forked from KolibriOS/kolibrios
Kosilka 1.16: add English translation, translate code comments into English
git-svn-id: svn://kolibrios.org@7332 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
29e0e255d4
commit
bb139230cd
@ -1,3 +1,7 @@
|
||||
10.09.18 -- v1.16 -- Leency
|
||||
- добавлен перевод программы на английский язык
|
||||
- все комментарии переведены на английский
|
||||
|
||||
22.12.12 -- v1.15 -- Leency
|
||||
- в программу встроен более симпатичный скин от меня, что позволило
|
||||
освободить 12 Кб в образе.
|
||||
|
@ -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")
|
||||
|
@ -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 @@ Byte external_levels_count[1] = {0};
|
||||
/////////////////
|
||||
|
||||
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 @@ int read_result=0;
|
||||
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 stone[576];
|
||||
RGB tree[576];
|
||||
RGB skos[576];
|
||||
|
||||
//Палитра цветов. Декодируем в 0xRRGGBB
|
||||
//Palette. Decoding to 0xRRGGBB
|
||||
char * apppath;
|
||||
char * levpath;
|
||||
|
||||
@ -91,7 +123,7 @@ char * getLevelsPathName(){
|
||||
}
|
||||
|
||||
|
||||
void interlevelpause(){ //Пауза между уровнями
|
||||
void interlevelpause(){ //The pause between levels
|
||||
Byte tempCode;
|
||||
RGB tmprgb;
|
||||
int tmpa=0;
|
||||
@ -109,7 +141,7 @@ void interlevelpause(){ //
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ switch (gamearea[elx][ely]){
|
||||
}
|
||||
|
||||
|
||||
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 animate(int initcellx, int initcelly, int direction){ //
|
||||
}
|
||||
|
||||
|
||||
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 @@ void draw_window(void){ //
|
||||
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,14 +351,13 @@ void draw_window(void){ //
|
||||
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 @@ void draw_window(void){ //
|
||||
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 @@ void draw_window(void){ //
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ void draw_window(void){ //
|
||||
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 @@ void draw_window(void){ //
|
||||
|
||||
|
||||
|
||||
//Описание уровней игры
|
||||
//, где 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 @@ void initializeLevel(int levnum){
|
||||
}
|
||||
else
|
||||
{
|
||||
//ВНЕШНИЕ УРОВНИ
|
||||
//External levels
|
||||
kosilkadirection=1;
|
||||
|
||||
int currentrow=0;
|
||||
@ -704,7 +733,6 @@ void initializeLevel(int levnum){
|
||||
|
||||
}
|
||||
|
||||
//Преоверяем остаток травы
|
||||
int grassLeft(){
|
||||
int leftgrass=0;
|
||||
for (int chky=0;chky<20;chky++){
|
||||
@ -717,8 +745,7 @@ int grassLeft(){
|
||||
return leftgrass;
|
||||
}
|
||||
|
||||
|
||||
//Меняем уровень или выводим сообщение о том, что все уровни пройдены
|
||||
//Change level or show win message
|
||||
void updateStatus(){
|
||||
|
||||
if (grassLeft()==0) {
|
||||
@ -738,7 +765,6 @@ void updateStatus(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void load_external_levels(){
|
||||
|
||||
CKosFile lev(getLevelsPathName());
|
||||
@ -1058,5 +1084,3 @@ void kos_Main(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Конец исходника
|
Loading…
Reference in New Issue
Block a user