# HG changeset patch # User unc0rr # Date 1130361335 0 # Node ID 09de46a3328cf09ba23d7ff49bb65a7befbc136f # Parent d49c23eba8ba1c4c3e634fe45fc0d902012e385d Binds and various fixes diff -r d49c23eba8ba -r 09de46a3328c QTfrontend/hw.ui.h --- a/QTfrontend/hw.ui.h Wed Oct 26 17:26:39 2005 +0000 +++ b/QTfrontend/hw.ui.h Wed Oct 26 21:15:35 2005 +0000 @@ -35,8 +35,8 @@ #include #include #include +#include "game.h" #include "hwconsts.h" -#include "game.h" #include "sdlkeys.h" class QHostAddress; @@ -200,23 +200,23 @@ void HWForm::NewTeam() { - HWTeam tmpTeam; - tmpTeam.ToPage( this ); + HWTeam tmpTeam(this); + tmpTeam.ToPage(); } void HWForm::EditTeam() { - HWTeam tmpTeam; + HWTeam tmpTeam(this); tmpTeam.LoadFromFile(cfgdir.absPath() + "/team.cfg"); - tmpTeam.ToPage( this ); + tmpTeam.ToPage(); } void HWForm::SaveTeamFromPage() { - HWTeam tmpTeam; - tmpTeam.FromPage( this ); + HWTeam tmpTeam(this); + tmpTeam.FromPage(); tmpTeam.SaveToFile(cfgdir.absPath() + "/team.cfg"); } diff -r d49c23eba8ba -r 09de46a3328c QTfrontend/hw_ru.ts --- a/QTfrontend/hw_ru.ts Wed Oct 26 17:26:39 2005 +0000 +++ b/QTfrontend/hw_ru.ts Wed Oct 26 21:15:35 2005 +0000 @@ -1,53 +1,53 @@ - - - HWForm - - Hedgewars - - - - Options - ???°?????????????? - - - Local game - ???????°?»?????°?? ???????° - - - Exit - ?????????? - - - Back - ???°?·?°?? - - - 640x480 - - - - 800x600 - - - - 1024x768 - - - - 1280x1024 - - - - Fatal error - ?????????????΅?????°?? ???????±???° - - - Could not start engine. - ???΅ ???????? ?·?°?????????????? ???????Ά????. - - - Quit - ?????????? - - - + + + HWForm + + Hedgewars + + + + Options + Настройки + + + Local game + Π›ΠΎΠΊΠ°Π»ΡŒΠ½Π°Ρ ΠΈΠ³Ρ€Π° + + + Exit + Π’Ρ‹Ρ…ΠΎΠ΄ + + + Back + Назад + + + 640x480 + + + + 800x600 + + + + 1024x768 + + + + 1280x1024 + + + + Fatal error + Ошибкаа + + + Could not start engine. + НС ΠΌΠΎΠ³Ρƒ Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ Π΄Π²ΠΈΠΆΠΎΠΊ. + + + Quit + Π’Ρ‹Ρ…ΠΎΠ΄ + + + diff -r d49c23eba8ba -r 09de46a3328c QTfrontend/sdlkeys.h --- a/QTfrontend/sdlkeys.h Wed Oct 26 17:26:39 2005 +0000 +++ b/QTfrontend/sdlkeys.h Wed Oct 26 21:15:35 2005 +0000 @@ -33,6 +33,9 @@ char keys[][2][16] = { + {"mousel", "mousel"}, + {"mousem", "mousem"}, + {"mouser", "mouser"}, {"backspace", "backspace"}, {"tab", "tab"}, {"clear", "clear"}, @@ -104,102 +107,6 @@ {"y", "y"}, {"z", "z"}, {"delete", "delete"}, - {"world 0", "world 0"}, - {"world 1", "world 1"}, - {"world 2", "world 2"}, - {"world 3", "world 3"}, - {"world 4", "world 4"}, - {"world 5", "world 5"}, - {"world 6", "world 6"}, - {"world 7", "world 7"}, - {"world 8", "world 8"}, - {"world 9", "world 9"}, - {"world 10", "world 10"}, - {"world 11", "world 11"}, - {"world 12", "world 12"}, - {"world 13", "world 13"}, - {"world 14", "world 14"}, - {"world 15", "world 15"}, - {"world 16", "world 16"}, - {"world 17", "world 17"}, - {"world 18", "world 18"}, - {"world 19", "world 19"}, - {"world 20", "world 20"}, - {"world 21", "world 21"}, - {"world 22", "world 22"}, - {"world 23", "world 23"}, - {"world 24", "world 24"}, - {"world 25", "world 25"}, - {"world 26", "world 26"}, - {"world 27", "world 27"}, - {"world 28", "world 28"}, - {"world 29", "world 29"}, - {"world 30", "world 30"}, - {"world 31", "world 31"}, - {"world 32", "world 32"}, - {"world 33", "world 33"}, - {"world 34", "world 34"}, - {"world 35", "world 35"}, - {"world 36", "world 36"}, - {"world 37", "world 37"}, - {"world 38", "world 38"}, - {"world 39", "world 39"}, - {"world 40", "world 40"}, - {"world 41", "world 41"}, - {"world 42", "world 42"}, - {"world 43", "world 43"}, - {"world 44", "world 44"}, - {"world 45", "world 45"}, - {"world 46", "world 46"}, - {"world 47", "world 47"}, - {"world 48", "world 48"}, - {"world 49", "world 49"}, - {"world 50", "world 50"}, - {"world 51", "world 51"}, - {"world 52", "world 52"}, - {"world 53", "world 53"}, - {"world 54", "world 54"}, - {"world 55", "world 55"}, - {"world 56", "world 56"}, - {"world 57", "world 57"}, - {"world 58", "world 58"}, - {"world 59", "world 59"}, - {"world 60", "world 60"}, - {"world 61", "world 61"}, - {"world 62", "world 62"}, - {"world 63", "world 63"}, - {"world 64", "world 64"}, - {"world 65", "world 65"}, - {"world 66", "world 66"}, - {"world 67", "world 67"}, - {"world 68", "world 68"}, - {"world 69", "world 69"}, - {"world 70", "world 70"}, - {"world 71", "world 71"}, - {"world 72", "world 72"}, - {"world 73", "world 73"}, - {"world 74", "world 74"}, - {"world 75", "world 75"}, - {"world 76", "world 76"}, - {"world 77", "world 77"}, - {"world 78", "world 78"}, - {"world 79", "world 79"}, - {"world 80", "world 80"}, - {"world 81", "world 81"}, - {"world 82", "world 82"}, - {"world 83", "world 83"}, - {"world 84", "world 84"}, - {"world 85", "world 85"}, - {"world 86", "world 86"}, - {"world 87", "world 87"}, - {"world 88", "world 88"}, - {"world 89", "world 89"}, - {"world 90", "world 90"}, - {"world 91", "world 91"}, - {"world 92", "world 92"}, - {"world 93", "world 93"}, - {"world 94", "world 94"}, - {"world 95", "world 95"}, {"[0]", "[0]"}, {"[1]", "[1]"}, {"[2]", "[2]"}, @@ -242,15 +149,15 @@ {"f14", "f14"}, {"f15", "f15"}, {"numlock", "numlock"}, - {"caps lock", "caps lock"}, - {"scroll lock", "scroll lock"}, - {"right shift", "right shift"}, - {"left shift", "left shift"}, - {"right ctrl", "right ctrl"}, - {"left ctrl", "left ctrl"}, - {"right alt", "right alt"}, - {"left alt", "left alt"}, - {"right meta", "right meta"}, - {"left meta", "left meta"}, + {"caps_lock", "caps_lock"}, + {"scroll_lock", "scroll_lock"}, + {"right_shift", "right_shift"}, + {"left_shift", "left_shift"}, + {"right_ctrl", "right_ctrl"}, + {"left_ctrl", "left_ctrl"}, + {"right_alt", "right_alt"}, + {"left_alt", "left_alt"}, + {"right_meta", "right_meta"}, + {"left_meta", "left_meta"}, {"", ""} }; diff -r d49c23eba8ba -r 09de46a3328c QTfrontend/team.h --- a/QTfrontend/team.h Wed Oct 26 17:26:39 2005 +0000 +++ b/QTfrontend/team.h Wed Oct 26 21:15:35 2005 +0000 @@ -34,22 +34,56 @@ #include #include #include +#include #include "hw.h" class QString; class QTextStream; class QFile; -class HWForm; +class QComboBox; + +struct BindAction +{ + QComboBox * cbind; + char action[15]; + char strbind[15]; +}; + +const BindAction cbinds[8] = +{ + {0, "+up", "up"}, + {0, "+left", "left"}, + {0, "+right", "right"}, + {0, "+down", "down"}, + {0, "ljump", "return"}, + {0, "hjump", "backspace"}, + {0, "+attack", "space"}, + {0, "switch", "tab"} +}; + class HWTeam { public: - HWTeam() + HWTeam(HWForm * hwform) { TeamName = "unnamed"; for (int i = 0; i < 8; i++) HHName[i].sprintf("hedgehog %d", i); Grave = "Simple"; + form = hwform; + memcpy(binds, cbinds, sizeof(cbinds)); + binds[0].cbind = form->CBindUp; + binds[1].cbind = form->CBindLeft; + binds[2].cbind = form->CBindRight; + binds[3].cbind = form->CBindDown; + binds[4].cbind = form->CBindLJump; + binds[5].cbind = form->CBindHJump; + binds[6].cbind = form->CBindAttack; + binds[7].cbind = form->CBindSwitch; } + + HWForm * form; + BindAction binds[8]; QString TeamName; QString HHName[8]; QString Grave; @@ -62,19 +96,20 @@ QTextStream stream(&cfgfile); stream.setEncoding(QTextStream::Unicode); QString str; + QString action; while (!stream.atEnd()) { str = stream.readLine(); if (str.startsWith(";")) continue; - if (str.startsWith("teamname ")) + if (str.startsWith("name team ")) { - str.remove(0, 9); + str.remove(0, 10); TeamName = str; } else - if (str.startsWith("name")) + if (str.startsWith("name hh")) { - str.remove(0, 4); + str.remove(0, 7); long i = str.left(1).toLong(); if ((i < 0) || (i > 7)) continue; str.remove(0, 2); @@ -89,7 +124,20 @@ { str.remove(0, 5); Fort = str; - } + } else + if (str.startsWith("bind ")) + { + str.remove(0, 5); + action = str.section(' ', 1); + str = str.section(' ', 0, 0); + str.truncate(15); + for (int i = 0; i < 8; i++) + if (action == binds[i].action) + { + strcpy((char *)&binds[i].strbind, str.latin1()); + break; + } + } } cfgfile.close(); return true; @@ -102,16 +150,20 @@ QTextStream stream(&cfgfile); stream.setEncoding(QTextStream::Unicode); stream << "; Generated by Hedgewars, do not modify" << endl; - stream << "teamname " << TeamName << endl; + stream << "name team " << TeamName << endl; for (int i = 0; i < 8; i++) - stream << "name" << i << " " << HHName[i] << endl; + stream << "name hh" << i << " " << HHName[i] << endl; stream << "grave " << Grave << endl; stream << "fort " << Fort << endl; + for(int i = 0; i < 8; i++) + { + stream << "bind " << binds[i].strbind << " " << binds[i].action << endl; + } cfgfile.close(); return true; } - void ToPage(HWForm * form) + void ToPage() { form->EditTeamName->setText(TeamName); form->HHName0->setText(HHName[0]); @@ -128,9 +180,15 @@ lb = form->CBForts->listBox(); form->CBForts->setCurrentItem(lb->index(lb->findItem(Fort))); + + lb = form->CBindUp->listBox(); + for(int i = 0; i < 8; i++) + { + binds[i].cbind->setCurrentItem(lb->index(lb->findItem(binds[i].strbind))); + } } - void FromPage(HWForm * form) + void FromPage() { TeamName = form->EditTeamName->text(); HHName[0] = form->HHName0->text(); @@ -144,6 +202,10 @@ Grave = form->CBGraves->currentText(); Fort = form->CBForts->currentText(); + for(int i = 0; i < 8; i++) + { + strcpy((char *)&binds[i].strbind, binds[i].cbind->currentText().latin1()); + } } private: };