# HG changeset patch # User koda # Date 1365094029 -7200 # Node ID 0bdeea9d388e175b3445f9e07476b8754aa13d18 # Parent 6e3308fc2a1d982dbbed8d0d75276d38c9cb6b08# Parent 31133afaa02587deda7748913a624e4d2a8846a8 merge with latest default branch diff -r 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/HWApplication.cpp --- a/QTfrontend/HWApplication.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/HWApplication.cpp Thu Apr 04 18:47:09 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) @@ -83,6 +84,8 @@ return true; } else if (scheme == "hwplay") { int port = openEvent->url().port(NETGAME_DEFAULT_PORT); + if (address == "") + address = NETGAME_DEFAULT_SERVER; form->NetConnectQuick(address, (quint16) port); return true; } else { diff -r 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/HWApplication.h --- a/QTfrontend/HWApplication.h Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/HWApplication.h Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/gameuiconfig.cpp --- a/QTfrontend/gameuiconfig.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/gameuiconfig.cpp Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/hwconsts.h --- a/QTfrontend/hwconsts.h Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/hwconsts.h Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/hwform.cpp Thu Apr 04 18:47:09 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) @@ -1345,7 +1345,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; diff -r 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/main.cpp --- a/QTfrontend/main.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/main.cpp Thu Apr 04 18:47:09 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; } diff -r 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/net/tcpBase.cpp --- a/QTfrontend/net/tcpBase.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/net/tcpBase.cpp Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/ui/dialog/input_password.cpp --- a/QTfrontend/ui/dialog/input_password.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/ui/dialog/input_password.cpp Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/ui/mouseoverfilter.cpp --- a/QTfrontend/ui/mouseoverfilter.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/ui/mouseoverfilter.cpp Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/ui/widget/chatwidget.cpp --- a/QTfrontend/ui/widget/chatwidget.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/ui/widget/chatwidget.cpp Thu Apr 04 18:47:09 2013 +0200 @@ -37,7 +37,7 @@ #include "hwconsts.h" #include "gameuiconfig.h" #include "playerslistmodel.h" - +#include "HWApplication.h" #include "chatwidget.h" @@ -464,6 +464,7 @@ { line = QString("%1").arg(line); SDLInteraction::instance().playSoundFile(m_hilightSound); + HWApplication::alert(this, 800); } chatStrings.append(line); diff -r 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/ui/widget/feedbackdialog.cpp --- a/QTfrontend/ui/widget/feedbackdialog.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/ui/widget/feedbackdialog.cpp Thu Apr 04 18:47:09 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("Please give 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 known here (english): ")) + .arg(tr("Your email address is optional, but we may want to contact you.")) ); + info->setOpenExternalLinks(true); pageLayout->addWidget(info); QVBoxLayout * summaryEmailLayout = new QVBoxLayout(); diff -r 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/util/MessageDialog.cpp --- a/QTfrontend/util/MessageDialog.cpp Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/util/MessageDialog.cpp Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e QTfrontend/util/MessageDialog.h --- a/QTfrontend/util/MessageDialog.h Thu Apr 04 14:01:54 2013 +0400 +++ b/QTfrontend/util/MessageDialog.h Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e gameServer/Utils.hs --- a/gameServer/Utils.hs Thu Apr 04 14:01:54 2013 +0400 +++ b/gameServer/Utils.hs Thu Apr 04 18:47:09 2013 +0200 @@ -56,7 +56,7 @@ t : replaceTeam tm ts illegalName :: B.ByteString -> Bool -illegalName s = B.null s || B.all isSpace s || isSpace (B.head s) || isSpace (B.last s) || B.any isIllegalChar s +illegalName s = B.null s || B.length s > 40 || B.all isSpace s || isSpace (B.head s) || isSpace (B.last s) || B.any isIllegalChar s where isIllegalChar c = c `List.elem` "$()*+?[]^{|}" diff -r 6e3308fc2a1d -r 0bdeea9d388e hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/CMakeLists.txt Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/GSHandlers.inc Thu Apr 04 18:47:09 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; @@ -5127,6 +5114,7 @@ const iceHeight = 40; var HHGear: PGear; + landRect: TSDL_Rect; ndX, ndY: hwFloat; i, t, gX, gY: LongInt; hogs: PGearArrayS; @@ -5145,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; @@ -5189,18 +5174,25 @@ Y:= HHGear^.Y end; - if (IceState = iceCollideWithGround) and ((GameTicks - IceTime) > groundFreezingTime) then - begin - FillRoundInLandWithIce(Target.X, Target.Y, iceRadius); - SetAllHHToActive; - IceState := iceWaitCollision; + 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; + 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 @@ -5208,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 @@ -5217,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 @@ -5310,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 @@ -5321,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 @@ -5438,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 @@ -5462,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); @@ -5499,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; @@ -5509,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; @@ -5517,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 @@ -5539,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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/LuaPas.pas --- a/hedgewars/LuaPas.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/LuaPas.pas Thu Apr 04 18:47:09 2013 +0200 @@ -15,9 +15,7 @@ {.$DEFINE LUA_GETHOOK} type -{$IFNDEF PAS2C} size_t = Cardinal; -{$ENDIF} Psize_t = ^size_t; PPointer = ^Pointer; diff -r 6e3308fc2a1d -r 0bdeea9d388e hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/SDLh.pas Thu Apr 04 18:47:09 2013 +0200 @@ -36,8 +36,10 @@ {$IFDEF UNIX} {$IFNDEF DARWIN} - {necessary for statically linking physfs (divdi3 undefined)} - {$linklib stdc++} + {necessary for statically linking physfs (divdi3 undefined on 32 bit)} + {$IFDEF CPU32} + {$linklib stdc++} + {$ENDIF} {$ENDIF} {$IFDEF HAIKU} {$linklib root} diff -r 6e3308fc2a1d -r 0bdeea9d388e hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/hwengine.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/options.inc --- a/hedgewars/options.inc Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/options.inc Thu Apr 04 18:47:09 2013 +0200 @@ -66,14 +66,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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/pas2c.h --- a/hedgewars/pas2c.h Thu Apr 04 14:01:54 2013 +0400 +++ /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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/pas2cSystem.pas --- a/hedgewars/pas2cSystem.pas Thu Apr 04 14:01:54 2013 +0400 +++ /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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uAIAmmoTests.pas Thu Apr 04 18:47:09 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,30 @@ 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); 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 +259,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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uAIMisc.pas Thu Apr 04 18:47:09 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; @@ -255,6 +256,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 +332,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; diff -r 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uConsts.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uFloat.pas --- a/hedgewars/uFloat.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uFloat.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uGearsHedgehog.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uGearsList.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uGearsRender.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uLand.pas --- a/hedgewars/uLand.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uLand.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uLandGraphics.pas Thu Apr 04 18:47:09 2013 +0200 @@ -22,10 +22,14 @@ interface uses uFloat, uConsts, uTypes; +type + fillType = (nullPixel, backgroundPixel, ebcPixel, icePixel, setNotCurrentMask, changePixelSetNotCurrent, setCurrentHog, changePixelNotSetNotCurrent); + type TRangeArray = array[0..31] of record Left, Right: LongInt; end; PRangeArray = ^TRangeArray; +TLandCircleProcedure = procedure (landX, landY, pixelX, pixelY: Longint); function addBgColor(OldColor, NewColor: LongWord): LongWord; function SweepDirty: boolean; @@ -36,7 +40,7 @@ procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte); procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt); procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword); -procedure FillRoundInLandWithIce(X, Y, Radius: LongInt); +function FillRoundInLand(X, Y, Radius: LongInt; fill: fillType): LongWord; procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet, isCurrent: boolean); function LandBackPixel(x, y: LongInt): LongWord; procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword); @@ -48,6 +52,218 @@ implementation uses SDLh, uLandTexture, uVariables, uUtils, uDebug; + +procedure calculatePixelsCoordinates(landX, landY: Longint; var pixelX, pixelY: Longint); inline; +begin +if (cReducedQuality and rqBlurryLand) = 0 then + begin + pixelX := landX; + pixelY := landY; + end +else + begin + pixelX := LandX div 2; + pixelY := LandY div 2; + end; +end; + +function drawPixelBG(landX, landY, pixelX, pixelY: Longint): Longword; inline; +begin +drawPixelBG := 0; +if (Land[LandY, landX] and lfIndestructible) = 0 then + begin + if ((Land[landY, landX] and lfBasic) <> 0) and (((LandPixels[pixelY, pixelX] and AMask) shr AShift) = 255) and (not disableLandBack) then + begin + LandPixels[pixelY, pixelX]:= LandBackPixel(landX, landY); + inc(drawPixelBG); + end + else if ((Land[landY, landX] and lfObject) <> 0) or (((LandPixels[pixelY, pixelX] and AMask) shr AShift) < 255) then + 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; + 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; +begin +result := 0; +for i := x - 1 to x + 1 do + for j := y - 1 to y + 1 do + begin + if (i < 0) or + (i > LAND_WIDTH - 1) or + (j < 0) or + (j > LAND_HEIGHT -1) then + begin + result := 9; + exit; + end; + if Land[j, i] and lfLandMask and not lfIce = 0 then + result := result + 1; + end; +end; + + +procedure fillPixelFromIceSprite(pixelX, pixelY:Longint); inline; +var + iceSurface: PSDL_Surface; + icePixels: PLongwordArray; + w: LongWord; +begin + // So. 3 parameters here. Ice colour, Ice opacity, and a bias on the greyscaled pixel towards lightness + iceSurface:= SpritesData[sprIceTexture].Surface; + icePixels := iceSurface^.pixels; + w:= LandPixels[pixelY, pixelX]; + if w > 0 then + begin + w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + + (w shr BShift and $FF) * RGB_LUMINANCE_GREEN + + (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)); + if w < 128 then w:= w+128; + if w > 255 then w:= 255; + w:= (w shl RShift) or (w shl BShift) or (w shl GShift) or (LandPixels[pixelY, pixelX] and AMask); + 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 + 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 + LandPixels[pixelY, pixelX]:= LandPixels[pixelY, pixelX] and not AMask or 254 shl AShift; + end; +end; + + +procedure DrawPixelIce(landX, landY, pixelX, pixelY: Longint); inline; +begin +if ((Land[landY, landX] and lfIce) <> 0) then exit; +if isLandscapeEdge(getPixelWeight(landX, landY)) then + begin + if (LandPixels[pixelY, pixelX] and AMask < 255) and (LandPixels[pixelY, pixelX] and AMask > 0) then + LandPixels[pixelY, pixelX] := (IceEdgeColor and not AMask) or (LandPixels[pixelY, pixelX] and AMask) + else if (LandPixels[pixelY, pixelX] and AMask < 255) or (Land[landY, landX] > 255) then + LandPixels[pixelY, pixelX] := IceEdgeColor + end +else if Land[landY, landX] > 255 then + begin + fillPixelFromIceSprite(pixelX, pixelY); + end; +if Land[landY, landX] > 255 then Land[landY, landX] := Land[landY, landX] or lfIce and not lfDamaged; +end; + + +function FillLandCircleLine(y, fromPix, toPix: LongInt; fill : fillType): Longword; +var px, py, i: LongInt; +begin +//get rid of compiler warning + px := 0; + py := 0; + FillLandCircleLine := 0; + case fill of + backgroundPixel: + for i:= fromPix to toPix do + begin + calculatePixelsCoordinates(i, y, px, py); + inc(FillLandCircleLine, drawPixelBG(i, y, px, py)); + end; + ebcPixel: + for i:= fromPix to toPix do + begin + calculatePixelsCoordinates(i, y, px, py); + drawPixelEBC(i, y, px, py); + end; + 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 + end; + icePixel: + for i:= fromPix to toPix do + begin + calculatePixelsCoordinates(i, y, px, py); + DrawPixelIce(i, y, px, py); + end; + setNotCurrentMask: + for i:= fromPix to toPix do + begin + Land[y, i]:= Land[y, i] and lfNotCurrentMask; + end; + 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: + for i:= fromPix to toPix do + begin + Land[y, i]:= Land[y, i] or lfCurrentHog + end; + changePixelNotSetNotCurrent: + 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) + end; + end; +end; + +function FillLandCircleSegment(x, y, dx, dy: LongInt; fill : fillType): Longword; inline; +begin + FillLandCircleSegment := 0; +if ((y + dy) and LAND_HEIGHT_MASK) = 0 then + inc(FillLandCircleSegment, FillLandCircleLine(y + dy, Max(x - dx, 0), Min(x + dx, LAND_WIDTH - 1), fill)); +if ((y - dy) and LAND_HEIGHT_MASK) = 0 then + inc(FillLandCircleSegment, FillLandCircleLine(y - dy, Max(x - dx, 0), Min(x + dx, LAND_WIDTH - 1), fill)); +if ((y + dx) and LAND_HEIGHT_MASK) = 0 then + inc(FillLandCircleSegment, FillLandCircleLine(y + dx, Max(x - dy, 0), Min(x + dy, LAND_WIDTH - 1), fill)); +if ((y - dx) and LAND_HEIGHT_MASK) = 0 then + inc(FillLandCircleSegment, FillLandCircleLine(y - dx, Max(x - dy, 0), Min(x + dy, LAND_WIDTH - 1), fill)); +end; + +function FillRoundInLand(X, Y, Radius: LongInt; fill: fillType): Longword; inline; +var dx, dy, d: LongInt; +begin +dx:= 0; +dy:= Radius; +d:= 3 - 2 * Radius; +FillRoundInLand := 0; +while (dx < dy) do + begin + inc(FillRoundInLand, FillLandCircleSegment(x, y, dx, dy, fill)); + if (d < 0) then + d:= d + 4 * dx + 6 + else + begin + d:= d + 4 * (dx - dy) + 10; + dec(dy) + end; + inc(dx) + end; +if (dx = dy) then + inc (FillRoundInLand, FillLandCircleSegment(x, y, dx, dy, fill)); +end; + + function addBgColor(OldColor, NewColor: LongWord): LongWord; // Factor ranges from 0 to 100% NewColor var @@ -100,67 +316,6 @@ Land[y - dx, i]:= Value; end; -procedure ChangeCircleLines(x, y, dx, dy: LongInt; doSet, isCurrent: boolean); -var i: LongInt; -begin -if not doSet then - begin - if ((y + dy) and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if isCurrent then - Land[y + dy, i]:= Land[y + dy, i] and lfNotCurrentMask - else if Land[y + dy, i] and lfObjMask > 0 then - Land[y + dy, i]:= (Land[y + dy, i] and lfNotObjMask) or ((Land[y + dy, i] and lfObjMask) - 1); - if ((y - dy) and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if isCurrent then - Land[y - dy, i]:= Land[y - dy, i] and lfNotCurrentMask - else if Land[y - dy, i] and lfObjMask > 0 then - Land[y - dy, i]:= (Land[y - dy, i] and lfNotObjMask) or ((Land[y - dy, i] and lfObjMask) - 1); - if ((y + dx) and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if isCurrent then - Land[y + dx, i]:= Land[y + dx, i] and lfNotCurrentMask - else if Land[y + dx, i] and lfObjMask > 0 then - Land[y + dx, i]:= (Land[y + dx, i] and lfNotObjMask) or ((Land[y + dx, i] and lfObjMask) - 1); - if ((y - dx) and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if isCurrent then - Land[y - dx, i]:= Land[y - dx, i] and lfNotCurrentMask - else if Land[y - dx, i] and lfObjMask > 0 then - Land[y - dx, i]:= (Land[y - dx, i] and lfNotObjMask) or ((Land[y - dx, i] and lfObjMask) - 1) - end -else - begin - if ((y + dy) and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if isCurrent then - Land[y + dy, i]:= Land[y + dy, i] or lfCurrentHog - else if Land[y + dy, i] and lfObjMask < lfObjMask then - Land[y + dy, i]:= (Land[y + dy, i] and lfNotObjMask) or ((Land[y + dy, i] and lfObjMask) + 1); - if ((y - dy) and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if isCurrent then - Land[y - dy, i]:= Land[y - dy, i] or lfCurrentHog - else if Land[y - dy, i] and lfObjMask < lfObjMask then - Land[y - dy, i]:= (Land[y - dy, i] and lfNotObjMask) or ((Land[y - dy, i] and lfObjMask) + 1); - if ((y + dx) and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if isCurrent then - Land[y + dx, i]:= Land[y + dx, i] or lfCurrentHog - else if Land[y + dx, i] and lfObjMask < lfObjMask then - Land[y + dx, i]:= (Land[y + dx, i] and lfNotObjMask) or ((Land[y + dx, i] and lfObjMask) + 1); - if ((y - dx) and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if isCurrent then - Land[y - dx, i]:= Land[y - dx, i] or lfCurrentHog - else if Land[y - dx, i] and lfObjMask < lfObjMask then - Land[y - dx, i]:= (Land[y - dx, i] and lfNotObjMask) or ((Land[y - dx, i] and lfObjMask) + 1) - end -end; - - - procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword); var dx, dy, d: LongInt; begin @@ -184,206 +339,17 @@ end; procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet, isCurrent: boolean); -var dx, dy, d: LongInt; begin -dx:= 0; -dy:= Radius; -d:= 3 - 2 * Radius; -while (dx < dy) do - begin - ChangeCircleLines(x, y, dx, dy, doSet, isCurrent); - if (d < 0) then - d:= d + 4 * dx + 6 - else - begin - d:= d + 4 * (dx - dy) + 10; - dec(dy) - end; - inc(dx) - end; -if (dx = dy) then - ChangeCircleLines(x, y, dx, dy, doSet, isCurrent) -end; - -procedure FillLandCircleLines0(x, y, dx, dy: LongInt); -var i, t: LongInt; -begin -t:= y + dy; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if ((Land[t, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[t, i] > 255)) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= 0 - else - LandPixels[t div 2, i div 2]:= 0; - -t:= y - dy; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if ((Land[t, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[t, i] > 255)) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= 0 - else - LandPixels[t div 2, i div 2]:= 0; - -t:= y + dx; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if ((Land[t, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[t, i] > 255)) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= 0 - else - LandPixels[t div 2, i div 2]:= 0; - -t:= y - dx; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if ((Land[t, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[t, i] > 255)) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= 0 - else - LandPixels[t div 2, i div 2]:= 0; - -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; -begin - result := 0; - for i := x - 1 to x + 1 do - for j := y - 1 to y + 1 do - begin - if (i < 0) or - (i > LAND_WIDTH - 1) or - (j < 0) or - (j > LAND_HEIGHT -1) then - begin - result := 9; - exit; - end; - - if Land[j, i] and lfLandMask and not lfIce = 0 then - result := result + 1; - end; +if not doSet and isCurrent then + FillRoundInLand(X, Y, Radius, setNotCurrentMask) +else if not doSet and not IsCurrent then + FillRoundInLand(X, Y, Radius, changePixelSetNotCurrent) +else if doSet and IsCurrent then + FillRoundInLand(X, Y, Radius, setCurrentHog) +else if doSet and not IsCurrent then + FillRoundInLand(X, Y, Radius, changePixelNotSetNotCurrent); end; -procedure drawIcePixel(y, x:Longint); -var - iceSurface: PSDL_Surface; - icePixels: PLongwordArray; - //pictureX, pictureY: LongInt; - w{, c}: LongWord; - //weight: Longint; -begin - // So. 3 parameters here. Ice colour, Ice opacity, and a bias on the greyscaled pixel towards lightness - iceSurface:= SpritesData[sprIceTexture].Surface; - icePixels := iceSurface^.pixels; - w:= LandPixels[y, x]; - if w > 0 then - begin - w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + - (w shr BShift and $FF) * RGB_LUMINANCE_GREEN + - (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)); - if w < 128 then w:= w+128; - if w > 255 then w:= 255; - w:= (w shl RShift) or (w shl BShift) or (w shl GShift) or (LandPixels[y,x] and AMask); - LandPixels[y, x]:= addBgColor(w, IceColor); - LandPixels[y, x]:= addBgColor(LandPixels[y, x], icePixels^[iceSurface^.w * (y mod iceSurface^.h) + (x mod iceSurface^.w)]) - end - else - begin - LandPixels[y, x]:= IceColor and not AMask or $E8 shl AShift; - LandPixels[y, x]:= addBgColor(LandPixels[y, x], icePixels^[iceSurface^.w * (y mod iceSurface^.h) + (x mod iceSurface^.w)]); - // silly workaround to avoid having to make background erasure a tadb it smarter about sea ice - if LandPixels[y, x] and AMask shr AShift = 255 then - LandPixels[y, x]:= LandPixels[y, x] and not AMask or 254 shl AShift; - end; -end; - -function getIncrementInquarter(dx, dy, quarter: Longint): Longint; inline; -const directionX : array [0..3] of Longint = (0, 0, 1, -1); -const directionY : array [0..3] of Longint = (1, -1, 0, 0); -begin - getIncrementInquarter := directionX[quarter] * dx + directionY[quarter] * dy; -end; - -function getIncrementInquarter2(dx, dy, quarter: Longint): Longint; inline; -const directionY : array [0..3] of Longint = (0, 0, 1, 1); -const directionX : array [0..3] of Longint = (1, 1, 0, 0); -begin - getIncrementInquarter2 := directionX[quarter] * dx + directionY[quarter] * dy; -end; - -procedure FillLandCircleLinesIce(x, y, dx, dy: LongInt); -var q, i, t, px, py: LongInt; -begin -for q := 0 to 3 do - begin - t:= y + getIncrementInquarter(dx, dy, q); - if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - getIncrementInquarter2(dx, dy, q), 0) to Min(x + getIncrementInquarter2(dx, dy, q), LAND_WIDTH - 1) do - if Land[t, i] and lfIce = 0 then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - begin - px:= i; py:= t - end - else - begin - px:= i div 2; py:= t div 2 - end; - if isLandscapeEdge(getPixelWeight(i, t)) then - begin - if (LandPixels[py, px] and AMask < 255) and (LandPixels[py, px] and AMask > 0) then - LandPixels[py, px] := (IceEdgeColor and not AMask) or (LandPixels[py, px] and AMask) - else if (LandPixels[py, px] and AMask < 255) or (Land[t, i] > 255) then - LandPixels[py, px] := IceEdgeColor - end - else if Land[t, i] > 255 then - begin - drawIcePixel(py, px) - end; - if Land[t, i] > 255 then Land[t, i] := Land[t, i] or lfIce and not lfDamaged; - end; - end -end; - -procedure FillRoundInLandWithIce(X, Y, Radius: LongInt); -var dx, dy, d: LongInt; - landRect: TSDL_Rect; -begin -dx:= 0; -dy:= Radius; -d:= 3 - 2 * Radius; -while (dx < dy) do - begin - FillLandCircleLinesIce(x, y, dx, dy); - if (d < 0) then - d:= d + 4 * dx + 6 - else - begin - d:= d + 4 * (dx - dy) + 10; - dec(dy) - end; - inc(dx) - end; -if (dx = dy) then - FillLandCircleLinesIce(x, y, dx, dy); -landRect.x := min(max(x - Radius, 0), LAND_WIDTH - 1); -landRect.y := min(max(y - Radius, 0), LAND_HEIGHT - 1); -landRect.w := min(2*Radius, LAND_WIDTH - landRect.x - 1); -landRect.h := min(2*Radius, LAND_HEIGHT - landRect.y - 1); -UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); -end; - - procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint); var i, j: integer; @@ -395,259 +361,32 @@ begin if Land[j, i] = 0 then begin - Land[j, i] := lfIce; - drawIcePixel(j, i); + 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); -end; - - - -function FillLandCircleLinesBG(x, y, dx, dy: LongInt): Longword; -var i, t, by, bx: LongInt; - cnt: Longword; -begin -cnt:= 0; -t:= y + dy; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if (Land[t, i] and lfIndestructible) = 0 then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - begin - by:= t; bx:= i; - end - else - begin - by:= t div 2; bx:= i div 2; - end; - if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then - begin - inc(cnt); - LandPixels[by, bx]:= LandBackPixel(i, t) - end - else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then - LandPixels[by, bx]:= 0 - end; - -t:= y - dy; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if (Land[t, i] and lfIndestructible) = 0 then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - begin - by:= t; bx:= i; - end - else - begin - by:= t div 2; bx:= i div 2; - end; - if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then - begin - inc(cnt); - LandPixels[by, bx]:= LandBackPixel(i, t) - end - else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then - LandPixels[by, bx]:= 0 - end; - -t:= y + dx; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if (Land[t, i] and lfIndestructible) = 0 then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - begin - by:= t; bx:= i; - end - else - begin - by:= t div 2; bx:= i div 2; - end; - if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then - begin - inc(cnt); - LandPixels[by, bx]:= LandBackPixel(i, t) - end - else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then - LandPixels[by, bx]:= 0 - end; -t:= y - dx; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if (Land[t, i] and lfIndestructible) = 0 then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - begin - by:= t; bx:= i; - end - else - begin - by:= t div 2; bx:= i div 2; - end; - if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then - begin - inc(cnt); - LandPixels[by, bx]:= LandBackPixel(i, t) - end - else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then - LandPixels[by, bx]:= 0 - end; -FillLandCircleLinesBG:= cnt; -end; - -procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt); -var i, t: LongInt; -begin -t:= y + dy; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= ExplosionBorderColor - else - LandPixels[t div 2, i div 2]:= ExplosionBorderColor; - - Land[t, i]:= (Land[t, i] or lfDamaged) and not lfIce; - //Despeckle(i, t); - LandDirty[t div 32, i div 32]:= 1; - end; - -t:= y - dy; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= ExplosionBorderColor - else - LandPixels[t div 2, i div 2]:= ExplosionBorderColor; - Land[t, i]:= (Land[t, i] or lfDamaged) and not lfIce; - //Despeckle(i, t); - LandDirty[t div 32, i div 32]:= 1; - end; - -t:= y + dx; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= ExplosionBorderColor - else - LandPixels[t div 2, i div 2]:= ExplosionBorderColor; - - Land[t, i]:= (Land[t, i] or lfDamaged) and not lfIce; - //Despeckle(i, t); - LandDirty[t div 32, i div 32]:= 1; - end; - -t:= y - dx; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then - begin - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= ExplosionBorderColor - else - LandPixels[t div 2, i div 2]:= ExplosionBorderColor; - - Land[t, i]:= (Land[t, i] or lfDamaged) and not lfIce; - //Despeckle(i, y - dy); - LandDirty[t div 32, i div 32]:= 1; - end; +UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); end; function DrawExplosion(X, Y, Radius: LongInt): Longword; -var dx, dy, ty, tx, d: LongInt; - cnt: Longword; +var + tx, ty, dx, dy: Longint; begin - -// draw background land texture - begin - cnt:= 0; - dx:= 0; - dy:= Radius; - d:= 3 - 2 * Radius; - - while (dx < dy) do - begin - inc(cnt, FillLandCircleLinesBG(x, y, dx, dy)); - if (d < 0) then - d:= d + 4 * dx + 6 - else - begin - d:= d + 4 * (dx - dy) + 10; - dec(dy) - end; - inc(dx) - end; - if (dx = dy) then - inc(cnt, FillLandCircleLinesBG(x, y, dx, dy)); - end; - -// draw a hole in land -if Radius > 20 then - begin - dx:= 0; - dy:= Radius - 15; - d:= 3 - 2 * dy; - - while (dx < dy) do - begin - FillLandCircleLines0(x, y, dx, dy); - if (d < 0) then - d:= d + 4 * dx + 6 - else - begin - d:= d + 4 * (dx - dy) + 10; - dec(dy) - end; - inc(dx) - end; - if (dx = dy) then - FillLandCircleLines0(x, y, dx, dy); - end; - - // FillRoundInLand after erasing land pixels to allow Land 0 check for mask.png to function + DrawExplosion := FillRoundInLand(x, y, Radius, backgroundPixel); + if Radius > 20 then + FillRoundInLand(x, y, Radius - 15, nullPixel); FillRoundInLand(X, Y, Radius, 0); - -// draw explosion border - begin - inc(Radius, 4); - dx:= 0; - dy:= Radius; - d:= 3 - 2 * Radius; - while (dx < dy) do - begin - FillLandCircleLinesEBC(x, y, dx, dy); - if (d < 0) then - d:= d + 4 * dx + 6 - else - begin - d:= d + 4 * (dx - dy) + 10; - dec(dy) - end; - inc(dx) - end; - if (dx = dy) then - FillLandCircleLinesEBC(x, y, dx, dy); - end; - -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; -UpdateLandTexture(tx, dx, ty, dy, false); -DrawExplosion:= cnt + FillRoundInLand(x, y, Radius + 4, ebcPixel); + 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; procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte); @@ -701,6 +440,33 @@ UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT, false) end; + + +procedure DrawExplosionBorder(X, Y, dx, dy:hwFloat; despeckle : Boolean); +var + t, tx, ty :Longint; +begin +for t:= 0 to 7 do + begin + X:= X + dX; + Y:= Y + dY; + tx:= hwRound(X); + ty:= hwRound(Y); + if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0) + or ((Land[ty, tx] and lfObject) <> 0)) then + begin + Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and not lfIce; + if despeckle then + LandDirty[ty div 32, tx div 32]:= 1; + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[ty, tx]:= ExplosionBorderColor + else + LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor + end + end; +end; + + // // - (dX, dY) - direction, vector of length = 0.5 // @@ -753,24 +519,7 @@ begin X:= nx - dX8; Y:= ny - dY8; - for t:= 0 to 7 do - begin - X:= X + dX; - Y:= Y + dY; - tx:= hwRound(X); - ty:= hwRound(Y); - if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0) - or ((Land[ty, tx] and lfObject) <> 0)) then - begin - Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and not lfIce; - if despeckle then - LandDirty[ty div 32, tx div 32]:= 1; - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[ty, tx]:= ExplosionBorderColor - else - LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor - end - end; + DrawExplosionBorder(X, Y, dx, dy, despeckle); X:= nx; Y:= ny; for t:= 0 to ticks do @@ -796,24 +545,7 @@ Land[ty, tx]:= 0; end end; - for t:= 0 to 7 do - begin - X:= X + dX; - Y:= Y + dY; - tx:= hwRound(X); - ty:= hwRound(Y); - if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0) - or ((Land[ty, tx] and lfObject) <> 0)) then - begin - Land[ty, tx]:=( Land[ty, tx] or lfDamaged) and not lfIce; - if despeckle then - LandDirty[ty div 32, tx div 32]:= 1; - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[ty, tx]:= ExplosionBorderColor - else - LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor - end - end; + DrawExplosionBorder(X, Y, dx, dy, despeckle); nx:= nx - dY; ny:= ny + dX; end; diff -r 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uLandObjects.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uStore.pas --- a/hedgewars/uStore.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uStore.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uTypes.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e hedgewars/uUtils.pas --- a/hedgewars/uUtils.pas Thu Apr 04 14:01:54 2013 +0400 +++ b/hedgewars/uUtils.pas Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e project_files/HedgewarsMobile/Classes/CreationChamber.m --- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Thu Apr 04 14:01:54 2013 +0400 +++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Thu Apr 04 18:47:09 2013 +0200 @@ -18,7 +18,7 @@ #import "CreationChamber.h" - +#import "weapons.h" @implementation CreationChamber diff -r 6e3308fc2a1d -r 0bdeea9d388e project_files/HedgewarsMobile/Classes/HWUtils.m --- a/project_files/HedgewarsMobile/Classes/HWUtils.m Thu Apr 04 14:01:54 2013 +0400 +++ b/project_files/HedgewarsMobile/Classes/HWUtils.m Thu Apr 04 18:47:09 2013 +0200 @@ -22,7 +22,7 @@ #import #import #import - +#import "hwconsts.h" static NSString *cachedModel = nil; static NSArray *cachedColors = nil; diff -r 6e3308fc2a1d -r 0bdeea9d388e project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m --- a/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m Thu Apr 04 14:01:54 2013 +0400 +++ b/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m Thu Apr 04 18:47:09 2013 +0200 @@ -18,7 +18,7 @@ #import "ServerProtocolNetwork.h" - +#import "hwconsts.h" #define BUFFER_SIZE 256 diff -r 6e3308fc2a1d -r 0bdeea9d388e project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu Apr 04 14:01:54 2013 +0400 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e project_files/HedgewarsMobile/Hedgewars_Prefix.pch --- a/project_files/HedgewarsMobile/Hedgewars_Prefix.pch Thu Apr 04 14:01:54 2013 +0400 +++ b/project_files/HedgewarsMobile/Hedgewars_Prefix.pch Thu Apr 04 18:47:09 2013 +0200 @@ -30,6 +30,5 @@ #import "EditableCellView.h" #import "CreationChamber.h" #import "HWUtils.h" -#import "hwconsts.h" #endif diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_ar.ts --- a/share/hedgewars/Data/Locale/hedgewars_ar.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_ar.ts Thu Apr 04 18:47:09 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 @@ -178,6 +194,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Cannot create directory %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -538,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 @@ -2004,35 +2046,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 @@ -2179,10 +2198,6 @@ - Hedgewars - - - Not all players are ready @@ -2424,6 +2439,18 @@ + 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! @@ -3032,4 +3059,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_bg.ts --- a/share/hedgewars/Data/Locale/hedgewars_bg.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_bg.ts Thu Apr 04 18:47:09 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,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Не може да се създаде папка %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -537,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 @@ -2019,35 +2061,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 @@ -2195,10 +2214,6 @@ - Hedgewars - - - Not all players are ready @@ -2440,6 +2455,18 @@ + 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! @@ -3048,4 +3075,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_cs.ts --- a/share/hedgewars/Data/Locale/hedgewars_cs.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_cs.ts Thu Apr 04 18:47:09 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,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Nemohu vytvořit adresář %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -543,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 @@ -2033,35 +2075,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 @@ -2210,10 +2229,6 @@ - Hedgewars - - - Not all players are ready @@ -2455,6 +2470,18 @@ + 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! @@ -3063,4 +3090,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_da.ts --- a/share/hedgewars/Data/Locale/hedgewars_da.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_da.ts Thu Apr 04 18:47:09 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 @@ -181,6 +197,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Kan ikke oprette mappe %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -541,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 @@ -2013,35 +2055,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: @@ -2203,10 +2222,6 @@ - Hedgewars - - - Not all players are ready @@ -2448,6 +2463,18 @@ + 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! @@ -3056,4 +3083,119 @@ DPad + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_de.ts --- a/share/hedgewars/Data/Locale/hedgewars_de.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_de.ts Thu Apr 04 18:47:09 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 @@ -181,6 +197,20 @@ 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 @@ -541,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 @@ -2032,37 +2077,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 @@ -2210,10 +2255,6 @@ - Hedgewars - - - Not all players are ready @@ -2455,6 +2496,18 @@ + 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! @@ -3063,4 +3116,119 @@ Steuerkreuz + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_el.ts --- a/share/hedgewars/Data/Locale/hedgewars_el.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_el.ts Thu Apr 04 18:47:09 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,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Δεν μπορεί να δημιουργηθεί ο κατάλογος %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -539,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 @@ -2007,35 +2049,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: @@ -2197,10 +2216,6 @@ - Hedgewars - - - Not all players are ready @@ -2442,6 +2457,18 @@ + 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! @@ -3050,4 +3077,119 @@ DPad + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_en.ts --- a/share/hedgewars/Data/Locale/hedgewars_en.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_en.ts Thu Apr 04 18:47:09 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,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Cannot create directory %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -537,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 @@ -2003,35 +2045,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 @@ -2179,10 +2198,6 @@ - Hedgewars - - - Not all players are ready @@ -2424,6 +2439,18 @@ + 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! @@ -3032,4 +3059,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_es.ts --- a/share/hedgewars/Data/Locale/hedgewars_es.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_es.ts Thu Apr 04 18:47:09 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 @@ -181,6 +197,17 @@ 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 @@ -541,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 @@ -2023,35 +2065,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 @@ -2199,10 +2218,6 @@ - Hedgewars - - - Not all players are ready @@ -2444,6 +2459,18 @@ + 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! @@ -3052,4 +3079,119 @@ DPad + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_fi.ts --- a/share/hedgewars/Data/Locale/hedgewars_fi.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_fi.ts Thu Apr 04 18:47:09 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,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Hakemiston %1 luonti epäonnistui + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -537,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 @@ -2019,35 +2061,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 @@ -2195,10 +2214,6 @@ - Hedgewars - - - Not all players are ready @@ -2440,6 +2455,18 @@ + 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! @@ -3048,4 +3075,119 @@ Hiiri: Vasen nappi + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_fr.ts --- a/share/hedgewars/Data/Locale/hedgewars_fr.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_fr.ts Thu Apr 04 18:47:09 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,17 @@ 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 @@ -537,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 @@ -2019,35 +2061,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 @@ -2194,10 +2213,6 @@ - Hedgewars - - - Not all players are ready @@ -2439,6 +2454,18 @@ + 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! @@ -3048,4 +3075,119 @@ Effacer + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_gl.ts --- a/share/hedgewars/Data/Locale/hedgewars_gl.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_gl.ts Thu Apr 04 18:47:09 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,17 @@ 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 @@ -537,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 @@ -1993,35 +2035,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: @@ -2182,10 +2201,6 @@ - Hedgewars - - - Not all players are ready @@ -2427,6 +2442,18 @@ + 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! @@ -3035,4 +3062,119 @@ Mando + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_hu.ts --- a/share/hedgewars/Data/Locale/hedgewars_hu.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_hu.ts Thu Apr 04 18:47:09 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 @@ -171,6 +187,17 @@ 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 @@ -531,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 @@ -1993,35 +2035,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 @@ -2167,10 +2186,6 @@ - Hedgewars - - - Not all players are ready @@ -2412,6 +2427,18 @@ + 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! @@ -3020,4 +3047,119 @@ DPad + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_it.ts --- a/share/hedgewars/Data/Locale/hedgewars_it.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_it.ts Thu Apr 04 18:47:09 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 @@ -181,6 +197,20 @@ 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 @@ -551,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 @@ -2042,37 +2087,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 @@ -2221,7 +2266,7 @@ Hedgewars - Hedgewars + Hedgewars Not all players are ready @@ -2466,6 +2511,18 @@ + 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! @@ -3078,111 +3135,115 @@ server Not room master - Non proprietario della stanza + Non proprietario della stanza Corrupted hedgehogs info - Informazioni ricci corrotte + Informazioni ricci corrotte too many teams - troppe squadre + troppe squadre too many hedgehogs - troppi ricci + troppi ricci There's already a team with same name in the list - C'è già una quadra collo stesso nome in lista + C'è già una quadra collo stesso nome in lista round in progress - turno in corso + turno in corso restricted - proibito + proibito REMOVE_TEAM: no such team - CANCELLA_SQUADRA: squadra non presente + CANCELLA_SQUADRA: squadra non presente Not team owner! - Non proprietario della squadra! + Non proprietario della squadra! Less than two clans! - Meno di due clan! + Meno di due clan! Room with such name already exists - Esiste già una stanza con questo nome + Esiste già una stanza con questo nome Nickname already chosen - Nome già scelto + Nome già scelto Illegal nickname - Nome non valido + Nome non valido Protocol already known - Protocollo già conosciuto + Protocollo già conosciuto Bad number - Numero non valido + Numero non valido Nickname is already in use - Nome già in uso + Nome già in uso Authentication failed - Autenticazione fallita + Autenticazione fallita 60 seconds cooldown after kick - 60 secondi di raffreddamento prima dell'espulsione + 60 secondi di raffreddamento prima dell'espulsione kicked - espulso + espulso Ping timeout - Scadenza ping + Scadenza ping bye - ciao + ciao Illegal room name - Nome stanza non valido + Nome stanza non valido No such room - Stanza non esistente + Stanza non esistente Joining restricted - Ingresso riservato + Ingresso riservato Registered users only - Solo utenti registrati + Solo utenti registrati You are banned in this room - Sei stato espulso dalla stanza + Sei stato espulso dalla stanza Empty config entry - Configurazione vuota + Configurazione vuota + + + No checker rights + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_ja.ts --- a/share/hedgewars/Data/Locale/hedgewars_ja.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_ja.ts Thu Apr 04 18:47:09 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 @@ -171,6 +187,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + フォルダー%1作成拒否 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -531,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 @@ -1989,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 @@ -2163,10 +2182,6 @@ - Hedgewars - - - Not all players are ready @@ -2408,6 +2423,18 @@ + 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! @@ -3016,4 +3043,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_ko.ts --- a/share/hedgewars/Data/Locale/hedgewars_ko.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_ko.ts Thu Apr 04 18:47:09 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 @@ -171,6 +187,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -531,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 @@ -1965,37 +2007,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 +2150,6 @@ - Hedgewars - - - Not all players are ready @@ -2384,6 +2391,18 @@ + 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! @@ -2992,4 +3011,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_lt.ts --- a/share/hedgewars/Data/Locale/hedgewars_lt.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_lt.ts Thu Apr 04 18:47:09 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 @@ -218,10 +238,23 @@ - + Scheme '%1' not supported + + + Cannot create directory %1 + + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -234,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 @@ -671,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 @@ -1757,23 +1808,23 @@ - + Ignore - + Add friend - + Unignore - + Remove friend @@ -1873,7 +1924,7 @@ - + Save password @@ -2301,27 +2352,27 @@ - + Your Email - + Summary - + Send system information - + Description - + Type the security code: @@ -2433,34 +2484,35 @@ - + + Hedgewars - Error - + System Information Preview - - + + Failed to generate captcha - + Failed to download captcha - + Please fill out all fields. Email is optional. - + Hedgewars - Success @@ -2508,46 +2560,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 @@ -2694,20 +2706,15 @@ - + Hedgewars - Warning - + Hedgewars - Information - - - Hedgewars - - QPushButton @@ -3004,6 +3011,20 @@ + TCPBase + + + Unable to start server at %1. + + + + + Unable to run engine at %1 +Error code: %2 + + + + TeamSelWidget @@ -3765,4 +3786,147 @@ + + server + + + No checker rights + + + + + Authentication failed + + + + + 60 seconds cooldown after kick + + + + + kicked + + + + + Ping timeout + + + + + bye + + + + + Empty config entry + + + + + Not room master + + + + + Corrupted hedgehogs info + + + + + too many teams + + + + + too many hedgehogs + + + + + There's already a team with same name in the list + + + + + round in progress + + + + + restricted + + + + + REMOVE_TEAM: no such team + + + + + Not team owner! + + + + + Less than two clans! + + + + + Room with such name already exists + + + + + Illegal room name + + + + + No such room + + + + + Joining restricted + + + + + Registered users only + + + + + You are banned in this room + + + + + Nickname already chosen + + + + + Illegal nickname + + + + + Protocol already known + + + + + Bad number + + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_ms.ts --- a/share/hedgewars/Data/Locale/hedgewars_ms.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_ms.ts Thu Apr 04 18:47:09 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 @@ -206,10 +226,23 @@ - + Scheme '%1' not supported + + + Cannot create directory %1 + + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -222,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 @@ -659,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 @@ -1744,23 +1795,23 @@ - + Ignore - + Add friend - + Unignore - + Remove friend @@ -1778,7 +1829,7 @@ QCheckBox - + Save password @@ -2098,27 +2149,27 @@ - + Your Email - + Summary - + Send system information - + Description - + Type the security code: @@ -2405,34 +2456,35 @@ - + + Hedgewars - Error - + System Information Preview - - + + Failed to generate captcha - + Failed to download captcha - + Please fill out all fields. Email is optional. - + Hedgewars - Success @@ -2447,46 +2499,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 - - - Error while authenticating at google.com: @@ -2664,20 +2676,15 @@ - + Hedgewars - Warning - + Hedgewars - Information - - - Hedgewars - - QPushButton @@ -2974,6 +2981,20 @@ + TCPBase + + + Unable to start server at %1. + + + + + Unable to run engine at %1 +Error code: %2 + + + + TeamSelWidget @@ -3735,4 +3756,147 @@ + + server + + + No checker rights + + + + + Authentication failed + + + + + 60 seconds cooldown after kick + + + + + kicked + + + + + Ping timeout + + + + + bye + + + + + Empty config entry + + + + + Not room master + + + + + Corrupted hedgehogs info + + + + + too many teams + + + + + too many hedgehogs + + + + + There's already a team with same name in the list + + + + + round in progress + + + + + restricted + + + + + REMOVE_TEAM: no such team + + + + + Not team owner! + + + + + Less than two clans! + + + + + Room with such name already exists + + + + + Illegal room name + + + + + No such room + + + + + Joining restricted + + + + + Registered users only + + + + + You are banned in this room + + + + + Nickname already chosen + + + + + Illegal nickname + + + + + Protocol already known + + + + + Bad number + + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_nl.ts --- a/share/hedgewars/Data/Locale/hedgewars_nl.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_nl.ts Thu Apr 04 18:47:09 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,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -537,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 @@ -1979,37 +2021,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 @@ -2154,10 +2165,6 @@ - Hedgewars - - - Not all players are ready @@ -2399,6 +2406,18 @@ + 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! @@ -3007,4 +3026,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_pl.ts --- a/share/hedgewars/Data/Locale/hedgewars_pl.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_pl.ts Thu Apr 04 18:47:09 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 @@ -187,6 +203,20 @@ 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 @@ -548,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 @@ -2045,37 +2090,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 @@ -2224,10 +2269,6 @@ - Hedgewars - - - Not all players are ready @@ -2469,6 +2510,18 @@ + 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! @@ -3077,4 +3130,119 @@ DPad + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_pt_BR.ts --- a/share/hedgewars/Data/Locale/hedgewars_pt_BR.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_pt_BR.ts Thu Apr 04 18:47:09 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,17 @@ 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 @@ -538,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 @@ -2020,35 +2062,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 @@ -2196,10 +2215,6 @@ - Hedgewars - - - Not all players are ready @@ -2442,6 +2457,18 @@ + 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! @@ -3055,4 +3082,119 @@ DPad + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_pt_PT.ts --- a/share/hedgewars/Data/Locale/hedgewars_pt_PT.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_pt_PT.ts Thu Apr 04 18:47:09 2013 +0200 @@ -98,6 +98,22 @@ Send Feedback Enviar 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 @@ -181,6 +197,20 @@ 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 @@ -551,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 @@ -2001,37 +2046,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 possível lançar o motor de jogo em + Não foi possível lançar o motor de jogo em Error code: %1 - Código de erro: %1 + Código de erro: %1 Video upload - Error @@ -2180,7 +2225,7 @@ Hedgewars - Hedgewars + Hedgewars Not all players are ready @@ -2425,6 +2470,18 @@ + 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! @@ -3037,115 +3094,115 @@ server Not room master - Não és o anfitrião da sala + Não és o anfitrião da sala Corrupted hedgehogs info - Informação dos ouriços corrompida + Informação dos ouriços corrompida too many teams - demasiadas equipas + demasiadas equipas too many hedgehogs - demasiados ouriços + demasiados ouriços There's already a team with same name in the list - Já existe uma equipa com o mesmo nome na lista + Já existe uma equipa com o mesmo nome na lista round in progress - partida em progresso + partida em progresso restricted - limitada + limitada REMOVE_TEAM: no such team - REMOVE_TEAM: equipa inexistente + REMOVE_TEAM: equipa inexistente Not team owner! - A equipa não te pertence! + A equipa não te pertence! Less than two clans! - Menos de 2 clãs! + Menos de 2 clãs! Room with such name already exists - Já existe uma sala com esse nome + Já existe uma sala com esse nome Nickname already chosen - Utilizador já em uso + Utilizador já em uso Illegal nickname - Nome de utilizador ilegal + Nome de utilizador ilegal Protocol already known - Protocolo já conhecido + Protocolo já conhecido Bad number - Número inválido + Número inválido Nickname is already in use - Nome de utilizador já em uso + Nome de utilizador já em uso No checker rights - Não possui permissões para verificar + Não possui permissões para verificar Authentication failed - A autenticação falhou + A autenticação falhou 60 seconds cooldown after kick - É necessário aguardar 60 segundos após uma expulsão + É necessário aguardar 60 segundos após uma expulsão kicked - expulso + expulso Ping timeout - Ping timeout + Ping timeout bye - tchau (bye) + tchau (bye) Illegal room name - Nome da sala ilegal + Nome da sala ilegal No such room - Sala inexistente + Sala inexistente Joining restricted - Entrada restrita + Entrada restrita Registered users only - Apenas utilizadores registados + Apenas utilizadores registados You are banned in this room - Estás banido desta sala + Estás banido desta sala Empty config entry - Campo vazio na configuração + Campo vazio na configuração diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_ro.ts --- a/share/hedgewars/Data/Locale/hedgewars_ro.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_ro.ts Thu Apr 04 18:47:09 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,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Cannot create directory %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -543,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 @@ -2003,35 +2045,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: @@ -2194,10 +2213,6 @@ - Hedgewars - - - Not all players are ready @@ -2439,6 +2454,18 @@ + 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! @@ -3047,4 +3074,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_ru.ts --- a/share/hedgewars/Data/Locale/hedgewars_ru.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_ru.ts Thu Apr 04 18:47:09 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 @@ -187,6 +203,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Не могу создать папку %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -548,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 @@ -2044,35 +2086,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 @@ -2221,10 +2240,6 @@ - Hedgewars - - - Not all players are ready @@ -2466,6 +2481,18 @@ + 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! @@ -3074,4 +3101,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_sk.ts --- a/share/hedgewars/Data/Locale/hedgewars_sk.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_sk.ts Thu Apr 04 18:47:09 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 @@ -187,6 +203,20 @@ 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 @@ -547,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 @@ -2042,37 +2087,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 @@ -2221,10 +2266,6 @@ - Hedgewars - - - Not all players are ready @@ -2466,6 +2507,18 @@ + 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! @@ -3074,4 +3127,119 @@ Pravý joystick (Doľava) + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_sv.ts --- a/share/hedgewars/Data/Locale/hedgewars_sv.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_sv.ts Thu Apr 04 18:47:09 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 @@ -181,6 +197,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Kan inte skapa katalog %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -541,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 @@ -2023,35 +2065,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 @@ -2199,10 +2218,6 @@ - Hedgewars - - - Not all players are ready @@ -2444,6 +2459,18 @@ + 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! @@ -3052,4 +3079,119 @@ Styrkors + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_tr_TR.ts --- a/share/hedgewars/Data/Locale/hedgewars_tr_TR.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_tr_TR.ts Thu Apr 04 18:47:09 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 @@ -171,6 +187,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + %1 dizini oluşturulamadı + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -531,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 @@ -1985,35 +2027,12 @@ - Main - Error - - - Cannot create directory %1 - %1 dizini oluşturulamadı - - - Failed to open data directory: -%1 - -Please check your installation! - - - - TCP - Error - + %1 dizini oluşturulamadı Unable to start the server: %1. - Sunucu başlatılamadı: %1. - - - Unable to run engine at - - - - Error code: %1 - + Sunucu başlatılamadı: %1. Video upload - Error @@ -2159,10 +2178,6 @@ - Hedgewars - - - Not all players are ready @@ -2404,6 +2419,18 @@ + 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! @@ -3012,4 +3039,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_uk.ts --- a/share/hedgewars/Data/Locale/hedgewars_uk.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_uk.ts Thu Apr 04 18:47:09 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 @@ -187,6 +203,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + Не можу створити директорію %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -547,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 @@ -2037,35 +2079,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 @@ -2214,10 +2233,6 @@ - Hedgewars - - - Not all players are ready @@ -2459,6 +2474,18 @@ + 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! @@ -3067,4 +3094,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_zh_CN.ts --- a/share/hedgewars/Data/Locale/hedgewars_zh_CN.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_zh_CN.ts Thu Apr 04 18:47:09 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 @@ -206,10 +226,23 @@ - + Scheme '%1' not supported + + + Cannot create directory %1 + + + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -222,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 @@ -659,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 @@ -1760,23 +1811,23 @@ - + Ignore - + Add friend - + Unignore - + Remove friend @@ -1861,7 +1912,7 @@ 记录名称中包含具体时间日期 - + Save password @@ -2273,27 +2324,27 @@ - + Your Email - + Summary - + Send system information - + Description - + Type the security code: @@ -2435,34 +2486,35 @@ - + + Hedgewars - Error - + System Information Preview - - + + Failed to generate captcha - + Failed to download captcha - + Please fill out all fields. Email is optional. - + Hedgewars - Success @@ -2500,46 +2552,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 @@ -2684,20 +2696,15 @@ - + Hedgewars - Warning - + Hedgewars - Information - - - Hedgewars - - QPushButton @@ -2994,6 +3001,20 @@ + TCPBase + + + Unable to start server at %1. + + + + + Unable to run engine at %1 +Error code: %2 + + + + TeamSelWidget @@ -3755,4 +3776,147 @@ + + server + + + No checker rights + + + + + Authentication failed + + + + + 60 seconds cooldown after kick + + + + + kicked + + + + + Ping timeout + + + + + bye + + + + + Empty config entry + + + + + Not room master + + + + + Corrupted hedgehogs info + + + + + too many teams + + + + + too many hedgehogs + + + + + There's already a team with same name in the list + + + + + round in progress + + + + + restricted + + + + + REMOVE_TEAM: no such team + + + + + Not team owner! + + + + + Less than two clans! + + + + + Room with such name already exists + + + + + Illegal room name + + + + + No such room + + + + + Joining restricted + + + + + Registered users only + + + + + You are banned in this room + + + + + Nickname already chosen + + + + + Illegal nickname + + + + + Protocol already known + + + + + Bad number + + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Locale/hedgewars_zh_TW.ts --- a/share/hedgewars/Data/Locale/hedgewars_zh_TW.ts Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Locale/hedgewars_zh_TW.ts Thu Apr 04 18:47:09 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 @@ -171,6 +187,17 @@ Scheme '%1' not supported + + Cannot create directory %1 + 無法創建路徑 %1 + + + Failed to open data directory: +%1 + +Please check your installation! + + HWAskQuitDialog @@ -531,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 @@ -1993,35 +2035,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 @@ -2167,10 +2186,6 @@ - Hedgewars - - - Not all players are ready @@ -2412,6 +2427,18 @@ + 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! @@ -3020,4 +3047,119 @@ + + server + + No checker rights + + + + Authentication failed + + + + 60 seconds cooldown after kick + + + + kicked + + + + Ping timeout + + + + bye + + + + Empty config entry + + + + Not room master + + + + Corrupted hedgehogs info + + + + too many teams + + + + too many hedgehogs + + + + There's already a team with same name in the list + + + + round in progress + + + + restricted + + + + REMOVE_TEAM: no such team + + + + Not team owner! + + + + Less than two clans! + + + + Room with such name already exists + + + + Illegal room name + + + + No such room + + + + Joining restricted + + + + Registered users only + + + + You are banned in this room + + + + Nickname already chosen + + + + Illegal nickname + + + + Protocol already known + + + + Bad number + + + + Nickname is already in use + + + diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Scripts/Locale.lua --- a/share/hedgewars/Data/Scripts/Locale.lua Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Scripts/Locale.lua Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/CMakeLists.txt --- a/share/hedgewars/Data/Themes/CMakeLists.txt Thu Apr 04 14:01:54 2013 +0400 +++ b/share/hedgewars/Data/Themes/CMakeLists.txt Thu Apr 04 18:47:09 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 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Cave/Stalactite.png Binary file share/hedgewars/Data/Themes/Cave/Stalactite.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Cave/Stalactite_mask.png Binary file share/hedgewars/Data/Themes/Cave/Stalactite_mask.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Cave/Stalagmite01.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite01.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Cave/Stalagmite01_mask.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite01_mask.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Cave/Stalagmite02.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite02.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Cave/Stalagmite02_mask.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite02_mask.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Cheese/cheese.png Binary file share/hedgewars/Data/Themes/Cheese/cheese.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Cheese/cheese_mask.png Binary file share/hedgewars/Data/Themes/Cheese/cheese_mask.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/Chunk.png Binary file share/hedgewars/Data/Themes/EarthRise/Chunk.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/Rock.png Binary file share/hedgewars/Data/Themes/EarthRise/Rock.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/RockShort.png Binary file share/hedgewars/Data/Themes/EarthRise/RockShort.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/RockShort_mask.png Binary file share/hedgewars/Data/Themes/EarthRise/RockShort_mask.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/Rock_mask.png Binary file share/hedgewars/Data/Themes/EarthRise/Rock_mask.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/horizontL.png Binary file share/hedgewars/Data/Themes/EarthRise/horizontL.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/horizontR.png Binary file share/hedgewars/Data/Themes/EarthRise/horizontR.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/icon.png Binary file share/hedgewars/Data/Themes/EarthRise/icon.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/EarthRise/icon@2x.png Binary file share/hedgewars/Data/Themes/EarthRise/icon@2x.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Banana1.png Binary file share/hedgewars/Data/Themes/Fruit/Banana1.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Banana2.png Binary file share/hedgewars/Data/Themes/Fruit/Banana2.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/BlueWater.png Binary file share/hedgewars/Data/Themes/Fruit/BlueWater.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Border.png Binary file share/hedgewars/Data/Themes/Fruit/Border.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e 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 Thu Apr 04 18:47:09 2013 +0200 @@ -0,0 +1,6 @@ +file(GLOB images *.png) + +install(FILES + theme.cfg + ${images} + DESTINATION ${SHAREPATH}Data/Themes/Fruit) diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Chunk.png Binary file share/hedgewars/Data/Themes/Fruit/Chunk.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Clouds.png Binary file share/hedgewars/Data/Themes/Fruit/Clouds.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Droplet.png Binary file share/hedgewars/Data/Themes/Fruit/Droplet.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Flake.png Binary file share/hedgewars/Data/Themes/Fruit/Flake.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Girder.png Binary file share/hedgewars/Data/Themes/Fruit/Girder.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/LandBackTex.png Binary file share/hedgewars/Data/Themes/Fruit/LandBackTex.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/LandTex.png Binary file share/hedgewars/Data/Themes/Fruit/LandTex.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Orange1.png Binary file share/hedgewars/Data/Themes/Fruit/Orange1.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Orange2.png Binary file share/hedgewars/Data/Themes/Fruit/Orange2.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Sky.png Binary file share/hedgewars/Data/Themes/Fruit/Sky.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/SkyL.png Binary file share/hedgewars/Data/Themes/Fruit/SkyL.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Snowball.png Binary file share/hedgewars/Data/Themes/Fruit/Snowball.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Splash.png Binary file share/hedgewars/Data/Themes/Fruit/Splash.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Watermelon.png Binary file share/hedgewars/Data/Themes/Fruit/Watermelon.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/Watermelon_mask.png Binary file share/hedgewars/Data/Themes/Fruit/Watermelon_mask.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/amSnowball.png Binary file share/hedgewars/Data/Themes/Fruit/amSnowball.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/horizont.png Binary file share/hedgewars/Data/Themes/Fruit/horizont.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/icon.png Binary file share/hedgewars/Data/Themes/Fruit/icon.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e share/hedgewars/Data/Themes/Fruit/icon@2x.png Binary file share/hedgewars/Data/Themes/Fruit/icon@2x.png has changed diff -r 6e3308fc2a1d -r 0bdeea9d388e 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 Thu Apr 04 18:47:09 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 = 255 +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 6e3308fc2a1d -r 0bdeea9d388e tools/PascalBasics.hs --- a/tools/PascalBasics.hs Thu Apr 04 14:01:54 2013 +0400 +++ /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 6e3308fc2a1d -r 0bdeea9d388e tools/PascalParser.hs --- a/tools/PascalParser.hs Thu Apr 04 14:01:54 2013 +0400 +++ /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 6e3308fc2a1d -r 0bdeea9d388e tools/PascalPreprocessor.hs --- a/tools/PascalPreprocessor.hs Thu Apr 04 14:01:54 2013 +0400 +++ /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 6e3308fc2a1d -r 0bdeea9d388e tools/PascalUnitSyntaxTree.hs --- a/tools/PascalUnitSyntaxTree.hs Thu Apr 04 14:01:54 2013 +0400 +++ /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 6e3308fc2a1d -r 0bdeea9d388e tools/pas2c.hs --- a/tools/pas2c.hs Thu Apr 04 14:01:54 2013 +0400 +++ /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 6e3308fc2a1d -r 0bdeea9d388e tools/unitCycles.hs --- a/tools/unitCycles.hs Thu Apr 04 14:01:54 2013 +0400 +++ /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