support for polish version of freespace 2
rraptorr
rraptorr at nails.eu.org
Mon Mar 3 02:27:57 EST 2003
Hi,
I'va managed to get my polish version of freespace 2 working with the
attached patch. There was a problem with two polish letters (they were
correct in the .tbl files, but the game seemed to read wrong characters).
There is one nasty hack with function lcl_fix_polish, but it works. And
last thing, polish players need to add Language=Polish to the
FreeSpace2.ini file, otherwise the game crashes complaining about
corrupted strings.tbl. I've managed to finish the game and it works
great. I hope this patch will be merged with cvs repository :)
Janusz Dziemidowicz
rraptorr at nails.eu.org
-------------- next part --------------
diff -ruN freespace2/include/localize.h freespace2-pl/include/localize.h
--- freespace2/include/localize.h 2002-06-09 06:41:13.000000000 +0200
+++ freespace2-pl/include/localize.h 2003-02-14 08:53:53.000000000 +0100
@@ -60,10 +60,11 @@
//
// language defines
-#define LCL_NUM_LANGUAGES 3 // keep this up to date
+#define LCL_NUM_LANGUAGES 4 // keep this up to date
#define LCL_ENGLISH 0
#define LCL_GERMAN 1
#define LCL_FRENCH 2
+#define LCL_POLISH 3
#define LCL_DEFAULT_LANGUAGE LCL_ENGLISH
@@ -78,6 +79,7 @@
extern int Lcl_fr;
extern int Lcl_gr;
extern int Lcl_english;
+extern int Lcl_pl;
// ------------------------------------------------------------------------------------------------------------
@@ -142,6 +144,9 @@
#define LCL_TO_ASCII 1
char* lcl_fix_umlauts(char *str, int which_way);
+// convert some of the polish characters
+void lcl_fix_polish(char *str);
+
// macro for launcher xstrs
#if defined(GERMAN_BUILD)
#define LXSTR(str, i) (lcl_fix_umlauts(XSTR(str, i), LCL_TO_ANSI))
@@ -152,7 +157,9 @@
void lcl_translate_wep_name(char *name);
void lcl_translate_ship_name(char *name);
void lcl_translate_brief_icon_name(char *name);
+void lcl_translate_brief_icon_name_pl(char *name);
void lcl_translate_targetbox_name(char *name);
+void lcl_translate_targetbox_name_pl(char *name);
#endif // defined __FREESPACE2_LOCALIZATION_UTILITIES_HEADER_FILE
diff -ruN freespace2/include/medals.h freespace2-pl/include/medals.h
--- freespace2/include/medals.h 2002-06-09 06:41:13.000000000 +0200
+++ freespace2-pl/include/medals.h 2003-02-14 16:15:58.000000000 +0100
@@ -114,6 +114,7 @@
void blit_text();
void medals_translate_name(char *name, int max_len);
+void medals_translate_name_pl(char *name, int max_len);
#endif
diff -ruN freespace2/src/controlconfig/controlsconfigcommon.cpp freespace2-pl/src/controlconfig/controlsconfigcommon.cpp
--- freespace2/src/controlconfig/controlsconfigcommon.cpp 2002-06-09 06:41:15.000000000 +0200
+++ freespace2-pl/src/controlconfig/controlsconfigcommon.cpp 2003-02-14 16:50:52.000000000 +0100
@@ -695,6 +695,57 @@
"Button 31", "Button 32", "Hat Back", "Hat Forward", "Hat Left", "Hat Right"
};
+char *Scan_code_text_polish[] = {
+ "", "Esc", "1", "2", "3", "4", "5", "6",
+ "7", "8", "9", "0", "-", "=", "Backspace", "Tab",
+ "Q", "W", "E", "R", "T", "Y", "U", "I",
+ "O", "P", "[", "]", "Enter", "Lewy Ctrl", "A", "S",
+
+ "D", "F", "G", "H", "J", "K", "L", ";",
+ "'", "`", "LShift", "\\", "Z", "X", "C", "V",
+ "B", "N", "M", ",", ".", "/", "PShift", "Num *",
+ "Alt", "Spacja", "CapsLock", "F1", "F2", "F3", "F4", "F5",
+
+ "F6", "F7", "F8", "F9", "F10", "Pause", "Scrlock", "Num 7",
+ "Num 8", "Num 9", "Num -", "Num 4", "Num 5", "Num 6", "Num +", "Num 1",
+ "Num 2", "Num 3", "Num 0", "Num .", "", "", "", "F11",
+ "F12", "", "", "", "", "", "", "",
+
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "Num Enter", "Prawy Ctrl", "", "",
+
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "Num /", "", "PrntScr",
+ "Alt", "", "", "", "", "", "", "",
+
+ "", "", "", "", "", "Num Lock", "", "Home",
+ "Kursor G\xF3ra", "Page Up", "", "Kursor Lewo", "", "Kursor Prawo", "", "End",
+ "Kursor D\xF3\xB3", "Page Down", "Insert", "Delete", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+};
+
+char *Joy_button_text_polish[] = {
+ "Przyc.1", "Przyc.2", "Przyc.3", "Przyc.4", "Przyc.5", "Przyc.6",
+ "Przyc.7", "Przyc.8", "Przyc.9", "Przyc.10", "Przyc.11", "Przyc.12",
+ "Przyc.13", "Przyc.14", "Przyc.15", "Przyc.16", "Przyc.17", "Przyc.18",
+ "Przyc.19", "Przyc.20", "Przyc.21", "Przyc.22", "Przyc.23", "Przyc.24",
+ "Przyc.25", "Przyc.26", "Przyc.27", "Przyc.28", "Przyc.29", "Przyc.30",
+ "Przyc.31", "Przyc.32", "Hat Ty\xB3", "Hat Prz?d", "Hat Lewo", "Hat Prawo"
+};
+
char **Scan_code_text = Scan_code_text_english;
char **Joy_button_text = Joy_button_text_english;
@@ -865,6 +916,9 @@
} else if(Lcl_fr){
Scan_code_text = Scan_code_text_french;
Joy_button_text = Joy_button_text_french;
+ } else if(Lcl_pl){
+ Scan_code_text = Scan_code_text_polish;
+ Joy_button_text = Joy_button_text_polish;
} else {
Scan_code_text = Scan_code_text_english;
Joy_button_text = Joy_button_text_english;
diff -ruN freespace2/src/hud/hud.cpp freespace2-pl/src/hud/hud.cpp
--- freespace2/src/hud/hud.cpp 2002-06-17 08:33:09.000000000 +0200
+++ freespace2-pl/src/hud/hud.cpp 2003-02-18 17:32:11.000000000 +0100
@@ -1407,7 +1407,12 @@
}
gr_set_color_fast(&Color_bright_red);
- gr_printf(Supernova_coords[gr_screen.res][0], Supernova_coords[gr_screen.res][1], "Supernova Warning : %.2f s", time_left);
+ if(Lcl_pl) {
+ gr_printf(Supernova_coords[gr_screen.res][0], Supernova_coords[gr_screen.res][1], "Wybuch supernowej : %.2f s", time_left);
+ }
+ else {
+ gr_printf(Supernova_coords[gr_screen.res][0], Supernova_coords[gr_screen.res][1], "Supernova Warning : %.2f s", time_left);
+ }
}
// render multiplayer ping time to the server if appropriate
diff -ruN freespace2/src/hud/hudtargetbox.cpp freespace2-pl/src/hud/hudtargetbox.cpp
--- freespace2/src/hud/hudtargetbox.cpp 2002-06-18 10:58:53.000000000 +0200
+++ freespace2-pl/src/hud/hudtargetbox.cpp 2003-02-14 16:43:29.000000000 +0100
@@ -429,7 +429,35 @@
} else if ( strstr(outstr, "laser") || strstr(outstr, "turret") || strstr(outstr, "missile") ) {
strcpy(outstr, "tourelle");
}
- } else {
+ } else if(Lcl_pl){
+ if ( strstr(outstr, "communication") ) {
+ strcpy(outstr, "komunikacja");
+ } else if ( !stricmp(outstr, "weapons") ) {
+ strcpy(outstr, "uzbrojenie");
+ } else if ( strstr(outstr, "engine") || strstr(outstr, "Engine")) {
+ strcpy(outstr, "silnik");
+ } else if ( !stricmp(outstr, "sensors") ) {
+ strcpy(outstr, "sensory");
+ } else if ( strstr(outstr, "navigat") ) {
+ strcpy(outstr, "nawigacja");
+ } else if ( strstr(outstr, "fighterbay") || strstr(outstr, "Fighterbay") ) {
+ strcpy(outstr, "dok my\x9Cliw.");
+ } else if ( strstr(outstr, "missile") ) {
+ strcpy(outstr, "wie\xBF. rakiet.");
+ } else if ( strstr(outstr, "laser") || strstr(outstr, "turret") ) {
+ strcpy(outstr, "wie\xBFyczka");
+ } else if ( strstr(outstr, "Command Tower") || strstr(outstr, "Bridge") ) {
+ strcpy(outstr, "mostek");
+ } else if ( strstr(outstr, "Barracks") ) {
+ strcpy(outstr, "koszary");
+ } else if ( strstr(outstr, "Reactor") ) {
+ strcpy(outstr, "reaktor");
+ } else if ( strstr(outstr, "RadarDish") ) {
+ strcpy(outstr, "antena radaru");
+ } else if (!stricmp(outstr, "Gas Collector")) {
+ strcpy(outstr, "zbieracz gazu");
+ }
+ } else {
if (!strnicmp(outstr, XSTR( "communication", 333), 3)) {
strcpy( outstr, XSTR( "comm", 334) );
} else if (!strnicmp(outstr, XSTR( "navigation", 335), 3)) {
@@ -938,6 +966,9 @@
if (Lcl_gr) {
lcl_translate_targetbox_name(outstr);
}
+ else if(Lcl_pl) {
+ lcl_translate_targetbox_name_pl(outstr);
+ }
emp_hud_string(Targetbox_coords[gr_screen.res][TBOX_NAME][0], Targetbox_coords[gr_screen.res][TBOX_NAME][1], EG_TBOX_NAME, outstr);
// print out ship class
@@ -957,6 +988,9 @@
if (Lcl_gr) {
lcl_translate_targetbox_name(temp_name);
}
+ else if(Lcl_pl) {
+ lcl_translate_targetbox_name_pl(temp_name);
+ }
emp_hud_printf(Targetbox_coords[gr_screen.res][TBOX_CLASS][0], Targetbox_coords[gr_screen.res][TBOX_CLASS][1], EG_TBOX_CLASS, temp_name);
ship_integrity = 1.0f;
diff -ruN freespace2/src/localization/localize.cpp freespace2-pl/src/localization/localize.cpp
--- freespace2/src/localization/localize.cpp 2002-06-09 06:41:22.000000000 +0200
+++ freespace2-pl/src/localization/localize.cpp 2003-02-14 16:41:11.000000000 +0100
@@ -311,6 +311,7 @@
{ "English", "" }, // english
{ "German", "gr" }, // german
{ "French", "fr" }, // french
+ { "Polish", "pl" }, // polish
};
//#if defined(GERMAN_BUILD)
@@ -320,6 +321,7 @@
//#endif
// following is the offset where special characters start in our font
+#define LCL_SPECIAL_CHARS_PL 127
#define LCL_SPECIAL_CHARS_FR 164
#define LCL_SPECIAL_CHARS_GR 164
#define LCL_SPECIAL_CHARS 127
@@ -329,6 +331,7 @@
// only 1 will be active at a time
int Lcl_fr = 0;
int Lcl_gr = 0 ;
+int Lcl_pl = 0;
int Lcl_english = 1;
@@ -529,6 +532,11 @@
stuff_int(&index);
stuff_string(buf, F_NAME, NULL, 4096);
+
+ if(Lcl_pl) {
+ lcl_fix_polish(buf);
+ }
+
i = strlen(buf);
while (i--) {
if (!isspace(buf[i])) {
@@ -638,6 +646,7 @@
// flag the proper language as being active
Lcl_fr = 0;
Lcl_gr = 0;
+ Lcl_pl = 0;
Lcl_english = 0;
switch(lang){
case LCL_ENGLISH:
@@ -652,6 +661,10 @@
Lcl_gr = 1;
Lcl_special_chars = LCL_SPECIAL_CHARS_GR;
break;
+ case LCL_POLISH:
+ Lcl_pl = 1;
+ Lcl_special_chars = LCL_SPECIAL_CHARS_PL;
+ break;
}
// set to 0, so lcl_ext_open() knows to reset file pointers
@@ -952,6 +965,10 @@
// now that we know the boundaries of the actual string in the XSTR() tag. copy it
memcpy(out, xstr + str_start, str_end - str_start);
+ if(Lcl_pl) {
+ lcl_fix_polish(out);
+ }
+
// success
return 1;
}
@@ -1395,6 +1412,15 @@
return str;
}
+// convert some of the polish characters
+void lcl_fix_polish(char *str)
+{
+ for(;*str;str++) {
+ if(*str == '\xA2') *str = '\xF3';
+ else if(*str == '\x88') *str = '\xEA';
+ }
+}
+
// ------------------------------------------------------------------
// lcl_translate_wep_name()
//
@@ -1561,6 +1587,94 @@
}
}
+// ------------------------------------------------------------------
+// lcl_translate_brief_icon_name_pl()
+//
+// For displaying ship names in polish version
+// since we cant actually just change them outright.
+//
+void lcl_translate_brief_icon_name_pl(char *name)
+{
+ char *pos;
+ char buf[128];
+
+ if (!stricmp(name, "Subspace Portal")) {
+ strcpy(name, "Portal podprz.");
+
+ } else if (!stricmp(name, "Alpha Wing")) {
+ strcpy(name, "Alfa");
+
+ } else if (!stricmp(name, "Beta Wing")) {
+ strcpy(name, "Beta");
+
+ } else if (!stricmp(name, "Zeta Wing")) {
+ strcpy(name, "Zeta");
+
+ } else if (!stricmp(name, "Capella Node")) {
+ strcpy(name, "Capella");
+
+ } else if (!stricmp(name, "Hostile")) {
+ strcpy(name, "Wr\xF3g");
+
+ } else if (!stricmp(name, "Hostile Craft")) {
+ strcpy(name, "Wr\xF3g");
+
+ } else if (!stricmp(name, "Rebel Wing")) {
+ strcpy(name, "Rebelianci");
+
+ } else if (!stricmp(name, "Rebel Fleet")) {
+ strcpy(name, "Flota Rebelii");
+
+ } else if (!stricmp(name, "Sentry Gun")) {
+ strcpy(name, "Dzia\xB3o str.");
+
+ } else if (!stricmp(name, "Cargo")) {
+ strcpy(name, "\xA3"); // gcc complains about xA3a being to large
+ strcat(name, "adunek");
+
+ } else if (!stricmp(name, "Knossos Device")) {
+ strcpy(name, "Urz. Knossos");
+
+ } else if (!stricmp(name, "Support")) {
+ strcpy(name, "Wsparcie");
+
+ } else if (!stricmp(name, "Unknown")) {
+ strcpy(name, "Nieznany");
+
+ } else if (!stricmp(name, "Instructor")) {
+ strcpy(name, "Instruktor");
+
+ } else if (!stricmp(name, "Jump Node")) {
+ strcpy(name, "W\xEAze\xB3 skokowy");
+
+ } else if (!stricmp(name, "Escort")) {
+ strcpy(name, "Eskorta");
+
+ } else if (!stricmp(name, "Asteroid Field")) {
+ strcpy(name, "Pole asteroid");
+
+ } else if (!stricmp(name, "Enif Station")) {
+ strcpy(name, "Stacja Enif");
+
+ } else if (!stricmp(name, "Rally Point")) {
+ strcpy(name, "Pkt zborny");
+
+ } else if ((pos = strstr(name, "Transport")) != NULL) {
+ pos += 9; // strlen of "transport"
+ strcpy(buf, "Transporter");
+ strcat(buf, pos);
+ strcpy(name, buf);
+
+ } else if ((pos = strstr(name, "Jump Node")) != NULL) {
+ pos += 9; // strlen of "jump node"
+ strcpy(buf, "W\xEAze\xB3 skokowy");
+ strcat(buf, pos);
+ strcpy(name, buf);
+
+ } else if (!stricmp(name, "Orion under repair")) {
+ strcpy(name, "Naprawiany Orion");
+ }
+}
// ------------------------------------------------------------------
// lcl_translate_ship_name()
@@ -1627,3 +1741,54 @@
}
}
+// ------------------------------------------------------------------
+// lcl_translate_targetbox_name_pl()
+//
+// For displaying ship names in polish version in the targetbox
+// since we cant actually just change them outright.
+//
+void lcl_translate_targetbox_name_pl(char *name)
+{
+ char *pos;
+ char buf[128];
+
+ if ((pos = strstr(name, "Sentry")) != NULL) {
+ pos += 6; // strlen of "sentry"
+ strcpy(buf, "Stra\xBFnik");
+ strcat(buf, pos);
+ strcpy(name, buf);
+
+ } else if ((pos = strstr(name, "Support")) != NULL) {
+ pos += 7; // strlen of "support"
+ strcpy(buf, "Wsparcie");
+ strcat(buf, pos);
+ strcpy(name, buf);
+
+ } else if ((pos = strstr(name, "Unknown")) != NULL) {
+ pos += 7; // strlen of "unknown"
+ strcpy(buf, "Nieznany");
+ strcat(buf, pos);
+ strcpy(name, buf);
+
+ } else if ((pos = strstr(name, "Drone")) != NULL) {
+ pos += 5; // strlen of "drone"
+ strcpy(buf, "Sonda");
+ strcat(buf, pos);
+ strcpy(name, buf);
+
+ } else if ((pos = strstr(name, "Jump Node")) != NULL) {
+ pos += 9; // strlen of "jump node"
+ strcpy(buf, "W\xEAze\xB3 skokowy");
+ strcat(buf, pos);
+ strcpy(name, buf);
+
+ } else if (!stricmp(name, "Instructor")) {
+ strcpy(name, "Instruktor");
+
+ } else if (!stricmp(name, "NTF Vessel")) {
+ strcpy(name, "Okr\xEAt NTF");
+
+ } else if (!stricmp(name, "Enif Station")) {
+ strcpy(name, "Stacja Enif");
+ }
+}
diff -ruN freespace2/src/mission/missionbriefcommon.cpp freespace2-pl/src/mission/missionbriefcommon.cpp
--- freespace2/src/mission/missionbriefcommon.cpp 2002-06-17 08:33:09.000000000 +0200
+++ freespace2-pl/src/mission/missionbriefcommon.cpp 2003-02-14 08:56:26.000000000 +0100
@@ -1192,6 +1192,12 @@
lcl_translate_brief_icon_name(buf);
gr_get_string_size(&w, &h, buf);
gr_printf(bc - fl2i(w/2.0f), by - h, buf);
+ } else if(Lcl_pl) {
+ char buf[128];
+ strcpy(buf, bi->label);
+ lcl_translate_brief_icon_name_pl(buf);
+ gr_get_string_size(&w, &h, buf);
+ gr_printf(bc - fl2i(w/2.0f), by - h, buf);
} else {
gr_get_string_size(&w,&h,bi->label);
gr_printf(bc - fl2i(w/2.0f), by - h, bi->label);
diff -ruN freespace2/src/missionui/missiondebrief.cpp freespace2-pl/src/missionui/missiondebrief.cpp
--- freespace2/src/missionui/missiondebrief.cpp 2002-07-13 08:46:48.000000000 +0200
+++ freespace2-pl/src/missionui/missiondebrief.cpp 2003-02-14 16:15:22.000000000 +0100
@@ -2529,6 +2529,9 @@
if (Lcl_gr) {
medals_translate_name(Debrief_award_text[Debrief_award_text_num_lines], AWARD_TEXT_MAX_LINE_LENGTH);
}
+ else if(Lcl_pl) {
+ medals_translate_name_pl(Debrief_award_text[Debrief_award_text_num_lines], AWARD_TEXT_MAX_LINE_LENGTH);
+ }
Debrief_award_text_num_lines++;
diff -ruN freespace2/src/stats/medals.cpp freespace2-pl/src/stats/medals.cpp
--- freespace2/src/stats/medals.cpp 2002-06-09 06:41:27.000000000 +0200
+++ freespace2-pl/src/stats/medals.cpp 2003-02-16 19:52:40.000000000 +0100
@@ -540,6 +540,66 @@
}
}
+// this is just a hack to display translated names without actually changing the names,
+// which would break stuff
+void medals_translate_name_pl(char *name, int max_len)
+{
+ if (!strcmp(name, "Epsilon Pegasi Liberation")) {
+ strncpy(name, "Order Wyzwolenia Epsilon Pegasi", max_len);
+
+ } else if (!strcmp(name, "Imperial Order of Vasuda")) {
+ strncpy(name, "Imperialny Order Vasudy", max_len);
+
+ } else if (!strcmp(name, "Distinguished Flying Cross")) {
+ strncpy(name, "Krzy\xBF Wybitnego Pilota", max_len);
+
+ } else if (!strcmp(name, "SOC Service Medallion")) {
+ strncpy(name, "Krzy\xBF S\xB3u?b Specjalnych", max_len);
+
+ } else if (!strcmp(name, "Intelligence Cross")) {
+ strncpy(name, "Krzy\xBF Wywiadu", max_len);
+
+ } else if (!strcmp(name, "Order of Galatea")) {
+ strncpy(name, "Order Galatei", max_len);
+
+ } else if (!strcmp(name, "Meritorious Unit Commendation")) {
+ strncpy(name, "Medal Pochwalny", max_len);
+
+ } else if (!strcmp(name, "Medal of Valor")) {
+ strncpy(name, "Medal za Odwag\xEA", max_len);
+
+ } else if (!strcmp(name, "GTVA Legion of Honor")) {
+ strncpy(name, "Legia Honorowa GTVA", max_len);
+
+ } else if (!strcmp(name, "Allied Defense Citation")) {
+ strncpy(name, "Order za Obron\xEA Sojuszu", max_len);
+
+ } else if (!strcmp(name, "Nebula Campaign Victory Star")) {
+ strncpy(name, "Gwiazda Wiktorii Kampanii w Mg?awicy", max_len);
+
+ } else if (!strcmp(name, "NTF Campaign Victory Star")) {
+ strncpy(name, "Gwiazda Wiktorii Kampanii NTF", max_len);
+
+ } else if (!strcmp(name, "Rank")) {
+ strncpy(name, "Ranga", max_len);
+
+ } else if (!strcmp(name, "Wings")) {
+ strncpy(name, "Skrzyd?a", max_len);
+
+ } else if (!strcmp(name, "Ace")) {
+ strncpy(name, "As", max_len);
+
+ } else if (!strcmp(name, "Double Ace")) {
+ strncpy(name, "Podw\xF3jny As", max_len);
+
+ } else if (!strcmp(name, "Triple Ace")) {
+ strncpy(name, "Potr\xF3jny As", max_len);
+
+ } else if (!strcmp(name, "SOC Unit Crest")) {
+ strncpy(name, "Tarcza S\xB3u?b Specjalnych", max_len);
+ }
+}
+
void blit_label(char *label, int *coords, int num)
{
int x, y, sw;
@@ -559,6 +619,17 @@
sprintf( text, NOX("%s (%d)"), translated_label, num );
} else {
sprintf( text, "%s", translated_label );
+ }
+ } else if(Lcl_pl) {
+ char translated_label[256];
+ strncpy(translated_label, label, 256);
+ medals_translate_name_pl(translated_label, 256);
+
+ // set correct string
+ if ( num > 1 ) {
+ sprintf( text, NOX("%s (%d)"), translated_label, num );
+ } else {
+ sprintf( text, "%s", translated_label );
}
} else {
// set correct string
More information about the freespace2
mailing list