ALT Linux repositórios
Group :: Jogos/Enigmas
RPM: kiki
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: kiki-cyrillic5.patch
Download
Download
diff -Naur kiki_src/kiki/py/intro.py kiki_src.1/kiki/py/intro.py
--- kiki_src/kiki/py/intro.py 2003-04-06 20:59:43 +0300
+++ kiki_src.1/kiki/py/intro.py 2004-03-31 18:18:24 +0300
@@ -264,7 +264,7 @@
m = KikiMenu (2)
- m.addItem ("$no_itemkiki " + Controller.getLocalizedString("demo"))
+ m.addItem ("$no_item" + Controller.getLocalizedString("kiki demo"))
m.addItem ("$no_item")
m.addItem (Controller.getLocalizedString("back"), once (stop_demo))
@@ -310,7 +310,7 @@
about_menu.addItem ("$no_item |monsterkodi@gmx.net")
about_menu.addItem ("$no_item")
- about_menu.addItem ("$no_item music theme by: |N(S)N - NOISE IS SILENCE IS NOISE")
+ about_menu.addItem ("$no_item " + Controller.getLocalizedString("music theme by") + ": |N(S)N - NOISE IS SILENCE IS NOISE")
about_menu.addItem ("$no_item |WWW.N2S1.COM")
about_menu.addItem ("$no_item")
diff -Naur kiki_src/kiki/py/levelselection.py kiki_src.1/kiki/py/levelselection.py
--- kiki_src/kiki/py/levelselection.py 2003-04-06 20:59:43 +0300
+++ kiki_src.1/kiki/py/levelselection.py 2004-03-31 18:18:24 +0300
@@ -54,7 +54,7 @@
menu.getProjection().setViewport (0.0, 0.0, 1.0, 0.4)
for index in range (last_level+1):
- item_text = "%d |%s" % (index+1, level_dict[level_list[index]]["intro"])
+ item_text = "%d |%s" % (index+1, Controller.getLocalizedString (level_dict[level_list[index]]["intro"]))
menu.addItem (item_text, once (lambda l=index: startLevel(l)))
displayLevel (world.level_index)
diff -Naur kiki_src/kiki/py/setup.py kiki_src.1/kiki/py/setup.py
--- kiki_src/kiki/py/setup.py 2003-04-06 20:59:43 +0300
+++ kiki_src.1/kiki/py/setup.py 2004-03-31 18:18:24 +0300
@@ -126,7 +126,7 @@
menu.addItem (Controller.getLocalizedString ("volume") + ": |%d" % (int (sound.getSoundVolume()/(128/9)), ), setupOption ("volume"))
menu.addItem (Controller.getLocalizedString ("fullscreen") + ": |" + (Controller.getFullscreen() and Controller.getLocalizedString ("on") or Controller.getLocalizedString ("off")), setupOption ("fullscreen"))
menu.addItem (Controller.getLocalizedString ("fov") + ": |%d" % (int (Controller.world.getProjection().getFov()), ), setupOption ("fov"))
- menu.addItem ("gamma: |%d" % (int (Controller.getGamma()), ), setupOption ("gamma"))
+ menu.addItem (Controller.getLocalizedString("gamma") + ": |%d" % (int (Controller.getGamma()), ), setupOption ("gamma"))
menu.addItem (Controller.getLocalizedString ("speed") + ": |%d" % (Controller.getSpeed(), ), setupOption ("speed"))
if escapeAction:
diff -Naur kiki_src/kiki/py/world.py kiki_src.1/kiki/py/world.py
--- kiki_src/kiki/py/world.py 2003-04-06 20:59:43 +0300
+++ kiki_src.1/kiki/py/world.py 2004-03-31 18:18:24 +0300
@@ -161,7 +161,7 @@
if "intro" in self.dict:
if not self.preview:
intro_text = KikiScreenText ()
- intro_text.addText (self.dict["intro"])
+ intro_text.addText (Controller.getLocalizedString(self.dict["intro"]))
intro_text.show ()
world.setName (self.dict["intro"])
else:
diff -Naur kiki_src/kiki/src/gui/KikiCharacter.cpp kiki_src.me/kiki/src/gui/KikiCharacter.cpp
--- kiki_src/kiki/src/gui/KikiCharacter.cpp 2003-03-29 18:32:49 +0200
+++ kiki_src.me/kiki/src/gui/KikiCharacter.cpp 2004-05-24 09:39:18 +0300
@@ -156,7 +156,49 @@
{{ {2,0}, {3,-1}, {2,-2}, {3,-2}, {4,-1}, {3,-0}, {-1}}, // tail for
{{-1}}, {{-1}}},
{{ {1,9}, {5,9}, {5,12}, {1,12}, {-1}}, // circle for
- {{2,10}, {2,11}, {4, 11}, {4,10}, {-1}}, {{-1}}},
+ {{2,10}, {2,11}, {4, 11}, {4,10}, {-1}}, {{-1}}},
+ {{ {0,0}, {4,0}, {6,1}, {6,4}, {5,5}, {2,5}, {2,6}, {6,6}, {6,8}, {0,8}, // cyrillic b
+ {-1}}, {{2,2}, {2,3}, {4,3}, {4,2}, {-1}}, {{-1}}},
+ {{ {0,0}, {2,0}, {2,6}, {6,6}, {6,8}, {0,8}, {-1}}, {{-1}}, {{-1}}}, // cyrillic g
+ {{ {0,0}, {2,2.5}, {2,0}, {3.5,0}, {3.5,2}, {6,0}, {6,2}, {4,4}, {6,6}, // cyrillic zh
+ {6,8}, {3.5,6}, {3.5,8}, {2.5,8}, {2.5,6}, {0,8}, {0,6}, {2,4}, {0,2},
+ {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {5,0}, {6,1}, {6,3}, {5,4}, {6,5}, {6,7}, {5,8}, {0,8}, {0,6}, // cyrillic z
+ {4,6}, {4,5}, {2,5}, {2,3}, {4,3}, {4,2}, {0,2}, {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {2,0}, {4,3}, {4,0}, {6,0}, {6,8}, {4,8}, {4,6}, {2,3}, {2,8}, // cyrillic i
+ {0,8}, {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {2,0}, {4,4}, {4,0}, {6,0}, {6,8}, {4,8}, {-1}}, // cyrillic l
+ {{-1}},{{-1}}},
+ {{ {0,0}, {2,0}, {2,6}, {4,6}, {4,0}, {6,0}, {6,8}, {0,8}, // cyrillic p
+ {-1}}, {{-1}},{{-1}}},
+ {{ {0,1}, {1,0}, {5,0}, {6,1}, {6,8}, {4,8}, {4,4}, {2,5}, {2,8}, {0,8}, // cyrillic u
+ {0,4}, {4,2}, {1,2}, {0,3}, {-1}}, {{-1}}, {{-1}}},
+ {{ {2,0}, {4,0}, {4,2}, {5,2}, {6,3}, {6,6}, {5,7}, {4,7}, {4,8}, {2,8}, // cyrillic f
+ {2,7}, {1,7}, {0,6}, {0,3}, {1,2}, {2,2}, {-1}},
+ {{2,3}, {2,6}, {1,5}, {1,4}, {-1}},
+ {{4,3}, {5,4}, {5,5}, {4,6}, {-1}}},
+ {{ {0,1}, {3,1}, {3,0}, {6,0}, {6,2}, {5,2}, {5,8}, {3.5,8}, {3.5,3}, // cyrillic c
+ {1.5,3}, {1.5,8}, {0,8}, {-1}}, {{-1}}, {{-1}}},
+ {{ {4,0}, {6,0}, {6,8}, {4,8}, {4,5}, {2,5}, {2,8}, {0,8}, {0,4}, {1,3}, // cyrillic ch
+ {4,3}, {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {6,0}, {6,8}, {5,8}, {5,2}, {3.5,2}, {3.5,8}, {2.5,8}, // cyrillic sh
+ {2.5,2}, {1,2}, {1,8}, {0,8}, {-1}}, {{-1}},{{-1}}},
+ {{ {0,1}, {4,1}, {4,0}, {6,2}, {5,2}, {5,8}, {4,8}, {4,2}, {3,2}, {3,8}, // cyrillic sch
+ {2,8}, {2,2}, {1,2}, {1,8}, {0,8}, {-1}}, {{-1}},{{-1}}},
+ {{ {1,0}, {4,0}, {6,1}, {6,4}, {5,5}, {3,5}, {3,8}, {0,8}, // cyrillic hard sign
+ {0,6}, {1,6}, {-1}}, {{2,2}, {2,3}, {4,3}, {4,2}, {-1}}, {{-1}}},
+ {{ {0,0}, {3,0}, {4,1}, {4,0}, {6,0}, {6,8}, {4,8}, {4,4}, // cyrillic hard i
+ {3,5}, {2,5}, {2,8}, {0,8}, {-1}},
+ {{2,1.5}, {3,2}, {3,3}, {2,3.5}, {-1}}, {{-1}}},
+ {{ {0,0}, {4,0}, {6,1}, {6,4}, {5,5}, {2,5}, {2,8}, {0,8}, // cyrillic soft sign
+ {-1}}, {{2,2}, {2,3}, {4,3}, {4,2}, {-1}}, {{-1}}},
+ {{ {0,0}, {5,0}, {6,1}, {6,7}, {5,8}, {0,8}, {0,6}, {3,6}, {4,5}, // cyrillic hard e
+ {1,5}, {1,3}, {4,3}, {3,2}, {0,2}, {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {1,0}, {1,3}, {2,3}, {2,1}, {3,0}, {5,0}, {6,1}, {6,7}, {5,8}, // cyrillic yu
+ {3,8}, {2,7}, {2,5}, {1,5}, {1,8}, {0,8}, {-1}},
+ {{4,1}, {5,2}, {5,6}, {4,7}, {3,6}, {3,2}, {-1}}, {{-1}}}, // cyrillic ya
+ {{ {0,0}, {2,0}, {4,2}, {4,0}, {6,0}, {6,8}, {1,8}, {0,7}, {0,5}, {1,4},
+ {3,4}, {0,1}, {-1}}, {{2,5.5}, {4,5.5}, {4,6.5}, {2,6.5}, {-1}}, {{-1}}},
};
// __________________________________________________________________________________________________
@@ -185,8 +227,45 @@
case -117: character = 32; addon = 5; break; //
case -118: character = 32; addon = 1; break; //
case -120: character = 32; addon = 3; break; //
+
+ case -63: character = 32; break; //
+ case -62: character = 65; break; //
+ case -41: character = 33; break; //
+ case -57: character = 66; break; //
+ case -60: character = 35; break; //
+ case -59: character = 36; break; //
+ case -93: character = 36; addon = 1; break; //
+ case -42: character = 67; break; //
+ case -38: character = 68; break; //
+ case -55: character = 69; break; //
+ case -54: character = 69; addon = 2; break; //
+ case -53: character = 42; break; //
+ case -52: character = 70; break; //
+ case -51: character = 44; break; //
+ case -50: character = 39; break; //
+ case -49: character = 46; break; //
+ case -48: character = 71; break; //
+ case -46: character = 47; break; //
+ case -45: character = 34; break; //
+ case -44: character = 51; break; //
+ case -43: character = 72; break; //
+ case -58: character = 73; break; //
+ case -56: character = 55; break; //
+ case -61: character = 74; break; //
+ case -34: character = 75; break; //
+ case -37: character = 76; break; //
+ case -35: character = 77; break; //
+ case -33: character = 78; break; //
+ case -39: character = 79; break; //
+ case -40: character = 80; break; //
+ case -36: character = 81; break; //
+ case -64: character = 82; break; //
+ case -47: character = 83; break; //
+ case -90: character = 40; break; //ibelorussian
+ case -83: character = 72; addon = 2; break; //u short
+// case -59: character = 40; addon = 1; break; //i ukrainian
default:
- KConsole::printf ("KikiCharacter::KikiCharacter unknown character %c (%d)", c, c);
+ KConsole::printf ("KikiCharacter::KikiCharacter unknown character %c (%d,%X)", c, c, (char)c);
break;
}
}
diff -Naur kiki_src/kiki/src/gui/KikiText.cpp kiki_src.me/kiki/src/gui/KikiText.cpp
--- kiki_src/kiki/src/gui/KikiText.cpp 2003-03-24 20:14:01 +0200
+++ kiki_src.me/kiki/src/gui/KikiText.cpp 2004-05-24 09:39:18 +0300
@@ -13,7 +13,7 @@
#include <KStringTools.h>
// __________________________________________________________________________________________________
-unsigned int KikiText::display_lists[3][58];
+unsigned int KikiText::display_lists[3][CHAR_COUNT];
std::vector<KColor> KikiText::colors(3);
const char * KikiText::color_names[] = { "base", "bright", "dark" };
int KikiText::list_color = -1;
@@ -83,7 +83,7 @@
// __________________________________________________________________________________________________
void KikiText::invalidateLists ( int index )
{
- for (int c = 0; c < 58; c++)
+ for (int c = 0; c < CHAR_COUNT; c++)
{
if (display_lists[index][c])
{
@@ -104,7 +104,7 @@
{
for (int i = 0; i < 3; i++)
{
- for (int c = 0; c < 58; c++)
+ for (int c = 0; c < CHAR_COUNT; c++)
{
display_lists[i][c] = 0;
}
diff -Naur kiki_src/kiki/src/gui/KikiText.h kiki_src.me/kiki/src/gui/KikiText.h
--- kiki_src/kiki/src/gui/KikiText.h 2003-02-15 20:05:10 +0200
+++ kiki_src.me/kiki/src/gui/KikiText.h 2004-05-24 09:39:18 +0300
@@ -6,6 +6,8 @@
#ifndef __KikiText
#define __KikiText
+#define CHAR_COUNT 85
+
#include <KColor.h>
#include <string>
@@ -64,7 +66,7 @@
KColor color;
// ........................................................................ display lists
- static unsigned int display_lists[3][58];
+ static unsigned int display_lists[3][CHAR_COUNT];
static int list_color;
// ........................................................................ depth
static float bevel_depth;
diff -Naur kiki_src/kiki/src/main/KikiController.cpp kiki_src.me/kiki/src/main/KikiController.cpp
--- kiki_src/kiki/src/main/KikiController.cpp 2004-05-24 09:50:50 +0300
+++ kiki_src.me/kiki/src/main/KikiController.cpp 2004-05-24 09:49:29 +0300
@@ -27,8 +27,16 @@
#include "KKey.h"
#include "KConsole.h"
+
#include <sys/param.h>
#include <unistd.h>
+#include <iconv.h>
+#include <locale.h>
+#include <libintl.h>
+#include <langinfo.h>
+
+#define PACKAGE "kiki"
+#define LOCALEDIR "/usr/share/locale"
static int ESCAPE_KEY_EVENT;
@@ -38,6 +46,8 @@
// __________________________________________________________________________________________________
KikiController::KikiController () : KEventHandler (), KKeyHandler (), KikiActionObject ()
{
+ int rumessages = 0;
+ int bymessages = 0;
addEventWithName ("timer");
timer_event = events.back(); // deserves it's own pointer, since it's used that often :-)
ESCAPE_KEY_EVENT = addEventWithName ("escape");
@@ -68,6 +78,24 @@
kiki_home += "/";
quit_key = "CTRL_q";
gamma = 8;
+
+ ru_iconv = (iconv_t)(-1);
+ // used briquolo as example of setlocale
+ locale = setlocale(LC_MESSAGES, "");
+ rumessages |= locale.compare(0, 2, "ru") == 0;
+ bymessages |= locale.compare(0, 2, "be") == 0;
+ locale = setlocale(LC_CTYPE, "");
+
+ // we support only koi8 as charset so recoding needed if locale is
+ // ru_RU.CP1251/UTF-8 or be_BY.CP1251 and so on
+ if (rumessages) {
+ ru_iconv = iconv_open("KOI8-R", nl_langinfo(CODESET));
+ } else if (bymessages) {
+ ru_iconv = iconv_open("KOI8-U", nl_langinfo(CODESET));
+ }
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
#endif
}
@@ -79,6 +107,8 @@
delete sound;
python->finalize();
delete python;
+ // close iconv if it has been used
+ if (ru_iconv != (iconv_t)(-1)) iconv_close(ru_iconv);
}
// __________________________________________________________________________________________________
@@ -105,11 +135,31 @@
// __________________________________________________________________________________________________
std::string KikiController::getLocalizedString ( const std::string & key )
{
+ char *inbuf, *obuf, *obuf_addr, *inbuf_addr;
+ const char *loc_key;
+ size_t inbufcnt, obufcnt;
+ std::string result;
#if defined(__APPLE__) && defined(__MACH__)
return std::string (kikiLocalizedString (key.c_str()));
#else
// no localization on linux yet
- return key;
+ if (ru_iconv != (iconv_t)(-1)) {
+ // geting text by key in current user locale
+ loc_key = gettext(key.c_str());
+ obufcnt = inbufcnt = strlen(loc_key) + 1;
+ inbuf_addr = inbuf = strdup(loc_key);
+ // koi8 text legth is the same as cp1251 and smaller then utf8
+ // so this will be enough
+ obuf_addr = obuf = strdup(loc_key);
+ // get text in koi8
+ iconv(ru_iconv, &inbuf_addr, &inbufcnt, &obuf_addr, &obufcnt);
+ result = std::string (obuf);
+ // freeing used memory
+ free(inbuf);
+ free(obuf);
+ return result;
+ }else
+ return std::string (gettext(key.c_str()));
#endif
}
@@ -147,7 +197,7 @@
{
cheat = false;
speed = 5;
-
+
KEventHandler::notification_center.addReceiverCallback(this, (KCallbackPtr)&KikiController::initOpenGL,
KDL_NOTIFICATION_TYPE_VIDEO_MODE_CHANGED);
diff -Naur kiki_src/kiki/src/main/KikiController.h kiki_src.me/kiki/src/main/KikiController.h
--- kiki_src/kiki/src/main/KikiController.h 2003-03-25 17:57:37 +0200
+++ kiki_src.me/kiki/src/main/KikiController.h 2004-05-24 09:43:30 +0300
@@ -24,6 +24,7 @@
#include <KMatrix.h>
#include <KEventHandler.h>
#include <KKeyHandler.h>
+#include <iconv.h>
class KikiGUI;
class KikiScreenText;
@@ -44,6 +45,8 @@
int speed;
int gamma;
std::string kiki_home;
+ std::string locale;
+ iconv_t ru_iconv;
public: // ........................................................................ PUBLIC