Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7331 → Rev 7332

/programs/games/kosilka/History.txt
1,3 → 1,7
10.09.18 -- v1.16 -- Leency
- äîáàâëåí ïåðåâîä ïðîãðàììû íà àíãëèéñêèé ÿçûê
- âñå êîììåíòàðèè ïåðåâåäåíû íà àíãëèéñêèé
 
22.12.12 -- v1.15 -- Leency
- â ïðîãðàììó âñòðîåí áîëåå ñèìïàòè÷íûé ñêèí îò ìåíÿ, ÷òî ïîçâîëèëî
îñâîáîäèòü 12 Êá â îáðàçå.
/programs/games/kosilka/Tupfile.lua
1,5 → 1,9
if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_MSVC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_msvc.lua")
if tup.getconfig("LANG") == "ru"
then CFLAGS = CFLAGS .. " /DLANG=RUS"
else CFLAGS = CFLAGS .. " /DLANG=ENG"
end
compile_msvc{"kosilka.cpp", "KosFile.cpp", "kosSyst.cpp", "mcsmemm.cpp"}
link_msvc("kosilka")
/programs/games/kosilka/kosilka.cpp
1,19 → 1,17
/* ------- ÊÎÑÈËÊÀ ÄËß ÊÎËÈÁÐÈ -------
Èãðà ïèøåòñÿ íà C++ (èñïîëüçóåòñÿ MS Visual C++ 6.0+).
Ýòî - èñõîäíèê âåðñèè 1.15.
/* ------- KOSILKA FOR KOLIBI -------
Written in C++ (MS Visual C++ 6.0+).
Version 1.16.
Andrey Mihaylovich aka Dron2004
*/
 
 
 
#include "kosSyst.h"
#include "kosFile.h"
#include "images.cpp"
 
 
 
//ÂÍÅØÍÈÅ ÓÐÎÂÍÈ
//External levels
bool external_levels_available=false;
bool external_levels = false;
int level_read_result;
22,7 → 20,7
/////////////////
 
int lastkosilkadirection=1;
int laststep=0; //Ïîñëåäíèé õîä. 0-íåáûëî, 1-âíèç, 2-ââåðõ, 3-âëåâî, 4-âïðàâî
int laststep=0; //Last step. 0-does not exists, 1-bottom, 2-up, 3-left, 4-right
 
 
Byte skindata[13824];
30,29 → 28,63
bool skin_available=false;
bool w_redraw=true;
 
#if LANG == RUS
const char windowTitle[]="Š®á¨«ª  ¤«ï Š®«¨¡à¨";
const char version[]="‚¥àá¨ï 1.15";
int levelcount=7; //×èñëî óðîâíåé
const char version[] = "‚¥àá¨ï 1.16";
const char win[] = "‚ë ¢ë¨£à «¨!";
const char press_q[] = "<­ ¦¬¨â¥ <q> ¤«ï ¢®§¢à â  ¢ ¬¥­î>";
const char fail[] = "ˆ£à  ®ª®­ç¥­ ...";
const char press_r[] = "<­ ¦¬¨â¥ <r> ¤«ï ⮣®, ç⮡ë áë£à âì ¥éñ à §>";
const char k_o_s_i_l_k[] = "Š Ž ‘ ˆ ‹ Š €";
const char for_kolibri[] = "¤«ï Š®«¨¡à¨ Ž‘";
const char press_enter[] = "<¤«ï ­ ç «  ¨£àë ­ ¦¬¨â¥ ENTER>";
const char press_g[] = "<­ ¦¬¨â¥ <g> ¤«ï ¯¥à¥ª«î祭¨ï ०¨¬  £à ä¨ª¨>";
const char press_a[] = "<­ ¦¬¨â¥ <a> ¤«ï ¢ª«î祭¨ï/¢ëª«î祭¨ï  ­¨¬ æ¨¨>";
const char press_h[] = "<­ ¦¬¨â¥ <h> ¤«ï ¯à®á¬®âà  á¢¥¤¥­¨© ® ¯à®£à ¬¬¥>";
const char press_s[] = "<­ ¦¬¨â¥ <s> çâ®¡ë ¢ëª«îç¨âì/¢ª«îç¨âì ᪨­>";
const char level[] = "“஢¥­ì:";
const char attempts_left[] = "Žáâ «®áì ¯®¯ë⮪:";
const char grass_left[] = "Žáâ «®áì âà ¢ë:";
#else
const char windowTitle[] = "Kosilka for Kolibri";
const char version[] = " Ver. 1.16";
const char win[] = " You won! ";
const char press_q[] = "<press <q> to return to the menu>";
const char fail[] = " Game over. ";
const char press_r[] = "<press r ¤«ï ⮣®, ç⮡ë áë£à âì ¥éñ à §>";
const char k_o_s_i_l_k[] = "K O S I L K A";
const char for_kolibri[] = "for Kolibri OS";
const char press_enter[] = "press ENTER to start the game";
const char press_g[] = "<press <g> to switch graphics mode>";
const char press_a[] = "<press <a> to turn on/off animation>";
const char press_h[] = "<press <h> to view information about the program>";
const char press_s[] = "<press <s> to turn on/off external skin>";
const char level[] = "Level:";
const char attempts_left[] = "Attempts left:";
const char grass_left[] = "Grass left:";
#endif
 
