# HG changeset patch # User sheepluva # Date 1365368020 -7200 # Node ID 539380a498e45a29f59de27903529f833ea51ecb # Parent af4ab297b2b773fc65bb7030686eae85db3767f0# Parent 08fe086511308efb8e7ecf73d5012c76edc9271f merge diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/HWApplication.cpp --- a/QTfrontend/HWApplication.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/HWApplication.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -18,6 +18,7 @@ #include "HWApplication.h" #include +#include #include "hwform.h" #include "MessageDialog.h" @@ -34,7 +35,7 @@ } #endif -HWApplication::HWApplication(int &argc, char **argv): +HWApplication::HWApplication(int &argc, char **argv) : QApplication(argc, argv) { #if !defined(Q_WS_WIN) @@ -84,7 +85,7 @@ } else if (scheme == "hwplay") { int port = openEvent->url().port(NETGAME_DEFAULT_PORT); if (address == "") - address = "netserver.hedgewars.org"; + address = NETGAME_DEFAULT_SERVER; form->NetConnectQuick(address, (quint16) port); return true; } else { diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/HWApplication.h --- a/QTfrontend/HWApplication.h Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/HWApplication.h Sun Apr 07 22:53:40 2013 +0200 @@ -20,10 +20,9 @@ #define HWAPP_H #include -#include -#include class HWForm; +class QEvent; /** * @brief Main class of the Qt application. diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/gameuiconfig.cpp --- a/QTfrontend/gameuiconfig.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/gameuiconfig.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -217,12 +217,12 @@ void GameUIConfig::resizeToConfigValues() { // fill 2/3 of the screen desktop - const QRect deskSize = QApplication::desktop()->screenGeometry(-1); + const QRect deskSize = HWApplication::desktop()->screenGeometry(-1); Form->resize(value("frontend/width", qMin(qMax(deskSize.width()*2/3,800),deskSize.width())).toUInt(), value("frontend/height", qMin(qMax(deskSize.height()*2/3,600),deskSize.height())).toUInt()); // move the window to the center of the screen - QPoint center = QApplication::desktop()->availableGeometry(-1).center(); + QPoint center = HWApplication::desktop()->availableGeometry(-1).center(); center.setX(center.x() - (Form->width()/2)); center.setY(center.y() - (Form->height()/2)); Form->move(center); diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/hwconsts.h --- a/QTfrontend/hwconsts.h Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/hwconsts.h Sun Apr 07 22:53:40 2013 +0200 @@ -67,6 +67,7 @@ #define SEASON_HWBDAY 4 #define SEASON_EASTER 8 +#define NETGAME_DEFAULT_SERVER "netserver.hedgewars.org" #define NETGAME_DEFAULT_PORT 46631 #define HEDGEHOGS_PER_TEAM 8 diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/hwform.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -361,7 +361,7 @@ { if(hwnet && (hwnet->clientState() != HWNewNet::Disconnected)) { - xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare(QString("netserver.hedgewars.org:%1").arg(NETGAME_DEFAULT_PORT)) ? "Official server" : hwnet->getHost().toAscii()); + xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare(QString("%1:%2").arg(NETGAME_DEFAULT_SERVER).arg(NETGAME_DEFAULT_PORT)) ? "Official server" : hwnet->getHost().toAscii()); switch(hwnet->clientState()) { case HWNewNet::Connecting: // Connecting @@ -1014,7 +1014,7 @@ void HWForm::NetConnectOfficialServer() { - NetConnectServer("netserver.hedgewars.org", NETGAME_DEFAULT_PORT); + NetConnectServer(NETGAME_DEFAULT_SERVER, NETGAME_DEFAULT_PORT); } void HWForm::NetPassword(const QString & nick) @@ -1351,7 +1351,7 @@ //nick and pass stuff QString nickname = config->value("net/nick", "").toString(); - hwnet->m_private_game = !(hostName == "netserver.hedgewars.org" && port == NETGAME_DEFAULT_PORT); + hwnet->m_private_game = !(hostName == NETGAME_DEFAULT_SERVER && port == NETGAME_DEFAULT_PORT); if (hwnet->m_private_game == false) if (AskForNickAndPwd() != 0) return; @@ -2016,8 +2016,22 @@ void HWForm::showFeedbackDialog() { - FeedbackDialog dialog(this); - dialog.exec(); + QNetworkRequest newRequest(QUrl("http://www.hedgewars.org")); + + QNetworkAccessManager *manager = new QNetworkAccessManager(this); + QNetworkReply *reply = manager->get(newRequest); + connect(reply, SIGNAL(finished()), this, SLOT(showFeedbackDialogNetChecked())); +} + +void HWForm::showFeedbackDialogNetChecked() +{ + QNetworkReply *reply = qobject_cast(sender()); + + if (reply && (reply->error() == QNetworkReply::NoError)) { + FeedbackDialog dialog(this); + dialog.exec(); + } else + MessageDialog::ShowErrorMessage(tr("This page requires an internet connection."), this); } void HWForm::startGame() diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/hwform.h --- a/QTfrontend/hwform.h Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/hwform.h Sun Apr 07 22:53:40 2013 +0200 @@ -129,6 +129,7 @@ void UpdateCampaignPageProgress(int index); void InitCampaignPage(); void showFeedbackDialog(); + void showFeedbackDialogNetChecked(); void NetGameChangeStatus(bool isMaster); void NetGameMaster(); diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/main.cpp --- a/QTfrontend/main.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/main.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -36,6 +35,7 @@ #include "DataManager.h" #include "FileEngine.h" +#include "MessageDialog.h" #ifdef _WIN32 #include @@ -99,12 +99,7 @@ if (!tmpdir.exists()) if (!tmpdir.mkpath(dir)) { - QMessageBox directoryMsg(QApplication::activeWindow()); - directoryMsg.setIcon(QMessageBox::Warning); - directoryMsg.setWindowTitle(QMessageBox::tr("Main - Error")); - directoryMsg.setText(QMessageBox::tr("Cannot create directory %1").arg(dir)); - directoryMsg.setWindowModality(Qt::WindowModal); - directoryMsg.exec(); + MessageDialog::ShowErrorMessage(HWApplication::tr("Cannot create directory %1").arg(dir)); return false; } return true; @@ -144,7 +139,7 @@ QPixmap pixmap(":res/splash.png"); splash = new QLabel(0, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint); splash->setAttribute(Qt::WA_TranslucentBackground); - const QRect deskSize = QApplication::desktop()->screenGeometry(-1); + const QRect deskSize = HWApplication::desktop()->screenGeometry(-1); QPoint splashCenter = QPoint( (deskSize.width() - pixmap.width())/2, (deskSize.height() - pixmap.height())/2 ); splash->move(splashCenter); @@ -253,16 +248,9 @@ datadir->cd(bindir->absolutePath()); datadir->cd(*cDataDir); - if(!datadir->cd("Data")) + if (!datadir->cd("Data")) { - QMessageBox missingMsg(QApplication::activeWindow()); - missingMsg.setIcon(QMessageBox::Critical); - missingMsg.setWindowTitle(QMessageBox::tr("Main - Error")); - missingMsg.setText(QMessageBox::tr("Failed to open data directory:\n%1\n\n" - "Please check your installation!"). - arg(datadir->absolutePath()+"/Data")); - missingMsg.setWindowModality(Qt::WindowModal); - missingMsg.exec(); + MessageDialog::ShowFatalMessage(HWApplication::tr("Failed to open data directory:\n%1\n\nPlease check your installation!").arg(datadir->absolutePath()+"/Data")); return 1; } @@ -279,12 +267,13 @@ { QSettings settings("physfs://hedgewars.ini", QSettings::IniFormat); QString cc = settings.value("misc/locale", QString()).toString(); - if(cc.isEmpty()) - cc = QLocale::system().name(); + if (cc.isEmpty()) + cc = HWApplication::keyboardInputLocale().name(); + // QLocale::system().name() returns only "C"... // load locale file into translator - if(!Translator.load(QString("physfs://Locale/hedgewars_%1").arg(cc))) - qWarning("Failed to install translation"); + if (!Translator.load(QString("physfs://Locale/hedgewars_%1").arg(cc))) + qWarning("Failed to install translation (%s)", qPrintable(cc)); app.installTranslator(&Translator); } diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/net/tcpBase.cpp --- a/QTfrontend/net/tcpBase.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/net/tcpBase.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -19,13 +19,12 @@ #include "tcpBase.h" -#include #include -#include #include #include #include "hwconsts.h" +#include "MessageDialog.h" #ifdef HWLIBRARY extern "C" void Game(char**arguments); @@ -89,13 +88,7 @@ IPCServer->setMaxPendingConnections(1); if (!IPCServer->listen(QHostAddress::LocalHost)) { - QMessageBox deniedMsg(QApplication::activeWindow()); - deniedMsg.setIcon(QMessageBox::Critical); - deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error")); - deniedMsg.setText(QMessageBox::tr("Unable to start the server: %1.").arg(IPCServer->errorString())); - deniedMsg.setWindowModality(Qt::WindowModal); - deniedMsg.exec(); - + MessageDialog::ShowFatalMessage(tr("Unable to start server at %1.").arg(IPCServer->errorString())); exit(0); // FIXME - should be graceful exit here (lower Critical -> Warning above when implemented) } } @@ -172,14 +165,7 @@ void TCPBase::StartProcessError(QProcess::ProcessError error) { - QMessageBox deniedMsg(QApplication::activeWindow()); - deniedMsg.setIcon(QMessageBox::Critical); - deniedMsg.setWindowTitle(QMessageBox::tr("TCP - Error")); - deniedMsg.setText(QMessageBox::tr("Unable to run engine at ") + bindir->absolutePath() + "/hwengine\n" + - QMessageBox::tr("Error code: %1").arg(error)); - deniedMsg.setWindowModality(Qt::WindowModal); - deniedMsg.exec(); - + MessageDialog::ShowFatalMessage(tr("Unable to run engine at %1\nError code: %2").arg(bindir->absolutePath() + "/hwengine").arg(error)); ClientDisconnect(); } diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/ui/dialog/input_password.cpp --- a/QTfrontend/ui/dialog/input_password.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/ui/dialog/input_password.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -29,18 +29,14 @@ { setWindowTitle(tr("Login")); - QString titleLabelText = "To connect to the server, please log in.\n\nIf you don't have an account on www.hedgewars.org,\njust enter your nickname."; - QString nickLabelText = "Nickname:"; - QString passLabelText = "Password:"; - QGridLayout * layout = new QGridLayout(this); QLabel * titleLabel = new QLabel(this); - titleLabel->setText(titleLabelText); + titleLabel->setText(tr("To connect to the server, please log in.\n\nIf you don't have an account on www.hedgewars.org,\njust enter your nickname.")); layout->addWidget(titleLabel, 0, 0); QLabel * nickLabel = new QLabel(this); - nickLabel->setText(nickLabelText); + nickLabel->setText(tr("Nickname:")); layout->addWidget(nickLabel, 1, 0); leNickname = new QLineEdit(this); @@ -48,7 +44,7 @@ layout->addWidget(leNickname, 2, 0); QLabel * passLabel = new QLabel(this); - passLabel->setText(passLabelText); + passLabel->setText(tr("Password:")); layout->addWidget(passLabel, 3, 0); lePassword = new QLineEdit(this); diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/ui/mouseoverfilter.cpp --- a/QTfrontend/ui/mouseoverfilter.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/ui/mouseoverfilter.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -35,7 +35,6 @@ } else if (event->type() == QEvent::FocusIn) { - QWidget * widget = dynamic_cast(dist); abstractpage = qobject_cast(ui->Pages->currentWidget()); // play a sound when mouse hovers certain ui elements diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/ui/page/pagedata.cpp --- a/QTfrontend/ui/page/pagedata.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/ui/page/pagedata.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -60,7 +60,10 @@ web->setOpenLinks(false); // fetchList(); - + web->setHtml(QString( + "

Hedgewars Downloadable Content



" + "%1
") + .arg(tr("Loading, please wait."))); m_contentDownloaded = false; } @@ -106,8 +109,7 @@ { QNetworkReply * reply = qobject_cast(sender()); - if(reply) - { + if (reply && (reply->error() == QNetworkReply::NoError)) { QString html = QString::fromUtf8(reply->readAll()); int begin = html.indexOf(""); int end = html.indexOf(""); @@ -117,7 +119,11 @@ html.remove(0, begin); } web->setHtml(html); - } + } else + web->setHtml(QString( + "

Hedgewars Downloadable Content



" + "

%1

") + .arg(tr("This page requires an internet connection."))); } void PageDataDownload::fileDownloaded() diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/ui/page/pageoptions.cpp --- a/QTfrontend/ui/page/pageoptions.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/ui/page/pageoptions.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -592,6 +592,11 @@ CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name()); } + QLabel *restartNoticeLabel = new QLabel(groupMisc); + restartNoticeLabel->setText(QLabel::tr("This setting will be effective at next restart.")); + groupMisc->layout()->addWidget(restartNoticeLabel, 1, 1); + + // Divider groupMisc->addDivider(); // row 1 @@ -600,14 +605,14 @@ CBNameWithDate = new QCheckBox(groupMisc); CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name")); - groupMisc->layout()->addWidget(CBNameWithDate, 2, 0, 1, 2); + groupMisc->layout()->addWidget(CBNameWithDate, 3, 0, 1, 2); // Associate file extensions BtnAssociateFiles = new QPushButton(groupMisc); BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions")); BtnAssociateFiles->setVisible(!custom_data && !custom_config); - groupMisc->layout()->addWidget(BtnAssociateFiles, 3, 0, 1, 2); + groupMisc->layout()->addWidget(BtnAssociateFiles, 4, 0, 1, 2); } #ifdef __APPLE__ diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/ui/widget/chatwidget.cpp --- a/QTfrontend/ui/widget/chatwidget.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/ui/widget/chatwidget.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -37,7 +37,7 @@ #include "hwconsts.h" #include "gameuiconfig.h" #include "playerslistmodel.h" - +#include "HWApplication.h" #include "chatwidget.h" @@ -449,6 +449,7 @@ { line = QString("%1").arg(line); SDLInteraction::instance().playSoundFile(m_hilightSound); + HWApplication::alert(this, 800); } chatStrings.append(line); diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/ui/widget/feedbackdialog.cpp --- a/QTfrontend/ui/widget/feedbackdialog.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/ui/widget/feedbackdialog.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -74,16 +74,22 @@ QHBoxLayout * systemLayout = new QHBoxLayout(); info = new QLabel(); - info->setText( + info->setText(QString( "" - "

Please give us feedback!

" - "

We are always happy about suggestions, ideas, or bug reports.

" - "

Your email address is optional, but we may want to contact you.

" - "

" + "

%1

" + "

%2

" + "

%3 known bugs

" + "

%4

" + "

