kolibrios-gitea/programs/games/kosilka/kosilka.cpp

1062 lines
34 KiB
C++
Raw Normal View History

/* ------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -------
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> C++ (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MS Visual C++ 6.0+).
<EFBFBD><EFBFBD><EFBFBD> - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1.15.
Andrey Mihaylovich aka Dron2004
*/
#include "kosSyst.h"
#include "kosFile.h"
#include "images.cpp"
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>. 0-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 1-<2D><><EFBFBD><EFBFBD>, 2-<2D><><EFBFBD><EFBFBD><EFBFBD>, 3-<2D><><EFBFBD><EFBFBD><EFBFBD>, 4-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Byte skindata[13824];
int read_result=0;
bool skin_available=false;
bool w_redraw=true;
const char windowTitle[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
const char version[]="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1.15";
int levelcount=7; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
char gamearea[20][20]; //<2F><><EFBFBD><EFBFBD><EFBFBD>
short int kosilkax; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
short int kosilkay;
short int kosilkadirection=1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. 1-<2D><><EFBFBD><EFBFBD>, 2-<2D><><EFBFBD><EFBFBD><EFBFBD>, 3-<2D><><EFBFBD><EFBFBD><EFBFBD>, 4-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
short int lives=2; // <20><><EFBFBD><EFBFBD><EFBFBD>
short int level=1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
short int status=0; //<2F><><EFBFBD> 0 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 1 - <20><><EFBFBD><EFBFBD>
// 2 - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 3 - <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// 4 - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
// -1 - <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool gamestarted=false; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD> false - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool drawgraphics=true; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
bool drawanimation=true; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
int grassLeft(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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];
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 0xRRGGBB
char * apppath;
char * levpath;
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 interlevelpause(){ //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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(); //Pause()?
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){ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
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(){ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
kos_DrawBar(605,120,20,10,0xEEEEEE);
kos_DisplayNumberToWindow(grassLeft(),3,605,120,0x0000FF,nbDecimal,false);
}
void animate(int initcellx, int initcelly, int direction){ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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){ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
sProcessInfo sPI;
if (w_redraw)
{
kos_WindowRedrawStatus(1); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
kos_DefineAndDrawWindow(50,50,640,506-22+kos_GetSkinHeight(),0x74,0xEEEEEE,0,0,(Dword)windowTitle);
kos_WindowRedrawStatus(2); //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
w_redraw=false;
kos_ProcessInfo( &sPI );
if (sPI.rawData[70]&0x04) return; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
if ((status!=0)&&(status!=-1)&&(status!=4))
{
kos_DrawBar(631-151,0,151,480,0xEEEEEE);
kos_WriteTextToWindow(500,30,0x80, 0 ,"<EFBFBD> <20> <20> <20> <20> <20> <20>",19);
kos_WriteTextToWindow(517,40,0x80, 0 ,"<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>",14);
kos_WriteTextToWindow(495,80,0x80, 0 ,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:",6);
kos_DisplayNumberToWindow(level,3,605,80,0x0000FF,nbDecimal,false);
kos_WriteTextToWindow(495,95,0x80, 0 ,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>⮪:",11);
kos_DisplayNumberToWindow(lives,1,605,95,0x0000FF,nbDecimal,false);
kos_WriteTextToWindow(495,120,0x80, 0 ,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD>:",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(255,200,0x80, 0xFFFFFF ,"<EFBFBD> <20> <20> <20> <20> <20> <20>",19);
kos_WriteTextToWindow(290, 220,0x80, 0xFFFFFF ,"<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>",14);
kos_WriteTextToWindow(239, 240,0x80, 0xFFFFFF ,"<<3C><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ENTER>",30);
kos_WriteTextToWindow(30, 380,0x80, 0xFFFFFF ,"<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <g> <20><><EFBFBD> <20><><EFBFBD><E0A5AA><EFBFBD><E7A5AD> <><E0A5A6><EFBFBD> <20><><EFBFBD><EFBFBD>>",53);
kos_WriteTextToWindow(30, 400,0x80, 0xFFFFFF ,"<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <a> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E7A5AD>/<2F><EFBFBD><EFBFBD><E7A5AD> <20><><EFBFBD><EFBFBD><EFBFBD>樨>",41);
kos_WriteTextToWindow(30, 420,0x80, 0xFFFFFF ,"<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <h> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><E1ACAE><EFBFBD><><E1A2A5><EFBFBD><EFBFBD><EFBFBD> <20> <20>ணࠬ<E0AEA3><E0A0AC>>",32);
if (skin_available==true) {kos_WriteTextToWindow(30, 440,0x80, 0xFFFFFF ,"<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <s> <20><EFBFBD> <20><EFBFBD><EBAAAB><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>>",27);}
// kos_WriteTextToWindow(470, 440,0x80, 0xFFFFFF ,"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <ESC> <20><><EFBFBD> <20><><EFBFBD>",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 ,"<EFBFBD><EFBFBD> <20>먣ࠫ<EBA8A3>!",13);
kos_WriteTextToWindow(240,250,0x80, 0xFFFFFF ,"<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> q <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>>",17);
}
if (status==3){
kos_DrawBar(10,150,610,200,0x8B4C4C);
kos_DrawBar(15,155,601,190,0xCF3B3B);
kos_WriteTextToWindow(220,220,0x80, 0xFFFFFF ,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>...",13);
kos_WriteTextToWindow(220,240,0x80, 0xFFFFFF ,"<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> r <20><><EFBFBD><>, <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ࠧ>",23);
kos_WriteTextToWindow(220,260,0x80, 0xFFFFFF ,"<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> q <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>>",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 ,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",22);
kos_WriteTextToWindow(40,60,0x80, 0xFFFFFF ,(char*)version,12);
kos_WriteTextToWindow(40,75,0x80, 0xFFFFFF ,"________________________________________",40);
kos_WriteTextToWindow(40,120,0x80, 0xFFFFFF ,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⨢ ࠧࠡ<E0A0A7><E0A0A1><EFBFBD><E7A8AA>:",18);
kos_WriteTextToWindow(40,150,0x80, 0xEEFFEE ,"<EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><E5A0A9><EFBFBD><EFBFBD><EFBFBD> aka Dron2004 - <20>ணࠬ<E0AEA3><E0A0AC><EFBFBD><E0AEA2><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><E0AEA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><><E1AAA8>)",32);
kos_WriteTextToWindow(40,170,0x80, 0xDDFFDD ,"Mario79 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ࠧࠡ<E0A0A7>⪥, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",35);
kos_WriteTextToWindow(40,190,0x80, 0xCCFFCC ,"Ataualpa - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ࠧࠡ<E0A0A7>",36);
kos_WriteTextToWindow(40,210,0x80, 0xBBFFBB ,"Leency - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ࠧࠡ<E0A0A7>⪥, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A5AB><EFBFBD><EFBFBD><><E1AAA8>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",62);
kos_WriteTextToWindow(40,230,0x80, 0xAAFFAA ,"Mike - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ࠧࠡ<E0A0A7>",34);
kos_WriteTextToWindow(40,250,0x80, 0x99FF99 ,"bw - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ࠧࠡ<E0A0A7>⪥, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",49);
kos_WriteTextToWindow(40,270,0x80, 0x99FF99 ,"diamond - <20><><EFBFBD><EFBFBD> <20><EFBFBD><E2ACA5><>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD>",49);
kos_WriteTextToWindow(40,300,0x80, 0x88FF88 ,"<EFBFBD><EFBFBD><EFBFBD> ᯠᨡ<E1AFA0>:",16);
kos_WriteTextToWindow(40,330,0x80, 0x77FF77 ,"<EFBFBD>ᥬ, <20><><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> :-) !",50);
kos_WriteTextToWindow(40,430,0x80, 0x66FF66 ,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <BACKSPACE> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>",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 ,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA2><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <1> <20><><EFBFBD> <2>):",0);
kos_WriteTextToWindow(215, 220,0x80, 0xFFFFFF ,"1. <20><><EFBFBD><EFBFBD><E0AEA5><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA2>",0);
kos_WriteTextToWindow(215, 240,0x80, 0xFFFFFF ,"2. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA2><EFBFBD>",0);
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
//, <20><><EFBFBD> k - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// g - <20><><EFBFBD><EFBFBD><EFBFBD>
// n - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
// s - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// t - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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();
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
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;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void updateStatus(){
if (grassLeft()==0) {
if (level==levelcount){
gamestarted=false;
status=2;
draw_window();
} else {
gamestarted=false;
interlevelpause();
level++;
initializeLevel(level);
gamestarted=true;
}
}
}
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();
decode_graphics(576*0 + kosilka_gfx,kosilka_d);
decode_graphics(576*1 + kosilka_gfx,kosilka_u);
decode_graphics(576*2 + kosilka_gfx,kosilka_l);
decode_graphics(576*3 + kosilka_gfx,kosilka_r);
decode_graphics(576*4 + kosilka_gfx,skos);
decode_graphics(576*5 + kosilka_gfx,stone);
decode_graphics(576*6 + kosilka_gfx,tree);
decode_graphics(576*7 + kosilka_gfx,grass);
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==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();
}
}
break;
case 3:
app_halt();
break;
}
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>