char gamearea[20][20]; //Êàðòà
int levelcount=7;
 
char gamearea[20][20]; //The map
 
short int kosilkax; // Ïîëîæåíèå êîñèëêè
 
short int kosilkax; // Kosilka position
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 - èãðàòü íåëüçÿ
short int kosilkadirection=1; //Last step direction. 1-bottom, 2-up, 3-left, 4-right
short int lives=2;
short int level=1;
short int status=0; //Where 0 - welcome screen
// 1 - the game
// 2 - win
// 3 - fail
// 4 - select the level (internal or external)
// -1 - about
bool gamestarted=false; //Key locker. If "false" then not possible to play
 
bool drawgraphics=true; //Ðèñîâàòü ëè äåòàëüíóþ ãðàôèêó (èëè îãðàíè÷èòüñÿ àñêåòè÷íîé)
bool drawanimation=true; //Àíèìèðîâàòü ëè
int grassLeft(); //Ñîîáùèì î íàëè÷èè ôóíêöèè Grass Left
bool drawgraphics=true; //Draw detailed graphics or just colored rectangles
bool drawanimation=true;
int grassLeft(); //Notify about "Grass Left" function
 
RGB kosilka_d[576];
RGB kosilka_l[576];
63,7 → 95,7
RGB tree[576];
RGB skos[576];
 
//Ïàëèòðà öâåòîâ. Äåêîäèðóåì â 0xRRGGBB
//Palette. Decoding to 0xRRGGBB
char * apppath;
char * levpath;
 
91,7 → 123,7
}
 
 
void interlevelpause(){ //Ïàóçà ìåæäó óðîâíÿìè
void interlevelpause(){ //The pause between levels
Byte tempCode;
RGB tmprgb;
int tmpa=0;
109,7 → 141,7
}
}
 
