mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-01 21:17:05 +03:00
d7d25fb0e8
git-svn-id: svn://kolibrios.org@1143 a494cfbc-eb01-0410-851d-a64ba20cac60
1466 lines
54 KiB
C++
1466 lines
54 KiB
C++
/* ------- КОСИЛКА ДЛЯ КОЛИБРИ -------
|
||
Игра пишется на C++ (используется MS Visual C++ 6.0).
|
||
Это - исходник версии 1.0.
|
||
|
||
Andrey Mihaylovich aka Dron2004
|
||
*/
|
||
|
||
|
||
|
||
#include "kosSyst.h"
|
||
#include "kosFile.h"
|
||
|
||
|
||
|
||
//ВНЕШНИЕ УРОВНИ
|
||
bool external_levels_available=false;
|
||
bool external_levels = false;
|
||
int level_read_result;
|
||
Byte * externallevels;
|
||
Byte external_levels_count[1] = {0};
|
||
/////////////////
|
||
|
||
int lastkosilkadirection=1;
|
||
int laststep=0; //Последний ход. Здесь
|
||
// 0 - нет такового
|
||
// 1 - вниз
|
||
// 2 - вверх
|
||
// 3 - влево
|
||
// 4 - вправо
|
||
|
||
|
||
Byte skindata[13824];
|
||
int read_result=0;
|
||
bool skin_available=false;
|
||
bool w_redraw=true;
|
||
|
||
const char windowTitle[]="Љ®бЁ«Є ¤«п Љ®«ЁЎаЁ";
|
||
const char version[]="‚ҐабЁп 1.11";
|
||
int levelcount=7; //Число уровней
|
||
|
||
char gamearea[20][20]; //Карта
|
||
|
||
|
||
short int kosilkax; // Положение косилки
|
||
short int kosilkay;
|
||
short int kosilkadirection=1; //Направление прошлого шага. 1-вниз, 2-вверх, 3-влево, 4-вправо
|
||
short int lives=2; // Жизни
|
||
short int level=1; //Уровень
|
||
short int status=0; //Где 0 - приветствие
|
||
// 1 - игра
|
||
// 2 - игра пройдена
|
||
// 3 - вы проиграли
|
||
// 4 - выбор набора уровней (встроенный или внешний)
|
||
// -1 - о программе
|
||
bool gamestarted=false; //Блокировка игровых клавиш. Если false - играть нельзя
|
||
|
||
bool drawgraphics=true; //Рисовать ли детальную графику (или ограничиться аскетичной)
|
||
bool drawanimation=true; //Анимировать ли
|
||
bool skinned=false;
|
||
int grassLeft(); //Сообщим о наличии функции Grass Left
|
||
|
||
//Графика игры
|
||
|
||
RGB kosilka_d[576];
|
||
RGB kosilka_l[576];
|
||
RGB kosilka_r[576];
|
||
RGB kosilka_u[576];
|
||
RGB grass[576];
|
||
RGB stone[576];
|
||
RGB tree[576];
|
||
RGB skos[576];
|
||
|
||
Byte kosilka_d1[]={0,1,2,3,4,5,5,6,6,6,5,5,5,5,5,6,5,5,5,4,2,2,1,7,1,2,4,6,21
|
||
,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,6,5,2,40,1,4,62,63,63,64,65,66,66
|
||
,67,66,66,66,66,68,66,66,63,69,65,65,62,4,1,2,6,75,91,64,65,67,92,75,75,75,75,75
|
||
,75,75,75,75,93,65,94,94,62,6,2,3,6,76,94,96,67,103,104,104,104,104,104,104,105
|
||
,106,107,108,109,93,63,64,75,6,3,3,21,75,94,94,67,115,104,104,104,104,105,105
|
||
,106,107,108,116,117,92,65,96,76,21,4,3,21,62,64,63,78,115,105,105,105,105,106
|
||
,107,108,116,116,119,120,92,65,96,77,6,3,4,6,62,96,69,67,123,106,106,107,107,108
|
||
,108,116,119,119,127,124,92,66,64,77,21,4,3,21,62,64,91,67,123,107,108,108,116
|
||
,116,119,119,127,127,127,124,75,69,64,77,21,4,4,6,62,64,69,68,123,108,116,119
|
||
,119,127,127,127,129,129,129,125,93,63,64,77,21,4,4,21,62,64,91,67,123,119,119
|
||
,127,127,129,129,129,129,129,129,125,68,94,64,77,6,4,3,21,62,64,94,63,122,128
|
||
,128,121,121,121,121,121,121,121,121,76,66,69,91,77,21,4,4,21,62,64,94,69,69,65
|
||
,66,67,68,68,67,68,67,67,66,66,69,91,64,77,21,4,4,21,76,96,64,94,94,64,94,96,69
|
||
,91,94,94,64,69,69,94,64,64,64,77,6,4,3,6,75,64,64,64,64,64,64,64,64,64,64,64,64
|
||
,64,64,64,64,64,96,75,21,4,3,6,16,94,64,64,64,64,64,64,64,64,64,64,64,64,64,64
|
||
,64,64,96,75,6,2,2,6,75,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,62
|
||
,6,2,1,2,33,95,111,111,111,111,79,79,79,79,79,79,79,79,111,95,79,111,95,33,32,40
|
||
,7,42,49,44,47,72,44,47,80,49,45,72,45,70,47,47,47,46,71,45,44,49,50,15,15,43,45
|
||
,72,70,71,44,71,43,44,44,46,47,71,49,71,45,47,45,47,80,80,110,0,15,45,45,45,44
|
||
,44,72,72,70,45,44,71,46,71,80,44,45,47,44,71,72,71,45,9,14,45,47,72,46,73,45,47
|
||
,72,46,45,47,45,70,43,45,45,46,47,44,43,43,42,10,8,32,42,45,46,44,43,44,44,47,45
|
||
,45,49,44,46,46,45,44,45,44,45,42,41,9,10,114,36,36,12,10,12,14,9,11,10,36,13,11
|
||
,10,9,13,12,11,9,10,8,8,8
|
||
};
|
||
|
||
Byte kosilka_u1[]={8,9,9,10,9,11,12,13,9,10,11,13,8,10,11,9,14,12,10,12,14,8,11
|
||
,10,9,41,42,43,44,45,44,45,46,46,44,45,45,45,47,44,44,43,44,46,45,42,32,0,14,42
|
||
,45,43,44,47,46,45,45,43,70,45,71,45,46,72,47,45,73,46,44,71,45,14,11,45,71,72
|
||
,71,44,47,45,44,80,71,46,71,44,45,70,72,72,44,44,45,45,45,15,0,110,80,80,71,45
|
||
,47,45,71,49,71,47,46,44,44,43,71,44,71,70,72,43,71,15,15,50,49,44,45,71,46,47
|
||
,47,71,70,45,72,45,49,80,47,44,72,47,44,45,50,15,1,32,121,95,111,79,95,111,79,79
|
||
,79,79,79,79,79,79,111,111,111,111,95,121,3,1,2,5,62,96,64,64,64,64,64,64,64,64
|
||
,64,64,64,64,64,64,64,96,96,75,5,2,2,6,75,94,64,64,64,64,64,64,64,64,64,64,64,64
|
||
,64,64,64,64,96,76,6,3,4,21,75,96,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64
|
||
,64,94,76,6,3,4,21,77,64,64,64,94,69,69,64,94,94,91,69,64,94,64,94,94,64,64,16
|
||
,21,4,4,6,77,64,91,69,66,66,66,67,67,67,68,68,67,66,65,69,69,94,64,77,21,4
|
||
,4,21,77,64,69,66,76,121,121,121,121,121,121,121,121,128,128,122,63,94,64,62,21
|
||
,3,4,6,77,64,94,67,125,129,129,129,129,129,129,127,127,119,119,123,66,91,64,62
|
||
,21,4,4,21,77,64,63,92,125,129,129,129,127,127,127,119,119,116,108,123,68,69,64
|
||
,62,6,4,4,21,77,64,63,92,124,127,127,127,119,119,116,108,108,108,108,123,68,91
|
||
,64,62,21,3,4,21,77,91,66,92,124,127,119,119,116,108,108,107,107,106,106,123,67
|
||
,69,64,62,21,3,3,21,77,64,65,92,120,119,116,116,108,107,106,105,105,105,105,115
|
||
,93,63,64,62,6,3,4,21,75,64,65,92,117,116,108,107,106,105,105,105,104,104,104
|
||
,115,67,94,96,76,21,3,3,6,75,96,63,93,109,108,107,106,105,104,104,104,104,104
|
||
,104,136,67,96,94,76,6,3,2,6,62,94,94,65,93,75,75,75,75,75,75,75,92,75,93,67,65
|
||
,64,64,75,6,2,1,4,62,65,65,69,63,65,66,67,66,66,65,65,67,66,66,65,64,63,65,62,4
|
||
,1,1,2,6,6,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,6,4,2,1,7,1,2,2,4,5
|
||
,5,6,6,5,5,5,6,6,6,6,6,5,6,3,4,2,1,0
|
||
};
|
||
|
||
Byte kosilka_l1[]={10,8,14,15,15,15,1,2,3,2,4,4,3,3,4,3,3,3,3,3,2,1,1,0,11,48,49
|
||
,45,47,50,3,6,6,6,21,21,21,21,6,21,21,6,21,6,5,4,2,1,29,42,71,45,74,49,33,75,76
|
||
,76,76,62,62,62,62,62,62,62,76,76,75,62,4,2,14,70,72,45,72,44,95,96,94,94,94,96
|
||
,64,64,64,64,64,96,94,94,94,66,6,3,12,46,46,44,70,47,111,64,96,96,64,94,94,91,69
|
||
,91,69,63,94,96,64,63,21,4,10,44,73,44,71,72,111,64,64,64,94,69,63,66,68,67,67
|
||
,68,67,67,65,64,21,5,12,43,45,72,44,44,111,64,64,64,94,69,122,123,123,123,123
|
||
,115,115,103,67,63,21,6,14,44,47,72,71,47,111,64,64,64,64,65,128,119,116,107,106
|
||
,105,104,104,93,66,21,6,9,44,72,70,43,80,79,64,64,64,94,66,128,119,116,108,106
|
||
,105,104,104,75,66,21,6,11,47,46,45,44,49,79,64,64,64,64,67,121,127,116,108,107
|
||
,105,104,104,92,67,21,6,10,45,45,44,44,45,79,64,64,64,69,68,121,127,119,116,107
|
||
,106,104,104,75,66,21,6,8,49,47,71,46,72,79,64,64,64,91,68,121,129,127,116,108
|
||
,106,105,104,75,66,21,6,13,45,45,46,47,45,79,64,64,64,94,67,121,129,127,119,108
|
||
,107,105,104,75,66,21,4,11,44,70,71,71,70,79,64,64,64,94,67,121,129,127,119,116
|
||
,108,106,105,75,66,21,5,10,46,43,80,49,47,79,64,64,64,64,67,121,129,129,127,119
|
||
,108,107,106,75,67,21,4,9,46,45,44,71,47,79,64,64,64,69,67,121,129,129,127,119
|
||
,116,108,107,75,66,21,6,13,45,45,45,45,47,111,64,64,64,69,66,121,129,129,127,127
|
||
,119,116,108,75,66,21,6,12,44,46,47,47,46,95,64,64,64,94,66,76,125,125,124,124
|
||
,120,117,109,93,63,21,4,11,45,47,44,45,71,79,64,64,64,64,69,66,68,92,75,92,92,92
|
||
,93,65,69,21,6,9,44,44,71,47,45,111,64,64,64,64,91,69,94,63,69,66,65,65,63,94,65
|
||
,21,4,10,47,43,72,80,44,95,64,64,64,64,64,64,64,64,64,64,64,64,64,64,63,6,2,9,42
|
||
,45,47,80,45,121,62,75,75,77,77,77,77,77,77,77,77,75,75,62,75,5,2,0,48,42,45,71
|
||
,50,2,6,6,21,6,21,21,6,21,21,21,21,21,6,6,4,2,40,8,11,51,9,8,15,1,2,2,4,4,3,4,4
|
||
,4,4,4,3,3,3,2,1,1,7
|
||
};
|
||
|
||
Byte kosilka_r1[]={7,1,1,2,3,3,3,4,4,4,4,4,4,4,4,2,2,1,15,0,9,12,9,8,40,2,4,6,6
|
||
,21,21,21,21,21,6,21,21,6,4,1,15,51,52,53,47,45,23,9,2,6,62,62,75,75,77,77,77,77
|
||
,77,77,77,77,77,77,78,79,45,80,47,71,42,9,2,6,65,94,94,94,96,64,64,64,64,64,64
|
||
,96,64,64,64,95,44,72,44,43,45,10,4,21,65,94,63,65,65,66,69,63,94,69,91,64,64,64
|
||
,64,79,43,47,71,44,72,9,5,21,69,65,93,92,92,92,92,92,67,66,69,64,64,64,64,79,71
|
||
,45,44,47,43,11,5,21,63,93,109,117,120,124,124,125,125,76,66,94,64,64,64,95,46
|
||
,47,47,46,72,12,6,21,65,75,108,116,119,127,127,129,129,121,66,69,64,64,64,111,47
|
||
,45,45,45,45,13,6,21,66,75,107,108,116,119,127,129,129,121,66,69,64,64,64,79,47
|
||
,71,44,45,44,9,4,21,67,75,106,107,116,119,127,129,129,121,67,64,64,64,64,79,47
|
||
,49,80,43,44,10,5,21,66,75,105,106,108,116,119,127,129,121,67,94,64,64,64,79,70
|
||
,71,71,70,72,11,4,21,66,75,104,105,107,108,119,127,129,121,67,94,64,64,64,79,45
|
||
,47,46,45,45,13,6,21,66,75,104,105,106,108,116,127,129,121,68,91,64,64,64,79,72
|
||
,46,71,47,45,8,6,21,65,75,104,104,105,107,116,119,127,121,68,69,64,64,64,79,45
|
||
,44,44,45,45,10,6,21,67,75,104,104,105,107,108,116,127,121,67,64,64,64,64,79,49
|
||
,44,45,46,46,11,6,21,66,92,104,104,105,106,108,116,119,128,66,94,64,64,64,79,80
|
||
,43,70,72,72,9,6,21,66,92,104,104,105,106,107,108,119,128,65,64,64,64,64,111,47
|
||
,71,72,47,72,14,6,21,65,67,103,115,115,123,123,123,123,122,69,94,64,64,64,111,44
|
||
,44,72,45,47,12,5,21,64,65,67,67,93,68,68,93,66,63,69,94,64,64,64,111,72,71,44
|
||
,73,72,10,3,21,63,64,96,94,63,69,91,69,91,94,94,64,64,64,64,111,47,70,44,46,44
|
||
,12,4,6,63,64,64,64,64,64,64,64,64,64,64,64,64,64,64,95,44,72,45,72,45,14,2,4,62
|
||
,75,76,76,62,62,62,62,62,62,62,76,62,62,77,79,45,43,45,46,42,36,1,2,5,6,6,21,6
|
||
,21,21,6,21,21,21,21,6,6,6,37,52,46,45,45,20,11,0,40,40,2,3,4,4,3,3,4,4,2,4,4,3
|
||
,3,2,1,15,15,15,14,36,10
|
||
};
|
||
|
||
Byte skos1[]={13,14,14,14,12,11,10,14,11,14,10,9,13,13,13,14,9,13,8,12,13,11,14
|
||
,8,11,10,9,8,10,10,12,11,14,10,9,14,14,9,10,12,10,14,9,11,10,8,10,8,13,14,10,8
|
||
,10,10,13,13,10,11,11,10,8,14,12,13,9,12,12,12,9,9,9,12,8,13,9,13,8,14,13,8,12
|
||
,13,11,9,11,14,9,10,10,9,14,10,8,12,12,13,9,10,14,12,14,12,9,9,8,8,10,8,12,8,14
|
||
,13,13,14,8,10,9,10,10,9,13,9,8,9,8,12,12,9,14,14,10,14,14,14,14,9,12,14,12,14
|
||
,13,10,11,51,12,13,10,14,8,8,11,13,8,8,8,9,14,12,8,13,14,14,9,14,13,9,8,126
|
||
,12,8,10,11,10,8,14,14,10,8,12,12,13,12,9,13,10,14,13,11,12,9,11,12,13,13,11,13
|
||
,12,13,13,10,8,10,14,12,11,10,11,9,14,10,11,11,11,12,9,8,9,13,14,8,8,14,10,11,9
|
||
,14,13,9,10,11,12,8,11,8,8,13,9,12,9,10,10,11,12,8,10,11,9,9,10,10,14,14,8,14,8
|
||
,13,14,9,14,11,8,12,12,14,12,14,13,9,11,8,8,14,10,9,11,12,11,10,9,9,9,11,11,14
|
||
,10,11,14,11,9,8,12,12,9,14,14,10,14,14,14,14,9,12,14,12,14,13,10,11,10,10,10,10
|
||
,8,8,8,10,13,9,12,9,12,8,8,14,11,11,13,13,12,13,12,8,11,12,13,11,12,10,13,8,8,8
|
||
,10,9,11,13,14,12,14,12,12,12,8,14,12,13,10,10,8,14,11,13,14,11,9,10,12,13,8,10
|
||
,11,13,11,11,14,9,11,8,10,14,10,14,10,12,8,8,14,14,11,13,11,12,8,8,13,12,11,14,9
|
||
,13,11,8,12,10,10,8,12,12,51,10,9,8,9,13,10,14,8,14,8,9,9,14,8,10,14,13,8,11,8
|
||
,11,13,12,13,10,13,10,10,10,9,12,11,13,14,13,11,8,14,8,10,10,10,14,13,10,11,10
|
||
,11,13,13,12,12,9,11,12,8,13,9,10,14,10,9,9,9,13,12,12,11,8,13,13,36,13,9,10,13
|
||
,12,8,13,12,9,13,10,11,12,12,10,9,13,8,9,12,10,11,12,14,9,14,14,8,11,14,12,12,10
|
||
,11,9,8,8,14,14,11,13,11,12,8,8,13,12,8,8,10,13,14,10,11,8,8,8,11,11,14,11,12,10
|
||
,13,9,14,14,9,9,11,9,10,11,8,14,12,10,12,14,9,11,10,8,13,11,10,9,13,12,11,9,10,9
|
||
,9,8
|
||
};
|
||
|
||
Byte grass1[]={16,17,17,18,17,19,20,21,22,22,23,22,24,18,23,23,25,18,22,26,27,28
|
||
,28,18,20,24,28,54,55,19,54,56,24,20,54,24,24,20,24,20,20,24,27,24,17,54,54,24
|
||
,55,55,28,55,55,54,54,55,54,24,54,54,24,24,54,20,54,17,54,54,55,24,81,55,17,19
|
||
,17,27,81,27,54,19,17,54,41,18,24,24,81,23,19,55,18,27,24,97,20,54,19,112,55,81
|
||
,18,24,19,24,48,20,55,28,81,28,18,24,112,55,18,81,17,54,24,54,118,19,54,81,23,81
|
||
,55,41,26,23,26,26,41,20,26,55,19,81,18,17,28,54,19,28,55,54,17,22,17,55,17,17
|
||
,81,18,28,25,97,18,27,112,112,81,24,24,27,26,81,54,24,54,17,27,55,28,23,97,25,54
|
||
,28,23,26,26,22,112,55,97,24,28,27,26,16,55,17,27,54,18,19,54,23,16,97,20,54,25
|
||
,26,26,19,19,48,18,16,28,17,23,20,19,28,55,24,20,19,28,20,48,23,33,19,97,26,26
|
||
,55,54,18,26,25,19,28,26,28,17,27,55,81,23,19,19,18,20,24,41,54,22,26,81,17,27
|
||
,17,25,26,28,24,48,22,27,26,55,54,55,55,28,16,33,5,24,41,18,48,55,19,48,97,16,26
|
||
,27,48,33,23,97,22,28,19,54,48,81,21,6,21,41,26,33,33,28,54,20,16,48,18,26,33,16
|
||
,48,23,17,19,112,26,23,48,21,21,131,48,26,33,97,17,17,20,16,25,97,16,16,26,21,20
|
||
,19,112,54,26,26,21,20,41,6,33,16,25,33,55,19,16,41,25,48,16,26,48,97,24,55,54
|
||
,24,24,23,21,23,97,48,21,33,24,6,54,54,132,54,18,16,97,28,26,22,28,27,54,20,16
|
||
,23,33,22,16,26,48,17,20,33,54,24,19,20,25,97,48,54,54,26,27,20,20,41,21,97,6,33
|
||
,23,26,48,19,17,48,24,23,24,27,16,18,16,55,55,19,26,27,54,48,21,24,48,23,33,25
|
||
,33,28,23,97,97,6,16,16,20,25,48,17,48,97,22,27,24,20,48,22,17,27,48,48,16,22,25
|
||
,24,41,33,25,25,54,23,97,17,18,27,22,97,24,20,18,23,27,17,23,48,25,23,97,27,97
|
||
,18,26,18,22,26,18,19,17,28,26,23,17,81,97,25,81,27,24,6,97,48,18,97,16,16,81,33
|
||
,18,22,26,24,17,27,23,26,17,27,23,26,26,54,41,33,18,97,22,18,22,48,18,16,97,22
|
||
,18,18,27,27,26,48,27,17,97,18,27,55,21,20,26,23,26,27,27,22,26,16,23,22,26,27
|
||
,140,19,20
|
||
};
|
||
|
||
Byte stone1[]={13,14,14,29,30,31,31,31,30,3,32,33,32,34,35,36,9,13,8,12,13,11,14
|
||
,8,11,10,36,30,31,57,58,57,31,59,59,59,59,31,31,30,32,29,11,11,10,8,10,8,13,8,30
|
||
,31,58,82,83,82,82,83,84,84,85,84,83,58,59,30,30,51,9,9,9,12,8,98,30,57,99,83,83
|
||
,83,83,84,84,85,100,73,49,74,73,82,31,30,8,12,12,13,9,0,30,57,82,83,83,83,83,84
|
||
,84,85,85,73,49,74,113,74,84,59,30,114,10,9,12,0,30,59,58,82,83,83,83,83,84,85
|
||
,85,73,49,74,74,113,113,83,31,30,11,10,12,13,30,30,57,99,82,83,83,83,84,84,85
|
||
,100,49,49,74,113,113,74,99,30,29,13,12,8,0,30,57,82,83,83,83,83,83,84,85,100,73
|
||
,49,74,113,113,113,85,31,40,12,13,13,1,30,99,83,83,83,83,83,83,84,84,85,73,49,74
|
||
,74,113,113,74,57,32,8,9,13,30,59,82,83,82,83,83,83,83,83,84,85,100,73,49,74,74
|
||
,113,113,57,5,51,10,0,30,57,82,82,83,83,83,83,83,83,84,85,85,73,49,74,74,113,113
|
||
,58,130,11,12,29,30,57,82,82,83,83,83,83,83,83,83,84,85,100,73,49,74,74,74,99,30
|
||
,11,9,29,30,57,82,82,83,83,83,83,83,83,83,84,84,85,73,49,49,74,74,82,30,0,8,8,30
|
||
,31,99,82,82,83,83,83,83,83,83,83,84,85,100,73,49,74,74,83,31,15,12,10,15,30,58
|
||
,82,82,82,83,83,83,83,83,83,84,84,85,100,73,49,74,84,31,1,11,13,7,30,58,82,82,82
|
||
,82,82,82,83,83,82,83,84,85,85,100,73,49,84,31,15,8,8,7,30,58,82,82,82,82,82,82
|
||
,82,82,82,83,84,84,85,85,73,73,82,30,35,10,10,35,30,57,82,82,82,82,82,82,82,82
|
||
,83,82,83,84,84,85,85,85,59,30,51,13,10,133,30,59,99,99,82,82,82,82,82,82,82,83
|
||
,82,83,84,84,84,57,30,35,10,11,13,13,1,31,58,82,99,82,82,82,99,58,58,82,82,83,83
|
||
,99,57,31,40,13,13,8,13,9,0,30,59,99,99,99,99,99,58,59,59,57,57,57,59,31,30,15
|
||
,10,11,12,14,9,14,14,15,30,31,58,58,58,57,30,30,30,30,30,30,32,1,37,8,8,13,12,8
|
||
,8,10,13,14,35,30,30,31,30,30,30,8,0,37,0,133,9,14,14,9,9,11,9,10,11,8,14,12,10
|
||
,37,40,32,1,35,8,13,11,10,9,13,12,11,9,10,9,9,8
|
||
};
|
||
|
||
Byte tree1[]={13,14,8,36,37,11,10,36,38,39,0,14,13,13,13,14,9,13,8,12,13,11,14,8
|
||
,11,36,39,39,39,34,38,39,60,61,60,39,34,0,37,37,14,36,15,36,14,8,10,8,11,86,60
|
||
,87,61,60,88,61,89,90,89,61,60,88,39,86,39,88,88,88,39,15,9,12,34,88,87,89,89
|
||
,101,89,89,89,89,89,89,101,61,61,90,89,89,102,87,60,39,37,13,34,60,89,89,89,89
|
||
,89,89,89,89,89,89,89,89,89,89,89,89,89,89,102,88,7,11,15,88,102,101,89,89,89,89
|
||
,89,89,101,89,89,101,89,89,89,89,89,89,101,60,34,51,8,39,60,102,89,89,89,89,89
|
||
,90,102,101,89,101,101,89,89,89,89,89,101,60,39,51,37,34,60,90,101,89,89,101,89
|
||
,101,101,89,89,89,89,89,89,89,89,89,89,87,88,15,37,60,89,89,89,89,101,90,89,89
|
||
,89,89,89,89,89,89,89,89,89,89,89,101,102,88,39,102,89,89,89,89,101,90,89,89,89
|
||
,89,89,89,101,101,101,101,89,89,89,89,89,61,32,102,89,89,89,89,101,90,90,101,89
|
||
,89,89,101,87,101,89,89,89,89,89,89,89,102,39,61,89,89,89,89,89,89,101,102,101
|
||
,89,89,90,89,89,89,89,89,89,89,89,89,90,9,39,61,101,89,89,89,89,101,102,102,89
|
||
,101,101,89,89,89,89,89,89,89,89,89,102,36,34,88,102,89,89,89,89,89,101,101,89
|
||
,89,89,89,89,89,89,89,89,89,101,90,60,8,39,60,101,89,89,89,89,89,89,89,89,89,89
|
||
,89,89,89,89,89,89,89,101,101,60,34,88,101,89,89,89,89,89,89,89,89,89,89,89,89
|
||
,89,89,89,89,101,101,89,89,102,34,60,89,89,89,89,89,89,89,89,89,89,89,89,89,89
|
||
,89,89,101,90,101,89,89,101,34,88,87,89,89,101,89,89,89,89,90,102,89,89,89,89,89
|
||
,89,89,89,101,89,89,102,37,32,60,102,87,87,89,89,89,134,135,135,101,89,89,89,89
|
||
,89,89,89,101,102,102,60,11,51,37,38,34,88,61,102,61,39,137,131,134,101,101,101
|
||
,102,90,89,89,102,60,39,37,8,51,11,37,37,0,39,39,32,15,137,137,138,60,61,60,88
|
||
,88,102,102,60,39,40,10,11,9,14,8,8,36,40,36,51,51,137,137,137,34,39,34,29,38,39
|
||
,39,32,15,13,12,8,8,10,51,14,37,37,8,8,8,137,137,137,8,9,139,51,8,7,7,14,11,11,9
|
||
,10,11,8,14,51,10,12,14,11,11,137,137,137,11,10,9,13,51,14,11,51,9,9,8
|
||
};
|
||
|
||
|
||
//Палитра цветов. Декодируем в 0xRRGGBB
|
||
|
||
char * apppath;
|
||
char * levpath;
|
||
char * getSkinPathName(){
|
||
|
||
int lastslashindex=0;
|
||
static char skinfilename[]="kosskin.gfx";
|
||
int tempslfnd=0;
|
||
|
||
for (tempslfnd=0; tempslfnd < strlen(kosExePath); tempslfnd++){
|
||
if (kosExePath[tempslfnd]=='/'){lastslashindex=tempslfnd;}
|
||
}
|
||
|
||
apppath = new char[lastslashindex+strlen(skinfilename)+1];
|
||
|
||
for (tempslfnd=0; tempslfnd <= lastslashindex; tempslfnd++){
|
||
apppath[tempslfnd]=kosExePath[tempslfnd];
|
||
}
|
||
for (tempslfnd=0; tempslfnd < strlen(skinfilename); tempslfnd++){
|
||
apppath[tempslfnd+lastslashindex+1]=skinfilename[tempslfnd];
|
||
}
|
||
|
||
|
||
return apppath;
|
||
|
||
|
||
}
|
||
|
||
char * getLevelsPathName(){
|
||
|
||
int lastslashindex=0;
|
||
static char levfilename[]="koslevel.pak";
|
||
int tempslfnd=0;
|
||
|
||
for (tempslfnd=0; tempslfnd < strlen(kosExePath); tempslfnd++){
|
||
if (kosExePath[tempslfnd]=='/'){lastslashindex=tempslfnd;}
|
||
}
|
||
|
||
levpath = new char[lastslashindex+strlen(levfilename)+1];
|
||
|
||
for (tempslfnd=0; tempslfnd <= lastslashindex; tempslfnd++){
|
||
levpath[tempslfnd]=kosExePath[tempslfnd];
|
||
}
|
||
for (tempslfnd=0; tempslfnd < strlen(levfilename); tempslfnd++){
|
||
levpath[tempslfnd+lastslashindex+1]=levfilename[tempslfnd];
|
||
}
|
||
|
||
return levpath;
|
||
|
||
|
||
}
|
||
|
||
|
||
void decode_graphics(Byte * source, RGB * target){
|
||
static const char palette[] = {
|
||
0x31,0x8A,0x97,0x2E,0x7F,0x8B,0x2B,0x7B,0x86,0x2B,0x76,0x82,0x28,0x74,0x7F,0x2B,0x70,0x79,0x26,0x6C,0x76,0x2E,0x83,0x90,
|
||
0x2F,0x8A,0x97,0x31,0x8C,0x9A,0x32,0x8D,0x9B,0x31,0x8C,0x99,0x33,0x8E,0x9C,0x34,0x8F,0x9D,0x30,0x8B,0x98,0x31,0x85,0x92,
|
||
0x32,0x75,0x88,0x54,0xA4,0xBA,0x3D,0x8C,0xA1,0x6A,0xB2,0xC6,0x46,0x8E,0xA0,0x26,0x5F,0x6B,0x44,0x98,0xAF,0x3B,0x87,0x9C,
|
||
0x4D,0x96,0xAB,0x38,0x83,0x98,0x40,0x91,0xA8,0x4C,0x9D,0xB4,0x5C,0xAC,0xC1,0x2F,0x87,0x94,0x30,0x30,0x30,0x35,0x34,0x34,
|
||
0x33,0x79,0x82,0x2F,0x6E,0x80,0x34,0x81,0x8B,0x32,0x86,0x93,0x2F,0x89,0x96,0x33,0x8C,0x98,0x3B,0x87,0x8F,0x39,0x9F,0x7E,
|
||
0x2D,0x81,0x8E,0x3F,0x80,0x92,0x5C,0x71,0x75,0x62,0x64,0x67,0x68,0x6A,0x6D,0x60,0x62,0x66,0x66,0x68,0x6B,0x64,0x66,0x6A,
|
||
0x35,0x7B,0x8E,0x61,0x61,0x62,0x41,0x76,0x79,0x33,0x8E,0x9B,0x54,0x79,0x7F,0x67,0x6A,0x77,0x55,0x9E,0xB2,0x5E,0xA7,0xBC,
|
||
0x3E,0x8C,0x97,0x3D,0x3E,0x3E,0x45,0x42,0x43,0x38,0x39,0x37,0x37,0x97,0x3C,0x37,0x94,0x20,0x34,0x79,0xB9,0x3E,0x86,0xE6,
|
||
0x41,0x8C,0xF2,0x3D,0x83,0xE2,0x3B,0x80,0xDD,0x3A,0x7C,0xD7,0x38,0x79,0xD1,0x3F,0x88,0xEA,0x5B,0x5D,0x60,0x63,0x65,0x68,
|
||
0x6B,0x6D,0x70,0x5E,0x5F,0x5F,0x66,0x65,0x65,0x31,0x69,0xB5,0x3B,0x66,0xAC,0x36,0x7D,0xC1,0x38,0x83,0xC8,0x46,0x72,0x99,
|
||
0x71,0x72,0x73,0x46,0x95,0xA8,0x4E,0x4D,0x4D,0x52,0x51,0x51,0x56,0x56,0x56,0x59,0x5A,0x5A,0x41,0x7B,0x68,0x33,0x89,0x09,
|
||
0x38,0x9B,0x5B,0x36,0x90,0x00,0x36,0x91,0x06,0x41,0x8B,0xF1,0x34,0x70,0xC2,0x37,0x77,0xCD,0x40,0x8A,0xEE,0x4B,0x77,0xA0,
|
||
0x41,0x8C,0xF1,0x37,0x80,0x94,0x34,0x8B,0x98,0x4A,0x48,0x49,0x5D,0x5D,0x5D,0x36,0x90,0x03,0x36,0x92,0x0E,0x7B,0x6B,0xB0,
|
||
0xF8,0x9C,0x94,0xF6,0x85,0x7C,0xF5,0x74,0x6A,0xF4,0x66,0x5A,0xF1,0x53,0x46,0xB6,0x53,0x5F,0x62,0x64,0x72,0x49,0x74,0x9C,
|
||
0x72,0xC4,0xD0,0x69,0x69,0x69,0x32,0x8B,0x99,0x76,0x66,0x9D,0xDD,0x47,0x3B,0xA0,0x49,0x53,0x77,0xCD,0xD8,0xC1,0x3E,0x34,
|
||
0x8C,0x43,0x4F,0x38,0x55,0x8E,0x41,0x73,0xC3,0x71,0x5D,0x89,0x74,0x3B,0x48,0x59,0x33,0x43,0x34,0x8D,0x9C,0x9A,0x32,0x2A,
|
||
0x49,0x5F,0x99,0x6D,0x23,0x1D,0x37,0x6E,0x75,0x19,0x48,0x52,0x48,0x88,0x8D,0x34,0x8D,0x9B,0x2F,0x7F,0x15,0x28,0x6C,0x2D,
|
||
0x8B,0x77,0xAA,0x15,0x3C,0x66,0x24,0x59,0x4E,0x31,0x8F,0x9D,0x48,0xAD,0xBC
|
||
};
|
||
|
||
for (int lc=0;lc<576;lc++)
|
||
target[lc] = ((RGB*)palette)[source[lc]];
|
||
}
|
||
|
||
|
||
void interlevelpause(){ //Пауза между уровнями
|
||
Byte tempCode;
|
||
RGB tmprgb;
|
||
int tmpa=0;
|
||
laststep=0;
|
||
static int yellow_pal[] = {0xA8A93D,0xBEBF4C,0xD6D856,0xDFE15A,0xECEE5B,
|
||
0xECEE5B,0xDFE15A,0xD6D856,0xBEBF4C,0xA8A93D};
|
||
for (int iic=0;iic<240;iic++){
|
||
kos_WaitForEvent(1);
|
||
kos_GetKey(tempCode);
|
||
|
||
kos_DrawBar(iic*2,0,2,480,yellow_pal[tmpa]);
|
||
|
||
tmpa++;
|
||
if (tmpa>9){tmpa=0;}
|
||
}
|
||
}
|
||
|
||
void draw_element(int elx, int ely){ //Отрисовка элемента карты
|
||
switch (gamearea[elx][ely]){
|
||
case 'g':
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)grass,24,24,elx*24,ely*24);
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(elx*24,ely*24,24,24,0xAAAA00);
|
||
}
|
||
|
||
break;
|
||
case 'k':
|
||
if (drawgraphics==true){
|
||
switch(kosilkadirection){
|
||
case 1:
|
||
kos_PutImage((RGB*)kosilka_d,24,24,elx*24,ely*24);
|
||
break;
|
||
case 2:
|
||
kos_PutImage((RGB*)kosilka_u,24,24,elx*24,ely*24);
|
||
break;
|
||
case 3:
|
||
kos_PutImage((RGB*)kosilka_l,24,24,elx*24,ely*24);
|
||
break;
|
||
case 4:
|
||
kos_PutImage((RGB*)kosilka_r,24,24,elx*24,ely*24);
|
||
break;
|
||
}
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(elx*24,ely*24,24,24,0x00AAAA);
|
||
}
|
||
|
||
|
||
|
||
break;
|
||
case 'n':
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)skos,24,24,elx*24,ely*24);
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(elx*24,ely*24,24,24,0xAAAAAA);
|
||
}
|
||
|
||
|
||
break;
|
||
case 's':
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)stone,24,24,elx*24,ely*24);
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(elx*24,ely*24,24,24,0x555555);
|
||
}
|
||
|
||
|
||
break;
|
||
|
||
case 't':
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)tree,24,24,elx*24,ely*24);
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(elx*24,ely*24,24,24,0x005500);
|
||
}
|
||
|
||
|
||
break;
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
void display_grass_left(){ //Выводим на экран количество оставшейся травы
|
||
kos_DrawBar(605,120,20,10,0xEEEEEE);
|
||
kos_DisplayNumberToWindow(grassLeft(),3,605,120,0x0000FF,nbDecimal,false);
|
||
}
|
||
|
||
|
||
void animate(int initcellx, int initcelly, int direction){ //анимация движения косилки
|
||
int tmpp=0;
|
||
|
||
switch (direction){
|
||
case 1:
|
||
for (tmpp=0; tmpp<23;tmpp++){
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)skos,24,24,initcellx*24,initcelly*24);
|
||
kos_PutImage((RGB*)kosilka_d,24,24,initcellx*24,initcelly*24+tmpp);
|
||
} else {
|
||
kos_DrawBar(initcellx*24,initcelly*24,24,24,0xAAAAAA);
|
||
kos_DrawBar(initcellx*24,initcelly*24+tmpp,24,24,0x00AAAA);
|
||
|
||
}
|
||
kos_Pause(1);
|
||
}
|
||
break;
|
||
case 2:
|
||
for (tmpp=0; tmpp<23;tmpp++){
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)skos,24,24,initcellx*24,initcelly*24);
|
||
kos_PutImage((RGB*)kosilka_u,24,24,initcellx*24,initcelly*24-tmpp);
|
||
} else {
|
||
kos_DrawBar(initcellx*24,initcelly*24,24,24,0xAAAAAA);
|
||
kos_DrawBar(initcellx*24,initcelly*24-tmpp,24,24,0x00AAAA);
|
||
}
|
||
kos_Pause(1);
|
||
}
|
||
break;
|
||
case 3:
|
||
for (tmpp=0; tmpp<23;tmpp++){
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)skos,24,24,initcellx*24,initcelly*24);
|
||
kos_PutImage((RGB*)kosilka_r,24,24,initcellx*24+tmpp,initcelly*24);
|
||
} else {
|
||
kos_DrawBar(initcellx*24,initcelly*24,24,24,0xAAAAAA);
|
||
kos_DrawBar(initcellx*24+tmpp,initcelly*24,24,24,0x00AAAA);
|
||
|
||
}
|
||
kos_Pause(1);
|
||
}
|
||
break;
|
||
case 4:
|
||
for (tmpp=0; tmpp<23;tmpp++){
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)skos,24,24,initcellx*24,initcelly*24);
|
||
kos_PutImage((RGB*)kosilka_l,24,24,initcellx*24-tmpp,initcelly*24);
|
||
} else {
|
||
kos_DrawBar(initcellx*24,initcelly*24,24,24,0xAAAAAA);
|
||
kos_DrawBar(initcellx*24-tmpp,initcelly*24,24,24,0x00AAAA);
|
||
|
||
}
|
||
kos_Pause(1);
|
||
}
|
||
break;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
void draw_window(void){ //Перерисовка окна
|
||
//----Leency
|
||
if (w_redraw)
|
||
{
|
||
kos_WindowRedrawStatus(1); //Начало перерисовки
|
||
//kos_DefineAndDrawWindow(50,50,640,506,0x74,0xEEEEEE,0,0,(Dword)windowTitle);
|
||
kos_DefineAndDrawWindow(50,50,640,506-22+kos_GetSkinWidth(),0x74,0xEEEEEE,0,0,(Dword)windowTitle);
|
||
}
|
||
w_redraw=false;
|
||
|
||
|
||
//Перерисовка карты
|
||
if ((status!=0)&&(status!=-1)&&(status!=4))
|
||
{
|
||
kos_DrawBar(631-151,0,151,480,0xEEEEEE);
|
||
|
||
kos_WriteTextToWindow(505,30,0x80, 0 ,"Љ Ћ ‘ € ‹ Љ Ђ",19);
|
||
kos_WriteTextToWindow(522,40,0x80, 0 ,"¤«п Љ®«ЁЎаЁ Ћ‘",14);
|
||
|
||
kos_WriteTextToWindow(495,80,0x80, 0 ,"“а®ўҐм:",6);
|
||
kos_DisplayNumberToWindow(level,3,605,80,0x0000FF,nbDecimal,false);
|
||
|
||
kos_WriteTextToWindow(495,95,0x80, 0 ,"Ћбв «®бм Ї®Їлв®Є:",11);
|
||
kos_DisplayNumberToWindow(lives,1,605,95,0x0000FF,nbDecimal,false);
|
||
|
||
kos_WriteTextToWindow(495,120,0x80, 0 ,"Ћбв «®бм ва ўл:",11);
|
||
display_grass_left();
|
||
|
||
kos_WriteTextToWindow(526,450,0x80, 0 ,(char*)version,12);
|
||
|
||
for (int cy=0;cy<20;cy++) for (int cx=0;cx<20;cx++) draw_element(cx,cy);
|
||
}
|
||
|
||
if (status==0){
|
||
kos_DrawBar(0,0,4,480,0x000000);
|
||
kos_DrawBar(628,0,3,480,0x000000);
|
||
//Leency----
|
||
|
||
|
||
for (int tmpppy=0;tmpppy<20;tmpppy++){
|
||
for (int tmpppx=0;tmpppx<26;tmpppx++){
|
||
if ((tmpppx==0) || (tmpppx==25) || (tmpppy==0) || (tmpppy==19)){
|
||
kos_PutImage((RGB*)stone,24,24,4+tmpppx*24,tmpppy*24);
|
||
}
|
||
else
|
||
{
|
||
kos_PutImage((RGB*)skos,24,24,4+tmpppx*24,tmpppy*24);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)kosilka_d,24,24,305,150);
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(305,150,24,24,0x00AAAA);
|
||
}
|
||
|
||
|
||
if (drawanimation==true){
|
||
kos_DrawBar(335,150,24,24,0x00AA00);
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(335,150,24,24,0xAA0000);
|
||
}
|
||
|
||
kos_WriteTextToWindow(257,200,0x80, 0xFFFFFF ,"Љ Ћ ‘ € ‹ Љ Ђ",19);
|
||
kos_WriteTextToWindow(290, 220,0x80, 0xFFFFFF ,"¤«п Љ®«ЁЎаЁ Ћ‘",14);
|
||
kos_WriteTextToWindow(239, 240,0x80, 0xFFFFFF ,"<¤«п з « ЁЈал ¦¬ЁвҐ ENTER>",30);
|
||
kos_WriteTextToWindow(30, 380,0x80, 0xFFFFFF ,"< ¦¬ЁвҐ <g> ¤«п ЇҐаҐЄ«о票п ०Ё¬ Ја дЁЄЁ>",53);
|
||
kos_WriteTextToWindow(30, 400,0x80, 0xFFFFFF ,"< ¦¬ЁвҐ <a> ¤«п ўЄ«о票п/ўлЄ«озҐЁп Ё¬ жЁЁ>",41);
|
||
kos_WriteTextToWindow(30, 420,0x80, 0xFFFFFF ,"< ¦¬ЁвҐ <h> ¤«п Їа®б¬®ва ᢥ¤ҐЁ© ® Їа®Ја ¬¬Ґ>",32);
|
||
if (skin_available==true) {kos_WriteTextToWindow(30, 440,0x80, 0xFFFFFF ,"< ¦¬ЁвҐ <s> зв®Ўл ўлЄ«озЁвм/ўЄ«озЁвм бЄЁ>",27);}
|
||
|
||
|
||
// kos_WriteTextToWindow(470, 440,0x80, 0xFFFFFF ," ¦¬ЁвҐ <ESC> ¤«п ўл室 ",27);
|
||
// kos_DisplayNumberToWindow(external_levels_count[0],3,200,340,0x0000FF,nbDecimal,false);
|
||
|
||
|
||
|
||
kos_WriteTextToWindow(533, 440,0x80, 0xFFFFFF ,(char*)version,0);
|
||
}
|
||
if (status==2){
|
||
kos_DrawBar(10,150,610,200,0x528B4C);
|
||
kos_DrawBar(15,155,601,190,0x3BCF46);
|
||
kos_WriteTextToWindow(240,230,0x80, 0xFFFFFF ,"‚л ўлЁЈа «Ё!",13);
|
||
kos_WriteTextToWindow(240,250,0x80, 0xFFFFFF ,"< ¦¬ЁвҐ q ¤«п ў®§ўа в ў ¬Ґо>",17);
|
||
}
|
||
if (status==3){
|
||
kos_DrawBar(10,150,610,200,0x8B4C4C);
|
||
kos_DrawBar(15,155,601,190,0xCF3B3B);
|
||
kos_WriteTextToWindow(220,220,0x80, 0xFFFFFF ,"€Ја ®Є®зҐ ...",13);
|
||
kos_WriteTextToWindow(220,240,0x80, 0xFFFFFF ,"< ¦¬ЁвҐ r ¤«п в®Ј®, зв®Ўл блЈа вм Ґйс а §>",23);
|
||
kos_WriteTextToWindow(220,260,0x80, 0xFFFFFF ,"< ¦¬ЁвҐ q ¤«п ў®§ўа в ў ¬Ґо>",17);
|
||
}
|
||
if (status==-1){
|
||
|
||
kos_DrawBar(0,0,4,480,0x000000);
|
||
kos_DrawBar(631-3,0,3,480,0x000000);
|
||
|
||
for (int tmpppy=0;tmpppy<20;tmpppy++){
|
||
for (int tmpppx=0;tmpppx<26;tmpppx++){
|
||
if ((tmpppx==0) || (tmpppx==25) || (tmpppy==0) || (tmpppy==19)){
|
||
kos_PutImage((RGB*)stone,24,24,4+tmpppx*24,tmpppy*24);
|
||
}
|
||
else
|
||
{
|
||
kos_PutImage((RGB*)skos,24,24,4+tmpppx*24,tmpppy*24);
|
||
}
|
||
}
|
||
}
|
||
|
||
kos_WriteTextToWindow(40,40,0x80, 0xFFFFFF ,"Љ®бЁ«Є ¤«п Ћ‘ Љ®«ЁЎаЁ",22);
|
||
kos_WriteTextToWindow(40,60,0x80, 0xFFFFFF ,(char*)version,12);
|
||
kos_WriteTextToWindow(40,75,0x80, 0xFFFFFF ,"________________________________________",40);
|
||
|
||
kos_WriteTextToWindow(40,120,0x80, 0xFFFFFF ,"Љ®««ҐЄвЁў а §а Ў®взЁЄ®ў:",18);
|
||
kos_WriteTextToWindow(40,150,0x80, 0xEEFFEE ,"Ђ¤аҐ© ЊЁе ©«®ўЁз aka Dron2004 - Їа®Ја ¬¬Ёа®ў ЁҐ, ўбв஥ п Ја дЁЄ (ЎҐ§ бЄЁ )",32);
|
||
kos_WriteTextToWindow(40,170,0x80, 0xDDFFDD ,"Mario79 - вҐбвЁа®ў ЁҐ, Ї®¬®йм ў а §а Ў®вЄҐ, ў ¦лҐ Ё¤ҐЁ",35);
|
||
kos_WriteTextToWindow(40,190,0x80, 0xCCFFCC ,"Ataualpa - вҐбвЁа®ў ЁҐ, Ї®¬®йм ў а §а Ў®вЄҐ",36);
|
||
kos_WriteTextToWindow(40,210,0x80, 0xBBFFBB ,"Leency - вҐбвЁа®ў ЁҐ, Ї®¬®йм ў а §а Ў®вЄҐ, § ¬Ґз ⥫млҐ бЄЁл, ў ¦лҐ Ё¤ҐЁ",62);
|
||
kos_WriteTextToWindow(40,230,0x80, 0xAAFFAA ,"Mike - вҐбвЁа®ў ЁҐ, Ї®¬®йм ў а §а Ў®вЄҐ",34);
|
||
kos_WriteTextToWindow(40,250,0x80, 0x99FF99 ,"bw - вҐбвЁа®ў ЁҐ, Ї®¬®йм ў а §а Ў®вЄҐ, ў ¦лҐ Ё¤ҐЁ",49);
|
||
kos_WriteTextToWindow(40,270,0x80, 0x99FF99 ,"diamond - Ё¤Ґп ®в¬Ґл 室 , вҐбвЁа®ў ЁҐ",49);
|
||
|
||
kos_WriteTextToWindow(40,300,0x80, 0x88FF88 ,"Ћв¤Ґ«м®Ґ бЇ бЁЎ®:",16);
|
||
kos_WriteTextToWindow(40,330,0x80, 0x77FF77 ,"‚ᥬ, Єв® ЁЈа Ґв ў нвг ЁЈаг :-) !",50);
|
||
|
||
|
||
kos_WriteTextToWindow(40,430,0x80, 0x66FF66 ," ¦¬ЁвҐ <BACKSPACE> ¤«п ў®§ўа в ў ¬Ґо",35);
|
||
}
|
||
|
||
|
||
if (status==4){
|
||
kos_DrawBar(0,0,631,480,0x000000);
|
||
|
||
|
||
for (int tmpppy=0;tmpppy<20;tmpppy++){
|
||
for (int tmpppx=0;tmpppx<26;tmpppx++){
|
||
if ((tmpppx==0) || (tmpppx==25) || (tmpppy==0) || (tmpppy==19)){
|
||
kos_PutImage((RGB*)stone,24,24,4+tmpppx*24,tmpppy*24);
|
||
}
|
||
else
|
||
{
|
||
kos_PutImage((RGB*)skos,24,24,4+tmpppx*24,tmpppy*24);
|
||
}
|
||
}
|
||
}
|
||
|
||
kos_WriteTextToWindow(215, 200,0x80, 0xFFFFFF ,"‚лЎҐаЁвҐ Ў®а га®ўҐ© ( ¦¬ЁвҐ <1> Ё«Ё <2>):",0);
|
||
kos_WriteTextToWindow(215, 220,0x80, 0xFFFFFF ,"1. ‚бва®ҐлҐ га®ўЁ",0);
|
||
kos_WriteTextToWindow(215, 240,0x80, 0xFFFFFF ,"2. ‚ҐиЁ© Ў®а га®ўҐ©",0);
|
||
|
||
}
|
||
|
||
|
||
kos_WindowRedrawStatus(2); //Конец перерисовки
|
||
|
||
}
|
||
|
||
|
||
|
||
//Описание уровней игры
|
||
//, где k - косилка
|
||
// g - трава
|
||
// n - скошенная трава
|
||
// s - камень
|
||
// t - дерево
|
||
void initializeLevel(int levnum){
|
||
laststep=0;
|
||
if (external_levels==false){
|
||
|
||
kosilkadirection=1;
|
||
if (levnum==1){
|
||
static char tmparea[20][20]={{'k','t','g','g','g','g','g','s','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','s','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','s','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','s','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','s','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','g','g','g','s','g','g','s','s','s','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','g','g','g','s','g','g','s','s','s','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','g','g','g','s','g','g','s','s','s','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','g','g','g','s','g','g','s','g','g','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','s','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','t','g','s','g','g','g','s','g','g','g','g','s','g','g','g','g','g','g','g'},
|
||
{'g','g','g','s','g','g','g','g','g','s','g','g','s','g','g','g','g','g','g','g'}};
|
||
for (int tyy=0;tyy<20;tyy++){
|
||
for (int txx=0;txx<20;txx++){
|
||
|
||
if (tmparea[txx][tyy]=='k'){
|
||
kosilkax=tyy;
|
||
kosilkay=txx;
|
||
}
|
||
|
||
gamearea[txx][tyy]=tmparea[tyy][txx];
|
||
}
|
||
}
|
||
}
|
||
if (levnum==2){
|
||
static char tmparea[20][20]={{'s','s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'s','s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','s','g'},
|
||
{'g','k','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','s','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','s','s','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','s','s','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'s','s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'s','s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','s','s','g','g','g','g','g','g','g','s','s','g'},
|
||
{'g','g','g','g','g','g','g','g','s','s','g','g','g','g','g','g','g','s','s','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','s','s','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','s','s','g','g','g','g','g'},
|
||
{'g','g','g','s','s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','g','g','s','s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'},
|
||
{'g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g'}};
|
||
for (int tyy=0;tyy<20;tyy++){
|
||
for (int txx=0;txx<20;txx++){
|
||
|
||
if (tmparea[txx][tyy]=='k'){
|
||
kosilkax=tyy;
|
||
kosilkay=txx;
|
||
}
|
||
|
||
gamearea[txx][tyy]=tmparea[tyy][txx];
|
||
}
|
||
}
|
||
}
|
||
|
||
if (levnum==3){
|
||
static char tmparea[20][20]={{'t','n','t','n','t','n','t','n','t','n','t','n','t','n','t','n','t','n','t','k'},
|
||
{'n','t','g','g','g','g','g','g','g','g','g','g','s','n','n','s','n','s','t','g'},
|
||
{'t','n','g','g','g','g','g','g','g','g','g','g','n','t','n','n','n','t','t','g'},
|
||
{'n','t','g','g','g','g','g','g','g','g','g','g','n','s','n','s','n','s','t','g'},
|
||
{'t','n','g','g','g','g','g','s','s','g','g','g','n','n','n','n','n','t','t','g'},
|
||
{'n','t','g','g','g','g','g','g','g','g','g','g','t','n','s','n','n','s','t','g'},
|
||
{'t','n','g','g','g','g','g','g','g','g','g','g','n','n','n','n','n','t','t','g'},
|
||
{'n','t','g','g','g','g','g','g','g','g','g','g','n','n','s','n','n','s','t','g'},
|
||
{'t','n','g','g','g','g','g','g','g','g','g','g','n','s','n','n','n','t','t','g'},
|
||
{'n','t','g','g','g','g','g','g','g','g','g','g','s','n','n','n','n','t','g','g'},
|
||
{'t','n','g','g','g','s','g','g','g','g','g','g','t','t','t','t','t','t','g','g'},
|
||
{'n','t','g','g','g','s','g','g','g','g','g','g','g','g','g','g','g','t','g','g'},
|
||
{'t','n','g','g','g','g','g','g','g','g','g','g','t','t','g','g','g','t','g','g'},
|
||
{'n','t','g','g','g','g','g','g','t','t','g','g','g','t','g','g','g','t','g','g'},
|
||
{'t','n','g','g','g','g','g','g','t','t','g','g','g','t','g','g','g','t','g','g'},
|
||
{'n','t','g','g','g','g','g','g','g','g','g','g','g','t','g','g','g','t','g','g'},
|
||
{'t','n','g','g','g','g','g','g','g','g','g','g','g','t','t','g','g','t','g','g'},
|
||
{'n','t','g','g','g','g','g','g','g','g','g','g','g','g','t','g','g','t','g','g'},
|
||
{'t','n','g','g','g','g','g','g','g','g','g','g','g','g','t','g','g','t','g','g'},
|
||
{'n','t','s','s','s','s','s','s','s','s','s','s','s','s','t','g','g','g','g','g'}};
|
||
for (int tyy=0;tyy<20;tyy++){
|
||
for (int txx=0;txx<20;txx++){
|
||
|
||
if (tmparea[txx][tyy]=='k'){
|
||
kosilkax=tyy;
|
||
kosilkay=txx;
|
||
}
|
||
|
||
gamearea[txx][tyy]=tmparea[tyy][txx];
|
||
}
|
||
}
|
||
}
|
||
|
||
if (levnum==4){
|
||
static char tmparea[20][20]={{'t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','n','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','n','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','n','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','s','n','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','s','n','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','s','n','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','s','n','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','s','s','t'},
|
||
{'t','g','g','g','g','t','t','t','t','t','t','t','t','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','t','t','t','t','t','t','t','t','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','k','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t'}};
|
||
for (int tyy=0;tyy<20;tyy++){
|
||
for (int txx=0;txx<20;txx++){
|
||
|
||
if (tmparea[txx][tyy]=='k'){
|
||
kosilkax=tyy;
|
||
kosilkay=txx;
|
||
}
|
||
|
||
gamearea[txx][tyy]=tmparea[tyy][txx];
|
||
}
|
||
}
|
||
}
|
||
|
||
if (levnum==5){
|
||
static char tmparea[20][20]={{'t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t'},
|
||
{'t','s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','s','g','g','g','g','g','t','g','g','t','g','g','g','g','g','g','g','g','t'},
|
||
{'t','t','g','g','g','g','t','n','t','t','t','g','g','g','g','g','g','g','g','t'},
|
||
{'t','s','g','g','g','g','t','n','n','n','t','g','g','g','g','g','g','g','g','t'},
|
||
{'t','k','g','g','g','g','t','n','n','n','t','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','t','n','n','n','t','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','t','n','n','t','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','t','n','n','t','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','t','n','n','n','t','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','t','n','n','n','t','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','t','n','t','t','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','t','t','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','t'},
|
||
{'t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t','t'}};
|
||
for (int tyy=0;tyy<20;tyy++){
|
||
for (int txx=0;txx<20;txx++){
|
||
|
||
if (tmparea[txx][tyy]=='k'){
|
||
kosilkax=tyy;
|
||
kosilkay=txx;
|
||
}
|
||
|
||
gamearea[txx][tyy]=tmparea[tyy][txx];
|
||
}
|
||
}
|
||
}
|
||
|
||
if (levnum==6){
|
||
static char tmparea[20][20]={{'s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s'},
|
||
{'s','k','t','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','s','s','s','s','s','s','s','s','s','s','s','s','s','s','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','t','t','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','g','g','g','g','g','t','t','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','g','g','g','g','g','t','t','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','t','t','g','g','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','t','t','t','g','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','t','t','t','t','t','t','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','t','t','t','t','t','t','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','t','t','g','g','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','t','t','g','g','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','g','g','g','g','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','g','g','g','g','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','g','g','g','g','g','g','g','g','g','g','g','g','s','g','g','s'},
|
||
{'s','g','g','s','s','s','s','s','s','s','s','s','s','s','s','s','s','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s'}};
|
||
for (int tyy=0;tyy<20;tyy++){
|
||
for (int txx=0;txx<20;txx++){
|
||
|
||
if (tmparea[txx][tyy]=='k'){
|
||
kosilkax=tyy;
|
||
kosilkay=txx;
|
||
}
|
||
|
||
gamearea[txx][tyy]=tmparea[tyy][txx];
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
if (levnum==7){
|
||
static char tmparea[20][20]={{'s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','t','t','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','t','t','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','t','t','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s','t','t','s'},
|
||
{'s','g','g','g','g','g','t','t','t','t','t','t','g','g','g','g','s','t','t','s'},
|
||
{'s','g','g','g','g','g','t','k','g','g','g','t','g','g','g','g','s','t','t','s'},
|
||
{'s','g','g','g','g','g','t','g','g','g','g','t','g','g','g','g','s','t','t','s'},
|
||
{'s','g','g','g','g','g','t','g','g','g','g','t','g','g','g','g','s','t','t','s'},
|
||
{'s','g','g','g','g','g','t','g','g','g','g','t','g','g','g','g','s','s','s','s'},
|
||
{'s','g','g','g','g','g','t','g','g','g','g','t','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','t','t','t','t','g','t','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','t','g','g','t','g','g','g','g','g','g','s'},
|
||
{'s','g','g','g','g','g','g','g','g','t','g','g','t','g','g','g','g','g','g','s'},
|
||
{'s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s'}};
|
||
for (int tyy=0;tyy<20;tyy++){
|
||
for (int txx=0;txx<20;txx++){
|
||
|
||
if (tmparea[txx][tyy]=='k'){
|
||
kosilkax=tyy;
|
||
kosilkay=txx;
|
||
}
|
||
|
||
gamearea[txx][tyy]=tmparea[tyy][txx];
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//ВНЕШНИЕ УРОВНИ
|
||
kosilkadirection=1;
|
||
|
||
int currentrow=0;
|
||
int currentcol=0;
|
||
|
||
for (int tmpcntr=0;tmpcntr<400;tmpcntr++){
|
||
|
||
currentcol=(int)(tmpcntr/20);
|
||
currentrow=tmpcntr-(((int)(tmpcntr/20))*20);
|
||
switch(externallevels[tmpcntr+(400*(levnum-1))]){
|
||
|
||
case 0:
|
||
gamearea[currentrow][currentcol]='n';
|
||
break;
|
||
case 1:
|
||
gamearea[currentrow][currentcol]='g';
|
||
break;
|
||
case 2:
|
||
gamearea[currentrow][currentcol]='k';
|
||
kosilkax=currentrow;
|
||
kosilkay=currentcol;
|
||
break;
|
||
case 3:
|
||
gamearea[currentrow][currentcol]='s';
|
||
break;
|
||
case 4:
|
||
gamearea[currentrow][currentcol]='t';
|
||
break;
|
||
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
draw_window();
|
||
|
||
}
|
||
|
||
//Преоверяем остаток травы
|
||
int grassLeft(){
|
||
int leftgrass=0;
|
||
for (int chky=0;chky<20;chky++){
|
||
for (int chkx=0;chkx<20;chkx++){
|
||
if (gamearea[chkx][chky]=='g') {
|
||
leftgrass++;
|
||
}
|
||
}
|
||
}
|
||
return leftgrass;
|
||
}
|
||
|
||
|
||
//Меняем уровень или выводим сообщение о том, что все уровни пройдены
|
||
void updateStatus(){
|
||
|
||
|
||
if (grassLeft()==0) {
|
||
if (level==levelcount){
|
||
gamestarted=false;
|
||
status=2;
|
||
draw_window();
|
||
} else {
|
||
gamestarted=false;
|
||
interlevelpause();
|
||
level++;
|
||
initializeLevel(level);
|
||
gamestarted=true;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
void decode_skin(){
|
||
int currentbyte3x=0;
|
||
RGB tmpRGB;
|
||
int tmpcc1=0;
|
||
|
||
for (tmpcc1=0;tmpcc1<576;tmpcc1++){
|
||
|
||
tmpRGB.r= skindata[currentbyte3x];
|
||
tmpRGB.g= skindata[currentbyte3x+1];
|
||
tmpRGB.b= skindata[currentbyte3x+2];
|
||
kosilka_d[tmpcc1]=tmpRGB;
|
||
currentbyte3x+=3;
|
||
}
|
||
|
||
for (tmpcc1=0;tmpcc1<576;tmpcc1++){
|
||
|
||
tmpRGB.r= skindata[currentbyte3x];
|
||
tmpRGB.g= skindata[currentbyte3x+1];
|
||
tmpRGB.b= skindata[currentbyte3x+2];
|
||
kosilka_u[tmpcc1]=tmpRGB;
|
||
currentbyte3x+=3;
|
||
}
|
||
|
||
for (tmpcc1=0;tmpcc1<576;tmpcc1++){
|
||
|
||
tmpRGB.r= skindata[currentbyte3x];
|
||
tmpRGB.g= skindata[currentbyte3x+1];
|
||
tmpRGB.b= skindata[currentbyte3x+2];
|
||
kosilka_l[tmpcc1]=tmpRGB;
|
||
currentbyte3x+=3;
|
||
}
|
||
|
||
for (tmpcc1=0;tmpcc1<576;tmpcc1++){
|
||
|
||
tmpRGB.r= skindata[currentbyte3x];
|
||
tmpRGB.g= skindata[currentbyte3x+1];
|
||
tmpRGB.b= skindata[currentbyte3x+2];
|
||
kosilka_r[tmpcc1]=tmpRGB;
|
||
currentbyte3x+=3;
|
||
}
|
||
|
||
for (tmpcc1=0;tmpcc1<576;tmpcc1++){
|
||
|
||
tmpRGB.r= skindata[currentbyte3x];
|
||
tmpRGB.g= skindata[currentbyte3x+1];
|
||
tmpRGB.b= skindata[currentbyte3x+2];
|
||
skos[tmpcc1]=tmpRGB;
|
||
currentbyte3x+=3;
|
||
}
|
||
|
||
for (tmpcc1=0;tmpcc1<576;tmpcc1++){
|
||
|
||
tmpRGB.r= skindata[currentbyte3x];
|
||
tmpRGB.g= skindata[currentbyte3x+1];
|
||
tmpRGB.b= skindata[currentbyte3x+2];
|
||
grass[tmpcc1]=tmpRGB;
|
||
currentbyte3x+=3;
|
||
}
|
||
|
||
for (tmpcc1=0;tmpcc1<576;tmpcc1++){
|
||
|
||
tmpRGB.r= skindata[currentbyte3x];
|
||
tmpRGB.g= skindata[currentbyte3x+1];
|
||
tmpRGB.b= skindata[currentbyte3x+2];
|
||
stone[tmpcc1]=tmpRGB;
|
||
currentbyte3x+=3;
|
||
}
|
||
|
||
for (tmpcc1=0;tmpcc1<576;tmpcc1++){
|
||
|
||
tmpRGB.r= skindata[currentbyte3x];
|
||
tmpRGB.g= skindata[currentbyte3x+1];
|
||
tmpRGB.b= skindata[currentbyte3x+2];
|
||
tree[tmpcc1]=tmpRGB;
|
||
currentbyte3x+=3;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
void load_external_levels(){
|
||
|
||
CKosFile lev(getLevelsPathName());
|
||
|
||
level_read_result=lev.Read (external_levels_count,1);
|
||
|
||
if (level_read_result == 1){
|
||
external_levels_available=true;
|
||
}
|
||
else
|
||
{
|
||
external_levels_available=false;
|
||
};
|
||
|
||
|
||
if (external_levels_count[0]==0){
|
||
external_levels_available=false;
|
||
}
|
||
else
|
||
{
|
||
externallevels = new Byte[400*external_levels_count[0]];
|
||
lev.Read (externallevels,400*external_levels_count[0]);
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
void app_halt(){
|
||
|
||
delete apppath;
|
||
delete levpath;
|
||
if (external_levels_available==true) {delete externallevels;}
|
||
kos_ExitApp();
|
||
|
||
}
|
||
|
||
void kos_Main(){
|
||
|
||
|
||
load_external_levels();
|
||
|
||
CKosFile skin(getSkinPathName());
|
||
|
||
read_result=skin.Read (skindata,13824);
|
||
if (read_result != 13824){
|
||
skin_available=false;
|
||
}
|
||
else
|
||
{
|
||
skin_available=true;
|
||
};
|
||
|
||
if (skin_available==false){
|
||
decode_graphics(kosilka_d1,kosilka_d);
|
||
decode_graphics(kosilka_u1,kosilka_u);
|
||
decode_graphics(kosilka_l1,kosilka_l);
|
||
decode_graphics(kosilka_r1,kosilka_r);
|
||
decode_graphics(skos1,skos);
|
||
decode_graphics(stone1,stone);
|
||
decode_graphics(tree1,tree);
|
||
decode_graphics(grass1,grass);
|
||
skinned=false;
|
||
}
|
||
else
|
||
{
|
||
decode_skin();
|
||
skinned=true;
|
||
}
|
||
|
||
draw_window();
|
||
|
||
for (;;){
|
||
|
||
switch (kos_WaitForEvent()){
|
||
case 1:
|
||
w_redraw=true;
|
||
draw_window();
|
||
break;
|
||
case 2:
|
||
Byte keyCode;
|
||
kos_GetKey(keyCode);
|
||
if (status==1){
|
||
if (gamestarted==true){
|
||
switch (keyCode){
|
||
case 177:
|
||
if (kosilkay<19){
|
||
if (gamearea[kosilkax][kosilkay+1]=='g'){
|
||
gamearea[kosilkax][kosilkay]='n';
|
||
gamearea[kosilkax][kosilkay+1]='k';
|
||
|
||
if (drawanimation==true) {animate(kosilkax,kosilkay,1);}
|
||
|
||
|
||
lastkosilkadirection=kosilkadirection;
|
||
laststep=1;
|
||
|
||
kosilkay++;
|
||
kosilkadirection=1;
|
||
draw_element(kosilkax,kosilkay);
|
||
draw_element(kosilkax,kosilkay-1);
|
||
display_grass_left();
|
||
updateStatus();
|
||
}
|
||
}
|
||
break;
|
||
case 178:
|
||
if (kosilkay>0){
|
||
if (gamearea[kosilkax][kosilkay-1]=='g'){
|
||
gamearea[kosilkax][kosilkay]='n';
|
||
gamearea[kosilkax][kosilkay-1]='k';
|
||
|
||
if (drawanimation==true) {animate(kosilkax,kosilkay,2);}
|
||
|
||
lastkosilkadirection=kosilkadirection;
|
||
laststep=2;
|
||
|
||
kosilkay--;
|
||
kosilkadirection=2;
|
||
|
||
draw_element(kosilkax,kosilkay);
|
||
draw_element(kosilkax,kosilkay+1);
|
||
display_grass_left();
|
||
updateStatus();
|
||
}
|
||
}
|
||
break;
|
||
|
||
case 179:
|
||
if (kosilkax<19){
|
||
if (gamearea[kosilkax+1][kosilkay]=='g'){
|
||
gamearea[kosilkax][kosilkay]='n';
|
||
gamearea[kosilkax+1][kosilkay]='k';
|
||
|
||
if (drawanimation==true) {animate(kosilkax,kosilkay,3);}
|
||
|
||
|
||
lastkosilkadirection=kosilkadirection;
|
||
laststep=3;
|
||
|
||
kosilkax++;
|
||
kosilkadirection=4;
|
||
|
||
draw_element(kosilkax,kosilkay);
|
||
draw_element(kosilkax-1,kosilkay);
|
||
display_grass_left();
|
||
updateStatus();
|
||
}
|
||
}
|
||
break;
|
||
|
||
case 176:
|
||
if (kosilkax>0){
|
||
if (gamearea[kosilkax-1][kosilkay]=='g'){
|
||
gamearea[kosilkax][kosilkay]='n';
|
||
gamearea[kosilkax-1][kosilkay]='k';
|
||
|
||
if (drawanimation==true) {animate(kosilkax,kosilkay,4);}
|
||
|
||
lastkosilkadirection=kosilkadirection;
|
||
laststep=4;
|
||
|
||
kosilkax--;
|
||
kosilkadirection=3;
|
||
|
||
draw_element(kosilkax,kosilkay);
|
||
draw_element(kosilkax+1,kosilkay);
|
||
display_grass_left();
|
||
updateStatus();
|
||
}
|
||
}
|
||
break;
|
||
|
||
case 27:
|
||
if (lives>0){
|
||
lives--;
|
||
initializeLevel(level);
|
||
|
||
} else {
|
||
gamestarted=false;
|
||
status=3;
|
||
draw_window();
|
||
}
|
||
break;
|
||
|
||
case 8:
|
||
if (laststep!=0){
|
||
kosilkadirection=lastkosilkadirection;
|
||
if (laststep==1){
|
||
gamearea[kosilkax][kosilkay]='g';
|
||
gamearea[kosilkax][kosilkay-1]='k';
|
||
draw_element(kosilkax,kosilkay);
|
||
draw_element(kosilkax,kosilkay-1);
|
||
kosilkay--;
|
||
}
|
||
if (laststep==2){
|
||
gamearea[kosilkax][kosilkay]='g';
|
||
gamearea[kosilkax][kosilkay+1]='k';
|
||
draw_element(kosilkax,kosilkay);
|
||
draw_element(kosilkax,kosilkay+1);
|
||
kosilkay++;
|
||
}
|
||
|
||
if (laststep==3){
|
||
gamearea[kosilkax][kosilkay]='g';
|
||
gamearea[kosilkax-1][kosilkay]='k';
|
||
draw_element(kosilkax,kosilkay);
|
||
draw_element(kosilkax-1,kosilkay);
|
||
kosilkax--;
|
||
}
|
||
|
||
if (laststep==4){
|
||
gamearea[kosilkax][kosilkay]='g';
|
||
gamearea[kosilkax+1][kosilkay]='k';
|
||
draw_element(kosilkax,kosilkay);
|
||
draw_element(kosilkax+1,kosilkay);
|
||
kosilkax++;
|
||
}
|
||
|
||
|
||
laststep=0;
|
||
}
|
||
break;
|
||
|
||
}
|
||
|
||
}
|
||
}
|
||
if (status==0){
|
||
if (keyCode==13){ //enter
|
||
if (external_levels_available==true){
|
||
status=4;
|
||
draw_window();
|
||
}
|
||
else
|
||
{
|
||
status=1;
|
||
initializeLevel(1);
|
||
gamestarted=true;
|
||
}
|
||
|
||
}
|
||
|
||
if (keyCode==103){
|
||
if (drawgraphics==true){
|
||
drawgraphics=false;
|
||
} else {
|
||
drawgraphics=true;
|
||
}
|
||
|
||
if (drawgraphics==true){
|
||
kos_PutImage((RGB*)kosilka_d,24,24,305,150);
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(305,150,24,24,0x00AAAA);
|
||
}
|
||
}
|
||
|
||
if (keyCode==97){
|
||
if (drawanimation==true){
|
||
drawanimation=false;
|
||
} else {
|
||
drawanimation=true;
|
||
}
|
||
|
||
if (drawanimation==true){
|
||
kos_DrawBar(335,150,24,24,0x00AA00);
|
||
}
|
||
else
|
||
{
|
||
kos_DrawBar(335,150,24,24,0xAA0000);
|
||
}
|
||
}
|
||
if (keyCode==104){
|
||
status=-1;
|
||
draw_window();
|
||
}
|
||
|
||
if (keyCode==115){
|
||
|
||
if (skin_available==true){
|
||
if (skinned==true){
|
||
skinned=false;
|
||
decode_graphics(kosilka_d1,kosilka_d);
|
||
decode_graphics(kosilka_u1,kosilka_u);
|
||
decode_graphics(kosilka_l1,kosilka_l);
|
||
decode_graphics(kosilka_r1,kosilka_r);
|
||
decode_graphics(skos1,skos);
|
||
decode_graphics(stone1,stone);
|
||
decode_graphics(tree1,tree);
|
||
decode_graphics(grass1,grass);
|
||
} else {
|
||
skinned=true;
|
||
decode_skin();
|
||
}
|
||
|
||
draw_window();
|
||
|
||
}
|
||
|
||
}
|
||
if (keyCode==27){
|
||
app_halt();
|
||
}
|
||
|
||
}
|
||
|
||
if (status==4){
|
||
if (keyCode==49){ //1
|
||
external_levels=false;
|
||
status=1;
|
||
initializeLevel(1);
|
||
gamestarted=true;
|
||
|
||
}
|
||
|
||
if (keyCode==50){ //2
|
||
external_levels=true;
|
||
levelcount=external_levels_count[0];
|
||
status=1;
|
||
initializeLevel(1);
|
||
gamestarted=true;
|
||
|
||
}
|
||
}
|
||
|
||
if (status==2){
|
||
if (keyCode==113){
|
||
lives=2;
|
||
status=0;
|
||
level=1;
|
||
draw_window();
|
||
gamestarted=true;
|
||
}
|
||
}
|
||
|
||
if (status==3){
|
||
if (keyCode==113){
|
||
lives=2;
|
||
status=0;
|
||
level=1;
|
||
draw_window();
|
||
gamestarted=true;
|
||
|
||
}
|
||
if (keyCode==114){
|
||
lives=2;
|
||
status=1;
|
||
level=1;
|
||
initializeLevel(1);
|
||
gamestarted=true;
|
||
}
|
||
|
||
}
|
||
|
||
if (status==-1){
|
||
if (keyCode==8){
|
||
status=0;
|
||
draw_window();
|
||
}
|
||
}
|
||
|
||
//Выводим код нажатой клавиши. Фича временная
|
||
/* kos_DrawBar(20,250,150,10,0xEEEEEE);
|
||
kos_WriteTextToWindow(20,250,0x80, 0 ,"Button",0);
|
||
kos_DisplayNumberToWindow(keyCode,3,70,250,0x0000FF,nbDecimal,false); */
|
||
break;
|
||
case 3:
|
||
|
||
app_halt();
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Конец исходника ;-)
|