From c4c8de746518933b6ec26c57840cf56119ea389c Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 14 Feb 2017 17:27:19 +0100 Subject: [PATCH 1/5] Add SDL2_image dependency --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index da9c74e..1815d41 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain make mingw-w64-x86_64- **Install SDL2 development packages** ``` -pacman -S --noconfirm --needed mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_mixer +pacman -S --noconfirm --needed mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-SDL2_image ``` **Install SDL_kitchensink dependencies** From 9bf4441cd82f70627454d7bfd51d9a14659f5c15 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 14 Feb 2017 17:27:43 +0100 Subject: [PATCH 2/5] Remove files that should not be in the repository --- src/action.cpp.orig | 2777 --------------------- src/action.h.orig | 22 - src/arrange.cpp.orig | 977 -------- src/blupi.cpp.orig | 640 ----- src/blupi.h.orig | 50 - src/button.cpp.orig | 440 ---- src/button.h.orig | 68 - src/chemin.cpp.orig | 369 --- src/decblupi.cpp.orig | 4914 ------------------------------------- src/decgoal.cpp.orig | 3549 --------------------------- src/decgoal.h.orig | 60 - src/decio.cpp.orig | 489 ---- src/decmap.cpp.orig | 545 ----- src/decmove.cpp.orig | 1119 --------- src/decmove.h.orig | 4 - src/decor.cpp.orig | 3498 --------------------------- src/decor.h.orig | 545 ----- src/decstat.cpp.orig | 1044 -------- src/def.h.orig | 621 ----- src/event.cpp.orig | 5371 ----------------------------------------- src/event.h.orig | 228 -- src/fifo.cpp.orig | 64 - src/fifo.h.orig | 33 - src/fog.cpp.orig | 152 -- src/jauge.cpp.orig | 150 -- src/jauge.h.orig | 44 - src/menu.cpp.orig | 496 ---- src/menu.h.orig | 54 - src/misc.cpp.orig | 121 - src/misc.h.orig | 17 - src/movie.cpp.orig | 293 --- src/movie.h.orig | 48 - src/obstacle.cpp.orig | 3640 ---------------------------- src/pixmap.cpp.orig | 708 ------ src/pixmap.h.orig | 76 - src/resource.h.orig | 278 --- src/sound.cpp.orig | 366 --- src/sound.h.orig | 61 - src/text.cpp.orig | 344 --- src/text.h.orig | 35 - 40 files changed, 34310 deletions(-) delete mode 100644 src/action.cpp.orig delete mode 100644 src/action.h.orig delete mode 100644 src/arrange.cpp.orig delete mode 100644 src/blupi.cpp.orig delete mode 100644 src/blupi.h.orig delete mode 100644 src/button.cpp.orig delete mode 100644 src/button.h.orig delete mode 100644 src/chemin.cpp.orig delete mode 100644 src/decblupi.cpp.orig delete mode 100644 src/decgoal.cpp.orig delete mode 100644 src/decgoal.h.orig delete mode 100644 src/decio.cpp.orig delete mode 100644 src/decmap.cpp.orig delete mode 100644 src/decmove.cpp.orig delete mode 100644 src/decmove.h.orig delete mode 100644 src/decor.cpp.orig delete mode 100644 src/decor.h.orig delete mode 100644 src/decstat.cpp.orig delete mode 100644 src/def.h.orig delete mode 100644 src/event.cpp.orig delete mode 100644 src/event.h.orig delete mode 100644 src/fifo.cpp.orig delete mode 100644 src/fifo.h.orig delete mode 100644 src/fog.cpp.orig delete mode 100644 src/jauge.cpp.orig delete mode 100644 src/jauge.h.orig delete mode 100644 src/menu.cpp.orig delete mode 100644 src/menu.h.orig delete mode 100644 src/misc.cpp.orig delete mode 100644 src/misc.h.orig delete mode 100644 src/movie.cpp.orig delete mode 100644 src/movie.h.orig delete mode 100644 src/obstacle.cpp.orig delete mode 100644 src/pixmap.cpp.orig delete mode 100644 src/pixmap.h.orig delete mode 100644 src/resource.h.orig delete mode 100644 src/sound.cpp.orig delete mode 100644 src/sound.h.orig delete mode 100644 src/text.cpp.orig delete mode 100644 src/text.h.orig diff --git a/src/action.cpp.orig b/src/action.cpp.orig deleted file mode 100644 index 2ba32ed..0000000 --- a/src/action.cpp.orig +++ /dev/null @@ -1,2777 +0,0 @@ -// Action.cpp -// - -#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 -{ - Sint16 action; - Sint16 channel; - Sint16 icons[8][MAXICON]; // nb, icones, - Sint16 moves[8][MAXMOVE]; // nb, nb, x,y, - Sint16 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(Sint16 action, Sint16 direct, - Sint16 &phase, Sint16 &step, - Sint16 &channel, Sint16 &icon, POINT &pos, Sint16 &posZ, - Sint16 &sound) -{ - DescAction* pTable = action_table; - Sint16 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 Sint16 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(Sint16 &icon, Sint16 direct) -{ - Sint16* pTable = rotate_table; - Sint16 i; - Sint16 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. - -Sint32 GetIconDirect(Sint16 icon) -{ - Sint16* pTable = rotate_table; - Sint16 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. - -Sint32 GetAmplitude(Sint16 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/src/action.h.orig b/src/action.h.orig deleted file mode 100644 index 6f4bec3..0000000 --- a/src/action.h.orig +++ /dev/null @@ -1,22 +0,0 @@ -// Action.h -// - -#pragma once - -#include "blupi.h" - -extern -bool Action(Sint16 action, Sint16 direct, - Sint16 &phase, Sint16 &step, - Sint16 &channel, Sint16 &icon, POINT &pos, Sint16 &posZ, - Sint16 &sound); - -extern -bool Rotate(Sint16 &icon, Sint16 direct); - -extern -Sint32 GetIconDirect(Sint16 icon); - -extern -Sint32 GetAmplitude(Sint16 action); - diff --git a/src/arrange.cpp.orig b/src/arrange.cpp.orig deleted file mode 100644 index 9cfc0b1..0000000 --- a/src/arrange.cpp.orig +++ /dev/null @@ -1,977 +0,0 @@ -// 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, Sint32 index) -{ - Sint32 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 ( Sint32 i=0 ; i<4 ; i++ ) - { - *pDst++ = *pSrc++; - } -} - -bool ChangeBits(char *pDst, char *pSrc) -{ - for ( Sint32 i=0 ; i<4 ; i++ ) - { - if ( *pDst++ != *pSrc++ ) return true; - } - return false; -} - -// Retourne l'icône correspondant aux bits d'eaux. - -Sint32 CDecor::GetSeeIcon(char *pBits, Sint32 index) -{ - Sint32 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; - Sint32 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, Sint32 &channel, Sint32 &icon) -{ - Sint32 index, i, x, y; - Sint32 first, last, matiere; - Sint32 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) -{ - Sint32 channel, icon; - Sint32 first, last; - Sint32 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; - Sint32 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, Sint32 channel, Sint32 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) -{ - Sint32 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, Sint32 channel, Sint32 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 == nullptr ) return; - memset(m_pFillMap, 0, MAXCELX*MAXCELY*sizeof(char)/4); - - ArrangeFillSearch(pos); - - for ( pos.x=0 ; pos.x -#include -#include "blupi.h" -#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 "misc.h" - - -// D�finitions globales - -#define NAME "Blupi" -#define TITLE "Blupi" - - -// Variables globales - -SDL_Window *g_window; -SDL_Renderer *g_renderer; -CEvent* g_pEvent = nullptr; -CPixmap* g_pPixmap = nullptr; // pixmap principal -CSound* g_pSound = nullptr; // sound principal -CMovie* g_pMovie = nullptr; // movie principal -CDecor* g_pDecor = nullptr; -bool g_bFullScreen = false; // false si mode de test -Sint32 g_speedRate = 1; -Sint32 g_timerInterval = 50; // inverval = 50ms -Sint32 g_mouseType = MOUSETYPEGRA; -bool g_bActive = true; // is application active ? -bool g_bTermInit = false; // initialisation en cours - -Uint32 g_lastPhase = 999; - - - - -// Lit un num�ro d�cimal. - -Sint32 GetNum(char *p) -{ - Sint32 n = 0; - - while ( *p >= '0' && *p <= '9' ) - { - n *= 10; - n += (*p++)-'0'; - } - - return n; -} - -// Lit le fichier de configuration. - -bool ReadConfig(Sint32 argc, char *argv[]) -{ - FILE* file = nullptr; - char buffer[200]; - char* pText; - size_t nb; - - const auto config = GetBaseDir () + "data/config.ini"; - - file = fopen(config.c_str (), "rb"); - if ( file == nullptr ) return false; - nb = fread(buffer, sizeof(char), 200-1, file); - buffer[nb] = 0; - fclose(file); - - pText = strstr(buffer, "SpeedRate="); - if ( pText != nullptr ) - { - 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 != nullptr ) - { - 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 != nullptr ) - { - g_bFullScreen = !!GetNum(pText+11); - if ( g_bFullScreen != 0 ) g_bFullScreen = 1; - } - - pText = strstr(buffer, "MouseType="); - if ( pText != nullptr ) - { - 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; - Uint32 phase; - POINT posMouse; - Sint32 i, term, speed; - - posMouse = g_pEvent->GetLastMousePos(); - - phase = g_pEvent->GetPhase(); - - if (!(phase == g_lastPhase && phase == WM_PHASE_PLAY)) - { - rcRect.left = 0; - rcRect.top = 0; - rcRect.right = LXIMAGE; - rcRect.bottom = LYIMAGE; - g_pPixmap->DrawImage(-1, CHBACK, rcRect); // 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� - } -} - - -void Benchmark() -{ - Sint32 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 == nullptr ) return false; - - g_pEvent->RestoreGame(); - return true; -} - -// Lib�re le jeu avant une d�sactivation en mode fullScreen. - -bool FlushGame() -{ - if ( g_pPixmap == nullptr ) return false; - - return g_pPixmap->Flush(); -} - - -// Finished with all objects we use; release them. - -static void FinishObjects(void) -{ - if ( g_pMovie != nullptr ) - { - delete g_pMovie; - g_pMovie = nullptr; - } - - if ( g_pEvent != nullptr ) - { - delete g_pEvent; - g_pEvent = nullptr; - } - - if ( g_pDecor != nullptr ) - { - delete g_pDecor; - g_pDecor = nullptr; - } - - if ( g_pSound != nullptr ) - { - g_pSound->StopMusic(); // stoppe la musique Midi - - delete g_pSound; - g_pSound = nullptr; - } - - if ( g_pPixmap != nullptr ) - { - delete g_pPixmap; - g_pPixmap = nullptr; - } -} - -void WindowProc2 (const SDL_Event &event) -{ - POINT totalDim, iconDim; - - if ( g_pEvent != nullptr && - g_pEvent->TreatEvent(event) ) - return; - - switch (event.type) - { - case SDL_WINDOWEVENT: - { - switch (event.window.event) - { - case SDL_WINDOWEVENT_FOCUS_GAINED: - 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); - } - SDL_SetWindowTitle (g_window, "Blupi"); - if (g_pSound != nullptr) g_pSound->RestartMusic (); - if (g_pMovie) - g_pMovie->Resume (); - return; - - case SDL_WINDOWEVENT_FOCUS_LOST: - if (g_bFullScreen) - { - FlushGame (); - } - SDL_SetWindowTitle (g_window, "Blupi -- stop"); - if (g_pSound != nullptr) g_pSound->SuspendMusic (); - if (g_pMovie) - g_pMovie->Pause (); - return; - } - break; - } - - case SDL_KEYDOWN: - switch (event.key.keysym.sym) - { - case SDLK_F5: - g_pEvent->SetSpeed (1); - break; - case SDLK_F6: - g_pEvent->SetSpeed (2); - break; - case SDLK_F7: - g_pEvent->SetSpeed (4); - break; - case SDLK_F8: - g_pEvent->SetSpeed (8); - break; - } - break; - - case SDL_USEREVENT: - { - switch (event.user.code) - { - case WM_UPDATE: - if (!g_pEvent->IsMovie ()) // pas de film en cours ? - { - if (g_bActive) - { - UpdateFrame (); - } - g_pPixmap->Display (); - } - break; - - case WM_MUSIC_STOP: - if (g_pSound->IsStoppedOnDemand ()) - break; - - g_pSound->RestartMusic (); - break; - - case WM_MOVIE_PLAY: - if (!g_pMovie->Render ()) - g_pEvent->StopMovie (); - break; - } - break; - } - } -} - -// Erreur dans DoInit. - -static bool InitFail(const 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, ")"); - - SDL_ShowSimpleMessageBox (SDL_MessageBoxFlags::SDL_MESSAGEBOX_ERROR, "Error", buffer, g_window); - - FinishObjects(); - return false; -} - -// Initialisation de l'application. - -static bool DoInit(Sint32 argc, char *argv[]) -{ - POINT totalDim, iconDim; - RECT rcRect; - bool bOK; - - bOK = ReadConfig(argc, argv); // lit le fichier config.ini - - auto res = SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER); - if (res < 0) - return false; - - // Create a window. - if ( g_bFullScreen ) - { - g_window = SDL_CreateWindow (NAME, 0, 0, LXIMAGE, LYIMAGE, SDL_WINDOW_FULLSCREEN); - } - else - { - g_window = SDL_CreateWindow (NAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, LXIMAGE, LYIMAGE, 0); - } - - if (!g_window) - { - printf (SDL_GetError ()); - return false; - } - - g_renderer = SDL_CreateRenderer (g_window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE | SDL_RENDERER_PRESENTVSYNC); - if (!g_renderer) - { - printf (SDL_GetError ()); - SDL_DestroyWindow (g_window); - return false; - } - - SDL_SetHint (SDL_HINT_RENDER_SCALE_QUALITY, "linear"); - - if ( !bOK ) // config.ini pas correct ? - { - return InitFail("Game not correctly installed", false); - } - - // Cr�e le pixmap principal. - g_pPixmap = new CPixmap; - if ( g_pPixmap == nullptr ) return InitFail("New pixmap", true); - - totalDim.x = LXIMAGE; - totalDim.y = LYIMAGE; - if ( !g_pPixmap->Create(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) ) -#else - if ( !g_pPixmap->Cache(CHBACK, "image/init.blp", totalDim, iconDim) ) -#endif - return false; - - 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) ) - return false; - - rcRect.left = 0; - rcRect.top = 0; - rcRect.right = LXIMAGE; - rcRect.bottom = LYIMAGE; - g_pPixmap->DrawImage(-1, CHBACK, rcRect); // 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) ) - return InitFail("Cache floor000.blp", true); - - totalDim.x = DIMOBJX*16; - totalDim.y = DIMOBJY*8; - iconDim.x = DIMOBJX; - iconDim.y = DIMOBJY; - if ( !g_pPixmap->Cache(CHOBJECT, "image/obj000.blp", totalDim, iconDim) ) - return InitFail("Cache obj000.blp", true); - - if ( !g_pPixmap->Cache(CHOBJECTo, "image/obj-o000.blp", totalDim, iconDim) ) - return InitFail("Cache obj-o000.blp", true); - - totalDim.x = DIMBLUPIX*16; - totalDim.y = DIMBLUPIY*23; - iconDim.x = DIMBLUPIX; - iconDim.y = DIMBLUPIY; - if ( !g_pPixmap->Cache(CHBLUPI, "image/blupi.blp", totalDim, iconDim) ) - return InitFail("Cache blupi.blp", true); - - totalDim.x = 64; - totalDim.y = 66; - iconDim.x = 64; - iconDim.y = 66/2; - if ( !g_pPixmap->Cache(CHHILI, "image/hili.blp", totalDim, iconDim) ) - return InitFail("Cache hili.blp", true); - - 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) ) - return InitFail("Cache fog.blp", true); - - 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) ) - return InitFail("Cache mask1.blp", true); - - totalDim.x = DIMBUTTONX*6; - totalDim.y = DIMBUTTONY*21; - iconDim.x = DIMBUTTONX; - iconDim.y = DIMBUTTONY; - if ( !g_pPixmap->Cache(CHBUTTON, "image/button00.blp", totalDim, iconDim) ) - return InitFail("Cache button00.blp", true); - - totalDim.x = DIMJAUGEX*1; - totalDim.y = DIMJAUGEY*4; - iconDim.x = DIMJAUGEX; - iconDim.y = DIMJAUGEY; - if ( !g_pPixmap->Cache(CHJAUGE, "image/jauge.blp", totalDim, iconDim) ) - return InitFail("Cache jauge.blp", true); - - 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) ) - return InitFail("Cache text.blp", true); - - totalDim.x = DIMLITTLEX*16; - totalDim.y = DIMLITTLEY*8; - iconDim.x = DIMLITTLEX; - iconDim.y = DIMLITTLEY; - if ( !g_pPixmap->Cache(CHLITTLE, "image/little.blp", totalDim, iconDim) ) - return InitFail("Cache little.blp", true); - - totalDim.x = 426; - totalDim.y = 52; - iconDim.x = 426; - iconDim.y = 52; - if ( !g_pPixmap->Cache(CHBIGNUM, "image/bignum.blp", totalDim, iconDim) ) - return InitFail("Cache bignum.blp", true); - - // Load all cursors - g_pPixmap->LoadCursors (); - g_pPixmap->ChangeSprite (SPRITE_WAIT); // met le sablier maison - - // Cr�e le gestionnaire de son. - g_pSound = new CSound; - if ( g_pSound == nullptr ) return InitFail("New sound", true); - - g_pSound->Create(); - g_pSound->CacheAll(); - g_pSound->SetState(true); - - // Cr�e le gestionnaire de films. - g_pMovie = new CMovie; - if ( g_pMovie == nullptr ) return InitFail("New movie", false); - - g_pMovie->Create(); - - // Cr�e le gestionnaire de d�cors. - g_pDecor = new CDecor; - if ( g_pDecor == nullptr ) return InitFail("New decor", false); - - g_pDecor->Create(g_pSound, g_pPixmap); - g_pDecor->MapInitColors(); - - // Cr�e le gestionnaire d'�v�nements. - g_pEvent = new CEvent; - if ( g_pEvent == nullptr ) return InitFail("New event", false); - - g_pEvent->Create(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. - -Sint32 main (Sint32 argc, char *argv[]) -{ - if (!DoInit(argc, argv)) - return -1; - - SDL_TimerID updateTimer = SDL_AddTimer (g_timerInterval, [] (Uint32 interval, void *param) -> Uint32 - { - CEvent::PushUserEvent (WM_UPDATE); - return interval; - }, nullptr); - - SDL_Event event; - while (SDL_WaitEvent (&event)) - { - WindowProc2 (event); - - if (event.type == SDL_QUIT) - break; - } - - if (g_window) - SDL_DestroyWindow (g_window); - - SDL_RemoveTimer (updateTimer); - FinishObjects (); - SDL_Quit (); - return 0; -} diff --git a/src/blupi.h.orig b/src/blupi.h.orig deleted file mode 100644 index 615f2fc..0000000 --- a/src/blupi.h.orig +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include -#include - -extern SDL_Window *g_window; -extern SDL_Renderer *g_renderer; - -struct POINT -{ - Sint32 x; - Sint32 y; -}; - -struct RECT -{ - Sint32 left; - Sint32 top; - Sint32 right; - Sint32 bottom; -}; - -typedef Uint32 COLORREF; - -#if defined(_WIN64) -typedef unsigned __int64 WPARAM; -typedef __int64 LPARAM; -#else -typedef Uint32 WPARAM; -typedef Sint32 LPARAM; -#endif - -#define LOWORD(l) ((Uint16)(((Uint32)(l)) & 0xffff)) -#define HIWORD(l) ((Uint16)((((Uint32)(l)) >> 16) & 0xffff)) - -#define MAX_PATH 260 - -#define VK_END 0x23 -#define VK_LEFT 0x25 -#define VK_UP 0x26 -#define VK_RIGHT 0x27 -#define VK_DOWN 0x28 - -#define WM_KEYDOWN 0x0100 -#define WM_KEYUP 0x0101 -#define WM_MOUSEMOVE 0x0200 -#define WM_LBUTTONDOWN 0x0201 -#define WM_LBUTTONUP 0x0202 -#define WM_RBUTTONDOWN 0x0204 -#define WM_RBUTTONUP 0x0205 diff --git a/src/button.cpp.orig b/src/button.cpp.orig deleted file mode 100644 index ccd983c..0000000 --- a/src/button.cpp.orig +++ /dev/null @@ -1,440 +0,0 @@ -// Button.cpp -// - -#include -#include -#include "gettext.h" -#include "def.h" -#include "pixmap.h" -#include "sound.h" -#include "decor.h" -#include "button.h" -#include "misc.h" -#include "event.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; - m_message = static_cast (-1); -} - -// Destructeur. - -CButton::~CButton() -{ -} - - -// Crée un nouveau bouton. - -bool CButton::Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, Sint32 type, bool bMinimizeRedraw, - Sint32 *pMenu, Sint32 nbMenu, - const char **pToolTips, - Sint32 region, Uint32 message) -{ - POINT iconDim; - Sint32 i, icon; - - static Sint32 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_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_selMenu = 0; - m_state = 0; - m_mouseState = 0; - m_bMouseDown = false; - m_bRedraw = true; - - m_nbToolTips = 0; - while (pToolTips[m_nbToolTips]) - ++m_nbToolTips; - - 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; -} - -Sint32 CButton::GetState() -{ - return m_state; -} - -void CButton::SetState(Sint32 state) -{ - if ( m_state != state || - m_mouseState != state ) - { - m_bRedraw = true; - } - - m_state = state; - m_mouseState = state; -} - -Sint32 CButton::GetMenu() -{ - return m_selMenu; -} - -void CButton::SetMenu(Sint32 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(const SDL_Event &event) -{ - POINT pos; - - if ( m_bHide || !m_bEnable ) return false; - - //pos = ConvLongToPos(lParam); - - switch (event.type) - { - case SDL_MOUSEBUTTONDOWN: - if ( event.button.button != SDL_BUTTON_LEFT - && event.button.button != SDL_BUTTON_RIGHT) - break; - - pos.x = event.button.x; - pos.y = event.button.y; - if ( MouseDown(pos) ) return true; - break; - - case SDL_MOUSEMOTION: - pos.x = event.motion.x; - pos.y = event.motion.y; - if ( MouseMove(pos) ) return true; - break; - - case SDL_MOUSEBUTTONUP: - if ( event.button.button != SDL_BUTTON_LEFT - && event.button.button != SDL_BUTTON_RIGHT) - break; - - pos.x = event.button.x; - pos.y = event.button.y; - 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. - -const char *CButton::GetToolTips(POINT pos) -{ - Sint32 width = m_dim.x; - Sint32 rank; - - if (m_bHide || !m_bEnable) - return nullptr; - - 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 nullptr; - - rank = (pos.x-(m_pos.x+2+1))/(m_dim.x-1); - if ( rank < 0 ) rank = 0; - if (rank > m_nbToolTips) - return nullptr; - - if ( m_nbMenu > 1 ) - { - if ( m_bMouseDown && rank > 0 ) - { - rank --; - } - else - { - rank = m_selMenu; - } - } - - return gettext (m_toolTips[rank]); -} - - -// Détecte si la souris est dans le bouton. - -bool CButton::Detect(POINT pos) -{ - Sint32 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; - CEvent::PushUserEvent (WM_UPDATE); - - m_pSound->PlayImage(SOUND_CLICK, pos); - return true; -} - -// Souris déplacés. - -bool CButton::MouseMove(POINT pos) -{ - bool bDetect; - Sint32 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; - CEvent::PushUserEvent (WM_UPDATE); - } - - 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 != static_cast (-1) ) - { - CEvent::PushUserEvent (m_message); - } - - return true; -} - - diff --git a/src/button.h.orig b/src/button.h.orig deleted file mode 100644 index a7476bf..0000000 --- a/src/button.h.orig +++ /dev/null @@ -1,68 +0,0 @@ -// Button.h - -#pragma once - -#include - -///////////////////////////////////////////////////////////////////////////// - -class CButton -{ -public: - CButton(); - ~CButton(); - - bool Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, Sint32 type, bool bMinimizeRedraw, - Sint32 *pMenu, Sint32 nbMenu, - const char **pToolTips, - Sint32 region, Uint32 message); - void Draw(); - void Redraw(); - - Sint32 GetState(); - void SetState(Sint32 state); - - Sint32 GetMenu(); - void SetMenu(Sint32 menu); - - bool GetEnable(); - void SetEnable(bool bEnable); - - bool GetHide(); - void SetHide(bool bHide); - - bool TreatEvent(const SDL_Event &event); - bool MouseOnButton(POINT pos); - const char *GetToolTips(POINT pos); - - -protected: - bool Detect(POINT pos); - bool MouseDown(POINT pos); - bool MouseMove(POINT pos); - bool MouseUp(POINT pos); - -protected: - CPixmap* m_pPixmap; - CDecor* m_pDecor; - CSound* m_pSound; - Sint32 m_type; // type de bouton - bool m_bEnable; // true si bouton actif - bool m_bHide; // true si bouton caché - Uint32 m_message; // message envoyé si bouton actionné - POINT m_pos; // coin sup/gauche - POINT m_dim; // dimensions - Sint32 m_state; // 0=relâché, 1=pressé, +2=survollé - Sint32 m_mouseState; // 0=relâché, 1=pressé, +2=survollé - Sint32 m_iconMenu[20]; // icônes du sous-menu - const char **m_toolTips; // info-bulles - Sint32 m_nbMenu; // nb de case du sous-menu - Sint32 m_nbToolTips; // nb d'info-bulles - Sint32 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/src/chemin.cpp.orig b/src/chemin.cpp.orig deleted file mode 100644 index ae0111a..0000000 --- a/src/chemin.cpp.orig +++ /dev/null @@ -1,369 +0,0 @@ -// 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(Sint32 exRank) -{ - Sint32 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(Sint32 rank) -{ - Sint32 pos, last, dest, dist; - Sint32 step, dir, cout, action, max, next, ampli; - Sint32 dx, dy; - Sint32 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 (Sint32 i=1; i -#include "gettext.h" -#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é. -Sint16 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() -{ - Sint32 i; - - memset(m_blupi, 0, sizeof(Blupi)*MAXBLUPI); - - for ( i=0 ; i= 0, supprime seulement ce personnage. - -bool CDecor::BlupiDelete(POINT cel, Sint32 perso) -{ - Sint32 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(Sint32 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(Sint32 exRank, POINT cel, Sint32 type) -{ - Sint32 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(Sint32 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(Sint32 cheat) -{ - Sint32 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(Sint32 rank, Sint32 sound, POINT pos, bool bStop) -{ - Sint32 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 Sint16 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(Sint32 rank, Sint32 action, Sint32 direct) -{ - Sint16* pTable = tableSound; - POINT pos; - Sint32 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(Sint32 rank, Sint32 action, Sint32 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(Sint32 rank) -{ - Sint32 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(Sint32 rank) -{ - Sint32 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(Sint32 rank, Sint32 button, - POINT &cel, POINT &cMem, Sint32 param, Sint32 list) -{ - Sint32 i, channel, icon, icon1, icon2, flags; - POINT test; - - static Sint32 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 Sint32 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(Sint32 rank, Sint32 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(Sint32 rank) -{ - Sint16* pTable; - Sint32 i, nb; - - if ( m_blupi[rank].goalAction == 0 ) return false; - - pTable = GetTableGoal(m_blupi[rank].goalAction); - if ( pTable == nullptr ) - { - 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(Sint32 rank) -{ - POINT cel; - Sint32 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(Sint32 rank, Sint32 &x, Sint32 &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. - -Sint32 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(Sint32 rank, Sint16 *pTable) -{ - Sint32 op, x, y; - Sint32 action, direct, channel, icon, mchannel, micon; - Sint32 total, step, delai, first, last, first2, last2, flag, i; - Sint32 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 ) - { - 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 ) - { - 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(Sint32 rank) -{ - Sint32 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(Sint32 rank) -{ - bool bOK; - POINT pos, iCel; - Sint32 a, min; - Sint16 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(Sint32 rank) -{ - Sint32 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(Sint32 rank) -{ - Sint32 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) -{ - Sint32 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 - Sint32 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(Sint32 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) -{ - Sint32 rank, r, nb, sound; - bool bEnerve = false; - POINT c1, c2; - - static Sint32 table_sound_ok[6] = - { - SOUND_OK1, - SOUND_OK2, - SOUND_OK3, - SOUND_OK4, - SOUND_OK5, - SOUND_OK6, - }; - - static Sint32 table_sound_okf[3] = // si fatigué - { - SOUND_OK1f, - SOUND_OK2f, - SOUND_OK3f, - }; - - static Sint32 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. - -Sint32 CDecor::GetDefButton(POINT cel) -{ - Sint32 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é à Sint32 terme, pour un blupi donné. - -bool CDecor::BlupiGoal(Sint32 rank, Sint32 button, POINT cel, POINT cMem) -{ - POINT goalHili, goalHili2, goal, test; - Sint32 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 = static_cast (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é à Sint32 terme, pour tous les blupi -// sélectionnés. - -void CDecor::BlupiGoal(POINT cel, Sint32 button) -{ - POINT bPos, avg; - Sint32 rank, nb, nbHili; - - static Sint32 table_sound_go[6] = - { - SOUND_GO1, - SOUND_GO2, - SOUND_GO3, - SOUND_GO4, - SOUND_GO5, - SOUND_GO6, - }; - - static Sint32 table_sound_gom[3] = - { - SOUND_GO4, - SOUND_GO5, - SOUND_GO6, - }; - - static Sint32 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) -{ - Sint32 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, Sint32 exRank, bool bSkipInMove) -{ - Sint32 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(Sint32 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, Sint32 &nb, - Sint32 *pButtons, Sint32 *pErrors, - std::unordered_map &texts, Sint32 &perso) -{ - Sint32* pB = pButtons; - Sint32* pE = pErrors; - POINT cel, cel2; - Sint32 i, rank, button, error, channel, icon; - bool bBuild = false; - bool bPut; - const char *textForButton; - - static Sint32 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] = 500; - texts[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. - -Sint32 CDecor::IsTerminated() -{ - Sint32 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/src/decgoal.cpp.orig b/src/decgoal.cpp.orig deleted file mode 100644 index ade053e..0000000 --- a/src/decgoal.cpp.orig +++ /dev/null @@ -1,3549 +0,0 @@ -// DecGoal.cpp - -#include "decgoal.h" -#include "def.h" -#include "decor.h" - -Sint16 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 Sint16 table_goal_go[] = -{ - WM_ACTION_GO, - GOAL_GOHILI, 0,0, false, - GOAL_TERM, - 0 -}; - -// Blupi va dans sa maison. -static Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 table_goal_repeat[] = -{ - WM_ACTION_REPEAT, - GOAL_TERM, - 0 -}; - -// Blupi se téléporte d'un endroit à un autre. -static Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16* 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, - nullptr -}; - -// Retourne le pointeur à la table table_goal_*. - -Sint16* GetTableGoal(Sint32 action) -{ - Sint16** ppTable = table_pGoal; - - while ( *ppTable != nullptr ) - { - if ( **ppTable == action ) - { - return *ppTable+1; // après WM_ACTION_* - } - - ppTable ++; - } - - return nullptr; -} - diff --git a/src/decgoal.h.orig b/src/decgoal.h.orig deleted file mode 100644 index 4ae86b9..0000000 --- a/src/decgoal.h.orig +++ /dev/null @@ -1,60 +0,0 @@ - -#pragma once - -#include - -// 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 - -Sint16* GetTableGoal (Sint32 action); -extern Sint16 table_goal_nbop[]; diff --git a/src/decio.cpp.orig b/src/decio.cpp.orig deleted file mode 100644 index f5af3f3..0000000 --- a/src/decio.cpp.orig +++ /dev/null @@ -1,489 +0,0 @@ -// DecIO.cpp -// - -#include "def.h" -#include "decor.h" -#include "misc.h" - -typedef struct -{ - Sint16 majRev; - Sint16 minRev; - Sint32 nbDecor; - Sint32 lgDecor; - Sint32 nbBlupi; - Sint32 lgBlupi; - Sint32 nbMove; - Sint32 lgMove; - Sint16 reserve1[100]; - POINT celCoin; - Sint16 world; - Sint32 time; - char buttonExist[MAXBUTTON]; - Term term; - Sint16 music; - Sint16 region; - Sint32 totalTime; - Sint16 skill; - POINT memoPos[4]; - Sint16 reserve2[29]; -} -DescFile; - -typedef struct -{ - Sint32 bExist; // true -> utilisé - Sint32 bHili; // true -> sélectionné - - Sint16 perso; // personnage, voir (*) - - Sint16 goalAction; // action (Sint32 terme) - Sint16 goalPhase; // phase (Sint32 terme) - POINT goalCel; // cellule visée (Sint32 terme) - POINT passCel; // cellule tranversante - - Sint16 energy; // énergie restante - - POINT cel; // cellule actuelle - POINT destCel; // cellule destination - Sint16 action; // action en cours - Sint16 aDirect; // direction actuelle - Sint16 sDirect; // direction souhaitée - - POINT pos; // position relative à partir de la cellule - Sint16 posZ; // déplacement z - Sint16 channel; - Sint16 lastIcon; - Sint16 icon; - Sint16 phase; // phase dans l'action - Sint16 step; // pas global - Sint16 interrupt; // 0=prioritaire, 1=normal, 2=misc - Sint16 clipLeft; - - Sint32 nbUsed; // nb de points déjà visités - char nextRankUsed; - POINT posUsed[MAXUSED]; - char rankUsed[MAXUSED]; - - Sint16 takeChannel; // objet transporté - Sint16 takeIcon; - - POINT fix; // point fixe (cultive, pont) - - Sint16 jaugePhase; - Sint16 jaugeMax; - Sint16 stop; // 1 -> devra stopper - Sint16 bArrow; // true -> flèche en dessus de blupi - Sint16 bRepeat; // true -> répète l'action - Sint16 nLoop; // nb de boucles pour GOAL_OTHERLOOP - Sint16 cLoop; // boucle en cours - Sint16 vIcon; // icône variable - POINT goalHili; // but visé - Sint16 bMalade; // true -> blupi malade - Sint16 bCache; // true -> caché (pas dessiné) - Sint16 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(Sint32 rank, bool bUser, Sint32 world, Sint32 time, Sint32 total) -{ - char filename[MAX_PATH]; - FILE* file = nullptr; - DescFile* pBuffer = nullptr; - Sint32 i; - size_t nb; - - if ( bUser ) - { - sprintf(filename, "data/user%.3d.blp", rank); - AddUserPath(filename); - } - else - { - sprintf(filename, "data/world%.3d.blp", rank); - } - - file = fopen(filename, "wb"); - if ( file == nullptr ) goto error; - - pBuffer = (DescFile*)malloc(sizeof(DescFile)); - if ( pBuffer == nullptr ) 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 != nullptr ) free(pBuffer); - if ( file != nullptr ) fclose(file); - return false; -} - -// Lit le décor sur disque. - -bool CDecor::Read(Sint32 rank, bool bUser, Sint32 &world, Sint32 &time, Sint32 &total) -{ - char filename[MAX_PATH]; - FILE* file = nullptr; - DescFile* pBuffer = nullptr; - Sint32 majRev, minRev; - Sint32 i, x, y; - size_t nb; - OldBlupi oldBlupi; - - Init(-1, -1); - - if ( bUser ) - { - sprintf(filename, "data/user%.3d.blp", rank); - AddUserPath(filename); - } - else - { - sprintf(filename, (GetBaseDir () + "data/world%.3d.blp").c_str (), rank); - } - - file = fopen(filename, "rb"); - if ( file == nullptr ) goto error; - - pBuffer = (DescFile*)malloc(sizeof(DescFile)); - if ( pBuffer == nullptr ) 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 != nullptr ) free(pBuffer); - if ( file != nullptr ) fclose(file); - return false; -} - - -#define MARG 18 - -// Initialise un décor neutre. - -void CDecor::Flush() -{ - Sint32 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 ; i= 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; - Sint32 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: - for ( i=0 ; i<4 ; i++ ) - { - if ( pos.x+i >= 0 && pos.x+i < DIMMAPX ) - { - icon = *pColors++; - if ( icon != 0 ) - { - g_map32_bits[pos.y][pos.x+i] = m_colors[icon]; - } - } - } -} - - -// Génère la carte. - -bool CDecor::GenerateMap() -{ - POINT dim, pos, cel; - Sint32 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; - - g_map32_bits[pos.y+0][pos.x+0] = m_colors[i]; - g_map32_bits[pos.y+0][pos.x+1] = m_colors[i]; - g_map32_bits[pos.y+1][pos.x+0] = m_colors[i]; - g_map32_bits[pos.y+1][pos.x+1] = m_colors[i]; - } - } - } - - // Dessine le cadre. - cel = m_celCoin; - pos = ConvCelToMap(cel); - - for ( i=pos.x ; iCache(CHMAP, surface, dim); - - pos.x = POSMAPX; - pos.y = POSMAPY; - m_pPixmap->DrawIcon(-1, CHMAP, 0, pos); - - SDL_FreeSurface (surface); - return true; -} - diff --git a/src/decmove.cpp.orig b/src/decmove.cpp.orig deleted file mode 100644 index 73167c1..0000000 --- a/src/decmove.cpp.orig +++ /dev/null @@ -1,1119 +0,0 @@ -// DecMove.cpp -// - -#include "decor.h" -#include "misc.h" -#include "decmove.h" - -// Mouvement pour secouer un arbre -// (synchrone avec ACTION_PIOCHE). -static Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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, -}; - -Sint16* GetListMoves(Sint32 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 nullptr; -} - - -// Petites flammes. -static Sint16 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 Sint16 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 Sint16 table_icon3[] = -{ - 4, // nb - 53,54,55,56, -}; - -// Eclairs n-s entre les tours. -static Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 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 Sint16 table_icon11[] = -{ - 4, // nb - 81,82,83,84, -}; - -Sint16* GetListIcons(Sint32 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 nullptr; -} - - - - -// Supprime tous les décors animés. - -void CDecor::MoveFlush() -{ - Sint32 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() -{ - Sint32 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, Sint32 rankBlupi, bool bFloor, - Sint32 channel, Sint32 icon, - Sint32 maskChannel, Sint32 maskIcon, - Sint32 total, Sint32 delai, Sint32 stepY, - bool bMisc, bool bNotIfExist) -{ - Sint32 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, Sint32 rankMoves) -{ - Sint32 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) -{ - Sint32 cx, cy, xx, yy, x, y, channel, icon; - - static Sint16 tableInd[5] = {2,1,3,0,4}; - static Sint16 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(Sint32 rank) -{ - Sint32 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) -{ - Sint32 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) -{ - Sint32 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(Sint32 rankBlupi) -{ - Sint32 rank; - - for ( rank=0 ; rank -#include -#include -#include "gettext.h" -#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(Sint32 x, Sint32 y) -{ - POINT cel; - - cel.x = x; - cel.y = y; - - return cel; -} - -POINT GetCel(POINT cel, Sint32 x, Sint32 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(Sint32 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_pSound = nullptr; - m_pUndoDecor = nullptr; - - 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(CSound *pSound, CPixmap *pPixmap) -{ - m_pSound = pSound; - m_pPixmap = pPixmap; - m_bOutline = false; -} - -// Initialise le décor avec un sol plat partout. - -void CDecor::Init(Sint32 channel, Sint32 icon) -{ - Sint32 x, y; - - for ( x=0 ; xCache(CHFLOOR, filename, totalDim, iconDim) ) - return false; - - 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) ) - return false; - - sprintf(filename, "image/obj-o%.3d.blp", m_region); - if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim) ) - return false; - - MapInitColors(); // init les couleurs pour la carte - - m_bGroundRedraw = true; - return true; -} - -// Met partout du brouillard, sauf aux endroits des blupi. - -void CDecor::ClearFog() -{ - Sint32 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, Sint32 channel, Sint32 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, Sint32 channel, Sint32 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, Sint32 &channel, Sint32 &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, Sint32 &channel, Sint32 &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() -{ - Sint32 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(Sint32 x, Sint32 y, POINT pos, Sint32 rank) -{ - Sint32 icon, nb; - Sint16* 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, 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(Sint32 x, Sint32 y, POINT pos, Sint32 rank) -{ - Sint32 hBuild, offset, startY, endY; - Sint32 channel, icon, nb; - Sint16* 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(Sint32 icon, POINT &pos) -{ - pos.x -= DIMCELX/2; - pos.y -= 96; - - static Sint32 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 Sint32 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"); - Sint32 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) -{ - Sint32 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 Sint32 table_eau[6] = - { - 70,68,14,69,14,68 - }; - static Sint32 table_random_x[10] = - { - 2,5,1,9,4,0,6,3,8,7 - }; - static Sint32 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); - - 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 ) - { - const auto text = GetResHili(posMouse); - if (text) - { - posMouse.x += 10; - posMouse.y += 20; - DrawText(m_pPixmap, posMouse, 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(Sint32 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(Sint32 total) -{ - m_totalTime = total; -} - -// Retourne le temps total passé dans cette partie. - -Sint32 CDecor::GetTotalTime() -{ - return m_totalTime; -} - - -// Compte le nombre total de sols contenus dans les décors. - -Sint32 CDecor::CountFloor(Sint32 channel, Sint32 icon) -{ - Sint32 x, y; - Sint32 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. - -Sint32 CDecor::CelOkForAction(POINT cel, Sint32 action, Sint32 rank) -{ - Sint32 icons[4][4]; - POINT celOutline1, celOutline2; - - return CelOkForAction(cel, action, rank, icons, - celOutline1, celOutline2); -} - -// Retourne le rang du nième blupi sélectionné. - -Sint32 CDecor::GetHiliRankBlupi(Sint32 nb) -{ - Sint32 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(Sint32 list) -{ - Sint32 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. - -const char *CDecor::GetResHili(POINT posMouse) -{ - Sint32 icon; - - // Les valeurs `corner == true` correspondent aux objets placés - // au coin inf/droit de la cellule. - struct object_t - { - bool corner; - const char *text; - }; - - static const std::unordered_map tableObject = { - { 6, { false, translate ("Tree") } }, - { 7, { false, translate ("Tree") } }, - { 8, { false, translate ("Tree") } }, - { 9, { false, translate ("Tree") } }, - { 10, { false, translate ("Tree") } }, - { 11, { false, translate ("Tree") } }, - { 12, { false, translate ("Enemy rocket") } }, - { 14, { false, translate ("Platinium") } }, - { 16, { true, translate ("Armour") } }, - { 20, { false, translate ("Wall") } }, - { 21, { false, translate ("Wall") } }, - { 22, { false, translate ("Wall") } }, - { 23, { false, translate ("Wall") } }, - { 24, { false, translate ("Wall") } }, - { 25, { false, translate ("Wall") } }, - { 26, { false, translate ("Wall") } }, - { 27, { false, translate ("Protection tower") } }, - { 28, { false, translate ("Laboratory") } }, - { 29, { false, translate ("Laboratory") } }, - { 30, { false, translate ("Tree trunks") } }, - { 31, { false, translate ("Tree trunks") } }, - { 32, { false, translate ("Tree trunks") } }, - { 33, { false, translate ("Tree trunks") } }, - { 34, { false, translate ("Tree trunks") } }, - { 35, { false, translate ("Tree trunks") } }, - { 36, { true, translate ("Planks") } }, - { 37, { false, translate ("Rocks") } }, - { 38, { false, translate ("Rocks") } }, - { 39, { false, translate ("Rocks") } }, - { 40, { false, translate ("Rocks") } }, - { 41, { false, translate ("Rocks") } }, - { 42, { false, translate ("Rocks") } }, - { 43, { false, translate ("Rocks") } }, - { 44, { true, translate ("Stones") } }, - { 45, { false, translate ("Fire") } }, - { 46, { false, translate ("Fire") } }, - { 47, { false, translate ("Fire") } }, - { 48, { false, translate ("Fire") } }, - { 49, { false, translate ("Fire") } }, - { 50, { false, translate ("Fire") } }, - { 51, { false, translate ("Fire") } }, - { 52, { false, translate ("Fire") } }, - { 57, { true, translate ("Tomatoes") } }, - { 58, { true, translate ("Tomatoes") } }, - { 59, { true, translate ("Tomatoes") } }, - { 60, { true, translate ("Tomatoes") } }, - { 61, { false, translate ("Garden shed") } }, - { 62, { false, translate ("Garden shed") } }, - { 63, { true, translate ("Eggs") } }, - { 64, { false, translate ("Eggs") } }, - { 65, { false, translate ("Palisade") } }, - { 66, { false, translate ("Palisade") } }, - { 67, { false, translate ("Palisade") } }, - { 68, { false, translate ("Palisade") } }, - { 69, { false, translate ("Palisade") } }, - { 70, { false, translate ("Palisade") } }, - { 71, { false, translate ("Palisade") } }, - { 72, { false, translate ("Bridge") } }, - { 73, { false, translate ("Bridge") } }, - { 80, { true, translate ("Medical potion") } }, - { 81, { false, ptranslate ("Flower|1|", "Flowers") } }, - { 82, { true, ptranslate ("Flower|1|", "Bunch of flowers") } }, - { 83, { false, ptranslate ("Flower|2|", "Flowers") } }, - { 84, { true, ptranslate ("Flower|2|", "Bunch of flowers") } }, - { 85, { true, translate ("Dynamite") } }, - { 86, { true, translate ("Dynamite") } }, - { 87, { true, translate ("Dynamite") } }, - { 92, { true, translate ("Poison") } }, - { 93, { true, translate ("Sticky trap") } }, - { 94, { false, ptranslate ("Flower|3|", "Flowers") } }, - { 95, { true, ptranslate ("Flower|3|", "Bunch of flowers") } }, - { 96, { true, translate ("Trapped enemy") } }, - { 97, { true, translate ("Trapped enemy") } }, - { 98, { true, translate ("Trapped enemy") } }, - { 99, { false, translate ("Enemy construction") } }, - { 100, { false, translate ("Enemy construction") } }, - { 101, { false, translate ("Enemy construction") } }, - { 102, { false, translate ("Enemy construction") } }, - { 103, { false, translate ("Enemy construction") } }, - { 104, { false, translate ("Enemy construction") } }, - { 105, { false, translate ("Enemy construction") } }, - { 106, { false, translate ("Enemy construction") } }, - { 107, { false, translate ("Enemy construction") } }, - { 108, { false, translate ("Enemy construction") } }, - { 109, { false, translate ("Enemy construction") } }, - { 110, { false, translate ("Enemy construction") } }, - { 111, { false, translate ("Enemy construction") } }, - { 112, { false, translate ("Enemy construction") } }, - { 113, { false, translate ("Blupi's house") } }, - { 114, { true, translate ("Trapped enemy") } }, - { 115, { false, translate ("Enemy construction") } }, - { 116, { false, translate ("Enemy construction") } }, - { 117, { true, translate ("Boat") } }, - { 118, { true, translate ("Jeep") } }, - { 119, { false, translate ("Workshop") } }, - { 120, { false, translate ("Workshop") } }, - { 121, { false, translate ("Mine") } }, - { 122, { false, translate ("Mine") } }, - { 123, { true, translate ("Iron") } }, - { 124, { false, translate ("Flag") } }, - { 125, { true, translate ("Time bomb") } }, - { 126, { false, translate ("Mine") } }, - { 127, { true, translate ("Time bomb") } }, - { 128, { false, translate ("Enemy construction") } }, - { 129, { false, translate ("Enemy construction") } }, - { 130, { true, translate ("Trapped enemy") } }, - }; - - static const std::unordered_map tableFloor = { - { 1, { false, translate ("Normal ground") } }, - { 2, { false, translate ("Bank") } }, - { 3, { false, translate ("Bank") } }, - { 4, { false, translate ("Bank") } }, - { 5, { false, translate ("Bank") } }, - { 6, { false, translate ("Bank") } }, - { 7, { false, translate ("Bank") } }, - { 8, { false, translate ("Bank") } }, - { 9, { false, translate ("Bank") } }, - { 10, { false, translate ("Bank") } }, - { 11, { false, translate ("Bank") } }, - { 12, { false, translate ("Bank") } }, - { 13, { false, translate ("Bank") } }, - { 14, { false, translate ("Water") } }, - { 15, { false, translate ("Paving stones") } }, - { 16, { false, translate ("Paving stones") } }, - { 17, { false, translate ("Striped paving stones") } }, - { 18, { false, translate ("Ice") } }, - { 19, { false, translate ("Burnt ground") } }, - { 20, { false, translate ("Inflammable ground") } }, - { 21, { false, translate ("Miscellaneous ground") } }, - { 22, { false, translate ("Miscellaneous ground") } }, - { 23, { false, translate ("Miscellaneous ground") } }, - { 24, { false, translate ("Miscellaneous ground") } }, - { 25, { false, translate ("Miscellaneous ground") } }, - { 26, { false, translate ("Miscellaneous ground") } }, - { 27, { false, translate ("Miscellaneous ground") } }, - { 28, { false, translate ("Miscellaneous ground") } }, - { 29, { false, translate ("Miscellaneous ground") } }, - { 30, { false, translate ("Miscellaneous ground") } }, - { 31, { false, translate ("Miscellaneous ground") } }, - { 32, { false, translate ("Miscellaneous ground") } }, - { 33, { false, translate ("Sterile ground") } }, - { 34, { false, translate ("Miscellaneous ground") } }, - { 35, { false, translate ("Miscellaneous ground") } }, - { 36, { false, translate ("Miscellaneous ground") } }, - { 37, { false, translate ("Miscellaneous ground") } }, - { 38, { false, translate ("Miscellaneous ground") } }, - { 39, { false, translate ("Miscellaneous ground") } }, - { 40, { false, translate ("Miscellaneous ground") } }, - { 41, { false, translate ("Miscellaneous ground") } }, - { 42, { false, translate ("Miscellaneous ground") } }, - { 43, { false, translate ("Miscellaneous ground") } }, - { 44, { false, translate ("Miscellaneous ground") } }, - { 45, { false, translate ("Miscellaneous ground") } }, - { 46, { false, translate ("Sterile ground") } }, - { 47, { false, translate ("Sterile ground") } }, - { 48, { false, translate ("Sterile ground") } }, - { 49, { false, translate ("Normal ground") } }, - { 50, { false, translate ("Normal ground") } }, - { 51, { false, translate ("Normal ground") } }, - { 52, { false, translate ("Incubator") } }, - { 53, { false, translate ("Incubator") } }, - { 54, { false, translate ("Incubator") } }, - { 55, { false, translate ("Incubator") } }, - { 56, { false, translate ("Incubator") } }, - { 57, { false, translate ("Normal ground") } }, - { 58, { false, translate ("Inflammable ground") } }, - { 59, { false, translate ("Bridge") } }, - { 60, { false, translate ("Bridge") } }, - { 61, { false, translate ("Bridge") } }, - { 62, { false, translate ("Bridge") } }, - { 63, { false, translate ("Bridge") } }, - { 64, { false, translate ("Bridge") } }, - { 65, { false, translate ("Enemy ground") } }, - { 66, { false, translate ("Miscellaneous ground") } }, - { 67, { false, translate ("Enemy ground") } }, - { 68, { false, translate ("Water") } }, - { 69, { false, translate ("Water") } }, - { 70, { false, translate ("Water") } }, - { 71, { false, translate ("Sterile ground") } }, - { 78, { false, translate ("Miscellaneous ground") } }, - { 79, { false, translate ("Miscellaneous ground") } }, - { 80, { false, translate ("Teleporter") } }, - { 81, { false, translate ("Teleporter") } }, - { 82, { false, translate ("Teleporter") } }, - { 83, { false, translate ("Teleporter") } }, - { 84, { false, translate ("Teleporter") } }, - }; - - if (m_bHideTooltips) - return nullptr; // rien si menu présent - - if ( posMouse.x < POSDRAWX - || posMouse.x > POSDRAWX + DIMDRAWX - || posMouse.y < POSDRAWY - || posMouse.y > POSDRAWY + DIMDRAWY) - return nullptr; - - if ( m_celHili.x != -1 ) - { - if ( m_rankHili != -1 ) // blupi visé ? - { - switch (m_blupi[m_rankHili].perso) - { - case 0: // blupi ? - if (m_blupi[m_rankHili].energy <= MAXENERGY / 4) - return gettext ("Tired Blupi"); - if (m_blupi[m_rankHili].bMalade) - return gettext ("Sick Blupi"); - return gettext ("Blupi"); - case 1: // araignée ? - return gettext ("Spider"); - case 2: // virus ? - return gettext ("Virus"); - case 3: // tracks ? - return gettext ("Bulldozer"); - case 4: // robot ? - return gettext ("Master robot"); - case 5: // bombe ? - return gettext ("Bouncing bomb"); - case 7: // electro ? - return gettext ("Electrocutor"); - case 8: // disciple ? - return gettext ("Helper robot"); - } - - return nullptr; - } - - icon = m_decor[m_celHili.x/2][m_celHili.y/2].objectIcon; - if (icon != -1) - { - const auto obj = tableObject.find (icon); - if (obj != tableObject.end ()) - { - if (!obj->second.corner) - return obj->second.text; - - if ( m_celHili.x % 2 - && m_celHili.y % 2) - return gettext (obj->second.text); - } - } - - icon = m_decor[m_celHili.x/2][m_celHili.y/2].floorIcon; - if (icon != -1) - { - const auto obj = tableFloor.find (icon); - if (obj != tableFloor.end ()) - return gettext (obj->second.text); - } - } - - return nullptr; -} - -// 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(Sint32 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(Sint32 time) -{ - m_time = time; - m_timeConst = time; // vraiment ? - m_timeFlipOutline = time; -} - -Sint32 CDecor::GetTime() -{ - return m_time; -} - - -// Gestion de la musique midi. - -void CDecor::SetMusic(Sint32 music) -{ - m_music = music; -} - -Sint32 CDecor::GetMusic() -{ - return m_music; -} - - -// Gestion de la difficulté. - -void CDecor::SetSkill(Sint32 skill) -{ - m_skill = skill; -} - -Sint32 CDecor::GetSkill() -{ - return m_skill; -} - - -// Gestion de la région. -// 0 = normal -// 1 = palmier -// 2 = hiver -// 3 = sapin - -void CDecor::SetRegion(Sint32 region) -{ - m_region = region; -} - -Sint32 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(Sint32 height) -{ - m_infoHeight = height; - m_bGroundRedraw = true; // faudra redessiner les sols -} - -Sint32 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 == nullptr ) - { - 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 != nullptr ) - { - free(m_pUndoDecor); - m_pUndoDecor = nullptr; - } -} - -// 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 != nullptr ) - { - 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 != nullptr ) - { - 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 != nullptr ); -} diff --git a/src/decor.h.orig b/src/decor.h.orig deleted file mode 100644 index 1cad40b..0000000 --- a/src/decor.h.orig +++ /dev/null @@ -1,545 +0,0 @@ -// 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 -{ - Sint16 floorChannel; - Sint16 floorIcon; - Sint16 objectChannel; - Sint16 objectIcon; - Sint16 fog; // brouillard - Sint16 rankMove; // rang dans m_move - Sint16 workBlupi; // rang du blupi travaillant ici - Sint16 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 -{ - Sint32 bExist; // true -> utilisé - Sint32 bHili; // true -> sélectionné - - Sint16 perso; // personnage, voir (*) - - Sint16 goalAction; // action (Sint32 terme) - Sint16 goalPhase; // phase (Sint32 terme) - POINT goalCel; // cellule visée (Sint32 terme) - POINT passCel; // cellule tranversante - - Sint16 energy; // énergie restante - - POINT cel; // cellule actuelle - POINT destCel; // cellule destination - Sint16 action; // action en cours - Sint16 aDirect; // direction actuelle - Sint16 sDirect; // direction souhaitée - - POINT pos; // position relative à partir de la cellule - Sint16 posZ; // déplacement z - Sint16 channel; - Sint16 lastIcon; - Sint16 icon; - Sint16 phase; // phase dans l'action - Sint16 step; // pas global - Sint16 interrupt; // 0=prioritaire, 1=normal, 2=misc - Sint16 clipLeft; - - Sint32 nbUsed; // nb de points déjà visités - char nextRankUsed; - POINT posUsed[MAXUSED]; - char rankUsed[MAXUSED]; - - Sint16 takeChannel; // objet transporté - Sint16 takeIcon; - - POINT fix; // point fixe (cultive, pont) - - Sint16 jaugePhase; - Sint16 jaugeMax; - Sint16 stop; // 1 -> devra stopper - Sint16 bArrow; // true -> flèche en dessus de blupi - Sint16 bRepeat; // true -> répète l'action - Sint16 nLoop; // nb de boucles pour GOAL_OTHERLOOP - Sint16 cLoop; // boucle en cours - Sint16 vIcon; // icône variable - POINT goalHili; // but visé - Sint16 bMalade; // true -> blupi malade - Sint16 bCache; // true -> caché (pas dessiné) - Sint16 vehicule; // véhicule utilisé par blupi, voir (**) - char busyCount; - char busyDelay; - char clicCount; - char clicDelay; - char reserve2[2]; - Sint16 listButton[MAXLIST]; - POINT listCel[MAXLIST]; - Sint16 listParam[MAXLIST]; - Sint16 repeatLevelHope; - Sint16 repeatLevel; - Sint16 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 -{ - Sint32 bExist; // true -> utilisé - - POINT cel; // cellule du décor - Sint16 rankBlupi; // blupi travaillant ici - - Sint32 bFloor; // true -> floor, false -> object - Sint16 channel; - Sint16 icon; - Sint16 maskChannel; - Sint16 maskIcon; - Sint16 phase; // phase pour pMoves ou pIcon - Sint16 rankMoves; // *nb,dx,dy,... - Sint16 rankIcons; // *nb,i,i,... - - Sint16 total; // nb total d'étapes - Sint16 delai; // délai entre deux pas - Sint16 stepY; // pas vertical *100 - - Sint16 cTotal; - Sint16 cDelai; -} -Move; - - -#define MAXLASTDRAPEAU 50 - -class CDecor -{ -public: - CDecor(); - ~CDecor(); - - // Arrange.cpp - void ArrangeFloor(POINT cel); - void ArrangeMur(POINT cel, Sint32 &icon, Sint32 index); - void ArrangeBuild(POINT cel, Sint32 &channel, Sint32 &icon); - void ArrangeObject(POINT cel); - - bool ArrangeFillTestFloor(POINT cel1, POINT cel2); - bool ArrangeFillTest(POINT pos); - void ArrangeFillPut(POINT pos, Sint32 channel, Sint32 icon); - void ArrangeFillSearch(POINT pos); - void ArrangeFill(POINT pos, Sint32 channel, Sint32 icon, bool bFloor); - - void ArrangeBlupi(); - - // Obstacle.cpp - void SearchFloor(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits); - void SearchObject(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits); - void AjustFloor(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits); - void AjustObject(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits); - bool IsFreeDirect(POINT cel, Sint32 direct, Sint32 rank); - bool IsFreeCelObstacle(POINT cel); - bool IsFreeCelFloor(POINT cel, Sint32 rank); - bool IsFreeCelGo(POINT cel, Sint32 rank); - bool IsFreeCelHili(POINT cel, Sint32 rank); - bool IsFreeCel(POINT cel, Sint32 rank); - bool IsFreeCelDepose(POINT cel, Sint32 rank); - bool IsFreeCelEmbarque(POINT cel, Sint32 rank, Sint32 &action, POINT &limit); - bool IsFreeCelDebarque(POINT cel, Sint32 rank, Sint32 &action, POINT &limit); - bool IsFreeJump(POINT cel, Sint32 direct, Sint32 rank, Sint32 &action); - bool IsFreeGlisse(POINT cel, Sint32 direct, Sint32 rank, Sint32 &action); - Sint32 DirectSearch(POINT cel, POINT goal); - void FlushUsed(Sint32 rank); - void AddUsedPos(Sint32 rank, POINT pos); - bool IsUsedPos(Sint32 rank, POINT pos); - bool SearchBestBase(Sint32 rank, Sint32 &action, POINT &newCel, Sint32 &direct); - bool SearchBestPass(Sint32 rank, Sint32 &action); - bool IsWorkableObject(POINT cel, Sint32 rank); - bool SearchOtherObject(Sint32 rank, POINT initCel, Sint32 action, - Sint32 distMax, Sint32 channel, - Sint32 firstIcon1, Sint32 lastIcon1, - Sint32 firstIcon2, Sint32 lastIcon2, - POINT &foundCel, Sint32 &foundIcon); - bool SearchOtherDrapeau(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon); - bool SearchOtherBateau(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon); - bool IsSpiderObject(Sint32 icon); - bool SearchSpiderObject(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon); - bool IsTracksObject(Sint32 icon); - bool SearchTracksObject(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon); - bool IsRobotObject(Sint32 icon); - bool SearchRobotObject(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon, - Sint32 &foundAction); - bool IsBombeObject(Sint32 icon); - bool SearchBombeObject(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon); - bool SearchElectroObject(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon); - bool IsUsineBuild(Sint32 rank, POINT cel); - bool IsUsineFree(Sint32 rank, POINT cel); - bool IsFireCel(POINT cel); - bool IsVirusCel(POINT cel); - Sint32 IsBuildPont(POINT &cel, Sint32 &iconBuild); - bool IsBuildBateau(POINT cel, Sint32 &direct); - void InitDrapeau(); - void AddDrapeau(POINT cel); - void SubDrapeau(POINT cel); - bool TestDrapeau(POINT cel); - - // DecBlupi.cpp - void BlupiFlush(); - Sint32 BlupiCreate(POINT cel, Sint32 action, Sint32 direct, - Sint32 perso, Sint32 energy); - bool BlupiDelete(POINT cel, Sint32 perso=-1); - void BlupiDelete(Sint32 rank); - void BlupiKill(Sint32 exRank, POINT cel, Sint32 type); - bool BlupiIfExist(Sint32 rank); - void BlupiCheat(Sint32 cheat); - void BlupiActualise(Sint32 rank); - void BlupiAdaptIcon(Sint32 rank); - void BlupiPushFog(Sint32 rank); - void BlupiSound(Sint32 rank, Sint32 sound, POINT pos, bool bStop=false); - void BlupiInitAction(Sint32 rank, Sint32 action, Sint32 direct=-1); - void BlupiChangeAction(Sint32 rank, Sint32 action, Sint32 direct=-1); - void ListFlush(Sint32 rank); - Sint32 ListGetParam(Sint32 rank, Sint32 button, POINT cel); - bool ListPut(Sint32 rank, Sint32 button, POINT cel, POINT cMem); - void ListRemove(Sint32 rank); - Sint32 ListSearch(Sint32 rank, Sint32 button, POINT cel, const char *&textForButton); - bool RepeatAdjust(Sint32 rank, Sint32 button, POINT &cel, POINT &cMem, - Sint32 param, Sint32 list); - void GoalStart(Sint32 rank, Sint32 action, POINT cel); - bool GoalNextPhase(Sint32 rank); - void SetTotalTime(Sint32 total); - Sint32 GetTotalTime(); - void GoalInitJauge(Sint32 rank); - void GoalInitPassCel(Sint32 rank); - void GoalAdjustCel(Sint32 rank, Sint32 &x, Sint32 &y); - bool GoalNextOp(Sint32 rank, Sint16 *pTable); - void GoalUnwork(Sint32 rank); - void GoalStop(Sint32 rank, bool bError=false, bool bSound=true); - bool BlupiIsGoalUsed(POINT cel); - void BlupiStartStopRayon(Sint32 rank, POINT startCel, POINT endCel); - bool BlupiRotate(Sint32 rank); - bool BlupiNextAction(Sint32 rank); - void BlupiNextGoal(Sint32 rank); - void BlupiStep(bool bFirst); - void BlupiGetRect(Sint32 rank, RECT &rect); - Sint32 GetTargetBlupi(POINT pos); - void BlupiDeselect(); - void BlupiDeselect(Sint32 rank); - void BlupiSetArrow(Sint32 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(); - Sint32 GetDefButton(POINT cel); - bool BlupiGoal(Sint32 rank, Sint32 button, POINT cel, POINT cMem); - void BlupiGoal(POINT cel, Sint32 button); - void BlupiDestCel(Sint32 rank); - bool IsTracksHere(POINT cel, bool bSkipInMove); - bool IsBlupiHereEx(POINT cel1, POINT cel2, Sint32 exRank, bool bSkipInMove); - bool IsBlupiHereEx(POINT cel, Sint32 exRank, bool bSkipInMove); - bool IsBlupiHere(POINT cel, bool bSkipInMove); - bool IsBlupiHere(POINT cel, Sint32 direct, bool bSkipInMove); - void GetLevelJauge(Sint32 *pLevels, Sint32 *pTypes); - bool IsWorkBlupi(Sint32 rank); - void BlupiGetButtons(POINT pos, Sint32 &nb, Sint32 *pButtons, Sint32 *pErrors, - std::unordered_map &texts, Sint32 &perso); - void TerminatedInit(); - Sint32 IsTerminated(); - Term* GetTerminated(); - - // DecMove.cpp - void MoveFlush(); - Sint32 MoveMaxFire(); - void MoveFixInit(); - bool MoveCreate(POINT cel, Sint32 rankBlupi, bool bFloor, - Sint32 channel, Sint32 icon, - Sint32 maskChannel, Sint32 maskIcon, - Sint32 total, Sint32 delai, Sint32 stepY, - bool bMisc=false, bool bNotIfExist=false); - bool MoveAddMoves(POINT cel, Sint32 rankMoves); - bool MoveAddIcons(POINT cel, Sint32 rankIcons, bool bContinue=false); - bool MoveStartFire(POINT cel); - void MoveProxiFire(POINT cel); - void MoveFire(Sint32 rank); - void MoveStep(bool bFirst); - void MoveFinish(POINT cel); - void MoveFinish(Sint32 rankBlupi); - bool MoveIsUsed(POINT cel); - bool MoveGetObject(POINT cel, Sint32 &channel, Sint32 &icon); - bool MovePutObject(POINT cel, Sint32 channel, Sint32 icon); - - // DecIO.cpp - bool Write(Sint32 rank, bool bUser, Sint32 world, Sint32 time, Sint32 total); - bool Read(Sint32 rank, bool bUser, Sint32 &world, Sint32 &time, Sint32 &total); - bool FileExist(Sint32 rank, bool bUser, Sint32 &world, Sint32 &time, Sint32 &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(); - Sint32 StatisticGetBlupi(); - Sint32 StatisticGetFire(); - void StatisticDraw(); - void GenerateStatictic(); - bool StatisticDown(POINT pos); - bool StatisticMove(POINT pos); - bool StatisticUp(POINT pos); - Sint32 StatisticDetect(POINT pos); - - // Chemin.cpp - void CheminMemPos(Sint32 exRank); - bool CheminTestPos(POINT pos, Sint32 &rank); - Sint32 CheminARebours(Sint32 rank); - void CheminFillTerrain(Sint32 rank); - bool CheminTestDirection(Sint32 rank, Sint32 pos, Sint32 dir, - Sint32 &next, Sint32 &li, - Sint32 &cout, Sint32 &action); - bool CheminCherche(Sint32 rank, Sint32 &action); - bool IsCheminFree(Sint32 rank, POINT dest, Sint32 button); - - // Decor.cpp - void SetShiftOffset(POINT offset); - POINT ConvCelToPos(POINT cel); - POINT ConvPosToCel(POINT pos, bool bMap=false); - POINT ConvPosToCel2(POINT pos); - - void Create(CSound *pSound, CPixmap *pPixmap); - void Init(Sint32 channel, Sint32 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, Sint32 channel, Sint32 icon); - bool PutObject(POINT cel, Sint32 channel, Sint32 icon); - bool GetFloor(POINT cel, Sint32 &channel, Sint32 &icon); - bool GetObject(POINT cel, Sint32 &channel, Sint32 &icon); - bool SetFire(POINT cel, bool bFire); - - void SetCoin(POINT coin, bool bCenter=false); - POINT GetCoin(); - POINT GetHome(); - void MemoPos(Sint32 rank, bool bRecord); - - void SetTime(Sint32 time); - Sint32 GetTime(); - - void SetMusic(Sint32 music); - Sint32 GetMusic(); - - void SetSkill(Sint32 skill); - Sint32 GetSkill(); - - void SetRegion(Sint32 region); - Sint32 GetRegion(); - - void SetInfoMode(bool bInfo); - bool GetInfoMode(); - void SetInfoHeight(Sint32 height); - Sint32 GetInfoHeight(); - - char* GetButtonExist(); - - void BuildPutBlupi(); - void BuildMoveFloor(Sint32 x, Sint32 y, POINT pos, Sint32 rank); - void BuildMoveObject(Sint32 x, Sint32 y, POINT pos, Sint32 rank); - void BuildGround(RECT clip); - void Build(RECT clip, POINT posMouse); - void NextPhase(Sint32 mode); - - Sint32 CountFloor(Sint32 channel, Sint32 icon); - Sint32 CelOkForAction(POINT cel, Sint32 action, Sint32 rank, - Sint32 icons[4][4], - POINT &celOutline1, - POINT &celOutline2); - Sint32 CelOkForAction(POINT cel, Sint32 action, Sint32 rank); - Sint32 GetHiliRankBlupi(Sint32 nb); - void CelHili(POINT pos, Sint32 action); - void CelHiliButton(POINT cel, Sint32 button); - void CelHiliRepeat(Sint32 list); - const char *GetResHili(POINT posMouse); - void HideTooltips(bool bHide); - - void UndoOpen(); - void UndoClose(); - void UndoCopy(); - void UndoBack(); - bool IsUndo(); - - -protected: - bool GetSeeBits(POINT cel, char *pBits, Sint32 index); - Sint32 GetSeeIcon(char *pBits, Sint32 index); - -protected: - CSound* m_pSound; - CPixmap* m_pPixmap; - Cellule* m_pUndoDecor; - Cellule m_decor[MAXCELX/2][MAXCELY/2]; - Sint16 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; - Sint32 m_iconHili[4][4]; - Sint32 m_rankHili; // rang du blupi visé - bool m_bHiliRect; - POINT m_p1Hili; // coins rectangle de sélection - POINT m_p2Hili; - Sint32 m_shiftHili; - Sint32 m_nbBlupiHili; // nb de blupi sélectionnés - Sint32 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 - Uint32 m_colors[100]; - Sint32 m_time; // temps relatif global - Sint32 m_timeConst; // temps relatif global constant - Sint32 m_timeFlipOutline; // temps quand basculer mode outline - Sint32 m_totalTime; // temps total passé sur une partie - Sint32 m_phase; // phase pour la carte - POINT m_celArrow; // cellule avec flèche - bool m_bOutline; - bool m_bGroundRedraw; - char m_buttonExist[MAXBUTTON]; - Sint32 m_statNb; // nb de statistiques - Sint32 m_statFirst; // première statistique visible - Sint32 m_bStatUp; // flèche up statistique - Sint32 m_bStatDown; // flèche down statistique - Sint32 m_statHili; // statistique survolée - bool m_bStatRecalc; // true -> recalcule les statistiques - bool m_bStatRedraw; // true -> redessine les statistiques - Sint32 m_nbStatHach; // nb de hachures - Sint32 m_nbStatHachBlupi; // hachures occupées par blupi - Sint32 m_nbStatHachPlanche;// hachures occupées par planches - Sint32 m_nbStatHachTomate; // hachures occupées par tomates - Sint32 m_nbStatHachMetal; // hachures occupées par métal - Sint32 m_nbStatHachRobot; // hachures occupées par robot - Sint32 m_nbStatHome; // nb de maisons - Sint32 m_nbStatHomeBlupi; // maisons occupées par blupi - Sint32 m_nbStatRobots; // nb d'ennemis - Term m_term; // conditions pour gagner - Sint32 m_winCount; // compteur avant gagné - Sint32 m_winLastHachBlupi; // dernier nombre atteint - Sint32 m_winLastHachPlanche;// dernier nombre atteint - Sint32 m_winLastHachTomate;// dernier nombre atteint - Sint32 m_winLastHachMetal; // dernier nombre atteint - Sint32 m_winLastHachRobot; // dernier nombre atteint - Sint32 m_winLastHome; // dernier nombre atteint - Sint32 m_winLastHomeBlupi; // dernier nombre atteint - Sint32 m_winLastRobots; // dernier nombre atteint - Sint32 m_music; // numéro musique - Sint32 m_region; // numéro région (*) - Sint32 m_lastRegion; // numéro dernière région - Sint32 m_blupiHere; - POINT m_lastDrapeau[MAXLASTDRAPEAU]; - bool m_bHideTooltips; // true -> menu présent - char m_text[50]; - POINT m_textLastPos; - Sint32 m_textCount; - Sint32 m_skill; - bool m_bInfo; - Sint32 m_infoHeight; - POINT m_memoPos[4]; - - Uint8 m_cheminWork[MAXCELX*MAXCELY]; - Sint32 m_cheminNbPos; - POINT m_cheminPos[MAXBLUPI*2]; - Sint32 m_cheminRank[MAXBLUPI*2]; - - bool m_bFillFloor; - Sint32 m_fillSearchChannel; - Sint32 m_fillSearchIcon; - Sint32 m_fillPutChannel; - Sint32 m_fillPutIcon; - char* m_pFillMap; -}; - -// (*) Régions : -// 0 -> normal -// 1 -> palmier -// 2 -> hiver -// 3 -> sapin - -///////////////////////////////////////////////////////////////////////////// - -POINT GetCel (Sint32 x, Sint32 y); -POINT GetCel (POINT cel, Sint32 x, Sint32 y); -bool IsValid (POINT cel); -POINT GetVector (Sint32 direct); -extern Sint32 table_multi_goal[]; -extern Sint16 table_actions[]; diff --git a/src/decstat.cpp.orig b/src/decstat.cpp.orig deleted file mode 100644 index 62e9b20..0000000 --- a/src/decstat.cpp.orig +++ /dev/null @@ -1,1044 +0,0 @@ -// DecStat.cpp -// - -#include "gettext.h" -#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 -{ - Sint16 bExist; - Sint16 perso; // -1=objet, -2=feu, -3=flèche - Sint16 firstIcon; // négatif si sol - Sint16 lastIcon; // négatif si sol - Sint16 drawIcon; - Sint16 bBigIcon; - const char *text; - Sint16 nb; - Sint16 lastShow; -} -Statistic; - - -static Statistic table_statistic[] = -{ - { // STATBLUPIm = 0 - true, - 0, // blupi malade - 0,0, // - 76, - false, - translate ("Sick Blupi"), - 0, 0, - }, - { // STATBLUPIf = 1 - true, - 0, // blupi fatigué - 0,0, // - 13, - false, - translate ("Tired Blupi"), - 0, 0, - }, - { // STATBLUPI = 2 - true, - 0, // blupi énergique - 0,0, // - 14, - false, - translate ("Blupi"), - 0, 0, - }, - { // STATDISCIPLE = 3 - true, - 8, // disciple - 0,0, // - 85, - false, - translate ("Helper robot"), - 0, 0, - }, - { // 4 - true, - -1, // objet - 117,117, // bateau - 58, - false, - translate ("Boat"), - 0, 0, - }, - { // 5 - true, - -1, // objet - 118,118, // jeep - 65, - false, - translate ("Jeep"), - 0, 0, - }, - { // 6 - true, - -1, // objet - 16,16, // armure - 106, - false, - translate ("Armour"), - 0, 0, - }, - { // 7 - true, - -1, // objet - 93,93, // piège - 70, - false, - translate ("Sticky trap"), - 0, 0, - }, - { // 8 - true, - -1, // objet - 92,92, // poison - 71, - false, - translate ("Poison"), - 0, 0, - }, - { // 9 - true, - -1, // objet - 85,85, // dynamite - 57, - false, - translate ("Dynamite"), - 0, 0, - }, - { // 10 - true, - -1, // objet - 125,125, // mine - 63, - false, - translate ("Time bomb"), - 0, 0, - }, - { // 11 - true, - -1, // objet - 60,60, // tomate - 28, - false, - translate ("Tomatoes"), - 0, 0, - }, - { // 12 - true, - -1, // objet - 80,80, // bouteille - 34, - false, - translate ("Medical potion"), - 0, 0, - }, - { // 13 - true, - -1, // objet - 36,36, // planches - 22, - false, - translate ("Planks"), - 0, 0, - }, - { // 14 - true, - -1, // objet - 44,44, // pierres - 27, - false, - translate ("Stones"), - 0, 0, - }, - { // 15 - true, - -1, // objet - 124,124, // drapeau - 64, - true, - translate ("Flag"), - 0, 0, - }, - { // 16 - true, - -1, // objet - 123,123, // fer - 62, - false, - translate ("Iron"), - 0, 0, - }, - { // 17 - true, - -1, // objet - 82,82, // fleurs1 - 72, - false, - ptranslate ("Flower|1|", "Flowers"), - 0, 0, - }, - { // 18 - true, - -1, // objet - 84,84, // fleurs2 - 73, - false, - ptranslate ("Flower|2|", "Flowers"), - 0, 0, - }, - { // 19 - true, - -1, // objet - 95,95, // fleurs3 - 74, - false, - ptranslate ("Flower|3|", "Flowers"), - 0, 0, - }, - { // 20 - true, - -1, // objet - 61,61, // cabane - 19, - true, - translate ("Garden shed"), - 0, 0, - }, - { // 21 - true, - -1, // objet - -52,-56, // couveuse - 25, - false, - translate ("Incubator"), - 0, 0, - }, - { // 22 - true, - -1, // objet - -80,-84, // téléporteur - 101, - false, - translate ("Teleporter"), - 0, 0, - }, - { // 23 - true, - -1, // objet - 28,29, // laboratoire - 35, - true, - translate ("Laboratory"), - 0, 0, - }, - { // 24 - true, - -1, // objet - 121,122, // mine de fer - 61, - true, - translate ("Mine"), - 0, 0, - }, - { // 25 - true, - -1, // objet - 119,120, // usine - 59, - true, - translate ("Workshop"), - 0, 0, - }, - { // 26 - true, - -1, // objet - 27,27, // tour - 33, - true, - translate ("Protection tower"), - 0, 0, - }, - { // STATFEU = 27 - true, - -2, // feu - 0,0, // - 37, - true, - translate ("Fire"), - 0, 0, - }, - { // STATROBOT = 28 - true, - 4, // robot - 0,0, // - 56, - false, - translate ("Master robot"), - 0, 0, - }, - { // STATTRACKS = 29 - true, - 3, // tracks - 0,0, // - 17, - false, - translate ("Bulldozer"), - 0, 0, - }, - { // STATBOMBE = 30 - true, - 5, // bombe - 0,0, // - 38, - false, - translate ("Bouncing bomb"), - 0, 0, - }, - { // STATARAIGNEE = 31 - true, - 1, // araignée - 0,0, // - 15, - false, - translate ("Spider"), - 0, 0, - }, - { // STATVIRUS = 32 - true, - 2, // virus - 0,0, // - 16, - false, - translate ("Virus"), - 0, 0, - }, - { // STATELECTRO = 33 - true, - 7, // électro - 0,0, // - 75, - false, - translate ("Electrocutor"), - 0, 0, - }, - - { - false, - -1, - 0,0, - -1, - false, - "", - 999, 999, - }, -}; - - -// Retourne la statistique correspondant à un rang donné. - -Statistic* StatisticGet(Sint32 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() -{ - Sint32 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. - -Sint32 CDecor::StatisticGetBlupi() -{ - return table_statistic[STATBLUPIf].nb + - table_statistic[STATBLUPIm].nb + - table_statistic[STATBLUPI].nb; -} - -// Retourne le nombre de cellules en feu. - -Sint32 CDecor::StatisticGetFire() -{ - return table_statistic[STATFEU].nb; -} - -// Dessine toutes les statistiques. - -void CDecor::StatisticDraw() -{ - POINT pos; - RECT rect; - Sint32 rank, icon, nb; - Statistic* pStatistic; - char text[50]; - const char *textRes; - - 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 = ""; - 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 = gettext (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 = gettext ("Interrupt"); - if ( m_statHili == 101 ) textRes = gettext ("Settings"); - if ( m_statHili == 102 ) textRes = gettext ("Save"); - } - - // 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 (strlen (textRes)) - { - nb = GetTextWidth(textRes); - pos.x += (POSDRAWX-nb)/2; - DrawText(m_pPixmap, pos, textRes); - } - - 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) -{ - Sint32 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) -{ - Sint32 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) -{ - return false; -} - -// Détecte dans quelle statistique est la souris. - -Sint32 CDecor::StatisticDetect(POINT pos) -{ - Sint32 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/src/def.h.orig b/src/def.h.orig deleted file mode 100644 index b79681e..0000000 --- a/src/def.h.orig +++ /dev/null @@ -1,621 +0,0 @@ -// Def.h -// - -#pragma once - -#include - -#define _INTRO false // true si images d'introduction - - -#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 - - -// 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 - -enum MouseSprites -{ - SPRITE_BEGIN = 1, - SPRITE_ARROW = 1, - SPRITE_POINTER = 2, - SPRITE_MAP = 3, - SPRITE_ARROWU = 4, - SPRITE_ARROWD = 5, - SPRITE_ARROWL = 6, - SPRITE_ARROWR = 7, - SPRITE_ARROWUL = 8, - SPRITE_ARROWUR = 9, - SPRITE_ARROWDL = 10, - SPRITE_ARROWDR = 11, - SPRITE_WAIT = 12, - SPRITE_EMPTY = 13, - SPRITE_FILL = 14, - SPRITE_END = 14, -}; - - -#define WM_USER 0x0400 - -#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_MUSIC_STOP (WM_USER+550) - -#define WM_PREV (WM_USER+600) -#define WM_NEXT (WM_USER+601) -#define WM_MOVIE (WM_USER+602) -#define WM_MOVIE_PLAY (WM_USER+603) - - -// Types de gestion de la souris. - -#define MOUSETYPEGRA 1 -#define MOUSETYPEWIN 2 -#define MOUSETYPEWINPOS 3 - - - -// Conditions pour gagner. - -typedef struct -{ - Sint16 bHachBlupi; // blupi sur dalle hachurée - Sint16 bHachPlanche; // planches sur dalle hachurée - Sint16 bStopFire; // feu éteint - Sint16 nbMinBlupi; // nb de blupi nécessaires - Sint16 nbMaxBlupi; // nb de blupi nécessaires - Sint16 bHomeBlupi; // blupi à la maison - Sint16 bKillRobots; // plus d'ennemis - Sint16 bHachTomate; // tomates sur dalle hachurée - Sint16 bHachMetal; // métal sur dalle hachurée - Sint16 bHachRobot; // robot sur dalle hachurée - Sint16 reserve[14]; -} -Term; - diff --git a/src/event.cpp.orig b/src/event.cpp.orig deleted file mode 100644 index 7c928ed..0000000 --- a/src/event.cpp.orig +++ /dev/null @@ -1,5371 +0,0 @@ -// Event.cpp -// - -#include -#include -#include -#include "gettext.h" -#include "blupi.h" -#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" - -#ifdef _WIN32 -#define unlink _unlink -#else // _WIN32 -#include -#endif // !_WINE32 - - -#define DEF_TIME_HELP 10000 // ~10 minutes -#define DEF_TIME_DEMO 1000 // ~1 minute -#define MAXDEMO 2000 - - -typedef struct -{ - Sint16 majRev; - Sint16 minRev; - Sint16 reserve1[9]; - Sint16 exercice; // exercice en cours (0..n) - Sint16 mission; // mission en cours (0..n) - Sint16 speed; - Sint16 bMovie; - Sint16 maxMission; // dernière mission effectuée (0..n) - Sint16 scrollSpeed; - Sint16 audioVolume; - Sint16 midiVolume; - Sint16 bAccessBuild; - Sint16 prive; - Sint16 skill; - Sint16 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, - { translate ("Demo") }, - }, - { - WM_PHASE_SCHOOL, - 0, {1,79}, - 16, 424-60-42*2, - { translate ("Training") }, - }, - { - WM_PHASE_MISSION, - 0, {1,80}, - 16, 424-60-42*1, - { translate ("Missions") }, - }, - { - WM_PHASE_PRIVATE, - 0, {1,49}, - 16, 424-60-42*0, - { translate ("Construction") }, - }, - { - WM_PHASE_BYE, - 0, {1,36}, - 16, 424, - { translate ("Quit BLUPI") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_HISTORY0, - "image/history0.blp", - true, - { - { - WM_PHASE_INIT, - 0, {1,50}, - 42+42*0, 433, - { translate ("Previous page") }, - }, - { - WM_PHASE_H1MOVIE, - 0, {1,51}, - 558-42*0, 433, - { translate ("Next page") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_HISTORY1, - "image/history1.blp", - true, - { - { - WM_PHASE_HISTORY0, - 0, {1,50}, - 42+42*0, 433, - { translate ("Previous page") }, - }, - { - WM_PHASE_H2MOVIE, - 0, {1,51}, - 558-42*0, 433, - { translate ("Next page") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_INFO, - "image/info%.3d.blp", - false, - { - { - WM_PREV, - 0, {1,50}, - 558-42*2, 433, - { translate ("Previous game") }, - }, - { - WM_PHASE_PLAYMOVIE, - 0, {1,48}, - 558-42*1, 433, - { translate ("Play this game") }, - }, - { - WM_NEXT, - 0, {1,51}, - 558-42*0, 433, - { translate ("Next game") }, - }, - { - WM_PHASE_READ, - 0, {1,52}, - 42+42*4, 433, - { translate ("Open another game") }, - }, - { - WM_PHASE_SETUP, - 0, {1,47}, - 42+42*7, 433, - { translate ("Settings") }, - }, - { - WM_PHASE_BUILD, - 0, {1,49}, - 42+42*8, 433, - { translate ("Construct this game") }, - }, - { - WM_PHASE_SKILL1, - 0, {1,94}, - 150, 230, - { translate ("Skill level") }, - }, - { - WM_PHASE_SKILL2, - 0, {1,95}, - 150, 230+42, - { translate ("Skill level") }, - }, - { - WM_PHASE_INIT, - 0, {1,40}, - 42+42*0, 433, - { translate ("Finish") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_PLAY, - "image/play.blp", - false, - { - { - WM_PHASE_STOP, - 0, {1,40}, - 10+42*0, 422, - {}, - }, - { - WM_PHASE_SETUPp, - 0, {1,47}, - 10+42*1, 422, - {}, - }, - { - WM_PHASE_WRITEp, - 0, {1,53}, - 10+42*2, 422, - {}, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_STOP, - "image/stop%.3d.blp", - false, - { - { - WM_PHASE_PLAY, - 0, {1,77}, - 558-42*1, 433, - { translate ("Continue this game") }, - }, - { - WM_PHASE_READ, - 0, {1,52}, - 42+42*4, 433, - { translate ("Open another game") }, - }, - { - WM_PHASE_WRITE, - 0, {1,53}, - 42+42*5, 433, - { translate ("Save this game") }, - }, - { - WM_PHASE_SETUP, - 0, {1,47}, - 42+42*7, 433, - { translate ("Settings") }, - }, - { - WM_PHASE_INFO, - 0, {1,78}, - 42+42*0, 433, - { translate ("Quit this game") }, - }, - { - WM_PHASE_HELP, - 0, {1,86}, - 42+42*9, 433, - { translate ("Help") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_HELP, - "image/help.blp", - true, - { - { - WM_PHASE_PLAY, - 0, {1,77}, - 558-42*1, 433, - { translate ("Continue this game") }, - }, - { - WM_PHASE_READ, - 0, {1,52}, - 42+42*4, 433, - { translate ("Open another game") }, - }, - { - WM_PHASE_WRITE, - 0, {1,53}, - 42+42*5, 433, - { translate ("Save this game") }, - }, - { - WM_PHASE_SETUP, - 0, {1,47}, - 42+42*7, 433, - { translate ("Settings") }, - }, - { - WM_PHASE_STOP, - 0, {1,50}, - 42+42*0, 433, - { translate ("Previous page") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_SETUP, - "image/setup.blp", - false, - { - { - WM_BUTTON1, - 0, {1,50}, - 54, 330, - { translate ("Slower") }, - }, - { - WM_BUTTON2, - 0, {1,51}, - 54+40, 330, - { translate ("Faster") }, - }, - { - WM_BUTTON3, - 0, {1,50}, - 284, 330, - { translate ("Reduce volume") }, - }, - { - WM_BUTTON4, - 0, {1,51}, - 284+40, 330, - { translate ("Increase volume") }, - }, - { - WM_BUTTON5, - 0, {1,50}, - 399, 330, - { translate ("Reduce volume") }, - }, - { - WM_BUTTON6, - 0, {1,51}, - 399+40, 330, - { translate ("Increase volume") }, - }, - { - WM_BUTTON7, - 0, {1,50}, - 514, 330, - { translate ("No video") }, - }, - { - WM_BUTTON8, - 0, {1,51}, - 514+40, 330, - { translate ("Show videos") }, - }, - { - WM_BUTTON9, - 0, {1,50}, - 169, 330, - { translate ("Slower") }, - }, - { - WM_BUTTON10, - 0, {1,51}, - 169+40, 330, - { translate ("Faster") }, - }, - { - WM_PHASE_STOP, - 0, {1,40}, - 11, 424, - { translate ("Finish") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_SETUPp, - "image/setup.blp", - false, - { - { - WM_BUTTON1, - 0, {1,50}, - 54, 330, - { translate ("Slower") }, - }, - { - WM_BUTTON2, - 0, {1,51}, - 54+40, 330, - { translate ("Faster") }, - }, - { - WM_BUTTON3, - 0, {1,50}, - 284, 330, - { translate ("Reduce volume") }, - }, - { - WM_BUTTON4, - 0, {1,51}, - 284+40, 330, - { translate ("Increase volume") }, - }, - { - WM_BUTTON5, - 0, {1,50}, - 399, 330, - { translate ("Reduce volume") }, - }, - { - WM_BUTTON6, - 0, {1,51}, - 399+40, 330, - { translate ("Increase volume") }, - }, - { - WM_BUTTON7, - 0, {1,50}, - 514, 330, - { translate ("No video") }, - }, - { - WM_BUTTON8, - 0, {1,51}, - 514+40, 330, - { translate ("Show videos") }, - }, - { - WM_BUTTON9, - 0, {1,50}, - 169, 330, - { translate ("Slower") }, - }, - { - WM_BUTTON10, - 0, {1,51}, - 169+40, 330, - { translate ("Faster") }, - }, - { - WM_PHASE_PLAY, - 0, {1,77}, - 11, 424, - { translate ("Continue this game") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_READ, - "image/read.blp", - false, - { - { - WM_READ0, - 0, {0}, - 420, 30+42*0, - {}, - }, - { - WM_READ1, - 0, {0}, - 420, 30+42*1, - {}, - }, - { - WM_READ2, - 0, {0}, - 420, 30+42*2, - {}, - }, - { - WM_READ3, - 0, {0}, - 420, 30+42*3, - {}, - }, - { - WM_READ4, - 0, {0}, - 420, 30+42*4, - {}, - }, - { - WM_READ5, - 0, {0}, - 420, 30+42*5, - {}, - }, - { - WM_READ6, - 0, {0}, - 420, 30+42*6, - {}, - }, - { - WM_READ7, - 0, {0}, - 420, 30+42*7, - {}, - }, - { - WM_READ8, - 0, {0}, - 420, 30+42*8, - {}, - }, - { - WM_READ9, - 0, {0}, - 420, 30+42*9, - {}, - }, - { - WM_PHASE_STOP, - 0, {1,40}, - 16, 424, - { translate ("Finish") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_WRITE, - "image/write.blp", - false, - { - { - WM_WRITE0, - 0, {0}, - 420, 30+42*0, - {}, - }, - { - WM_WRITE1, - 0, {0}, - 420, 30+42*1, - {}, - }, - { - WM_WRITE2, - 0, {0}, - 420, 30+42*2, - {}, - }, - { - WM_WRITE3, - 0, {0}, - 420, 30+42*3, - {}, - }, - { - WM_WRITE4, - 0, {0}, - 420, 30+42*4, - {}, - }, - { - WM_WRITE5, - 0, {0}, - 420, 30+42*5, - {}, - }, - { - WM_WRITE6, - 0, {0}, - 420, 30+42*6, - {}, - }, - { - WM_WRITE7, - 0, {0}, - 420, 30+42*7, - {}, - }, - { - WM_WRITE8, - 0, {0}, - 420, 30+42*8, - {}, - }, - { - WM_WRITE9, - 0, {0}, - 420, 30+42*9, - {}, - }, - { - WM_PHASE_STOP, - 0, {1,40}, - 16, 424, - { translate ("Finish") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_WRITEp, - "image/write.blp", - false, - { - { - WM_WRITE0, - 0, {0}, - 420, 30+42*0, - {}, - }, - { - WM_WRITE1, - 0, {0}, - 420, 30+42*1, - {}, - }, - { - WM_WRITE2, - 0, {0}, - 420, 30+42*2, - {}, - }, - { - WM_WRITE3, - 0, {0}, - 420, 30+42*3, - {}, - }, - { - WM_WRITE4, - 0, {0}, - 420, 30+42*4, - {}, - }, - { - WM_WRITE5, - 0, {0}, - 420, 30+42*5, - {}, - }, - { - WM_WRITE6, - 0, {0}, - 420, 30+42*6, - {}, - }, - { - WM_WRITE7, - 0, {0}, - 420, 30+42*7, - {}, - }, - { - WM_WRITE8, - 0, {0}, - 420, 30+42*8, - {}, - }, - { - WM_WRITE9, - 0, {0}, - 420, 30+42*9, - {}, - }, - { - WM_PHASE_PLAY, - 0, {1,77}, - 16, 424, - { translate ("Continue this game") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_LOST, - "image/lost.blp", - true, - { - { - WM_PHASE_INFO, - 0, {1,50}, - 9, 431, - { translate ("Restart this game") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_WIN, - "image/win.blp", - true, - { - { - WM_NEXT, - 0, {1,51}, - 9, 431, - { translate ("Next game") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_LASTWIN, - "image/last%.3d.blp", - true, - { - { - WM_PHASE_INIT, - 0, {1,51}, - 9, 431, - { translate ("Next game") }, - }, - { - 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, - { - translate ("Normal ground"), - translate ("Inflammable ground"), - translate ("Sterile ground"), - translate ("Water"), - translate ("Special pavings"), - translate ("Incubator or teleporter") - }, - }, - { - WM_DECOR2, // pose des plantes - 0, {4, 6,7,8,11}, - 11+42*2, 190+42*1, - { - translate ("Delete item"), - translate ("Decorative plants"), - translate ("Tree"), - ptranslate ("Flower|1|", "Flowers") - }, - }, - { - WM_DECOR3, // pose des batiments - 0, {11, 18,81,33,61,82,93,20,21,22,57,58}, - 11+42*2, 190+42*2, - { - translate ("Delete item"), - translate ("Buildings"), - translate ("Protection tower"), - translate ("Mine"), - translate ("Enemy buildings"), - translate ("Enemy barrier"), - translate ("Wall or palisade"), - translate ("Rocks"), - translate ("Items"), - translate ("Weapons"), - translate ("Transport") - }, - }, - { - WM_DECOR4, // pose des blupi - 0, {10, 12,13,14,85,15,16,17,38,75,56}, - 11+42*2, 190+42*3, - { - translate ("Delete figure"), - translate ("Tired Blupi"), - translate ("Blupi"), - translate ("Helper robot"), - translate ("Spider"), - translate ("Virus"), - translate ("Bulldozer"), - translate ("Bouncing bomb"), - translate ("Electrocutor"), - translate ("Master robot") - }, - }, - { - WM_DECOR5, // pose les catastrophes - 0, {2, 36,37}, - 11+42*2, 190+42*4, - { - translate ("Delete fire"), - translate ("Starting fire") - }, - }, - { - WM_PHASE_REGION, - 0, {1,5}, - 11+42*0, 190+42*1, - { translate ("Scenery choice") }, - }, - { - WM_PHASE_MUSIC, - 0, {1,44}, - 11+42*0, 190+42*2, - { translate ("Music choice") }, - }, - { - WM_PHASE_BUTTON, - 0, {1,46}, - 11+42*0, 190+42*3, - { translate ("Available buttons") }, - }, - { - WM_PHASE_TERM, - 0, {1,45}, - 11+42*0, 190+42*4, - { translate ("Ending conditions") }, - }, - { - WM_PHASE_INFO, - 0, {1,40}, - 11+42*0, 424, - { translate ("Quit construction") }, - }, - { - WM_PHASE_UNDO, - 0, {1,87}, - 11+42*2, 424, - { translate ("Cancel last operation") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_BUTTON, - "image/button.blp", - true, - { - { - WM_BUTTON1, // stop - 0, {1,40}, - 170+42*0, 30+52*0, - { translate ("Stop") }, - }, - { - WM_BUTTON0, // go - 0, {1,24}, - 170+42*1, 30+52*0, - { translate ("Go") }, - }, - { - WM_BUTTON3, // carry - 0, {1,30}, - 170+42*3, 30+52*0, - { translate ("Take") }, - }, - { - WM_BUTTON4, // depose - 0, {1,31}, - 170+42*4, 30+52*0, - { translate ("Drop") }, - }, - { - WM_BUTTON32, // répète - 0, {1,100}, - 170+42*6, 30+52*0, - { translate ("Repeat") }, - }, - - { - WM_BUTTON5, // abat - 0, {1,22}, - 170+42*0, 30+52*1, - { translate ("Cut down a tree") }, - }, - { - WM_BUTTON16, // abat n - 0, {1,42}, - 170+42*1, 30+52*1, - { translate ("Cut down trees") }, - }, - { - WM_BUTTON6, // roc - 0, {1,27}, - 170+42*3, 30+52*1, - { translate ("Carve a rock") }, - }, - { - WM_BUTTON17, // roc n - 0, {1,43}, - 170+42*4, 30+52*1, - { translate ("Carve rocks") }, - }, - { - WM_BUTTON22, // fleurs - 0, {1,54}, - 170+42*6, 30+52*1, - { translate ("Make bunch of flowers") }, - }, - { - WM_BUTTON23, // fleurs n - 0, {1,55}, - 170+42*7, 30+52*1, - { translate ("Make bunches of flowers") }, - }, - - { - WM_BUTTON9, // build2 (couveuse) - 0, {1,25}, - 170+42*0, 30+52*2, - { translate ("Incubator") }, - }, - { - WM_BUTTON15, // palis - 0, {1,26}, - 170+42*1, 30+52*2, - { translate ("Palisade") }, - }, - { - WM_BUTTON18, // pont - 0, {1,23}, - 170+42*2, 30+52*2, - { translate ("Bridge") }, - }, - { - WM_BUTTON25, // bateau - 0, {1,58}, - 170+42*3, 30+52*2, - { translate ("Boat") }, - }, - { - WM_BUTTON13, // build6 (téléporteur) - 0, {1,101}, - 170+42*4, 30+52*2, - { translate ("Teleporter") }, - }, - { - WM_BUTTON14, // mur - 0, {1,20}, - 170+42*6, 30+52*2, - { translate ("Wall") }, - }, - { - WM_BUTTON19, // tour - 0, {1,33}, - 170+42*7, 30+52*2, - { translate ("Protection tower") }, - }, - - { - WM_BUTTON8, // build1 (cabane) - 0, {1,19}, - 170+42*0, 30+52*3, - { translate ("Garden shed") }, - }, - { - WM_BUTTON7, // cultive - 0, {1,28}, - 170+42*1, 30+52*3, - { translate ("Grow tomatoes") }, - }, - { - WM_BUTTON2, // mange - 0, {1,32}, - 170+42*2, 30+52*3, - { translate ("Eat") }, - }, - - { - WM_BUTTON10, // build3 (laboratoire) - 0, {1,35}, - 170+42*0, 30+52*4, - { translate ("Laboratory") }, - }, - { - WM_BUTTON21, // laboratoire - 0, {1,39}, - 170+42*1, 30+52*4, - { translate ("Transform") }, - }, - { - WM_BUTTON20, // boit - 0, {1,34}, - 170+42*2, 30+52*4, - { translate ("Drink") }, - }, - { - WM_BUTTON24, // dynamite - 0, {1,41}, - 170+42*3, 30+52*4, - { translate ("Blow up") }, - }, - - { - WM_BUTTON27, // drapeau - 0, {1,64}, - 170+42*0, 30+52*5, - { translate ("Prospect for iron") }, - }, - { - WM_BUTTON11, // build4 (mine) - 0, {1,61}, - 170+42*1, 30+52*5, - { translate ("Mine") }, - }, - { - WM_BUTTON28, // extrait - 0, {1,62}, - 170+42*2, 30+52*5, - { translate ("Extract iron") }, - }, - { - WM_BUTTON12, // build5 (usine) - 0, {1,59}, - 170+42*4, 30+52*5, - { translate ("Workshop") }, - }, - { - WM_BUTTON29, // fabrique jeep - 0, {1,65}, - 170+42*5, 30+52*5, - { translate ("Make a Jeep") }, - }, - { - WM_BUTTON30, // fabrique mine - 0, {1,63}, - 170+42*6, 30+52*5, - { translate ("Make a time bomb") }, - }, - { - WM_BUTTON34, // fabrique armure - 0, {1,106}, - 170+42*7, 30+52*5, - { translate ("Make armour") }, - }, - { - WM_BUTTON31, // fabrique disciple - 0, {1,83}, - 170+42*8, 30+52*5, - { translate ("Make a helper robot") }, - }, - { - WM_PHASE_BUILD, - 0, {1,50}, - 11, 424, - { translate ("Finish") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_TERM, - "image/term.blp", - true, - { - { - WM_BUTTON8, // home blupi - 0, {1,81}, - 170+42*0, 30+42*0, - { translate ("Blupi in house") }, - }, - { - WM_BUTTON9, // kill robots - 0, {1,57}, - 170+42*1, 30+42*0, - { translate ("No more enemies") }, - }, - { - WM_BUTTON3, // stop fire - 0, {1,37}, - 170+42*2, 30+42*0, - { translate ("Fire out") }, - }, - { - WM_BUTTON1, // hach blupi - 0, {1,14}, - 170+42*0, 30+42*2, - { translate ("Blupi on striped paving stones") }, - }, - { - WM_BUTTON2, // hach planche - 0, {1,22}, - 170+42*1, 30+42*2, - { translate ("Planks on striped paving stones") }, - }, - { - WM_BUTTON10, // hach tomate - 0, {1,28}, - 170+42*2, 30+42*2, - { translate ("Tomatoes on striped paving stones") }, - }, - { - WM_BUTTON11, // hach métal - 0, {1,84}, - 170+42*3, 30+42*2, - { translate ("Platinium on striped paving stones") }, - }, - { - WM_BUTTON12, // hach robot - 0, {1,94}, - 170+42*4, 30+42*2, - { translate ("Robot on striped paving stones") }, - }, - { - WM_BUTTON4, // - min blupi - 0, {1,50}, - 170+42*0, 30+42*4, - { "(-)" }, - }, - { - WM_BUTTON5, // + min blupi - 0, {1,51}, - 170+42*1, 30+42*4, - { "(+)" }, - }, - { - WM_BUTTON6, // - max blupi - 0, {1,50}, - 170+42*0, 30+42*5, - { "(-)" }, - }, - { - WM_BUTTON7, // + max blupi - 0, {1,51}, - 170+42*1, 30+42*5, - { "(+)" }, - }, - { - WM_PHASE_BUILD, - 0, {1,50}, - 11, 424, - { translate ("Finish") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_MUSIC, - "image/music.blp", - true, - { - { - WM_BUTTON1, - 0, {1,40}, - 170+42*0, 30+42*0, - { translate ("No music") }, - }, - { - WM_BUTTON2, - 0, {1,44}, - 170+42*0, 30+42*1, - { translate ("Music number 1") }, - }, - { - WM_BUTTON3, - 0, {1,44}, - 170+42*0, 30+42*2, - { translate ("Music number 2") }, - }, - { - WM_BUTTON4, - 0, {1,44}, - 170+42*0, 30+42*3, - { translate ("Music number 3") }, - }, - { - WM_BUTTON5, - 0, {1,44}, - 170+42*0, 30+42*4, - { translate ("Music number 4") }, - }, - { - WM_BUTTON6, - 0, {1,44}, - 170+42*0, 30+42*5, - { translate ("Music number 5") }, - }, - { - WM_BUTTON7, - 0, {1,44}, - 170+42*0, 30+42*6, - { translate ("Music number 6") }, - }, - { - WM_BUTTON8, - 0, {1,44}, - 170+42*0, 30+42*7, - { translate ("Music number 7") }, - }, - { - WM_BUTTON9, - 0, {1,44}, - 170+42*0, 30+42*8, - { translate ("Music number 8") }, - }, - { - WM_BUTTON10, - 0, {1,44}, - 170+42*0, 30+42*9, - { translate ("Music number 9") }, - }, - { - WM_PHASE_BUILD, - 0, {1,50}, - 11, 424, - { translate ("Finish") }, - }, - { - 0 - }, - }, - }, - - { - WM_PHASE_REGION, - "image/region.blp", - true, - { - { - WM_BUTTON1, // normal - 0, {0}, - 220, 60, - { translate ("Prairie") }, - }, - { - WM_BUTTON4, // sapins - 0, {0}, - 220, 170, - { translate ("Forest") }, - }, - { - WM_BUTTON2, // palmiers - 0, {0}, - 220, 280, - { translate ("Desert") }, - }, - { - WM_BUTTON3, // hivers - 0, {0}, - 220, 390, - { translate ("Forest under snow") }, - }, - { - WM_PHASE_BUILD, - 0, {1,50}, - 11, 424, - { translate ("Finish") }, - }, - { - 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_INIT, - 0, {1,40}, - 16, 424, - { translate ("Quit BLUPI") }, - }, - { - 0 - }, - }, - }, - - { - 0 - } -}; - - -///////////////////////////////////////////////////////////////////////////// - - -// Constructeur. - -CEvent::CEvent() -{ - Sint32 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_bMouseDown = false; - m_oldMousePos.x = 0; - m_oldMousePos.y = 0; - m_mouseSprite = SPRITE_ARROW; - m_bFillMouse = false; - m_bWaitMouse = false; - m_bHideMouse = 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 = nullptr; - m_demoTime = 0; - m_keymod = 0; - - for ( i=0 ; iGetRegion(), - message); - i ++; - } - - return true; - -} - -// Ajoute un cheat-code dans un buffer. - -void AddCheatCode(char *pDst, char *pSrc) -{ - Sint32 i; - size_t j; - - if ( pDst[0] != 0 ) strcat(pDst, " / "); - - i = 0; - j = strlen(pDst); - while ( pSrc[i] != 0 ) - { - pDst[j++] = pSrc[i++]; - } - pDst[j] = 0; -} - -// Dessine un texte multi-lignes centré. - -void CEvent::DrawTextCenter(const char *text, Sint32 x, Sint32 y, Sint32 font) -{ - POINT pos; - pos.x = x; - pos.y = y; - ::DrawTextCenter(m_pPixmap, pos, text, font); -} - -// Dessine tous les boutons de la phase en cours. - -bool CEvent::DrawButtons() -{ - Sint32 i; - Sint32 levels[2]; - Sint32 types[2]; - Sint32 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; - DrawText(m_pPixmap, pos, "Version 1.7", FONTLITTLE); - } - - 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_menuTexts, - m_menuPerso); - m_menu.Update(m_menuNb, m_menuButtons, m_menuErrors, m_menuTexts); - - button = m_menu.GetSel(); - m_pDecor->CelHiliButton(m_menuCel, button); - } - m_menu.Draw(); - - // Dessine la pause. - if ( m_bPause ) - { - DrawTextCenter(gettext ("Game paused"), (10+134)/2, 20); - } - else - { - if ( m_bDemoRec ) // démo en enregistrement ? - { - DrawTextCenter(gettext ("REC"), (10+134)/2, 20, FONTRED); - } - if ( m_bDemoPlay ) // démo en restitution ? - { - DrawTextCenter(gettext ("Demo"), (10+134)/2, 20, FONTRED); - } - } - - // Dessine la rose des vents. - if ( !m_bPause && !m_bDemoRec && !m_bDemoPlay ) - { - DrawTextCenter(gettext ("N"), (10+134)/2, 17); - DrawTextCenter(gettext ("S"), (10+134)/2, 126); - DrawTextCenter(gettext ("W"), 14, 70); - DrawTextCenter(gettext ("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 ) - snprintf (res, sizeof (res), "%s", gettext ("Open another game")); - else - snprintf (res, sizeof (res), "%s", gettext ("Save this game")); - - 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) - snprintf (text, sizeof (text), gettext ("construction %d, time %d"), (world - 200) + 1, time / 100); - else if ( world >= 100 ) - snprintf(text, sizeof (text), gettext ("mission %d, time %d"), (world - 100) + 1, time / 100); - else - snprintf(text, sizeof (text), gettext ("training %d, time %d"), world + 1, time / 100); - - DrawText(m_pPixmap, pos, text); // partie x, temps t - } - else - DrawText(m_pPixmap, pos, gettext ("free slot"), FONTRED); // libre - } - } - - // Dessine les réglages pour la fin de la partie. - if ( m_phase == WM_PHASE_TERM ) - { - Term* pTerm = m_pDecor->GetTerminated(); - - DrawTextCenter(gettext ("Ending conditions"), (10+134)/2, 20); - - pos.x = 170+42*2+4; - pos.y = 30+12+42*4; - snprintf(text, sizeof (text), gettext ("Lost if less than %d Blupi"), pTerm->nbMinBlupi); - DrawText(m_pPixmap, pos, text); - - pos.x = 170+42*2+4; - pos.y = 30+12+42*5; - snprintf(text, sizeof (text), gettext ("Impossible to win if less than %d Blupi"), pTerm->nbMaxBlupi); - DrawText(m_pPixmap, pos, text); - } - - // Dessine les textes pour les choix des boutons. - if ( m_phase == WM_PHASE_BUTTON ) - { - DrawTextCenter(gettext ("Available buttons"), (10+134)/2, 20); - } - - // Dessine les textes pour le choix des musiques. - if ( m_phase == WM_PHASE_MUSIC ) - { - DrawTextCenter(gettext ("Music choice"), (10+134)/2, 20); - } - - // Dessine les textes pour le choix de la région. - if ( m_phase == WM_PHASE_REGION ) - { - DrawTextCenter(gettext ("Scenery choice"), (10+134)/2, 20); - } - - // Ajoute "Mission numéro". - if ( m_phase == WM_PHASE_INFO ) - { - if (m_bSchool) - snprintf (res, sizeof (res), gettext ("Training number")); - else - snprintf (res, sizeof (res), gettext ("Mission number")); - - if (m_bPrivate) - snprintf (res, sizeof (res), gettext ("Construction number")); - - 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 ) - { - char *text = gettext ("Game paused"); - lg = GetTextWidth(text); - 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, text, FONTRED); - } - - // Ajoute le texte "Informations complémentaires". - if ( m_phase == WM_PHASE_HELP ) - { - char *text = gettext ("Help number"); - lg = GetTextWidth(text); - 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, text, 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); - } - - // Affiche facile/difficile. - if ( m_phase == WM_PHASE_INFO ) - { - if ( !m_bSchool ) - { - if ( m_pDecor->GetSkill() == 0 ) - { - if ( m_bPrivate ) - { - pos.x = 117+50; - pos.y = 115+13; - } - else - { - pos.x = 150+50; - pos.y = 230+13; - } - DrawText(m_pPixmap, pos, gettext ("Easy"), FONTSLIM); - } - - if ( m_pDecor->GetSkill() == 1 ) - { - 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, gettext ("Difficult"), FONTSLIM); - } - } - } - - // 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 ) - { - static char *list[] = { - gettext ("You have failed, try again..."), - gettext ("No, wrong way ..."), - gettext ("Bang, failed again !"), - gettext ("Another mistake..."), - gettext ("No, not that way !"), - }; - - pos.x = 60; - pos.y = 443; - DrawText(m_pPixmap, pos, list[GetWorld () % 5]); - } - - // Affiche le texte lorsque c'est réussi. - if ( m_phase == WM_PHASE_WIN ) - { - static char *list[] = { - gettext ("Well done !"), - gettext ("Yes, great ..."), - gettext ("Very good."), - gettext ("Excellent..."), - gettext ("Mission over..."), - }; - - pos.x = 60; - pos.y = 443; - DrawText(m_pPixmap, pos, list[GetWorld () % 5]); - } - - // Affiche le texte lorsque c'est fini. - if ( m_phase == WM_PHASE_LASTWIN ) - { - char *text; - if (m_bSchool) - text = gettext ("Now go on mission."); - else - text = gettext ("Very good, success on all missions !"); - - if (m_bPrivate) - text = gettext ("Last construction resolved !"); - - pos.x = 60; - pos.y = 443; - DrawText(m_pPixmap, pos, text); - } - - // Dessine les réglages. - if ( m_phase == WM_PHASE_SETUP || - m_phase == WM_PHASE_SETUPp ) - { - DrawTextCenter(gettext ("Global game\nspeed"), 54+40, 80); - DrawTextCenter(gettext ("Scroll speed\nwith mouse"), 169+40, 80); - DrawTextCenter(gettext ("Sound effect\nvolume"), 284+40, 80); - DrawTextCenter(gettext ("Music\nvolume"), 399+40, 80); - DrawTextCenter(gettext ("Video\nsequences"), 514+40, 80); - - 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); - - char *text = gettext ("No"); - if (m_pMovie->GetEnable() && m_bMovie) - text = gettext ("Yes"); - lg = GetTextWidth(text); - pos.x = (514+40)-lg/2; - pos.y = 330-20; - DrawText(m_pPixmap, pos, text); - - if (!m_scrollSpeed) - snprintf (res, sizeof (res), gettext ("None")); - 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 ) - { - char *text; - - text = gettext ("You have played Planet Blupi."); - - lg = GetTextWidth(text); - pos.x = LXIMAGE/2-lg/2; - pos.y = 20; - DrawText(m_pPixmap, pos, text); - - text = gettext ("We hope you have had as much fun playing the game as we had making it !"); - - lg = GetTextWidth(text); - pos.x = LXIMAGE/2-lg/2; - pos.y = 40; - DrawText(m_pPixmap, pos, text); - - text = gettext ("This game is an original creation of EPSITEC SA, CH-1092 Belmont"); - - lg = GetTextWidth(text); - pos.x = LXIMAGE/2-lg/2; - pos.y = 430; - DrawText(m_pPixmap, pos, text); - - text = gettext ("http://www.blupi.com blupi@epsitec.ch"); - - lg = GetTextWidth(text); - pos.x = LXIMAGE/2-lg/2; - pos.y = 450; - DrawText(m_pPixmap, pos, text); - } - - // Affiche le texte lorsqu'il faut insérer le CD-Rom. - if ( m_phase == WM_PHASE_INSERT ) - { - DrawTextCenter(gettext ("Insert CD-Rom Planet Blupi and wait a few seconds..."), 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. - -MouseSprites CEvent::MousePosToSprite(POINT pos) -{ - MouseSprites 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->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); - m_pPixmap->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); - m_pPixmap->ChangeSprite(m_mouseSprite); -} - -// Traite les événements pour tous les boutons. - -bool CEvent::EventButtons(const SDL_Event &event, POINT pos) -{ - POINT test; - Sint32 lg, oldx, sound; - - // Cherche le tool tips à utiliser pour la souris. - m_textToolTips[0] = 0; - oldx = m_posToolTips.x; - m_posToolTips.x = -1; - - const auto progress = [&] (CJauge &progress, const char *text) -> bool - { - if (progress.GetHide ()) - return false; - - test = progress.GetPos (); - if ( pos.x >= test.x - && pos.x <= test.x + DIMJAUGEX - && pos.y >= test.y - && pos.y <= test.y + DIMJAUGEY) - { - snprintf (m_textToolTips, sizeof (m_textToolTips), "%s", text); - lg = GetTextWidth (m_textToolTips); - test.x += (DIMJAUGEX - lg) / 2; - test.y += 4; - m_posToolTips = test; - return true; - } - return false; - }; - - if ( m_phase == WM_PHASE_PLAY ) - { - const auto spotted = progress (m_jauges[0], gettext ("Blupi's energy")); - if (!spotted) - progress (m_jauges[1], gettext ("Work done")); - - if ( oldx != m_posToolTips.x ) - { - for (Sint32 i = 0; i < 2; i++) - m_jauges[i].SetRedraw(); - } - } - else - { - Sint32 i = 0; - while ( table[m_index].buttons[i].message != 0 ) - { - const auto text = m_buttons[i].GetToolTips(pos); - if (text) - { - snprintf (m_textToolTips, sizeof (m_textToolTips), text); - 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 (event.type == SDL_MOUSEBUTTONDOWN - && ( event.button.button == SDL_BUTTON_LEFT - || event.button.button == SDL_BUTTON_RIGHT)) - { - if ( m_pDecor->GetInfoMode() ) sound = SOUND_CLOSE; - else sound = SOUND_OPEN; - m_pSound->PlayImage(sound, pos); - } - if (event.type == SDL_MOUSEBUTTONUP - && ( event.button.button == SDL_BUTTON_LEFT - || event.button.button == SDL_BUTTON_RIGHT)) - { - // 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 (event.type == SDL_MOUSEBUTTONDOWN - && ( event.button.button == SDL_BUTTON_LEFT - || event.button.button == SDL_BUTTON_RIGHT)) - { - m_pSound->PlayImage(SOUND_CLICK, pos); - } - if (event.type == SDL_MOUSEBUTTONUP - && ( event.button.button == SDL_BUTTON_LEFT - || event.button.button == SDL_BUTTON_RIGHT)) - { - // 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 (event.type == SDL_MOUSEBUTTONDOWN - && ( event.button.button == SDL_BUTTON_LEFT - || event.button.button == SDL_BUTTON_RIGHT)) - { - m_pDecor->HideTooltips(true); // plus de tooltips pour décor - } - if (event.type == SDL_MOUSEBUTTONUP - && ( event.button.button == SDL_BUTTON_LEFT - || event.button.button == SDL_BUTTON_RIGHT)) - { - m_pDecor->HideTooltips(false); - } - } - - - Sint32 i = 0; - while ( table[m_index].buttons[i].message != 0 ) - { - if ( m_buttons[i].TreatEvent(event) ) return true; - i ++; - } - - if ( m_phase == WM_PHASE_PLAY ) - { - if ( m_menu.TreatEvent(event) ) return true; - } - - return false; -} - - -// Indique si la souris est sur un bouton. - -bool CEvent::MouseOnButton(POINT pos) -{ - Sint32 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. - -Sint32 CEvent::SearchPhase(Uint32 phase) -{ - Sint32 i=0; - - while ( table[i].phase != 0 ) - { - if ( table[i].phase == phase ) return i; - i ++; - } - - return -1; -} - -// Donne le numéro du monde. - -Sint32 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. - -Sint32 CEvent::GetPhysicalWorld() -{ - if ( m_bPrivate ) return m_private+200; - if ( m_bSchool ) return m_exercice; - else return m_mission+100; -} - -Sint32 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 ( m_bHelp || m_pDecor->GetTotalTime() > DEF_TIME_HELP ) - { - bHide = false; - } - if ( m_bSchool || m_bPrivate ) - { - bHide = true; // pas d'aide pour les exercices - } - - return bHide; -} - -// Change de phase. - -bool CEvent::ChangePhase(Uint32 phase) -{ - Sint32 index, world, time, total, music, i, max; - POINT totalDim, iconDim; - char filename[MAX_PATH]; - char* pButtonExist; - bool bEnable, bHide; - Term* pTerm; - - 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_keymod = 0; - 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 - } - - // FIXME: pause is better if the game is not stop but just interrupted - if (m_phase == WM_PHASE_PLAY && m_phase != phase) - m_pSound->StopAllSounds (); - - m_phase = phase; // change de phase - m_index = index; - - strcpy(filename, table[m_index].backName); - if ( strstr(filename, "%.3d") != nullptr ) // "%.3d" dans le nom ? - { - sprintf(filename, table[m_index].backName, GetImageWorld()); - } - totalDim.x = LXIMAGE; - totalDim.y = LYIMAGE; - iconDim.x = 0; - iconDim.y = 0; - if ( !m_pPixmap->Cache(CHBACK, filename, totalDim, iconDim) ) - { - 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 ( m_bAccessBuild || - m_pDecor->GetTotalTime() > DEF_TIME_HELP*6 ) - { - bEnable = true; - } - - if ( GetWorld() >= 99 ) - { - bEnable = false; - } - - 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 ( 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); - } - } - - 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->StopMusic (); - m_pSound->PlayMusic(filename); - } - } - } - - if ( phase == WM_PHASE_H0MOVIE ) - { - strcpy(m_movieToStart, "movie/history0.mkv"); - m_phaseAfterMovie = WM_PHASE_HISTORY0; - } - - if ( phase == WM_PHASE_H1MOVIE ) - { - strcpy(m_movieToStart, "movie/history1.mkv"); - m_phaseAfterMovie = WM_PHASE_HISTORY1; - } - - if ( phase == WM_PHASE_H2MOVIE ) - { - strcpy(m_movieToStart, "movie/history2.mkv"); - m_phaseAfterMovie = WM_PHASE_INFO; - } - - if ( phase == WM_PHASE_PLAYMOVIE ) - { - sprintf(m_movieToStart, "movie/play%.3d.mkv", GetPhysicalWorld()); - m_phaseAfterMovie = WM_PHASE_PLAY; - } - - if ( phase == WM_PHASE_WINMOVIE ) - { - sprintf(m_movieToStart, "movie/win%.3d.mkv", GetPhysicalWorld()); - 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. - -Uint32 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(Sint32 dx, Sint32 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) -{ - Sint32 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_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, const SDL_Event &event) -{ - bool bDecor = false; - bool bMap = false; - Sint32 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); - - 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 (event.button.button == SDL_BUTTON_RIGHT) - { - 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, !!(m_keymod & KMOD_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, Uint16 mod) -{ - if ( m_bMenu ) - { - if ( !m_menu.IsExist() ) - { - m_bMenu = false; - m_pDecor->HideTooltips(false); - m_menu.Delete(); - } - return true; - } - - m_pDecor->StatisticMove(pos); - - if ( m_bMouseDown ) // bouton souris pressé ? - { - if ( m_bHili ) - { - m_pDecor->BlupiHiliMove(pos, !!(mod & KMOD_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, Uint16 mod) -{ - static Sint32 table_sound_boing[3] = - { - SOUND_BOING1, - SOUND_BOING2, - SOUND_BOING3, - }; - - m_pDecor->StatisticUp(pos); - - if ( m_bMouseDown ) // bouton souris pressé ? - { - if ( m_bHili ) - { - m_pDecor->BlupiHiliUp(pos, !!(mod & KMOD_SHIFT)); - } - else - { - m_pDecor->BlupiGetButtons(pos, m_menuNb, m_menuButtons, - m_menuErrors, m_menuTexts, 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_pPixmap, m_pSound, - pos, m_menuNb, m_menuButtons, m_menuErrors, - m_menuTexts, 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(Sint32 message) -{ - Sint32 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->AdaptVolumeMusic (); - } - } - if ( message == WM_BUTTON6 ) - { - volume = m_pSound->GetMidiVolume(); - if ( volume < MAXVOLUME ) - { - m_pSound->SetMidiVolume(volume+1); - m_pSound->AdaptVolumeMusic (); - } - } - - 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, Sint32 insIcon) -{ - Sint32 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, Sint32 insIcon) -{ - Sint32 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 Sint32 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 Sint32 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 Sint32 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, Uint16 mod, bool bMix) -{ - POINT cel; - Sint32 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 (mod & KMOD_CTRL) // 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 (mod & KMOD_CTRL) // 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 (mod & KMOD_CTRL) // 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, Uint16 mod, const SDL_Event &event) -{ - if (event.motion.state & SDL_BUTTON (SDL_BUTTON_LEFT)) // bouton souris pressé ? - { - BuildDown(pos, mod, 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) -{ - return true; -} - - -// Démarre un film non interractif. - -bool CEvent::StartMovie(const char *pFilename) -{ - RECT rect; - - 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(); - - if ( !m_pMovie->Play(rect, pFilename) ) return false; - m_bRunMovie = true; - return true; -} - -// Stoppe un film non interractif. - -void CEvent::StopMovie() -{ - m_pMovie->Stop(); - 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(Sint32 message) -{ - Sint32 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(Sint32 message) -{ - Sint32 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() -{ - Sint32 i, nb, h1, h2; - Term term; - char string[100]; - char buffer[100]; - const char *text = nullptr; - - snprintf (m_libelle, sizeof (m_libelle), "%s", "1|Goal :"); - - memcpy(&term, m_pDecor->GetTerminated(), sizeof(Term)); - nb = 0; - for ( i=0 ; i<2 ; i++ ) // 2 objectifs au maximum ! - { - text = nullptr; - - if ( term.bKillRobots ) - { - term.bKillRobots = false; - text = gettext ("1|Kill all\n1|enemies !"); - } - else if ( term.bHachBlupi ) - { - term.bHachBlupi = false; - text = gettext ("1|Go on striped\n1| paving stones."); - } - else if ( term.bHachPlanche ) - { - term.bHachPlanche = false; - text = gettext ("1|Drop planks on striped \n1|paving stones."); - } - else if ( term.bHachTomate ) - { - term.bHachTomate = false; - text = gettext ("1|Drop tomatoes on striped \n1|paving stones."); - } - else if ( term.bHachMetal ) - { - term.bHachMetal = false; - text = gettext ("1|Drop platinium on striped \n1|paving stones."); - } - else if ( term.bHachRobot ) - { - term.bHachRobot = false; - text = gettext ("1|The robot must reach\n1|the striped paving stones."); - } - else if ( term.bHomeBlupi ) - { - term.bHomeBlupi = false; - text = gettext ("1|Each Blupi in\n1|his house."); - } - else if ( term.bStopFire ) - { - term.bStopFire = false; - text = gettext ("1|Resist until\n1|fire extinction ..."); - } - - if (!text) - break; - - strcat(m_libelle, "\n1|\n"); - strcat(m_libelle, text); - nb ++; - } - - if ( nb == 0 || term.nbMaxBlupi > 1 ) - { - snprintf (buffer, sizeof (buffer), - "%s", "1|The Blupi population must \n1|be of at least %d Blupis."); - 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(Sint32 world, bool bSchool, bool bHelp) -{ - FILE* file = nullptr; - char* pBuffer = nullptr; - char* pText; - char* pDest; - char indic; - Sint32 h1, h2; - size_t nb; - - if ( bSchool ) indic = '$'; - else indic = '#'; - if ( bHelp ) indic = '@'; - - pBuffer = (char*)malloc(sizeof(char)*50000); - if ( pBuffer == nullptr ) goto error; - memset(pBuffer, 0, sizeof(char)*50000); - - file = fopen((GetBaseDir () + "data/enigmes.blp").c_str (), "rb"); - if ( file == nullptr ) 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 != nullptr ) free(pBuffer); - if ( file != nullptr ) fclose(file); - return false; -} - - -// Sauve les informations sur disque. - -bool CEvent::WriteInfo() -{ - char filename[MAX_PATH]; - FILE* file = nullptr; - DescInfo info; - size_t nb; - - strcpy(filename, "data/info.blp"); - AddUserPath(filename); - - file = fopen(filename, "wb"); - if ( file == nullptr ) 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 != nullptr ) fclose(file); - return false; -} - -// Lit les informations sur disque. - -bool CEvent::ReadInfo() -{ - char filename[MAX_PATH]; - FILE* file = nullptr; - DescInfo info; - size_t nb; - - strcpy(filename, "data/info.blp"); - AddUserPath(filename); - - file = fopen(filename, "rb"); - if ( file == nullptr ) 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 != nullptr ) fclose(file); - return false; -} - - -// Modifie la vitesse du jeu. - -void CEvent::SetSpeed(Sint32 speed) -{ - Sint32 max; - - if ( m_bSpeed ) max = 8; - else max = 2; - - if ( speed > max ) speed = max; - - m_speed = speed; -} - -Sint32 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 == nullptr ) 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 = nullptr; - DemoHeader header; - - if ( m_bDemoPlay ) return; - - if ( m_pDemoBuffer != nullptr ) - { - unlink ("data/demo.blp"); - file = fopen("data/demo.blp", "wb"); - if ( file != nullptr ) - { - 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 = nullptr; - } - - 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 = nullptr; - DemoHeader header; - Sint32 world, time, total; - size_t nb; - - m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent)); - if ( m_pDemoBuffer == nullptr ) return false; - memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent)); - - sprintf(filename, (GetBaseDir () + "data/demo%.3d.blp").c_str (), m_demoNumber); - file = fopen(filename, "rb"); - if ( file == nullptr ) - { - 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 != nullptr ) - { - free(m_pDemoBuffer); - m_pDemoBuffer = nullptr; - } - m_bDemoPlay = false; - m_bDemoRec = false; - m_demoTime = 0; - - ChangePhase(WM_PHASE_INIT); -} - -void CEvent::WinToSDLEvent (Uint32 msg, WPARAM wParam, LPARAM lParam, SDL_Event &event) -{ -#define GET_X_LPARAM(lp) ((Sint32) (Sint16) LOWORD (lp)) -#define GET_Y_LPARAM(lp) ((Sint32) (Sint16) HIWORD (lp)) - - static const std::unordered_map keycodes = { - { '0', { SDL_SCANCODE_0, SDLK_0, 0, 0 } }, - { '1', { SDL_SCANCODE_1, SDLK_1, 0, 0 } }, - { '2', { SDL_SCANCODE_2, SDLK_2, 0, 0 } }, - { '3', { SDL_SCANCODE_3, SDLK_3, 0, 0 } }, - { '4', { SDL_SCANCODE_4, SDLK_4, 0, 0 } }, - { '5', { SDL_SCANCODE_5, SDLK_5, 0, 0 } }, - { '6', { SDL_SCANCODE_6, SDLK_6, 0, 0 } }, - { '7', { SDL_SCANCODE_7, SDLK_7, 0, 0 } }, - { '8', { SDL_SCANCODE_8, SDLK_8, 0, 0 } }, - { '9', { SDL_SCANCODE_9, SDLK_9, 0, 0 } }, - { 'A', { SDL_SCANCODE_A, SDLK_a, 0, 0 } }, - { 'B', { SDL_SCANCODE_B, SDLK_b, 0, 0 } }, - { 'C', { SDL_SCANCODE_C, SDLK_c, 0, 0 } }, - { 'D', { SDL_SCANCODE_D, SDLK_d, 0, 0 } }, - { 'E', { SDL_SCANCODE_E, SDLK_e, 0, 0 } }, - { 'F', { SDL_SCANCODE_F, SDLK_f, 0, 0 } }, - { 'G', { SDL_SCANCODE_G, SDLK_g, 0, 0 } }, - { 'H', { SDL_SCANCODE_H, SDLK_h, 0, 0 } }, - { 'I', { SDL_SCANCODE_I, SDLK_i, 0, 0 } }, - { 'J', { SDL_SCANCODE_J, SDLK_j, 0, 0 } }, - { 'K', { SDL_SCANCODE_K, SDLK_k, 0, 0 } }, - { 'L', { SDL_SCANCODE_L, SDLK_l, 0, 0 } }, - { 'M', { SDL_SCANCODE_M, SDLK_m, 0, 0 } }, - { 'N', { SDL_SCANCODE_N, SDLK_n, 0, 0 } }, - { 'O', { SDL_SCANCODE_O, SDLK_o, 0, 0 } }, - { 'P', { SDL_SCANCODE_P, SDLK_p, 0, 0 } }, - { 'Q', { SDL_SCANCODE_Q, SDLK_q, 0, 0 } }, - { 'R', { SDL_SCANCODE_R, SDLK_r, 0, 0 } }, - { 'S', { SDL_SCANCODE_S, SDLK_0, 0, 0 } }, - { 'T', { SDL_SCANCODE_T, SDLK_t, 0, 0 } }, - { 'U', { SDL_SCANCODE_U, SDLK_u, 0, 0 } }, - { 'V', { SDL_SCANCODE_V, SDLK_v, 0, 0 } }, - { 'W', { SDL_SCANCODE_W, SDLK_w, 0, 0 } }, - { 'X', { SDL_SCANCODE_X, SDLK_x, 0, 0 } }, - { 'Y', { SDL_SCANCODE_Y, SDLK_y, 0, 0 } }, - { 'Z', { SDL_SCANCODE_Z, SDLK_z, 0, 0 } }, - { VK_LEFT, { SDL_SCANCODE_LEFT, SDLK_LEFT, 0, 0 } }, - { VK_UP, { SDL_SCANCODE_UP, SDLK_UP, 0, 0 } }, - { VK_RIGHT, { SDL_SCANCODE_RIGHT, SDLK_RIGHT, 0, 0 } }, - { VK_DOWN, { SDL_SCANCODE_DOWN, SDLK_DOWN, 0, 0 } }, - { VK_END, { SDL_SCANCODE_END, SDLK_END, 0, 0 } }, - }; - - try - { - switch (msg) - { - case WM_KEYUP: - case WM_KEYDOWN: - event.type = msg == WM_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP; - event.key.keysym = keycodes.at (wParam); - // TODO: lParam - break; - - case WM_LBUTTONUP: - case WM_LBUTTONDOWN: - event.type = msg == WM_LBUTTONDOWN ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP; - event.button.button = SDL_BUTTON_LEFT; - // TODO: wParam CTRL or SHIFT - event.button.x = GET_X_LPARAM (lParam); - event.button.y = GET_Y_LPARAM (lParam); - break; - - case WM_RBUTTONUP: - case WM_RBUTTONDOWN: - event.type = msg == WM_RBUTTONDOWN ? SDL_MOUSEBUTTONDOWN : SDL_MOUSEBUTTONUP; - event.button.button = SDL_BUTTON_RIGHT; - // TODO: wParam CTRL or SHIFT - event.button.x = GET_X_LPARAM (lParam); - event.button.y = GET_Y_LPARAM (lParam); - break; - - case WM_MOUSEMOVE: - event.type = SDL_MOUSEMOTION; - // TODO: wParam CTRL or SHIFT - event.motion.x = GET_X_LPARAM (lParam); - event.motion.y = GET_Y_LPARAM (lParam); - break; - } - } - catch (...) - { - SDL_LogError (SDL_LOG_CATEGORY_APPLICATION, "unsupported keycode"); - } -} - -// Avance l'index d'enregistrement ou de reproduction. - -void CEvent::DemoStep() -{ - Sint32 time; - Uint32 message; - WPARAM wParam; - LPARAM lParam; - - 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 != nullptr ) - { - 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) - { - POINT pos = ConvLongToPos (lParam); - SDL_WarpMouseInWindow (g_window, pos.x, pos.y); - } - - SDL_Event event = { 0 }; - CEvent::WinToSDLEvent (message, wParam, lParam, event); - TreatEventBase(event); - - 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(Uint32 message, WPARAM wParam, LPARAM lParam) -{ - if ( m_bDemoRec && m_pDemoBuffer != nullptr && - (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 = static_cast (wParam); - m_pDemoBuffer[m_demoIndex-1].lParam = static_cast (lParam); - } - else - { - m_pDemoBuffer[m_demoIndex].time = m_demoTime; - m_pDemoBuffer[m_demoIndex].message = message; - m_pDemoBuffer[m_demoIndex].wParam = static_cast (wParam); - m_pDemoBuffer[m_demoIndex].lParam = static_cast (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(const SDL_Event &event) -{ - if (m_bDemoPlay) - { - if (event.type == SDL_KEYDOWN || - event.type == SDL_KEYUP || - event.type == SDL_MOUSEBUTTONUP) // is the user clicking? - { - DemoPlayStop (); - return true; - } - - if (event.type == SDL_MOUSEMOTION) // is the user moving? - return true; - } - - return TreatEventBase(event); -} - -// Traitement d'un événement. - -bool CEvent::TreatEventBase(const SDL_Event &event) -{ - POINT pos; - Sint32 i, sound; - char c; - bool bEnable; - - //DemoRecEvent(message, wParam, lParam); XXX: use SDL_Event - - switch (event.type) - { - case SDL_KEYDOWN: - if ( event.key.keysym.sym >= SDLK_a && event.key.keysym.sym <= SDLK_z ) - { - if ( m_posCheat == 0 ) // première lettre ? - { - m_rankCheat = -1; - for ( i=0 ; i<9 ; i++ ) - { - if ( (char) event.key.keysym.sym == 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) event.key.keysym.sym == 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 ( m_rankCheat == 5 ) // helpme ? - { - m_bHelp = !m_bHelp; - bEnable = m_bHelp; - m_bChangeCheat = true; - } - - 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 ( m_rankCheat == 8 ) // construire ? - { - m_bAccessBuild = !m_bAccessBuild; - bEnable = m_bAccessBuild; - m_bChangeCheat = true; - } - - 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 ) - { - SDL_Event ev; - ev.type = SDL_QUIT; - SDL_PushEvent (&ev); - } - - switch (event.key.keysym.sym) - { - case SDLK_END: - DemoRecStop(); - return true; - case SDLK_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 ) - { - SDL_Event ev; - ev.type = SDL_QUIT; - SDL_PushEvent (&ev); - break; - } - return true; - case SDLK_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 SDLK_LEFT: - DecorShift(-2,2); - return true; - case SDLK_RIGHT: - DecorShift(2,-2); - return true; - case SDLK_UP: - DecorShift(-3,-3); - return true; - case SDLK_DOWN: - DecorShift(3,3); - return true; - case SDLK_HOME: - pos = m_pDecor->GetHome(); - m_pDecor->SetCoin(pos); - return true; - case SDLK_SPACE: - if ( m_bRunMovie ) - { - StopMovie(); - m_pSound->SetSuspendSkip(1); - return true; - } - m_pDecor->FlipOutline(); - return true; - case SDLK_PAUSE: - m_bPause = !m_bPause; - if ( m_phase == WM_PHASE_PLAY ) - { - if ( m_bPause ) - { - m_pSound->SuspendMusic(); - } - else - { - m_pSound->RestartMusic(); - } - } - return true; - - case SDLK_LSHIFT: - case SDLK_RSHIFT: - m_keymod |= KMOD_SHIFT; - break; - - case SDLK_LCTRL: - case SDLK_RCTRL: - m_keymod |= KMOD_CTRL; - if ( m_phase == WM_PHASE_BUILD ) - { - m_bFillMouse = true; - MouseSprite(GetMousePos()); - } - else - { - m_bFillMouse = false; - } - return true; - case SDLK_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 SDLK_F8: - if ( m_phase == WM_PHASE_PLAY ) - { - m_pDecor->MemoPos(0, !!(m_keymod & KMOD_CTRL)); - } - return true; - case SDLK_F10: - if ( m_phase == WM_PHASE_PLAY ) - { - m_pDecor->MemoPos(1, !!(m_keymod & KMOD_CTRL)); - } - return true; - case SDLK_F11: - if ( m_phase == WM_PHASE_PLAY ) - { - m_pDecor->MemoPos(2, !!(m_keymod & KMOD_CTRL)); - } - return true; - case SDLK_F12: - if ( m_phase == WM_PHASE_PLAY ) - { - m_pDecor->MemoPos(3, !!(m_keymod & KMOD_CTRL)); - } - return true; - } - break; - - case SDL_KEYUP: - switch (event.key.keysym.sym) - { - case SDLK_LSHIFT: - case SDLK_RSHIFT: - m_keymod &= ~KMOD_SHIFT; - break; - - case SDLK_LCTRL: - case SDLK_RCTRL: - m_keymod &= ~KMOD_CTRL; - m_bFillMouse = false; - MouseSprite(GetMousePos()); - return true; - } - break; - - case SDL_MOUSEBUTTONDOWN: - if ( event.button.button != SDL_BUTTON_LEFT - && event.button.button != SDL_BUTTON_RIGHT) - break; - - pos.x = event.button.x; - pos.y = event.button.y; - - MouseSprite(pos); -//? DecorAutoShift(pos); - if ( EventButtons(event, pos) ) return true; - if ( m_phase == WM_PHASE_BUILD ) - { - if ( BuildDown(pos, m_keymod) ) return true; - } - if ( m_phase == WM_PHASE_PLAY ) - { - if ( PlayDown(pos, event) ) return true; - } - break; - - case SDL_MOUSEMOTION: - pos.x = event.motion.x; - pos.y = event.motion.y; - - m_oldMousePos = pos; - - MouseSprite(pos); - if ( EventButtons(event, pos) ) return true; - if ( m_phase == WM_PHASE_BUILD ) - { - if ( BuildMove(pos, m_keymod, event) ) return true; - } - if ( m_phase == WM_PHASE_PLAY ) - { - if ( PlayMove(pos, m_keymod) ) return true; - } - break; - - case SDL_MOUSEBUTTONUP: - if ( event.button.button != SDL_BUTTON_LEFT - && event.button.button != SDL_BUTTON_RIGHT) - break; - - pos.x = event.button.x; - pos.y = event.button.y; - - if ( EventButtons(event, pos) ) return true; - if ( m_phase == WM_PHASE_BUILD ) - { - if ( BuildUp(pos) ) return true; - } - if ( m_phase == WM_PHASE_PLAY ) - { - if ( PlayUp(pos, m_keymod) ) return true; - } - if ( m_phase == WM_PHASE_BYE ) - { - SDL_Event ev; - ev.type = SDL_QUIT; - SDL_PushEvent (&ev); - } - break; - - case SDL_USEREVENT: - switch (event.user.code) - { - 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(event.user.code) ) 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(event.user.code); - 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(event.user.code); - 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(event.user.code); - 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; -} - -// 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; - } - } -} - -void CEvent::PushUserEvent (Sint32 code) -{ - SDL_Event event; - - event.type = SDL_USEREVENT; - event.user.code = code; - event.user.data1 = nullptr; - event.user.data2 = nullptr; - - SDL_PushEvent (&event); - -} - diff --git a/src/event.h.orig b/src/event.h.orig deleted file mode 100644 index 9129f6e..0000000 --- a/src/event.h.orig +++ /dev/null @@ -1,228 +0,0 @@ -// Event.h - -#pragma once - -#include -#include -#include "blupi.h" -#include "jauge.h" -#include "menu.h" -#include "button.h" - -class CMovie; - -///////////////////////////////////////////////////////////////////////////// - -typedef struct -{ - Uint32 message; - Sint32 type; - Sint32 iconMenu[20]; - Sint32 x, y; - const char *toolTips[16]; -} -Button; - -typedef struct -{ - Uint32 phase; - char backName[20]; - Sint32 bCDrom; - Button buttons[MAXBUTTON]; -} -Phase; - - -typedef struct -{ - Sint16 majRev; - Sint16 minRev; - Sint16 bSchool; - Sint16 bPrivate; - Sint16 world; - Sint16 skill; - Sint16 reserve1[99]; -} -DemoHeader; - -typedef struct -{ - Sint32 time; - Uint32 message; - Uint32 wParam; // WPARAM - Uint32 lParam; // LPARAM -} -DemoEvent; - - -class CEvent -{ -public: - CEvent(); - ~CEvent(); - - POINT GetMousePos(); - void Create(CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CMovie *pMovie); - void SetFullScreen(bool bFullScreen); - void SetMouseType(Sint32 mouseType); - Sint32 GetWorld(); - Sint32 GetPhysicalWorld(); - Sint32 GetImageWorld(); - bool IsHelpHide(); - bool ChangePhase(Uint32 phase); - void MovieToStart(); - Uint32 GetPhase(); - void TryInsert(); - void RestoreGame(); - - Sint32 GetButtonIndex(Sint32 button); - Sint32 GetState(Sint32 button); - void SetState(Sint32 button, Sint32 state); - bool GetEnable(Sint32 button); - void SetEnable(Sint32 button, bool bEnable); - bool GetHide(Sint32 button); - void SetHide(Sint32 button, bool bHide); - Sint32 GetMenu(Sint32 button); - void SetMenu(Sint32 button, Sint32 menu); - - bool DrawButtons(); - MouseSprites MousePosToSprite(POINT pos); - void MouseSprite(POINT pos); - void WaitMouse(bool bWait); - void HideMouse(bool bHide); - POINT GetLastMousePos(); - bool TreatEvent(const SDL_Event &event); - bool TreatEventBase(const SDL_Event &event); - - void DecorAutoShift(POINT pos); - - bool StartMovie(const char *pFilename); - void StopMovie(); - bool IsMovie(); - - void Read(Sint32 message); - void Write(Sint32 message); - - void SetSpeed(Sint32 speed); - Sint32 GetSpeed(); - bool GetPause(); - bool IsShift(); - - void DemoStep(); - - void IntroStep(); - -public: - static void PushUserEvent (Sint32 code); - -protected: - void DrawTextCenter(const char *text, Sint32 x, Sint32 y, Sint32 font=0); - bool CreateButtons(); - bool EventButtons(const SDL_Event &event, POINT pos); - bool MouseOnButton(POINT pos); - Sint32 SearchPhase(Uint32 phase); - void DecorShift(Sint32 dx, Sint32 dy); - - bool PlayDown(POINT pos, const SDL_Event &event); - bool PlayMove(POINT pos, Uint16 mod); - bool PlayUp(POINT pos, Uint16 mod); - void ChangeButtons(Sint32 message); - - void BuildFloor(POINT cel, Sint32 insIcon); - void BuildWater(POINT cel, Sint32 insIcon); - bool BuildDown(POINT pos, Uint16 mod, bool bMix=true); - bool BuildMove(POINT pos, Uint16 mod, const SDL_Event &event); - bool BuildUp(POINT pos); - - void PrivateLibelle(); - bool ReadLibelle(Sint32 world, bool bSchool, bool bHelp); - bool WriteInfo(); - bool ReadInfo(); - - void DemoRecStart(); - void DemoRecStop(); - bool DemoPlayStart(); - void DemoPlayStop(); - static void WinToSDLEvent (Uint32 msg, WPARAM wParam, LPARAM lParam, SDL_Event &event); - void DemoRecEvent(Uint32 message, WPARAM wParam, LPARAM lParam); - -protected: - Sint32 m_speed; - Sint32 m_exercice; - Sint32 m_mission; - Sint32 m_private; - Sint32 m_maxMission; - Uint32 m_phase; - Sint32 m_index; - bool m_bSchool; - bool m_bPrivate; - bool m_bAccessBuild; - bool m_bFullScreen; - Sint32 m_mouseType; - CPixmap* m_pPixmap; - CDecor* m_pDecor; - CSound* m_pSound; - CMovie* m_pMovie; - char m_movieToStart[MAX_PATH]; - Sint32 m_phaseAfterMovie; - CButton m_buttons[MAXBUTTON]; - Sint32 m_lastFloor[MAXBUTTON]; - Sint32 m_lastObject[MAXBUTTON]; - Sint32 m_lastHome[MAXBUTTON]; - bool m_bRunMovie; - bool m_bBuildModify; - CJauge m_jauges[2]; - CMenu m_menu; - bool m_bMenu; - POINT m_menuPos; - Sint32 m_menuNb; - Sint32 m_menuButtons[MAXBUTTON]; - Sint32 m_menuErrors[MAXBUTTON]; - std::unordered_map m_menuTexts; - Sint32 m_menuPerso; - POINT m_menuCel; - POINT m_oldMousePos; - bool m_bMouseDown; - bool m_bHili; - Sint32 m_fileWorld[10]; - Sint32 m_fileTime[10]; - POINT m_posToolTips; - char m_textToolTips[50]; - MouseSprites m_mouseSprite; - bool m_bFillMouse; - bool m_bWaitMouse; - bool m_bHideMouse; - Sint32 m_rankCheat; - Sint32 m_posCheat; - bool m_bMovie; - bool m_bSpeed; - bool m_bHelp; - bool m_bAllMissions; - bool m_bChangeCheat; - Sint32 m_scrollSpeed; - bool m_bPause; - bool m_bShift; - Sint32 m_shiftPhase; - POINT m_shiftVector; - POINT m_shiftOffset; - char m_libelle[1000]; - Sint32 m_tryPhase; - Sint32 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; - Sint32 m_demoTime; - size_t m_demoIndex; - size_t m_demoEnd; - Sint32 m_demoNumber; - Uint16 m_keymod; - POINT m_debugPos; - Sint32 m_introTime; -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/fifo.cpp.orig b/src/fifo.cpp.orig deleted file mode 100644 index b2b5ab1..0000000 --- a/src/fifo.cpp.orig +++ /dev/null @@ -1,64 +0,0 @@ -// Class CFifo, gestion d'une liste en fifo - -#include -#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(Sint32 taille) -{ - m_taille = taille; - m_max = m_out = 0; - m_data = (Element*) malloc (sizeof(Element)*taille); -} - -CPileTriee::~CPileTriee() -{ - free( m_data ); -} - -Sint32 CPileTriee::get() -{ - if (m_out == m_max) return -1; - Sint32 val = m_data [m_out].pos; - m_out++; - if (m_out>=m_taille) m_out = 0; - return val; -} - -void CPileTriee::put(Sint32 pos, Sint32 dist) -{ - Sint32 i=m_out; - Sint32 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; - } -} diff --git a/src/fifo.h.orig b/src/fifo.h.orig deleted file mode 100644 index 437cb7f..0000000 --- a/src/fifo.h.orig +++ /dev/null @@ -1,33 +0,0 @@ - -#pragma once - -// traitement d'une liste en fifo - - -// stucture pour enpiler des positions -// en fonction de leur distance à la cible -typedef struct -{ - Sint32 pos; - Sint32 dist; -} -Element; - - -// traitement d'une pile triée - -class CPileTriee -{ -private: - Sint32 m_taille; // nombre de polongs max - Sint32 m_max; // position limite - Sint32 m_out; // position pour reprendre - Element* m_data; // données - -public: - CPileTriee(Sint32 taille); - ~CPileTriee(); - - void put(Sint32 pos, Sint32 dist); - Sint32 get(); -}; \ No newline at end of file diff --git a/src/fog.cpp.orig b/src/fog.cpp.orig deleted file mode 100644 index 62229c8..0000000 --- a/src/fog.cpp.orig +++ /dev/null @@ -1,152 +0,0 @@ -// Fog.cpp - -#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(Sint32 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. - -Sint32 GetFogIcon(char *pBits) -{ - Sint32 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(Sint32 rank) -{ - Sint32 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/src/jauge.cpp.orig b/src/jauge.cpp.orig deleted file mode 100644 index 420ae07..0000000 --- a/src/jauge.cpp.orig +++ /dev/null @@ -1,150 +0,0 @@ -// Jauge.cpp -// - -#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(CPixmap *pPixmap, CSound *pSound, - POINT pos, Sint32 type, bool bMinimizeRedraw) -{ - 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() -{ - Sint32 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(Sint32 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(Sint32 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/src/jauge.h.orig b/src/jauge.h.orig deleted file mode 100644 index 25de815..0000000 --- a/src/jauge.h.orig +++ /dev/null @@ -1,44 +0,0 @@ -// Jauge.h - -#pragma once - -class CPixmap; -class CDecor; -class CSound; - -///////////////////////////////////////////////////////////////////////////// - -class CJauge -{ -public: - CJauge(); - ~CJauge(); - - bool Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, Sint32 type, bool bMinimizeRedraw); - void Draw(); - void Redraw(); - - void SetLevel(Sint32 level); - void SetType(Sint32 type); - - bool GetHide(); - void SetHide(bool bHide); - - POINT GetPos(); - void SetRedraw(); - -protected: - 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 - Sint32 m_type; - Sint32 m_level; - bool m_bMinimizeRedraw; - bool m_bRedraw; // true -> doit être redessiné -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/menu.cpp.orig b/src/menu.cpp.orig deleted file mode 100644 index 1bb5488..0000000 --- a/src/menu.cpp.orig +++ /dev/null @@ -1,496 +0,0 @@ -// Menu.cpp -// - -#include -#include -#include "blupi.h" -#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" -#include "event.h" - - -///////////////////////////////////////////////////////////////////////////// - - -#define MARGMENU 0 - - -static const Sint16 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 -}; - -static const char *GetText(Sint32 rank) -{ - static const char *list[] = { - "Go", - "Stop", - "Eat", - "Take", - "Drop", - "Cut down a tree", - "Carve a rock", - "Grow tomatoes", - "Garden shed", - "Incubator", - "Laboratory", - "Mine", - "Workshop", - "Teleporter", - "Wall", - "Palisade", - "Cut down trees", - "Carve rocks", - "Bridge", - "Protection tower", - "Drink", - "Transform", - "Make bunch of flowers", - "Make bunches of flowers", - "Blow up", - "Boat", - "Leave Jeep", - "Prospect for iron", - "Extract iron", - "Make a Jeep", - "Make a time bomb", - "Make a helper robot", - "Repeat", - "Quit", - "Make armour", - }; - - return gettext (list[rank]); -} - -static const char *GetErr(Sint32 rank) -{ - static const char *list[] = { - "Impossible", - "Inadequate ground", - "Occupied ground", - "Opposite bank no good", - "Bridge finished", - "(isolated tower)", - "Too close to water", - "Already two teleporters", - }; - - return gettext (list[rank]); -} - - -///////////////////////////////////////////////////////////////////////////// - -// Constructeur. - -CMenu::CMenu() -{ - m_nbButtons = 0; - m_selRank = -1; -} - -// Destructeur. - -CMenu::~CMenu() -{ -} - - -// Crée un nouveau bouton. - -bool CMenu::Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, Sint32 nb, Sint32 *pButtons, Sint32 *pErrors, - std::unordered_map &texts, - Sint32 perso) -{ - pos.x -= DIMBUTTONX/2; - pos.y -= DIMBUTTONY/2; - - m_pPixmap = pPixmap; - m_pSound = pSound; - m_nbButtons = nb; - m_pos = pos; - m_perso = perso; - - Update(nb, pButtons, pErrors, texts); - - 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; - SDL_WarpMouseInWindow (g_window, pos.x, pos.y); - } - - m_selRank = Detect(pos); - - return true; -} - -// Met à jour le menu. - -void CMenu::Update(Sint32 nb, Sint32 *pButtons, Sint32 *pErrors, - std::unordered_map &texts) -{ - Sint32 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); - - 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 ? - { - snprintf (text, sizeof (text), m_texts[i]); - pText = strchr(text, '\n'); - if ( pText != nullptr ) *pText = 0; - } - else - { - const auto tr = GetText(m_buttons[i]); - snprintf (text, sizeof (text), tr); - } - - 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 ? - { - snprintf (text, sizeof (text), m_texts[i]); - pText = strchr(text, '\n'); - if ( pText != nullptr ) strcpy(text, pText+1); - } - else - { - const auto tr = GetErr (m_errors[i]-1); // impossible ici - snprintf (text, sizeof (text), tr); - } - - 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é. - -Sint32 CMenu::GetSel() -{ - if ( m_selRank == -1 ) return -1; - - return m_buttons[m_selRank]; -} - -// Retourne le rang sélectionné. - -Sint32 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(const SDL_Event &event) -{ - POINT pos; - - if ( m_nbButtons == 0 ) return false; - - //pos = ConvLongToPos(lParam); - - switch (event.type) - { - case SDL_MOUSEBUTTONDOWN: - if ( event.button.button != SDL_BUTTON_LEFT - && event.button.button != SDL_BUTTON_RIGHT) - break; - - pos.x = event.button.x; - pos.y = event.button.y; - if ( MouseDown(pos) ) return true; - break; - - case SDL_MOUSEMOTION: - pos.x = event.motion.x; - pos.y = event.motion.y; - if ( MouseMove(pos) ) return true; - break; - - case SDL_MOUSEBUTTONUP: - if ( event.button.button != SDL_BUTTON_LEFT - && event.button.button != SDL_BUTTON_RIGHT) - break; - - pos.x = event.button.x; - pos.y = event.button.y; - if ( MouseUp(pos) ) return true; - break; - } - - return false; -} - -// Détecte dans quel bouton est la souris. - -Sint32 CMenu::Detect(POINT pos) -{ - Sint32 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_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_selRank = Detect(pos); - - return false; -} - -// Envoie le message. - -void CMenu::Message() -{ - if ( m_selRank != -1 ) - { - CEvent::PushUserEvent (WM_BUTTON0 + m_selRank); - } -} - - diff --git a/src/menu.h.orig b/src/menu.h.orig deleted file mode 100644 index 1f610b2..0000000 --- a/src/menu.h.orig +++ /dev/null @@ -1,54 +0,0 @@ -// Menu.h - -#pragma once - -#include -#include "def.h" - -///////////////////////////////////////////////////////////////////////////// - -class CMenu -{ -public: - CMenu(); - ~CMenu(); - - bool Create(CPixmap *pPixmap, CSound *pSound, - POINT pos, Sint32 nb, Sint32 *pButtons, Sint32 *pErrors, - std::unordered_map &texts, - Sint32 perso); - void Update(Sint32 nb, Sint32 *pButtons, Sint32 *pErrors, - std::unordered_map &texts); - void Delete(); - void Draw(); - Sint32 GetSel(); - Sint32 GetRank(); - bool IsError(); - bool IsExist(); - void Message(); - - bool TreatEvent(const SDL_Event &event); - -protected: - Sint32 Detect(POINT pos); - bool MouseDown(POINT pos); - bool MouseMove(POINT pos); - bool MouseUp(POINT pos); - -protected: - CPixmap* m_pPixmap; - CDecor* m_pDecor; - CSound* m_pSound; - POINT m_pos; // coin sup/gauche - POINT m_dim; // dimensions - Sint32 m_nbButtons; - POINT m_nbCel; - Sint32 m_perso; - Sint32 m_buttons[MAXBUTTON]; - Sint32 m_errors[MAXBUTTON]; - std::unordered_map m_texts; - Uint32 m_messages[MAXBUTTON]; - Sint32 m_selRank; -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/misc.cpp.orig b/src/misc.cpp.orig deleted file mode 100644 index 68e262d..0000000 --- a/src/misc.cpp.orig +++ /dev/null @@ -1,121 +0,0 @@ -// misc.cpp -// - -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -#include -#define mkdir(a, b) _mkdir(a) -#else /* _WIN32 */ -#include -#endif /*! _WIN32 */ - -#include "misc.h" -#include "blupi.h" -#include "def.h" - -// Variables globales - -extern bool g_bFullScreen; // false si mode de test -extern Sint32 g_mouseType; - - -// Affiche un message de debug. - -void OutputDebug(const char *pMessage) -{ - SDL_LogDebug (SDL_LOG_CATEGORY_APPLICATION, "%s", pMessage); -} - -// 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). - -Sint32 Random(Sint32 min, Sint32 max) -{ - Sint32 n; - - n = rand(); - n = min+(n%(max-min+1)); - - return (Sint32)n; -} - - -// Retourne le nom de dossier en cours. - -std::string GetBaseDir () -{ - static std::string basePath; - - if (!basePath.size ()) - { - auto sdlBasePath = SDL_GetBasePath (); - sdlBasePath[strlen (sdlBasePath) - 1] = '\0'; - basePath = sdlBasePath; - std::replace (basePath.begin (), basePath.end (), '\\', '/'); - basePath = basePath.substr (0, basePath.find_last_of ("//") + 1); - SDL_free (sdlBasePath); - } - - return basePath; -} - -// Ajoute le chemin permettant de lire un fichier -// utilisateur. - -void AddUserPath(char *pFilename) -{ - char *temp; - char* pText; - size_t pos; - char last; - - temp = SDL_GetPrefPath ("Epsitec SA", "Planet Blupi"); - std::string path = temp; - - pText = strstr(pFilename, "/"); - if ( pText != nullptr ) - { - pos = path.size () + (pText - pFilename) + 1; - path += pFilename; - last = path[pos]; - path[pos] = 0; - mkdir (path.c_str (), 755); - path[pos] = last; - } - else - path += pFilename; - - strcpy(pFilename, path.c_str ()); - SDL_free (temp); -} diff --git a/src/misc.h.orig b/src/misc.h.orig deleted file mode 100644 index f0e7890..0000000 --- a/src/misc.h.orig +++ /dev/null @@ -1,17 +0,0 @@ -// misc.h -// - -#pragma once - -#include -#include "blupi.h" - -extern void OutputDebug(const char *pMessage); - -extern POINT ConvLongToPos(LPARAM lParam); - -extern void InitRandom(); -extern Sint32 Random(Sint32 min, Sint32 max); - -std::string GetBaseDir(); -extern void AddUserPath(char *pFilename); diff --git a/src/movie.cpp.orig b/src/movie.cpp.orig deleted file mode 100644 index cc050be..0000000 --- a/src/movie.cpp.orig +++ /dev/null @@ -1,293 +0,0 @@ -// movie.cpp -// - -#include -#include -#include -#include "def.h" -#include "blupi.h" -#include "movie.h" -#include "misc.h" -#include "event.h" -#include "kitchensink/kitchensink.h" - - -//---------------------------------------------------------------------------- - -#define AVI_VIDEO "avivideo" - -#define IDM_PLAY 10 - -//---------------------------------------------------------------------------- - -// Initialize avi libraries. - -bool CMovie::initAVI() -{ - // Initialize Kitchensink with network support and all formats. - Sint32 err = Kit_Init (KIT_INIT_FORMATS); - if (err != 0) - { - fprintf (stderr, "Unable to initialize Kitchensink: %s", Kit_GetError ()); - return false; - } - - return true; -} - -// Closes the opened AVI file and the opened device type. | - -void CMovie::termAVI() -{ - Kit_Quit (); -} - -// Close the movie and anything associated with it. | -// This function clears the and flags | - -void CMovie::fileCloseMovie() -{ - m_fPlaying = false; // can't be playing any longer - m_fMovieOpen = false; // no more movies open - - if (m_videoTex) - { - SDL_DestroyTexture (m_videoTex); - m_videoTex = nullptr; - } - - if (m_player) - { - SDL_CloseAudioDevice (m_audioDev); - Kit_ClosePlayer (m_player); - m_player = nullptr; - } - - if (m_movie) - { - Kit_CloseSource (m_movie); - m_movie = nullptr; - } -} - - -// 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(RECT rect, const char *pFilename) -{ - const auto path = GetBaseDir () + pFilename; - - // we got a filename, now close any old movie and open the new one. */ - if ( m_fMovieOpen ) fileCloseMovie(); - - // Open up the sourcefile. - // This can be a local file, network url, ... - m_movie = Kit_CreateSourceFromUrl (path.c_str ()); - if (m_movie) - { - // Create the player - m_player = Kit_CreatePlayer (m_movie); - if (m_player == nullptr) - return false; - - pinfo = new Kit_PlayerInfo; - Kit_GetPlayerInfo (m_player, pinfo); - - SDL_AudioSpec wanted_spec, audio_spec; - - SDL_memset (&wanted_spec, 0, sizeof (wanted_spec)); - wanted_spec.freq = pinfo->audio.samplerate; - wanted_spec.format = pinfo->audio.format; - wanted_spec.channels = pinfo->audio.channels; - m_audioDev = SDL_OpenAudioDevice (nullptr, 0, &wanted_spec, &audio_spec, 0); - SDL_PauseAudioDevice (m_audioDev, 0); - - m_videoTex = SDL_CreateTexture ( - g_renderer, - pinfo->video.format, - SDL_TEXTUREACCESS_STATIC, - pinfo->video.width, - pinfo->video.height - ); - if (m_videoTex == nullptr) - return false; - - return true; - } - else - { - // generic error for open - m_fMovieOpen = false; - return false; - } -} - -// Play/pause the movie depending on the state - -void CMovie::playMovie() -{ - m_fPlaying = !m_fPlaying; // swap the play flag - - // play/pause the AVI movie - if (m_fPlaying) - { - SDL_RenderSetLogicalSize (g_renderer, pinfo->video.width, pinfo->video.height); - Kit_PlayerPlay (m_player); - } - else - Kit_PlayerPause (m_player); -} - - -//---------------------------------------------------------------------------- - - -// Constructeur. - -CMovie::CMovie() -{ - m_bEnable = false; - m_fPlaying = false; - m_fMovieOpen = false; - - m_movie = nullptr; - m_player = nullptr; - m_videoTex = nullptr; - pinfo = nullptr; -} - -// Destructeur. - -CMovie::~CMovie() -{ - termAVI(); -} - -// Ouvre la librairie avi. - -bool CMovie::Create() -{ - if ( initAVI() ) - { - m_bEnable = true; - return true; - } - else - { - m_bEnable = false; - return false; - } -} - -// Retourne l'état de DirectMovie. - -bool CMovie::GetEnable() -{ - return m_bEnable; -} - -// Indique si un film existe. - -bool CMovie::IsExist(const char *pFilename) -{ - const auto path = GetBaseDir () + pFilename; - FILE* file; - - file = fopen(path.c_str (), "rb"); - if ( file == nullptr ) return false; - - fclose(file); - return true; -} - -// Montre un film avi. - -bool CMovie::Play(RECT rect, const char *pFilename) -{ - if ( !m_bEnable ) return false; - if ( !fileOpenMovie(rect, pFilename) ) return false; - playMovie(); - CEvent::PushUserEvent (WM_MOVIE_PLAY); - - return true; -} - -// Stoppe le film avi. - -void CMovie::Stop() -{ - if ( !m_bEnable ) return; - fileCloseMovie(); - SDL_RenderSetLogicalSize (g_renderer, 0, 0); -} - -void CMovie::Pause () -{ - if (!m_bEnable || !m_fPlaying) - return; - - if (Kit_GetPlayerState (m_player) != KIT_PLAYING) - return; - - Kit_PlayerPause (m_player); -} - -void CMovie::Resume () -{ - if (!m_bEnable || !m_fPlaying) - return; - - if (Kit_GetPlayerState (m_player) != KIT_PAUSED) - return; - - Kit_PlayerPlay (m_player); -} - -bool CMovie::Render () -{ - if (!m_bEnable || !m_fPlaying) - return false; - - if (Kit_GetPlayerState (m_player) == KIT_STOPPED) - return false; - - // Refresh audio - if (SDL_GetQueuedAudioSize (m_audioDev) < AUDIOBUFFER_SIZE) - { - Sint32 need = AUDIOBUFFER_SIZE - m_ret; - - SDL_LockAudio (); - while (need > 0) - { - m_ret = Kit_GetAudioData (m_player, (unsigned char*) m_audiobuf, - AUDIOBUFFER_SIZE, (size_t) SDL_GetQueuedAudioSize (m_audioDev)); - need -= m_ret; - if (m_ret > 0) - { - SDL_QueueAudio (m_audioDev, m_audiobuf, m_ret); - } - else - { - break; - } - } - SDL_UnlockAudio (); - SDL_PauseAudioDevice (m_audioDev, 0); - } - - // Clear screen with black - SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255); - SDL_RenderClear (g_renderer); - - // Refresh videotexture and render it - Kit_GetVideoData (m_player, m_videoTex); - SDL_RenderCopy (g_renderer, m_videoTex, nullptr, nullptr); - - SDL_RenderPresent (g_renderer); - CEvent::PushUserEvent (WM_MOVIE_PLAY); - return true; -} diff --git a/src/movie.h.orig b/src/movie.h.orig deleted file mode 100644 index 57df6f2..0000000 --- a/src/movie.h.orig +++ /dev/null @@ -1,48 +0,0 @@ -// movie.h -// - -#pragma once - -struct Kit_Source; -struct Kit_Player; -struct Kit_PlayerInfo; -struct SDL_Texture; - -#define AUDIOBUFFER_SIZE (32768) - -class CMovie -{ -public: - CMovie(); - ~CMovie(); - - bool Create(); - bool GetEnable(); - bool IsExist(const char *pFilename); - bool Play(RECT rect, const char *pFilename); - void Stop(); - void Pause (); - void Resume (); - bool Render (); - -protected: - void playMovie(); - bool fileOpenMovie(RECT rect, const char *pFilename); - void fileCloseMovie(); - void termAVI(); - bool initAVI(); - -protected: - Kit_PlayerInfo *pinfo; - Kit_Source *m_movie; - Kit_Player *m_player; - SDL_Texture *m_videoTex; - Sint32 m_ret; - SDL_AudioDeviceID m_audioDev; - - char m_audiobuf[AUDIOBUFFER_SIZE]; - bool m_bEnable; - bool m_fPlaying; // Play flag: true == playing, false == paused - bool m_fMovieOpen; // Open flag: true == movie open, false = none -}; - diff --git a/src/obstacle.cpp.orig b/src/obstacle.cpp.orig deleted file mode 100644 index 8c6455d..0000000 --- a/src/obstacle.cpp.orig +++ /dev/null @@ -1,3640 +0,0 @@ -// 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(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits) -{ - char* pTable; - Sint32 first, last; - Sint32 dx, dy, x, y, i; - Sint32 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(Sint32 rank, Sint32 icon, POINT cel, Sint32 *pBits) -{ - Sint32 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(Sint32 *pSrc33, Sint32 *pDst99, Sint32 dx, Sint32 dy) -{ - Sint32 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, Sint32 direct, Sint32 rank) -{ - Sint32 icon, workBlupi; - Sint32 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) -{ - Sint32 icon; - Sint32 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, Sint32 rank) -{ - Sint32 icon; - Sint32 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, Sint32 rank) -{ - bool bOK; - POINT limit; - Sint32 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, Sint32 rank) -{ - bool bOK; - POINT limit; - Sint32 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, Sint32 rank) -{ - Sint32 icon, workBlupi; - Sint32 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, Sint32 rank) -{ - Sint32 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, Sint32 rank, - Sint32 &action, POINT &limit) -{ - bool bOK; - Sint32 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, Sint32 rank, - Sint32 &action, POINT &limit) -{ - bool bOK; - Sint32 channel1, icon1; - Sint32 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, Sint32 direct, Sint32 rank, Sint32 &action) -{ - POINT depart, vector; - Sint32 i, icon; - Sint32 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, Sint32 direct, Sint32 rank, Sint32 &action) -{ - Sint32 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. - -Sint32 CDecor::DirectSearch(POINT cel, POINT goal) -{ - POINT dir; - Sint32 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(Sint32 rank) -{ - m_blupi[rank].nbUsed = 0; - m_blupi[rank].nextRankUsed = 0; -} - -// Ajoute une position déjà été essayée. - -void CDecor::AddUsedPos(Sint32 rank, POINT pos) -{ - Sint32 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, Sint32 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(Sint32 rank, POINT initCel, Sint32 action, - Sint32 distMax, Sint32 channel, - Sint32 firstIcon1, Sint32 lastIcon1, - Sint32 firstIcon2, Sint32 lastIcon2, - POINT &foundCel, Sint32 &foundIcon) -{ - Sint32 startx, starty, endx, endy; - Sint32 x, y, xx, yy; - Sint32 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(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon) -{ - Sint32 startx, starty, endx, endy, icon; - Sint32 x, y; - Sint32 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(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon) -{ - Sint32 startx, starty, endx, endy; - Sint32 x, y, direct; - Sint32 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(Sint32 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(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon) -{ - Sint32 startx, starty, endx, endy, icon; - Sint32 x, y; - Sint32 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(Sint32 rank, POINT cel) -{ - Sint32 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(Sint32 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(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon) -{ - Sint32 startx, starty, endx, endy; - Sint32 x, y; - Sint32 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(Sint32 rank, POINT initCel, Sint32 distMax, - POINT &foundCel, Sint32 &foundIcon) -{ - Sint32 startx, starty, endx, endy; - Sint32 x, y, i, d, dd, r; - Sint32 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) -{ - Sint32 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 ! - -Sint32 CDecor::IsBuildPont(POINT &cel, Sint32 &iconBuild) -{ - POINT vector, test; - Sint32 i, channel, icon, p1, p2, p3, r1, r2, nb, rest; - Sint32 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, Sint32 &direct) -{ - Sint32 fChannel, fIcon; - Sint32 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() -{ - Sint32 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) -{ - Sint32 i; - - for ( i=0 ; i -#include -#include - -#ifdef _WIN32 -#include -#define access _access -#else /* _WIN32 */ -#include -#endif /* !_WIN32 */ - -#include "def.h" -#include "pixmap.h" -#include "misc.h" -#include "blupi.h" - - - -///////////////////////////////////////////////////////////////////////////// - - -// Constructeur. - -CPixmap::CPixmap() -{ - Sint32 i; - - m_bFullScreen = false; - m_mouseType = MOUSETYPEGRA; - m_bDebug = true; - m_bPalette = true; - - m_mouseSprite = SPRITE_WAIT; - m_bBackDisplayed = false; - - for (i = 0; i < MAXCURSORS; i++) - m_lpSDLCursors[i] = nullptr; - - for ( i=0 ; i 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 0; - - if ( chDst < 0 ) - { - SDL_Rect srcRect, dstRect; - srcRect.x = rcRect.left; - srcRect.y = rcRect.top; - srcRect.w = rcRect.right - rcRect.left; - srcRect.h = rcRect.bottom - rcRect.top; - dstRect = srcRect; - dstRect.x = dst.x; - dstRect.y = dst.y; - - res = SDL_RenderCopy (g_renderer, m_lpSDLTexture[channel], &srcRect, &dstRect); - } - else - { - SDL_Rect srcRect, dstRect; - srcRect.x = rcRect.left; - srcRect.y = rcRect.top; - srcRect.w = rcRect.right - rcRect.left; - srcRect.h = rcRect.bottom - rcRect.top; - dstRect = srcRect; - dstRect.x = dst.x; - dstRect.y = dst.y; - - SDL_SetRenderTarget (g_renderer, m_lpSDLTexture[chDst]); - res = SDL_RenderCopy (g_renderer, m_lpSDLTexture[channel], &srcRect, &dstRect); - SDL_SetRenderTarget (g_renderer, nullptr); - } - - return res; -} - -// Effectue un appel BltFast. -// Les modes sont 0=transparent, 1=opaque. - -Sint32 CPixmap::BltFast(SDL_Texture *lpSDL, Sint32 channel, POINT dst, RECT rcRect) -{ - Sint32 res; - - SDL_Rect srcRect, dstRect; - srcRect.x = rcRect.left; - srcRect.y = rcRect.top; - srcRect.w = rcRect.right - rcRect.left; - srcRect.h = rcRect.bottom - rcRect.top; - dstRect = srcRect; - dstRect.x = dst.x; - dstRect.y = dst.y; - - SDL_SetRenderTarget (g_renderer, lpSDL); - res = SDL_RenderCopy (g_renderer, m_lpSDLTexture[channel], &srcRect, &dstRect); - SDL_SetRenderTarget (g_renderer, nullptr); - - return res; -} - -// Cache une image contenant des ic�nes. - -bool CPixmap::Cache(Sint32 channel, const char *pFilename, POINT totalDim, POINT iconDim) -{ - if ( channel < 0 || channel >= MAXIMAGE ) return false; - - std::string file = GetBaseDir () + pFilename; - if (access ((file + ".bmp").c_str (), 0 /* F_OK */) != -1) - file += ".bmp"; - - SDL_Surface *surface = SDL_LoadBMP (file.c_str ()); - - if (channel == CHBLUPI) - m_lpSDLBlupi = surface; - - SDL_Texture *texture = SDL_CreateTextureFromSurface (g_renderer, surface); - Uint32 format; - Sint32 access, w, h; - SDL_QueryTexture (texture, &format, &access, &w, &h); - - if (!m_lpSDLTexture[channel]) - { - m_lpSDLTexture[channel] = SDL_CreateTexture (g_renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_TARGET, w, h); - SDL_SetTextureBlendMode (m_lpSDLTexture[channel], SDL_BLENDMODE_BLEND); - } - else - { - SDL_SetRenderTarget (g_renderer, m_lpSDLTexture[channel]); - SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 0); - SDL_RenderClear (g_renderer); - SDL_SetRenderTarget (g_renderer, nullptr); - } - - SDL_SetRenderTarget (g_renderer, m_lpSDLTexture[channel]); - SDL_RenderCopy (g_renderer, texture, nullptr, nullptr); - SDL_SetRenderTarget (g_renderer, nullptr); - - SDL_DestroyTexture (texture); - - //m_lpSDLTexture[channel] = SDL_CreateTextureFromSurface (g_renderer, surface); - if (!m_lpSDLTexture[channel]) - { - SDL_LogError (SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture from surface: %s", SDL_GetError ()); - return false; - } - - if (channel != CHBLUPI) - SDL_FreeSurface (surface); - - strcpy(m_filename[channel], pFilename); - - m_totalDim[channel] = totalDim; - m_iconDim[channel] = iconDim; - - return true; -} - -// Cache une image globale. - -bool CPixmap::Cache(Sint32 channel, const char *pFilename, POINT totalDim) -{ - POINT iconDim; - - if ( channel < 0 || channel >= MAXIMAGE ) return false; - - iconDim.x = 0; - iconDim.y = 0; - - return Cache(channel, pFilename, totalDim, iconDim); -} - -// Cache une image provenant d'un bitmap. - -bool CPixmap::Cache(Sint32 channel, SDL_Surface *surface, POINT totalDim) -{ - if ( channel < 0 || channel >= MAXIMAGE ) return false; - - // Create the offscreen surface, by loading our bitmap. - if (m_lpSDLTexture[channel]) - SDL_DestroyTexture (m_lpSDLTexture[channel]); - - m_lpSDLTexture[channel] = SDL_CreateTextureFromSurface (g_renderer, surface); - - if (!m_lpSDLTexture[channel]) - return false; - - m_totalDim[channel] = totalDim; - m_iconDim[channel] = totalDim; - - return true; -} - -// 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(Sint32 channel, Sint32 rank, POINT pos) -{ - Sint32 nbx, nby; - - if ( channel < 0 || channel >= MAXIMAGE ) return false; - if (m_lpSDLTexture[channel] == nullptr ) 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; - - SDL_Rect rect; - rect.x = pos.x; - rect.y = pos.y; - rect.w = 1; - rect.h = 1; - Uint32 pixel = 0; - - SDL_SetRenderTarget (g_renderer, m_lpSDLTexture[channel]); - SDL_RenderReadPixels (g_renderer, &rect, 0, &pixel, 4); - SDL_SetRenderTarget (g_renderer, nullptr); - - return !!pixel; -} - - -// Dessine une partie d'image rectangulaire. -// Les modes sont 0=transparent, 1=opaque. - -bool CPixmap::DrawIcon(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, bool bMask) -{ - Sint32 nbx, nby; - RECT rect; - - if ( channel < 0 || channel >= MAXIMAGE ) return false; - if ( channel != CHMAP && m_lpSDLTexture[channel] == nullptr ) 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; - - return !BltFast (chDst, channel, pos, rect); -} - -// 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(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, bool bMask) -{ - Sint32 nbx, nby; - RECT rect; - - if ( channel < 0 || channel >= MAXIMAGE ) return false; - if (m_lpSDLTexture[channel] == nullptr ) 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); - - return !BltFast (chDst, channel, pos, rect); -} - -// Dessine une partie d'image rectangulaire. - -bool CPixmap::DrawIconPart(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, - Sint32 startY, Sint32 endY, bool bMask) -{ - Sint32 nbx, nby; - RECT rect; - - if ( channel < 0 || channel >= MAXIMAGE ) return false; - if (m_lpSDLTexture[channel] == nullptr ) 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; - - return !BltFast (chDst, channel, pos, rect); -} - -// Dessine une partie d'image n'importe o�. - -bool CPixmap::DrawPart(Sint32 chDst, Sint32 channel, POINT dest, RECT rect, bool bMask) -{ - if ( channel < 0 || channel >= MAXIMAGE ) return false; - if (m_lpSDLTexture[channel] == nullptr ) return false; - - return !BltFast (chDst, channel, dest, rect); -} - -// Dessine une partie d'image rectangulaire. - -bool CPixmap::DrawImage(Sint32 chDst, Sint32 channel, RECT rect) -{ - POINT dst; - Sint32 res; - - if ( channel < 0 || channel >= MAXIMAGE ) return false; - if (m_lpSDLTexture[channel] == nullptr ) return false; - - dst.x = rect.left; - dst.y = rect.top; - - res = BltFast(chDst, channel, dst, rect); - - if (res) - return false; - - if ( channel == CHBACK ) - { - m_bBackDisplayed = false; - } - - return true; -} - - -// Construit une ic�ne en utilisant un masque. - -bool CPixmap::BuildIconMask(Sint32 channelMask, Sint32 rankMask, - Sint32 channel, Sint32 rankSrc, Sint32 rankDst) -{ - Sint32 nbx, nby; - POINT posDst; - RECT rect; - Sint32 res; - - if ( channel < 0 || channel >= MAXIMAGE ) return false; - if (m_lpSDLTexture[channel] == nullptr ) 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; - res = BltFast(m_lpSDLTexture[channel], channel, posDst, rect); - if (res) - 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; - res = BltFast(m_lpSDLTexture[channel], channelMask, posDst, rect); - - return !res; -} - - -// Affiche le pixmap � l'�cran. -// Retourne false en cas d'erreur. - -bool CPixmap::Display() -{ - m_bBackDisplayed = true; - SDL_RenderPresent (g_renderer); - return true; -} - -// Change le lutin de la souris. - -void CPixmap::SetMouseSprite(Sint32 sprite, bool bDemoPlay) -{ - if ( m_mouseSprite == sprite ) return; - - m_mouseSprite = sprite; - - SDL_SetCursor (m_lpSDLCursors[sprite - 1]); -} - -// Montre ou cache la souris. - -void CPixmap::MouseShow(bool bShow) -{ - SDL_ShowCursor (bShow); -} - -// Retourne le rectangle correspondant au sprite -// de la souris dans CHBLUPI. - -RECT CPixmap::MouseRectSprite() -{ - Sint32 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; -} - -SDL_Point CPixmap::GetCursorHotSpot (Sint32 sprite) -{ - static const Sint32 hotspots[MAXCURSORS * 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 - }; - - SDL_Point hotspot = { 0, 0 }; - - if (sprite >= SPRITE_BEGIN && sprite <= SPRITE_END) - { - const Sint32 rank = sprite - SPRITE_BEGIN; // rank <- 0..n - - hotspot.x = hotspots[rank * 2 + 0]; - hotspot.y = hotspots[rank * 2 + 1]; - } - - return hotspot; -} - -SDL_Rect CPixmap::GetCursorRect (Sint32 sprite) -{ - Sint32 rank; - SDL_Rect rcRect; - - switch (sprite) - { - default: - case SPRITE_ARROW: - rank = 348; - break; - case SPRITE_POINTER: - rank = 349; - break; - case SPRITE_MAP: - rank = 350; - break; - case SPRITE_WAIT: - rank = 351; - break; - case SPRITE_FILL: - rank = 352; - break; - case SPRITE_ARROWL: - rank = 353; - break; - case SPRITE_ARROWR: - rank = 354; - break; - case SPRITE_ARROWU: - rank = 355; - break; - case SPRITE_ARROWD: - rank = 356; - break; - case SPRITE_ARROWDL: - rank = 357; - break; - case SPRITE_ARROWDR: - rank = 358; - break; - case SPRITE_ARROWUL: - rank = 359; - break; - case SPRITE_ARROWUR: - rank = 360; - break; - } - - Sint32 nbx = m_totalDim[CHBLUPI].x / m_iconDim[CHBLUPI].x; - - rcRect.x = (rank % nbx) * m_iconDim[CHBLUPI].x; - rcRect.y = (rank / nbx) * m_iconDim[CHBLUPI].y; - rcRect.w = m_iconDim[CHBLUPI].x; - rcRect.h = m_iconDim[CHBLUPI].y; - - return rcRect; -} - -void CPixmap::LoadCursors () -{ - Uint32 rmask, gmask, bmask, amask; - - /* SDL interprets each pixel as a 32-bit number, so our masks must depend - on the endianness (byte order) of the machine */ -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0xff000000; - gmask = 0x00ff0000; - bmask = 0x0000ff00; - amask = 0x000000ff; -#else - rmask = 0x000000ff; - gmask = 0x0000ff00; - bmask = 0x00ff0000; - amask = 0xff000000; -#endif - - for (Sint32 sprite = SPRITE_BEGIN; sprite <= SPRITE_END; ++sprite) - { - SDL_Point hotspot = this->GetCursorHotSpot (sprite); - SDL_Rect rect = this->GetCursorRect (sprite); - - SDL_Surface *surface = SDL_CreateRGBSurface (0, rect.w, rect.h, 32, rmask, gmask, bmask, amask); - SDL_BlitSurface (m_lpSDLBlupi, &rect, surface, nullptr); - - // FIXME: change cursor first value to 0 - m_lpSDLCursors[sprite - 1] = SDL_CreateColorCursor (surface, hotspot.x, hotspot.y); - } -} - -void CPixmap::ChangeSprite (MouseSprites sprite) -{ - if (m_lpCurrentCursor == m_lpSDLCursors[sprite - 1]) - return; - - SDL_SetCursor (m_lpSDLCursors[sprite - 1]); - m_lpCurrentCursor = m_lpSDLCursors[sprite - 1]; -} diff --git a/src/pixmap.h.orig b/src/pixmap.h.orig deleted file mode 100644 index 25a2e09..0000000 --- a/src/pixmap.h.orig +++ /dev/null @@ -1,76 +0,0 @@ -// CPixmap.h - -#pragma once - -#include - -#include "blupi.h" - -#define MAXIMAGE 100 -#define MAXCURSORS 14 - -class CPixmap -{ -public: - CPixmap(); - ~CPixmap(); - - bool Create(POINT dim, bool bFullScreen, Sint32 mouseType); - bool Flush(); - void Fill(RECT rect, COLORREF color); - - bool Cache(Sint32 channel, const char *pFilename, POINT totalDim, POINT iconDim); - bool Cache(Sint32 channel, const char *pFilename, POINT totalDim); - bool Cache(Sint32 channel, SDL_Surface *surface, POINT totalDim); - void SetClipping(RECT clip); - RECT GetClipping(); - - bool IsIconPixel(Sint32 channel, Sint32 rank, POINT pos); - - bool DrawIcon(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, bool bMask=false); - bool DrawIconDemi(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, bool bMask=false); - bool DrawIconPart(Sint32 chDst, Sint32 channel, Sint32 rank, POINT pos, Sint32 startY, Sint32 endY, bool bMask=false); - bool DrawPart(Sint32 chDst, Sint32 channel, POINT dest, RECT rect, bool bMask=false); - bool DrawImage(Sint32 chDst, Sint32 channel, RECT rect); - - bool BuildIconMask(Sint32 channelMask, Sint32 rankMask, - Sint32 channel, Sint32 rankSrc, Sint32 rankDst); - - bool Display(); - - void SetMouseSprite(Sint32 sprite, bool bDemoPlay); - void MouseShow(bool bShow); - void LoadCursors (); - void ChangeSprite (MouseSprites sprite); - -protected: - Sint32 BltFast(Sint32 chDst, Sint32 channel, POINT dst, RECT rcRect); - Sint32 BltFast(SDL_Texture *lpSDL, Sint32 channel, POINT dst, RECT rcRect); - - RECT MouseRectSprite(); - SDL_Point GetCursorHotSpot (Sint32 sprite); - SDL_Rect GetCursorRect (Sint32 sprite); - -protected: - bool m_bFullScreen; - Sint32 m_mouseType; - bool m_bDebug; - bool m_bPalette; - POINT m_dim; // dimensions totales - RECT m_clipRect; // rectangle de clipping - - Sint32 m_mouseSprite; - bool m_bBackDisplayed; - - SDL_Cursor * m_lpCurrentCursor; - SDL_Cursor * m_lpSDLCursors[MAXCURSORS]; - SDL_Surface * m_lpSDLBlupi; - SDL_Texture * m_lpSDLTexture[MAXIMAGE]; - 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 -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/resource.h.orig b/src/resource.h.orig deleted file mode 100644 index cb67028..0000000 --- a/src/resource.h.orig +++ /dev/null @@ -1,278 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by blupi-e.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_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/src/sound.cpp.orig b/src/sound.cpp.orig deleted file mode 100644 index d66be26..0000000 --- a/src/sound.cpp.orig +++ /dev/null @@ -1,366 +0,0 @@ -// sound.cpp -// - -#include -#include "sound.h" -#include "event.h" -#include "misc.h" -#include "def.h" -#include "resource.h" - - -// Stops all sounds. - -bool CSound::StopAllSounds() -{ - for (Sint32 i = 0; i < MAXSOUND; i ++) - { - if (!m_lpSDL[i]) - continue; - - if (Mix_Playing (i + 1) == SDL_TRUE) - Mix_FadeOutChannel (i + 1, 500); - } - - return true; -} - -CSound::CSound() -{ - Sint32 i; - - m_bEnable = false; - m_bState = false; - m_MIDIFilename[0] = 0; - m_audioVolume = 20; - m_midiVolume = 15; - m_lastMidiVolume = 0; - m_nbSuspendSkip = 0; - m_pMusic = nullptr; - m_bStopped = false; - - for ( i=0 ; i= MAXSOUND ) return false; - - if (m_lpSDL[channel]) - Flush(channel); - - const auto file = GetBaseDir () + pFilename; - - m_lpSDL[channel] = Mix_LoadWAV (file.c_str ()); - if (!m_lpSDL[channel]) - { - SDL_Log ("Mix_LoadWAV: %s\n", Mix_GetError ()); - return false; - } - - return true; -} - -// D�charge un son. - -void CSound::Flush(Sint32 channel) -{ - if ( !m_bEnable ) return; - if ( channel < 0 || channel >= MAXSOUND ) return; - - if (m_lpSDL[channel]) - { - Mix_FreeChunk (m_lpSDL[channel]); - m_lpSDL[channel] = nullptr; - } -} - -// Fait entendre un son. -// Le volume est compris entre 128 (max) et 0 (silence). -// Le panoramique est compris entre 255,0 (gauche), 127,128 (centre) -// et 0,255 (droite). - -bool CSound::Play(Sint32 channel, Sint32 volume, Uint8 panLeft, Uint8 panRight) -{ - if (!m_bEnable) - return true; - - if (!m_bState || !m_audioVolume) - return true; - - if (channel < 0 || channel >= MAXSOUND) - return false; - - Mix_SetPanning (channel + 1, panLeft, panRight); - - volume = volume * 100 * m_audioVolume / 20 / 100; - Mix_Volume (channel + 1, volume); - - if (Mix_Playing (channel + 1) == SDL_FALSE) - Mix_PlayChannel (channel + 1, m_lpSDL[channel], 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(Sint32 channel, POINT pos, Sint32 rank) -{ - Sint32 stopCh, volumex, volumey, volume; - - if ( rank >= 0 && rank < MAXBLUPI ) - { - stopCh = m_channelBlupi[rank]; - if ( stopCh >= 0 && m_lpSDL[stopCh] != nullptr ) - Mix_FadeOutChannel (stopCh + 1, 500); - - m_channelBlupi[rank] = channel; - } - - Uint8 panRight, panLeft; - volumex = MIX_MAX_VOLUME; - volumey = MIX_MAX_VOLUME; - - if (pos.x < 0) - { - panRight = 0; - panLeft = 255; - volumex += pos.x; - if (volumex < 0) - volumex = 0; - } - else if (pos.x > LXIMAGE) - { - panRight = 255; - panLeft = 0; - volumex -= pos.x - LXIMAGE; - if (volumex < 0) - volumex = 0; - } - else - { - panRight = 255 * static_cast (pos.x) / LXIMAGE; - panLeft = 255 - panRight; - } - - if (pos.y < 0) - { - volumey += pos.y; - if (volumey < 0) - volumey = 0; - } - else if (pos.y > LYIMAGE) - { - volumey -= pos.y - LYIMAGE; - if (volumey < 0) - volumey = 0; - } - - volume = volumex < volumey ? volumex : volumey; - - return Play(channel, volume, panLeft, panRight); -} - - -// Uses MCI to play a MIDI file. The window procedure -// is notified when playback is complete. - -bool CSound::PlayMusic(const char *lpszMIDIFilename) -{ - std::string path = GetBaseDir (); - - if ( !m_bEnable ) return true; - if ( m_midiVolume == 0 ) return true; - - Mix_VolumeMusic (MIX_MAX_VOLUME * 100 * m_midiVolume / 20 / 100); - m_lastMidiVolume = m_midiVolume; - - path += lpszMIDIFilename; - - m_pMusic = Mix_LoadMUS (path.c_str ()); - if (!m_pMusic) - { - printf ("%s\n", Mix_GetError ()); - return false; - } - - if (Mix_PlayMusic (m_pMusic, 0) == -1) - { - printf ("%s\n", Mix_GetError ()); - return false; - } - - m_bStopped = 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_MIDIFilename); -} - -// Shuts down the MIDI player. - -void CSound::SuspendMusic() -{ - if ( !m_bEnable ) return; - - if ( m_nbSuspendSkip != 0 ) - { - m_nbSuspendSkip --; - return; - } - - m_bStopped = true; - Mix_HaltMusic (); -} - -// 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); -} - -bool CSound::IsStoppedOnDemand () -{ - return m_bStopped; -} - -// Adapte le volume de la musique en cours, si n�cessaire. - -void CSound::AdaptVolumeMusic() -{ - if (m_midiVolume != m_lastMidiVolume) - { - Mix_VolumeMusic (MIX_MAX_VOLUME * 100 * m_midiVolume / 20 / 100); - m_lastMidiVolume = m_midiVolume; - } -} - -// Indique le nombre de suspend � sauter. - -void CSound::SetSuspendSkip(Sint32 nb) -{ - m_nbSuspendSkip = nb; -} diff --git a/src/sound.h.orig b/src/sound.h.orig deleted file mode 100644 index d06cf56..0000000 --- a/src/sound.h.orig +++ /dev/null @@ -1,61 +0,0 @@ -// sound.h -// - -#pragma once - -#include -#include -#include "blupi.h" - -///////////////////////////////////////////////////////////////////////////// - -#define MAXSOUND 100 -#define MAXVOLUME 20 -#define MAXBLUPI 100 - -class CSound -{ -public: - CSound(); - ~CSound(); - - bool Create(); - void SetState(bool bState); - bool GetEnable(); - - void SetAudioVolume(Sint32 volume); - Sint32 GetAudioVolume(); - void SetMidiVolume(Sint32 volume); - Sint32 GetMidiVolume(); - - void CacheAll(); - bool Cache(Sint32 channel, const char *pFilename); - void Flush(Sint32 channel); - - bool Play(Sint32 channel, Sint32 volume=0, Uint8 panLeft = 255, Uint8 panRight = 255); - bool PlayImage(Sint32 channel, POINT pos, Sint32 rank=-1); - bool PlayMusic(const char *lpszMIDIFilename); - bool RestartMusic(); - void SuspendMusic(); - void StopMusic(); - bool IsPlayingMusic(); - bool IsStoppedOnDemand (); - void AdaptVolumeMusic(); - void SetSuspendSkip(Sint32 nb); - bool StopAllSounds(); - -protected: - bool m_bEnable; - bool m_bState; - bool m_bStopped; - Mix_Music *m_pMusic; - Mix_Chunk *m_lpSDL[MAXSOUND]; - Sint16 m_channelBlupi[MAXBLUPI]; - char m_MIDIFilename[50]; - Sint32 m_audioVolume; - Sint32 m_midiVolume; - Sint32 m_lastMidiVolume; - Sint32 m_nbSuspendSkip; -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/text.cpp.orig b/src/text.cpp.orig deleted file mode 100644 index 3e38d58..0000000 --- a/src/text.cpp.orig +++ /dev/null @@ -1,344 +0,0 @@ -// Text.cpp - -#include -#include -#include "def.h" -#include "pixmap.h" -#include "text.h" - - -///////////////////////////////////////////////////////////////////////////// - - -// Retourne l'offset pour un caractère donné. - -Sint32 GetOffset(char c) -{ - Sint32 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. - -Sint32 GetCharWidth(char c, Sint32 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, const char *pText, Sint32 font) -{ - Sint32 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, - Sint32 pente, Sint32 font) -{ - Sint32 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, - Sint32 pente, Sint32 font, Sint32 part) -{ - char text[100]; - char* pDest; - Sint32 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, const char *pText, Sint32 font) -{ - char text[100]; - char* pDest; - Sint32 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. - -Sint32 GetTextHeight(char *pText, Sint32 font, Sint32 part) -{ - char text[100]; - char* pDest; - Sint32 itl; - Sint32 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. - -Sint32 GetTextWidth(const char *pText, Sint32 font) -{ - Sint32 width = 0; - - while ( *pText != 0 ) - { - width += GetCharWidth(*pText++, font); - } - - return width; -} - - -// Retourne la longueur d'un grand chiffre. - -void GetBignumInfo(Sint32 num, Sint32 &start, Sint32 &lg) -{ - static Sint32 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, Sint32 num) -{ - char string[10]; - Sint32 i = 0; - Sint32 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. - -Sint32 GetBignumWidth(Sint32 num) -{ - char string[10]; - Sint32 i = 0; - Sint32 start, lg; - Sint32 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/src/text.h.orig b/src/text.h.orig deleted file mode 100644 index 38aaac5..0000000 --- a/src/text.h.orig +++ /dev/null @@ -1,35 +0,0 @@ -// Text.h - -#pragma once - -#define FONTWHITE 0 -#define FONTRED 1 -#define FONTSLIM 2 -#define FONTLITTLE 10 - -extern -void DrawText(CPixmap *pPixmap, POINT pos, const char *pText, Sint32 font=0); - -extern -void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, - Sint32 pente, Sint32 font=0); - -extern -void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, - Sint32 pente, Sint32 font=0, Sint32 part=-1); - -extern -void DrawTextCenter(CPixmap *pPixmap, POINT pos, const char *pText, Sint32 font=0); - -extern -Sint32 GetTextHeight(char *pText, Sint32 font=0, Sint32 part=-1); - -extern -Sint32 GetTextWidth(const char *pText, Sint32 font=0); - -extern -void DrawBignum(CPixmap *pPixmap, POINT pos, Sint32 num); - -extern -Sint32 GetBignumWidth(Sint32 num); - From 9ae4056b92d5d0056a4e53202d838b22fc9ac41b Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 14 Feb 2017 17:28:23 +0100 Subject: [PATCH 3/5] Remove live resizing It's not working very fine with directx. --- src/blupi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blupi.cpp b/src/blupi.cpp index 308ae6f..02f5652 100644 --- a/src/blupi.cpp +++ b/src/blupi.cpp @@ -418,7 +418,7 @@ static bool DoInit (Sint32 argc, char *argv[]) SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_INPUT_GRABBED); else g_window = SDL_CreateWindow (NAME, SDL_WINDOWPOS_CENTERED, - SDL_WINDOWPOS_CENTERED, LXIMAGE, LYIMAGE, SDL_WINDOW_RESIZABLE); + SDL_WINDOWPOS_CENTERED, LXIMAGE, LYIMAGE, 0); if (!g_window) { From eb093b103c23fe3de2e5e524f1b50a8944c8db6a Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 14 Feb 2017 18:03:50 +0100 Subject: [PATCH 4/5] Use real fullscreen mode The logical size is not adapted for a game like planetblupi. We should create the textures for higher definitions and a dynamic view for the game map. --- src/blupi.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/blupi.cpp b/src/blupi.cpp index 02f5652..2ac8bed 100644 --- a/src/blupi.cpp +++ b/src/blupi.cpp @@ -415,7 +415,7 @@ static bool DoInit (Sint32 argc, char *argv[]) // Create a window. if (g_bFullScreen) g_window = SDL_CreateWindow (NAME, 0, 0, LXIMAGE, LYIMAGE, - SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_INPUT_GRABBED); + SDL_WINDOW_FULLSCREEN | SDL_WINDOW_INPUT_GRABBED); else g_window = SDL_CreateWindow (NAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, LXIMAGE, LYIMAGE, 0); @@ -434,8 +434,6 @@ static bool DoInit (Sint32 argc, char *argv[]) return false; } - SDL_RenderSetLogicalSize (g_renderer, LXIMAGE, LYIMAGE); - if (!bOK) // config.ini pas correct ? return InitFail ("Game not correctly installed", false); From b40c7b6ec4502f7a247eb60c763f0eef48e60a1a Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 14 Feb 2017 18:17:45 +0100 Subject: [PATCH 5/5] Fix link on all platforms --- CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01287c2..d634c94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,17 +43,27 @@ pkg_search_module (SDL2_IMAGE REQUIRED SDL2_image) ################## ## SDL_kitchensink -ExternalProject_Add (SDL_kitchensink + +ExternalProject_Add (SDL_kitchensink_Project GIT_REPOSITORY https://github.com/katajakasa/SDL_kitchensink.git PREFIX ${CMAKE_CURRENT_BINARY_DIR} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR} ) -ExternalProject_Get_Property (SDL_kitchensink install_dir) +ExternalProject_Get_Property (SDL_kitchensink_Project install_dir) include_directories (${install_dir}/include) +if (WIN32) +add_library (SDL_kitchensink STATIC IMPORTED) +set_property (TARGET SDL_kitchensink PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libSDL_kitchensink.dll.a) +else () +add_library (SDL_kitchensink SHARED IMPORTED) +set_property (TARGET SDL_kitchensink PROPERTY IMPORTED_LOCATION ${install_dir}/lib/libSDL_kitchensink.so) +endif () + add_dependencies (planetblupi SDL_kitchensink) + ## SDL_kitchensink ## ################## @@ -62,5 +72,5 @@ target_link_libraries (planetblupi PUBLIC ${SDL2_LIBRARIES} ${SDL2_MIXER_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} - ${install_dir}/lib/libSDL_kitchensink.dll.a + SDL_kitchensink )