void draw_element(int elx, int ely){ //Îòðèñîâêà ýëåìåíòà êàðòû
void draw_element(int elx, int ely){ //Draw map element
switch (gamearea[elx][ely]){
case 'g':
if (drawgraphics==true){
184,13 → 216,13
}
 
 
void display_grass_left(){ //Âûâîäèì íà ýêðàí êîëè÷åñòâî îñòàâøåéñÿ òðàâû
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){ //àíèìàöèÿ äâèæåíèÿ êîñèëêè
void animate(int initcellx, int initcelly, int direction){ //kosilka movement animation
int tmpp=0;
switch (direction){
249,35 → 281,35
}
 
 
void draw_window(void){ //Ïåðåðèñîâêà îêíà
void draw_window(void){
sProcessInfo sPI;
if (w_redraw)
{
kos_WindowRedrawStatus(1); //Íà÷àëî ïåðåðèñîâêè
kos_WindowRedrawStatus(1);
kos_DefineAndDrawWindow(50,50,640,506-22+kos_GetSkinHeight(),0x74,0xEEEEEE,0,0,(Dword)windowTitle);
kos_WindowRedrawStatus(2); //Êîíåö ïåðåðèñîâêè
kos_WindowRedrawStatus(2);
}
w_redraw=false;
 
kos_ProcessInfo( &sPI );
if (sPI.rawData[70]&0x04) return; //íè÷åãî íå äåëàòü åñëè îêíî ñõëîïíóòî â çàãîëîâîê
if (sPI.rawData[70]&0x04) return; //do nothing if window is rolled-up into title
 
//Ïåðåðèñîâêà êàðòû
//Map redraw
if ((status!=0)&&(status!=-1)&&(status!=4))
{
kos_DrawBar(631-151,0,151,480,0xEEEEEE);
 
kos_WriteTextToWindow(500,30,0x80, 0 ,"Š Ž ‘ ˆ ‹ Š €",19);
kos_WriteTextToWindow(517,40,0x80, 0 ,"¤«ï Š®«¨¡à¨ Ž‘",14);
kos_WriteTextToWindow(500,30,0x80, 0, (char*)k_o_s_i_l_k,19);
kos_WriteTextToWindow(517,40,0x80, 0, (char*)for_kolibri,14);
 
kos_WriteTextToWindow(495,80,0x80, 0 ,"“஢¥­ì:",6);
kos_WriteTextToWindow(495,80,0x80, 0, (char*)level,6);
kos_DisplayNumberToWindow(level,3,605,80,0x0000FF,nbDecimal,false);
 
kos_WriteTextToWindow(495,95,0x80, 0 ,"Žáâ «®áì ¯®¯ë⮪:",11);
kos_WriteTextToWindow(495,95,0x80, 0, (char*)attempts_left,11);
kos_DisplayNumberToWindow(lives,1,605,95,0x0000FF,nbDecimal,false);
 
kos_WriteTextToWindow(495,120,0x80, 0 ,"Žáâ «®áì âà ¢ë:",11);
kos_WriteTextToWindow(495,120,0x80, 0, (char*)grass_left,11);
display_grass_left();
 
kos_WriteTextToWindow(526,450,0x80, 0 ,(char*)version,12);
288,7 → 320,6
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++){
320,15 → 351,14
kos_DrawBar(335,150,24,24,0xAA0000);
}
 
kos_WriteTextToWindow(255,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(255, 200,0x80, 0xFFFFFF, (char*)k_o_s_i_l_k, 19);
kos_WriteTextToWindow(290, 220,0x80, 0xFFFFFF, (char*)for_kolibri, 14);
kos_WriteTextToWindow(239, 240,0x80, 0xFFFFFF, (char*)press_enter, 30);
kos_WriteTextToWindow(30, 380,0x80, 0xFFFFFF, (char*)press_g, 53);
kos_WriteTextToWindow(30, 400,0x80, 0xFFFFFF, (char*)press_a, 41);
kos_WriteTextToWindow(30, 420,0x80, 0xFFFFFF, (char*)press_h, 32);
if (skin_available==true) kos_WriteTextToWindow(30, 440,0x80, 0xFFFFFF, (char*)press_s, 27);
 
 
// kos_WriteTextToWindow(470, 440,0x80, 0xFFFFFF ,"­ ¦¬¨â¥ <ESC> ¤«ï ¢ë室 ",27);
// kos_DisplayNumberToWindow(external_levels_count[0],3,200,340,0x0000FF,nbDecimal,false);
 
339,15 → 369,15
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);
kos_WriteTextToWindow(240,230,0x80, 0xFFFFFF ,(char*)win,13);
kos_WriteTextToWindow(240,250,0x80, 0xFFFFFF ,(char*)press_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);
kos_WriteTextToWindow(220,220,0x80, 0xFFFFFF ,(char*)fail,13);
kos_WriteTextToWindow(220,240,0x80, 0xFFFFFF ,(char*)press_r,23);
kos_WriteTextToWindow(220,260,0x80, 0xFFFFFF ,(char*)press_q,17);
}
if (status==-1){
 
366,7 → 396,7
}
}
 
kos_WriteTextToWindow(40,40,0x80, 0xFFFFFF ,"Š®á¨«ª  ¤«ï Ž‘ Š®«¨¡à¨",22);
kos_WriteTextToWindow(40,40,0x80, 0xFFFFFF ,(char*)windowTitle,22);
kos_WriteTextToWindow(40,60,0x80, 0xFFFFFF ,(char*)version,12);
kos_WriteTextToWindow(40,75,0x80, 0xFFFFFF ,"________________________________________",40);
382,7 → 412,6
kos_WriteTextToWindow(40,300,0x80, 0x88FF88 ,"Žâ¤¥«ì­®¥ ᯠᨡ®:",16);
kos_WriteTextToWindow(40,330,0x80, 0x77FF77 ,"‚ᥬ, ªâ® ¨£à ¥â ¢ íâã ¨£àã :-) !",50);
 
 
kos_WriteTextToWindow(40,430,0x80, 0x66FF66 ,"­ ¦¬¨â¥ <BACKSPACE> ¤«ï ¢®§¢à â  ¢ ¬¥­î",35);
}
 
413,12 → 442,12
 
 
 
//Îïèñàíèå óðîâíåé èãðû
//, ãäå k - êîñèëêà
// g - òðàâà
// n - ñêîøåííàÿ òðàâà
// s - êàìåíü
// t - äåðåâî
//Game level description,
//where k - kosilka
// g - grass
// n - cut grass
// s - stone
// t - tree
void initializeLevel(int levnum){
laststep=0;
if (external_levels==false){
664,7 → 693,7
}
else
{
//ÂÍÅØÍÈÅ ÓÐÎÂÍÈ
//External levels
kosilkadirection=1;
 
int currentrow=0;
704,7 → 733,6
 
}
 
//Ïðåîâåðÿåì îñòàòîê òðàâû
int grassLeft(){
int leftgrass=0;
for (int chky=0;chky<20;chky++){
717,8 → 745,7
return leftgrass;
}
 
 
//Ìåíÿåì óðîâåíü èëè âûâîäèì ñîîáùåíèå î òîì, ÷òî âñå óðîâíè ïðîéäåíû
//Change level or show win message
void updateStatus(){
 
if (grassLeft()==0) {
738,7 → 765,6
}
 
 
 
void load_external_levels(){
 
CKosFile lev(getLevelsPathName());
1058,5 → 1084,3
}
}
}
 
// Êîíåö èñõîäíèêà