") + .arg(tr("Send us feedback!")) + .arg(tr("We are always happy about suggestions, ideas, or bug reports.")) + .arg(tr("If you found a bug, you can see if it's already been reported here: ")) + .arg(tr("Your email address is optional, but necessary if you want us to get back at you.")) ); + info->setOpenExternalLinks(true); pageLayout->addWidget(info); QVBoxLayout * summaryEmailLayout = new QVBoxLayout(); @@ -238,12 +244,14 @@ MEMORYSTATUSEX status; status.dwLength = sizeof(status); GlobalMemoryStatusEx(&status); - total_ram += QString::number(status.ullTotalPhys) + "\n"; + total_ram += QString::number(status.ullTotalPhys/1024/1024) + " MB\n"; - switch(QSysInfo::WinVersion()) + switch(QSysInfo::windowsVersion()) { + case QSysInfo::WV_NT: os_version += "Windows NT\n"; break; case QSysInfo::WV_2000: os_version += "Windows 2000\n"; break; case QSysInfo::WV_XP: os_version += "Windows XP\n"; break; + case QSysInfo::WV_2003: os_version += "Windows Server 2003\n"; break; case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break; case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break; //case QSysInfo::WV_WINDOWS8: os_version += "Windows 8\n"; break; //QT 5+ @@ -260,8 +268,8 @@ #else available_pages = 0, #endif*/ - page_size = sysconf(_SC_PAGE_SIZE); - total_ram += QString::number(pages * page_size) + "\n"; + page_size = sysconf(_SC_PAGE_SIZE); + total_ram += QString::number(pages*page_size/1024/1024) + " MB\n"; os_version += "GNU/Linux or BSD\n"; #endif diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/util/MessageDialog.cpp --- a/QTfrontend/util/MessageDialog.cpp Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/util/MessageDialog.cpp Sun Apr 07 22:53:40 2013 +0200 @@ -17,23 +17,39 @@ */ #include "MessageDialog.h" +#include "HWApplication.h" + +int MessageDialog::ShowFatalMessage(const QString & msg, QWidget * parent) +{ + return ShowMessage(QMessageBox::tr("Hedgewars - Error"), + msg, + QMessageBox::Critical, + parent); +} int MessageDialog::ShowErrorMessage(const QString & msg, QWidget * parent) { - return ShowMessage(msg, QMessageBox::tr("Hedgewars - Warning"), QMessageBox::Warning, parent); + return ShowMessage(QMessageBox::tr("Hedgewars - Warning"), + msg, + QMessageBox::Warning, + parent); } int MessageDialog::ShowInfoMessage(const QString & msg, QWidget * parent) { - return ShowMessage(msg, QMessageBox::tr("Hedgewars - Information"), QMessageBox::Information, parent); + return ShowMessage(QMessageBox::tr("Hedgewars - Information"), + msg, + QMessageBox::Information, + parent); } -int MessageDialog::ShowMessage(const QString & msg, const QString & title, QMessageBox::Icon icon, QWidget * parent) +int MessageDialog::ShowMessage(const QString & title, const QString & msg, QMessageBox::Icon icon, QWidget * parent) { - QMessageBox msgMsg(parent); + QMessageBox msgMsg(parent ? parent : HWApplication::activeWindow()); + msgMsg.setWindowTitle(title != NULL ? title : "Hedgewars"); + msgMsg.setText(msg); msgMsg.setIcon(icon); - msgMsg.setWindowTitle(title.isEmpty() ? QMessageBox::tr("Hedgewars") : title); - msgMsg.setText(msg); msgMsg.setWindowModality(Qt::WindowModal); + return msgMsg.exec(); } diff -r af4ab297b2b7 -r 539380a498e4 QTfrontend/util/MessageDialog.h --- a/QTfrontend/util/MessageDialog.h Tue Mar 26 18:52:42 2013 +0100 +++ b/QTfrontend/util/MessageDialog.h Sun Apr 07 22:53:40 2013 +0200 @@ -19,7 +19,6 @@ #ifndef MESSAGEDIALOG_H #define MESSAGEDIALOG_H -#include #include class QWidget; @@ -27,9 +26,18 @@ class MessageDialog { public: + static int ShowFatalMessage(const QString & msg, QWidget * parent = 0); static int ShowErrorMessage(const QString & msg, QWidget * parent = 0); static int ShowInfoMessage(const QString & msg, QWidget * parent = 0); - static int ShowMessage(const QString & msg, const QString & title = QString(), QMessageBox::Icon icon = QMessageBox::NoIcon, QWidget * parent = 0); + /** + * @brief Displays a message. + * @param title message title or NULL if no/default title + * @param msg message to display + * @param icon (optional) icon to be displayed next to the message + * @param parent parent Widget + * @return a QMessageBox::StandardButton value indicating which button was clicked + */ + static int ShowMessage(const QString & title, const QString & msg, QMessageBox::Icon icon = QMessageBox::NoIcon, QWidget * parent = 0); }; #endif diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/ArgParsers.inc --- a/hedgewars/ArgParsers.inc Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/ArgParsers.inc Sun Apr 07 22:53:40 2013 +0200 @@ -191,8 +191,8 @@ {--locale} 2 : cLocaleFName := getStringParameter (arg, paramIndex, parseParameter); {--fullscreen-width} 3 : cFullscreenWidth := getLongIntParameter(arg, paramIndex, parseParameter); {--fullscreen-height} 4 : cFullscreenHeight := getLongIntParameter(arg, paramIndex, parseParameter); - {--width} 5 : cWindowedWidth := getLongIntParameter(arg, paramIndex, parseParameter); - {--height} 6 : cWindowedHeight := getLongIntParameter(arg, paramIndex, parseParameter); + {--width} 5 : cWindowedWidth := max(2 * (getLongIntParameter(arg, paramIndex, parseParameter) div 2), cMinScreenWidth); + {--height} 6 : cWindowedHeight := max(2 * (getLongIntParameter(arg, paramIndex, parseParameter) div 2), cMinScreenHeight); {--frame-interval} 7 : cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter); {--volume} 8 : SetVolume ( getLongIntParameter(arg, paramIndex, parseParameter) ); {--nomusic} 9 : SetMusic ( false ); diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/CMakeLists.txt Sun Apr 07 22:53:40 2013 +0200 @@ -167,8 +167,9 @@ find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP") if(PNG_FOUND) - list(REMOVE_AT PNG_INCLUDE_DIR 1) #removing the zlib include path - list(APPEND pascal_flags "-dPNG_SCREENSHOTS -Fl${PNG_INCLUDE_DIR}") + list(REMOVE_AT PNG_LIBRARIES 1) #removing the zlib library path + get_filename_component(PNG_LIBRARY_DIR ${PNG_LIBRARIES} PATH) + list(APPEND pascal_flags "-dPNG_SCREENSHOTS" "-Fl${PNG_LIBRARY_DIR}") endif() diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/GSHandlers.inc Sun Apr 07 22:53:40 2013 +0200 @@ -53,7 +53,7 @@ sX:= dX / steps; sY:= dY / steps; end - + else begin sX:= dX; @@ -75,7 +75,7 @@ end; procedure makeHogsWorry(x, y: hwFloat; r: LongInt); -var +var gi: PGear; d: LongInt; begin @@ -89,7 +89,7 @@ begin if (CurrentHedgehog^.Gear = gi) then PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack) - + else begin if ((gi^.State and gstMoving) = 0) and (gi^.Hedgehog^.Effects[heFrozen] = 0) then @@ -97,15 +97,15 @@ gi^.dX.isNegative:= X r div 2 then - PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack) + PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack) else PlaySoundV(sndUhOh, gi^.Hedgehog^.Team^.voicepack); end; end; end; - + gi := gi^.NextGear end; end; @@ -116,10 +116,10 @@ DeleteCI(HH^.Gear); if FollowGear = HH^.Gear then FollowGear:= nil; - + if lastGearByUID = HH^.Gear then lastGearByUID := nil; - + HH^.Gear^.Message:= HH^.Gear^.Message or gmRemoveFromList; with HH^.Gear^ do begin @@ -165,7 +165,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepFallingGear(Gear: PGear); -var +var isFalling: boolean; //tmp: QWord; tdX, tdY: hwFloat; @@ -173,23 +173,11 @@ land: word; begin // clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems. -{$IFNDEF WEB} if Gear^.dX.Round > 2 then Gear^.dX.QWordValue:= 8589934592; if Gear^.dY.Round > 2 then Gear^.dY.QWordValue:= 8589934592; -{$ELSE} - if Gear^.dX.Round > 2 then - begin - Gear^.dX.Round:= 2; - Gear^.dX.Frac:= 0 - end; - if Gear^.dY.QWordValue > 2 then - begin - Gear^.dY.Round:= 2; - Gear^.dY.Frac:= 0 - end; -{$ENDIF} + Gear^.State := Gear^.State and (not gstCollision); collV := 0; collH := 0; @@ -220,16 +208,16 @@ else if (Gear^.AdvBounce=1) and (TestCollisionYwithGear(Gear, 1) <> 0) then collV := 1; end - else + else begin // Gear^.dY.isNegative is false land:= TestCollisionYwithGear(Gear, 1); if land <> 0 then begin collV := 1; isFalling := false; - if land and lfIce <> 0 then + if land and lfIce <> 0 then Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) - else + else Gear^.dX := Gear^.dX * Gear^.Friction; Gear^.dY := - Gear^.dY * Gear^.Elasticity; @@ -252,7 +240,7 @@ Gear^.State := Gear^.State or gstCollision end else if (Gear^.AdvBounce=1) and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then - collH := -hwSign(Gear^.dX); + collH := -hwSign(Gear^.dX); //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then if (Gear^.AdvBounce=1) and (collV <>0) and (collH <> 0) and ((collV=-1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue)) then @@ -285,18 +273,18 @@ else Gear^.State := Gear^.State or gstMoving; - if (Gear^.nImpactSounds > 0) and + if (Gear^.nImpactSounds > 0) and (Gear^.State and gstCollision <> 0) and (((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or (Gear^.State and gstMoving <> 0)) and (((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or - ((Gear^.Radius >= 3) and + ((Gear^.Radius >= 3) and ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true); end; //////////////////////////////////////////////////////////////////////////////// procedure doStepBomb(Gear: PGear); -var +var i, x, y: LongInt; dX, dY, gdX: hwFloat; vg: PVisualGear; @@ -307,7 +295,7 @@ dec(Gear^.Timer); if Gear^.Timer = 1000 then // might need adjustments - case Gear^.Kind of + case Gear^.Kind of gtGrenade: makeHogsWorry(Gear^.X, Gear^.Y, 50); gtClusterBomb: makeHogsWorry(Gear^.X, Gear^.Y, 20); gtWatermelon: makeHogsWorry(Gear^.X, Gear^.Y, 75); @@ -331,10 +319,10 @@ if Gear^.Timer = 0 then begin - case Gear^.Kind of + case Gear^.Kind of gtGrenade: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound); gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, Gear^.Hedgehog, EXPLAutoSound); - gtClusterBomb: + gtClusterBomb: begin x := hwRound(Gear^.X); y := hwRound(Gear^.Y); @@ -347,7 +335,7 @@ FollowGear := AddGear(x, y, gtCluster, 0, dX, dY, 25) end end; - gtWatermelon: + gtWatermelon: begin x := hwRound(Gear^.X); y := hwRound(Gear^.Y); @@ -361,7 +349,7 @@ FollowGear^.DirAngle := i * 60 end end; - gtHellishBomb: + gtHellishBomb: begin x := hwRound(Gear^.X); y := hwRound(Gear^.Y); @@ -377,7 +365,7 @@ AddGear(x, y, gtFlame, 0, dX, -dY, 0) end else - begin + begin AddGear(x, y, gtFlame, 0, dX, dY, 0); AddGear(x, y, gtFlame, gstTmpFlag, dX, -dY, 0) end; @@ -417,7 +405,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepMolotov(Gear: PGear); -var +var s: Longword; i, gX, gY: LongInt; dX, dY: hwFloat; @@ -437,7 +425,7 @@ i:= 130 else i:= 50; - + smoke:= AddVisualGear(hwRound(Gear^.X)-round(cos((Gear^.DirAngle+i) * pi / 180)*20), hwRound(Gear^.Y)-round(sin((Gear^.DirAngle+i) * pi / 180)*20), vgtSmoke); if smoke <> nil then smoke^.Scale:= 0.75; @@ -697,10 +685,10 @@ end; p:= @(p^[s^.pitch shr 2]) end; - - // Why is this here. For one thing, there's no test on +1 being safe. + + // Why is this here. For one thing, there's no test on +1 being safe. //Land[py, px+1]:= lfBasic; - + if allpx then UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w), true) else @@ -765,7 +753,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepBeeWork(Gear: PGear); -var +var t: hwFloat; gX,gY,i: LongInt; uw, nuw: boolean; @@ -880,7 +868,7 @@ Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and (not gmAttack); Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and (not gstAttacking); AttackBar:= 0; - + Gear^.SoundChannel := LoopSound(sndBee); Gear^.Timer := 5000; // save initial speed in otherwise unused Friction variable @@ -902,7 +890,7 @@ end; procedure doStepShotgunShot(Gear: PGear); -var +var i: LongWord; shell: PVisualGear; begin @@ -978,7 +966,7 @@ // Bullet trail VGear := AddVisualGear(hwRound(ox), hwRound(oy), vgtLineTrail); - + if VGear <> nil then begin VGear^.X:= hwFloat2Float(ox); @@ -1001,7 +989,7 @@ end; procedure doStepBulletWork(Gear: PGear); -var +var i, x, y: LongWord; oX, oY: hwFloat; VGear: PVisualGear; @@ -1016,7 +1004,7 @@ Gear^.Y := Gear^.Y + Gear^.dY; x := hwRound(Gear^.X); y := hwRound(Gear^.Y); - + if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] <> 0) then inc(Gear^.Damage); // let's interrupt before a collision to give portals a chance to catch the bullet @@ -1038,7 +1026,7 @@ else AmmoShove(Gear, Gear^.Timer, 20); CheckGearDrowning(Gear); - dec(i) + dec(i) until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0); if Gear^.Damage > 0 then @@ -1066,7 +1054,7 @@ cLaserSighting := false; if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and ((GameFlags and gfArtillery) = 0) then cArtillery := false; - + // Bullet Hit if (hwRound(Gear^.X) and LAND_WIDTH_MASK = 0) and (hwRound(Gear^.Y) and LAND_HEIGHT_MASK = 0) then begin @@ -1076,7 +1064,7 @@ VGear^.Angle := DxDy2Angle(-Gear^.dX, Gear^.dY); end; end; - + spawnBulletTrail(Gear); Gear^.doStep := @doStepShotIdle end; @@ -1092,7 +1080,7 @@ end; procedure doStepSniperRifleShot(Gear: PGear); -var +var HHGear: PGear; shell: PVisualGear; begin @@ -1123,7 +1111,7 @@ Gear^.dY := -AngleCos(HHGear^.Angle) * _0_5; PlaySound(sndGun); // add 3 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just weird angles - Gear^.X := Gear^.X + Gear^.dX * 3; + Gear^.X := Gear^.X + Gear^.dX * 3; Gear^.Y := Gear^.Y + Gear^.dY * 3; Gear^.doStep := @doStepBulletWork; end @@ -1152,7 +1140,7 @@ begin dec(Gear^.Timer); case Gear^.Kind of - gtATStartGame: + gtATStartGame: begin AllInactive := false; if Gear^.Timer = 0 then @@ -1160,7 +1148,7 @@ AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState); end end; - gtATFinishGame: + gtATFinishGame: begin AllInactive := false; if Gear^.Timer = 1000 then @@ -1183,7 +1171,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepPickHammerWork(Gear: PGear); -var +var i, ei, x, y: LongInt; HHGear: PGear; begin @@ -1274,7 +1262,7 @@ end; procedure doStepPickHammer(Gear: PGear); -var +var i, y: LongInt; ar: TRangeArray; HHGear: PGear; @@ -1301,11 +1289,11 @@ end; //////////////////////////////////////////////////////////////////////////////// -var +var BTPrevAngle, BTSteps: LongInt; procedure doStepBlowTorchWork(Gear: PGear); -var +var HHGear: PGear; b: boolean; prevX: LongInt; @@ -1314,7 +1302,7 @@ dec(Gear^.Timer); if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then dec(TurnTimeLeft); - + HHGear := Gear^.Hedgehog^.Gear; HedgehogChAngle(HHGear); @@ -1395,7 +1383,7 @@ end; procedure doStepBlowTorch(Gear: PGear); -var +var HHGear: PGear; begin BTPrevAngle := High(LongInt); @@ -1443,7 +1431,7 @@ inc(Gear^.Damage, hwRound(Gear^.dY * -_70)) else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then inc(Gear^.Damage, hwRound(Gear^.dX * -_70)); - + if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then begin vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); @@ -1505,9 +1493,9 @@ procedure doStepSMine(Gear: PGear); begin // TODO: do real calculation? - if TestCollisionXwithGear(Gear, 2) - or (TestCollisionYwithGear(Gear, -2) <> 0) - or TestCollisionXwithGear(Gear, -2) + if TestCollisionXwithGear(Gear, 2) + or (TestCollisionYwithGear(Gear, -2) <> 0) + or TestCollisionXwithGear(Gear, -2) or (TestCollisionYwithGear(Gear, 2) <> 0) then begin if (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then @@ -1582,14 +1570,14 @@ Try tweaking friction some more *) procedure doStepRollingBarrel(Gear: PGear); -var +var i: LongInt; particle: PVisualGear; begin if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and (TestCollisionYwithGear(Gear, 1) = 0) then SetLittle(Gear^.dY); Gear^.State := Gear^.State or gstAnimation; - + if ((Gear^.dX.QWordValue <> 0) or (Gear^.dY.QWordValue <> 0)) then begin @@ -1608,10 +1596,10 @@ end else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then inc(Gear^.Damage, hwRound(Gear^.dX * _70)) - + else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then inc(Gear^.Damage, hwRound(Gear^.dY * -_70)) - + else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then inc(Gear^.Damage, hwRound(Gear^.dX * -_70)); @@ -1660,7 +1648,7 @@ end; procedure doStepCase(Gear: PGear); -var +var i, x, y: LongInt; k: TGearType; exBoom: boolean; @@ -1701,7 +1689,7 @@ exBoom := true; end else - begin + begin if (Gear^.Pos <> posCaseHealth) and (GameTicks and $1FFF = 0) then // stir 'em up periodically begin gi := GearsList; @@ -1738,12 +1726,12 @@ sparkles^.dX:= 0; sparkles^.dY:= 0; sparkles^.Angle:= 270; - if Gear^.Tag = 1 then + if Gear^.Tag = 1 then sparkles^.Tint:= $3744D7FF else sparkles^.Tint:= $FAB22CFF end; end; - if Gear^.Timer < 1000 then + if Gear^.Timer < 1000 then begin AllInactive:= false; exit @@ -1802,7 +1790,7 @@ if Gear^.dY > _0_2 then for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); - + Gear^.dY := - Gear^.dY * Gear^.Elasticity; if Gear^.dY > - _0_001 then Gear^.dY := _0 @@ -1856,7 +1844,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepShover(Gear: PGear); -var +var HHGear: PGear; begin HHGear := Gear^.Hedgehog^.Gear; @@ -1872,7 +1860,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepWhip(Gear: PGear); -var +var HHGear: PGear; i: LongInt; begin @@ -1894,7 +1882,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepFlame(Gear: PGear); -var +var gX,gY,i: LongInt; sticky: Boolean; vgt: PVisualGear; @@ -1921,10 +1909,10 @@ if Gear^.dX.QWordValue > _0_01.QWordValue then Gear^.dX := Gear^.dX * _0_995; - + Gear^.dY := Gear^.dY + cGravity; // if sticky then Gear^.dY := Gear^.dY + cGravity; - + if Gear^.dY.QWordValue > _0_2.QWordValue then Gear^.dY := Gear^.dY * _0_995; @@ -1985,13 +1973,13 @@ Gear^.Radius := 1; end else if ((GameTicks and $3) = 3) then - doMakeExplosion(gX, gY, 8, Gear^.Hedgehog, 0);//, EXPLNoDamage); + doMakeExplosion(gX, gY, 8, Gear^.Hedgehog, 0);//, EXPLNoDamage); //DrawExplosion(gX, gY, 4); - + if ((GameTicks and $7) = 0) and (Random(2) = 0) then for i:= Random(2) downto 0 do AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); - + if Gear^.Health > 0 then dec(Gear^.Health); Gear^.Timer := 450 - Gear^.Tag * 8 @@ -2034,7 +2022,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepFirePunchWork(Gear: PGear); -var +var HHGear: PGear; begin AllInactive := false; @@ -2071,7 +2059,7 @@ end; procedure doStepFirePunch(Gear: PGear); -var +var HHGear: PGear; begin AllInactive := false; @@ -2094,7 +2082,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepParachuteWork(Gear: PGear); -var +var HHGear: PGear; begin HHGear := Gear^.Hedgehog^.Gear; @@ -2123,13 +2111,13 @@ if (Gear^.Message and gmLeft) <> 0 then HHGear^.X := HHGear^.X - cMaxWindSpeed * 80 - + else if (Gear^.Message and gmRight) <> 0 then HHGear^.X := HHGear^.X + cMaxWindSpeed * 80; - + if (Gear^.Message and gmUp) <> 0 then HHGear^.Y := HHGear^.Y - cGravity * 40 - + else if (Gear^.Message and gmDown) <> 0 then HHGear^.Y := HHGear^.Y + cGravity * 40; @@ -2142,7 +2130,7 @@ end; procedure doStepParachute(Gear: PGear); -var +var HHGear: PGear; begin HHGear := Gear^.Hedgehog^.Gear; @@ -2169,7 +2157,7 @@ if (Gear^.Health > 0)and(not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then begin dec(Gear^.Health); - case Gear^.State of + case Gear^.State of 0: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); 1: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed * Gear^.Tag, _0, 0); 2: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtNapalmBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); @@ -2212,7 +2200,7 @@ // calcs for Napalm Strike, so that it will hit the target (without wind at least :P) if (Gear^.State = 2) then - Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900 + Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900 // calcs for regular falling gears else if (int2hwFloat(Gear^.Target.Y) - Gear^.Y > _0) then Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(Gear^.Target.Y) - Gear^.Y) * 2 / @@ -2246,7 +2234,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepGirder(Gear: PGear); -var +var HHGear: PGear; x, y, tx, ty: hwFloat; begin @@ -2268,7 +2256,7 @@ isCursorVisible := true; DeleteGear(Gear) end - else + else begin PlaySound(sndPlaced); DeleteGear(Gear); @@ -2281,7 +2269,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepTeleportAfter(Gear: PGear); -var +var HHGear: PGear; begin HHGear := Gear^.Hedgehog^.Gear; @@ -2315,7 +2303,7 @@ end; procedure doStepTeleport(Gear: PGear); -var +var HHGear: PGear; begin AllInactive := false; @@ -2356,7 +2344,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepSwitcherWork(Gear: PGear); -var +var HHGear: PGear; hedgehog: PHedgehog; State: Longword; @@ -2391,12 +2379,12 @@ repeat CurrentTeam^.CurrHedgehog := Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber); - until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and - (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0) and + until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and + (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen]=0); SwitchCurrentHedgehog(@CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]); - AmmoMenuInvalidated:= true; + AmmoMenuInvalidated:= true; HHGear := CurrentHedgehog^.Gear; HHGear^.State := State; @@ -2410,7 +2398,7 @@ end; procedure doStepSwitcher(Gear: PGear); -var +var HHGear: PGear; begin Gear^.doStep := @doStepSwitcherWork; @@ -2426,7 +2414,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepMortar(Gear: PGear); -var +var dX, dY, gdX, gdY: hwFloat; i: LongInt; dxn, dyn: boolean; @@ -2461,7 +2449,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepKamikazeWork(Gear: PGear); -var +var i: LongWord; HHGear: PGear; sparkles: PVisualGear; @@ -2496,7 +2484,7 @@ i := 2; repeat - + Gear^.X := Gear^.X + HHGear^.dX; Gear^.Y := Gear^.Y + HHGear^.dY; HHGear^.X := Gear^.X; @@ -2579,7 +2567,7 @@ end; procedure doStepKamikaze(Gear: PGear); -var +var HHGear: PGear; begin AllInactive := false; @@ -2600,7 +2588,7 @@ //////////////////////////////////////////////////////////////////////////////// const cakeh = 27; -var +var CakePoints: array[0..Pred(cakeh)] of record x, y: hwFloat; end; @@ -2620,7 +2608,7 @@ end; procedure doStepCakeDown(Gear: PGear); -var +var gi: PGear; dmg, dmgBase: LongInt; fX, fY, tdX, tdY: hwFloat; @@ -2706,7 +2694,7 @@ end; procedure doStepCakeUp(Gear: PGear); -var +var i: Longword; begin AllInactive := false; @@ -2746,7 +2734,7 @@ end; procedure doStepCake(Gear: PGear); -var +var HHGear: PGear; begin AllInactive := false; @@ -2850,7 +2838,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepWaterUp(Gear: PGear); -var +var i: LongWord; begin if (Gear^.Tag = 0) @@ -2884,28 +2872,28 @@ forward; procedure doStepDrillDrilling(Gear: PGear); -var +var t: PGearArray; - ox, oy: hwFloat; - tempColl: Word; + tempColl: Word; begin AllInactive := false; - - if (Gear^.Timer > 0) and ((Gear^.Timer mod 10) = 0) then - begin - ox := Gear^.X; - oy := Gear^.Y; - Gear^.X := Gear^.X + Gear^.dX; - Gear^.Y := Gear^.Y + Gear^.dY; - DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6); - if (Gear^.Timer mod 30) = 0 then - AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust); - if (CheckGearDrowning(Gear)) then - begin - StopSoundChan(Gear^.SoundChannel); - exit - end + if (Gear^.Timer > 0) and (Gear^.Timer mod 10 <> 0) then + begin + dec(Gear^.Timer); + exit; + end; + + DrawTunnel(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 2, 6); + Gear^.X := Gear^.X + Gear^.dX; + Gear^.Y := Gear^.Y + Gear^.dY; + if (Gear^.Timer mod 30) = 0 then + AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust); + if (CheckGearDrowning(Gear)) then + begin + StopSoundChan(Gear^.SoundChannel); + exit end; + tempColl:= Gear^.CollisionMask; Gear^.CollisionMask:= $007F; if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) <> 0) or TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) or (GameTicks > Gear^.FlightTime) then @@ -2913,7 +2901,7 @@ else t := nil; Gear^.CollisionMask:= tempColl; //fixes drill not exploding when touching HH bug - + if (Gear^.Timer = 0) or ((t <> nil) and (t^.Count <> 0)) or ( ((Gear^.State and gsttmpFlag) = 0) and (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))) // CheckLandValue returns true if the type isn't matched @@ -2928,7 +2916,7 @@ DeleteGear(Gear); exit end - + else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then begin StopSoundChan(Gear^.SoundChannel); @@ -2940,7 +2928,7 @@ end; procedure doStepDrill(Gear: PGear); -var +var t: PGearArray; oldDx, oldDy: hwFloat; t2: hwFloat; @@ -2964,7 +2952,7 @@ Gear^.dX := oldDx; Gear^.dY := oldDy; - if GameTicks > Gear^.FlightTime then + if GameTicks > Gear^.FlightTime then t := CheckGearsCollision(Gear) else t := nil; @@ -2975,7 +2963,7 @@ Gear^.dX := Gear^.dX * t2; Gear^.dY := Gear^.dY * t2; end - + else if (t <> nil) then begin //explode right on contact with HH @@ -2989,14 +2977,14 @@ Gear^.SoundChannel := LoopSound(sndDrillRocket); Gear^.doStep := @doStepDrillDrilling; - + if (Gear^.State and gsttmpFlag) <> 0 then gear^.RenderTimer:= true; if Gear^.Timer > 0 then dec(Gear^.Timer) end else if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Tag <> 0) then begin - if Gear^.Timer > 0 then + if Gear^.Timer > 0 then dec(Gear^.Timer) else begin @@ -3008,7 +2996,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepBallgunWork(Gear: PGear); -var +var HHGear, ball: PGear; rx, ry: hwFloat; gX, gY: LongInt; @@ -3038,7 +3026,7 @@ end; procedure doStepBallgun(Gear: PGear); -var +var HHGear: PGear; begin HHGear := Gear^.Hedgehog^.Gear; @@ -3051,7 +3039,7 @@ procedure doStepRCPlaneWork(Gear: PGear); const cAngleSpeed = 3; -var +var HHGear: PGear; i: LongInt; dX, dY: hwFloat; @@ -3160,7 +3148,7 @@ begin if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft; - + TurnTimeLeft:= 14 * 125; end; @@ -3170,7 +3158,7 @@ end; procedure doStepRCPlane(Gear: PGear); -var +var HHGear: PGear; begin HHGear := Gear^.Hedgehog^.Gear; @@ -3178,7 +3166,7 @@ HHGear^.State := HHGear^.State or gstNotKickable; Gear^.Angle := HHGear^.Angle; Gear^.Tag := hwSign(HHGear^.dX); - + if HHGear^.dX.isNegative then Gear^.Angle := 4096 - Gear^.Angle; Gear^.doStep := @doStepRCPlaneWork @@ -3186,7 +3174,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepJetpackWork(Gear: PGear); -var +var HHGear: PGear; fuel, i: LongInt; move: hwFloat; @@ -3265,9 +3253,9 @@ if Gear^.Health < 0 then Gear^.Health := 0; - + i:= Gear^.Health div 20; - + if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then begin Gear^.Damage:= i; @@ -3276,9 +3264,9 @@ Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(i) + '%', cWhiteColor, fntSmall) end; - if HHGear^.Message and (gmAttack or gmUp or gmPrecise or gmLeft or gmRight) <> 0 then + if HHGear^.Message and (gmAttack or gmUp or gmPrecise or gmLeft or gmRight) <> 0 then Gear^.State := Gear^.State and (not gsttmpFlag); - + HHGear^.Message := HHGear^.Message and (not (gmUp or gmPrecise or gmLeft or gmRight)); HHGear^.State := HHGear^.State or gstMoving; @@ -3288,7 +3276,7 @@ if not isUnderWater and hasBorder and ((HHGear^.X < _0) or (hwRound(HHGear^.X) > LAND_WIDTH)) then HHGear^.dY.isNegative:= false; - + if ((Gear^.State and gsttmpFlag) = 0) or (HHGear^.dY < _0) then doStepHedgehogMoving(HHGear); @@ -3320,7 +3308,7 @@ end; procedure doStepJetpack(Gear: PGear); -var +var HHGear: PGear; begin Gear^.Pos:= 0; @@ -3333,7 +3321,7 @@ begin State := State and (not gstAttacking); Message := Message and (not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight)); - + if (dY < _0_1) and (dY > -_0_1) then begin Gear^.State := Gear^.State or gsttmpFlag; @@ -3356,13 +3344,13 @@ end; procedure doStepBirdyFly(Gear: PGear); -var +var HHGear: PGear; fuel, i: LongInt; move: hwFloat; begin HHGear := Gear^.Hedgehog^.Gear; - if HHGear = nil then + if HHGear = nil then begin DeleteGear(Gear); exit @@ -3386,11 +3374,11 @@ if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then HHGear^.dY := HHGear^.dY - move; - + dec(Gear^.Health, fuel); Gear^.MsgParam := Gear^.MsgParam or gmUp; end; - + if (HHGear^.Message and gmLeft) <> 0 then move.isNegative := true; if (HHGear^.Message and (gmLeft or gmRight)) <> 0 then begin @@ -3401,7 +3389,7 @@ if Gear^.Health < 0 then Gear^.Health := 0; - + if ((GameTicks and $FF) = 0) and (Gear^.Health < 500) then for i:= ((500-Gear^.Health) div 250) downto 0 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFeather); @@ -3419,7 +3407,7 @@ if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then Gear^.State := Gear^.State and (not gsttmpFlag); - + HHGear^.Message := HHGear^.Message and (not (gmUp or gmPrecise or gmLeft or gmRight)); HHGear^.State := HHGear^.State or gstMoving; @@ -3462,7 +3450,7 @@ end; procedure doStepBirdyDescend(Gear: PGear); -var +var HHGear: PGear; begin if Gear^.Timer > 0 then @@ -3503,12 +3491,12 @@ end; procedure doStepBirdy(Gear: PGear); -var +var HHGear: PGear; begin gear^.State := gear^.State or gstAnimation and (not gstTmpFlag); Gear^.doStep := @doStepBirdyAppear; - + if CurrentHedgehog = nil then begin DeleteGear(Gear); @@ -3533,7 +3521,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepEggWork(Gear: PGear); -var +var vg: PVisualGear; i: LongInt; begin @@ -3574,18 +3562,18 @@ if (CurAmmoType = amPortalGun) then begin CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and (not gmSwitch); - + CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); if CurWeapon^.Pos <> 0 then CurWeapon^.Pos := 0 - + else CurWeapon^.Pos := 1; end; end; procedure doStepPortal(Gear: PGear); -var +var iterator, conPortal: PGear; s, r, nx, ny, ox, oy, poffs, noffs, pspeed, nspeed, resetx, resety, resetdx, resetdy: hwFloat; @@ -3886,7 +3874,7 @@ resetx.QWordValue:= 4294967296 * 35; resetdx.isNegative:= false; resetdx.QWordValue:= 4294967296 * 1152; - + resetdy:=hwAbs(iterator^.dX*4); resetdy:= resetdy + hwPow(resetdy,3)/_6 + _3 * hwPow(resetdy,5) / _40 + _5 * hwPow(resetdy,7) / resety + resetx * hwPow(resetdy,9) / resetdx; iterator^.Angle:= hwRound(resetdy*_2048 / _PI); @@ -3907,7 +3895,7 @@ and (CurAmmoGear^.Kind =gtRope) then CurAmmoGear^.PortalCounter:= 1; - if not isbullet and (iterator^.State and gstInvisible = 0) + if not isbullet and (iterator^.State and gstInvisible = 0) and (iterator^.Kind <> gtFlake) then FollowGear := iterator; @@ -3953,7 +3941,7 @@ end; procedure doStepMovingPortal_real(Gear: PGear); -var +var x, y, tx, ty: LongInt; s: hwFloat; begin @@ -3967,7 +3955,7 @@ begin Gear^.State := Gear^.State or gstCollision; Gear^.State := Gear^.State and (not gstMoving); - + if (Land[y, x] and lfBouncy <> 0) or (not CalcSlopeTangent(Gear, x, y, tx, ty, 255)) or (DistanceI(tx,ty) < _12) then // reject shots at too irregular terrain @@ -3995,7 +3983,7 @@ else loadNewPortalBall(Gear, true); end - + else if (y > cWaterLine) or (y < -max(LAND_WIDTH,4096)) or (x > 2*max(LAND_WIDTH,4096)) @@ -4007,13 +3995,13 @@ begin doPortalColorSwitch(); doStepPerPixel(Gear, @doStepMovingPortal_real, true); - if (Gear^.Timer < 1) + if (Gear^.Timer < 1) or (Gear^.Hedgehog^.Team <> CurrentHedgehog^.Team) then deleteGear(Gear); end; procedure doStepPortalShot(newPortal: PGear); -var +var iterator: PGear; s: hwFloat; CurWeapon: PAmmo; @@ -4093,15 +4081,15 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepPiano(Gear: PGear); -var +var r0, r1: LongInt; odY: hwFloat; begin AllInactive := false; - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and + if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.Message and gmSlot) <> 0) then begin - case CurrentHedgehog^.Gear^.MsgParam of + case CurrentHedgehog^.Gear^.MsgParam of 0: PlaySound(sndPiano0); 1: PlaySound(sndPiano1); 2: PlaySound(sndPiano2); @@ -4181,7 +4169,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepSineGunShotWork(Gear: PGear); -var +var x, y, rX, rY, t, tmp, initHealth: LongInt; oX, oY, ldX, ldY, sdX, sdY, sine, lx, ly, amp: hwFloat; justCollided: boolean; @@ -4276,7 +4264,7 @@ end; if random(100) = 0 then - AddVisualGear(x, y, vgtSmokeTrace); + AddVisualGear(x, y, vgtSmokeTrace); end else dec(Gear^.Health, 5); // if underwater get additional damage end; @@ -4314,7 +4302,7 @@ var HHGear: PGear; begin - PlaySound(sndSineGun); + PlaySound(sndSineGun); // push the shooting Hedgehog back HHGear := CurrentHedgehog^.Gear; @@ -4334,7 +4322,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepFlamethrowerWork(Gear: PGear); -var +var HHGear, flame: PGear; rx, ry, speed: hwFloat; i, gX, gY: LongInt; @@ -4344,7 +4332,7 @@ HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); - + if (GameTicks and $FF) = 0 then begin if (HHGear^.Message and gmRight) <> 0 then @@ -4358,11 +4346,11 @@ begin if HHGear^.dX.isNegative and (Gear^.Tag > 5) then dec(Gear^.Tag) - else if Gear^.Tag < 20 then + else if Gear^.Tag < 20 then inc(Gear^.Tag); end end; - + dec(Gear^.Timer); if Gear^.Timer = 0 then begin @@ -4372,12 +4360,12 @@ rx := rndSign(getRandomf * _0_1); ry := rndSign(getRandomf * _0_1); speed := _0_5 * (_10 / Gear^.Tag); - + flame:= AddGear(gx, gy, gtFlame, gstTmpFlag, SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); flame^.CollisionMask:= lfNotCurrentMask; - + if (Gear^.Health mod 30) = 0 then begin flame:= AddGear(gx, gy, gtFlame, 0, @@ -4408,7 +4396,7 @@ end; procedure doStepFlamethrower(Gear: PGear); -var +var HHGear: PGear; begin HHGear := Gear^.Hedgehog^.Gear; @@ -4419,7 +4407,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepLandGunWork(Gear: PGear); -var +var HHGear, land: PGear; rx, ry, speed: hwFloat; i, gX, gY: LongInt; @@ -4429,7 +4417,7 @@ HedgehogChAngle(HHGear); gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); - + if (GameTicks and $FF) = 0 then begin if (HHGear^.Message and gmRight) <> 0 then @@ -4447,7 +4435,7 @@ inc(Gear^.Tag); end end; - + dec(Gear^.Timer); if Gear^.Timer = 0 then begin @@ -4457,11 +4445,11 @@ ry := rndSign(getRandomf * _0_1); speed := (_3 / Gear^.Tag); - land:= AddGear(gx, gy, gtFlake, gstTmpFlag, - SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, + land:= AddGear(gx, gy, gtFlake, gstTmpFlag, + SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); land^.CollisionMask:= lfNotCurrentMask; - + Gear^.Timer:= Gear^.Tag end; @@ -4485,7 +4473,7 @@ end; procedure doStepLandGun(Gear: PGear); -var +var HHGear: PGear; begin HHGear := Gear^.Hedgehog^.Gear; @@ -4554,7 +4542,7 @@ end; procedure doStepHammerHitWork(Gear: PGear); -var +var i, j, ei: LongInt; HitGear: PGear; begin @@ -4610,7 +4598,7 @@ end; procedure doStepHammerHit(Gear: PGear); -var +var i, y: LongInt; ar: TRangeArray; HHGear: PGear; @@ -4660,7 +4648,7 @@ begin if (GameTicks and $F) <> 0 then exit; - end + end else if (GameTicks and $1FF) <> 0 then exit; @@ -4697,8 +4685,8 @@ inc(graves[i]^.Health); end; end; -} - end - else + end + else begin // now really resurrect the hogs with the hp saved in the graves for i:= 0 to graves.size - 1 do @@ -4757,9 +4745,9 @@ RecountTeamHealth(hh^.Team); inc(graves.ar^[Gear^.Tag]^.Health); inc(Gear^.Tag) - end - end - else + end + end + else begin StopSoundChan(Gear^.SoundChannel); Gear^.Timer := 250; @@ -4779,7 +4767,7 @@ begin doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, Gear^.Hedgehog, EXPLAutoSound); gX := hwRound(Gear^.X); - gY := hwRound(Gear^.Y); + gY := hwRound(Gear^.Y); for i:= 0 to 10 do begin dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandomf + _1); @@ -4807,7 +4795,7 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepStructure(Gear: PGear); -var +var x, y: LongInt; HH: PHedgehog; t: PGear; @@ -4824,7 +4812,7 @@ dec(Gear^.Health, Gear^.Damage); Gear^.Damage:= 0; - + if Gear^.Pos = 1 then begin AddGearCI(Gear); @@ -4835,7 +4823,7 @@ HideHog(HH); Gear^.Pos:= 2 end; - + if Gear^.Pos = 2 then begin if ((GameTicks mod 100) = 0) and (Gear^.Timer < 1000) then @@ -4851,7 +4839,7 @@ if Gear^.Tag <= TotalRounds then Gear^.Pos:= 3; end; - + if Gear^.Pos = 3 then if Gear^.Timer < 1000 then begin @@ -4869,7 +4857,7 @@ RestoreHog(HH); Gear^.Pos:= 4; end; - + if Gear^.Pos = 4 then if ((GameTicks mod 1000) = 0) and ((GameFlags and gfInvulnerable) = 0) then begin @@ -4881,12 +4869,12 @@ t:= t^.NextGear; end; end; - + if Gear^.Health <= 0 then begin if HH^.GearHidden <> nil then RestoreHog(HH); - + x := hwRound(Gear^.X); y := hwRound(Gear^.Y); @@ -4899,7 +4887,7 @@ //////////////////////////////////////////////////////////////////////////////// (* - TARDIS needs + TARDIS needs Warp in. Pos = 1 Pause. Pos = 2 Hide gear (TARDIS hedgehog was nil) @@ -4925,7 +4913,7 @@ begin AfterAttack; if Gear = CurAmmoGear then CurAmmoGear := nil; - if (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and + if (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and ((Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then HideHog(HH) end @@ -4945,7 +4933,7 @@ if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then begin inc(Gear^.Power); - if (Gear^.Power = 172) and (HH^.Gear <> nil) and + if (Gear^.Power = 172) and (HH^.Gear <> nil) and (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and ((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then with HH^.Gear^ do @@ -4986,7 +4974,7 @@ begin if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true); - + if HH^.GearHidden <> nil then begin Gear^.X:= HH^.GearHidden^.X; @@ -5062,7 +5050,7 @@ WIP. The ice gun will have the following effects. It has been proposed by sheepluva that it take the appearance of a large freezer spewing ice cubes. The cubes will be visual gears only. The scatter from them and the impact snow dust should help hide imprecisions in things like the GearsNear effect. For now we assume a "ray" like a deagle projected out from the gun. -All these effects assume the ray's angle is not changed and that the target type was unchanged over a number of ticks. This is a simplifying assumption for "gun was applying freezing effect to the same target". +All these effects assume the ray's angle is not changed and that the target type was unchanged over a number of ticks. This is a simplifying assumption for "gun was applying freezing effect to the same target". * When fired at water a layer of ice textured land is added above the water. * When fired at non-ice land (land and lfLandMask and not lfIce) the land is overlaid with a thin layer of ice textured land around that point (say, 1 or 2px into land, 1px above). For attractiveness, a slope would probably be needed. * When fired at a hog (land and $00FF <> 0), while the hog is targetted, the hog's state is set to frozen. As long as the gun is on the hog, a frozen hog sprite creeps up from the feet to the head. If the effect is interrupted before reaching the top, the freezing state is cleared. @@ -5072,7 +5060,7 @@ procedure updateFuel(Gear: PGear); -var +var t:LongInt; begin t:= Gear^.Health div 10; @@ -5105,16 +5093,15 @@ iter := GearsList; while iter <> nil do begin - if (iter^.Kind = gtHedgehog) and - (iter^.Hedgehog^.Effects[heFrozen] and $FF = 0) then + if (iter^.Kind = gtHedgehog) and + (iter^.Hedgehog^.Effects[heFrozen] and $FF = 0) then iter^.Hedgehog^.Effects[heFrozen]:= 0; iter:= iter^.NextGear - end + end *) end; end; - procedure doStepIceGun(Gear: PGear); const iceWaitCollision:Longint = 0; const iceCollideWithGround:Longint = 1; @@ -5146,41 +5133,38 @@ HedgehogChAngle(HHGear); ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; ndY:= -AngleCos(HHGear^.Angle) * _4; - if (ndX <> dX) or (ndY <> dY) or - ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and + if (ndX <> dX) or (ndY <> dY) or + ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0))) then begin - updateTarget(Gear, ndX, ndY); - IceState := iceWaitCollision; + updateTarget(Gear, ndX, ndY); + Timer := iceWaitCollision; end else begin X:= X + dX; Y:= Y + dY; gX:= hwRound(X); - gY:= hwRound(Y); - if Target.X = NoPointX then - begin - t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); - end; + gY:= hwRound(Y); + if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); if Target.X <> NoPointX then - begin + begin CheckCollisionWithLand(Gear); if (State and gstCollision) <> 0 then - begin - if IceState = iceWaitCollision then begin - IceState := iceCollideWithGround; - IceTime := GameTicks; - end - end + if Timer = iceWaitCollision then + begin + Timer := iceCollideWithGround; + Power := GameTicks; + end + end else if (target.y >= cWaterLine) then begin - if IceState = iceWaitCollision then + if Timer = iceWaitCollision then begin - IceState := iceCollideWithWater; - IceTime := GameTicks; + Timer := iceCollideWithWater; + Power := GameTicks; end; end; @@ -5190,25 +5174,25 @@ Y:= HHGear^.Y end; - if (IceState = iceCollideWithGround) and ((GameTicks - IceTime) > groundFreezingTime) then - begin + if (Timer = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then + begin FillRoundInLand(target.x, target.y, iceRadius, icePixel); landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1); landRect.y := min(max(target.y - iceRadius, 0), LAND_HEIGHT - 1); landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1); landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1); UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); - + // FillRoundInLandWithIce(Target.X, Target.Y, iceRadius); SetAllHHToActive; - IceState := iceWaitCollision; + Timer := iceWaitCollision; end; - if (IceState = iceCollideWithWater) and ((GameTicks - IceTime) > groundFreezingTime) then - begin + if (Timer = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime) then + begin DrawIceBreak(Target.X, cWaterLine - iceHeight, iceRadius, iceHeight); - SetAllHHToActive; - IceState := iceWaitCollision; + SetAllHHToActive; + Timer := iceWaitCollision; end; // freeze nearby hogs @@ -5216,7 +5200,7 @@ if hogs.size > 0 then for i:= 0 to hogs.size - 1 do if hogs.ar^[i] <> HHGear then - if GameTicks mod 5 = 0 then + if GameTicks mod 5 = 0 then begin hogs.ar^[i]^.Active:= true; if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] < 256 then @@ -5225,16 +5209,16 @@ hogs.ar^[i]^.Hedgehog^.Effects[heFrozen]:= 200000;//cHedgehogTurnTime + cReadyDelay end; inc(Pos) - end + end else if (t > 400) and ((gY > cWaterLine) or (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) and (Land[gY, gX] <> 0))) then - begin + begin Target.X:= gX; Target.Y:= gY; X:= HHGear^.X; Y:= HHGear^.Y - end; + end; {if (gX > max(LAND_WIDTH,4096)*2) or (gX < -max(LAND_WIDTH,4096)) or (gY < -max(LAND_HEIGHT,4096)) or @@ -5318,7 +5302,7 @@ DeleteGear(Gear) end; // ssssss he essssscaped - if (Gear^.Timer > 250) and ((HHGear = nil) or + if (Gear^.Timer > 250) and ((HHGear = nil) or (((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) > 180) and (Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > _180))) then begin @@ -5329,7 +5313,7 @@ end; // Search out a new target, as target seek time has expired, target is dead, target is out of range, or we did not have a target -if (HHGear = nil) or (Gear^.Timer = 0) or +if (HHGear = nil) or (Gear^.Timer = 0) or (((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) > Gear^.Angle) and (Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > int2hwFloat(Gear^.Angle))) then @@ -5446,7 +5430,7 @@ This didn't end up getting used, but, who knows, might be reasonable for javellin or something // Make the knife initial angle based on the hog attack angle, or is that too hard? procedure doStepKnife(Gear: PGear); -var t, +var t, gx, gy, ga, // gear x,y,angle lx, ly, la, // land x,y,angle ox, oy, // x,y offset @@ -5470,7 +5454,7 @@ begin if CheckLandValue(gx, gy, lfLandMask) then begin - t:= Angle + hwRound((hwAbs(dX)+hwAbs(dY)) * _10); + t:= Angle + hwRound((hwAbs(dX)+hwAbs(dY)) * _10); if t < 0 then inc(t, 4096) else if 4095 < t then dec(t, 4096); @@ -5507,7 +5491,7 @@ 4: begin ox:= 29; oy:= 8; w:= 19; h:= 19; - tx:= 0; ty:= 17 + tx:= 0; ty:= 17 end; 5: begin ox:= 29; oy:= 32; @@ -5517,7 +5501,7 @@ 6: begin ox:= 51; oy:= 3; w:= 11; h:= 23; - tx:= 0; ty:= 22 + tx:= 0; ty:= 22 end; 7: begin ox:= 51; oy:= 34; @@ -5525,7 +5509,7 @@ tx:= 0; ty:= 23 end end; - + surf:= SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, RMask, GMask, BMask, AMask); copyToXYFromRect(SpritesData[sprKnife].Surface, surf, ox, oy, w, h, 0, 0); // try to make the knife hit point first @@ -5547,7 +5531,7 @@ AddFileLog('la: '+inttostr(la)+' ga: '+inttostr(ga)+' Angle: '+inttostr(Angle)) end; case Angle div 1024 of - 0: begin + 0: begin flipSurface(surf, true); flipSurface(surf, true); BlitImageAndGenerateCollisionInfo(gx-(w-tx), gy-(h-ty), w, surf) diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/LuaPas.pas --- a/hedgewars/LuaPas.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/LuaPas.pas Sun Apr 07 22:53:40 2013 +0200 @@ -15,9 +15,7 @@ {.$DEFINE LUA_GETHOOK} type -{$IFNDEF PAS2C} size_t = Cardinal; -{$ENDIF} Psize_t = ^size_t; PPointer = ^Pointer; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/SDLh.pas Sun Apr 07 22:53:40 2013 +0200 @@ -946,12 +946,11 @@ procedure SDL_StartTextInput; cdecl; external SDLLibName; function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName; -function SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName; {$ELSE} -function SDL_CreateThread(fn: Pointer; data: Pointer): PSDL_Thread; cdecl; external SDLLibName; function SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; mask: LongWord): LongInt; cdecl; external SDLLibName; {$ENDIF} + function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; function SDL_GetKeyName(key: LongWord): PChar; cdecl; external SDLLibName; function SDL_GetScancodeName(key: LongWord): PChar; cdecl; external SDLLibName; @@ -969,7 +968,13 @@ procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; function SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName; + +// remember to mark the threaded functions as 'cdecl; export;' +// (or have fun debugging nil arguments) +function SDL_CreateThread(fn: Pointer; {$IFDEF SDL13}name: PChar;{$ENDIF} data: Pointer): PSDL_Thread; cdecl; external SDLLibName; procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName; +procedure SDL_KillThread(thread: PSDL_Thread); cdecl; external SDLLibName; + function SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName; procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName; function SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP'; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/hwengine.pas Sun Apr 07 22:53:40 2013 +0200 @@ -122,11 +122,7 @@ if flagMakeCapture then begin flagMakeCapture:= false; - {$IFDEF PAS2C} - s:= '/Screenshots/hw'; - {$ELSE} s:= '/Screenshots/hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks); - {$ENDIF} // flash playSound(sndShutter); @@ -169,7 +165,7 @@ if GameState = gsChat then begin // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3 - KeyPressChat(SDL_GetKeyFromScancode(event.key.keysym.sym, event.key.keysym.sym)//TODO correct for keymodifiers + KeyPressChat(SDL_GetKeyFromScancode(event.key.keysym.sym), event.key.keysym.sym); //TODO correct for keymodifiers end else ProcessKey(event.key); diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/options.inc --- a/hedgewars/options.inc Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/options.inc Sun Apr 07 22:53:40 2013 +0200 @@ -29,10 +29,8 @@ {$DEFINE USE_LUA_SCRIPT} - {$IFDEF ANDROID} {$DEFINE MOBILE} - {$DEFINE USE_SDLTHREADS} {$DEFINE USE_CONTEXT_RESTORE} {$DEFINE Java_Prefix:= 'Java_org_hedgewars_hedgeroid_EngineProtocol_PascalExports_'} {$ENDIF} @@ -66,14 +64,12 @@ {$DEFINE SDL13} {$ENDIF} -{$IFDEF PAS2C} - {$DEFINE NOCONSOLE} - {$DEFINE USE_SDLTHREADS} -{$ENDIF} +//TODO: cruft to be removed {$DEFINE _S:=} {$DEFINE _P:=} + //{$DEFINE TRACEAIACTIONS} //{$DEFINE COUNTTICKS} diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/pas2c.h --- a/hedgewars/pas2c.h Tue Mar 26 18:52:42 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -typedef union string255_ - { - struct { - char s[256]; - }; - struct { - char len; - char str[255]; - }; - } string255; -typedef struct string192_ - { - char s[193]; - } string192; -typedef struct string31_ - { - char s[32]; - } string31; -typedef struct string15_ - { - char s[16]; - } string15; - -typedef string255 shortstring; -typedef string255 ansistring; - -typedef uint8_t Byte; -typedef int8_t ShortInt; -typedef uint16_t Word; -typedef int16_t SmallInt; -typedef uint32_t LongWord; -typedef int32_t LongInt; -typedef uint64_t QWord; -typedef int64_t Int64; -typedef LongWord Cardinal; - -typedef LongInt Integer; -typedef float extended; -typedef float real; -typedef float single; - -typedef bool boolean; -typedef int LongBool; - -typedef void * pointer; -typedef Byte * PByte; -typedef char * PChar; -typedef LongInt * PLongInt; -typedef LongWord * PLongWord; -typedef Integer * PInteger; -typedef int PtrInt; -typedef wchar_t widechar; - -#define new(a) __new((void **)&a, sizeof(*(a))) -void __new(void ** p, int size); -#define dispose(a) __dispose(a, sizeof(*(a))) -void __dispose(pointer p, int size); - -void * GetMem(int size); -void FreeMem(void * p, int size); - -#define FillChar(a, b, c) __FillChar(&(a), b, c) - -void __FillChar(pointer p, int size, char fill); -string255 _strconcat(string255 a, string255 b); -string255 _strappend(string255 s, char c); -string255 _strprepend(char c, string255 s); -string255 _chrconcat(char a, char b); -bool _strcompare(string255 a, string255 b); -bool _strcomparec(string255 a, char b); -bool _strncompare(string255 a, string255 b); -char * _pchar(string255 s); -string255 pchar2str(char * s); - -int Length(string255 a); -string255 copy(string255 a, int s, int l); -string255 delete(string255 a, int s, int l); -string255 trim(string255 a); - -#define STRINIT(a) {.len = sizeof(a) - 1, .str = a} - - -int length_ar(void * a); - -typedef int file; -typedef int TextFile; -extern int FileMode; -extern int IOResult; -extern int stdout; -extern int stderr; - -#define assign(a, b) assign_(&(a), b) -void assign_(int * f, string255 fileName); -void reset_1(int f, int size); -void reset_2(int f, int size); -#define BlockRead(a, b, c, d) BlockRead_(a, &(b), c, &(d)) -void BlockRead_(int f, void * p, int size, int * sizeRead); -#define BlockWrite(a, b, c) BlockWrite_(a, &(b), c) -void BlockWrite_(int f, void * p, int size); -void close(int f); - -void write(int f, string255 s); -void writeLn(int f, string255 s); - -bool DirectoryExists(string255 dir); -bool FileExists(string255 filename); - -bool odd(int i); - - -typedef int TThreadId; -void ThreadSwitch(); -#define InterlockedIncrement(a) __InterlockedIncrement(&(a)) -#define InterlockedDecrement(a) __InterlockedDecrement(&(a)) -void __InterlockedIncrement(int * a); -void __InterlockedDecrement(int * a); - -bool Assigned(void * a); - -void randomize(); -int random(int max); -int abs(int i); -double sqr(double n); -double sqrt(double n); -int trunc(double n); -int round(double n); - -string255 ParamStr(int n); -int ParamCount(); - -#define val(a, b, c) _val(a, (LongInt*)&(b), (LongInt*)&(c)) -void _val(string255 str, LongInt * a, LongInt * c); - -extern double pi; - -string255 EnumToStr(int a); -string255 ExtractFileName(string255 f); diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/pas2cSystem.pas --- a/hedgewars/pas2cSystem.pas Tue Mar 26 18:52:42 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -system; - -type - Integer = integer; - LongInt = integer; - LongWord = integer; - Cardinal = integer; - PtrInt = integer; - Word = integer; - Byte = integer; - SmallInt = integer; - ShortInt = integer; - QWord = integer; - GLint = integer; - GLuint = integer; - int = integer; - size_t = integer; - - pointer = pointer; - - float = float; - single = float; - double = float; - real = float; - extended = float; - GLfloat = float; - - boolean = boolean; - LongBool = boolean; - - string = string; - shortstring = string; - ansistring = string; - widechar = string; - - char = char; - PChar = ^char; - PPChar = ^Pchar; - - PByte = ^Byte; - PWord = ^Word; - PLongInt = ^LongInt; - PLongWord = ^LongWord; - PInteger = ^Integer; - - Handle = integer; - - png_structp = pointer; - png_size_t = integer; - -var - false, true: boolean; - - write, writeLn, read, readLn: procedure; - - StrLen, ord, Succ, Pred : function : integer; - inc, dec, Low, High, Lo, Hi : function : integer; - odd, even : function : boolean; - - Now : function : integer; - - new, dispose, FillChar, Move : procedure; - - trunc, round : function : integer; - abs, sqr : function : integer; - - StrPas, FormatDateTime, copy, delete, str, pos, trim, LowerCase : function : shortstring; - Length, StrToInt : function : integer; - SetLength, val : procedure; - _pchar : function : PChar; - pchar2str : function : string; - memcpy : procedure; - - assign, rewrite, reset, flush, BlockWrite, BlockRead, close : procedure; - IOResult : integer; - exit, break, halt, continue : procedure; - TextFile, file : Handle; - FileMode : integer; - FileExists, DirectoryExists, eof : function : boolean; - ExtractFileName : function : string; - exitcode : integer; - stdout, stderr : Handle; - - ParamCount : function : integer; - ParamStr : function : string; - - sqrt, arctan2, cos, sin, power : function : float; - pi : float; - - TypeInfo, GetEnumName : function : shortstring; - - UTF8ToUnicode, WrapText: function : shortstring; - - sizeof : function : integer; - - GetMem : function : pointer; - FreeMem : procedure; - - glGetString : function : pchar; - - glBegin, glBindTexture, glBlendFunc, glClear, glClearColor, - glColor4ub, glColorMask, glColorPointer, glDeleteTextures, - glDisable, glDisableClientState, glDrawArrays, glEnable, - glEnableClientState, glEnd, glGenTextures, glGetIntegerv, - glHint, glLineWidth, glLoadIdentity, glMatrixMode, glPopMatrix, - glPushMatrix, glReadPixels, glRotatef, glScalef, glTexCoord2f, - glTexCoordPointer, glTexImage2D, glTexParameterf, - glTexParameteri, glTranslatef, glVertex2d, glVertexPointer, - glViewport, glext_LoadExtension, glDeleteRenderbuffersEXT, - glDeleteFramebuffersEXT, glGenFramebuffersEXT, - glGenRenderbuffersEXT, glBindFramebufferEXT, - glBindRenderbufferEXT, glRenderbufferStorageEXT, - glFramebufferRenderbufferEXT, glFramebufferTexture2DEXT : procedure; - - GL_BGRA, GL_BLEND, GL_CLAMP_TO_EDGE, GL_COLOR_ARRAY, - GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_DEPTH_COMPONENT, - GL_DITHER, GL_EXTENSIONS, GL_FALSE, GL_FASTEST, GL_LINEAR, - GL_LINE_LOOP, GL_LINES, GL_LINE_SMOOTH, GL_LINE_STRIP, - GL_MAX_TEXTURE_SIZE, GL_MODELVIEW, GL_ONE_MINUS_SRC_ALPHA, - GL_PERSPECTIVE_CORRECTION_HINT, GL_PROJECTION, GL_QUADS, - GL_RENDERER, GL_RGBA, GL_RGBA8, GL_SRC_ALPHA, GL_TEXTURE_2D, - GL_TEXTURE_COORD_ARRAY, GL_TEXTURE_MAG_FILTER, - GL_TEXTURE_MIN_FILTER, GL_TEXTURE_PRIORITY, GL_TEXTURE_WRAP_S, - GL_TEXTURE_WRAP_T, GL_TRIANGLE_FAN, GL_TRUE, GL_VENDOR, - GL_VERSION, GL_VERTEX_ARRAY, GLenum, GL_FRAMEBUFFER_EXT, - GL_RENDERBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_COLOR_ATTACHMENT0_EXT, GL_FLOAT, GL_UNSIGNED_BYTE : integer; - - TThreadId : function : integer; - BeginThread, ThreadSwitch : procedure; - InterlockedIncrement, InterlockedDecrement : procedure; - - random : function : integer; - randomize : procedure; - - Assigned : function : boolean; - - _strconcat, _strappend, _strprepend, _chrconcat : function : string; - _strcompare, _strncompare, _strcomparec : function : boolean; - - png_structp, png_set_write_fn, png_get_io_ptr, - png_get_libpng_ver, png_create_write_struct, - png_create_info_struct, png_destroy_write_struct, - png_write_row, png_set_ihdr, png_write_info, - png_write_end : procedure; - - EnumToStr : function : string; - diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uAI.pas --- a/hedgewars/uAI.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uAI.pas Sun Apr 07 22:53:40 2013 +0200 @@ -30,31 +30,21 @@ implementation uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions, - uAmmos, SysUtils{$IFNDEF USE_SDLTHREADS} {$IFDEF UNIX}, cthreads{$ENDIF} {$ENDIF}, uTypes, + uAmmos, SysUtils, uTypes, uVariables, uCommands, uUtils, uDebug, uAILandMarks; var BestActions: TActions; CanUseAmmo: array [TAmmoType] of boolean; StopThinking: boolean; -{$IFDEF USE_SDLTHREADS} ThinkThread: PSDL_Thread = nil; -{$ELSE} - ThinkThread: TThreadID; -{$ENDIF} - hasThread: LongInt; StartTicks: Longword; procedure FreeActionsList; begin AddFileLog('FreeActionsList called'); - if hasThread <> 0 then - begin - AddFileLog('Waiting AI thread to finish'); - StopThinking:= true; - repeat - SDL_Delay(10) - until hasThread = 0 - end; + if (ThinkThread <> nil) then + SDL_WaitThread(ThinkThread, nil); + ThinkThread:=nil; with CurrentHedgehog^ do if Gear <> nil then @@ -66,7 +56,6 @@ end; - const cBranchStackSize = 12; type TStackEntry = record WastedTicks: Longword; @@ -123,15 +112,11 @@ with Me^.Hedgehog^ do a:= CurAmmoType; aa:= a; -{$IFDEF USE_SDLTHREADS} - SDL_delay(0); //ThreadSwitch was only a hint -{$ELSE} - ThreadSwitch(); -{$ENDIF} + SDL_delay(0); // hint to let the context switch run repeat - if (CanUseAmmo[a]) - and ((not rareChecks) or ((AmmoTests[a].flags and amtest_Rare) = 0)) - and ((i = 0) or ((AmmoTests[a].flags and amtest_NoTarget) = 0)) + if (CanUseAmmo[a]) + and ((not rareChecks) or ((AmmoTests[a].flags and amtest_Rare) = 0)) + and ((i = 0) or ((AmmoTests[a].flags and amtest_NoTarget) = 0)) then begin {$HINTS OFF} @@ -150,10 +135,10 @@ AddAction(BestActions, aia_LookRight, 0, 200, 0, 0) else if (ap.Angle < 0) then AddAction(BestActions, aia_LookLeft, 0, 200, 0, 0); - + if (Ammoz[a].Ammo.Propz and ammoprop_Timerable) <> 0 then AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0); - + if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then begin dAngle:= LongInt(Me^.Angle) - Abs(ap.Angle); @@ -168,23 +153,23 @@ AddAction(BestActions, aia_Down, aim_release, -dAngle, 0, 0) end end; - + if (Ammoz[a].Ammo.Propz and ammoprop_NeedTarget) <> 0 then begin AddAction(BestActions, aia_Put, 0, 1, ap.AttackPutX, ap.AttackPutY) end; - + if (Ammoz[a].Ammo.Propz and ammoprop_OscAim) <> 0 then begin AddAction(BestActions, aia_attack, aim_push, 350 + random(200), 0, 0); AddAction(BestActions, aia_attack, aim_release, 1, 0, 0); - + if abs(ap.Angle) > 32 then begin AddAction(BestActions, aia_Down, aim_push, 100 + random(150), 0, 0); AddAction(BestActions, aia_Down, aim_release, 32, 0, 0); end; - + AddAction(BestActions, aia_waitAngle, ap.Angle, 250, 0, 0); AddAction(BestActions, aia_attack, aim_push, 1, 0, 0); AddAction(BestActions, aia_attack, aim_release, 1, 0, 0); @@ -243,21 +228,21 @@ if (Me^.State and gstAttacked) = 0 then TestAmmos(Actions, Me, false); - + BestRate:= RatePlace(Me); BaseRate:= Max(BestRate, 0); -// switch to 'skip' if we can't move because of mouse cursor being shown +// switch to 'skip' if we cannot move because of mouse cursor being shown if (Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0 then AddAction(Actions, aia_Weapon, Longword(amSkip), 100 + random(200), 0, 0); - -if ((CurrentHedgehog^.MultiShootAttacks = 0) or ((Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoMoveAfter) = 0)) + +if ((CurrentHedgehog^.MultiShootAttacks = 0) or ((Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoMoveAfter) = 0)) and (GameFlags and gfArtillery = 0) then begin tmp:= random(2) + 1; Push(0, Actions, Me^, tmp); Push(0, Actions, Me^, tmp xor 3); - + while (Stack.Count > 0) and (not StopThinking) do begin Pop(ticks, Actions, Me^); @@ -267,7 +252,7 @@ AddAction(Actions, aia_WaitXL, hwRound(Me^.X), 0, 0, 0) else AddAction(Actions, aia_WaitXR, hwRound(Me^.X), 0, 0, 0); - + steps:= 0; while (not StopThinking) do @@ -280,8 +265,8 @@ if ticks > maxticks then break; - if (BotLevel < 5) - and (GoInfo.JumpType = jmpHJump) + if (BotLevel < 5) + and (GoInfo.JumpType = jmpHJump) and (not checkMark(hwRound(Me^.X), hwRound(Me^.Y), markHJumped)) then // hjump support begin @@ -295,7 +280,7 @@ AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0) else AddAction(MadeActions, aia_LookLeft, 0, 200, 0, 0); - + AddAction(MadeActions, aia_HJump, 0, 305 + random(50), 0, 0); AddAction(MadeActions, aia_HJump, 0, 350, 0, 0); end; @@ -303,8 +288,8 @@ Push(ticks, Stack.States[Pred(Stack.Count)].MadeActions, AltMe, Me^.Message) end; end; - if (BotLevel < 3) - and (GoInfo.JumpType = jmpLJump) + if (BotLevel < 3) + and (GoInfo.JumpType = jmpLJump) and (not checkMark(hwRound(Me^.X), hwRound(Me^.Y), markLJumped)) then // ljump support begin @@ -323,7 +308,7 @@ // push current position so we proceed from it after checking jump+forward walk opportunities if CanGo then Push(ticks, Actions, Me^, Me^.Message); - + // first check where we go after jump walking forward if Push(ticks, Actions, AltMe, Me^.Message) then with Stack.States[Pred(Stack.Count)] do @@ -331,10 +316,10 @@ break end; - // 'not CanGO' means we can't go straight, possible jumps are checked above + // 'not CanGO' means we cannot go straight, possible jumps are checked above if not CanGo then break; - + inc(steps); Actions.actions[Pred(Actions.Count)].Param:= hwRound(Me^.X); Rate:= RatePlace(Me); @@ -347,17 +332,17 @@ end else if Rate < BestRate then break; - + if ((Me^.State and gstAttacked) = 0) and ((steps mod 4) = 0) then begin if (steps > 4) and checkMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere) then - break; + break; addMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere); TestAmmos(Actions, Me, ticks shr 12 = oldticks shr 12); - + end; - + if GoInfo.FallPix >= FallPixForBranching then Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right end {while}; @@ -368,25 +353,26 @@ end {if} end; -function Think(Me: Pointer): ptrint; +function Think(Me: PGear): LongInt; cdecl; export; var BackMe, WalkMe: TGear; switchCount: LongInt; StartTicks, currHedgehogIndex, itHedgehog, switchesNum, i: Longword; switchImmediatelyAvailable: boolean; Actions: TActions; begin -InterlockedIncrement(hasThread); +AddFileLog('Thread started'); +dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent; StartTicks:= GameTicks; currHedgehogIndex:= CurrentTeam^.CurrHedgehog; itHedgehog:= currHedgehogIndex; switchesNum:= 0; switchImmediatelyAvailable:= (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtSwitcher); -if PGear(Me)^.Hedgehog^.BotLevel <> 5 then +if Me^.Hedgehog^.BotLevel <> 5 then switchCount:= HHHasAmmo(PGear(Me)^.Hedgehog^, amSwitch) else switchCount:= 0; -if (PGear(Me)^.State and gstAttacked) = 0 then +if (Me^.State and gstAttacked) = 0 then if Targets.Count > 0 then begin // iterate over current team hedgehogs @@ -402,7 +388,7 @@ begin // when AI has to use switcher, make it cost smth unless they have a lot of switches if (switchCount < 10) then Actions.Score:= (-27+switchCount*3)*4000; - AddAction(Actions, aia_Weapon, Longword(amSwitch), 300 + random(200), 0, 0); + AddAction(Actions, aia_Weapon, Longword(amSwitch), 300 + random(200), 0, 0); AddAction(Actions, aia_attack, aim_push, 300 + random(300), 0, 0); AddAction(Actions, aia_attack, aim_release, 1, 0, 0); end; @@ -416,10 +402,9 @@ itHedgehog:= Succ(itHedgehog) mod CurrentTeam^.HedgehogsNumber; until (itHedgehog = currHedgehogIndex) or ((CurrentTeam^.Hedgehogs[itHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[itHedgehog].Effects[heFrozen]=0)); - inc(switchesNum); until (not (switchImmediatelyAvailable or (switchCount > 0))) - or StopThinking + or StopThinking or (itHedgehog = currHedgehogIndex) or BestActions.isWalkingToABetterPlace; @@ -435,7 +420,7 @@ end else SDL_Delay(100) else begin - BackMe:= PGear(Me)^; + BackMe:= Me^; while (not StopThinking) and (BestActions.Count = 0) do begin (* @@ -454,9 +439,9 @@ end end; -PGear(Me)^.State:= PGear(Me)^.State and (not gstHHThinking); +Me^.State:= Me^.State and (not gstHHThinking); +ThinkThread:= nil; Think:= 0; -InterlockedDecrement(hasThread) end; procedure StartThink(Me: PGear); @@ -487,12 +472,7 @@ FillBonuses((Me^.State and gstAttacked) <> 0); AddFileLog('Enter Think Thread'); -{$IFDEF USE_SDLTHREADS} -ThinkThread := SDL_CreateThread(@Think{$IFDEF SDL13}, nil{$ENDIF}, Me); -{$ELSE} -BeginThread(@Think, Me, ThinkThread); -{$ENDIF} -AddFileLog('Thread started'); +ThinkThread:= SDL_CreateThread(@Think{$IFDEF SDL13}, 'think'{$ENDIF}, Me); end; //var scoreShown: boolean = false; @@ -513,14 +493,14 @@ StopMessages(Gear^.Message); TryDo((Gear^.Message and gmAllStoppable) = 0, 'Engine bug: AI may break demos playing', true); end; - + if Gear^.Message <> 0 then exit; - - //scoreShown:= false; + + //scoreShown:= false; StartThink(Gear); StartTicks:= GameTicks - + end else begin {if not scoreShown then @@ -537,13 +517,15 @@ procedure initModule; begin - hasThread:= 0; StartTicks:= 0; - ThinkThread:= ThinkThread; + ThinkThread:= nil; end; procedure freeModule; begin + if (ThinkThread <> nil) then + SDL_KillThread(ThinkThread); + ThinkThread:= nil; FreeActionsList(); end; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uAIAmmoTests.pas Sun Apr 07 22:53:40 2013 +0200 @@ -197,7 +197,11 @@ x, y, dX, dY: real; t: LongInt; value: LongInt; + t2: real; + timer: Longint; begin + if (Level > 3) then exit(BadTurn); + mX:= hwFloat2Float(Me^.X); mY:= hwFloat2Float(Me^.Y); ap.Time:= 0; @@ -224,14 +228,32 @@ dec(t) until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (y > cWaterLine); - + + if TestCollWithLand(trunc(x), trunc(y), 5) and (Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) > 21) then + begin + timer := 500; + t2 := 0.5 / sqrt(sqr(dX) + sqr(dY)); + dX := dX * t2; + dY := dY * t2; + repeat + x:= x + dX; + y:= y + dY; + dec(timer); + until (Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) < 22) + or (x < 0) + or (y < 0) + or (trunc(x) > LAND_WIDTH) + or (trunc(y) > LAND_HEIGHT) + or not TestCollWithLand(trunc(x), trunc(y), 5) + or (timer = 0) + end; EX:= trunc(x); EY:= trunc(y); + // Try to prevent AI from thinking firing into water will cause a drowning + if (EY < cWaterLine-5) and (Timer > 0) and (Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) > 21) then exit(BadTurn); if Level = 1 then value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand) else value:= RateExplosion(Me, EX, EY, 101); - if value = 0 then - value:= 1024 - Metric(Targ.X, Targ.Y, EX, EY) div 64; if valueResult <= value then begin ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9)); @@ -239,7 +261,7 @@ ap.ExplR:= 100; ap.ExplX:= EX; ap.ExplY:= EY; - valueResult:= value + valueResult:= value-2500 // trying to make it slightly less attractive than a bazooka, to prevent waste. AI could use awareness of weapon count end; end until rTime > 4250; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uAIMisc.pas Sun Apr 07 22:53:40 2013 +0200 @@ -64,6 +64,7 @@ function TestCollExcludingObjects(x, y, r: LongInt): boolean; inline; function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline; function TraceShoveFall(x, y, dX, dY: Real): LongInt; +function TestCollWithLand(x, y, r: LongInt): boolean; inline; function RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; inline; function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt; @@ -89,6 +90,7 @@ const KillScore = 200; var friendlyfactor: LongInt = 300; +var dmgMod: real = 1.0; implementation uses uCollisions, uVariables, uUtils, uLandTexture, uGearsUtils; @@ -255,6 +257,72 @@ RatePlace:= rate; end; +function CheckBounds(x, y, r: Longint): boolean; inline; +begin + CheckBounds := (((x-r) and LAND_WIDTH_MASK) = 0) and + (((x+r) and LAND_WIDTH_MASK) = 0) and + (((y-r) and LAND_HEIGHT_MASK) = 0) and + (((y+r) and LAND_HEIGHT_MASK) = 0); +end; + + +function TestCollWithEverything(x, y, r: LongInt): boolean; inline; +begin + if not CheckBounds(x, y, r) then + exit(false); + + if (Land[y-r, x-r] <> 0) or + (Land[y+r, x-r] <> 0) or + (Land[y-r, x+r] <> 0) or + (Land[y+r, x+r] <> 0) then + exit(true); + + TestCollWithEverything := false; +end; + +function TestCollExcludingObjects(x, y, r: LongInt): boolean; inline; +begin + if not CheckBounds(x, y, r) then + exit(false); + + if (Land[y-r, x-r] > lfAllObjMask) or + (Land[y+r, x-r] > lfAllObjMask) or + (Land[y-r, x+r] > lfAllObjMask) or + (Land[y+r, x+r] > lfAllObjMask) then + exit(true); + + TestCollExcludingObjects:= false; +end; + +function TestColl(x, y, r: LongInt): boolean; inline; +begin + if not CheckBounds(x, y, r) then + exit(false); + + if (Land[y-r, x-r] and lfNotCurrentMask <> 0) or + (Land[y+r, x-r] and lfNotCurrentMask <> 0) or + (Land[y-r, x+r] and lfNotCurrentMask <> 0) or + (Land[y+r, x+r] and lfNotCurrentMask <> 0) then + exit(true); + + TestColl:= false; +end; + +function TestCollWithLand(x, y, r: LongInt): boolean; inline; +begin + if not CheckBounds(x, y, r) then + exit(false); + + if (Land[y-r, x-r] > lfAllObjMask) or + (Land[y+r, x-r] > lfAllObjMask) or + (Land[y-r, x+r] > lfAllObjMask) or + (Land[y+r, x+r] > lfAllObjMask) then + exit(true); + + TestCollWithLand:= false; +end; + + // Wrapper to test various approaches. If it works reasonably, will just replace. // Right now, converting to hwFloat is a tad inefficient since the x/y were hwFloat to begin with... function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline; @@ -265,77 +333,13 @@ MeX:= hwRound(Me^.X); MeY:= hwRound(Me^.Y); // We are still inside the hog. Skip radius test - if ((((x-MeX)*(x-MeX)) + ((y-MeY)*(y-MeY))) < 256) and (Land[y, x] <= lfAllObjMask) then + if ((sqr(x-MeX) + sqr(y-MeY)) < 256) and (Land[y, x] and lfObjMask = 0) then exit(false); end; - TestCollExcludingMe:= TestColl(x, y, r) -end; - -function TestCollExcludingObjects(x, y, r: LongInt): boolean; inline; -var b: boolean; -begin - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] > lfAllObjMask); - if b then - exit(true); - - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] > lfAllObjMask); - if b then - exit(true); - - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] > lfAllObjMask); - if b then - exit(true); - - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] > lfAllObjMask); - if b then - exit(true); - - TestCollExcludingObjects:= false; + TestCollExcludingMe:= TestCollWithEverything(x, y, r) end; -function TestColl(x, y, r: LongInt): boolean; inline; -var b: boolean; -begin - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] and lfNotCurrentMask <> 0); - if b then - exit(true); - - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] and lfNotCurrentMask <> 0); - if b then - exit(true); - - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] and lfNotCurrentMask <> 0); - if b then - exit(true); - - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] and lfNotCurrentMask <> 0); - if b then - exit(true); - - TestColl:= false; -end; -function TestCollWithLand(x, y, r: LongInt): boolean; inline; -var b: boolean; -begin - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] > lfAllObjMask); - if b then - exit(true); - - b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] > lfAllObjMask); - if b then - exit(true); - - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] > lfAllObjMask); - if b then - exit(true); - - b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] > lfAllObjMask); - if b then - exit(true); - - TestCollWithLand:= false; -end; function TraceFall(eX, eY: LongInt; x, y, dX, dY: Real; r: LongWord): LongInt; var skipLandCheck: boolean; @@ -409,11 +413,10 @@ function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt; var i, fallDmg, dmg, dmgBase, rate, erasure: LongInt; - dX, dY, dmgMod: real; + dX, dY: real; hadSkips: boolean; begin fallDmg:= 0; -dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent; rate:= 0; // add our virtual position with Targets.ar[Targets.Count] do @@ -477,12 +480,11 @@ function RateShove(x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt; var i, fallDmg, dmg, rate: LongInt; - dX, dY, dmgMod: real; + dX, dY: real; begin fallDmg:= 0; dX:= gdX * 0.01 * kick; dY:= gdY * 0.01 * kick; -dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent; rate:= 0; for i:= 0 to Pred(Targets.Count) do with Targets.ar[i] do @@ -521,10 +523,9 @@ function RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt; var i, dmg, fallDmg, baseDmg, rate, erasure: LongInt; - dX, dY, dmgMod: real; + dX, dY: real; hadSkips: boolean; begin -dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent; rate:= 0; gdX:= gdX * 0.01; gdY:= gdX * 0.01; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uConsts.pas Sun Apr 07 22:53:40 2013 +0200 @@ -115,13 +115,11 @@ MAXNAMELEN = 192; MAXROPEPOINTS = 3840; - {$IFNDEF PAS2C} // some opengl headers do not have these macros GL_BGR = $80E0; GL_BGRA = $80E1; GL_CLAMP_TO_EDGE = $812F; GL_TEXTURE_PRIORITY = $8066; - {$ENDIF} cVisibleWater : LongInt = 128; cTeamHealthWidth : LongInt = 128; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uFloat.pas --- a/hedgewars/uFloat.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uFloat.pas Sun Apr 07 22:53:40 2013 +0200 @@ -63,9 +63,7 @@ // The implemented operators operator = (const z1, z2: hwFloat) z : boolean; inline; -{$IFDEF PAS2C} -operator <> (const z1, z2: hwFloat) z : boolean; inline; -{$ENDIF} + operator + (const z1, z2: hwFloat) z : hwFloat; inline; operator - (const z1, z2: hwFloat) z : hwFloat; inline; operator - (const z1: hwFloat) z : hwFloat; inline; @@ -221,19 +219,11 @@ hwFloat2Float:= -hwFloat2Float; end; -{$IFNDEF WEB} operator = (const z1, z2: hwFloat) z : boolean; inline; begin z:= (z1.isNegative = z2.isNegative) and (z1.QWordValue = z2.QWordValue); end; -{$IFDEF PAS2C} -operator <> (const z1, z2: hwFloat) z : boolean; inline; -begin - z:= (z1.isNegative <> z2.isNegative) or (z1.QWordValue <> z2.QWordValue); -end; -{$ENDIF} - operator + (const z1, z2: hwFloat) z : hwFloat; inline; begin if z1.isNegative = z2.isNegative then @@ -300,102 +290,6 @@ else b:= (z1.QWordValue > z2.QWordValue) <> z2.isNegative end; -{$ENDIF} -{$IFDEF WEB} -(* - Mostly to be kind to JS as of 2012-08-27 where there is no int64/uint64. This may change though. -*) -operator = (const z1, z2: hwFloat) z : boolean; inline; -begin - z:= (z1.isNegative = z2.isNegative) and (z1.Frac = z2.Frac) and (z1.Round = z2.Round); -end; - -operator <> (const z1, z2: hwFloat) z : boolean; inline; -begin - z:= (z1.isNegative <> z2.isNegative) or (z1.Frac <> z2.Frac) or (z1.Round <> z2.Round); -end; - -operator + (const z1, z2: hwFloat) z : hwFloat; inline; -begin -if z1.isNegative = z2.isNegative then - begin - z:= z1; - z.Frac:= z.Frac + z2.Frac; - z.Round:= z.Round + z2.Round; - if z.Frac z2.Round) or ((z1.Round = z2.Round) and (z1.Frac > z2.Frac)) then - begin - z.isNegative:= z1.isNegative; - z.Round:= z1.Round - z2.Round; - z.Frac:= z1.Frac - z2.Frac; - if z2.Frac > z1.Frac then dec(z.Round) - end - else - begin - z.isNegative:= z2.isNegative; - z.Round:= z2.Round - z1.Round; - z.Frac:= z2.Frac-z1.Frac; - if z2.Frac < z1.Frac then dec(z.Round) - end -end; - -operator - (const z1, z2: hwFloat) z : hwFloat; inline; -begin -if z1.isNegative = z2.isNegative then - if (z1.Round > z2.Round) or ((z1.Round = z2.Round) and (z1.Frac > z2.Frac)) then - begin - z.isNegative:= z1.isNegative; - z.Round:= z1.Round - z2.Round; - z.Frac:= z1.Frac-z2.Frac; - if z2.Frac > z1.Frac then dec(z.Round) - end - else - begin - z.isNegative:= not z2.isNegative; - z.Round:= z2.Round - z1.Round; - z.Frac:= z2.Frac-z1.Frac; - if z2.Frac < z1.Frac then dec(z.Round) - end -else - begin - z:= z1; - z.Frac:= z.Frac + z2.Frac; - z.Round:= z.Round + z2.Round; - if z.Frac z1.isNegative -end; - -operator > (const z1, z2: hwFloat) b : boolean; inline; -begin -if z1.isNegative xor z2.isNegative then - b:= z2.isNegative -else -(* - if z1.QWordValue = z2.QWordValue then - b:= false - else*) - b:= ((z1.Round > z2.Round) or ((z1.Round = z2.Round) and (z1.Frac > z2.Frac))) <> z1.isNegative -end; - -function isZero(const z: hwFloat): boolean; inline; -begin -isZero := (z.Round = 0) and (z.Frac = 0); -end; -{$ENDIF} operator - (const z1: hwFloat) z : hwFloat; inline; begin diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uGearsHedgehog.pas Sun Apr 07 22:53:40 2013 +0200 @@ -23,18 +23,18 @@ uses uTypes; procedure doStepHedgehog(Gear: PGear); -procedure AfterAttack; -procedure HedgehogStep(Gear: PGear); -procedure doStepHedgehogMoving(Gear: PGear); -procedure HedgehogChAngle(HHGear: PGear); +procedure AfterAttack; +procedure HedgehogStep(Gear: PGear); +procedure doStepHedgehogMoving(Gear: PGear); +procedure HedgehogChAngle(HHGear: PGear); procedure PickUp(HH, Gear: PGear); procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); procedure CheckIce(Gear: PGear); inline; implementation -uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, +uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, uCommands, uLocale, uUtils, uVisualGears, uStats, uIO, uScript, - uGearsList, uGears, uCollisions, uRandom, uStore, uTeams, + uGearsList, uGears, uCollisions, uRandom, uStore, uTeams, uGearsUtils; var GHStepTicks: LongWord = 0; @@ -75,7 +75,7 @@ MultiShootAttacks:= 0; HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump)); - + if Ammoz[CurAmmoType].Slot = slot then begin i:= 0; @@ -90,8 +90,8 @@ end; until (i = 1) or ((Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns)) - - end + + end else begin i:= 0; @@ -114,7 +114,7 @@ LoadHedgehogHat(HHGear^.Hedgehog^, Hat); end; // Try again in the next slot - if CurAmmoType = prevAmmo then + if CurAmmoType = prevAmmo then begin if slot >= cMaxSlotIndex then slot:= 0 else inc(slot); HHGear^.MsgParam:= slot; @@ -213,7 +213,7 @@ if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstHHChooseTarget)) = 0) and (((State and gstMoving) = 0) or (Power > 0) or (CurAmmoType = amTeleport) - or + or // Allow attacks while moving on ammo with AltAttack ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) @@ -257,7 +257,7 @@ and ((Gear^.Message and gmLJump) <> 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then begin - newDx:= dX; + newDx:= dX; newDy:= dY; altUse:= true end @@ -285,15 +285,15 @@ amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0); amMine: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000); amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); - amKnife: begin + amKnife: begin newGear:= AddGear(hwRound(lx), hwRound(ly), gtKnife, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); - newGear^.State:= newGear^.State or gstMoving; + newGear^.State:= newGear^.State or gstMoving; newGear^.Radius:= 4 // temporarily shrink so it doesn't instantly embed in the ground end; amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0); amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0); amPortalGun: begin - newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, + newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, // set selected color CurWeapon^.Pos); end; @@ -353,7 +353,7 @@ cGravity:= cMaxWindSpeed; cGravityf:= 0.00025 end; - amExtraDamage: begin + amExtraDamage: begin PlaySound(sndHellishImpact4); cDamageModifier:= _1_5 end; @@ -383,21 +383,18 @@ end; //amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000); amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000); - amIceGun: begin - newGear:= AddGear(hwRound(X), hwRound(Y), gtIceGun, 0, _0, _0, 0); - newGear^.radius := 8; - end; + amIceGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtIceGun, 0, _0, _0, 0); end; if altUse and (newGear <> nil) then begin newGear^.dX:= newDx / newGear^.Density; newGear^.dY:= newDY / newGear^.Density end; - + case CurAmmoType of - amGrenade, amMolotov, - amClusterBomb, amGasBomb, - amBazooka, amSnowball, + amGrenade, amMolotov, + amClusterBomb, amGasBomb, + amBazooka, amSnowball, amBee, amSMine, amMortar, amWatermelon, amHellishBomb, amDrill: FollowGear:= newGear; @@ -418,7 +415,7 @@ amTardis, amPiano, amIceGun: CurAmmoGear:= newGear; end; - + if ((CurAmmoType = amMine) or (CurAmmoType = amSMine)) and (GameFlags and gfInfAttack <> 0) then newGear^.FlightTime:= GameTicks + 1000 else if CurAmmoType = amDrill then @@ -442,7 +439,7 @@ newGear^.Elasticity:= newGear^.Elasticity * elastic else if elastic > _1 then newGear^.Elasticity:= _1 - ((_1-newGear^.Elasticity) / elastic); - (* Experimented with friction modifier. Didn't seem helpful + (* Experimented with friction modifier. Didn't seem helpful fric:= int2hwfloat(CurWeapon^.Bounciness) / _250; if fric < _1 then newGear^.Friction:= newGear^.Friction * fric else if fric > _1 then newGear^.Friction:= _1 - ((_1-newGear^.Friction) / fric)*) @@ -478,7 +475,7 @@ AfterAttack; end end - else + else Message:= Message and (not gmAttack); end; TargetPoint.X := NoPointX; @@ -498,13 +495,13 @@ if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then begin Inc(MultiShootAttacks); - + if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then begin s:= inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1); AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate); end; - + if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) or ((GameFlags and gfMultiWeapon) <> 0) then begin @@ -519,7 +516,7 @@ TagTurnTimeLeft:= TurnTimeLeft; TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100; end; - if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (HHGear <> nil) then + if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (HHGear <> nil) then HHGear^.State:= HHGear^.State or gstAttacked; if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then ApplyAmmoChanges(CurrentHedgehog^) @@ -547,7 +544,7 @@ dec(Gear^.Timer); if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos) - end + end else if Gear^.Timer = 1 then begin Gear^.State:= Gear^.State or gstNoDamage; @@ -555,7 +552,7 @@ AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; DeleteGear(Gear); SetAllToActive - end + end else // Gear^.Timer = 0 begin AllInactive:= false; @@ -608,7 +605,7 @@ if cnt <> 0 then AddAmmo(HH, ammo, cnt) else AddAmmo(HH, ammo); - if (not (HH.Team^.ExtDriven + if (not (HH.Team^.ExtDriven or (HH.BotLevel > 0))) or (HH.Team^.Clan^.ClanIndex = LocalClan) or (GameType = gmtDemo) then @@ -646,7 +643,7 @@ posCaseUtility, posCaseAmmo: begin PlaySound(sndShotgunReload); - if Gear^.AmmoType <> amNothing then + if Gear^.AmmoType <> amNothing then begin AddPickup(HH^.Hedgehog^, Gear^.AmmoType, Gear^.Power, hwRound(Gear^.X), hwRound(Gear^.Y)); end @@ -654,7 +651,7 @@ begin // Add spawning here... AddRandomness(GameTicks); - + gi := GearsList; while gi <> nil do begin @@ -769,7 +766,7 @@ if (Gear^.Message and gmLeft )<>0 then Gear^.dX:= -cLittle else if (Gear^.Message and gmRight )<>0 then - Gear^.dX:= cLittle + Gear^.dX:= cLittle else exit; StepSoundTimer:= cHHStepTicks; @@ -796,7 +793,7 @@ var da: LongWord; begin with HHGear^.Hedgehog^ do - if ((CurAmmoType = amRope) and ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) + if ((CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amRope) and ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) or ((CurAmmoType = amPortalGun) and ((HHGear^.State and gstMoving) <> 0)) then da:= 2 else da:= 1; @@ -836,7 +833,7 @@ Gear^.dY:= _0; Gear^.State:= Gear^.State or gstMoving; if (CurrentHedgehog^.Gear = Gear) - and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then + and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then begin // TODO: why so aggressive at setting FollowGear when falling? FollowGear:= Gear; @@ -852,7 +849,7 @@ or ((Gear^.dY.QWordValue + Gear^.dX.QWordValue) > _0_55.QWordValue))) then Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density end - end + end else begin land:= TestCollisionYwithGear(Gear, 1); @@ -911,7 +908,7 @@ Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_93; Gear^.Y:= Gear^.Y - _2 - end + end else if not (TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) or (TestCollisionYwithXYShift(Gear, hwSign(Gear^.dX) - hwRound(Gear^.dX), -1, -1))) then @@ -978,7 +975,7 @@ // ARTILLERY but not being moved by explosions Gear^.X:= Gear^.X + Gear^.dX; Gear^.Y:= Gear^.Y + Gear^.dY; - if (not Gear^.dY.isNegative) and (not TestCollisionYKick(Gear, 1)) + if (not Gear^.dY.isNegative) and (not TestCollisionYKick(Gear, 1)) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then begin CheckHHDamage(Gear); @@ -1071,7 +1068,7 @@ or ((HHGear^.State and gstAttacking) <> 0)) then Attack(HHGear) // should be before others to avoid desync with '/put' msg and changing weapon msgs else -else +else with Hedgehog^ do if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and ((HHGear^.Message and gmLJump) <> 0) @@ -1176,7 +1173,7 @@ begin ResurrectHedgehog(Gear); end - else + else begin Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation); Gear^.doStep:= @doStepHedgehogDead; @@ -1220,9 +1217,9 @@ procedure CheckIce(Gear: PGear); inline; (* var x,y,tx,ty: LongInt; - tdX, tdY, slope: hwFloat; + tdX, tdY, slope: hwFloat; land: Word; *) -var slope: hwFloat; +var slope: hwFloat; begin if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0) and (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0) @@ -1263,7 +1260,7 @@ end; if GameTicks mod 100 = 0 then CheckIce(Gear); (* -if Gear^.Hedgehog^.Effects[heFrozen] > 0 then +if Gear^.Hedgehog^.Effects[heFrozen] > 0 then begin if (Gear^.Hedgehog^.Effects[heFrozen] > 256) and (CurrentHedgehog^.Team^.Clan <> Gear^.Hedgehog^.Team^.Clan) then dec(Gear^.Hedgehog^.Effects[heFrozen]) @@ -1271,7 +1268,7 @@ dec(Gear^.Hedgehog^.Effects[heFrozen]) end; *) -if (GameTicks mod 10 = 0) and (Gear^.Hedgehog^.Effects[heFrozen] > 0) and (Gear^.Hedgehog^.Effects[heFrozen] < 256) then +if (GameTicks mod 10 = 0) and (Gear^.Hedgehog^.Effects[heFrozen] > 0) and (Gear^.Hedgehog^.Effects[heFrozen] < 256) then dec(Gear^.Hedgehog^.Effects[heFrozen]); if (Gear^.State and gstHHDriven) = 0 then doStepHedgehogFree(Gear) diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uGearsList.pas Sun Apr 07 22:53:40 2013 +0200 @@ -36,7 +36,7 @@ uGearsRender, uGearsUtils, uDebug; const - GearKindAmmoTypeMap : array [TGearType] of TAmmoType = ( + GearKindAmmoTypeMap : array [TGearType] of TAmmoType = ( (* gtFlame *) amNothing (* gtHedgehog *) , amNothing (* gtMine *) , amMine @@ -181,7 +181,7 @@ gear^.AmmoType:= GearKindAmmoTypeMap[Kind]; gear^.CollisionMask:= $FFFF; -if CurrentHedgehog <> nil then +if CurrentHedgehog <> nil then begin gear^.Hedgehog:= CurrentHedgehog; if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then @@ -192,7 +192,7 @@ gear^.Z:= cHHZ+1 else gear^.Z:= cUsualZ; - + case Kind of gtGrenade, gtClusterBomb, @@ -548,7 +548,10 @@ gear^.Pos:= 1; end; } - gtIceGun: gear^.Health:= 1000; + gtIceGun: begin + gear^.Health:= 1000; + gear^.Radius:= 8; + end; gtGenericFaller:begin gear^.AdvBounce:= 1; gear^.Radius:= 1; @@ -645,7 +648,7 @@ if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Effects[heResurrectable] <> 0) and //(Gear^.Hedgehog^.Effects[heResurrectable] = 0) then (Gear^.Hedgehog^.Team^.Clan <> CurrentHedgehog^.Team^.Clan) then - with CurrentHedgehog^ do + with CurrentHedgehog^ do begin inc(Team^.stats.AIKills); FreeTexture(Team^.AIKillsTex); diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uGearsRender.pas Sun Apr 07 22:53:40 2013 +0200 @@ -352,13 +352,7 @@ lx:= lx + ax; ly:= ly + ay; tx:= round(lx); - ty:= round(ly); - if (abs(tx-hx) > 1000) or (abs(hy-ty) > 1000) then - begin - DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0); - hx:= tx; - hy:= ty - end + ty:= round(ly) end; // reached edge of land. assume infinite beam. Extend it way out past camera if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then @@ -368,7 +362,6 @@ end; //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then - if (tx <> hx) or (ty <> hy) then begin DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0); end; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uLand.pas Sun Apr 07 22:53:40 2013 +0200 @@ -483,28 +483,11 @@ p:= tmpsurf^.pixels; for y:= 0 to Pred(tmpsurf^.h) do - begin + begin for x:= 0 to Pred(tmpsurf^.w) do - begin - // this an if instead of masking colours to avoid confusing map creators - if ((AMask and p^[x]) = 0) then - Land[cpY + y, cpX + x]:= 0 - else if p^[x] = $FFFFFFFF then // white - Land[cpY + y, cpX + x]:= lfObject - else if p^[x] = AMask then // black - begin - Land[cpY + y, cpX + x]:= lfBasic; - disableLandBack:= false - end - else if p^[x] = (AMask or RMask) then // red - Land[cpY + y, cpX + x]:= lfIndestructible - else if p^[x] = (AMask or BMask) then // blue - Land[cpY + y, cpX + x]:= lfObject or lfIce - else if p^[x] = (AMask or GMask) then // green - Land[cpY + y, cpX + x]:= lfObject or lfBouncy + SetLand(Land[cpY + y, cpX + x], p^[x]); + p:= @(p^[tmpsurf^.pitch div 4]); end; - p:= @(p^[tmpsurf^.pitch div 4]); - end; if SDL_MustLock(tmpsurf) then SDL_UnlockSurface(tmpsurf); diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uLandGraphics.pas Sun Apr 07 22:53:40 2013 +0200 @@ -81,22 +81,22 @@ LandPixels[pixelY, pixelX]:= 0 end; end; - + procedure drawPixelEBC(landX, landY, pixelX, pixelY: Longint); inline; begin if ((Land[landY, landX] and lfBasic) <> 0) or ((Land[landY, landX] and lfObject) <> 0) then begin LandPixels[pixelY, pixelX]:= ExplosionBorderColor; Land[landY, landX]:= (Land[landY, landX] or lfDamaged) and not lfIce; - LandDirty[landY div 32, landX div 32]:= 1; + LandDirty[landY div 32, landX div 32]:= 1; end; end; - + function isLandscapeEdge(weight:Longint):boolean; inline; begin result := (weight < 8) and (weight >= 2); end; - + function getPixelWeight(x, y:Longint): Longint; var i, j:Longint; @@ -109,7 +109,7 @@ (i > LAND_WIDTH - 1) or (j < 0) or (j > LAND_HEIGHT -1) then - begin + begin result := 9; exit; end; @@ -140,12 +140,12 @@ LandPixels[pixelY, pixelX]:= addBgColor(w, IceColor); LandPixels[pixelY, pixelX]:= addBgColor(LandPixels[pixelY, pixelX], icePixels^[iceSurface^.w * (pixelY mod iceSurface^.h) + (pixelX mod iceSurface^.w)]) end - else + else begin LandPixels[pixelY, pixelX]:= IceColor and not AMask or $E8 shl AShift; LandPixels[pixelY, pixelX]:= addBgColor(LandPixels[pixelY, pixelX], icePixels^[iceSurface^.w * (pixelY mod iceSurface^.h) + (pixelX mod iceSurface^.w)]); // silly workaround to avoid having to make background erasure a tadb it smarter about sea ice - if LandPixels[pixelY, pixelX] and AMask shr AShift = 255 then + if LandPixels[pixelY, pixelX] and AMask shr AShift = 255 then LandPixels[pixelY, pixelX]:= LandPixels[pixelY, pixelX] and not AMask or 254 shl AShift; end; end; @@ -177,43 +177,43 @@ py := 0; FillLandCircleLine := 0; case fill of - backgroundPixel: + backgroundPixel: for i:= fromPix to toPix do begin calculatePixelsCoordinates(i, y, px, py); inc(FillLandCircleLine, drawPixelBG(i, y, px, py)); end; - ebcPixel: + ebcPixel: for i:= fromPix to toPix do begin calculatePixelsCoordinates(i, y, px, py); drawPixelEBC(i, y, px, py); end; - nullPixel: + nullPixel: for i:= fromPix to toPix do begin calculatePixelsCoordinates(i, y, px, py); if ((Land[y, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[y, i] > 255)) then - LandPixels[py, px]:= 0 + LandPixels[py, px]:= 0 end; - icePixel: + icePixel: for i:= fromPix to toPix do begin calculatePixelsCoordinates(i, y, px, py); DrawPixelIce(i, y, px, py); end; - setNotCurrentMask: + setNotCurrentMask: for i:= fromPix to toPix do begin Land[y, i]:= Land[y, i] and lfNotCurrentMask; end; - changePixelSetNotCurrent: + changePixelSetNotCurrent: for i:= fromPix to toPix do begin if Land[y, i] and lfObjMask > 0 then Land[y, i]:= (Land[y, i] and lfNotObjMask) or ((Land[y, i] and lfObjMask) - 1); end; - setCurrentHog: + setCurrentHog: for i:= fromPix to toPix do begin Land[y, i]:= Land[y, i] or lfCurrentHog @@ -222,11 +222,11 @@ for i:= fromPix to toPix do begin if Land[y, i] and lfObjMask < lfObjMask then - Land[y, i]:= (Land[y, i] and lfNotObjMask) or ((Land[y, i] and lfObjMask) + 1) + Land[y, i]:= (Land[y, i] and lfNotObjMask) or ((Land[y, i] and lfObjMask) + 1) end; - end; + end; end; - + function FillLandCircleSegment(x, y, dx, dy: LongInt; fill : fillType): Longword; inline; begin FillLandCircleSegment := 0; @@ -361,31 +361,31 @@ begin if Land[j, i] = 0 then begin - Land[j, i] := lfIce; + Land[j, i] := lfIce; fillPixelFromIceSprite(i, j); end; - end; + end; end; landRect.x := min(max(x - iceRadius, 0), LAND_WIDTH - 1); landRect.y := min(max(y, 0), LAND_HEIGHT - 1); landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1); landRect.h := min(iceHeight, LAND_HEIGHT - landRect.y - 1); -UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); +UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); end; function DrawExplosion(X, Y, Radius: LongInt): Longword; var tx, ty, dx, dy: Longint; -begin +begin DrawExplosion := FillRoundInLand(x, y, Radius, backgroundPixel); if Radius > 20 then FillRoundInLand(x, y, Radius - 15, nullPixel); FillRoundInLand(X, Y, Radius, 0); FillRoundInLand(x, y, Radius + 4, ebcPixel); - tx:= Max(X - Radius - 1, 0); - dx:= Min(X + Radius + 1, LAND_WIDTH) - tx; - ty:= Max(Y - Radius - 1, 0); - dy:= Min(Y + Radius + 1, LAND_HEIGHT) - ty; + tx:= Max(X - Radius - 5, 0); + dx:= Min(X + Radius + 5, LAND_WIDTH) - tx; + ty:= Max(Y - Radius - 5, 0); + dy:= Min(Y + Radius + 5, LAND_HEIGHT) - ty; UpdateLandTexture(tx, dx, ty, dy, false); end; @@ -463,7 +463,7 @@ else LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor end - end; + end; end; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uLandObjects.pas Sun Apr 07 22:53:40 2013 +0200 @@ -27,7 +27,9 @@ procedure LoadThemeConfig; procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline; procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word); +procedure BlitImageUsingMask(cpX, cpY: Longword; Image, Mask: PSDL_Surface); procedure AddOnLandObjects(Surface: PSDL_Surface); +procedure SetLand(var LandWord: Word; Pixel: LongWord); inline; implementation uses uStore, uConsts, uConsole, uRandom, uSound, GLunit @@ -42,7 +44,7 @@ type TRectsArray = array[0..MaxRects] of TSDL_Rect; PRectArray = ^TRectsArray; TThemeObject = record - Surf: PSDL_Surface; + Surf, Mask: PSDL_Surface; inland: TSDL_Rect; outland: array[0..Pred(MAXOBJECTRECTS)] of TSDL_Rect; rectcnt: Longword; @@ -68,6 +70,26 @@ ThemeObjects: TThemeObjects; SprayObjects: TSprayObjects; +procedure SetLand(var LandWord: Word; Pixel: LongWord); inline; +begin + // this an if instead of masking colours to avoid confusing map creators + if ((AMask and Pixel) = 0) then + LandWord:= 0 + else if Pixel = $FFFFFFFF then // white + LandWord:= lfObject + else if Pixel = AMask then // black + begin + LandWord:= lfBasic; + disableLandBack:= false + end + else if Pixel = (AMask or RMask) then // red + LandWord:= lfIndestructible + else if Pixel = (AMask or BMask) then // blue + LandWord:= lfObject or lfIce + else if Pixel = (AMask or GMask) then // green + LandWord:= lfObject or lfBouncy +end; + procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline; begin BlitImageAndGenerateCollisionInfo(cpX, cpY, Width, Image, 0); @@ -119,6 +141,47 @@ WriteLnToConsole(msgOK) end; +procedure BlitImageUsingMask(cpX, cpY: Longword; Image, Mask: PSDL_Surface); +var p, mp: PLongwordArray; + x, y: Longword; + bpp: LongInt; +begin +WriteToConsole('Generating collision info... '); + +if SDL_MustLock(Image) then + SDLTry(SDL_LockSurface(Image) >= 0, true); + +bpp:= Image^.format^.BytesPerPixel; +TryDo(bpp = 4, 'Land object should be 32bit', true); + +p:= Image^.pixels; +mp:= Mask^.pixels; +for y:= 0 to Pred(Image^.h) do + begin + for x:= 0 to Pred(Image^.w) do + begin + if (cReducedQuality and rqBlurryLand) = 0 then + begin + if (LandPixels[cpY + y, cpX + x] = 0) + or (((p^[x] and AMask) <> 0) and (((LandPixels[cpY + y, cpX + x] and AMask) shr AShift) < 255)) then + LandPixels[cpY + y, cpX + x]:= p^[x]; + end + else + if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then + LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x]; + + if (Land[cpY + y, cpX + x] <= lfAllObjMask) or (Land[cpY + y, cpX + x] and lfObject <> 0) then + SetLand(Land[cpY + y, cpX + x], mp^[x]); + end; + p:= @(p^[Image^.pitch shr 2]); + mp:= @(mp^[Mask^.pitch shr 2]) + end; + +if SDL_MustLock(Image) then + SDL_UnlockSurface(Image); +WriteLnToConsole(msgOK) +end; + procedure AddRect(x1, y1, w1, h1: LongInt); begin with Rects^[RectCount] do @@ -326,7 +389,9 @@ if bRes then begin i:= getrandom(cnt); - BlitImageAndGenerateCollisionInfo(ar[i].x, ar[i].y, 0, Obj.Surf); + if Obj.Mask <> nil then + BlitImageUsingMask(ar[i].x, ar[i].y, Obj.Surf, Obj.Mask) + else BlitImageAndGenerateCollisionInfo(ar[i].x, ar[i].y, 0, Obj.Surf); AddRect(ar[i].x, ar[i].y, Width, Height); dec(Maxcnt) end @@ -555,9 +620,10 @@ with ThemeObjects.objs[Pred(ThemeObjects.Count)] do begin i:= Pos(',', s); - Surf:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i))), ifTransparent or ifIgnoreCaps); + Surf:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i))), ifTransparent or ifIgnoreCaps or ifCritical); Width:= Surf^.w; Height:= Surf^.h; + Mask:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i)))+'_mask', ifTransparent or ifIgnoreCaps); Delete(s, 1, i); i:= Pos(',', s); Maxcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uMisc.pas Sun Apr 07 22:53:40 2013 +0200 @@ -38,8 +38,7 @@ implementation uses SysUtils, uVariables, uUtils - {$IFDEF PNG_SCREENSHOTS}, PNGh, png {$ENDIF} - {$IFNDEF USE_SDLTHREADS} {$IFDEF UNIX}, cthreads{$ENDIF} {$ENDIF}; + {$IFDEF PNG_SCREENSHOTS}, PNGh, png {$ENDIF}; type PScreenshot = ^TScreenshot; TScreenshot = record @@ -64,7 +63,7 @@ {$IFDEF PNG_SCREENSHOTS} // this funtion will be executed in separate thread -function SaveScreenshot(screenshot: pointer): PtrInt; +function SaveScreenshot(screenshot: pointer): LongInt; cdecl; export; var i: LongInt; png_ptr: ^png_struct; info_ptr: ^png_info; @@ -119,7 +118,7 @@ {$ELSE} // no PNG_SCREENSHOTS // this funtion will be executed in separate thread -function SaveScreenshot(screenshot: pointer): PtrInt; +function SaveScreenshot(screenshot: pointer): LongInt; cdecl; export; var f: file; // Windows Bitmap Header head: array[0..53] of Byte = ( @@ -262,11 +261,7 @@ image^.size:= size; image^.buffer:= p; -{$IFDEF USE_SDLTHREADS} -SDL_CreateThread(@SaveScreenshot{$IFDEF SDL13}, nil{$ENDIF}, image); -{$ELSE} -BeginThread(@SaveScreenshot, image); -{$ENDIF} +SDL_CreateThread(@SaveScreenshot{$IFDEF SDL13}, 'snapshot'{$ENDIF}, image); MakeScreenshot:= true; // possibly it is not true but we will not wait for thread to terminate end; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uStore.pas Sun Apr 07 22:53:40 2013 +0200 @@ -21,7 +21,7 @@ unit uStore; interface -uses {$IFNDEF PAS2C} StrUtils, {$ENDIF}SysUtils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat; +uses StrUtils, SysUtils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat; procedure initModule; procedure freeModule; @@ -575,19 +575,19 @@ tmpsurf:= IMG_Load_RW(rwopsOpenRead(s), true); if tmpsurf = nil then - begin + begin OutError(msgFailed, (imageFlags and ifCritical) <> 0); exit; - end; + end; if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then - begin + begin SDL_FreeSurface(tmpsurf); OutError(msgFailedSize, ((not cOnlyStats) and ((imageFlags and ifCritical) <> 0))); // dummy surface to replace non-critical textures that failed to load due to their size LoadImage:= SDL_CreateRGBSurface(SDL_SWSURFACE, 2, 2, 32, RMask, GMask, BMask, AMask); exit; - end; + end; tmpsurf:= doSurfaceConversion(tmpsurf); @@ -765,7 +765,7 @@ AddFileLog(' |----- Number of auxiliary buffers: ' + inttostr(AuxBufNum)); {$ENDIF} AddFileLog(' \----- Extensions: '); -{$IFNDEF PAS2C} + // fetch extentions and store them in string tmpstr := StrPas(PChar(glGetString(GL_EXTENSIONS))); tmpn := WordCount(tmpstr, [' ']); @@ -783,10 +783,6 @@ tmpint := tmpint + 3; end; until (tmpint > tmpn); -{$ELSE} - // doesn't seem to print >256 chars - AddFileLogRaw(PChar(glGetString(GL_EXTENSIONS))); -{$ENDIF} AddFileLog(''); defaultFrame:= 0; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uTypes.pas Sun Apr 07 22:53:40 2013 +0200 @@ -220,48 +220,56 @@ PClan = ^TClan; TGearStepProcedure = procedure (Gear: PGear); +// So, you're here looking for variables you can (ab)use to store some gear state? +// Not all members of this structure are created equal. Comments below are my take on what can be used for what in the gear structure. TGear = record - NextGear, PrevGear: PGear; - Active: Boolean; - AdvBounce: Longword; - Invulnerable: Boolean; - RenderTimer: Boolean; - AmmoType : TAmmoType; - State : Longword; - X : hwFloat; +// Don't ever override these. + NextGear, PrevGear: PGear; // Linked list + Z: Longword; // Z index. For rendering. Sets order in list + Active: Boolean; // Is gear Active (running step code) + Kind: TGearType; + doStep: TGearStepProcedure; // Code the gear is running + AmmoType : TAmmoType; // Ammo type associated with this kind of gear + RenderTimer: Boolean; // Will visually display Timer if true + Target : TPoint; // Gear target. Will render in uGearsRender unless a special case is added + AIHints: LongWord; // hints for ai. + LastDamage: PHedgehog; // Used to track damage source for stats + CollisionIndex: LongInt; // Position in collision array + Message: LongWord; // Game messages are stored here. See gm bitmasks in uConsts + uid: Longword; // Lua use this to reference gears +// Strongly recommended not to override these. Will mess up generic operations like portaling + X : hwFloat; // X/Y/dX/dY are position/velocity. People count on these having semi-normal values Y : hwFloat; dX: hwFloat; dY: hwFloat; - Target : TPoint; - Kind: TGearType; - Pos: Longword; - doStep: TGearStepProcedure; - Radius: LongInt; - Angle, Power : Longword; - DirAngle: real; - Timer : LongWord; + State : Longword; // See gst bitmask values in uConsts + PortalCounter: LongWord; // Necessary to interrupt portal loops. Not possible to avoid infinite loops without it. +// Don't use these if you're using generic movement like doStepFallingGear and explosion shoves. Generally recommended not to use. + Radius: LongInt; // Radius. If not using uCollisions, is usually used to indicate area of effect + CollisionMask: Word; // Masking off Land impact FF7F for example ignores current hog and crates + AdvBounce: Longword; // Triggers 45° bounces. Is a counter to avoid edge cases Elasticity: hwFloat; Friction : hwFloat; - Density : hwFloat; - Message, MsgParam : Longword; - Hedgehog: PHedgehog; + Density : hwFloat; // Density is kind of a mix of size and density. Impacts distance thrown, wind. + ImpactSound: TSound; // first sound, others have to be after it in the sounds def. + nImpactSounds: Word; // count of ImpactSounds. +// Don't use these if you want to take damage normally, otherwise health/damage are commonly used for other purposes + Invulnerable: Boolean; Health, Damage, Karma: LongInt; - CollisionIndex: LongInt; - Tag: LongInt; - Tex: PTexture; - Z: Longword; - CollisionMask: Word; - LinkedGear: PGear; - FlightTime: Longword; - uid: Longword; - ImpactSound: TSound; // first sound, others have to be after it in the sounds def. - nImpactSounds: Word; // count of ImpactSounds - SoundChannel: LongInt; - PortalCounter: LongWord; // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion. - AIHints: LongWord; // hints for ai. haha ^^^^^^ temporary, sure - IceTime: Longint; //time of ice beam with object some interaction temporary - IceState: Longint; //state of ice gun temporary - LastDamage: PHedgehog; +// DirAngle is a "real" - if you don't need it for rotation of sprite in uGearsRender, you can use it for any visual-only value + DirAngle: real; +// These are frequently overridden to serve some other purpose + Pos: Longword; // Commonly overridden. Example use is posCase values in uConsts. + Angle, Power : Longword; // Used for hog aiming/firing. Angle is rarely used as an Angle otherwise. + Timer : LongWord; // Typically used for some sort of gear timer. Time to explosion, remaining fuel... + Tag: LongInt; // Quite generic. Variety of uses. + FlightTime: Longword; // Initially added for batting of hogs to determine homerun. Used for some firing delays + MsgParam: LongWord; // Initially stored a set of messages. So usually gm values like Message. Frequently overriden +// These are not used generically, but should probably be used for purpose intended. Definitely shouldn't override pointer type + Tex: PTexture; // A texture created by the gear. Shouldn't use for anything but textures + LinkedGear: PGear; // Used to track a related gear. Portal pairs for example. + Hedgehog: PHedgehog; // set to CurrentHedgehog on gear creation + SoundChannel: LongInt; // Used to track a sound the gear started end; TPGearArray = array of PGear; PGearArrayS = record @@ -429,7 +437,7 @@ TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused, sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync, - sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady, + sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady, sidBounce1, sidBounce2, sidBounce3, sidBounce4, sidBounce5, sidBounce, sidMute); @@ -440,8 +448,8 @@ TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable, gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery, - gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, - gidRandomMineTimer, gidDamageModifier, gidResetHealth, gidAISurvival, + gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, + gidRandomMineTimer, gidDamageModifier, gidResetHealth, gidAISurvival, gidInfAttack, gidResetWeps, gidPerHogAmmo, gidTagTeam); TLandArray = packed array of array of LongWord; diff -r af4ab297b2b7 -r 539380a498e4 hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Tue Mar 26 18:52:42 2013 +0100 +++ b/hedgewars/uUtils.pas Sun Apr 07 22:53:40 2013 +0200 @@ -27,14 +27,12 @@ procedure SplitByChar(var a, b: shortstring; c: char); procedure SplitByChar(var a, b: ansistring; c: char); -{$IFNDEF PAS2C} function EnumToStr(const en : TGearType) : shortstring; overload; function EnumToStr(const en : TVisualGearType) : shortstring; overload; function EnumToStr(const en : TSound) : shortstring; overload; function EnumToStr(const en : TAmmoType) : shortstring; overload; function EnumToStr(const en : THogEffect) : shortstring; overload; function EnumToStr(const en : TCapGroup) : shortstring; overload; -{$ENDIF} function Min(a, b: LongInt): LongInt; inline; function Max(a, b: LongInt): LongInt; inline; @@ -68,10 +66,8 @@ function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; -{$IFNDEF PAS2C} procedure Write(var f: textfile; s: shortstring); procedure WriteLn(var f: textfile; s: shortstring); -{$ENDIF} function isPhone: Boolean; inline; function getScreenDPI: Double; inline; //cdecl; external; @@ -92,7 +88,7 @@ implementation -uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; +uses typinfo, Math, uConsts, uVariables, SysUtils; {$IFDEF DEBUGFILE} var f: textfile; @@ -135,11 +131,11 @@ end else b:= ''; end; -{$IFNDEF PAS2C} function EnumToStr(const en : TGearType) : shortstring; overload; begin EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) end; + function EnumToStr(const en : TVisualGearType) : shortstring; overload; begin EnumToStr:= GetEnumName(TypeInfo(TVisualGearType), ord(en)) @@ -164,7 +160,7 @@ begin EnumToStr := GetEnumName(TypeInfo(TCapGroup), ord(en)) end; -{$ENDIF} + function Min(a, b: LongInt): LongInt; begin @@ -407,7 +403,6 @@ CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil); end; -{$IFNDEF PAS2C} procedure Write(var f: textfile; s: shortstring); begin system.write(f, s) @@ -417,7 +412,7 @@ begin system.writeln(f, s) end; -{$ENDIF} + // this function is just to determine whether we are running on a limited screen device function isPhone: Boolean; inline; diff -r af4ab297b2b7 -r 539380a498e4 project_files/HedgewarsMobile/Classes/CreationChamber.m --- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Tue Mar 26 18:52:42 2013 +0100 +++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Sun Apr 07 22:53:40 2013 +0200 @@ -18,7 +18,7 @@ #import "CreationChamber.h" - +#import "weapons.h" @implementation CreationChamber diff -r af4ab297b2b7 -r 539380a498e4 project_files/HedgewarsMobile/Classes/HWUtils.m --- a/project_files/HedgewarsMobile/Classes/HWUtils.m Tue Mar 26 18:52:42 2013 +0100 +++ b/project_files/HedgewarsMobile/Classes/HWUtils.m Sun Apr 07 22:53:40 2013 +0200 @@ -22,7 +22,7 @@ #import #import #import - +#import "hwconsts.h" static NSString *cachedModel = nil; static NSArray *cachedColors = nil; diff -r af4ab297b2b7 -r 539380a498e4 project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m --- a/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m Tue Mar 26 18:52:42 2013 +0100 +++ b/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m Sun Apr 07 22:53:40 2013 +0200 @@ -18,7 +18,7 @@ #import "ServerProtocolNetwork.h" - +#import "hwconsts.h" #define BUFFER_SIZE 256 diff -r af4ab297b2b7 -r 539380a498e4 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue Mar 26 18:52:42 2013 +0100 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Apr 07 22:53:40 2013 +0200 @@ -11,7 +11,8 @@ isa = PBXAggregateTarget; buildConfigurationList = 61799290114AE0CD00BA94A9 /* Build configuration list for PBXAggregateTarget "UpdateDataFolder" */; buildPhases = ( - 6179928A114AE0C800BA94A9 /* ShellScript */, + 61806B78170B83EA00C601BC /* config.inc */, + 6179928A114AE0C800BA94A9 /* data */, ); dependencies = ( ); @@ -629,6 +630,8 @@ 617BC23A1490211F00E1C294 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Locale/Italian.lproj/Scheme.strings; sourceTree = ""; }; 617D78D816D932310091D4D6 /* Physfs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Physfs.xcodeproj; path = ../../misc/libphysfs/Xcode/Physfs.xcodeproj; sourceTree = SOURCE_ROOT; }; 617D794316D933B00091D4D6 /* Physlayer.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Physlayer.xcodeproj; path = ../../misc/libphyslayer/Xcode/Physlayer.xcodeproj; sourceTree = SOURCE_ROOT; }; + 61806BDA170B963800C601BC /* weapons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = weapons.h; path = ../../QTfrontend/weapons.h; sourceTree = SOURCE_ROOT; }; + 61806BE0170B969D00C601BC /* hwconsts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hwconsts.h; path = ../../QTfrontend/hwconsts.h; sourceTree = SOURCE_ROOT; }; 6183D83C11E2BCE200A88903 /* Default-ipad-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-ipad-Landscape.png"; path = "Resources/Icons/Default-ipad-Landscape.png"; sourceTree = ""; }; 6183D83D11E2BCE200A88903 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = Resources/Icons/Default.png; sourceTree = ""; }; 618899811299516000D55FD6 /* title@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "title@2x~iphone.png"; path = "Resources/Frontend/title@2x~iphone.png"; sourceTree = ""; }; @@ -672,7 +675,6 @@ 61A4A39312A5CCC2004D81E6 /* uVariables.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uVariables.pas; path = ../../hedgewars/uVariables.pas; sourceTree = SOURCE_ROOT; }; 61A4A3A112A5CD56004D81E6 /* uCaptions.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uCaptions.pas; path = ../../hedgewars/uCaptions.pas; sourceTree = SOURCE_ROOT; }; 61A976B2136F668500DD9878 /* uCursor.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uCursor.pas; path = ../../hedgewars/uCursor.pas; sourceTree = SOURCE_ROOT; }; - 61A97F0E136F675A00DD9878 /* hwconsts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hwconsts.h; path = ../../QTfrontend/hwconsts.h; sourceTree = SOURCE_ROOT; }; 61AC067212B2E32D000B52A2 /* Appirater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Appirater.h; path = Classes/Appirater.h; sourceTree = ""; }; 61AC067312B2E32D000B52A2 /* Appirater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Appirater.m; path = Classes/Appirater.m; sourceTree = ""; }; 61B7A33612CC21080086B604 /* StatsPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatsPageViewController.h; sourceTree = ""; }; @@ -1023,9 +1025,10 @@ 61641FE21437CD8F006E049C /* Headers */ = { isa = PBXGroup; children = ( + 61806BE0170B969D00C601BC /* hwconsts.h */, + 61806BDA170B963800C601BC /* weapons.h */, 61641FE31437CDAA006E049C /* DefinesAndMacros.h */, 32CA4F630368D1EE00C91783 /* Hedgewars_Prefix.pch */, - 61A97F0E136F675A00DD9878 /* hwconsts.h */, 6165922911CA9BD500D6E256 /* PascalImports.h */, ); name = Headers; @@ -1629,19 +1632,34 @@ shellPath = /bin/sh; shellScript = "HEDGEWARS_REVISION=`/usr/local/bin/hg identify -n ${SOURCE_DIR}|sed -e 's/\\+//'`\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $HEDGEWARS_REVISION\" \"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\""; }; - 6179928A114AE0C800BA94A9 /* ShellScript */ = { + 6179928A114AE0C800BA94A9 /* data */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); + name = data; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "SOURCE_DIR=${PROJECT_DIR}/../../\n\n#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${SOURCE_DIR}/CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${SOURCE_DIR}/CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${SOURCE_DIR}/CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${SOURCE_DIR}/CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${SOURCE_DIR}`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/config.inc\n\necho \"Copying Data...\"\ncp -R ${SOURCE_DIR}/share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some other files\necho \"Fetching additional graphics...\"\nmkdir -p ${PROJECT_DIR}/Data/Graphics/Icons\ncp ${SOURCE_DIR}/QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png ${PROJECT_DIR}/Data/Graphics/Icons/\ncp -R ${SOURCE_DIR}/project_files/Android-build/SDL-android-project/assets/Data/Graphics/Buttons ${PROJECT_DIR}/Data/Graphics/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#copy mono audio\ncp -R ${SOURCE_DIR}/project_files/AudioMono/* ${PROJECT_DIR}/Data/\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`;\ndo \n if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]];\n then\n mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/;\n fi;\ndone;\n\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\""; - showEnvVarsInLog = 0; + shellScript = "SOURCE_DIR=${PROJECT_DIR}/../../\n\n#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\necho \"Copying Data...\"\ncp -R ${SOURCE_DIR}/share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some other files\necho \"Fetching additional graphics...\"\nmkdir -p ${PROJECT_DIR}/Data/Graphics/Icons\ncp ${SOURCE_DIR}/QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png ${PROJECT_DIR}/Data/Graphics/Icons/\ncp -R ${SOURCE_DIR}/project_files/Android-build/SDL-android-project/assets/Data/Graphics/Buttons ${PROJECT_DIR}/Data/Graphics/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#copy mono audio\ncp -R ${SOURCE_DIR}/project_files/AudioMono/* ${PROJECT_DIR}/Data/\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`;\ndo \n if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]];\n then\n mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/;\n fi;\ndone;\n\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\""; + }; + 61806B78170B83EA00C601BC /* config.inc */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = config.inc; + outputPaths = ( + "$(DERIVED_FILE_DIR)/myfile", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "HG=/usr/local/bin/hg\nSOURCE_DIR=${PROJECT_DIR}/../../\n\n#create config.inc\necho \"Updating config file...\"\nPRON=`grep HEDGEWARS_PROTO_VER ${SOURCE_DIR}/CMakeLists.txt | grep -o -E [0-9]+`\nMAJN=`grep CPACK_PACKAGE_VERSION_MAJOR ${SOURCE_DIR}/CMakeLists.txt | grep -o -E \"[0-9]+\"`\nMINN=`grep CPACK_PACKAGE_VERSION_MINOR ${SOURCE_DIR}/CMakeLists.txt | grep -o -E \"[0-9]+\"`\nPATN=`grep CPACK_PACKAGE_VERSION_PATCH ${SOURCE_DIR}/CMakeLists.txt | grep -o -E \"[0-9]+\"`\nREVN=`$HG id -n ${SOURCE_DIR}`\nHASH=`$HG id -i ${SOURCE_DIR}`\n\necho \"{Do not change this file, use the project target to regenerate}\" > ${PROJECT_DIR}/config.inc\necho \"const cNetProtoVersion = $PRON;\" >> ${PROJECT_DIR}/config.inc\necho \"const cVersionString = '$MAJN.$MINN.$PATN';\" >> ${PROJECT_DIR}/config.inc\necho \"const cRevisionString = '$REVN';\" >> ${PROJECT_DIR}/config.inc\necho \"const cHashString = '$HASH';\" >> ${PROJECT_DIR}/config.inc\necho \"const cLuaLibrary = '';\" >> ${PROJECT_DIR}/config.inc"; }; 9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = { isa = PBXShellScriptBuildPhase; diff -r af4ab297b2b7 -r 539380a498e4 project_files/HedgewarsMobile/Hedgewars_Prefix.pch --- a/project_files/HedgewarsMobile/Hedgewars_Prefix.pch Tue Mar 26 18:52:42 2013 +0100 +++ b/project_files/HedgewarsMobile/Hedgewars_Prefix.pch Sun Apr 07 22:53:40 2013 +0200 @@ -30,6 +30,5 @@ #import "EditableCellView.h" #import "CreationChamber.h" #import "HWUtils.h" -#import "hwconsts.h" #endif diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_ar.ts --- a/share/hedgewars/Data/Locale/hedgewars_ar.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_ar.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -174,6 +190,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Cannot create directory %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -534,6 +565,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -934,6 +980,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1989,35 +2042,12 @@ - Main - Error - - - Cannot create directory %1 - Cannot create directory %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Cannot create directory %1 Unable to start the server: %1. - Unable to start the server: %1. - - - Unable to run engine at - - - - Error code: %1 - + Unable to start the server: %1. Video upload - Error @@ -2164,10 +2194,6 @@ - Hedgewars - - - Not all players are ready @@ -2279,6 +2305,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2389,6 +2435,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_bg.ts --- a/share/hedgewars/Data/Locale/hedgewars_bg.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_bg.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -173,6 +189,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Не може да се създаде папка %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -533,6 +564,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -933,6 +979,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2004,35 +2057,12 @@ - Main - Error - - - Cannot create directory %1 - Не може да се създаде папка %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Не може да се създаде папка %1 Unable to start the server: %1. - Грешка при стартиране на сървъра: %1. - - - Unable to run engine at - - - - Error code: %1 - + Грешка при стартиране на сървъра: %1. Video upload - Error @@ -2180,10 +2210,6 @@ - Hedgewars - - - Not all players are ready @@ -2295,6 +2321,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2405,6 +2451,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_cs.ts --- a/share/hedgewars/Data/Locale/hedgewars_cs.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_cs.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -179,6 +195,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Nemohu vytvořit adresář %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -539,6 +570,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -945,6 +991,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2018,35 +2071,12 @@ - Main - Error - - - Cannot create directory %1 - Nemohu vytvořit adresář %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Nemohu vytvořit adresář %1 Unable to start the server: %1. - Nemohu spustit server: %1. - - - Unable to run engine at - - - - Error code: %1 - + Nemohu spustit server: %1. Video upload - Error @@ -2195,10 +2225,6 @@ - Hedgewars - - - Not all players are ready @@ -2310,6 +2336,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2420,6 +2466,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_da.ts --- a/share/hedgewars/Data/Locale/hedgewars_da.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_da.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -177,6 +193,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Kan ikke oprette mappe %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -537,6 +568,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -937,6 +983,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1998,35 +2051,12 @@ - Main - Error - - - Cannot create directory %1 - Kan ikke oprette mappe %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Kan ikke oprette mappe %1 Unable to start the server: %1. - Ude af stand til at starte serveren: %1. - - - Unable to run engine at - - - - Error code: %1 - + Ude af stand til at starte serveren: %1. Error while authenticating at google.com: @@ -2188,10 +2218,6 @@ - Hedgewars - - - Not all players are ready @@ -2303,6 +2329,26 @@ Cancel uploading + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2413,6 +2459,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_de.ts --- a/share/hedgewars/Data/Locale/hedgewars_de.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_de.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -177,6 +193,24 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Verzeichnis %1 konnte nicht angelegt werden + + + Failed to open data directory: +%1 + +Please check your installation! + Konnte Daten-Verzeichnis nicht öffnen: +%1 + +Bitte überprüfe deine Installation! + HWAskQuitDialog @@ -537,6 +571,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -937,6 +986,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2017,37 +2073,37 @@ Main - Error - Hedgewars - Fehler + Hedgewars - Fehler Cannot create directory %1 - Verzeichnis %1 konnte nicht angelegt werden + Verzeichnis %1 konnte nicht angelegt werden Failed to open data directory: %1 Please check your installation! - Konnte Daten-Verzeichnis nicht öffnen: + Konnte Daten-Verzeichnis nicht öffnen: %1 Bitte überprüfe deine Installation! TCP - Error - TCP - Fehler + TCP - Fehler Unable to start the server: %1. - Server %1 konnte nicht gestartet werden. + Server %1 konnte nicht gestartet werden. Unable to run engine at - Konnte Engine nicht starten: + Konnte Engine nicht starten: Error code: %1 - Fehler-Code: %1 + Fehler-Code: %1 Video upload - Error @@ -2195,10 +2251,6 @@ - Hedgewars - - - Not all players are ready @@ -2310,6 +2362,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2420,6 +2492,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_el.ts --- a/share/hedgewars/Data/Locale/hedgewars_el.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_el.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -173,6 +189,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Δεν μπορεί να δημιουργηθεί ο κατάλογος %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -535,6 +566,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -935,6 +981,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1992,35 +2045,12 @@ - Main - Error - - - Cannot create directory %1 - Δεν μπορεί να δημιουργηθεί ο κατάλογος %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Δεν μπορεί να δημιουργηθεί ο κατάλογος %1 Unable to start the server: %1. - Δεν είναι δυνατόν να ξεκινήσει ο εξυπηρετητής : %1. - - - Unable to run engine at - - - - Error code: %1 - + Δεν είναι δυνατόν να ξεκινήσει ο εξυπηρετητής : %1. Error while authenticating at google.com: @@ -2182,10 +2212,6 @@ - Hedgewars - - - Not all players are ready @@ -2297,6 +2323,26 @@ Cancel uploading + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2407,6 +2453,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_en.ts --- a/share/hedgewars/Data/Locale/hedgewars_en.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_en.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -173,6 +189,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Cannot create directory %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -533,6 +564,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -933,6 +979,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1988,35 +2041,12 @@ - Main - Error - - - Cannot create directory %1 - Cannot create directory %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Cannot create directory %1 Unable to start the server: %1. - Unable to start the server: %1. - - - Unable to run engine at - - - - Error code: %1 - + Unable to start the server: %1. Video upload - Error @@ -2164,10 +2194,6 @@ - Hedgewars - - - Not all players are ready @@ -2279,6 +2305,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2389,6 +2435,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_es.ts --- a/share/hedgewars/Data/Locale/hedgewars_es.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_es.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -177,6 +193,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + No se pudo crear el directorio %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -537,6 +568,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -937,6 +983,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2008,35 +2061,12 @@ - Main - Error - - - Cannot create directory %1 - No se pudo crear el directorio %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + No se pudo crear el directorio %1 Unable to start the server: %1. - No se pudo iniciar el servidor: %1. - - - Unable to run engine at - - - - Error code: %1 - + No se pudo iniciar el servidor: %1. Video upload - Error @@ -2184,10 +2214,6 @@ - Hedgewars - - - Not all players are ready @@ -2299,6 +2325,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2409,6 +2455,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_fi.ts --- a/share/hedgewars/Data/Locale/hedgewars_fi.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_fi.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -173,6 +189,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Hakemiston %1 luonti epäonnistui + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -533,6 +564,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -933,6 +979,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2004,35 +2057,12 @@ - Main - Error - - - Cannot create directory %1 - Hakemiston %1 luonti epäonnistui - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Hakemiston %1 luonti epäonnistui Unable to start the server: %1. - Palvelinta ei pystytty käynnistämään: %1. - - - Unable to run engine at - - - - Error code: %1 - + Palvelinta ei pystytty käynnistämään: %1. Video upload - Error @@ -2180,10 +2210,6 @@ - Hedgewars - - - Not all players are ready @@ -2295,6 +2321,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2405,6 +2451,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_fr.ts --- a/share/hedgewars/Data/Locale/hedgewars_fr.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_fr.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -173,6 +189,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Impossible de créer le dossier %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -533,6 +564,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -933,6 +979,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2004,35 +2057,12 @@ - Main - Error - - - Cannot create directory %1 - Impossible de créer le dossier %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Impossible de créer le dossier %1 Unable to start the server: %1. - Impossible de démarrer le serveur: %1. - - - Unable to run engine at - - - - Error code: %1 - + Impossible de démarrer le serveur: %1. Video upload - Error @@ -2179,10 +2209,6 @@ - Hedgewars - - - Not all players are ready @@ -2294,6 +2320,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2404,6 +2450,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_gl.ts --- a/share/hedgewars/Data/Locale/hedgewars_gl.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_gl.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -173,6 +189,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Non se puido crear o directorio %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -533,6 +564,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -933,6 +979,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1978,35 +2031,12 @@ - Main - Error - - - Cannot create directory %1 - Non se puido crear o directorio %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Non se puido crear o directorio %1 Unable to start the server: %1. - Non se puido iniciar o servidor: %1. - - - Unable to run engine at - - - - Error code: %1 - + Non se puido iniciar o servidor: %1. Error while authenticating at google.com: @@ -2167,10 +2197,6 @@ - Hedgewars - - - Not all players are ready @@ -2282,6 +2308,26 @@ Cancel uploading + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2392,6 +2438,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_hu.ts --- a/share/hedgewars/Data/Locale/hedgewars_hu.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_hu.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -167,6 +183,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Nem sikerült létrehozni %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -527,6 +558,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -921,6 +967,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1978,35 +2031,12 @@ - Main - Error - - - Cannot create directory %1 - Nem sikerült létrehozni %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Nem sikerült létrehozni %1 Unable to start the server: %1. - Nem sikerült a szerverhez csatlakozni: %1. - - - Unable to run engine at - - - - Error code: %1 - + Nem sikerült a szerverhez csatlakozni: %1. Video upload - Error @@ -2152,10 +2182,6 @@ - Hedgewars - - - Not all players are ready @@ -2267,6 +2293,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2377,6 +2423,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_it.ts --- a/share/hedgewars/Data/Locale/hedgewars_it.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_it.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback Invia Commento + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -177,6 +193,24 @@ %1 giorni + + Scheme '%1' not supported + + + + Cannot create directory %1 + Impossibile creare la directory %1 + + + Failed to open data directory: +%1 + +Please check your installation! + Impossibile creare la directory dati: +%1 + +Per favore controlla l'installazione! + HWAskQuitDialog @@ -547,6 +581,21 @@ Login Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -947,6 +996,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2027,37 +2083,37 @@ Main - Error - Main - Errore + Main - Errore Cannot create directory %1 - Impossibile creare la directory %1 + Impossibile creare la directory %1 Failed to open data directory: %1 Please check your installation! - Impossibile creare la directory dati: + Impossibile creare la directory dati: %1 Per favore controlla l'installazione! TCP - Error - TCP - Errore + TCP - Errore Unable to start the server: %1. - Impossibile avviare il server: %1. + Impossibile avviare il server: %1. Unable to run engine at - Impossibile avviare il motore a + Impossibile avviare il motore a Error code: %1 - Codice di errore: %1 + Codice di errore: %1 Video upload - Error @@ -2206,7 +2262,7 @@ Hedgewars - Hedgewars + Hedgewars Not all players are ready @@ -2321,6 +2377,26 @@ Upload this video to your Youtube account Cariva questo video nel tuo account Youtube + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2431,6 +2507,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team @@ -3108,7 +3203,7 @@ 60 seconds cooldown after kick - 60 secondi di raffreddamento prima dell'espulsione + 60 secondi di raffreddamento prima dell'espulsione kicked diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_ja.ts --- a/share/hedgewars/Data/Locale/hedgewars_ja.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_ja.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -167,6 +183,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + フォルダー%1作成拒否 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -527,6 +558,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -921,6 +967,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1974,35 +2027,12 @@ - Main - Error - - - Cannot create directory %1 - フォルダー%1作成拒否 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + フォルダー%1作成拒否 Unable to start the server: %1. - サーバー%1の起動は出来なかった - - - Unable to run engine at - - - - Error code: %1 - + サーバー%1の起動は出来なかった Video upload - Error @@ -2148,10 +2178,6 @@ - Hedgewars - - - Not all players are ready @@ -2263,6 +2289,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2373,6 +2419,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_ko.ts --- a/share/hedgewars/Data/Locale/hedgewars_ko.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_ko.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -167,6 +183,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -527,6 +558,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -917,6 +963,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1950,37 +2003,6 @@ - Main - Error - - - - Cannot create directory %1 - - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - - - - Unable to start the server: %1. - - - - Unable to run engine at - - - - Error code: %1 - - - Video upload - Error @@ -2124,10 +2146,6 @@ - Hedgewars - - - Not all players are ready @@ -2239,6 +2257,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2349,6 +2387,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_lt.ts --- a/share/hedgewars/Data/Locale/hedgewars_lt.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_lt.ts Sun Apr 07 22:53:40 2013 +0200 @@ -105,17 +105,37 @@ FeedbackDialog - + + Please give us feedback! + + + + + We are always happy about suggestions, ideas, or bug reports. + + + + + If you found a bug, you can see if it's already known here (english): + + + + + Your email address is optional, but we may want to contact you. + + + + View - + Cancel - + Send Feedback @@ -217,6 +237,24 @@ + + + Scheme '%1' not supported + + + + + Cannot create directory %1 + + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -229,52 +267,52 @@ HWChatWidget - + %1 has been removed from your ignore list - + %1 has been added to your ignore list - + %1 has been removed from your friends list - + %1 has been added to your friends list - - Stylesheet imported from %1 - - - + Stylesheet imported from %1 + + + + Enter %1 if you want to use the current StyleSheet in future, enter %2 to reset! - + Couldn't read %1 - + StyleSheet discarded - + StyleSheet saved to %1 - + Failed to save StyleSheet to %1 @@ -292,18 +330,18 @@ - + Nickname - - + + No nickname supplied. - + Someone already uses your nickname %1 on the server. Please pick another nickname: @@ -314,12 +352,12 @@ - + Hedgewars - Nick registered - + This nick is registered, and you haven't specified a password. If this nick isn't yours, please register your own nick at www.hedgewars.org @@ -328,76 +366,76 @@ - + Your nickname is not registered. To prevent someone else from using it, please register it at www.hedgewars.org - + Your password wasn't saved either. - - + + Hedgewars - Empty nickname - + Hedgewars - Wrong password - + You entered a wrong password. - + Try Again - + Hedgewars - Connection error - + You reconnected too fast. Please wait a few seconds and try again. - - + + Cannot save record to file %1 - + Hedgewars Demo File File Types - + Hedgewars Save File File Types - + Demo name - + Demo name: @@ -654,7 +692,7 @@ - + Quit reason: @@ -666,6 +704,24 @@ Login + + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + + Nickname: + + + + + Password: + + HWUploadVideoDialog @@ -691,17 +747,17 @@ HatPrompt - + Search for a hat: - + Cancel - + Use selected hat @@ -1151,6 +1207,14 @@ + PageNetServer + + + Insert your address here + + + + PageOptions @@ -1380,52 +1444,52 @@ PageRoomsList - + Search for a room: - + Create room - + Join room - + Room state - + Rules: - + Weapons: - + Clear filters - + Admin features - + Open server administration page - + %1 players online @@ -1739,23 +1803,23 @@ - + Ignore - + Add friend - + Unignore - + Remove friend @@ -1775,12 +1839,12 @@ - + Show games in lobby - + Show games in-progress @@ -1855,7 +1919,7 @@ - + Save password @@ -1979,8 +2043,8 @@ - - + + Any @@ -2096,22 +2160,22 @@ - + Tip: - + This development build is 'work in progress' and may not be compatible with other versions of the game, while some features might be broken or incomplete! - + Server name: - + Server port: @@ -2283,27 +2347,27 @@ - + Your Email - + Summary - + Send system information - + Description - + Type the security code: @@ -2389,70 +2453,71 @@ - + Hedgewars - Nick not registered - + Unable to start server - + Connection to server is lost - + Not all players are ready - + Are you sure you want to start this game? Not all players are ready. - + + Hedgewars - Error - + System Information Preview - - + + Failed to generate captcha - + Failed to download captcha - + Please fill out all fields. Email is optional. - - + + Hedgewars - Success - + All file associations have been set - + File association failed. @@ -2490,46 +2555,6 @@ - - - Main - Error - - - - - Cannot create directory %1 - - - - - Failed to open data directory: -%1 - -Please check your installation! - - - - - - TCP - Error - - - - - Unable to start the server: %1. - - - - - Unable to run engine at - - - - - Error code: %1 - - - Netgame - Error @@ -2570,22 +2595,22 @@ - + Room Name - Error - + Please select room from the list - + Room Name - Are you sure? - + The game you are trying to join has started. Do you still want to join the room? @@ -2676,26 +2701,20 @@ - + Hedgewars - Warning - + Hedgewars - Information - - - Hedgewars - - QPushButton - default @@ -2737,11 +2756,36 @@ + + Reset + + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start + + Start private server + + + Associate file extensions @@ -2962,6 +3006,28 @@ + TCPBase + + + Unable to start server at %1. + + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + + At least two teams are required to play! + + + + TeamShowWidget @@ -2972,17 +3038,17 @@ ThemePrompt - + Search for a theme: - + Cancel - + Use selected theme diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_ms.ts --- a/share/hedgewars/Data/Locale/hedgewars_ms.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_ms.ts Sun Apr 07 22:53:40 2013 +0200 @@ -105,17 +105,37 @@ FeedbackDialog - + + Please give us feedback! + + + + + We are always happy about suggestions, ideas, or bug reports. + + + + + If you found a bug, you can see if it's already known here (english): + + + + + Your email address is optional, but we may want to contact you. + + + + View - + Cancel - + Send Feedback @@ -205,6 +225,24 @@ + + + Scheme '%1' not supported + + + + + Cannot create directory %1 + + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -217,52 +255,52 @@ HWChatWidget - + %1 has been removed from your ignore list - + %1 has been added to your ignore list - + %1 has been removed from your friends list - + %1 has been added to your friends list - - Stylesheet imported from %1 - - - + Stylesheet imported from %1 + + + + Enter %1 if you want to use the current StyleSheet in future, enter %2 to reset! - + Couldn't read %1 - + StyleSheet discarded - + StyleSheet saved to %1 - + Failed to save StyleSheet to %1 @@ -285,12 +323,12 @@ - + Hedgewars - Nick registered - + This nick is registered, and you haven't specified a password. If this nick isn't yours, please register your own nick at www.hedgewars.org @@ -299,93 +337,93 @@ - + Your nickname is not registered. To prevent someone else from using it, please register it at www.hedgewars.org - + Your password wasn't saved either. - + Nickname - + Someone already uses your nickname %1 on the server. Please pick another nickname: - - + + No nickname supplied. - - + + Hedgewars - Empty nickname - + Hedgewars - Wrong password - + You entered a wrong password. - + Try Again - + Hedgewars - Connection error - + You reconnected too fast. Please wait a few seconds and try again. - - + + Cannot save record to file %1 - + Hedgewars Demo File File Types - + Hedgewars Save File File Types - + Demo name - + Demo name: @@ -584,7 +622,7 @@ HWNewNet - + Quit reason: @@ -654,6 +692,24 @@ Login + + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + + Nickname: + + + + + Password: + + HWUploadVideoDialog @@ -679,17 +735,17 @@ HatPrompt - + Search for a hat: - + Cancel - + Use selected hat @@ -1127,6 +1183,14 @@ + PageNetServer + + + Insert your address here + + + + PageOptions @@ -1356,52 +1420,52 @@ PageRoomsList - + Search for a room: - + Create room - + Join room - + Room state - + Rules: - + Weapons: - + Clear filters - + Admin features - + Open server administration page - + %1 players online @@ -1726,33 +1790,33 @@ - + Ignore - + Add friend - + Unignore - + Remove friend - + Show games in lobby - + Show games in-progress @@ -1760,7 +1824,7 @@ QCheckBox - + Save password @@ -1951,8 +2015,8 @@ - - + + Any @@ -2080,47 +2144,47 @@ - + Your Email - + Summary - + Send system information - + Description - + Type the security code: + + Tip: + + + - Tip: - - - - This development build is 'work in progress' and may not be compatible with other versions of the game, while some features might be broken or incomplete! - + Server name: - + Server port: @@ -2361,114 +2425,75 @@ - + Hedgewars - Nick not registered - + Unable to start server - + Connection to server is lost - + Not all players are ready - + Are you sure you want to start this game? Not all players are ready. - + + Hedgewars - Error - + System Information Preview - - + + Failed to generate captcha - + Failed to download captcha - + Please fill out all fields. Email is optional. - - + + Hedgewars - Success - + All file associations have been set - + File association failed. - - - Main - Error - - - - - Cannot create directory %1 - - - - - Failed to open data directory: -%1 - -Please check your installation! - - - - - - TCP - Error - - - - - Unable to start the server: %1. - - - - - Unable to run engine at - - - - - Error code: %1 - - - Error while authenticating at google.com: @@ -2532,22 +2557,22 @@ - + Room Name - Error - + Please select room from the list - + Room Name - Are you sure? - + The game you are trying to join has started. Do you still want to join the room? @@ -2646,20 +2671,15 @@ - + Hedgewars - Warning - + Hedgewars - Information - - - Hedgewars - - QPushButton @@ -2670,7 +2690,6 @@ - default @@ -2712,11 +2731,36 @@ + + Reset + + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start + + Start private server + + + Associate file extensions @@ -2932,6 +2976,28 @@ + TCPBase + + + Unable to start server at %1. + + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + + At least two teams are required to play! + + + + TeamShowWidget @@ -2942,17 +3008,17 @@ ThemePrompt - + Search for a theme: - + Cancel - + Use selected theme diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_nl.ts --- a/share/hedgewars/Data/Locale/hedgewars_nl.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_nl.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -173,6 +189,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -533,6 +564,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -929,6 +975,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1964,37 +2017,6 @@ - Main - Error - - - - Cannot create directory %1 - - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - - - - Unable to start the server: %1. - - - - Unable to run engine at - - - - Error code: %1 - - - Video upload - Error @@ -2139,10 +2161,6 @@ - Hedgewars - - - Not all players are ready @@ -2254,6 +2272,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2364,6 +2402,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_pl.ts --- a/share/hedgewars/Data/Locale/hedgewars_pl.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_pl.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -183,6 +199,24 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Nie można utworzyć katalogu %1 + + + Failed to open data directory: +%1 + +Please check your installation! + Nie można otworzyć katalogu z danymi: +%1 + +Sprawdź poprawność instalacji! + HWAskQuitDialog @@ -544,6 +578,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -950,6 +999,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2030,37 +2086,37 @@ Main - Error - Błąd + Błąd Cannot create directory %1 - Nie można utworzyć katalogu %1 + Nie można utworzyć katalogu %1 Failed to open data directory: %1 Please check your installation! - Nie można otworzyć katalogu z danymi: + Nie można otworzyć katalogu z danymi: %1 Sprawdź poprawność instalacji! TCP - Error - TCP - Błąd + TCP - Błąd Unable to start the server: %1. - Nie można uruchomić serwera: %1. + Nie można uruchomić serwera: %1. Unable to run engine at - Nie można uruchomić silnika na + Nie można uruchomić silnika na Error code: %1 - Kod błędu: %1 + Kod błędu: %1 Video upload - Error @@ -2209,10 +2265,6 @@ - Hedgewars - - - Not all players are ready @@ -2324,6 +2376,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2434,6 +2506,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_pt_BR.ts --- a/share/hedgewars/Data/Locale/hedgewars_pt_BR.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_pt_BR.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -173,6 +189,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Não foi possível criar o diretório %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -534,6 +565,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -934,6 +980,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2005,35 +2058,12 @@ - Main - Error - - - Cannot create directory %1 - Não foi possível criar o diretório %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Não foi possível criar o diretório %1 Unable to start the server: %1. - Não foi possível iniciar o servidor: %1. - - - Unable to run engine at - - - - Error code: %1 - + Não foi possível iniciar o servidor: %1. Video upload - Error @@ -2181,10 +2211,6 @@ - Hedgewars - - - Not all players are ready @@ -2296,6 +2322,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2407,6 +2453,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_pt_PT.ts --- a/share/hedgewars/Data/Locale/hedgewars_pt_PT.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_pt_PT.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -177,6 +193,24 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Não foi possível criar o diretório %1 + + + Failed to open data directory: +%1 + +Please check your installation! + Erro ao abrir o diretório: +%1 + +Por favor verifica a tua instalação! + HWAskQuitDialog @@ -538,6 +572,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -939,6 +988,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2019,37 +2075,37 @@ Main - Error - Main - Erro + Main - Erro Cannot create directory %1 - Não foi possível criar o diretório %1 + Não foi possível criar o diretório %1 Failed to open data directory: %1 Please check your installation! - Erro ao abrir o diretório: + Erro ao abrir o diretório: %1 Por favor verifica a tua instalação! TCP - Error - TCP - Erro + TCP - Erro Unable to start the server: %1. - Não foi possível iniciar o servidor: %1. + Não foi possível iniciar o servidor: %1. Unable to run engine at - Não foi possivel lançar o motor de jogo em + Não foi possivel lançar o motor de jogo em Error code: %1 - Código de erro: %1 + Código de erro: %1 Video upload - Error @@ -2197,10 +2253,6 @@ - Hedgewars - - - Not all players are ready @@ -2312,6 +2364,26 @@ Upload this video to your Youtube account Enviar este vídeo para a tua conta do Youtube + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2422,6 +2494,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_ro.ts --- a/share/hedgewars/Data/Locale/hedgewars_ro.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_ro.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -179,6 +195,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Cannot create directory %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -539,6 +570,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -945,6 +991,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1988,35 +2041,12 @@ - Main - Error - - - Cannot create directory %1 - Cannot create directory %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Cannot create directory %1 Unable to start the server: %1. - Unable to start the server: %1. - - - Unable to run engine at - - - - Error code: %1 - + Unable to start the server: %1. Error while authenticating at google.com: @@ -2179,10 +2209,6 @@ - Hedgewars - - - Not all players are ready @@ -2294,6 +2320,26 @@ Cancel uploading + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2404,6 +2450,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_ru.ts --- a/share/hedgewars/Data/Locale/hedgewars_ru.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_ru.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -183,6 +199,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Не могу создать папку %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -544,6 +575,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -950,6 +996,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2029,35 +2082,12 @@ - Main - Error - - - Cannot create directory %1 - Не могу создать папку %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Не могу создать папку %1 Unable to start the server: %1. - Ошибка запуска сервера: %1. - - - Unable to run engine at - - - - Error code: %1 - + Ошибка запуска сервера: %1. Video upload - Error @@ -2206,10 +2236,6 @@ - Hedgewars - - - Not all players are ready @@ -2321,6 +2347,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2431,6 +2477,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_sk.ts --- a/share/hedgewars/Data/Locale/hedgewars_sk.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_sk.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -183,6 +199,24 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Nepodarilo sa vytvoriť adresár %1 + + + Failed to open data directory: +%1 + +Please check your installation! + Chyba pri otváraní adresára s dátami: +%1 + +Skontrolujte, prosím, inštaláciu! + HWAskQuitDialog @@ -543,6 +577,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -949,6 +998,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2027,37 +2083,37 @@ Main - Error - Hlavné okno - Chyba + Hlavné okno - Chyba Cannot create directory %1 - Nepodarilo sa vytvoriť adresár %1 + Nepodarilo sa vytvoriť adresár %1 Failed to open data directory: %1 Please check your installation! - Chyba pri otváraní adresára s dátami: + Chyba pri otváraní adresára s dátami: %1 Skontrolujte, prosím, inštaláciu! TCP - Error - TCP - Chyba + TCP - Chyba Unable to start the server: %1. - Nepodarilo sa spustiť server: %1. + Nepodarilo sa spustiť server: %1. Unable to run engine at - Nepodarilo sa spustiť enginu na + Nepodarilo sa spustiť enginu na Error code: %1 - Kód chyby: %1 + Kód chyby: %1 Video upload - Error @@ -2206,10 +2262,6 @@ - Hedgewars - - - Not all players are ready @@ -2321,6 +2373,26 @@ Upload this video to your Youtube account Uploadovať video na váš účet YouTube + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2431,6 +2503,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_sv.ts --- a/share/hedgewars/Data/Locale/hedgewars_sv.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_sv.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -177,6 +193,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Kan inte skapa katalog %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -537,6 +568,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -937,6 +983,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2008,35 +2061,12 @@ - Main - Error - - - Cannot create directory %1 - Kan inte skapa katalog %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Kan inte skapa katalog %1 Unable to start the server: %1. - Kunde inte starta servern: %1. - - - Unable to run engine at - - - - Error code: %1 - + Kunde inte starta servern: %1. Video upload - Error @@ -2184,10 +2214,6 @@ - Hedgewars - - - Not all players are ready @@ -2299,6 +2325,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2409,6 +2455,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_tr_TR.ts --- a/share/hedgewars/Data/Locale/hedgewars_tr_TR.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_tr_TR.ts Sun Apr 07 22:53:40 2013 +0200 @@ -5,14 +5,14 @@ About Unknown Compiler - + Bilinmeyen Derleyici AbstractPage Go back - + Geri Dön @@ -23,79 +23,95 @@ copy of - + kopya BanDialog IP - IP + IP Nick - + Takma Ad IP/Nick - + IP Reason - + Sebep Duration - + Süre Ok - + Tamam Cancel - İptal + İptal you know why - + biliyor musunuz Warning - + Uyarı Please, specify %1 - + Lütfen %1 belirtin nickname - + takmaad permanent - + kalıcı DataManager Use Default - + Varsayılanı Kullan FeedbackDialog View - + Göster Cancel - İptal + İptal Send Feedback + Geribildirim Gönder + + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. @@ -103,12 +119,12 @@ FreqSpinBox Never - + Asla Every %1 turn - - + + Her %1 turda @@ -124,97 +140,119 @@ Game scheme will auto-select a weapon - + Oyun planı otomatik bir silah seçecek Map - Harita + Harita Game options - + Oyun seçenekleri HWApplication %1 minutes - - + + %1 dakika %1 hour - - + + %1 saat %1 hours - - + + %1 saat %1 day - - + + %1 gün %1 days - - + + %1 gün + + Scheme '%1' not supported + + + + Cannot create directory %1 + %1 dizini oluşturulamadı + + + Failed to open data directory: +%1 + +Please check your installation! + Veri dizini açılamadı: +%1 + +Lütfen kurulumunuzu denetleyin! + HWAskQuitDialog Do you really want to quit? - + Gerçekten çıkmak istiyor musunuz? HWChatWidget %1 has been removed from your ignore list - - - - %1 has been added to your ignore list - + %1 yoksayma listenizden kaldırıldı + + + %1 has been added toINCOMPLETE your ignore list + %1 yoksayma listenize eklendi %1 has been removed from your friends list - + %1 arkadaş listenizden kaldırıldı %1 has been added to your friends list - + %1 arkadaş listenize eklendi Stylesheet imported from %1 - + %1 biçembelgesi aktarıldı Enter %1 if you want to use the current StyleSheet in future, enter %2 to reset! - + Geçerli BiçemBelgesini ileride kullanmak için %1, sıfırlamak için %3 girin! Couldn't read %1 - + %1 okunamadı StyleSheet discarded - + BiçemBelgesi silindi StyleSheet saved to %1 - + BiçemBelgesi %1 konumuna kaydedildi Failed to save StyleSheet to %1 + BiçemBelgesi %1 konumuna kaydedilemedi + + + %1 has been added to your ignore list @@ -226,50 +264,50 @@ DefaultTeam - + VarsayılanTakım Hedgewars Demo File File Types - + Hedgewars Gösteri Dosyası Hedgewars Save File File Types - + Hedgewars Kayıt Dosyası Demo name - + Gösteri adı Demo name: - + Gösteri adı: Game aborted - + Oyun sonlandı Nickname - + Takma ad No nickname supplied. - + Takma ad girilmedi. Someone already uses your nickname %1 on the server. Please pick another nickname: - + Sunucuda başka biri %1 takma adını kullanıyor. Başka bir isim girin: %1's Team - + %1 Oyuncusunun Takımı Hedgewars - Nick registered - + Hedgewars - Takma ad kayıtlı This nick is registered, and you haven't specified a password. @@ -277,44 +315,53 @@ If this nick isn't yours, please register your own nick at www.hedgewars.org Password: - + Bu takma ad kayıtlı ve bir parola belirtmediniz. + +Bu takma ad sizin değilse, lütfen kendi takma adınızı www.hedgewars.org adresinden kaydedin. + +Parola: Your nickname is not registered. To prevent someone else from using it, please register it at www.hedgewars.org - + Takma adınız kayıtlı değil. +Başkasının kullanmaması için lütfen, +www.hedgewars.org sitesinde kaydedin Your password wasn't saved either. - + + +Parolanız da kaydedilmedi. Hedgewars - Empty nickname - + Hedgewars - Boş takma ad Hedgewars - Wrong password - + Hedgewars - Hatalı parola You entered a wrong password. - + Hatalı parola girdiniz. Try Again - + Tekrar Dene Hedgewars - Connection error - + Hedgewars - Bağlantı hatası You reconnected too fast. Please wait a few seconds and try again. - + Çok hızlı yeniden bağlandınız. +Birkaç saniye bekleyin ve yeniden deneyin. @@ -356,103 +403,103 @@ Small tunnels - + Küçük tüneller Medium tunnels - + Orta tüneller Seed - + Besleme Map type: - + Harita türü: Image map - + Resim haritası Mission map - + Görev haritası Hand-drawn - + El çizimi Randomly generated - + Rastgele oluşturulmuş Random maze - + Rastgele labirent Random - Rastgele + Rastgele Map preview: - + Harita önizleme: Load map drawing - + Yerel harita çizimi Edit map drawing - + Harita çizimini düzenle Small islands - + Küçük adalar Medium islands - + Orta adalar Large islands - + Büyük adalar Map size: - + Harita boyutu: Maze style: - + Labirent biçemi: Mission: - + Görev: Map: - + Harita: Theme: - + Tema: Load drawn map - + Çizili harita yükle Drawn Maps - + Çizili Haritalar All files - + Tüm dosyalar Large tunnels - + Büyük tüneller @@ -486,7 +533,7 @@ Quit reason: - Çıkma sebebi: + Çıkma sebebi: You got kicked @@ -494,37 +541,52 @@ %1 *** %2 has joined the room - + %1 *** %2 odaya katıldı %1 *** %2 has joined - + %1 *** %2 katıldı %1 *** %2 has left - + %1 *** %2 ayrıldı %1 *** %2 has left (%3) - + %1 *** %2 ayrıldı (%3) User quit - + Kullanıcı çıktı Remote host has closed connection - + Uzak sunucu bağlantıyı kapattı The server is too old. Disconnecting now. - + Sunucu çok eski. Bağlantı kesiliyor. HWPasswordDialog Login + Oturum aç + + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: @@ -532,33 +594,33 @@ HWUploadVideoDialog Upload video - + Video yükle Upload - + Yükle HatButton Change hat (%1) - + Şapkayı değiştir (%1) HatPrompt Cancel - İptal + İptal Use selected hat - + Seçili şapkayı kullan Search for a hat: - + Şapka ara: @@ -572,7 +634,7 @@ KeyBinder Category - + Kategori @@ -580,93 +642,94 @@ Duration: %1m %2s - + Süre: %1d %2s + Video: %1x%2, - + Video: %1x%2, %1 fps, - + %1 fps, Audio: - + Ses: unknown - + bilinmiyor MapModel No description available. - + Kullanılabilir açıklama yok. PageAdmin Clear Accounts Cache - + Hesap Belleğini Temizle Fetch data - + Veri getir Server message for latest version: - + Son sürüm için sunucu iletisi: Server message for previous versions: - + Önceki sürümler için sunucu iletisi: Latest version protocol number: - + En son sürüm protokol numarası: MOTD preview: - + MOTD önizleme: Set data - + Veri ayarla General - Genel + Genel Bans - + Engellemeler IP/Nick - + IP/Takma Ad Expiration - + Dolum Reason - + Sebep Refresh - + Yenile Add - + Ekle Remove - + Kaldır @@ -680,39 +743,39 @@ PageDrawMap Undo - + Geri al Clear - + Temizle Load - Yükle + Yükle Save - + Kaydet Load drawn map - + Çizili harita yükle Save drawn map - + Çizili haritayı kaydet Drawn Maps - + Çizili Haritalar All files - + Tüm dosyalar Eraser - + Silgi @@ -723,93 +786,93 @@ Select an action to choose a custom key bind for this team - + Bu takıma özel tuş ataması için bir eylem seçin Use my default - + Varsayılanı kullan Reset all binds - + Tüm atamaları sıfırla Custom Controls - + Özel Denetimler Hat - + Şapka Name - + İsim This hedgehog's name - + Bu kirpinin adı Randomize this hedgehog's name - + Kirpi adını rastgele ata Random Team - + Rastgele Takım PageGameStats Details - + Ayrıntılar Health graph - + Sağlık Grafiği Ranking - + Sıralama The best shot award was won by <b>%1</b> with <b>%2</b> pts. - + En iyi atış ödülü: <b>%2</b> puanla <b>%1</b> The best killer is <b>%1</b> with <b>%2</b> kills in a turn. - - + + En iyi öldürücü: <b>%1</b> bir turda <b>%2</b> öldürme. A total of <b>%1</b> hedgehog(s) were killed during this round. - - + + Bu turda toplam <b>%1</b> kirpi öldürüldü. (%1 kill) - - + + (%1 öldürme) <b>%1</b> thought it's good to shoot his own hedgehogs with <b>%2</b> pts. - - + + <b>%1</b> kendi kirpilerini <b>%2</b> puanla vurmanın güzel olduğunu düşündü <b>%1</b> killed <b>%2</b> of his own hedgehogs. - - + + <b>%1</b> kendi <b>%2</b> kirpisini öldürdü <b>%1</b> was scared and skipped turn <b>%2</b> times. - - + + <b>%1</b> korktu ve <b>%2</b> kez turu pas geçti. @@ -817,73 +880,73 @@ PageInGame In game... - + Oyunda... PageInfo Open the snapshot folder - + Ekran görüntü klasörünü aç PageMain Downloadable Content - + İndirilebilir İçerik Play a game on a single computer - + Tek bir bilgisayarda oyna Play a game across a network - + Ağ üzerinde oyna Read about who is behind the Hedgewars Project - + Hedgewars Projesinin arkasında kimlerin olduğunu göster Leave a feedback here reporting issues, suggesting features or just saying how you like Hedgewars - + Sorunları bildirme, özellik önerme veya Hedgewars oyununu ne kadar sevdiğinizi söylemek için geri bildirim bırakın Access the user created content downloadable from our website - + Websitemizden kullanıcılar tarafından oluşturulmuş indirilebilir içeriğe bakın Exit game - + Oyundan çık Manage videos recorded from game - + Oyunda kayıtlı videolarınızı yönetin Edit game preferences - + Oyun tercihlerini düzenle Play a game across a local area network - + Yerel ağda bir oyun oyna Play a game on an official server - + Resmi bir sunucuda oyun oyna Feedback - + Geri Bildirim Play local network game - + Yerel ağ oyunu oyna Play official network game - + Resmi ağ oyunu oyna @@ -894,29 +957,36 @@ Edit game preferences - + Oyun tercihlerini düzenle PageNetGame Control - Kontrol + Denetim Edit game preferences - + Oyun tercihlerini düzenle Start - Başla + Başla Update - Güncelle + Güncelle Room controls + Oda denetimleri + + + + PageNetServer + + Insert your address here @@ -932,111 +1002,111 @@ Delete team - + Takımı sil You can't edit teams from team selection. Go back to main menu to add, edit or delete teams. - + Takım seçiminden takımları düzenleyemezsiniz. Takım eklemek, düzenlemek ve silmek için ana menüye dönün. New scheme - + Yeni plan Edit scheme - + Planı düzenle Delete scheme - + Planı sil New weapon set - + Yeni silah seti Edit weapon set - + Silah setini düzenle Delete weapon set - + Silah setini sil Advanced - Gelişmiş + Gelişmiş Reset to default colors - + Varsayılan renklere sıfırla Proxy host - + Vekil sunucusu Proxy port - + Vekil portu Proxy login - + Vekil kullanıcı adı Proxy password - + Vekil parolası No proxy - + Vekil sunucu yok Socks5 proxy - + Socks5 vekil sunucusu HTTP proxy - + HTTp vekil sunucusu System proxy settings - + Sistem vekil ayarları Select an action to change what key controls it - + Denetimi kullanan tuşu değiştirmek için bir eylem seçin Reset to default - + Varsayılana sıfırla Reset all binds - + Tüm atamaları sıfırla Game - + Oyun Graphics - + Grafik Audio - + Ses Controls - + Denetimler Video Recording - + Video Kaydı Network - + Teams @@ -1044,7 +1114,7 @@ Schemes - + Planlar Weapons @@ -1052,43 +1122,43 @@ Frontend - + Ön Uç Custom colors - + Özel renkler Game audio - + Oyun sesi Frontend audio - + Ön uç sesi Account - + Hesap Proxy settings - + Vekil sunucu ayarları Miscellaneous - + Çeşitli Updates - + Güncellemeler Check for updates - + Güncellemeleri Denetle Video recording options - + Video kayıt seçenekleri @@ -1118,41 +1188,41 @@ Rules: - + Kurallar: Weapons: - + Silahlar: %1 players online - + %1 oyuncu çevrimiçi Search for a room: - + Bir oda ara: Create room - + Oda oluştur Join room - + Odaya katıl Room state - + Oda durumu Clear filters - + Süzgeçleri temizle Open server administration page - + Sunucu yönetim sayfasını aç @@ -1163,7 +1233,7 @@ Teams will start on opposite sides of the terrain, two team colours max! - Takımlar bölgenin faklı taraflarında başlarlar, en fazla iki takım rengi! + Takımlar bölgenin farklı taraflarında başlarlar, en fazla iki takım rengi! Land can not be destroyed! @@ -1183,7 +1253,7 @@ Gain 80% of the damage you do back in health - Verdiğin hasarın %%80'ini sağlık olarak kazan + Verdiğin hasarın %80'ini sağlık olarak kazan Share your opponents pain, share their damage @@ -1211,63 +1281,63 @@ Order of play is random instead of in room order. - + Oda sırası yerine oynama sırası rastgeledir. Play with a King. If he dies, your side dies. - + Bir Kralla oyna. O ölürse takımın ölür. Take turns placing your hedgehogs before the start of play. - + Oyuna başlamadan önce kirpileri sırayla yerleştirin. Ammo is shared between all teams that share a colour. - + Aynı rengi paylaşan tüm takımlar cephaneyi paylaşır. Disable girders when generating random maps. - + Rastgele haritalar oluştururken kirişleri devre dışı bırak. Disable land objects when generating random maps. - + Rastgele haritalar oluştururken zemin nesnelerini devre dışı bırak. AI respawns on death. - + Yapay zeka, öldükten sonra yeniden doğar All (living) hedgehogs are fully restored at the end of turn - + Tüm (yaşayan) kirpiler tur sonunda eski haline gelir Attacking does not end your turn. - + Saldırmak sıranı bitirmez. Weapons are reset to starting values each turn. - + Silahlar her turda başlangıç değerlerine sıfırlanır. Each hedgehog has its own ammo. It does not share with the team. - + Her kirpinin kendi cephanesi olur. Takımla paylaşmaz. You will not have to worry about wind anymore. - + Artık rüzgarı dert etmen gerekmiyor. Wind will affect almost everything. - + Rüzgar neredeyse her şeyi etkiler. Copy - + Kopyala Teams in each clan take successive turns sharing their turn time. - + Her klandaki takımlar kendi sıralarındaki zamanı paylaşarak değişirler. Add an indestructible border around the terrain @@ -1275,14 +1345,14 @@ Add an indestructible border along the bottom - + Alta yok edilemez bir sınır ekle PageSelectWeapon Default - Öntanımlı + Varsayılan Delete @@ -1294,92 +1364,94 @@ Copy - + Kopyala PageSinglePlayer Play a quick game against the computer with random settings - + Rastgele ayarlarla bilgisayara karşı hızlı bir oyun oyna Play a hotseat game against your friends, or AI teams - + Arkadaşlarınla veya Yapay Zeka takımlarıyla ayarlanmış bir oyun oyna Campaign Mode - + Mücadele Kipi Practice your skills in a range of training missions - + Yeteneklerini çeşitli eğitim görevleri ile geliştir Watch recorded demos - + Kayıtlı gösterileri izle Load a previously saved game - + Önceden kayıtlı bir oyun yükle PageTraining No description available - + Kullanılabilir açıklama yok Select a mission! - + Bir görev seç! Pick the mission or training to play - + Oynamak üzere bir görev veya eğitim seç Start fighting - + Dövüşe başla PageVideos Name - + İsim Size - + Boyut %1 bytes - + %1 bayt (in progress...) - + (yapım aşamasında...) encoding - + kodlanıyor uploading - + yükleniyor Date: %1 - + Tarih: %1 + Size: %1 - + Boyut: %1 + @@ -1406,23 +1478,23 @@ Follow - + Takip Et Ignore - + Yoksay Add friend - + Arkadaş ekle Unignore - + Yoksaymayı kapat Remove friend - + Arkadaş kaldır Update @@ -1430,15 +1502,15 @@ Restrict Unregistered Players Join - + Kayıtsız Oyuncuların Katılmasını Kısıtla Show games in lobby - + Lobideki oyunları göster Show games in-progress - + Süren oyunları göster @@ -1461,59 +1533,59 @@ Check for updates at startup - + Başlangıçta güncellemeleri denetle Show ammo menu tooltips - + Cephane menüsü araç ipuçlarını göster Save password - + Parolayı kaydet Save account name and password - + Hesap adı ve parolasını kaydet Video is private - + Video özel Record audio - + Sesi kaydet Use game resolution - + Oyun çözünürlüğünü kullan Visual effects - + Görsel efektler Sound - + Ses In-game sound effects - + Oyun ses efektleri Music - + Müzik In-game music - + Oyun içi müzik Frontend sound effects - + Ön uç ses efektleri Frontend music - + Ön uç müziği @@ -1524,79 +1596,79 @@ Level - Bilgisayar + Seviye (System default) - + (Sistem varsayılanı) Community - + Topluluk Any - + Herhangi Disabled - + Kapalı Red/Cyan - + Kırmızı/Camgöbeği Cyan/Red - + Camgöbeği/Kırmızı Red/Blue - + Kırmızı/Mavi Blue/Red - + Mavi/Kırmızı Red/Green - + Kırmızı/Yeşil Green/Red - + Yeşil/Kırmızı Side-by-side - + Yan yana Top-Bottom - + Üst-Alt Red/Cyan grayscale - + Kırmızı/Camgöbeği gri Cyan/Red grayscale - + Camgöbeği/Kırmızı gri Red/Blue grayscale - + Kırmızı/Mavi gri Blue/Red grayscale - + Mavi/Kırmızı gri Red/Green grayscale - + Kırmızı/Yeşil gri Green/Red grayscale - + Yeşil/Kırmızı gri @@ -1627,15 +1699,15 @@ Team Settings - + Takım ayarları Videos - + Videolar Description - + Açıklama @@ -1710,141 +1782,143 @@ % Dud Mines - + Sahte Mayın % Name - + İsim Type - + Tür Grave - + Mezar taşı Flag - + Bayrak Voice - + Ses Locale - + Dil Explosives - + Patlayıcılar Tip: - + İpucu: Quality - + Kalite % Health Crates - + Sağlık Sandık %'si Health in Crates - + Sandıklardaki Sağlık Sudden Death Water Rise - + Ani Ölüm Su Yükselmesi Sudden Death Health Decrease - + Ani Ölüm Sağlık Azaltması % Rope Length - + Halat Uzunluk %'si Stereo rendering - + Stereo hazırlama Style - + Biçem Scheme - + Plan % Get Away Time - + Uzakta Zamanı %'si There are videos that are currently being processed. Exiting now will abort them. Do you really want to quit? - + Şu anda işlenen videolar var. +Çıkmak bu işlemi sonlandıracak. +Gerçekten çıkmak istiyor musunuz? Please provide either the YouTube account name or the email address associated with the Google Account. - + Lütfen YouTube hesap adını veya Google Hesabınız ile ilişkilendirmiş e-posta adresinizi girin. Account name (or email): - + Hesap adı (veya e-posta): Password: - + Parola: Video title: - + Video başlığı: Video description: - + Video açıklaması: Tags (comma separated): - + Etiketler (virgülle ayrılmış): Description - + Açıklama Nickname - + Takma ad Format - + Biçim Audio codec - + Ses kodlayıcı Video codec - + Video kodlayıcı Framerate - + Kare oranı Bitrate (Kbps) - + Bit oranı (Kbps) This development build is 'work in progress' and may not be compatible with other versions of the game, while some features might be broken or incomplete! - + Bu geliştirme derlemesi 'yapım aşamasındadır' ve oyunun diğer sürümleri ile uyumlu olmayabilir; bazı özellikler bozuk veya tamamlanmamış olabilir! Fullscreen @@ -1852,35 +1926,35 @@ Fullscreen Resolution - + Tam Ekran Çözünürlüğü Windowed Resolution - + Pencere Çözünürlüğü Your Email - + E-postanız Summary - + Özet Send system information - + Sistem bilgisi gönder Type the security code: - + Güvenlik kodunu yaz: Revision - + Gözden Geçirme This program is distributed under the %1 - + Bu program %1 altında dağıtılmaktadır @@ -1891,11 +1965,11 @@ hedgehog %1 - + kirpi %1 anonymous - + anonim @@ -1906,7 +1980,7 @@ -r%1 (%2) - + -r%1 (%2) @@ -1921,96 +1995,95 @@ File association failed. - + Dosya ilişkilendirme başarısız. Error while authenticating at google.com: - + Google.com ile kimlik açma başarısız Login or password is incorrect - + Kullanıcı adı veya parolası yanlış Error while sending metadata to youtube.com: - + Youtube.com üst verisi gönderilirken hata Teams - Are you sure? - + Takımlar - Emin misiniz? Do you really want to delete the team '%1'? - + '%1' takımını gerçekten silmek istiyor musunuz? Cannot delete default scheme '%1'! - + Varsayılan '%1' planı silinemez Please select a record from the list - + Lütfen listeden bir kayıt seçin Unable to start server - + Sunucu başlatılamadı Hedgewars - Error - + Hedgewars - Hata Hedgewars - Success - + Hedgewars - Başarılı All file associations have been set - - - - Main - Error - + Tüm dosya ilişkilendirmeleri ayarlandı Cannot create directory %1 - %1 dizini oluşturulamadı + %1 dizini oluşturulamadı Failed to open data directory: %1 Please check your installation! - + Veri dizini açılamadı: +%1 + +Lütfen kurulumunuzu denetleyin! TCP - Error - + TCP - Hata Unable to start the server: %1. - Sunucu başlatılamadı: %1. + Sunucu başlatılamadı: %1. Unable to run engine at - + Motor şurada başlatılamadı: Error code: %1 - + Hata kodu: %1 Video upload - Error - + Video yükleme - Hata Netgame - Error - + Ağ oyunu - Hata Please select a server from the list - + Lütfen listeden bir sunucu seçin Please enter room name @@ -2018,7 +2091,7 @@ Record Play - Error - + Oyunu Kaydet - Hata Please select record from the list @@ -2026,15 +2099,15 @@ Cannot rename to - + Adlandırma başarısız: Cannot delete file - + Dosya silinemedi: Room Name - Error - + Oda Adı - Hata Please select room from the list @@ -2042,126 +2115,128 @@ Room Name - Are you sure? - + Oda Adı - Emin misiniz? The game you are trying to join has started. Do you still want to join the room? - + Katılmaya çalıştığınız oyun başlamış. +Hala odaya katılmak istiyor musunuz? Schemes - Warning - + Planlar - Uyarı Schemes - Are you sure? - + Planlar - Emin misiniz? Do you really want to delete the game scheme '%1'? - + Gerçekten '%1' oyun planını silmek istiyor musunuz? Videos - Are you sure? - + Videolar - Emin misiniz? Do you really want to delete the video '%1'? - + Gerçekten '%1' videosunu silmek istiyor musunuz? Do you really want to remove %1 file(s)? - + Gerçekten %1 dosyayı kaldırmak istiyor musunuz? Do you really want to cancel uploading %1? - + Gerçekten %1 yüklemesini iptal etmek istiyor musunuz? File error - + Dosya hatası Cannot open '%1' for writing - + '%1' yazmak için açılamıyor Cannot open '%1' for reading - + '%1' okumak için açılamıyor Cannot use the ammo '%1'! - + '%1' cephanesi kullanılamıyor! Weapons - Warning - + Silahlar - Uyarı Cannot overwrite default weapon set '%1'! - + Varsayılan '%1' silah setinin üzerine yazılamaz! Cannot delete default weapon set '%1'! - + Varsayılan '%1' silah seti silinemez! Weapons - Are you sure? - + Silahlar - Emin misiniz? Do you really want to delete the weapon set '%1'? - + Gerçekten '%1' silah setini silmek istiyor musunuz? Hedgewars - Nick not registered - + Hedgewars - Takma ad kayıtlı değil System Information Preview - + Sistem Bilgi Önizlemesi Failed to generate captcha - + Captcha oluşturulamadı Failed to download captcha - + Captcha indirilemedi Please fill out all fields. Email is optional. - + Lütfen tüm alanları doldurun. E-posta isteğe bağlıdır. Hedgewars - Warning - + Hedgewars - Uyarı Hedgewars - Information - + Hedgewars - Bilgi Hedgewars - + Hedgewars Not all players are ready - + Tüm oyuncular hazır değil Are you sure you want to start this game? Not all players are ready. - + Oyunu başlatmak istiyor musunuz? +Tüm oyuncular hazır değil. QPushButton default - öntanımlı + varsayılan OK @@ -2213,50 +2288,70 @@ Associate file extensions - + Dosya uzantılarını ilişkilendir More info - + Daha fazla bilgi Set default options - + Varsayılan seçenekleri ayarla Open videos directory - + Video dizinini aç Play - + Oynat Upload to YouTube - + YouTube'a Yükle Cancel uploading - + Yüklemeyi iptal et Restore default coding parameters - + Varsayılan kodlama parametrelerini geri al Open the video directory in your system - + Sisteminizdeki video dizinini aç Play this video - + Bu videoyu oynat Delete this video - + Bu videoyu sil Upload this video to your Youtube account + Bu videoyu Youtube hesabınıza yükle + + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server @@ -2264,7 +2359,7 @@ RoomNamePrompt Enter a name for your room. - + Odanız için bir ad girin. Cancel @@ -2272,30 +2367,30 @@ Create room - + Oda oluştur RoomsListModel In progress - + Sürüyor Room Name - + Oda Adı C - + K T - + T Owner - + Sahip Map @@ -2303,7 +2398,7 @@ Rules - + Kurallar Weapons @@ -2311,22 +2406,22 @@ Random Map - + Rastgele Harita Random Maze - + Rastgele Labirent Hand-drawn - + El Çizimi SeedPrompt The map seed is the basis for all random values generated by the game. - + Harita beslemesi, oyun tarafından oluşturulan tüm rastgele değerler için bir tabandır. Cancel @@ -2334,30 +2429,30 @@ Set seed - + Besleme ayarla Close - + Kapat SelWeaponWidget Weapon set - + Silah seti Probabilities - + Olasılıklar Ammo in boxes - + Kutulardaki cephane Delays - + Gecikmeler new @@ -2365,6 +2460,25 @@ copy of + kopya + + + + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! @@ -2372,7 +2486,7 @@ TeamShowWidget %1's team - + %1 takımı @@ -2383,11 +2497,11 @@ Search for a theme: - + Tema arayın: Use selected theme - + Seçili temayı kullan @@ -2514,7 +2628,7 @@ change mode - modu değiştir + kipi değiştir capture @@ -2526,23 +2640,23 @@ long jump - + uzun zıplama high jump - + yüksek zıplama zoom in - + yakınlaştırma zoom out - + uzaklaştırma reset zoom - + yakınlaştırmayı sıfırla slot 10 @@ -2550,22 +2664,22 @@ mute audio - + sesi kapat record - + kaydet hedgehog info - + kirpi bilgisi binds (categories) Movement - + Hareket Weapons @@ -2573,117 +2687,117 @@ Camera - + Kamera Miscellaneous - + Çeşitli binds (descriptions) Traverse gaps and obstacles by jumping: - + Boşluklardan ve engellerden zıplayarak kaçın: Fire your selected weapon or trigger an utility item: - + Seçili silahını ateşle veya bir yardımcı öge tetikle: Pick a weapon or a target location under the cursor: - + Bir silah seç veya imleç altında konum işaretle Switch your currently active hog (if possible): - + Geçerli kirpiyi değiştir (mümkünse): Pick a weapon or utility item: - + Bir silah veya yardımcı öge al: Set the timer on bombs and timed weapons: - + Bombalarda ve zamanlı silahlarda zamanlayıcıyı ayarla: Move the camera to the active hog: - + Kamerayı etkin kirpiye götür: Move the cursor or camera without using the mouse: - + Kamera veya imleci fare kullanmadan hareket ettir Modify the camera's zoom level: - + Kamera yakınlaştırma seviyesini değiştir: Talk to your team or all participants: - + Takımla veya tüm katılanlarla konuş Pause, continue or leave your game: - + Oyunu beklet, devam et veya oyundan ayrıl Modify the game's volume while playing: - + Oynarken oyunun sesini değiştir: Toggle fullscreen mode: - + Tam ekran kipini değiştir: Take a screenshot: - + Ekran görüntüsü al: Toggle labels above hedgehogs: - + Kirpilerin üzerindeki etiketleri aç/kapat Record video: - + Video kaydet: Hedgehog movement - + Kirpi hareketi binds (keys) Axis - + Eksen (Up) - + (Yukarı) (Down) - + (Aşağı) Hat - + Şapka (Left) - + (Sol) (Right) - + (Sağ) Button - + Düğme Keyboard - + Klavye Delete @@ -2691,398 +2805,398 @@ Mouse: Left button - + Fare: Sol düğme Mouse: Middle button - + Fare: Orta düğme Mouse: Right button - + Fare: Sağ düğme Mouse: Wheel up - + Fare: Tekerlek yukarı Mouse: Wheel down - + Fare: Tekerlek aşağı Backspace - + Backspace Tab - + Sekme Clear - + Temizle Return - + Enter Pause - + Pause Escape - + Escape Space - + Boşluk Numpad 0 - + Nümerik 0 Numpad 1 - + Nümerik 1 Numpad 2 - + Nümerik 2 Numpad 3 - + Nümerik 3 Numpad 4 - + Nümerik 4 Numpad 5 - + Nümerik 5 Numpad 6 - + Nümerik 6 Numpad 7 - + Nümerik 7 Numpad 8 - + Nümerik 8 Numpad 9 - + Nümerik 9 Numpad . - + Nümerik . Numpad / - + Nümerik / Numpad * - + Nümerik * Numpad - - + Nümerik - Numpad + - + Nümerik + Enter - + Enter Equals - + Eşittir Up - + Yukarı Down - + Aşağı Right - + Sağ Left - + Sol Insert - + Ekle Home - + Ev End - + Son Page up - + Sayfa yukarı Page down - + Sayfa aşağı Num lock - + Nümerik kilit Caps lock - + Büyük harf Scroll lock - + Kaydırma kilidi Right shift - + Sağ üst karakter Left shift - + Sol üst karakter Right ctrl - + Sağ kontrol Left ctrl - + Sol kontrol Right alt - + Sağ alt Left alt - + Sol alt Right meta - + Sağ meta Left meta - + Sol meta A button - + A düğmesi B button - + B düğmesi X button - + X düğmesi Y button - + Y düğmesi LB button - + LB düğmesi RB button - + RB düğmesi Back button - + Geri düğmesi Start button - + Start düğmesi Left stick - + Sol çubuk Right stick - + Sağ çubuk Left stick (Right) - + Sol çubuk (Sağ) Left stick (Left) - + Sol çubuk (Sol) Left stick (Down) - + Sol çubuk (Aşağı) Left stick (Up) - + Sol çubuk (Yukarı) Left trigger - + Sol tetik Right trigger - + Sağ tetik Right stick (Down) - + Sağ çubuk (Aşağı) Right stick (Up) - + Sağ çubuk (Yukarı) Right stick (Right) - + Sağ çubuk (Sağ) Right stick (Left) - + Sağ çubuk (Sol) DPad - + DPad server Not room master - + Oda uzmanı değil Corrupted hedgehogs info - + Bozuk kirpi bilgisi too many teams - + çok fazla takım too many hedgehogs - + çok fazla kirpi There's already a team with same name in the list - + Listede aynı isimde başka bir takım var round in progress - + tur sürüyor restricted - + kısıtlı REMOVE_TEAM: no such team - + REMOVE_TEAM: böyle bir takım yok Not team owner! - + Takım sahibi değil! Less than two clans! - + İki klandan daha az! Room with such name already exists - + Oda adı zaten mevcut Nickname already chosen - + Takma ad zaten seçilmiş Illegal nickname - + Geçersiz takma ad Protocol already known - + Protokol zaten biliniyor Bad number - + Hatalı sayı Nickname is already in use - + Takma ad zaten kullanımda No checker rights - + Denetim hakları yok Authentication failed - + Kimlik doğrulama başarısız 60 seconds cooldown after kick - + Kovulduktan sonra 60 saniye sakinleşme kicked - + kovuldu Ping timeout - + Ping zaman aşımı bye - + hoşça kal Illegal room name - + Geçersiz oda adı No such room - + Böyle bir oda yok Joining restricted - + Katılma kısıtlı Registered users only - + Sadece kayıtlı kullanıcılar You are banned in this room - + Bu odadan engellendiniz Empty config entry - + Boş yapılandırma girdisi diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_uk.ts --- a/share/hedgewars/Data/Locale/hedgewars_uk.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_uk.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -183,6 +199,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + Не можу створити директорію %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -543,6 +574,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -949,6 +995,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -2022,35 +2075,12 @@ - Main - Error - - - Cannot create directory %1 - Не можу створити директорію %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + Не можу створити директорію %1 Unable to start the server: %1. - Помилка запуску сервера: %1. - - - Unable to run engine at - - - - Error code: %1 - + Помилка запуску сервера: %1. Video upload - Error @@ -2199,10 +2229,6 @@ - Hedgewars - - - Not all players are ready @@ -2314,6 +2340,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2424,6 +2470,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_zh_CN.ts --- a/share/hedgewars/Data/Locale/hedgewars_zh_CN.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_zh_CN.ts Sun Apr 07 22:53:40 2013 +0200 @@ -105,17 +105,37 @@ FeedbackDialog - + + Please give us feedback! + + + + + We are always happy about suggestions, ideas, or bug reports. + + + + + If you found a bug, you can see if it's already known here (english): + + + + + Your email address is optional, but we may want to contact you. + + + + View - + Cancel 取消 - + Send Feedback @@ -205,6 +225,24 @@ + + + Scheme '%1' not supported + + + + + Cannot create directory %1 + + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -217,52 +255,52 @@ HWChatWidget - + %1 has been removed from your ignore list - + %1 has been added to your ignore list - + %1 has been removed from your friends list - + %1 has been added to your friends list - - Stylesheet imported from %1 - - - + Stylesheet imported from %1 + + + + Enter %1 if you want to use the current StyleSheet in future, enter %2 to reset! - + Couldn't read %1 - + StyleSheet discarded - + StyleSheet saved to %1 - + Failed to save StyleSheet to %1 @@ -285,12 +323,12 @@ - + Hedgewars - Nick registered - + This nick is registered, and you haven't specified a password. If this nick isn't yours, please register your own nick at www.hedgewars.org @@ -299,93 +337,93 @@ - + Your nickname is not registered. To prevent someone else from using it, please register it at www.hedgewars.org - + Your password wasn't saved either. - + Nickname - + Someone already uses your nickname %1 on the server. Please pick another nickname: - - + + No nickname supplied. - - + + Hedgewars - Empty nickname - + Hedgewars - Wrong password - + You entered a wrong password. - + Try Again - + Hedgewars - Connection error - + You reconnected too fast. Please wait a few seconds and try again. - + Hedgewars Demo File File Types - + Hedgewars Save File File Types - + Demo name - + Demo name: - - + + Cannot save record to file %1 无法录入文件 %1 @@ -632,7 +670,7 @@ - + Quit reason: 退出原因: @@ -654,6 +692,24 @@ Login + + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + + Nickname: + + + + + Password: + + HWUploadVideoDialog @@ -679,17 +735,17 @@ HatPrompt - + Search for a hat: - + Cancel 取消 - + Use selected hat @@ -1131,6 +1187,14 @@ + PageNetServer + + + Insert your address here + + + + PageOptions @@ -1360,42 +1424,42 @@ PageRoomsList - + Search for a room: - + Create room - + Join room - + Room state - + Rules: - + Weapons: - + Clear filters - + Open server administration page @@ -1408,14 +1472,14 @@ 加入 - + %1 players online - + Admin features 管理员功能 @@ -1742,33 +1806,33 @@ - + Ignore - + Add friend - + Unignore - + Remove friend - + Show games in lobby - + Show games in-progress @@ -1843,7 +1907,7 @@ 记录名称中包含具体时间日期 - + Save password @@ -1967,8 +2031,8 @@ - - + + Any @@ -2079,12 +2143,12 @@ - + Server name: 服务器名: - + Server port: 服务器端口: @@ -2255,37 +2319,37 @@ - + Your Email - + Summary - + Send system information - + Description - + Type the security code: + + Tip: + + + - Tip: - - - - This development build is 'work in progress' and may not be compatible with other versions of the game, while some features might be broken or incomplete! @@ -2391,70 +2455,71 @@ - + Hedgewars - Nick not registered - + Unable to start server - + Connection to server is lost 服务器连接丢失 - + Not all players are ready - + Are you sure you want to start this game? Not all players are ready. - + + Hedgewars - Error - + System Information Preview - - + + Failed to generate captcha - + Failed to download captcha - + Please fill out all fields. Email is optional. - - + + Hedgewars - Success - + All file associations have been set - + File association failed. @@ -2482,46 +2547,6 @@ - - - Main - Error - - - - - Cannot create directory %1 - - - - - Failed to open data directory: -%1 - -Please check your installation! - - - - - - TCP - Error - - - - - Unable to start the server: %1. - - - - - Unable to run engine at - - - - - Error code: %1 - - - Netgame - Error @@ -2562,22 +2587,22 @@ - + Room Name - Error - + Please select room from the list - + Room Name - Are you sure? - + The game you are trying to join has started. Do you still want to join the room? @@ -2666,20 +2691,15 @@ - + Hedgewars - Warning - + Hedgewars - Information - - - Hedgewars - - QPushButton @@ -2701,11 +2721,36 @@ 上场! + + Reset + + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start 开始 + + Start private server + + + Start server 开始服务端 @@ -2727,7 +2772,6 @@ - default 默认 @@ -2952,6 +2996,28 @@ + TCPBase + + + Unable to start server at %1. + + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + + At least two teams are required to play! + + + + TeamShowWidget @@ -2962,17 +3028,17 @@ ThemePrompt - + Search for a theme: - + Cancel 取消 - + Use selected theme diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Locale/hedgewars_zh_TW.ts --- a/share/hedgewars/Data/Locale/hedgewars_zh_TW.ts Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Locale/hedgewars_zh_TW.ts Sun Apr 07 22:53:40 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback + + Please give us feedback! + + + + We are always happy about suggestions, ideas, or bug reports. + + + + If you found a bug, you can see if it's already known here (english): + + + + Your email address is optional, but we may want to contact you. + + FreqSpinBox @@ -167,6 +183,21 @@ + + Scheme '%1' not supported + + + + Cannot create directory %1 + 無法創建路徑 %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -527,6 +558,21 @@ Login + + To connect to the server, please log in. + +If you don't have an account on www.hedgewars.org, +just enter your nickname. + + + + Nickname: + + + + Password: + + HWUploadVideoDialog @@ -921,6 +967,13 @@ + PageNetServer + + Insert your address here + + + + PageOptions New team @@ -1978,35 +2031,12 @@ - Main - Error - - - Cannot create directory %1 - 無法創建路徑 %1 - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + 無法創建路徑 %1 Unable to start the server: %1. - 無法開始服務端: %1. - - - Unable to run engine at - - - - Error code: %1 - + 無法開始服務端: %1. Video upload - Error @@ -2152,10 +2182,6 @@ - Hedgewars - - - Not all players are ready @@ -2267,6 +2293,26 @@ Upload this video to your Youtube account + + Reset + + + + Set the default server port for Hedgewars + + + + Invite your friends to your server in just 1 click! + + + + Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you. + + + + Start private server + + RoomNamePrompt @@ -2377,6 +2423,25 @@ + TCPBase + + Unable to start server at %1. + + + + Unable to run engine at %1 +Error code: %2 + + + + + TeamSelWidget + + At least two teams are required to play! + + + + TeamShowWidget %1's team diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Scripts/Locale.lua --- a/share/hedgewars/Data/Scripts/Locale.lua Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Scripts/Locale.lua Sun Apr 07 22:53:40 2013 +0200 @@ -2,17 +2,8 @@ local lang = HedgewarsScriptLoad("Locale/" .. tostring(L) .. ".lua") -if lang ~= nil then - lang() -else - lang = HedgewarsScriptLoad("Locale/" .. tostring(L) .. ".lua") - if lang ~= nil then - lang() - end -end - function loc(text) - if lang ~= nil and locale ~= nil and locale[text] ~= nil then return locale[text] + if locale ~= nil and locale[text] ~= nil then return locale[text] else return text end end diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/CMakeLists.txt --- a/share/hedgewars/Data/Themes/CMakeLists.txt Tue Mar 26 18:52:42 2013 +0100 +++ b/share/hedgewars/Data/Themes/CMakeLists.txt Sun Apr 07 22:53:40 2013 +0200 @@ -9,14 +9,15 @@ Castle Cheese Christmas + City Compost + CrazyMission Deepspace Desert - City - CrazyMission EarthRise Eyes Freeway + Fruit Golf Halloween Hell diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Cave/Stalactite.png Binary file share/hedgewars/Data/Themes/Cave/Stalactite.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Cave/Stalactite_mask.png Binary file share/hedgewars/Data/Themes/Cave/Stalactite_mask.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Cave/Stalagmite01.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite01.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Cave/Stalagmite01_mask.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite01_mask.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Cave/Stalagmite02.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite02.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Cave/Stalagmite02_mask.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite02_mask.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Cheese/cheese.png Binary file share/hedgewars/Data/Themes/Cheese/cheese.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Cheese/cheese_mask.png Binary file share/hedgewars/Data/Themes/Cheese/cheese_mask.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/Chunk.png Binary file share/hedgewars/Data/Themes/EarthRise/Chunk.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/Rock.png Binary file share/hedgewars/Data/Themes/EarthRise/Rock.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/RockShort.png Binary file share/hedgewars/Data/Themes/EarthRise/RockShort.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/RockShort_mask.png Binary file share/hedgewars/Data/Themes/EarthRise/RockShort_mask.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/Rock_mask.png Binary file share/hedgewars/Data/Themes/EarthRise/Rock_mask.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/horizontL.png Binary file share/hedgewars/Data/Themes/EarthRise/horizontL.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/horizontR.png Binary file share/hedgewars/Data/Themes/EarthRise/horizontR.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/icon.png Binary file share/hedgewars/Data/Themes/EarthRise/icon.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/EarthRise/icon@2x.png Binary file share/hedgewars/Data/Themes/EarthRise/icon@2x.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Banana1.png Binary file share/hedgewars/Data/Themes/Fruit/Banana1.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Banana2.png Binary file share/hedgewars/Data/Themes/Fruit/Banana2.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/BlueWater.png Binary file share/hedgewars/Data/Themes/Fruit/BlueWater.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Border.png Binary file share/hedgewars/Data/Themes/Fruit/Border.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Fruit/CMakeLists.txt Sun Apr 07 22:53:40 2013 +0200 @@ -0,0 +1,6 @@ +file(GLOB images *.png) + +install(FILES + theme.cfg + ${images} + DESTINATION ${SHAREPATH}Data/Themes/Fruit) diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Chunk.png Binary file share/hedgewars/Data/Themes/Fruit/Chunk.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Clouds.png Binary file share/hedgewars/Data/Themes/Fruit/Clouds.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Droplet.png Binary file share/hedgewars/Data/Themes/Fruit/Droplet.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Flake.png Binary file share/hedgewars/Data/Themes/Fruit/Flake.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Girder.png Binary file share/hedgewars/Data/Themes/Fruit/Girder.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/LandBackTex.png Binary file share/hedgewars/Data/Themes/Fruit/LandBackTex.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/LandTex.png Binary file share/hedgewars/Data/Themes/Fruit/LandTex.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Orange1.png Binary file share/hedgewars/Data/Themes/Fruit/Orange1.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Orange2.png Binary file share/hedgewars/Data/Themes/Fruit/Orange2.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Sky.png Binary file share/hedgewars/Data/Themes/Fruit/Sky.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/SkyL.png Binary file share/hedgewars/Data/Themes/Fruit/SkyL.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Snowball.png Binary file share/hedgewars/Data/Themes/Fruit/Snowball.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Splash.png Binary file share/hedgewars/Data/Themes/Fruit/Splash.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Watermelon.png Binary file share/hedgewars/Data/Themes/Fruit/Watermelon.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/Watermelon_mask.png Binary file share/hedgewars/Data/Themes/Fruit/Watermelon_mask.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/amSnowball.png Binary file share/hedgewars/Data/Themes/Fruit/amSnowball.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/horizont.png Binary file share/hedgewars/Data/Themes/Fruit/horizont.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/icon.png Binary file share/hedgewars/Data/Themes/Fruit/icon.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/icon@2x.png Binary file share/hedgewars/Data/Themes/Fruit/icon@2x.png has changed diff -r af4ab297b2b7 -r 539380a498e4 share/hedgewars/Data/Themes/Fruit/theme.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Fruit/theme.cfg Sun Apr 07 22:53:40 2013 +0200 @@ -0,0 +1,13 @@ +sky = 50, 40, 131 +border = 0, 128, 0 +water-top = 255, 98, 0 +water-bottom = 255, 68, 0 +water-opacity = 125 +music = oriental.ogg +clouds = 20 +object = Orange1, 1, 50, 84, 15, 3, 1, 8, 2, 90, 73 +object = Orange2, 1, 50, 84, 15, 3, 1, 8, 2, 90, 73 +object = Watermelon, 1, 87, 272, 77, 10, 1, 21, 2, 242, 219 +object = Banana1, 1, 152, 191, 37, 24, 1, 2, 1, 163, 174 +object = Banana2, 1, 1, 190, 37, 24, 1, 22, 0, 163, 174 +flakes = 40, 3, 999999999, 100, 260 diff -r af4ab297b2b7 -r 539380a498e4 tools/PascalBasics.hs --- a/tools/PascalBasics.hs Tue Mar 26 18:52:42 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -{-# LANGUAGE FlexibleContexts #-} -module PascalBasics where - -import Text.Parsec.Combinator -import Text.Parsec.Char -import Text.Parsec.Prim -import Text.Parsec.Token -import Text.Parsec.Language -import Data.Char - -builtin = ["succ", "pred", "low", "high", "ord", "inc", "dec", "exit", "break", "continue", "length"] - -pascalLanguageDef - = emptyDef - { commentStart = "(*" - , commentEnd = "*)" - , commentLine = "//" - , nestedComments = False - , identStart = letter <|> oneOf "_" - , identLetter = alphaNum <|> oneOf "_" - , reservedNames = [ - "begin", "end", "program", "unit", "interface" - , "implementation", "and", "or", "xor", "shl" - , "shr", "while", "do", "repeat", "until", "case", "of" - , "type", "var", "const", "out", "array", "packed" - , "procedure", "function", "with", "for", "to" - , "downto", "div", "mod", "record", "set", "nil" - , "cdecl", "external", "if", "then", "else" - ] -- ++ builtin - , reservedOpNames= [] - , caseSensitive = False - } - -preprocessorSwitch :: Stream s m Char => ParsecT s u m String -preprocessorSwitch = do - try $ string "{$" - s <- manyTill (noneOf "\n") $ char '}' - return s - -caseInsensitiveString s = do - mapM_ (\a -> satisfy (\b -> toUpper a == toUpper b)) s s - return s - -pas = patch $ makeTokenParser pascalLanguageDef - where - patch tp = tp {stringLiteral = stringL} - -comment = choice [ - char '{' >> notFollowedBy (char '$') >> manyTill anyChar (try $ char '}') - , (try $ string "(*") >> manyTill anyChar (try $ string "*)") - , (try $ string "//") >> manyTill anyChar (try newline) - ] - -comments = do - spaces - skipMany $ do - preprocessorSwitch <|> comment - spaces - -stringL = do - (char '\'') - s <- (many $ noneOf "'") - (char '\'') - ss <- many $ do - (char '\'') - s' <- (many $ noneOf "'") - (char '\'') - return $ '\'' : s' - comments - return $ concat (s:ss) diff -r af4ab297b2b7 -r 539380a498e4 tools/PascalParser.hs --- a/tools/PascalParser.hs Tue Mar 26 18:52:42 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,659 +0,0 @@ -module PascalParser where - -import Text.Parsec -import Text.Parsec.Char -import Text.Parsec.Token -import Text.Parsec.Language -import Text.Parsec.Expr -import Text.Parsec.Prim -import Text.Parsec.Combinator -import Text.Parsec.String -import Control.Monad -import Data.Maybe -import Data.Char - -import PascalBasics -import PascalUnitSyntaxTree - -knownTypes = ["shortstring", "ansistring", "char", "byte"] - -pascalUnit = do - comments - u <- choice [program, unit, systemUnit, redoUnit] - comments - return u - -iD = do - i <- liftM (flip Identifier BTUnknown) (identifier pas) - comments - return i - -unit = do - string "unit" >> comments - name <- iD - semi pas - comments - int <- interface - impl <- implementation - comments - return $ Unit name int impl Nothing Nothing - - -reference = buildExpressionParser table term "reference" - where - term = comments >> choice [ - parens pas (liftM RefExpression expression >>= postfixes) >>= postfixes - , try $ typeCast >>= postfixes - , char '@' >> liftM Address reference >>= postfixes - , liftM SimpleReference iD >>= postfixes - ] "simple reference" - - table = [ - ] - - postfixes r = many postfix >>= return . foldl (flip ($)) r - postfix = choice [ - parens pas (option [] parameters) >>= return . FunCall - , char '^' >> return Dereference - , (brackets pas) (commaSep1 pas $ expression) >>= return . ArrayElement - , (char '.' >> notFollowedBy (char '.')) >> liftM (flip RecordField) reference - ] - - typeCast = do - t <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) knownTypes - e <- parens pas expression - comments - return $ TypeCast (Identifier t BTUnknown) e - -varsDecl1 = varsParser sepEndBy1 -varsDecl = varsParser sepEndBy -varsParser m endsWithSemi = do - vs <- m (aVarDecl endsWithSemi) (semi pas) - return vs - -aVarDecl endsWithSemi = do - isVar <- liftM (== Just "var") $ - if not endsWithSemi then - optionMaybe $ choice [ - try $ string "var" - , try $ string "const" - , try $ string "out" - ] - else - return Nothing - comments - ids <- do - i <- (commaSep1 pas) $ (try iD "variable declaration") - char ':' - return i - comments - t <- typeDecl "variable type declaration" - comments - init <- option Nothing $ do - char '=' - comments - e <- initExpression - comments - return (Just e) - return $ VarDeclaration isVar False (ids, t) init - - -constsDecl = do - vs <- many1 (try (aConstDecl >>= \i -> semi pas >> return i) >>= \i -> comments >> return i) - comments - return vs - where - aConstDecl = do - comments - i <- iD - t <- optionMaybe $ do - char ':' - comments - t <- typeDecl - comments - return t - char '=' - comments - e <- initExpression - comments - return $ VarDeclaration False (isNothing t) ([i], fromMaybe (DeriveType e) t) (Just e) - -typeDecl = choice [ - char '^' >> typeDecl >>= return . PointerTo - , try (string "shortstring") >> return (String 255) - , try (string "string") >> optionMaybe (brackets pas $ integer pas) >>= return . String . fromMaybe 255 - , try (string "ansistring") >> optionMaybe (brackets pas $ integer pas) >>= return . String . fromMaybe 255 - , arrayDecl - , recordDecl - , setDecl - , functionType - , sequenceDecl >>= return . Sequence - , try iD >>= return . SimpleType - , rangeDecl >>= return . RangeType - ] "type declaration" - where - arrayDecl = do - try $ do - optional $ (try $ string "packed") >> comments - string "array" - comments - r <- option [] $ do - char '[' - r <- commaSep pas rangeDecl - char ']' - comments - return r - string "of" - comments - t <- typeDecl - if null r then - return $ ArrayDecl Nothing t - else - return $ foldr (\a b -> ArrayDecl (Just a) b) (ArrayDecl (Just $ head r) t) (tail r) - recordDecl = do - try $ do - optional $ (try $ string "packed") >> comments - string "record" - comments - vs <- varsDecl True - union <- optionMaybe $ do - string "case" - comments - iD - comments - string "of" - comments - many unionCase - string "end" - return $ RecordType vs union - setDecl = do - try $ string "set" >> space - comments - string "of" - comments - liftM Set typeDecl - unionCase = do - try $ commaSep pas $ (iD >> return ()) <|> (integer pas >> return ()) - char ':' - comments - u <- parens pas $ varsDecl True - char ';' - comments - return u - sequenceDecl = (parens pas) $ (commaSep pas) (iD >>= \i -> optional (spaces >> char '=' >> spaces >> integer pas) >> return i) - functionType = do - fp <- try (string "function") <|> try (string "procedure") - comments - vs <- option [] $ parens pas $ varsDecl False - comments - ret <- if (fp == "function") then do - char ':' - comments - ret <- typeDecl - comments - return ret - else - return VoidType - optional $ try $ char ';' >> comments >> string "cdecl" - comments - return $ FunctionType ret vs - -typesDecl = many (aTypeDecl >>= \t -> comments >> return t) - where - aTypeDecl = do - i <- try $ do - i <- iD "type declaration" - comments - char '=' - return i - comments - t <- typeDecl - comments - semi pas - comments - return $ TypeDeclaration i t - -rangeDecl = choice [ - try $ rangeft - , iD >>= return . Range - ] "range declaration" - where - rangeft = do - e1 <- initExpression - string ".." - e2 <- initExpression - return $ RangeFromTo e1 e2 - -typeVarDeclaration isImpl = (liftM concat . many . choice) [ - varSection, - constSection, - typeSection, - funcDecl, - operatorDecl - ] - where - varSection = do - try $ string "var" - comments - v <- varsDecl1 True "variable declaration" - comments - return v - - constSection = do - try $ string "const" - comments - c <- constsDecl "const declaration" - comments - return c - - typeSection = do - try $ string "type" - comments - t <- typesDecl "type declaration" - comments - return t - - operatorDecl = do - try $ string "operator" - comments - i <- manyTill anyChar space - comments - vs <- parens pas $ varsDecl False - comments - rid <- iD - comments - char ':' - comments - ret <- typeDecl - comments - return ret - char ';' - comments - forward <- liftM isJust $ optionMaybe (try (string "forward;") >> comments) - inline <- liftM (any (== "inline;")) $ many functionDecorator - b <- if isImpl && (not forward) then - liftM Just functionBody - else - return Nothing - return $ [OperatorDeclaration i rid inline ret vs b] - - - funcDecl = do - fp <- try (string "function") <|> try (string "procedure") - comments - i <- iD - vs <- option [] $ parens pas $ varsDecl False - comments - ret <- if (fp == "function") then do - char ':' - comments - ret <- typeDecl - comments - return ret - else - return VoidType - char ';' - comments - forward <- liftM isJust $ optionMaybe (try (string "forward;") >> comments) - inline <- liftM (any (== "inline;")) $ many functionDecorator - b <- if isImpl && (not forward) then - liftM Just functionBody - else - return Nothing - return $ [FunctionDeclaration i inline ret vs b] - - functionDecorator = do - d <- choice [ - try $ string "inline;" - , try $ caseInsensitiveString "cdecl;" - , try $ string "overload;" - , try $ string "export;" - , try $ string "varargs;" - , try (string "external") >> comments >> iD >> optional (string "name" >> comments >> stringLiteral pas)>> string ";" - ] - comments - return d - - -program = do - string "program" - comments - name <- iD - (char ';') - comments - comments - u <- uses - comments - tv <- typeVarDeclaration True - comments - p <- phrase - comments - char '.' - comments - return $ Program name (Implementation u (TypesAndVars tv)) p - -interface = do - string "interface" - comments - u <- uses - comments - tv <- typeVarDeclaration False - comments - return $ Interface u (TypesAndVars tv) - -implementation = do - string "implementation" - comments - u <- uses - comments - tv <- typeVarDeclaration True - string "end." - comments - return $ Implementation u (TypesAndVars tv) - -expression = do - buildExpressionParser table term "expression" - where - term = comments >> choice [ - builtInFunction expression >>= \(n, e) -> return $ BuiltInFunCall e (SimpleReference (Identifier n BTUnknown)) - , try (parens pas $ expression >>= \e -> notFollowedBy (comments >> char '.') >> return e) - , brackets pas (commaSep pas iD) >>= return . SetExpression - , try $ integer pas >>= \i -> notFollowedBy (char '.') >> (return . NumberLiteral . show) i - , float pas >>= return . FloatLiteral . show - , try $ integer pas >>= return . NumberLiteral . show - , try (string "_S" >> stringLiteral pas) >>= return . StringLiteral - , try (string "_P" >> stringLiteral pas) >>= return . PCharLiteral - , stringLiteral pas >>= return . strOrChar - , try (string "#$") >> many hexDigit >>= \c -> comments >> return (HexCharCode c) - , char '#' >> many digit >>= \c -> comments >> return (CharCode c) - , char '$' >> many hexDigit >>= \h -> comments >> return (HexNumber h) - --, char '-' >> expression >>= return . PrefixOp "-" - , char '-' >> reference >>= return . PrefixOp "-" . Reference - , (try $ string "not" >> notFollowedBy comments) >> unexpected "'not'" - , try $ string "nil" >> return Null - , reference >>= return . Reference - ] "simple expression" - - table = [ - [ Prefix (try (string "not") >> return (PrefixOp "not")) - , Prefix (try (char '-') >> return (PrefixOp "-"))] - , - [ Infix (char '*' >> return (BinOp "*")) AssocLeft - , Infix (char '/' >> return (BinOp "/")) AssocLeft - , Infix (try (string "div") >> return (BinOp "div")) AssocLeft - , Infix (try (string "mod") >> return (BinOp "mod")) AssocLeft - , Infix (try (string "in") >> return (BinOp "in")) AssocNone - , Infix (try $ string "and" >> return (BinOp "and")) AssocLeft - , Infix (try $ string "shl" >> return (BinOp "shl")) AssocLeft - , Infix (try $ string "shr" >> return (BinOp "shr")) AssocLeft - ] - , [ Infix (char '+' >> return (BinOp "+")) AssocLeft - , Infix (char '-' >> return (BinOp "-")) AssocLeft - , Infix (try $ string "or" >> return (BinOp "or")) AssocLeft - , Infix (try $ string "xor" >> return (BinOp "xor")) AssocLeft - ] - , [ Infix (try (string "<>") >> return (BinOp "<>")) AssocNone - , Infix (try (string "<=") >> return (BinOp "<=")) AssocNone - , Infix (try (string ">=") >> return (BinOp ">=")) AssocNone - , Infix (char '<' >> return (BinOp "<")) AssocNone - , Infix (char '>' >> return (BinOp ">")) AssocNone - ] - {-, [ Infix (try $ string "shl" >> return (BinOp "shl")) AssocNone - , Infix (try $ string "shr" >> return (BinOp "shr")) AssocNone - ] - , [ - Infix (try $ string "or" >> return (BinOp "or")) AssocLeft - , Infix (try $ string "xor" >> return (BinOp "xor")) AssocLeft - ]-} - , [ - Infix (char '=' >> return (BinOp "=")) AssocNone - ] - ] - strOrChar [a] = CharCode . show . ord $ a - strOrChar a = StringLiteral a - -phrasesBlock = do - try $ string "begin" - comments - p <- manyTill phrase (try $ string "end" >> notFollowedBy alphaNum) - comments - return $ Phrases p - -phrase = do - o <- choice [ - phrasesBlock - , ifBlock - , whileCycle - , repeatCycle - , switchCase - , withBlock - , forCycle - , (try $ reference >>= \r -> string ":=" >> return r) >>= \r -> comments >> expression >>= return . Assignment r - , builtInFunction expression >>= \(n, e) -> return $ BuiltInFunctionCall e (SimpleReference (Identifier n BTUnknown)) - , procCall - , char ';' >> comments >> return NOP - ] - optional $ char ';' - comments - return o - -ifBlock = do - try $ string "if" >> notFollowedBy (alphaNum <|> char '_') - comments - e <- expression - comments - string "then" - comments - o1 <- phrase - comments - o2 <- optionMaybe $ do - try $ string "else" >> space - comments - o <- option NOP phrase - comments - return o - return $ IfThenElse e o1 o2 - -whileCycle = do - try $ string "while" - comments - e <- expression - comments - string "do" - comments - o <- phrase - return $ WhileCycle e o - -withBlock = do - try $ string "with" >> space - comments - rs <- (commaSep1 pas) reference - comments - string "do" - comments - o <- phrase - return $ foldr WithBlock o rs - -repeatCycle = do - try $ string "repeat" >> space - comments - o <- many phrase - string "until" - comments - e <- expression - comments - return $ RepeatCycle e o - -forCycle = do - try $ string "for" >> space - comments - i <- iD - comments - string ":=" - comments - e1 <- expression - comments - up <- liftM (== Just "to") $ - optionMaybe $ choice [ - try $ string "to" - , try $ string "downto" - ] - --choice [string "to", string "downto"] - comments - e2 <- expression - comments - string "do" - comments - p <- phrase - comments - return $ ForCycle i e1 e2 p up - -switchCase = do - try $ string "case" - comments - e <- expression - comments - string "of" - comments - cs <- many1 aCase - o2 <- optionMaybe $ do - try $ string "else" >> notFollowedBy alphaNum - comments - o <- many phrase - comments - return o - string "end" - comments - return $ SwitchCase e cs o2 - where - aCase = do - e <- (commaSep pas) $ (liftM InitRange rangeDecl <|> initExpression) - comments - char ':' - comments - p <- phrase - comments - return (e, p) - -procCall = do - r <- reference - p <- option [] $ (parens pas) parameters - return $ ProcCall r p - -parameters = (commaSep pas) expression "parameters" - -functionBody = do - tv <- typeVarDeclaration True - comments - p <- phrasesBlock - char ';' - comments - return (TypesAndVars tv, p) - -uses = liftM Uses (option [] u) - where - u = do - string "uses" - comments - u <- (iD >>= \i -> comments >> return i) `sepBy1` (char ',' >> comments) - char ';' - comments - return u - -initExpression = buildExpressionParser table term "initialization expression" - where - term = comments >> choice [ - liftM (uncurry BuiltInFunction) $ builtInFunction initExpression - , try $ brackets pas (commaSep pas $ initExpression) >>= return . InitSet - , try $ parens pas (commaSep pas $ initExpression) >>= \ia -> when (null $ tail ia) mzero >> return (InitArray ia) - , try $ parens pas (sepEndBy recField (char ';' >> comments)) >>= return . InitRecord - , parens pas initExpression - , try $ integer pas >>= \i -> notFollowedBy (char '.') >> (return . InitNumber . show) i - , try $ float pas >>= return . InitFloat . show - , try $ integer pas >>= return . InitNumber . show - , stringLiteral pas >>= return . InitString - , char '#' >> many digit >>= \c -> comments >> return (InitChar c) - , char '$' >> many hexDigit >>= \h -> comments >> return (InitHexNumber h) - , char '@' >> initExpression >>= \c -> comments >> return (InitAddress c) - , try $ string "nil" >> return InitNull - , itypeCast - , iD >>= return . InitReference - ] - - recField = do - i <- iD - spaces - char ':' - spaces - e <- initExpression - spaces - return (i ,e) - - table = [ - [ - Prefix (char '-' >> return (InitPrefixOp "-")) - ,Prefix (try (string "not") >> return (InitPrefixOp "not")) - ] - , [ Infix (char '*' >> return (InitBinOp "*")) AssocLeft - , Infix (char '/' >> return (InitBinOp "/")) AssocLeft - , Infix (try (string "div") >> return (InitBinOp "div")) AssocLeft - , Infix (try (string "mod") >> return (InitBinOp "mod")) AssocLeft - , Infix (try $ string "and" >> return (InitBinOp "and")) AssocLeft - , Infix (try $ string "shl" >> return (InitBinOp "shl")) AssocNone - , Infix (try $ string "shr" >> return (InitBinOp "shr")) AssocNone - ] - , [ Infix (char '+' >> return (InitBinOp "+")) AssocLeft - , Infix (char '-' >> return (InitBinOp "-")) AssocLeft - , Infix (try $ string "or" >> return (InitBinOp "or")) AssocLeft - , Infix (try $ string "xor" >> return (InitBinOp "xor")) AssocLeft - ] - , [ Infix (try (string "<>") >> return (InitBinOp "<>")) AssocNone - , Infix (try (string "<=") >> return (InitBinOp "<=")) AssocNone - , Infix (try (string ">=") >> return (InitBinOp ">=")) AssocNone - , Infix (char '<' >> return (InitBinOp "<")) AssocNone - , Infix (char '>' >> return (InitBinOp ">")) AssocNone - , Infix (char '=' >> return (InitBinOp "=")) AssocNone - ] - {--, [ Infix (try $ string "and" >> return (InitBinOp "and")) AssocLeft - , Infix (try $ string "or" >> return (InitBinOp "or")) AssocLeft - , Infix (try $ string "xor" >> return (InitBinOp "xor")) AssocLeft - ] - , [ Infix (try $ string "shl" >> return (InitBinOp "shl")) AssocNone - , Infix (try $ string "shr" >> return (InitBinOp "shr")) AssocNone - ]--} - --, [Prefix (try (string "not") >> return (InitPrefixOp "not"))] - ] - - itypeCast = do - t <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) knownTypes - i <- parens pas initExpression - comments - return $ InitTypeCast (Identifier t BTUnknown) i - -builtInFunction e = do - name <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) builtin - spaces - exprs <- option [] $ parens pas $ option [] $ commaSep1 pas $ e - spaces - return (name, exprs) - -systemUnit = do - string "system;" - comments - string "type" - comments - t <- typesDecl - string "var" - v <- varsDecl True - return $ System (t ++ v) - -redoUnit = do - string "redo;" - comments - string "type" - comments - t <- typesDecl - string "var" - v <- varsDecl True - return $ Redo (t ++ v) - diff -r af4ab297b2b7 -r 539380a498e4 tools/PascalPreprocessor.hs --- a/tools/PascalPreprocessor.hs Tue Mar 26 18:52:42 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -module PascalPreprocessor where - -import Text.Parsec -import Control.Monad.IO.Class -import Control.Monad -import System.IO -import qualified Data.Map as Map -import Data.Char - - --- comments are removed -comment = choice [ - char '{' >> notFollowedBy (char '$') >> manyTill anyChar (try $ char '}') >> return "" - , (try $ string "(*") >> manyTill anyChar (try $ string "*)") >> return "" - , (try $ string "//") >> manyTill anyChar (try newline) >> return "\n" - ] - -initDefines = Map.fromList [ - ("FPC", "") - , ("PAS2C", "") - , ("ENDIAN_LITTLE", "") - ] - -preprocess :: String -> IO String -preprocess fn = do - r <- runParserT (preprocessFile fn) (initDefines, [True]) "" "" - case r of - (Left a) -> do - hPutStrLn stderr (show a) - return "" - (Right a) -> return a - - where - preprocessFile fn = do - f <- liftIO (readFile fn) - setInput f - preprocessor - - preprocessor, codeBlock, switch :: ParsecT String (Map.Map String String, [Bool]) IO String - - preprocessor = chainr codeBlock (return (++)) "" - - codeBlock = do - s <- choice [ - switch - , comment - , char '\'' >> many (noneOf "'\n") >>= \s -> char '\'' >> return ('\'' : s ++ "'") - , identifier >>= replace - , noneOf "{" >>= \a -> return [a] - ] - (_, ok) <- getState - return $ if and ok then s else "" - - --otherChar c = c `notElem` "{/('_" && not (isAlphaNum c) - identifier = do - c <- letter <|> oneOf "_" - s <- many (alphaNum <|> oneOf "_") - return $ c:s - - switch = do - try $ string "{$" - s <- choice [ - include - , ifdef - , if' - , elseSwitch - , endIf - , define - , unknown - ] - return s - - include = do - try $ string "INCLUDE" - spaces - (char '"') - fn <- many1 $ noneOf "\"\n" - char '"' - spaces - char '}' - f <- liftIO (readFile fn `catch` error ("File not found: " ++ fn)) - c <- getInput - setInput $ f ++ c - return "" - - ifdef = do - s <- try (string "IFDEF") <|> try (string "IFNDEF") - let f = if s == "IFNDEF" then not else id - - spaces - d <- identifier - spaces - char '}' - - updateState $ \(m, b) -> - (m, (f $ d `Map.member` m) : b) - - return "" - - if' = do - s <- try (string "IF" >> notFollowedBy alphaNum) - - manyTill anyChar (char '}') - --char '}' - - updateState $ \(m, b) -> - (m, False : b) - - return "" - - elseSwitch = do - try $ string "ELSE}" - updateState $ \(m, b:bs) -> (m, (not b):bs) - return "" - endIf = do - try $ string "ENDIF}" - updateState $ \(m, b:bs) -> (m, bs) - return "" - define = do - try $ string "DEFINE" - spaces - i <- identifier - d <- ((string ":=" >> return ()) <|> spaces) >> many (noneOf "}") - char '}' - updateState $ \(m, b) -> (if (and b) && (head i /= '_') then Map.insert i d m else m, b) - return "" - replace s = do - (m, _) <- getState - return $ Map.findWithDefault s s m - - unknown = do - fn <- many1 $ noneOf "}\n" - char '}' - return $ "{$" ++ fn ++ "}" diff -r af4ab297b2b7 -r 539380a498e4 tools/PascalUnitSyntaxTree.hs --- a/tools/PascalUnitSyntaxTree.hs Tue Mar 26 18:52:42 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -module PascalUnitSyntaxTree where - -import Data.Maybe -import Data.Char - -data PascalUnit = - Program Identifier Implementation Phrase - | Unit Identifier Interface Implementation (Maybe Initialize) (Maybe Finalize) - | System [TypeVarDeclaration] - | Redo [TypeVarDeclaration] - deriving Show -data Interface = Interface Uses TypesAndVars - deriving Show -data Implementation = Implementation Uses TypesAndVars - deriving Show -data Identifier = Identifier String BaseType - deriving Show -data TypesAndVars = TypesAndVars [TypeVarDeclaration] - deriving Show -data TypeVarDeclaration = TypeDeclaration Identifier TypeDecl - | VarDeclaration Bool Bool ([Identifier], TypeDecl) (Maybe InitExpression) - | FunctionDeclaration Identifier Bool TypeDecl [TypeVarDeclaration] (Maybe (TypesAndVars, Phrase)) - | OperatorDeclaration String Identifier Bool TypeDecl [TypeVarDeclaration] (Maybe (TypesAndVars, Phrase)) - deriving Show -data TypeDecl = SimpleType Identifier - | RangeType Range - | Sequence [Identifier] - | ArrayDecl (Maybe Range) TypeDecl - | RecordType [TypeVarDeclaration] (Maybe [[TypeVarDeclaration]]) - | PointerTo TypeDecl - | String Integer - | Set TypeDecl - | FunctionType TypeDecl [TypeVarDeclaration] - | DeriveType InitExpression - | VoidType - | VarParamType TypeDecl -- this is a hack - deriving Show -data Range = Range Identifier - | RangeFromTo InitExpression InitExpression - | RangeInfinite - deriving Show -data Initialize = Initialize String - deriving Show -data Finalize = Finalize String - deriving Show -data Uses = Uses [Identifier] - deriving Show -data Phrase = ProcCall Reference [Expression] - | IfThenElse Expression Phrase (Maybe Phrase) - | WhileCycle Expression Phrase - | RepeatCycle Expression [Phrase] - | ForCycle Identifier Expression Expression Phrase Bool -- The last Boolean indicates wether it's up or down counting - | WithBlock Reference Phrase - | Phrases [Phrase] - | SwitchCase Expression [([InitExpression], Phrase)] (Maybe [Phrase]) - | Assignment Reference Expression - | BuiltInFunctionCall [Expression] Reference - | NOP - deriving Show -data Expression = Expression String - | BuiltInFunCall [Expression] Reference - | PrefixOp String Expression - | PostfixOp String Expression - | BinOp String Expression Expression - | StringLiteral String - | PCharLiteral String - | CharCode String - | HexCharCode String - | NumberLiteral String - | FloatLiteral String - | HexNumber String - | Reference Reference - | SetExpression [Identifier] - | Null - deriving Show -data Reference = ArrayElement [Expression] Reference - | FunCall [Expression] Reference - | TypeCast Identifier Expression - | SimpleReference Identifier - | Dereference Reference - | RecordField Reference Reference - | Address Reference - | RefExpression Expression - deriving Show -data InitExpression = InitBinOp String InitExpression InitExpression - | InitPrefixOp String InitExpression - | InitReference Identifier - | InitArray [InitExpression] - | InitRecord [(Identifier, InitExpression)] - | InitFloat String - | InitNumber String - | InitHexNumber String - | InitString String - | InitChar String - | BuiltInFunction String [InitExpression] - | InitSet [InitExpression] - | InitAddress InitExpression - | InitNull - | InitRange Range - | InitTypeCast Identifier InitExpression - deriving Show - -data BaseType = BTUnknown - | BTChar - | BTString - | BTInt - | BTBool - | BTFloat - | BTRecord String [(String, BaseType)] - | BTArray Range BaseType BaseType - | BTFunction Bool Int BaseType - | BTPointerTo BaseType - | BTUnresolved String - | BTSet BaseType - | BTEnum [String] - | BTVoid - | BTUnit - | BTVarParam BaseType - deriving Show diff -r af4ab297b2b7 -r 539380a498e4 tools/pas2c.hs --- a/tools/pas2c.hs Tue Mar 26 18:52:42 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1086 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables #-} -module Pas2C where - -import Text.PrettyPrint.HughesPJ -import Data.Maybe -import Data.Char -import Text.Parsec.Prim hiding (State) -import Control.Monad.State -import System.IO -import System.Directory -import Control.Monad.IO.Class -import PascalPreprocessor -import Control.Exception -import System.IO.Error -import qualified Data.Map as Map -import qualified Data.Set as Set -import Data.List (find) -import Numeric - -import PascalParser(pascalUnit) -import PascalUnitSyntaxTree - - -data InsertOption = - IOInsert - | IOInsertWithType Doc - | IOLookup - | IOLookupLast - | IOLookupFunction Int - | IODeferred - -data Record = Record - { - lcaseId :: String, - baseType :: BaseType, - typeDecl :: Doc - } - deriving Show -type Records = Map.Map String [Record] -data RenderState = RenderState - { - currentScope :: Records, - lastIdentifier :: String, - lastType :: BaseType, - lastIdTypeDecl :: Doc, - stringConsts :: [(String, String)], - uniqCounter :: Int, - toMangle :: Set.Set String, - currentUnit :: String, - currentFunctionResult :: String, - namespaces :: Map.Map String Records - } - -rec2Records = map (\(a, b) -> Record a b empty) - -emptyState = RenderState Map.empty "" BTUnknown empty [] 0 Set.empty "" "" - -getUniq :: State RenderState Int -getUniq = do - i <- gets uniqCounter - modify(\s -> s{uniqCounter = uniqCounter s + 1}) - return i - -addStringConst :: String -> State RenderState Doc -addStringConst str = do - strs <- gets stringConsts - let a = find ((==) str . snd) strs - if isJust a then - do - modify (\s -> s{lastType = BTString}) - return . text . fst . fromJust $ a - else - do - i <- getUniq - let sn = "__str" ++ show i - modify (\s -> s{lastType = BTString, stringConsts = (sn, str) : strs}) - return $ text sn - -escapeStr :: String -> String -escapeStr = foldr escapeChar [] - -escapeChar :: Char -> ShowS -escapeChar '"' s = "\\\"" ++ s -escapeChar '\\' s = "\\\\" ++ s -escapeChar a s = a : s - -strInit :: String -> Doc -strInit a = text "STRINIT" <> parens (doubleQuotes (text $ escapeStr a)) - -renderStringConsts :: State RenderState Doc -renderStringConsts = liftM (vcat . map (\(a, b) -> text "static const string255" <+> (text a) <+> text "=" <+> strInit b <> semi)) - $ gets stringConsts - -docToLower :: Doc -> Doc -docToLower = text . map toLower . render - -pas2C :: String -> IO () -pas2C fn = do - setCurrentDirectory "../hedgewars/" - s <- flip execStateT initState $ f fn - renderCFiles s - where - printLn = liftIO . hPutStrLn stdout - print = liftIO . hPutStr stdout - initState = Map.empty - f :: String -> StateT (Map.Map String PascalUnit) IO () - f fileName = do - processed <- gets $ Map.member fileName - unless processed $ do - print ("Preprocessing '" ++ fileName ++ ".pas'... ") - fc' <- liftIO - $ tryJust (guard . isDoesNotExistError) - $ preprocess (fileName ++ ".pas") - case fc' of - (Left a) -> do - modify (Map.insert fileName (System [])) - printLn "doesn't exist" - (Right fc) -> do - print "ok, parsing... " - let ptree = parse pascalUnit fileName fc - case ptree of - (Left a) -> do - liftIO $ writeFile "preprocess.out" fc - printLn $ show a ++ "\nsee preprocess.out for preprocessed source" - fail "stop" - (Right a) -> do - printLn "ok" - modify (Map.insert fileName a) - mapM_ f (usesFiles a) - - -renderCFiles :: Map.Map String PascalUnit -> IO () -renderCFiles units = do - let u = Map.toList units - let nss = Map.map (toNamespace nss) units - --hPutStrLn stderr $ "Units: " ++ (show . Map.keys . Map.filter (not . Map.null) $ nss) - --writeFile "pas2c.log" $ unlines . map (\t -> show (fst t) ++ "\n" ++ (unlines . map ((:) '\t' . show) . snd $ t)) . Map.toList $ nss - mapM_ (toCFiles nss) u - where - toNamespace :: Map.Map String Records -> PascalUnit -> Records - toNamespace nss (System tvs) = - currentScope $ execState f (emptyState nss) - where - f = do - checkDuplicateFunDecls tvs - mapM_ (tvar2C True False True False) tvs - toNamespace nss (Redo tvs) = -- functions that are re-implemented, add prefix to all of them - currentScope $ execState f (emptyState nss){currentUnit = "fpcrtl_"} - where - f = do - checkDuplicateFunDecls tvs - mapM_ (tvar2C True False True False) tvs - toNamespace _ (Program {}) = Map.empty - toNamespace nss (Unit (Identifier i _) interface _ _ _) = - currentScope $ execState (interface2C interface True) (emptyState nss){currentUnit = map toLower i ++ "_"} - - -withState' :: (RenderState -> RenderState) -> State RenderState a -> State RenderState a -withState' f sf = do - st <- liftM f get - let (a, s) = runState sf st - modify(\st -> st{ - lastType = lastType s - , uniqCounter = uniqCounter s - , stringConsts = stringConsts s - }) - return a - -withLastIdNamespace f = do - li <- gets lastIdentifier - nss <- gets namespaces - withState' (\st -> st{currentScope = fromMaybe Map.empty $ Map.lookup li (namespaces st)}) f - -withRecordNamespace :: String -> [Record] -> State RenderState Doc -> State RenderState Doc -withRecordNamespace _ [] = error "withRecordNamespace: empty record" -withRecordNamespace prefix recs = withState' f - where - f st = st{currentScope = Map.unionWith un records (currentScope st), currentUnit = ""} - records = Map.fromList $ map (\(Record a b d) -> (map toLower a, [Record (prefix ++ a) b d])) recs - un [a] b = a : b - -toCFiles :: Map.Map String Records -> (String, PascalUnit) -> IO () -toCFiles _ (_, System _) = return () -toCFiles _ (_, Redo _) = return () -toCFiles ns p@(fn, pu) = do - hPutStrLn stdout $ "Rendering '" ++ fn ++ "'..." - toCFiles' p - where - toCFiles' (fn, p@(Program {})) = writeFile (fn ++ ".c") $ "#include \"fpcrtl.h\"\n" ++ (render2C initialState . pascal2C) p - toCFiles' (fn, (Unit unitId@(Identifier i _) interface implementation _ _)) = do - let (a, s) = runState (id2C IOInsert (setBaseType BTUnit unitId) >> interface2C interface True) initialState{currentUnit = map toLower i ++ "_"} - (a', s') = runState (id2C IOInsert (setBaseType BTUnit unitId) >> interface2C interface False) initialState{currentUnit = map toLower i ++ "_"} - writeFile (fn ++ ".h") $ "#pragma once\n\n#include \"pas2c.h\"\n\n" ++ (render (a $+$ text "")) - writeFile (fn ++ ".c") $ "#include \"fpcrtl.h\"\n\n#include \"" ++ fn ++ ".h\"\n" ++ render (a' $+$ text "") ++ (render2C s . implementation2C) implementation - initialState = emptyState ns - - render2C :: RenderState -> State RenderState Doc -> String - render2C a = render . ($+$ empty) . flip evalState a - - -usesFiles :: PascalUnit -> [String] -usesFiles (Program _ (Implementation uses _) _) = ["pas2cSystem", "pas2cRedo"] ++ uses2List uses -usesFiles (Unit _ (Interface uses1 _) (Implementation uses2 _) _ _) = ["pas2cSystem", "pas2cRedo"] ++ uses2List uses1 ++ uses2List uses2 -usesFiles (System {}) = [] -usesFiles (Redo {}) = [] - -pascal2C :: PascalUnit -> State RenderState Doc -pascal2C (Unit _ interface implementation init fin) = - liftM2 ($+$) (interface2C interface True) (implementation2C implementation) - -pascal2C (Program _ implementation mainFunction) = do - impl <- implementation2C implementation - [main] <- tvar2C True False True True (FunctionDeclaration (Identifier "main" BTInt) False (SimpleType $ Identifier "int" BTInt) [VarDeclaration False False ([Identifier "argc" BTInt], SimpleType (Identifier "Integer" BTInt)) Nothing, VarDeclaration False False ([Identifier "argv" BTUnknown], SimpleType (Identifier "PPChar" BTUnknown)) Nothing] (Just (TypesAndVars [], mainFunction))) - return $ impl $+$ main - - --- the second bool indicates whether do normal interface translation or generate variable declarations --- that will be inserted into implementation files -interface2C :: Interface -> Bool -> State RenderState Doc -interface2C (Interface uses tvars) True = do - u <- uses2C uses - tv <- typesAndVars2C True True True tvars - r <- renderStringConsts - return (u $+$ r $+$ tv) -interface2C (Interface uses tvars) False = do - u <- uses2C uses - tv <- typesAndVars2C True False False tvars - r <- renderStringConsts - return tv - -implementation2C :: Implementation -> State RenderState Doc -implementation2C (Implementation uses tvars) = do - u <- uses2C uses - tv <- typesAndVars2C True False True tvars - r <- renderStringConsts - return (u $+$ r $+$ tv) - -checkDuplicateFunDecls :: [TypeVarDeclaration] -> State RenderState () -checkDuplicateFunDecls tvs = - modify $ \s -> s{toMangle = Map.keysSet . Map.filter (> 1) . foldr ins initMap $ tvs} - where - initMap = Map.empty - --initMap = Map.fromList [("reset", 2)] - ins (FunctionDeclaration (Identifier i _) _ _ _ _) m = Map.insertWith (+) (map toLower i) 1 m - ins _ m = m - --- the second bool indicates whether declare variable as extern or not --- the third bool indicates whether include types or not - -typesAndVars2C :: Bool -> Bool -> Bool -> TypesAndVars -> State RenderState Doc -typesAndVars2C b externVar includeType(TypesAndVars ts) = do - checkDuplicateFunDecls ts - liftM (vcat . map (<> semi) . concat) $ mapM (tvar2C b externVar includeType False) ts - -setBaseType :: BaseType -> Identifier -> Identifier -setBaseType bt (Identifier i _) = Identifier i bt - -uses2C :: Uses -> State RenderState Doc -uses2C uses@(Uses unitIds) = do - - mapM_ injectNamespace (Identifier "pas2cSystem" undefined : unitIds) - mapM_ injectNamespace (Identifier "pas2cRedo" undefined : unitIds) - mapM_ (id2C IOInsert . setBaseType BTUnit) unitIds - return $ vcat . map (\i -> text $ "#include \"" ++ i ++ ".h\"") $ uses2List uses - where - injectNamespace (Identifier i _) = do - getNS <- gets (flip Map.lookup . namespaces) - modify (\s -> s{currentScope = Map.unionWith (++) (fromMaybe Map.empty (getNS i)) $ currentScope s}) - -uses2List :: Uses -> [String] -uses2List (Uses ids) = map (\(Identifier i _) -> i) ids - - -setLastIdValues vv = (\s -> s{lastType = baseType vv, lastIdentifier = lcaseId vv, lastIdTypeDecl = typeDecl vv}) - -id2C :: InsertOption -> Identifier -> State RenderState Doc -id2C IOInsert i = id2C (IOInsertWithType empty) i -id2C (IOInsertWithType d) (Identifier i t) = do - ns <- gets currentScope - tom <- gets (Set.member n . toMangle) - cu <- gets currentUnit - let (i', t') = case (t, tom) of - (BTFunction _ p _, True) -> (cu ++ i ++ ('_' : show p), t) - (BTFunction _ _ _, _) -> (cu ++ i, t) - (BTVarParam t', _) -> ('(' : '*' : i ++ ")" , t') - _ -> (i, t) - modify (\s -> s{currentScope = Map.insertWith (++) n [Record i' t' d] (currentScope s), lastIdentifier = n}) - return $ text i' - where - n = map toLower i - -id2C IOLookup i = id2CLookup head i -id2C IOLookupLast i = id2CLookup last i -id2C (IOLookupFunction params) (Identifier i t) = do - let i' = map toLower i - v <- gets $ Map.lookup i' . currentScope - lt <- gets lastType - if isNothing v then - error $ "Not defined: '" ++ i' ++ "'\n" ++ show lt ++ "\nwith num of params = " ++ show params ++ "\n" ++ show v - else - let vv = fromMaybe (head $ fromJust v) . find checkParam $ fromJust v in - modify (setLastIdValues vv) >> (return . text . lcaseId $ vv) - where - checkParam (Record _ (BTFunction _ p _) _) = p == params - checkParam _ = False -id2C IODeferred (Identifier i t) = do - let i' = map toLower i - v <- gets $ Map.lookup i' . currentScope - if (isNothing v) then - modify (\s -> s{lastType = BTUnknown, lastIdentifier = i}) >> return (text i) - else - let vv = head $ fromJust v in modify (setLastIdValues vv) >> (return . text . lcaseId $ vv) - -id2CLookup :: ([Record] -> Record) -> Identifier -> State RenderState Doc -id2CLookup f (Identifier i t) = do - let i' = map toLower i - v <- gets $ Map.lookup i' . currentScope - lt <- gets lastType - if isNothing v then - error $ "Not defined: '" ++ i' ++ "'\n" ++ show lt - else - let vv = f $ fromJust v in modify (setLastIdValues vv) >> (return . text . lcaseId $ vv) - - -id2CTyped :: TypeDecl -> Identifier -> State RenderState Doc -id2CTyped = id2CTyped2 Nothing - -id2CTyped2 :: Maybe Doc -> TypeDecl -> Identifier -> State RenderState Doc -id2CTyped2 md t (Identifier i _) = do - tb <- resolveType t - case (t, tb) of - (_, BTUnknown) -> do - error $ "id2CTyped: type BTUnknown for " ++ show i ++ "\ntype: " ++ show t - (SimpleType {}, BTRecord _ r) -> do - ts <- type2C t - id2C (IOInsertWithType $ ts empty) (Identifier i (BTRecord (render $ ts empty) r)) - (_, BTRecord _ r) -> do - ts <- type2C t - id2C (IOInsertWithType $ ts empty) (Identifier i (BTRecord i r)) - _ -> case md of - Nothing -> id2C IOInsert (Identifier i tb) - Just ts -> id2C (IOInsertWithType ts) (Identifier i tb) - - -resolveType :: TypeDecl -> State RenderState BaseType -resolveType st@(SimpleType (Identifier i _)) = do - let i' = map toLower i - v <- gets $ Map.lookup i' . currentScope - if isJust v then return . baseType . head $ fromJust v else return $ f i' - where - f "integer" = BTInt - f "pointer" = BTPointerTo BTVoid - f "boolean" = BTBool - f "float" = BTFloat - f "char" = BTChar - f "string" = BTString - f _ = error $ "Unknown system type: " ++ show st -resolveType (PointerTo (SimpleType (Identifier i _))) = return . BTPointerTo $ BTUnresolved (map toLower i) -resolveType (PointerTo t) = liftM BTPointerTo $ resolveType t -resolveType (RecordType tv mtvs) = do - tvs <- mapM f (concat $ tv : fromMaybe [] mtvs) - return . BTRecord "" . concat $ tvs - where - f :: TypeVarDeclaration -> State RenderState [(String, BaseType)] - f (VarDeclaration _ _ (ids, td) _) = mapM (\(Identifier i _) -> liftM ((,) i) $ resolveType td) ids -resolveType (ArrayDecl (Just i) t) = do - t' <- resolveType t - return $ BTArray i BTInt t' -resolveType (ArrayDecl Nothing t) = liftM (BTArray RangeInfinite BTInt) $ resolveType t -resolveType (FunctionType t a) = liftM (BTFunction False (length a)) $ resolveType t -resolveType (DeriveType (InitHexNumber _)) = return BTInt -resolveType (DeriveType (InitNumber _)) = return BTInt -resolveType (DeriveType (InitFloat _)) = return BTFloat -resolveType (DeriveType (InitString _)) = return BTString -resolveType (DeriveType (InitBinOp {})) = return BTInt -resolveType (DeriveType (InitPrefixOp _ e)) = initExpr2C e >> gets lastType -resolveType (DeriveType (BuiltInFunction{})) = return BTInt -resolveType (DeriveType (InitReference (Identifier{}))) = return BTBool -- TODO: derive from actual type -resolveType (DeriveType _) = return BTUnknown -resolveType (String _) = return BTString -resolveType VoidType = return BTVoid -resolveType (Sequence ids) = return $ BTEnum $ map (\(Identifier i _) -> map toLower i) ids -resolveType (RangeType _) = return $ BTVoid -resolveType (Set t) = liftM BTSet $ resolveType t -resolveType (VarParamType t) = liftM BTVarParam $ resolveType t - - -resolve :: String -> BaseType -> State RenderState BaseType -resolve s (BTUnresolved t) = do - v <- gets $ Map.lookup t . currentScope - if isJust v then - resolve s . baseType . head . fromJust $ v - else - error $ "Unknown type " ++ show t ++ "\n" ++ s -resolve _ t = return t - -fromPointer :: String -> BaseType -> State RenderState BaseType -fromPointer s (BTPointerTo t) = resolve s t -fromPointer s t = do - error $ "Dereferencing from non-pointer type " ++ show t ++ "\n" ++ s - - -functionParams2C params = liftM (hcat . punctuate comma . concat) $ mapM (tvar2C False False True True) params - -numberOfDeclarations :: [TypeVarDeclaration] -> Int -numberOfDeclarations = sum . map cnt - where - cnt (VarDeclaration _ _ (ids, _) _) = length ids - cnt _ = 1 - -hasPassByReference :: [TypeVarDeclaration] -> Bool -hasPassByReference = or . map isVar - where - isVar (VarDeclaration v _ (_, _) _) = v - isVar _ = error $ "hasPassByReference called not on function parameters" - -toIsVarList :: [TypeVarDeclaration] -> [Bool] -toIsVarList = concatMap isVar - where - isVar (VarDeclaration v _ (p, _) _) = replicate (length p) v - isVar _ = error $ "toIsVarList called not on function parameters" - - -funWithVarsToDefine :: String -> [TypeVarDeclaration] -> Doc -funWithVarsToDefine n params = text "#define" <+> text n <> parens abc <+> text (n ++ "__vars") <> parens cparams - where - abc = hcat . punctuate comma . map (char . fst) $ ps - cparams = hcat . punctuate comma . map (\(c, v) -> if v then char '&' <> parens (char c) else char c) $ ps - ps = zip ['a'..] (toIsVarList params) - -fun2C :: Bool -> String -> TypeVarDeclaration -> State RenderState [Doc] -fun2C _ _ (FunctionDeclaration name inline returnType params Nothing) = do - t <- type2C returnType - t'<- gets lastType - p <- withState' id $ functionParams2C params - n <- liftM render . id2C IOInsert $ setBaseType (BTFunction hasVars (numberOfDeclarations params) t') name - let decor = if inline then text "inline" else empty - if hasVars then - return [funWithVarsToDefine n params $+$ decor <+> t empty <+> text (n ++ "__vars") <> parens p] - else - return [decor <+> t empty <+> text n <> parens p] - where - hasVars = hasPassByReference params - - -fun2C True rv (FunctionDeclaration name@(Identifier i _) inline returnType params (Just (tvars, phrase))) = do - let res = docToLower $ text rv <> text "_result" - t <- type2C returnType - t'<- gets lastType - - notDeclared <- liftM isNothing . gets $ Map.lookup (map toLower i) . currentScope - - n <- liftM render . id2C IOInsert $ setBaseType (BTFunction hasVars (numberOfDeclarations params) t') name - - let isVoid = case returnType of - VoidType -> True - _ -> False - - (p, ph) <- withState' (\st -> st{currentScope = Map.insertWith un (map toLower rv) [Record (render res) t' empty] $ currentScope st - , currentFunctionResult = if isVoid then [] else render res}) $ do - p <- functionParams2C params - ph <- liftM2 ($+$) (typesAndVars2C False False True tvars) (phrase2C' phrase) - return (p, ph) - - let phrasesBlock = if isVoid then ph else t empty <+> res <> semi $+$ ph $+$ text "return" <+> res <> semi - let define = if hasVars then text "#ifndef" <+> text n $+$ funWithVarsToDefine n params $+$ text "#endif" else empty - let decor = if inline then text "inline" else empty - return [ - define - $+$ - --(if notDeclared && hasVars then funWithVarsToDefine n params else empty) $+$ - decor <+> t empty <+> text (if hasVars then n ++ "__vars" else n) <> parens p - $+$ - text "{" - $+$ - nest 4 phrasesBlock - $+$ - text "}"] - where - phrase2C' (Phrases p) = liftM vcat $ mapM phrase2C p - phrase2C' p = phrase2C p - un [a] b = a : b - hasVars = hasPassByReference params - -fun2C False _ (FunctionDeclaration (Identifier name _) _ _ _ _) = error $ "nested functions not allowed: " ++ name -fun2C _ tv _ = error $ "fun2C: I don't render " ++ show tv - --- the second bool indicates whether declare variable as extern or not --- the third bool indicates whether include types or not --- the fourth bool indicates whether ignore initialization or not (basically for dynamic arrays since we cannot do initialization in function params) -tvar2C :: Bool -> Bool -> Bool -> Bool -> TypeVarDeclaration -> State RenderState [Doc] -tvar2C b _ includeType _ f@(FunctionDeclaration (Identifier name _) _ _ _ _) = do - t <- fun2C b name f - if includeType then return t else return [] -tvar2C _ _ includeType _ td@(TypeDeclaration i' t) = do - i <- id2CTyped t i' - tp <- type2C t - return $ if includeType then [text "typedef" <+> tp i] else [] - -tvar2C _ _ _ _ (VarDeclaration True _ (ids, t) Nothing) = do - t' <- liftM ((empty <+>) . ) $ type2C t - liftM (map(\i -> t' i)) $ mapM (id2CTyped2 (Just $ t' empty) (VarParamType t)) ids - -tvar2C _ externVar includeType ignoreInit (VarDeclaration _ isConst (ids, t) mInitExpr) = do - t' <- liftM (((if isConst then text "static const" else if externVar - then text "extern" - else empty) - <+>) . ) $ type2C t - ie <- initExpr mInitExpr - lt <- gets lastType - case (isConst, lt, ids, mInitExpr) of - (True, BTInt, [i], Just _) -> do - i' <- id2CTyped t i - return $ if includeType then [text "enum" <> braces (i' <+> ie)] else [] - (True, BTFloat, [i], Just e) -> do - i' <- id2CTyped t i - ie <- initExpr2C e - return $ if includeType then [text "#define" <+> i' <+> parens ie <> text "\n"] else [] - (_, BTFunction{}, _, Nothing) -> liftM (map(\i -> t' i)) $ mapM (id2CTyped t) ids - (_, BTArray r _ _, [i], _) -> do - i' <- id2CTyped t i - ie' <- return $ case (r, mInitExpr, ignoreInit) of - (RangeInfinite, Nothing, False) -> text "= NULL" -- force dynamic array to be initialized as NULL if not initialized at all - (_, _, _) -> ie - result <- liftM (map(\i -> varDeclDecision isConst includeType (t' i) ie')) $ mapM (id2CTyped t) ids - case (r, ignoreInit) of - (RangeInfinite, False) -> - -- if the array is dynamic, add dimension info to it - return $ [dimDecl] ++ result - where - arrayDimStr = show $ arrayDimension t - arrayDimInitExp = text ("={" ++ ".dim = " ++ arrayDimStr ++ ", .a = {0, 0, 0, 0}}") - dimDecl = varDeclDecision isConst includeType (text "fpcrtl_dimension_t" <+> i' <> text "_dimension_info") arrayDimInitExp - - (_, _) -> return result - - _ -> liftM (map(\i -> varDeclDecision isConst includeType (t' i) ie)) $ mapM (id2CTyped2 (Just $ t' empty) t) ids - where - initExpr Nothing = return $ empty - initExpr (Just e) = liftM (text "=" <+>) (initExpr2C e) - varDeclDecision True True varStr expStr = varStr <+> expStr - varDeclDecision False True varStr expStr = if externVar then varStr else varStr <+> expStr - varDeclDecision False False varStr expStr = varStr <+> expStr - varDeclDecision True False varStr expStr = empty - arrayDimension a = case a of - ArrayDecl Nothing t -> let a = arrayDimension t in if a > 3 then error "Dynamic array with dimension > 4 is not supported." else 1 + arrayDimension t - ArrayDecl _ _ -> error "Mixed dynamic array and static array are not supported." - _ -> 0 - -tvar2C f _ _ _ (OperatorDeclaration op (Identifier i _) inline ret params body) = do - r <- op2CTyped op (extractTypes params) - fun2C f i (FunctionDeclaration r inline ret params body) - - -op2CTyped :: String -> [TypeDecl] -> State RenderState Identifier -op2CTyped op t = do - t' <- liftM (render . hcat . punctuate (char '_') . map (\t -> t empty)) $ mapM type2C t - bt <- gets lastType - return $ Identifier (t' ++ "_op_" ++ opStr) bt - where - opStr = case op of - "+" -> "add" - "-" -> "sub" - "*" -> "mul" - "/" -> "div" - "/(float)" -> "div" - "=" -> "eq" - "<" -> "lt" - ">" -> "gt" - "<>" -> "neq" - _ -> error $ "op2CTyped: unknown op '" ++ op ++ "'" - -extractTypes :: [TypeVarDeclaration] -> [TypeDecl] -extractTypes = concatMap f - where - f (VarDeclaration _ _ (ids, t) _) = replicate (length ids) t - f a = error $ "extractTypes: can't extract from " ++ show a - -initExpr2C, initExpr2C' :: InitExpression -> State RenderState Doc -initExpr2C (InitArray values) = liftM (braces . vcat . punctuate comma) $ mapM initExpr2C values -initExpr2C a = initExpr2C' a -initExpr2C' InitNull = return $ text "NULL" -initExpr2C' (InitAddress expr) = do - ie <- initExpr2C' expr - lt <- gets lastType - case lt of - BTFunction True _ _ -> return $ text "&" <> ie <> text "__vars" - _ -> return $ text "&" <> ie -initExpr2C' (InitPrefixOp op expr) = liftM (text (op2C op) <>) (initExpr2C' expr) -initExpr2C' (InitBinOp op expr1 expr2) = do - e1 <- initExpr2C' expr1 - e2 <- initExpr2C' expr2 - return $ parens $ e1 <+> text (op2C op) <+> e2 -initExpr2C' (InitNumber s) = return $ text s -initExpr2C' (InitFloat s) = return $ text s -initExpr2C' (InitHexNumber s) = return $ text "0x" <> (text . map toLower $ s) -initExpr2C' (InitString [a]) = return . quotes $ text [a] -initExpr2C' (InitString s) = return $ strInit s -initExpr2C' (InitChar a) = return $ quotes $ text "\\x" <> text (showHex (read a) "") -initExpr2C' (InitReference i) = id2C IOLookup i -initExpr2C' (InitRecord fields) = do - (fs :: [Doc]) <- mapM (\(Identifier a _, b) -> liftM (text "." <> text a <+> equals <+>) $ initExpr2C b) fields - return $ lbrace $+$ (nest 4 . vcat . punctuate comma $ fs) $+$ rbrace -initExpr2C' (InitArray [value]) = initExpr2C value -initExpr2C' r@(InitRange (Range i@(Identifier i' _))) = do - id2C IOLookup i - t <- gets lastType - case t of - BTEnum s -> return . int $ length s - BTInt -> case i' of - "byte" -> return $ int 256 - _ -> error $ "InitRange identifier: " ++ i' - _ -> error $ "InitRange: " ++ show r -initExpr2C' (InitRange (RangeFromTo (InitNumber "0") r)) = initExpr2C $ BuiltInFunction "succ" [r] -initExpr2C' (InitRange (RangeFromTo (InitChar "0") (InitChar r))) = initExpr2C $ BuiltInFunction "succ" [InitNumber r] -initExpr2C' (InitRange a) = error $ show a --return $ text "<>" -initExpr2C' (InitSet []) = return $ text "0" -initExpr2C' (InitSet a) = return $ text "<>" -initExpr2C' (BuiltInFunction "low" [InitReference e]) = return $ - case e of - (Identifier "LongInt" _) -> int (-2^31) - (Identifier "SmallInt" _) -> int (-2^15) - _ -> error $ "BuiltInFunction 'low': " ++ show e -initExpr2C' (BuiltInFunction "high" [e]) = do - initExpr2C e - t <- gets lastType - case t of - (BTArray i _ _) -> initExpr2C' $ BuiltInFunction "pred" [InitRange i] - a -> error $ "BuiltInFunction 'high': " ++ show a -initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e -initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e -initExpr2C' (BuiltInFunction "succ" [e]) = liftM (<> text " + 1") $ initExpr2C' e -initExpr2C' (BuiltInFunction "pred" [e]) = liftM (<> text " - 1") $ initExpr2C' e -initExpr2C' b@(BuiltInFunction _ _) = error $ show b -initExpr2C' a = error $ "initExpr2C: don't know how to render " ++ show a - - -range2C :: InitExpression -> State RenderState [Doc] -range2C (InitString [a]) = return [quotes $ text [a]] -range2C (InitRange (Range i)) = liftM (flip (:) []) $ id2C IOLookup i -range2C (InitRange (RangeFromTo (InitString [a]) (InitString [b]))) = return $ map (\i -> quotes $ text [i]) [a..b] -range2C a = liftM (flip (:) []) $ initExpr2C a - -baseType2C :: String -> BaseType -> Doc -baseType2C _ BTFloat = text "float" -baseType2C _ BTBool = text "bool" -baseType2C _ BTString = text "string255" -baseType2C s a = error $ "baseType2C: " ++ show a ++ "\n" ++ s - -type2C :: TypeDecl -> State RenderState (Doc -> Doc) -type2C (SimpleType i) = liftM (\i a -> i <+> a) $ id2C IOLookup i -type2C t = do - r <- type2C' t - rt <- resolveType t - modify (\st -> st{lastType = rt}) - return r - where - type2C' VoidType = return (text "void" <+>) - type2C' (String l) = return (text "string255" <+>)--return (text ("string" ++ show l) <+>) - type2C' (PointerTo (SimpleType i)) = do - i' <- id2C IODeferred i - lt <- gets lastType - case lt of - BTRecord _ _ -> return $ \a -> text "struct __" <> i' <+> text "*" <+> a - BTUnknown -> return $ \a -> text "struct __" <> i' <+> text "*" <+> a - _ -> return $ \a -> i' <+> text "*" <+> a - type2C' (PointerTo t) = liftM (\t a -> t (parens $ text "*" <> a)) $ type2C t - type2C' (RecordType tvs union) = do - t <- withState' f $ mapM (tvar2C False False True False) tvs - u <- unions - return $ \i -> text "struct __" <> i <+> lbrace $+$ nest 4 ((vcat . map (<> semi) . concat $ t) $$ u) $+$ rbrace <+> i - where - f s = s{currentUnit = ""} - unions = case union of - Nothing -> return empty - Just a -> do - structs <- mapM struct2C a - return $ text "union" $+$ braces (nest 4 $ vcat structs) <> semi - struct2C tvs = do - t <- withState' f $ mapM (tvar2C False False True False) tvs - return $ text "struct" $+$ braces (nest 4 (vcat . map (<> semi) . concat $ t)) <> semi - type2C' (RangeType r) = return (text "int" <+>) - type2C' (Sequence ids) = do - is <- mapM (id2C IOInsert . setBaseType bt) ids - return (text "enum" <+> (braces . vcat . punctuate comma . map (\(a, b) -> a <+> equals <+> text "0x" <> text (showHex b "")) $ zip is [0..]) <+>) - where - bt = BTEnum $ map (\(Identifier i _) -> map toLower i) ids - type2C' (ArrayDecl Nothing t) = type2C (PointerTo t) - type2C' (ArrayDecl (Just r) t) = do - t' <- type2C t - lt <- gets lastType - ft <- case lt of - -- BTFunction {} -> type2C (PointerTo t) - _ -> return t' - r' <- initExpr2C (InitRange r) - return $ \i -> ft i <> brackets r' - type2C' (Set t) = return (text "<>" <+>) - type2C' (FunctionType returnType params) = do - t <- type2C returnType - p <- withState' id $ functionParams2C params - return (\i -> (t empty <> (parens $ text "*" <> i) <> parens p)) - type2C' (DeriveType (InitBinOp _ _ i)) = type2C' (DeriveType i) - type2C' (DeriveType (InitPrefixOp _ i)) = type2C' (DeriveType i) - type2C' (DeriveType (InitNumber _)) = return (text "int" <+>) - type2C' (DeriveType (InitHexNumber _)) = return (text "int" <+>) - type2C' (DeriveType (InitFloat _)) = return (text "float" <+>) - type2C' (DeriveType (BuiltInFunction {})) = return (text "int" <+>) - type2C' (DeriveType (InitString {})) = return (text "string255" <+>) - type2C' (DeriveType r@(InitReference {})) = do - initExpr2C r - t <- gets lastType - return (baseType2C (show r) t <+>) - type2C' (DeriveType a) = error $ "Can't derive type from " ++ show a - -phrase2C :: Phrase -> State RenderState Doc -phrase2C (Phrases p) = do - ps <- mapM phrase2C p - return $ text "{" $+$ (nest 4 . vcat $ ps) $+$ text "}" -phrase2C (ProcCall f@(FunCall {}) []) = liftM (<> semi) $ ref2C f -phrase2C (ProcCall ref []) = liftM (<> semi) $ ref2CF ref -phrase2C (ProcCall ref params) = error $ "ProcCall"{-do - r <- ref2C ref - ps <- mapM expr2C params - return $ r <> parens (hsep . punctuate (char ',') $ ps) <> semi -} -phrase2C (IfThenElse (expr) phrase1 mphrase2) = do - e <- expr2C expr - p1 <- (phrase2C . wrapPhrase) phrase1 - el <- elsePart - return $ - text "if" <> parens e $+$ p1 $+$ el - where - elsePart | isNothing mphrase2 = return $ empty - | otherwise = liftM (text "else" $$) $ (phrase2C . wrapPhrase) (fromJust mphrase2) -phrase2C (Assignment ref expr) = do - r <- ref2C ref - t <- gets lastType - case (t, expr) of - (BTFunction {}, (Reference r')) -> do - e <- ref2C r' - return $ r <+> text "=" <+> e <> semi - (BTString, _) -> do - e <- expr2C expr - lt <- gets lastType - case lt of - -- assume pointer to char for simplicity - BTPointerTo _ -> do - e <- expr2C $ Reference $ FunCall [Reference $ RefExpression expr] (SimpleReference (Identifier "pchar2str" BTUnknown)) - return $ r <+> text "=" <+> e <> semi - BTString -> do - e <- expr2C expr - return $ r <+> text "=" <+> e <> semi - _ -> error $ "Assignment to string from " ++ show lt - (BTArray _ _ _, _) -> do - case expr of - Reference er -> do - exprRef <- ref2C er - exprT <- gets lastType - case exprT of - BTArray RangeInfinite _ _ -> - return $ text "FIXME: assign a dynamic array to an array" - BTArray _ _ _ -> phrase2C $ - ProcCall (FunCall - [ - Reference $ ref - , Reference $ RefExpression expr - , Reference $ FunCall [expr] (SimpleReference (Identifier "sizeof" BTUnknown)) - ] - (SimpleReference (Identifier "memcpy" BTUnknown)) - ) [] - _ -> return $ text "FIXME: assign a non-specific value to an array" - - _ -> return $ text "FIXME: dynamic array assignment 2" - _ -> do - e <- expr2C expr - return $ r <+> text "=" <+> e <> semi -phrase2C (WhileCycle expr phrase) = do - e <- expr2C expr - p <- phrase2C $ wrapPhrase phrase - return $ text "while" <> parens e $$ p -phrase2C (SwitchCase expr cases mphrase) = do - e <- expr2C expr - cs <- mapM case2C cases - d <- dflt - return $ - text "switch" <> parens e $+$ braces (nest 4 . vcat $ cs ++ d) - where - case2C :: ([InitExpression], Phrase) -> State RenderState Doc - case2C (e, p) = do - ies <- mapM range2C e - ph <- phrase2C p - return $ - vcat (map (\i -> text "case" <+> i <> colon) . concat $ ies) <> nest 4 (ph $+$ text "break;") - dflt | isNothing mphrase = return [text "default: break;"] -- avoid compiler warning - | otherwise = do - ph <- mapM phrase2C $ fromJust mphrase - return [text "default:" <+> nest 4 (vcat ph)] - -phrase2C wb@(WithBlock ref p) = do - r <- ref2C ref - t <- gets lastType - case t of - (BTRecord _ rs) -> withRecordNamespace (render r ++ ".") (rec2Records rs) $ phrase2C $ wrapPhrase p - a -> do - error $ "'with' block referencing non-record type " ++ show a ++ "\n" ++ show wb -phrase2C (ForCycle i' e1' e2' p up) = do - i <- id2C IOLookup i' - iType <- gets lastIdTypeDecl - e1 <- expr2C e1' - e2 <- expr2C e2' - let inc = if up then "inc" else "dec" - let add = if up then "+ 1" else "- 1" - let iEnd = i <> text "__end__" - ph <- phrase2C . appendPhrase (BuiltInFunctionCall [Reference $ SimpleReference i'] (SimpleReference (Identifier inc BTUnknown))) $ wrapPhrase p - return . braces $ - i <+> text "=" <+> e1 <> semi - $$ - iType <+> iEnd <+> text "=" <+> e2 <> semi - $$ - text "if" <+> (parens $ i <+> text "<=" <+> iEnd) <+> text "do" <+> ph <+> - text "while" <> parens (i <+> text "!=" <+> iEnd <+> text add) <> semi - where - appendPhrase p (Phrases ps) = Phrases $ ps ++ [p] -phrase2C (RepeatCycle e' p') = do - e <- expr2C e' - p <- phrase2C (Phrases p') - return $ text "do" <+> p <+> text "while" <> parens (text "!" <> parens e) <> semi -phrase2C NOP = return $ text ";" - -phrase2C (BuiltInFunctionCall [] (SimpleReference (Identifier "exit" BTUnknown))) = do - f <- gets currentFunctionResult - if null f then - return $ text "return" <> semi - else - return $ text "return" <+> text f <> semi -phrase2C (BuiltInFunctionCall [] (SimpleReference (Identifier "break" BTUnknown))) = return $ text "break" <> semi -phrase2C (BuiltInFunctionCall [] (SimpleReference (Identifier "continue" BTUnknown))) = return $ text "continue" <> semi -phrase2C (BuiltInFunctionCall [e] (SimpleReference (Identifier "exit" BTUnknown))) = liftM (\e -> text "return" <+> e <> semi) $ expr2C e -phrase2C (BuiltInFunctionCall [e] (SimpleReference (Identifier "dec" BTUnknown))) = liftM (\e -> text "--" <> e <> semi) $ expr2C e -phrase2C (BuiltInFunctionCall [e1, e2] (SimpleReference (Identifier "dec" BTUnknown))) = liftM2 (\a b -> a <> text " -= " <> b <> semi) (expr2C e1) (expr2C e2) -phrase2C (BuiltInFunctionCall [e] (SimpleReference (Identifier "inc" BTUnknown))) = liftM (\e -> text "++" <> e <> semi) $ expr2C e -phrase2C (BuiltInFunctionCall [e1, e2] (SimpleReference (Identifier "inc" BTUnknown))) = liftM2 (\a b -> a <+> text "+=" <+> b <> semi) (expr2C e1) (expr2C e2) -phrase2C a = error $ "phrase2C: " ++ show a - -wrapPhrase p@(Phrases _) = p -wrapPhrase p = Phrases [p] - -expr2C :: Expression -> State RenderState Doc -expr2C (Expression s) = return $ text s -expr2C b@(BinOp op expr1 expr2) = do - e1 <- expr2C expr1 - t1 <- gets lastType - e2 <- expr2C expr2 - t2 <- gets lastType - case (op2C op, t1, t2) of - ("+", BTString, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strconcat" (BTFunction False 2 BTString)) - ("+", BTString, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strappend" (BTFunction False 2 BTString)) - ("+", BTChar, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strprepend" (BTFunction False 2 BTString)) - ("+", BTChar, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_chrconcat" (BTFunction False 2 BTString)) - ("==", BTString, BTChar) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strcomparec" (BTFunction False 2 BTBool)) - ("==", BTString, BTString) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strcompare" (BTFunction False 2 BTBool)) - ("!=", BTString, _) -> expr2C $ BuiltInFunCall [expr1, expr2] (SimpleReference $ Identifier "_strncompare" (BTFunction False 2 BTBool)) - ("&", BTBool, _) -> return $ parens e1 <+> text "&&" <+> parens e2 - ("|", BTBool, _) -> return $ parens e1 <+> text "||" <+> parens e2 - (_, BTRecord t1 _, BTRecord t2 _) -> do - i <- op2CTyped op [SimpleType (Identifier t1 undefined), SimpleType (Identifier t2 undefined)] - ref2C $ FunCall [expr1, expr2] (SimpleReference i) - (_, BTRecord t1 _, BTInt) -> do - -- aw, "LongInt" here is hwengine-specific hack - i <- op2CTyped op [SimpleType (Identifier t1 undefined), SimpleType (Identifier "LongInt" undefined)] - ref2C $ FunCall [expr1, expr2] (SimpleReference i) - ("in", _, _) -> - case expr2 of - SetExpression set -> do - ids <- mapM (id2C IOLookup) set - modify(\s -> s{lastType = BTBool}) - return . parens . hcat . punctuate (text " || ") . map (\i -> parens $ e1 <+> text "==" <+> i) $ ids - _ -> error "'in' against not set expression" - (o, _, _) | o `elem` boolOps -> do - modify(\s -> s{lastType = BTBool}) - return $ parens e1 <+> text o <+> parens e2 - | otherwise -> do - o' <- return $ case o of - "/(float)" -> text "/(float)" -- pascal returns real value - _ -> text o - e1' <- return $ case (o, t1, t2) of - ("-", BTInt, BTInt) -> parens $ text "(int64_t)" <+> parens e1 - _ -> parens e1 - e2' <- return $ case (o, t1, t2) of - ("-", BTInt, BTInt) -> parens $ text "(int64_t)" <+> parens e2 - _ -> parens e2 - return $ e1' <+> o' <+> e2' - where - boolOps = ["==", "!=", "<", ">", "<=", ">="] -expr2C (NumberLiteral s) = do - modify(\s -> s{lastType = BTInt}) - return $ text s -expr2C (FloatLiteral s) = return $ text s -expr2C (HexNumber s) = return $ text "0x" <> (text . map toLower $ s) -{-expr2C (StringLiteral [a]) = do - modify(\s -> s{lastType = BTChar}) - return . quotes . text $ escape a - where - escape '\'' = "\\\'" - escape a = [a]-} -expr2C (StringLiteral s) = addStringConst s -expr2C (PCharLiteral s) = return . doubleQuotes $ text s -expr2C (Reference ref) = ref2CF ref -expr2C (PrefixOp op expr) = do - e <- expr2C expr - lt <- gets lastType - case lt of - BTRecord t _ -> do - i <- op2CTyped op [SimpleType (Identifier t undefined)] - ref2C $ FunCall [expr] (SimpleReference i) - BTBool -> do - o <- return $ case op of - "not" -> text "!" - _ -> text (op2C op) - return $ o <> parens e - _ -> return $ text (op2C op) <> parens e -expr2C Null = return $ text "NULL" -expr2C (CharCode a) = do - modify(\s -> s{lastType = BTChar}) - return $ quotes $ text "\\x" <> text (showHex (read a) "") -expr2C (HexCharCode a) = if length a <= 2 then return $ quotes $ text "\\x" <> text (map toLower a) else expr2C $ HexNumber a -expr2C (SetExpression ids) = mapM (id2C IOLookup) ids >>= return . parens . hcat . punctuate (text " | ") - -expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "low" _))) = do - e' <- liftM (map toLower . render) $ expr2C e - lt <- gets lastType - case lt of - BTEnum a -> return $ int 0 - BTInt -> case e' of - "longint" -> return $ int (-2147483648) - BTArray {} -> return $ int 0 - _ -> error $ "BuiltInFunCall 'low' from " ++ show e ++ "\ntype: " ++ show lt -expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "high" _))) = do - e' <- liftM (map toLower . render) $ expr2C e - lt <- gets lastType - case lt of - BTEnum a -> return . int $ length a - 1 - BTInt -> case e' of - "longint" -> return $ int (2147483647) - BTString -> return $ int 255 - BTArray (RangeFromTo _ n) _ _ -> initExpr2C n - _ -> error $ "BuiltInFunCall 'high' from " ++ show e ++ "\ntype: " ++ show lt -expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "ord" _))) = liftM parens $ expr2C e -expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "succ" _))) = liftM (<> text " + 1") $ expr2C e -expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "pred" _))) = liftM (<> text " - (int64_t)1") $ expr2C e -expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "length" _))) = do - e' <- expr2C e - lt <- gets lastType - modify (\s -> s{lastType = BTInt}) - case lt of - BTString -> return $ text "fpcrtl_Length" <> parens e' - BTArray RangeInfinite _ _ -> error $ "length() called on variable size array " ++ show e' - BTArray (RangeFromTo _ n) _ _ -> initExpr2C (BuiltInFunction "succ" [n]) - _ -> error $ "length() called on " ++ show lt -expr2C (BuiltInFunCall params ref) = do - r <- ref2C ref - t <- gets lastType - ps <- mapM expr2C params - case t of - BTFunction _ _ t' -> do - modify (\s -> s{lastType = t'}) - _ -> error $ "BuiltInFunCall lastType: " ++ show t - return $ - r <> parens (hsep . punctuate (char ',') $ ps) -expr2C a = error $ "Don't know how to render " ++ show a - -ref2CF :: Reference -> State RenderState Doc -ref2CF (SimpleReference name) = do - i <- id2C IOLookup name - t <- gets lastType - case t of - BTFunction _ _ rt -> do - modify(\s -> s{lastType = rt}) - return $ i <> parens empty --xymeng: removed parens - _ -> return $ i -ref2CF r@(RecordField (SimpleReference _) (SimpleReference _)) = do - i <- ref2C r - t <- gets lastType - case t of - BTFunction _ _ rt -> do - modify(\s -> s{lastType = rt}) - return $ i <> parens empty - _ -> return $ i -ref2CF r = ref2C r - -ref2C :: Reference -> State RenderState Doc --- rewrite into proper form -ref2C (RecordField ref1 (ArrayElement exprs ref2)) = ref2C $ ArrayElement exprs (RecordField ref1 ref2) -ref2C (RecordField ref1 (Dereference ref2)) = ref2C $ Dereference (RecordField ref1 ref2) -ref2C (RecordField ref1 (RecordField ref2 ref3)) = ref2C $ RecordField (RecordField ref1 ref2) ref3 -ref2C (RecordField ref1 (FunCall params ref2)) = ref2C $ FunCall params (RecordField ref1 ref2) -ref2C (ArrayElement (a:b:xs) ref) = ref2C $ ArrayElement (b:xs) (ArrayElement [a] ref) --- conversion routines -ref2C ae@(ArrayElement [expr] ref) = do - e <- expr2C expr - r <- ref2C ref - t <- gets lastType - case t of - (BTArray _ _ t') -> modify (\st -> st{lastType = t'}) --- (BTFunctionReturn _ (BTArray _ _ t')) -> modify (\st -> st{lastType = t'}) --- (BTFunctionReturn _ (BTString)) -> modify (\st -> st{lastType = BTChar}) - (BTString) -> modify (\st -> st{lastType = BTChar}) - (BTPointerTo t) -> do - t'' <- fromPointer (show t) =<< gets lastType - case t'' of - BTChar -> modify (\st -> st{lastType = BTChar}) - a -> error $ "Getting element of " ++ show a ++ "\nReference: " ++ show ae - a -> error $ "Getting element of " ++ show a ++ "\nReference: " ++ show ae - case t of - BTString -> return $ r <> text ".s" <> brackets e - _ -> return $ r <> brackets e -ref2C (SimpleReference name) = id2C IOLookup name -ref2C rf@(RecordField (Dereference ref1) ref2) = do - r1 <- ref2C ref1 - t <- fromPointer (show ref1) =<< gets lastType - r2 <- case t of - BTRecord _ rs -> withRecordNamespace "" (rec2Records rs) $ ref2C ref2 - BTUnit -> error "What??" - a -> error $ "dereferencing from " ++ show a ++ "\n" ++ show rf - return $ - r1 <> text "->" <> r2 -ref2C rf@(RecordField ref1 ref2) = do - r1 <- ref2C ref1 - t <- gets lastType - case t of - BTRecord _ rs -> do - r2 <- withRecordNamespace "" (rec2Records rs) $ ref2C ref2 - return $ r1 <> text "." <> r2 - BTUnit -> withLastIdNamespace $ ref2C ref2 - a -> error $ "dereferencing from " ++ show a ++ "\n" ++ show rf -ref2C d@(Dereference ref) = do - r <- ref2C ref - t <- fromPointer (show d) =<< gets lastType - modify (\st -> st{lastType = t}) - return $ (parens $ text "*" <> r) -ref2C f@(FunCall params ref) = do - r <- fref2C ref - t <- gets lastType - case t of - BTFunction _ _ t' -> do - ps <- liftM (parens . hsep . punctuate (char ',')) $ mapM expr2C params - modify (\s -> s{lastType = t'}) - return $ r <> ps - _ -> case (ref, params) of - (SimpleReference i, [p]) -> ref2C $ TypeCast i p - _ -> error $ "ref2C FunCall erroneous type cast detected: " ++ show f ++ "\nType detected: " ++ show t - where - fref2C (SimpleReference name) = id2C (IOLookupFunction $ length params) name - fref2C a = ref2C a - -ref2C (Address ref) = do - r <- ref2C ref - lt <- gets lastType - case lt of - BTFunction True _ _ -> return $ text "&" <> parens (r <> text "__vars") - _ -> return $ text "&" <> parens r -ref2C (TypeCast t'@(Identifier i _) expr) = do - lt <- expr2C expr >> gets lastType - case (map toLower i, lt) of - ("pchar", BTString) -> ref2C $ FunCall [expr] (SimpleReference (Identifier "_pchar" $ BTPointerTo BTChar)) - ("shortstring", BTPointerTo _) -> ref2C $ FunCall [expr] (SimpleReference (Identifier "pchar2str" $ BTString)) - (a, _) -> do - e <- expr2C expr - t <- id2C IOLookup t' - return . parens $ parens t <> e -ref2C (RefExpression expr) = expr2C expr - - -op2C :: String -> String -op2C "or" = "|" -op2C "and" = "&" -op2C "not" = "~" -op2C "xor" = "^" -op2C "div" = "/" -op2C "mod" = "%" -op2C "shl" = "<<" -op2C "shr" = ">>" -op2C "<>" = "!=" -op2C "=" = "==" -op2C "/" = "/(float)" -op2C a = a - diff -r af4ab297b2b7 -r 539380a498e4 tools/unitCycles.hs --- a/tools/unitCycles.hs Tue Mar 26 18:52:42 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -module Main where - -import PascalParser -import System -import Control.Monad -import Data.Either -import Data.List -import Data.Graph -import Data.Maybe - -unident :: Identificator -> String -unident (Identificator s) = s - -extractUnits :: PascalUnit -> (String, [String]) -extractUnits (Program (Identificator name) (Implementation (Uses idents) _ _) _) = ("program " ++ name, map unident idents) -extractUnits (Unit (Identificator name) (Interface (Uses idents1) _) (Implementation (Uses idents2) _ _) _ _) = (name, map unident $ idents1 ++ idents2) - -f :: [(String, [String])] -> String -f = unlines . map showSCC . stronglyConnComp . map (\(a, b) -> (a, a, b)) - where - showSCC (AcyclicSCC v) = v - showSCC (CyclicSCC vs) = intercalate ", " vs - -myf :: [(String, [String])] -> String -myf d = unlines . map (findCycle . fst) $ d - where - findCycle :: String -> String - findCycle searched = searched ++ ": " ++ (intercalate ", " $ fc searched []) - where - fc :: String -> [String] -> [String] - fc curSearch visited = let uses = curSearch `lookup` d; res = dropWhile null . map t $ fromJust uses in if isNothing uses || null res then [] else head res - where - t u = - if u == searched then - [u] - else - if u `elem` visited then - [] - else - let chain = fc u (u:visited) in if null chain then [] else u:chain - - -main = do - fileNames <- getArgs - files <- mapM readFile fileNames - putStrLn . myf . map extractUnits . rights . map parsePascalUnit $ files