# HG changeset patch
# User sheepluva
# Date 1461524892 -7200
# Node ID 989b2d54bed344eee3e63666ee608a911f9b5e66
# Parent bf7899e6359a7ae8acf346e1460bfeebbb5f0c77# Parent 68eddcdc9f26a8c941fa38b16fc1c16449174a68
merge Wuzzy's space campaign string fixes
diff -r 68eddcdc9f26 -r 989b2d54bed3 .travis.yml
--- a/.travis.yml Wed Apr 13 14:59:14 2016 +0200
+++ b/.travis.yml Sun Apr 24 21:08:12 2016 +0200
@@ -44,7 +44,7 @@
sudo apt-get install debhelper cmake dpkg-dev libqt4-dev qt4-qmake libphysfs-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev libsdl2-net-dev bzip2 ghc libghc-mtl-dev libghc-parsec3-dev libghc-bytestring-show-dev libghc-vector-dev libghc-zlib-dev libghc-random-dev libghc-stm-dev libghc-network-dev libghc-dataenc-dev libghc-hslogger-dev libghc-utf8-string-dev libghc-sha-dev libghc-entropy-dev liblua5.1-0-dev imagemagick fpc fp-compiler fp-units-misc libpng-dev fp-units-gfx libavcodec-dev libavformat-dev libglew1.6-dev
elif [ "$TRAVIS_OS_NAME" == "osx" ]; then
brew install fpc glew qt physfs lua51 sdl2 sdl2_image sdl2_net sdl2_ttf ffmpeg ghc cabal-install
- brew install sdl2_mixer --with-vorbis
+ brew install sdl2_mixer --with-libvorbis
# use cabal install haskell deps, pas2c ones are covered by server
if [[ "$BUILD_ARGS" != *"NOSERVER"* ]]; then
cabal update
diff -r 68eddcdc9f26 -r 989b2d54bed3 CMakeLists.txt
--- a/CMakeLists.txt Wed Apr 13 14:59:14 2016 +0200
+++ b/CMakeLists.txt Sun Apr 24 21:08:12 2016 +0200
@@ -41,6 +41,7 @@
option(SKIPBUNDLE "Do not create relocate bundle (off)" OFF)
option(BUILD_ENGINE_C "Compile hwengine as native C (off)" OFF)
+option(BUILD_ENGINE_JS "Compile hwengine as javascript (off)" OFF)
option(GL2 "Enable OpenGL 2 rendering !!!EXPERIMENTAL - DO NOT USE!!! [default: off)" OFF)
set(GHFLAGS "" CACHE STRING "Additional Haskell flags")
@@ -50,6 +51,22 @@
option(NOVERSIONINFOUPDATE "Disable update of version_info.txt. To be used if source is in a git/repo that is NOT the hedgewars repo" OFF)
+
+if(BUILD_ENGINE_JS)
+ if(NOT CMAKE_TOOLCHAIN_FILE)
+ message(FATAL_ERROR "Missing emscripten toolchain file\nRerun cmake with -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake_modules/Platform/Emscripten.cmake")
+ endif()
+
+ set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+ set(NOAUTOUPDATE ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+ set(PHYSFS_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+ set(LUA_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+ set(NOVIDEOREC ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+ set(NOSERVER ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+ set(GL2 ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+ set(BUILD_SHARED_LIBS OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+endif()
+
#system paths for finding required fonts (see share/hedgewars/Data/fonts)
#subdirectories will NOT be searched.
#all fonts that can't be found will be bundled with hedgewars
@@ -90,7 +107,10 @@
#perform safe check that enable/disable compilation features
-include(${CMAKE_MODULE_PATH}/compilerchecks.cmake)
+#skip when crosscompiling to javascript
+if(NOT BUILD_ENGINE_JS)
+ include(${CMAKE_MODULE_PATH}/compilerchecks.cmake)
+endif()
#set default compiler flags
add_flag_append(CMAKE_C_FLAGS "-Wall -pipe")
@@ -135,7 +155,7 @@
#build engine without freepascal
-if(BUILD_ENGINE_C)
+if(BUILD_ENGINE_C AND NOT BUILD_ENGINE_JS)
find_package(Clang REQUIRED)
if(${CLANG_VERSION} VERSION_LESS "3.0")
@@ -232,9 +252,13 @@
if(ANDROID)
add_subdirectory(project_files/Android-build)
else(ANDROID)
+ #skip frontend for javascript
+ if(NOT BUILD_ENGINE_JS)
+ add_subdirectory(QTfrontend)
+ add_subdirectory(share)
+ endif()
+
add_subdirectory(bin)
- add_subdirectory(QTfrontend)
- add_subdirectory(share)
add_subdirectory(tools)
endif(ANDROID)
diff -r 68eddcdc9f26 -r 989b2d54bed3 QTfrontend/ui/page/pagecampaign.cpp
--- a/QTfrontend/ui/page/pagecampaign.cpp Wed Apr 13 14:59:14 2016 +0200
+++ b/QTfrontend/ui/page/pagecampaign.cpp Sun Apr 24 21:08:12 2016 +0200
@@ -55,6 +55,9 @@
CBTeam = new QComboBox(this);
CBMission = new QComboBox(this);
CBCampaign = new QComboBox(this);
+ CBTeam->setMaxVisibleItems(30);
+ CBMission->setMaxVisibleItems(30);
+ CBCampaign->setMaxVisibleItems(30);
infoLayout->addWidget(btnPreview,0,1,2,1);
infoLayout->addWidget(lbltitle,0,2,1,2);
diff -r 68eddcdc9f26 -r 989b2d54bed3 QTfrontend/ui/page/pageeditteam.cpp
--- a/QTfrontend/ui/page/pageeditteam.cpp Wed Apr 13 14:59:14 2016 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp Sun Apr 24 21:08:12 2016 +0200
@@ -129,16 +129,19 @@
CBGrave = new QComboBox(GBoxTeam);
CBGrave->setMaxCount(65535);
+ CBGrave->setMaxVisibleItems(20);
CBGrave->setIconSize(QSize(32, 32));
GBTLayout->addWidget(CBGrave, 2, 1);
CBFlag = new QComboBox(GBoxTeam);
CBFlag->setMaxCount(65535);
+ CBFlag->setMaxVisibleItems(50);
CBFlag->setIconSize(QSize(22, 15));
GBTLayout->addWidget(CBFlag, 3, 1);
QHBoxLayout * hbox = new QHBoxLayout();
CBVoicepack = new QComboBox(GBoxTeam);
+ CBVoicepack->setMaxVisibleItems(50);
hbox->addWidget(CBVoicepack, 100);
btnTestSound = addSoundlessButton(":/res/PlaySound.png", hbox, 1, true);
diff -r 68eddcdc9f26 -r 989b2d54bed3 QTfrontend/ui/page/pageoptions.cpp
--- a/QTfrontend/ui/page/pageoptions.cpp Wed Apr 13 14:59:14 2016 +0200
+++ b/QTfrontend/ui/page/pageoptions.cpp Sun Apr 24 21:08:12 2016 +0200
@@ -132,6 +132,7 @@
groupTeams->layout()->setColumnStretch(0, 1);
CBTeamName = new QComboBox(groupTeams);
+ CBTeamName->setMaxVisibleItems(50);
groupTeams->layout()->addWidget(CBTeamName, 0, 0);
BtnNewTeam = new QPushButton(groupTeams);
@@ -172,6 +173,7 @@
groupSchemes->layout()->setColumnStretch(0, 1);
SchemesName = new QComboBox(groupSchemes);
+ SchemesName->setMaxVisibleItems(50);
groupSchemes->layout()->addWidget(SchemesName, 0, 0);
SchemeNew = new QPushButton(groupSchemes);
@@ -203,6 +205,7 @@
groupWeapons->layout()->setColumnStretch(0, 1);
WeaponsName = new QComboBox(groupWeapons);
+ WeaponsName->setMaxVisibleItems(50);
groupWeapons->layout()->addWidget(WeaponsName, 0, 0);
WeaponNew = new QPushButton(groupWeapons);
@@ -256,6 +259,7 @@
groupGame->layout()->addWidget(lblFullScreenRes, 1, 0);
CBResolution = new QComboBox(groupGame);
+ CBResolution->setMaxVisibleItems(50);
CBResolution->setFixedWidth(200);
groupGame->layout()->addWidget(CBResolution, 1, 1, Qt::AlignLeft);
@@ -310,6 +314,7 @@
groupGame->layout()->addWidget(lblStereo, 4, 0);
CBStereoMode = new QComboBox(groupGame);
+ CBStereoMode->setMaxVisibleItems(50);
CBStereoMode->addItem(QComboBox::tr("Disabled"));
CBStereoMode->addItem(QComboBox::tr("Red/Cyan"));
CBStereoMode->addItem(QComboBox::tr("Cyan/Red"));
@@ -618,6 +623,7 @@
groupMisc->layout()->addWidget(labelLanguage, 0, 0);
CBLanguage = new QComboBox(groupMisc);
+ CBLanguage->setMaxVisibleItems(50);
groupMisc->layout()->addWidget(CBLanguage, 0, 1);
QStringList locs = DataManager::instance().entryList("Locale", QDir::Files, QStringList("hedgewars_*.qm"));
CBLanguage->addItem(QComboBox::tr("(System default)"), QString());
@@ -696,6 +702,7 @@
// list of supported formats
comboAVFormats = new QComboBox(groupVideoRec);
+ comboAVFormats->setMaxVisibleItems(50);
groupVideoRec->layout()->addWidget(comboAVFormats, 0, 1, 1, 4);
LibavInteraction::instance().fillFormats(comboAVFormats);
@@ -716,6 +723,7 @@
// list of supported audio codecs
comboAudioCodecs = new QComboBox(groupVideoRec);
+ comboAudioCodecs->setMaxVisibleItems(50);
groupVideoRec->layout()->addWidget(comboAudioCodecs, 2, 1, 1, 3);
// checkbox 'record audio'
@@ -741,6 +749,7 @@
// list of supported video codecs
comboVideoCodecs = new QComboBox(groupVideoRec);
+ comboVideoCodecs->setMaxVisibleItems(50);
groupVideoRec->layout()->addWidget(comboVideoCodecs, 4, 1, 1, 4);
// label for resolution
diff -r 68eddcdc9f26 -r 989b2d54bed3 QTfrontend/ui/page/pagescheme.cpp
--- a/QTfrontend/ui/page/pagescheme.cpp Wed Apr 13 14:59:14 2016 +0200
+++ b/QTfrontend/ui/page/pagescheme.cpp Sun Apr 24 21:08:12 2016 +0200
@@ -71,102 +71,101 @@
TBW_mode_Forts->setWhatsThis(tr("Defend your fort and destroy the opponents, two team colours max!"));
glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1);
- TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/btnTeamsDivide@2x.png");
- TBW_teamsDivide->setWhatsThis(tr("Teams will start on opposite sides of the terrain, two team colours max!"));
- glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1);
+ TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders@2x.png");
+ TBW_disablegirders->setWhatsThis(tr("Disable girders when generating random maps."));
+ glGMLayout->addWidget(TBW_disablegirders,0,1,1,1);
- TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid@2x.png");
- TBW_solid->setWhatsThis(tr("Land can not be destroyed!"));
- glGMLayout->addWidget(TBW_solid,0,2,1,1);
+ TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects@2x.png");
+ TBW_disablelandobjects->setWhatsThis(tr("Disable land objects when generating random maps."));
+ glGMLayout->addWidget(TBW_disablelandobjects,0,2,1,1);
TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder@2x.png");
TBW_border->setWhatsThis(tr("Add an indestructible border around the terrain"));
glGMLayout->addWidget(TBW_border,0,3,1,1);
+ TBW_bottomborder = new ToggleButtonWidget(gbGameModes, ":/res/btnBottomBorder@2x.png");
+ TBW_bottomborder->setWhatsThis(tr("Add an indestructible border along the bottom"));
+ glGMLayout->addWidget(TBW_bottomborder,0,4,1,1);
+
+ TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid@2x.png");
+ TBW_solid->setWhatsThis(tr("Land can not be destroyed!"));
+ glGMLayout->addWidget(TBW_solid,1,0,1,1);
+
TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity@2x.png");
TBW_lowGravity->setWhatsThis(tr("Lower gravity"));
- glGMLayout->addWidget(TBW_lowGravity,0,4,1,1);
-
- TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight@2x.png");
- TBW_laserSight->setWhatsThis(tr("Assisted aiming with laser sight"));
- glGMLayout->addWidget(TBW_laserSight,1,0,1,1);
-
- TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable@2x.png");
- TBW_invulnerable->setWhatsThis(tr("All hogs have a personal forcefield"));
- glGMLayout->addWidget(TBW_invulnerable,1,1,1,1);
+ glGMLayout->addWidget(TBW_lowGravity,1,1,1,1);
- TBW_resethealth = new ToggleButtonWidget(gbGameModes, ":/res/btnResetHealth@2x.png");
- TBW_resethealth->setWhatsThis(tr("All (living) hedgehogs are fully restored at the end of turn"));
- glGMLayout->addWidget(TBW_resethealth,1,2,1,1);
+ TBW_nowind = new ToggleButtonWidget(gbGameModes, ":/res/btnNoWind@2x.png");
+ TBW_nowind->setWhatsThis(tr("You will not have to worry about wind anymore."));
+ glGMLayout->addWidget(TBW_nowind,1,2,1,1);
- TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric@2x.png");
- TBW_vampiric->setWhatsThis(tr("Gain 80% of the damage you do back in health"));
- glGMLayout->addWidget(TBW_vampiric,1,3,1,1);
-
- TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma@2x.png");
- TBW_karma->setWhatsThis(tr("Share your opponents pain, share their damage"));
- glGMLayout->addWidget(TBW_karma,1,4,1,1);
+ TBW_morewind = new ToggleButtonWidget(gbGameModes, ":/res/btnMoreWind@2x.png");
+ TBW_morewind->setWhatsThis(tr("Wind will affect almost everything."));
+ glGMLayout->addWidget(TBW_morewind,1,3,1,1);
TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery@2x.png");
TBW_artillery->setWhatsThis(tr("Your hogs are unable to move, put your artillery skills to the test"));
- glGMLayout->addWidget(TBW_artillery,2,0,1,1);
+ glGMLayout->addWidget(TBW_artillery,1,4,1,1);
- TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder@2x.png");
- TBW_randomorder->setWhatsThis(tr("Order of play is random instead of in room order."));
- glGMLayout->addWidget(TBW_randomorder,2,1,1,1);
+ TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric@2x.png");
+ TBW_vampiric->setWhatsThis(tr("Gain 80% of the damage you do back in health"));
+ glGMLayout->addWidget(TBW_vampiric,2,0,1,1);
+
+ TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma@2x.png");
+ TBW_karma->setWhatsThis(tr("Share your opponents pain, share their damage"));
+ glGMLayout->addWidget(TBW_karma,2,1,1,1);
- TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing@2x.png");
- TBW_king->setWhatsThis(tr("Play with a King. If he dies, your side dies."));
- glGMLayout->addWidget(TBW_king,2,2,1,1);
+ TBW_resethealth = new ToggleButtonWidget(gbGameModes, ":/res/btnResetHealth@2x.png");
+ TBW_resethealth->setWhatsThis(tr("All (living) hedgehogs are fully restored at the end of turn"));
+ glGMLayout->addWidget(TBW_resethealth,2,2,1,1);
+
+ TBW_aisurvival = new ToggleButtonWidget(gbGameModes, ":/res/btnAISurvival@2x.png");
+ TBW_aisurvival->setWhatsThis(tr("AI respawns on death."));
+ glGMLayout->addWidget(TBW_aisurvival,2,3,1,1);
- TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog@2x.png");
- TBW_placehog->setWhatsThis(tr("Take turns placing your hedgehogs before the start of play."));
- glGMLayout->addWidget(TBW_placehog,2,3,1,1);
+ TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable@2x.png");
+ TBW_invulnerable->setWhatsThis(tr("All hogs have a personal forcefield"));
+ glGMLayout->addWidget(TBW_invulnerable,2,4,1,1);
+
+ TBW_perhogammo = new ToggleButtonWidget(gbGameModes, ":/res/btnPerHogAmmo@2x.png");
+ TBW_perhogammo->setWhatsThis(tr("Each hedgehog has its own ammo. It does not share with the team."));
+ glGMLayout->addWidget(TBW_perhogammo,3,0,1,1);
TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo@2x.png");
TBW_sharedammo->setWhatsThis(tr("Ammo is shared between all teams that share a colour."));
- glGMLayout->addWidget(TBW_sharedammo,2,4,1,1);
-
- TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders@2x.png");
- TBW_disablegirders->setWhatsThis(tr("Disable girders when generating random maps."));
- glGMLayout->addWidget(TBW_disablegirders,3,0,1,1);
+ glGMLayout->addWidget(TBW_sharedammo,3,1,1,1);
- TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects@2x.png");
- TBW_disablelandobjects->setWhatsThis(tr("Disable land objects when generating random maps."));
- glGMLayout->addWidget(TBW_disablelandobjects,3,1,1,1);
-
- TBW_aisurvival = new ToggleButtonWidget(gbGameModes, ":/res/btnAISurvival@2x.png");
- TBW_aisurvival->setWhatsThis(tr("AI respawns on death."));
- glGMLayout->addWidget(TBW_aisurvival,3,2,1,1);
+ TBW_resetweps = new ToggleButtonWidget(gbGameModes, ":/res/btnResetWeps@2x.png");
+ TBW_resetweps->setWhatsThis(tr("Weapons are reset to starting values each turn."));
+ glGMLayout->addWidget(TBW_resetweps,3,2,1,1);
TBW_infattack = new ToggleButtonWidget(gbGameModes, ":/res/btnInfAttack@2x.png");
TBW_infattack->setWhatsThis(tr("Attacking does not end your turn."));
glGMLayout->addWidget(TBW_infattack,3,3,1,1);
- TBW_resetweps = new ToggleButtonWidget(gbGameModes, ":/res/btnResetWeps@2x.png");
- TBW_resetweps->setWhatsThis(tr("Weapons are reset to starting values each turn."));
- glGMLayout->addWidget(TBW_resetweps,3,4,1,1);
+ TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight@2x.png");
+ TBW_laserSight->setWhatsThis(tr("Assisted aiming with laser sight"));
+ glGMLayout->addWidget(TBW_laserSight,3,4,1,1);
- TBW_perhogammo = new ToggleButtonWidget(gbGameModes, ":/res/btnPerHogAmmo@2x.png");
- TBW_perhogammo->setWhatsThis(tr("Each hedgehog has its own ammo. It does not share with the team."));
- glGMLayout->addWidget(TBW_perhogammo,4,0,1,1);
+ TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder@2x.png");
+ TBW_randomorder->setWhatsThis(tr("Order of play is random instead of in room order."));
+ glGMLayout->addWidget(TBW_randomorder,4,0,1,1);
- TBW_nowind = new ToggleButtonWidget(gbGameModes, ":/res/btnNoWind@2x.png");
- TBW_nowind->setWhatsThis(tr("You will not have to worry about wind anymore."));
- glGMLayout->addWidget(TBW_nowind,4,1,1,1);
+ TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog@2x.png");
+ TBW_placehog->setWhatsThis(tr("Take turns placing your hedgehogs before the start of play."));
+ glGMLayout->addWidget(TBW_placehog,4,1,1,1);
- TBW_morewind = new ToggleButtonWidget(gbGameModes, ":/res/btnMoreWind@2x.png");
- TBW_morewind->setWhatsThis(tr("Wind will affect almost everything."));
- glGMLayout->addWidget(TBW_morewind,4,2,1,1);
+ TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/btnTeamsDivide@2x.png");
+ TBW_teamsDivide->setWhatsThis(tr("Teams will start on opposite sides of the terrain, two team colours max!"));
+ glGMLayout->addWidget(TBW_teamsDivide,4,2,1,1);
TBW_tagteam = new ToggleButtonWidget(gbGameModes, ":/res/btnTagTeam@2x.png");
TBW_tagteam->setWhatsThis(tr("Teams in each clan take successive turns sharing their turn time."));
glGMLayout->addWidget(TBW_tagteam,4,3,1,1);
- TBW_bottomborder = new ToggleButtonWidget(gbGameModes, ":/res/btnBottomBorder@2x.png");
- TBW_bottomborder->setWhatsThis(tr("Add an indestructible border along the bottom"));
- glGMLayout->addWidget(TBW_bottomborder,4,4,1,1);
-
+ TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing@2x.png");
+ TBW_king->setWhatsThis(tr("Play with a King. If he dies, your side dies."));
+ glGMLayout->addWidget(TBW_king,4,4,1,1);
// Right
QLabel * l;
@@ -443,6 +442,7 @@
{
QHBoxLayout * bottomLayout = new QHBoxLayout();
selectScheme = new QComboBox(this);
+ selectScheme->setMaxVisibleItems(50);
bottomLayout->addWidget(selectScheme, 0);
BtnCopy = addButton(tr("Copy"), bottomLayout, 1);
diff -r 68eddcdc9f26 -r 989b2d54bed3 QTfrontend/ui/page/pageselectweapon.cpp
--- a/QTfrontend/ui/page/pageselectweapon.cpp Wed Apr 13 14:59:14 2016 +0200
+++ b/QTfrontend/ui/page/pageselectweapon.cpp Sun Apr 24 21:08:12 2016 +0200
@@ -40,6 +40,7 @@
QGridLayout * bottomLayout = new QGridLayout();
selectWeaponSet = new QComboBox(this);
+ selectWeaponSet->setMaxVisibleItems(50);
bottomLayout->addWidget(selectWeaponSet, 0, 0, 2, 1);
// first row
diff -r 68eddcdc9f26 -r 989b2d54bed3 QTfrontend/ui/widget/feedbackdialog.cpp
--- a/QTfrontend/ui/widget/feedbackdialog.cpp Wed Apr 13 14:59:14 2016 +0200
+++ b/QTfrontend/ui/widget/feedbackdialog.cpp Sun Apr 24 21:08:12 2016 +0200
@@ -61,7 +61,6 @@
setWindowFlags(Qt::Sheet);
setWindowModality(Qt::WindowModal);
setWindowTitle(tr("Feedback"));
- setMinimumSize(700, 460);
resize(700, 460);
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
@@ -71,11 +70,9 @@
/* Top layout */
QVBoxLayout * pageLayout = new QVBoxLayout();
- QHBoxLayout * summaryLayout = new QHBoxLayout();
- QHBoxLayout * emailLayout = new QHBoxLayout();
- QHBoxLayout * descriptionLayout = new QHBoxLayout();
- QHBoxLayout * combinedTopLayout = new QHBoxLayout();
- QHBoxLayout * systemLayout = new QHBoxLayout();
+ QGridLayout * feedbackLayout = new QGridLayout();
+
+ setStyleSheet("QPushButton { padding: 5px }");
info = new QLabel();
info->setText(QString(
@@ -96,65 +93,45 @@
info->setOpenExternalLinks(true);
pageLayout->addWidget(info);
- QVBoxLayout * summaryEmailLayout = new QVBoxLayout();
-
- const int labelWidth = 90;
-
label_email = new QLabel();
label_email->setText(QLabel::tr("Your Email"));
- label_email->setFixedWidth(labelWidth);
- emailLayout->addWidget(label_email);
email = new QLineEdit();
- emailLayout->addWidget(email);
- summaryEmailLayout->addLayout(emailLayout);
+ feedbackLayout->addWidget(label_email, 0, 0);
+ feedbackLayout->addWidget(email, 0, 1);
label_summary = new QLabel();
label_summary->setText(QLabel::tr("Summary"));
- label_summary->setFixedWidth(labelWidth);
- summaryLayout->addWidget(label_summary);
summary = new QLineEdit();
- summaryLayout->addWidget(summary);
- summaryEmailLayout->addLayout(summaryLayout);
-
- combinedTopLayout->addLayout(summaryEmailLayout);
+ feedbackLayout->addWidget(label_summary, 1, 0);
+ feedbackLayout->addWidget(summary, 1, 1);
CheckSendSpecs = new QCheckBox();
CheckSendSpecs->setText(QLabel::tr("Send system information"));
CheckSendSpecs->setChecked(true);
- systemLayout->addWidget(CheckSendSpecs);
BtnViewInfo = new QPushButton(tr("View"));
- systemLayout->addWidget(BtnViewInfo, 1);
- BtnViewInfo->setFixedSize(60, 30);
+ BtnViewInfo->setFixedHeight(40);
+ feedbackLayout->addWidget(CheckSendSpecs, 0, 2, 2, 1);
+ feedbackLayout->addWidget(BtnViewInfo, 0, 3, 2, 1);
connect(BtnViewInfo, SIGNAL(clicked()), this, SLOT(ShowSpecs()));
- combinedTopLayout->addLayout(systemLayout);
- combinedTopLayout->setStretch(0, 1);
- combinedTopLayout->insertSpacing(1, 20);
-
- pageLayout->addLayout(combinedTopLayout);
label_description = new QLabel();
label_description->setText(QLabel::tr("Description"));
- label_description->setFixedWidth(labelWidth);
- descriptionLayout->addWidget(label_description, 0, Qt::AlignTop);
description = new QTextBrowser();
description->setReadOnly(false);
- descriptionLayout->addWidget(description);
- pageLayout->addLayout(descriptionLayout);
+ feedbackLayout->addWidget(label_description, 2, 0);
+ feedbackLayout->addWidget(description, 2, 1, 1, 3);
/* Bottom layout */
- QHBoxLayout * bottomLayout = new QHBoxLayout();
QHBoxLayout * captchaLayout = new QHBoxLayout();
QVBoxLayout * captchaInputLayout = new QVBoxLayout();
QPushButton * BtnCancel = new QPushButton(tr("Cancel"));
- bottomLayout->addWidget(BtnCancel, 0);
- BtnCancel->setFixedSize(100, 40);
+ feedbackLayout->addWidget(BtnCancel, 3, 0);
+ BtnCancel->setFixedHeight(40);
connect(BtnCancel, SIGNAL(clicked()), this, SLOT(reject()));
- bottomLayout->insertStretch(1);
-
label_captcha = new QLabel();
label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
label_captcha->setText("loading
captcha");
@@ -166,27 +143,27 @@
captchaInputLayout->addWidget(label_captcha_input);
captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
captcha_code = new QLineEdit();
- captcha_code->setFixedSize(165, 30);
+ captcha_code->setFixedHeight(30);
captchaInputLayout->addWidget(captcha_code);
captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
captchaLayout->addLayout(captchaInputLayout);
captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
- bottomLayout->addLayout(captchaLayout);
- bottomLayout->addSpacing(40);
+ QWidget * captchaLayoutWidget = new QWidget();
+ captchaLayoutWidget->setContentsMargins(0, 0, 0, 0);
+ captchaLayoutWidget->setLayout(captchaLayout);
+ feedbackLayout->addWidget(captchaLayoutWidget, 3, 1, 1, 2);
// TODO: Set green arrow icon for send button (:/res/Start.png)
BtnSend = new QPushButton(tr("Send Feedback"));
- bottomLayout->addWidget(BtnSend, 0);
- BtnSend->setFixedSize(120, 40);
+ feedbackLayout->addWidget(BtnSend, 3, 3);
+ BtnSend->setFixedHeight(40);
connect(BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback()));
- bottomLayout->setStretchFactor(captchaLayout, 0);
- bottomLayout->setStretchFactor(BtnSend, 1);
+ pageLayout->addLayout(feedbackLayout);
QVBoxLayout * dialogLayout = new QVBoxLayout(this);
dialogLayout->addLayout(pageLayout, 1);
- dialogLayout->addLayout(bottomLayout);
LoadCaptchaImage();
}
diff -r 68eddcdc9f26 -r 989b2d54bed3 QTfrontend/ui/widget/gamecfgwidget.cpp
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp Wed Apr 13 14:59:14 2016 +0200
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp Sun Apr 24 21:08:12 2016 +0200
@@ -108,6 +108,7 @@
GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), this), 1, 0);
Scripts = new QComboBox(this);
+ Scripts->setMaxVisibleItems(30);
GBoxOptionsLayout->addWidget(Scripts, 1, 1);
Scripts->setModel(DataManager::instance().gameStyleModel());
@@ -121,6 +122,7 @@
SchemeWidgetLayout->setMargin(0);
GameSchemes = new QComboBox(SchemeWidget);
+ GameSchemes->setMaxVisibleItems(30);
SchemeWidgetLayout->addWidget(GameSchemes, 0, 2);
connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int)));
@@ -139,6 +141,7 @@
SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Weapons"), SchemeWidget), 1, 0);
WeaponsName = new QComboBox(SchemeWidget);
+ WeaponsName->setMaxVisibleItems(30);
SchemeWidgetLayout->addWidget(WeaponsName, 1, 2);
connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
diff -r 68eddcdc9f26 -r 989b2d54bed3 QTfrontend/ui/widget/keybinder.cpp
--- a/QTfrontend/ui/widget/keybinder.cpp Wed Apr 13 14:59:14 2016 +0200
+++ b/QTfrontend/ui/widget/keybinder.cpp Sun Apr 24 21:08:12 2016 +0200
@@ -170,6 +170,7 @@
comboBox->setModel((QAbstractItemModel*)DataManager::instance().bindsModel());
comboBox->setVisible(false);
comboBox->setFixedWidth(200);
+ comboBox->setMaxVisibleItems(50);
// Table row
int row = curTable->rowCount();
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/CMakeSystemSpecificInformation.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/CMakeSystemSpecificInformation.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -0,0 +1,123 @@
+# XXX Emscripten:
+# This file is copied as-is from the CMake source tree. Due to how CMake
+# platform toolchain files work, we must have a copy of this file located
+# relative to Emscripten platform toolchain file, or file inclusion order
+# in cmGlobalGenerator::EnableLanguage will not find Emscripten.cmake
+# toolchain file, and as a result, it is not possible to set the default
+# compilation output suffix to .js, and as a consequence the script
+# check_function_exists() will not function properly (it will try to
+# build to wrong file suffix)
+
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2014 Kitware, Inc.
+# Copyright 2000-2011 Insight Software Consortium
+# All rights reserved.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# ------------------------------------------------------------------------------
+
+# The above copyright and license notice applies to distributions of
+# CMake in source and binary form. Some source files contain additional
+# notices of original copyright by their contributors; see each source
+# for details. Third-party software packages supplied with CMake under
+# compatible licenses provide their own copyright notices documented in
+# corresponding subdirectories.
+
+# ------------------------------------------------------------------------------
+
+# CMake was initially developed by Kitware with the following sponsorship:
+
+# * National Library of Medicine at the National Institutes of Health
+# as part of the Insight Segmentation and Registration Toolkit (ITK).
+
+# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
+# Visualization Initiative.
+
+# * National Alliance for Medical Image Computing (NAMIC) is funded by the
+# National Institutes of Health through the NIH Roadmap for Medical Research,
+# Grant U54 EB005149.
+
+# * Kitware, Inc.
+
+# This file is included by cmGlobalGenerator::EnableLanguage.
+# It is included after the compiler has been determined, so
+# we know things like the compiler name and if the compiler is gnu.
+
+# before cmake 2.6 these variables were set in cmMakefile.cxx. This is still
+# done to keep scripts and custom language and compiler modules working.
+# But they are reset here and set again in the platform files for the target
+# platform, so they can be used for testing the target platform instead
+# of testing the host platform.
+set(APPLE )
+set(UNIX )
+set(CYGWIN )
+set(WIN32 )
+
+
+# include Generic system information
+include(CMakeGenericSystem)
+
+# 2. now include SystemName.cmake file to set the system specific information
+set(CMAKE_SYSTEM_INFO_FILE Platform/${CMAKE_SYSTEM_NAME})
+
+include(${CMAKE_SYSTEM_INFO_FILE} OPTIONAL RESULT_VARIABLE _INCLUDED_SYSTEM_INFO_FILE)
+
+if(NOT _INCLUDED_SYSTEM_INFO_FILE)
+ message("System is unknown to cmake, create:\n${CMAKE_SYSTEM_INFO_FILE}"
+ " to use this system, please send your config file to "
+ "cmake@www.cmake.org so it can be added to cmake")
+ if(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
+ configure_file(${CMAKE_BINARY_DIR}/CMakeCache.txt
+ ${CMAKE_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY)
+ message("Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. "
+ "Please send that file to cmake@www.cmake.org.")
+ endif()
+endif()
+
+
+# optionally include a file which can do extra-generator specific things, e.g.
+# CMakeFindEclipseCDT4.cmake asks gcc for the system include dirs for the Eclipse CDT4 generator
+if(CMAKE_EXTRA_GENERATOR)
+ string(REPLACE " " "" _CMAKE_EXTRA_GENERATOR_NO_SPACES ${CMAKE_EXTRA_GENERATOR} )
+ include("CMakeFind${_CMAKE_EXTRA_GENERATOR_NO_SPACES}" OPTIONAL)
+endif()
+
+
+# for most systems a module is the same as a shared library
+# so unless the variable CMAKE_MODULE_EXISTS is set just
+# copy the values from the LIBRARY variables
+# this has to be done after the system information has been loaded
+if(NOT CMAKE_MODULE_EXISTS)
+ set(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
+ set(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif()
+
+
+set(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1)
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/CheckTypeSize.c.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/CheckTypeSize.c.in Sun Apr 24 21:08:12 2016 +0200
@@ -0,0 +1,37 @@
+@headers@
+
+#undef KEY
+#if defined(__i386)
+# define KEY '_','_','i','3','8','6'
+#elif defined(__x86_64)
+# define KEY '_','_','x','8','6','_','6','4'
+#elif defined(__ppc__)
+# define KEY '_','_','p','p','c','_','_'
+#elif defined(__ppc64__)
+# define KEY '_','_','p','p','c','6','4','_','_'
+#endif
+
+#define SIZE (sizeof(@type@))
+char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
+ ('0' + ((SIZE / 10000)%10)),
+ ('0' + ((SIZE / 1000)%10)),
+ ('0' + ((SIZE / 100)%10)),
+ ('0' + ((SIZE / 10)%10)),
+ ('0' + (SIZE % 10)),
+ ']',
+#ifdef KEY
+ ' ','k','e','y','[', KEY, ']',
+#endif
+ '\0'};
+
+#ifdef __CLASSIC_C__
+int main(argc, argv) int argc; char *argv[];
+#else
+int main(int argc, char *argv[])
+#endif
+{
+ int require = 0;
+ require += info_size[argc];
+ (void)argv;
+ return SIZE;
+}
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/CheckTypeSize.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/CheckTypeSize.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -0,0 +1,231 @@
+#.rst:
+# CheckTypeSize
+# -------------
+#
+# Check sizeof a type
+#
+# ::
+#
+# CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY]
+# [LANGUAGE ])
+#
+# Check if the type exists and determine its size. On return,
+# "HAVE_${VARIABLE}" holds the existence of the type, and "${VARIABLE}"
+# holds one of the following:
+#
+# ::
+#
+# = type has non-zero size
+# "0" = type has arch-dependent size (see below)
+# "" = type does not exist
+#
+# Both ``HAVE_${VARIABLE}`` and ``${VARIABLE}`` will be created as internal
+# cache variables.
+#
+# Furthermore, the variable "${VARIABLE}_CODE" holds C preprocessor code
+# to define the macro "${VARIABLE}" to the size of the type, or leave
+# the macro undefined if the type does not exist.
+#
+# The variable "${VARIABLE}" may be "0" when CMAKE_OSX_ARCHITECTURES has
+# multiple architectures for building OS X universal binaries. This
+# indicates that the type size varies across architectures. In this
+# case "${VARIABLE}_CODE" contains C preprocessor tests mapping from
+# each architecture macro to the corresponding type size. The list of
+# architecture macros is stored in "${VARIABLE}_KEYS", and the value for
+# each key is stored in "${VARIABLE}-${KEY}".
+#
+# If the BUILTIN_TYPES_ONLY option is not given, the macro checks for
+# headers , , and , and saves results
+# in HAVE_SYS_TYPES_H, HAVE_STDINT_H, and HAVE_STDDEF_H. The type size
+# check automatically includes the available headers, thus supporting
+# checks of types defined in the headers.
+#
+# If LANGUAGE is set, the specified compiler will be used to perform the
+# check. Acceptable values are C and CXX
+#
+# Despite the name of the macro you may use it to check the size of more
+# complex expressions, too. To check e.g. for the size of a struct
+# member you can do something like this:
+#
+# ::
+#
+# check_type_size("((struct something*)0)->member" SIZEOF_MEMBER)
+#
+#
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run:
+#
+# ::
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+# CMAKE_REQUIRED_QUIET = execute quietly without messages
+# CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include
+
+#=============================================================================
+# Copyright 2002-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
+
+cmake_policy(PUSH)
+cmake_policy(VERSION 3.0)
+
+get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+#-----------------------------------------------------------------------------
+# Helper function. DO NOT CALL DIRECTLY.
+function(__check_type_size_impl type var map builtin language)
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type}")
+ endif()
+
+ # Include header files.
+ set(headers)
+ if(builtin)
+ if(HAVE_SYS_TYPES_H)
+ set(headers "${headers}#include \n")
+ endif()
+ if(HAVE_STDINT_H)
+ set(headers "${headers}#include \n")
+ endif()
+ if(HAVE_STDDEF_H)
+ set(headers "${headers}#include \n")
+ endif()
+ endif()
+ foreach(h ${CMAKE_EXTRA_INCLUDE_FILES})
+ set(headers "${headers}#include \"${h}\"\n")
+ endforeach()
+
+ # Perform the check.
+
+ if("${language}" STREQUAL "C")
+ set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c)
+ elseif("${language}" STREQUAL "CXX")
+ set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.cpp)
+ else()
+ message(FATAL_ERROR "Unknown language:\n ${language}\nSupported languages: C, CXX.\n")
+ endif()
+ set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin)
+ configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY)
+ try_run(${var}_run_result HAVE_${var} ${CMAKE_BINARY_DIR} ${src}
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
+ CMAKE_FLAGS
+ "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}"
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
+ RUN_OUTPUT_VARIABLE ${var}_run_output
+ COMPILE_OUTPUT_VARIABLE output
+ )
+
+ if(${HAVE_${var}} AND NOT "${${var}_run_result}" STREQUAL "FAILED_TO_RUN")
+ set(${var} ${${var}_run_result})
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type} - done")
+ endif()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining size of ${type} passed with the following output:\n${output}\n\n")
+ set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})")
+ else()
+ # The check failed to compile.
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Check size of ${type} - failed")
+ endif()
+ file(READ ${src} content)
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n")
+ set(${var} "" CACHE INTERNAL "CHECK_TYPE_SIZE: ${type} unknown")
+ file(REMOVE ${map})
+ endif()
+endfunction()
+
+#-----------------------------------------------------------------------------
+macro(CHECK_TYPE_SIZE TYPE VARIABLE)
+ # parse arguments
+ unset(doing)
+ foreach(arg ${ARGN})
+ if("x${arg}" STREQUAL "xBUILTIN_TYPES_ONLY")
+ set(_CHECK_TYPE_SIZE_${arg} 1)
+ unset(doing)
+ elseif("x${arg}" STREQUAL "xLANGUAGE") # change to MATCHES for more keys
+ set(doing "${arg}")
+ set(_CHECK_TYPE_SIZE_${doing} "")
+ elseif("x${doing}" STREQUAL "xLANGUAGE")
+ set(_CHECK_TYPE_SIZE_${doing} "${arg}")
+ unset(doing)
+ else()
+ message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
+ endif()
+ endforeach()
+ if("x${doing}" MATCHES "^x(LANGUAGE)$")
+ message(FATAL_ERROR "Missing argument:\n ${doing} arguments requires a value\n")
+ endif()
+ if(DEFINED _CHECK_TYPE_SIZE_LANGUAGE)
+ if(NOT "x${_CHECK_TYPE_SIZE_LANGUAGE}" MATCHES "^x(C|CXX)$")
+ message(FATAL_ERROR "Unknown language:\n ${_CHECK_TYPE_SIZE_LANGUAGE}.\nSupported languages: C, CXX.\n")
+ endif()
+ set(_language ${_CHECK_TYPE_SIZE_LANGUAGE})
+ else()
+ set(_language C)
+ endif()
+
+ # Optionally check for standard headers.
+ if(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
+ set(_builtin 0)
+ else()
+ set(_builtin 1)
+ if("${_language}" STREQUAL "C")
+ check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+ check_include_file(stdint.h HAVE_STDINT_H)
+ check_include_file(stddef.h HAVE_STDDEF_H)
+ elseif("${_language}" STREQUAL "CXX")
+ check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
+ check_include_file_cxx(stdint.h HAVE_STDINT_H)
+ check_include_file_cxx(stddef.h HAVE_STDDEF_H)
+ endif()
+ endif()
+ unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
+ unset(_CHECK_TYPE_SIZE_LANGUAGE)
+
+ # Compute or load the size or size map.
+ set(${VARIABLE}_KEYS)
+ set(_map_file ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${VARIABLE}.cmake)
+ if(NOT DEFINED HAVE_${VARIABLE})
+ __check_type_size_impl(${TYPE} ${VARIABLE} ${_map_file} ${_builtin} ${_language})
+ endif()
+ include(${_map_file} OPTIONAL)
+ set(_map_file)
+ set(_builtin)
+
+ # Create preprocessor code.
+ if(${VARIABLE}_KEYS)
+ set(${VARIABLE}_CODE)
+ set(_if if)
+ foreach(key ${${VARIABLE}_KEYS})
+ set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n")
+ set(_if elif)
+ endforeach()
+ set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#else\n# error ${VARIABLE} unknown\n#endif")
+ set(_if)
+ elseif(${VARIABLE})
+ set(${VARIABLE}_CODE "#define ${VARIABLE} ${${VARIABLE}}")
+ else()
+ set(${VARIABLE}_CODE "/* #undef ${VARIABLE} */")
+ endif()
+endmacro()
+
+#-----------------------------------------------------------------------------
+cmake_policy(POP)
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/FindEmscripten.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/FindEmscripten.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -0,0 +1,36 @@
+# - Try to find the Clang/LLVM executable
+# Once done this will define
+#
+# EMSCRIPTEN_FOUND - system has Clang
+# EMSCRIPTEN_VERSION - Clang version
+# EMSCRIPTEN_EXECUTABLE - Clang executable
+#
+# Copyright (c) 2013, Vittorio Giovara
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+find_program(EMSCRIPTEN_EXECUTABLE
+ NAMES emcc
+ PATHS /opt/local/bin /usr/local/bin /usr/bin)
+
+if (EMSCRIPTEN_EXECUTABLE)
+ execute_process(COMMAND ${EMSCRIPTEN_EXECUTABLE} -v
+ OUTPUT_VARIABLE EMSCRIPTEN_VERSION_OUTPUT
+ ERROR_VARIABLE EMSCRIPTEN_VERSION_ERROR
+ RESULT_VARIABLE EMSCRIPTEN_VERSION_RESULT
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ if(${EMSCRIPTEN_VERSION_RESULT} EQUAL 0)
+ string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" EMSCRIPTEN_VERSION "${EMSCRIPTEN_VERSION_OUTPUT}")
+ string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+)" "\\1" EMSCRIPTEN_VERSION "${EMSCRIPTEN_VERSION}")
+ else()
+ message(SEND_ERROR "Command \"${EMSCRIPTEN_EXECUTABLE} --version\" failed with output: ${EMSCRIPTEN_VERSION_ERROR}")
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Emscripten DEFAULT_MSG EMSCRIPTEN_EXECUTABLE EMSCRIPTEN_VERSION)
+mark_as_advanced(EMSCRIPTEN_VERSION)
+
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/FindGLEW.cmake
--- a/cmake_modules/FindGLEW.cmake Wed Apr 13 14:59:14 2016 +0200
+++ b/cmake_modules/FindGLEW.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -34,6 +34,11 @@
$ENV{PROGRAMFILES}/GLEW/lib
DOC "The GLEW library")
+if(BUILD_ENGINE_JS)
+ set(GLEW_INCLUDE_DIR "${EMSCRIPTEN_ROOT_PATH}/system/include")
+ SET(GLEW_LIBRARY "glew_emscripten_internal")
+endif()
+
find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDE_DIR)
mark_as_advanced(GLEW_LIBRARY GLEW_INCLUDE_DIR)
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/FindOpenGL.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/FindOpenGL.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -0,0 +1,209 @@
+#.rst:
+# FindOpenGL
+# ----------
+#
+# FindModule for OpenGL and GLU.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module sets the following variables:
+#
+# ``OPENGL_FOUND``
+# True, if the system has OpenGL.
+# ``OPENGL_XMESA_FOUND``
+# True, if the system has XMESA.
+# ``OPENGL_GLU_FOUND``
+# True, if the system has GLU.
+# ``OPENGL_INCLUDE_DIR``
+# Path to the OpenGL include directory.
+# ``OPENGL_LIBRARIES``
+# Paths to the OpenGL and GLU libraries.
+#
+# If you want to use just GL you can use these values:
+#
+# ``OPENGL_gl_LIBRARY``
+# Path to the OpenGL library.
+# ``OPENGL_glu_LIBRARY``
+# Path to the GLU library.
+#
+# OSX Specific
+# ^^^^^^^^^^^^
+#
+# On OSX default to using the framework version of OpenGL. People will
+# have to change the cache values of OPENGL_glu_LIBRARY and
+# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX.
+
+
+#=============================================================================
+# Copyright 2001-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+set(_OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY)
+
+if (CYGWIN)
+
+ find_path(OPENGL_INCLUDE_DIR GL/gl.h )
+ list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
+
+ find_library(OPENGL_gl_LIBRARY opengl32 )
+
+ find_library(OPENGL_glu_LIBRARY glu32 )
+
+elseif (WIN32)
+
+ if(BORLAND)
+ set (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
+ set (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
+ else()
+ set (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
+ set (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
+ endif()
+
+elseif (APPLE)
+
+ # The OpenGL.framework provides both gl and glu
+ find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X")
+ find_library(OPENGL_glu_LIBRARY OpenGL DOC
+ "GLU library for OS X (usually same as OpenGL library)")
+ find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X")
+ list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
+
+else()
+ if (CMAKE_SYSTEM_NAME MATCHES "HP-UX")
+ # Handle HP-UX cases where we only want to find OpenGL in either hpux64
+ # or hpux32 depending on if we're doing a 64 bit build.
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(_OPENGL_LIB_PATH
+ /opt/graphics/OpenGL/lib/hpux32/)
+ else()
+ set(_OPENGL_LIB_PATH
+ /opt/graphics/OpenGL/lib/hpux64/
+ /opt/graphics/OpenGL/lib/pa20_64)
+ endif()
+ elseif(CMAKE_SYSTEM_NAME STREQUAL Haiku)
+ set(_OPENGL_LIB_PATH
+ /boot/develop/lib/x86)
+ set(_OPENGL_INCLUDE_PATH
+ /boot/develop/headers/os/opengl)
+ endif()
+
+ # The first line below is to make sure that the proper headers
+ # are used on a Linux machine with the NVidia drivers installed.
+ # They replace Mesa with NVidia's own library but normally do not
+ # install headers and that causes the linking to
+ # fail since the compiler finds the Mesa headers but NVidia's library.
+ # Make sure the NVIDIA directory comes BEFORE the others.
+ # - Atanas Georgiev
+
+ find_path(OPENGL_INCLUDE_DIR GL/gl.h
+ /usr/share/doc/NVIDIA_GLX-1.0/include
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include /usr/X11R6/include
+ ${_OPENGL_INCLUDE_PATH}
+ )
+ list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR)
+
+ find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
+ /usr/share/doc/NVIDIA_GLX-1.0/include
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include /usr/X11R6/include
+ )
+
+ find_library(OPENGL_gl_LIBRARY
+ NAMES GL MesaGL
+ PATHS /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ ${_OPENGL_LIB_PATH}
+ )
+
+ unset(_OPENGL_INCLUDE_PATH)
+ unset(_OPENGL_LIB_PATH)
+
+ find_library(OPENGL_glu_LIBRARY
+ NAMES GLU MesaGLU
+ PATHS ${OPENGL_gl_LIBRARY}
+ /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ )
+
+endif ()
+
+if(OPENGL_gl_LIBRARY)
+
+ if(OPENGL_xmesa_INCLUDE_DIR)
+ set( OPENGL_XMESA_FOUND "YES" )
+ else()
+ set( OPENGL_XMESA_FOUND "NO" )
+ endif()
+
+ set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
+ if(OPENGL_glu_LIBRARY)
+ set( OPENGL_GLU_FOUND "YES" )
+ if(NOT "${OPENGL_glu_LIBRARY}" STREQUAL "${OPENGL_gl_LIBRARY}")
+ set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
+ endif()
+ else()
+ set( OPENGL_GLU_FOUND "NO" )
+ endif()
+
+ # This deprecated setting is for backward compatibility with CMake1.4
+ set (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
+
+endif()
+
+# This deprecated setting is for backward compatibility with CMake1.4
+set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
+
+if(BUILD_ENGINE_JS)
+ # The implementation is based on the standard FindOpenGL.cmake provided
+ # with CMake, but customized for targeting Emscripten only.
+
+ # These libraries are provided with Emscripten
+ SET(OPENGL_FOUND TRUE)
+ SET(OPENGL_GLU_FOUND TRUE)
+
+ # Doesn't look like this one is part of Emscripten
+ SET(OPENGL_XMESA_FOUND FALSE)
+
+ # This is the path where is found
+ SET(OPENGL_INCLUDE_DIR "${EMSCRIPTEN_ROOT_PATH}/system/include")
+
+ # No library to link against for OpenGL, since Emscripten picks it up
+ # automatically from library_gl.js, but need to report something, or
+ # CMake thinks we failed in the search.
+ SET(OPENGL_LIBRARIES "opengl_emscripten_internal")
+ SET(OPENGL_gl_LIBRARY "gl_emscripten_internal")
+ SET(OPENGL_glu_LIBRARY "glu_emscripten_internal")
+
+ mark_as_advanced(
+ OPENGL_INCLUDE_DIR
+ OPENGL_glu_LIBRARY
+ OPENGL_gl_LIBRARY
+ )
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS})
+unset(_OpenGL_REQUIRED_VARS)
+
+mark_as_advanced(
+ OPENGL_INCLUDE_DIR
+ OPENGL_xmesa_INCLUDE_DIR
+ OPENGL_glu_LIBRARY
+ OPENGL_gl_LIBRARY
+)
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/FindSDL2.cmake
--- a/cmake_modules/FindSDL2.cmake Wed Apr 13 14:59:14 2016 +0200
+++ b/cmake_modules/FindSDL2.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -158,6 +158,11 @@
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
ENDIF(SDL2_LIBRARY_TEMP)
+if(BUILD_ENGINE_JS)
+ set(SDL2_LIBRARY "sdl2_emscripten_internal" CACHE STRING "emscripten override" FORCE)
+ set(SDL2_INCLUDE_DIR "${CMAKE_SYSTEM_INCLUDE_PATH}/SDL" CACHE STRING "emscripten override" FORCE)
+endif()
+
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/FindSDL2_image.cmake
--- a/cmake_modules/FindSDL2_image.cmake Wed Apr 13 14:59:14 2016 +0200
+++ b/cmake_modules/FindSDL2_image.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -74,6 +74,12 @@
set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY})
set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR})
+if(BUILD_ENGINE_JS)
+ set(SDL2_IMAGE_LIBRARY "sdl2_image_emscripten_internal")
+ set(SDL2_IMAGE_LIBRARIES "sdl2_image_emscripten_internal")
+ set(SDL2_IMAGE_INCLUDE_DIRS "${CMAKE_SYSTEM_INCLUDE_PATH}/SDL")
+endif()
+
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/FindSDL2_mixer.cmake
--- a/cmake_modules/FindSDL2_mixer.cmake Wed Apr 13 14:59:14 2016 +0200
+++ b/cmake_modules/FindSDL2_mixer.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -74,6 +74,12 @@
set(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY})
set(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_INCLUDE_DIR})
+if(BUILD_ENGINE_JS)
+ set(SDL2_MIXER_LIBRARY "sdl2_mixer_emscripten_internal")
+ set(SDL2_MIXER_LIBRARIES "sdl2_mixer_emscripten_internal")
+ set(SDL2_MIXER_INCLUDE_DIRS "${CMAKE_SYSTEM_INCLUDE_PATH}/SDL")
+endif()
+
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_mixer
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/FindSDL2_net.cmake
--- a/cmake_modules/FindSDL2_net.cmake Wed Apr 13 14:59:14 2016 +0200
+++ b/cmake_modules/FindSDL2_net.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -74,6 +74,12 @@
set(SDL2_NET_LIBRARIES ${SDL2_NET_LIBRARY})
set(SDL2_NET_INCLUDE_DIRS ${SDL2_NET_INCLUDE_DIR})
+if(BUILD_ENGINE_JS)
+ set(SDL2_NET_LIBRARY "sdl2_net_emscripten_internal")
+ set(SDL2_NET_LIBRARIES "sdl2_net_emscripten_internal")
+ set(SDL2_NET_INCLUDE_DIRS "${CMAKE_SYSTEM_INCLUDE_PATH}/SDL")
+endif()
+
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_net
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/FindSDL2_ttf.cmake
--- a/cmake_modules/FindSDL2_ttf.cmake Wed Apr 13 14:59:14 2016 +0200
+++ b/cmake_modules/FindSDL2_ttf.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -74,6 +74,12 @@
set(SDL2_TTF_LIBRARIES ${SDL2_TTF_LIBRARY})
set(SDL2_TTF_INCLUDE_DIRS ${SDL2_TTF_INCLUDE_DIR})
+if(BUILD_ENGINE_JS)
+ set(SDL2_TTF_LIBRARY "sdl2_ttf_emscripten_internal")
+ set(SDL2_TTF_LIBRARIES "sdl2_ttf_emscripten_internal")
+ set(SDL2_TTF_INCLUDE_DIRS "${CMAKE_SYSTEM_INCLUDE_PATH}/SDL")
+endif()
+
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_ttf
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/Platform/Emscripten.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/Platform/Emscripten.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -0,0 +1,275 @@
+# This file is a 'toolchain description file' for CMake.
+# It teaches CMake about the Emscripten compiler, so that CMake can generate makefiles
+# from CMakeLists.txt that invoke emcc.
+
+# To use this toolchain file with CMake, invoke CMake with the following command line parameters
+# cmake -DCMAKE_TOOLCHAIN_FILE=/cmake/Modules/Platform/Emscripten.cmake
+# -DCMAKE_BUILD_TYPE=
+# -G "Unix Makefiles" (Linux and OSX)
+# -G "MinGW Makefiles" (Windows)
+# # Note, pass in here ONLY the path to the file, not the filename 'CMakeLists.txt' itself.
+
+# After that, build the generated Makefile with the command 'make'. On Windows, you may download and use 'mingw32-make' instead.
+
+# The following variable describes the target OS we are building to.
+set(CMAKE_SYSTEM_NAME Emscripten)
+set(CMAKE_SYSTEM_VERSION 1)
+
+set(CMAKE_CROSSCOMPILING TRUE)
+
+# Advertise Emscripten as a 32-bit platform (as opposed to CMAKE_SYSTEM_PROCESSOR=x86_64 for 64-bit platform),
+# since some projects (e.g. OpenCV) use this to detect bitness.
+set(CMAKE_SYSTEM_PROCESSOR x86)
+
+# Tell CMake how it should instruct the compiler to generate multiple versions of an outputted .so library: e.g. "libfoo.so, libfoo.so.1, libfoo.so.1.4" etc.
+# This feature is activated if a shared library project has the property SOVERSION defined.
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+
+# In CMake, CMAKE_HOST_WIN32 is set when we are cross-compiling from Win32 to Emscripten: http://www.cmake.org/cmake/help/v2.8.12/cmake.html#variable:CMAKE_HOST_WIN32
+# The variable WIN32 is set only when the target arch that will run the code will be WIN32, so unset WIN32 when cross-compiling.
+set(WIN32)
+
+# The same logic as above applies for APPLE and CMAKE_HOST_APPLE, so unset APPLE.
+set(APPLE)
+
+# And for UNIX and CMAKE_HOST_UNIX. However, Emscripten is often able to mimic being a Linux/Unix system, in which case a lot of existing CMakeLists.txt files can be configured for Emscripten while assuming UNIX build, so this is left enabled.
+set(UNIX 1)
+
+# Do a no-op access on the CMAKE_TOOLCHAIN_FILE variable so that CMake will not issue a warning on it being unused.
+if(CMAKE_TOOLCHAIN_FILE)
+endif()
+
+# In order for check_function_exists() detection to work, we must signal it to pass an additional flag, which causes the compilation
+# to abort if linking results in any undefined symbols. The CMake detection mechanism depends on the undefined symbol error to be raised.
+set(CMAKE_REQUIRED_FLAGS "-s ERROR_ON_UNDEFINED_SYMBOLS=1")
+
+# Locate where the Emscripten compiler resides in relative to this toolchain file.
+if("${EMSCRIPTEN_ROOT_PATH}" STREQUAL "")
+ get_filename_component(GUESS_EMSCRIPTEN_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
+ if(EXISTS "${GUESS_EMSCRIPTEN_ROOT_PATH}/emranlib")
+ set(EMSCRIPTEN_ROOT_PATH "${GUESS_EMSCRIPTEN_ROOT_PATH}")
+ endif()
+endif()
+
+# If not found by above search, locate using the EMSCRIPTEN environment variable.
+if("${EMSCRIPTEN_ROOT_PATH}" STREQUAL "")
+ set(EMSCRIPTEN_ROOT_PATH "$ENV{EMSCRIPTEN}")
+endif()
+
+# Abort if not found.
+if("${EMSCRIPTEN_ROOT_PATH}" STREQUAL "")
+ message(FATAL_ERROR "Could not locate the Emscripten compiler toolchain directory! Either set the EMSCRIPTEN environment variable, or pass -DEMSCRIPTEN_ROOT_PATH=xxx to CMake to explicitly specify the location of the compiler! This usually matches EMSCRIPTEN_ROOT from your ~/.emscripten file.")
+endif()
+
+# Normalize, convert Windows backslashes to forward slashes or CMake will crash.
+get_filename_component(EMSCRIPTEN_ROOT_PATH "${EMSCRIPTEN_ROOT_PATH}" ABSOLUTE)
+
+if(NOT CMAKE_MODULE_PATH)
+ set(CMAKE_MODULE_PATH "")
+endif()
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${EMSCRIPTEN_ROOT_PATH}/cmake/Modules")
+
+set(CMAKE_FIND_ROOT_PATH "${EMSCRIPTEN_ROOT_PATH}/system")
+
+if(CMAKE_HOST_WIN32)
+ set(EMCC_SUFFIX ".bat")
+else()
+ set(EMCC_SUFFIX "")
+endif()
+
+# Specify the compilers to use for C and C++
+if("${CMAKE_C_COMPILER}" STREQUAL "")
+ set(CMAKE_C_COMPILER "${EMSCRIPTEN_ROOT_PATH}/emcc${EMCC_SUFFIX}")
+endif()
+if("${CMAKE_CXX_COMPILER}" STREQUAL "")
+ set(CMAKE_CXX_COMPILER "${EMSCRIPTEN_ROOT_PATH}/em++${EMCC_SUFFIX}")
+endif()
+
+if("${CMAKE_AR}" STREQUAL "")
+ set(CMAKE_AR "${EMSCRIPTEN_ROOT_PATH}/emar${EMCC_SUFFIX}" CACHE FILEPATH "Emscripten ar")
+endif()
+
+if("${CMAKE_RANLIB}" STREQUAL "")
+ set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT_PATH}/emranlib${EMCC_SUFFIX}" CACHE FILEPATH "Emscripten ranlib")
+endif()
+
+# Don't do compiler autodetection, since we are cross-compiling.
+include(CMakeForceCompiler)
+CMAKE_FORCE_C_COMPILER("${CMAKE_C_COMPILER}" Clang)
+CMAKE_FORCE_CXX_COMPILER("${CMAKE_CXX_COMPILER}" Clang)
+
+# To find programs to execute during CMake run time with find_program(), e.g. 'git' or so, we allow looking
+# into system paths.
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+
+# Since Emscripten is a cross-compiler, we should never look at the system-provided directories like /usr/include and so on.
+# Therefore only CMAKE_FIND_ROOT_PATH should be used as a find directory. See http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_FIND_ROOT_PATH_MODE_INCLUDE.html
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+set(CMAKE_SYSTEM_INCLUDE_PATH "${EMSCRIPTEN_ROOT_PATH}/system/include")
+
+# We would prefer to specify a standard set of Clang+Emscripten-friendly common convention for suffix files, especially for CMake executable files,
+# but if these are adjusted, ${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake will fail, since it depends on being able to compile output files with predefined names.
+#SET(CMAKE_LINK_LIBRARY_SUFFIX "")
+#SET(CMAKE_STATIC_LIBRARY_PREFIX "")
+#SET(CMAKE_STATIC_LIBRARY_SUFFIX ".bc")
+#SET(CMAKE_SHARED_LIBRARY_PREFIX "")
+#SET(CMAKE_SHARED_LIBRARY_SUFFIX ".bc")
+SET(CMAKE_EXECUTABLE_SUFFIX ".js")
+#SET(CMAKE_FIND_LIBRARY_PREFIXES "")
+#SET(CMAKE_FIND_LIBRARY_SUFFIXES ".bc")
+
+SET(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
+SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
+SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)
+SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1)
+SET(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 1)
+SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1)
+
+set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@")
+set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@")
+
+# Specify the program to use when building static libraries. Force Emscripten-related command line options to clang.
+set(CMAKE_C_CREATE_STATIC_LIBRARY " rc ")
+set(CMAKE_CXX_CREATE_STATIC_LIBRARY " rc ")
+
+# Set a global EMSCRIPTEN variable that can be used in client CMakeLists.txt to detect when building using Emscripten.
+set(EMSCRIPTEN 1 CACHE BOOL "If true, we are targeting Emscripten output.")
+
+# Hardwire support for cmake-2.8/Modules/CMakeBackwardsCompatibilityC.cmake without having CMake to try complex things
+# to autodetect these:
+set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
+set(CMAKE_SIZEOF_CHAR 1)
+set(CMAKE_SIZEOF_UNSIGNED_SHORT 2)
+set(CMAKE_SIZEOF_SHORT 2)
+set(CMAKE_SIZEOF_INT 4)
+set(CMAKE_SIZEOF_UNSIGNED_LONG 4)
+set(CMAKE_SIZEOF_UNSIGNED_INT 4)
+set(CMAKE_SIZEOF_LONG 4)
+set(CMAKE_SIZEOF_VOID_P 4)
+set(CMAKE_SIZEOF_FLOAT 4)
+set(CMAKE_SIZEOF_DOUBLE 8)
+set(CMAKE_C_SIZEOF_DATA_PTR 4)
+set(CMAKE_CXX_SIZEOF_DATA_PTR 4)
+set(CMAKE_HAVE_LIMITS_H 1)
+set(CMAKE_HAVE_UNISTD_H 1)
+set(CMAKE_HAVE_PTHREAD_H 1)
+set(CMAKE_HAVE_SYS_PRCTL_H 1)
+set(CMAKE_WORDS_BIGENDIAN 0)
+set(CMAKE_DL_LIBS)
+
+set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELEASE")
+set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_MINSIZEREL")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELWITHDEBINFO")
+set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELEASE")
+set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_MINSIZEREL")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELWITHDEBINFO")
+
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELEASE")
+set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_MINSIZEREL")
+set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO")
+set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELEASE")
+set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL")
+set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO")
+set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELEASE")
+set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "-Os" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL")
+set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO")
+
+function(em_validate_asmjs_after_build target)
+ add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo Validating build output for asm.js... COMMAND "python" ARGS "${EMSCRIPTEN_ROOT_PATH}/tools/validate_asmjs.py" "$")
+endfunction()
+
+# A global counter to guarantee unique names for js library files.
+set(link_js_counter 1)
+
+# Internal function: Do not call from user CMakeLists.txt files. Use one of em_link_js_library()/em_link_pre_js()/em_link_post_js() instead.
+function(em_add_tracked_link_flag target flagname)
+
+ # User can input list of JS files either as a single list, or as variable arguments to this function, so iterate over varargs, and treat each
+ # item in varargs as a list itself, to support both syntax forms.
+ foreach(jsFileList ${ARGN})
+ foreach(jsfile ${jsFileList})
+ # If the user edits the JS file, we want to relink the emscripten application, but unfortunately it is not possible to make a link step
+ # depend directly on a source file. Instead, we must make a dummy no-op build target on that source file, and make the project depend on
+ # that target.
+
+ # Sanitate the source .js filename to a good symbol name to use as a dummy filename.
+ get_filename_component(jsname "${jsfile}" NAME)
+ string(REGEX REPLACE "[/:\\\\.\ ]" "_" dummy_js_target ${jsname})
+ set(dummy_lib_name ${target}_${link_js_counter}_${dummy_js_target})
+ set(dummy_c_name "${CMAKE_BINARY_DIR}/${dummy_js_target}_tracker.c")
+
+ # Create a new static library target that with a single dummy .c file.
+ add_library(${dummy_lib_name} STATIC ${dummy_c_name})
+ # Make the dummy .c file depend on the .js file we are linking, so that if the .js file is edited, the dummy .c file, and hence the static library will be rebuild (no-op). This causes the main application to be relinked, which is what we want.
+ # This approach was recommended by http://www.cmake.org/pipermail/cmake/2010-May/037206.html
+ add_custom_command(OUTPUT ${dummy_c_name} COMMAND ${CMAKE_COMMAND} -E touch ${dummy_c_name} DEPENDS ${jsfile})
+ target_link_libraries(${target} ${dummy_lib_name})
+
+ # Link the js-library to the target
+ # When a linked library starts with a "-" cmake will just add it to the linker command line as it is.
+ # The advantage of doing it this way is that the js-library will also be automatically linked to targets
+ # that depend on this target.
+ get_filename_component(js_file_absolute_path "${jsfile}" ABSOLUTE )
+ target_link_libraries(${target} "${flagname} \"${js_file_absolute_path}\"")
+
+ math(EXPR link_js_counter "${link_js_counter} + 1")
+ endforeach()
+ endforeach()
+endfunction()
+
+# This function links a (list of ) .js library file(s) to the given CMake project.
+# Example: em_link_js_library(my_executable "lib1.js" "lib2.js")
+# will result in emcc passing --js-library lib1.js --js-library lib2.js to the emscripten linker, as well as
+# tracking the modification timestamp between the linked .js files and the main project, so that editing the .js file
+# will cause the target project to be relinked.
+function(em_link_js_library target)
+ em_add_tracked_link_flag(${target} "--js-library" ${ARGN})
+endfunction()
+
+# This function is identical to em_link_js_library(), except the .js files will be added with '--pre-js file.js' command line flag,
+# which is generally used to add some preamble .js code to a generated output file.
+function(em_link_pre_js target)
+ em_add_tracked_link_flag(${target} "--pre-js" ${ARGN})
+endfunction()
+
+# This function is identical to em_link_js_library(), except the .js files will be added with '--post-js file.js' command line flag,
+# which is generally used to add some postamble .js code to a generated output file.
+function(em_link_post_js target)
+ em_add_tracked_link_flag(${target} "--post-js" ${ARGN})
+endfunction()
+
+# Experimental support for targeting generation of Visual Studio project files (vs-tool) of Emscripten projects for Windows.
+# To use this, pass the combination -G "Visual Studio 10" -DCMAKE_TOOLCHAIN_FILE=Emscripten.cmake
+if ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio.*")
+ # By default, CMake generates VS project files with a true directive.
+ # This causes VS to attempt to invoke rc.exe during the build, which will fail since app manifests are meaningless for Emscripten.
+ # To disable this, add the following linker flag. This flag will not go to emcc, since the Visual Studio CMake generator will swallow it.
+ set(EMSCRIPTEN_VS_LINKER_FLAGS "/MANIFEST:NO")
+ # CMake is hardcoded to write a ClCompile directive $(IntDir) in all VS project files it generates.
+ # This makes VS pass emcc a -o param that points to a directory instead of a file, which causes emcc autogenerate the output filename.
+ # CMake is hardcoded to assume all object files have the suffix .obj, so adjust the emcc-autogenerated default suffix name to match.
+ set(EMSCRIPTEN_VS_LINKER_FLAGS "${EMSCRIPTEN_VS_LINKER_FLAGS} --default-obj-ext .obj")
+ # Also hint CMake that it should not hardcode generation. Requires a custom CMake build for this to work (ignored on others)
+ # See http://www.cmake.org/Bug/view.php?id=14673 and https://github.com/juj/CMake
+ set(CMAKE_VS_NO_DEFAULT_OBJECTFILENAME 1)
+
+ # Apply and cache Emscripten Visual Studio IDE-specific linker flags.
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
+endif()
+
+if(NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
+ find_program(NODE_JS_EXECUTABLE NAMES nodejs node)
+ if(NODE_JS_EXECUTABLE)
+ set(CMAKE_CROSSCOMPILING_EMULATOR "${NODE_JS_EXECUTABLE}" CACHE FILEPATH "Path to the emulator for the target system.")
+ endif()
+endif()
+
+# No-op on CMAKE_CROSSCOMPILING_EMULATOR so older versions of cmake do not
+# complain about unused CMake variable.
+if(CMAKE_CROSSCOMPILING_EMULATOR)
+endif()
diff -r 68eddcdc9f26 -r 989b2d54bed3 cmake_modules/TestBigEndian.cmake
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake_modules/TestBigEndian.cmake Sun Apr 24 21:08:12 2016 +0200
@@ -0,0 +1,30 @@
+#.rst:
+# TestBigEndian
+# -------------
+#
+# The TestBigEndian.cmake module that ships with CMake, which
+# checks if the system is big endian or little endian, assumes
+# that a binary is produced that will have bytes that correspond to the
+# endianness on the target system. Since emscripten produces Javascript, we
+# override the default behavior and always return little endian.
+#
+# ::
+#
+# TEST_BIG_ENDIAN(VARIABLE)
+# VARIABLE - variable to store the result to
+#=============================================================================
+# Copyright 2002-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+function(TEST_BIG_ENDIAN VARIABLE)
+ set(${VARIABLE} 0 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
+endfunction()
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/ArgParsers.pas
--- a/hedgewars/ArgParsers.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/ArgParsers.pas Sun Apr 24 21:08:12 2016 +0200
@@ -23,9 +23,9 @@
procedure GetParams;
{$IFDEF HWLIBRARY}
-var operatingsystem_parameter_argc: LongInt = 0; export;
- operatingsystem_parameter_argv: pointer = nil; export;
- operatingsystem_parameter_envp: pointer = nil; export;
+var operatingsystem_parameter_argc: LongInt = 0; {$IFNDEF PAS2C}cdecl; export;{$ENDIF}
+ operatingsystem_parameter_argv: pointer = nil; {$IFNDEF PAS2C}cdecl; export;{$ENDIF}
+ operatingsystem_parameter_envp: pointer = nil; {$IFNDEF PAS2C}cdecl; export;{$ENDIF}
function ParamCount: LongInt;
function ParamStr(i: LongInt): shortstring;
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/SDLh.pas
--- a/hedgewars/SDLh.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/SDLh.pas Sun Apr 24 21:08:12 2016 +0200
@@ -1047,7 +1047,6 @@
function SDL_GetError: PChar; cdecl; external SDLLibName;
-function SDL_SetVideoMode(width, height, bpp: LongInt; flags: LongWord): PSDL_Surface; cdecl; external SDLLibName;
function SDL_CreateRGBSurface(flags: LongWord; Width, Height, Depth: LongInt; RMask, GMask, BMask, AMask: LongWord): PSDL_Surface; cdecl; external SDLLibName;
function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: LongInt; RMask, GMask, BMask, AMask: LongWord): PSDL_Surface; cdecl; external SDLLibName;
procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/hwengine.pas
--- a/hedgewars/hwengine.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/hwengine.pas Sun Apr 24 21:08:12 2016 +0200
@@ -39,7 +39,7 @@
;
{$IFDEF HWLIBRARY}
-procedure RunEngine(argc: LongInt; argv: PPChar); cdecl; export;
+function RunEngine(argc: LongInt; argv: PPChar): LongInt; cdecl; export;
procedure preInitEverything();
procedure initEverything(complete:boolean);
@@ -576,7 +576,7 @@
end;
{$IFDEF HWLIBRARY}
-procedure RunEngine(argc: LongInt; argv: PPChar); cdecl; export;
+function RunEngine(argc: LongInt; argv: PPChar): LongInt; cdecl; export;
begin
operatingsystem_parameter_argc:= argc;
operatingsystem_parameter_argv:= argv;
@@ -622,7 +622,7 @@
exit(HaltNoError);
{$ELSE}
{$IFDEF IPHONEOS}
- exit;
+ exit(HaltNoError);
{$ELSE}
halt(HaltNoError);
{$ENDIF}
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/options.inc
--- a/hedgewars/options.inc Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/options.inc Sun Apr 24 21:08:12 2016 +0200
@@ -46,7 +46,9 @@
{$DEFINE USE_TOUCH_INTERFACE}
{$ELSE}
{$DEFINE USE_AM_NUMCOLUMN}
- {$DEFINE USE_S3D_RENDERING}
+ {$IFNDEF WEBGL}
+ {$DEFINE USE_S3D_RENDERING}
+ {$ENDIF}
{$ENDIF}
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/pas2cRedo.pas
--- a/hedgewars/pas2cRedo.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/pas2cRedo.pas Sun Apr 24 21:08:12 2016 +0200
@@ -113,4 +113,5 @@
Load_GL_VERSION_2_0 : procedure;
+ GetCurrentDir : function : PChar;
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/uInputHandler.pas
--- a/hedgewars/uInputHandler.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/uInputHandler.pas Sun Apr 24 21:08:12 2016 +0200
@@ -318,7 +318,7 @@
DefaultBinds[KeyNameToCode('j0a0d')]:= '+right';
DefaultBinds[KeyNameToCode('j0a1u')]:= '+up';
DefaultBinds[KeyNameToCode('j0a1d')]:= '+down';
- for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+IntToStr(i);
+ for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+char(48+i);
for i:= 1 to 5 do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i);
loadBinds('dbind', cPathz[ptData] + '/settings.ini');
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/uLand.pas
--- a/hedgewars/uLand.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/uLand.pas Sun Apr 24 21:08:12 2016 +0200
@@ -33,7 +33,7 @@
uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, SysUtils,
uVariables, uUtils, uCommands, adler32, uDebug, uLandPainted, uTextures,
uLandGenMaze, uPhysFSLayer, uScript, uLandGenPerlin,
- uLandGenTemplateBased, uLandUtils;
+ uLandGenTemplateBased, uLandUtils, uRenderUtils;
var digest: shortstring;
maskOnly: boolean;
@@ -49,7 +49,7 @@
procedure DrawBorderFromImage(Surface: PSDL_Surface);
var tmpsurf: PSDL_Surface;
- r, rr: TSDL_Rect;
+ //r, rr: TSDL_Rect;
x, yd, yu: LongInt;
targetMask: Word;
begin
@@ -79,25 +79,9 @@
while (yu < yd ) and ((Land[yu, x] and targetMask) = 0) do inc(yu);
if (yd < LAND_HEIGHT - 1) and ((yd - yu) >= 16) then
- begin
- rr.x:= x;
- rr.y:= yd - 15;
- r.x:= x mod tmpsurf^.w;
- r.y:= 16;
- r.w:= 1;
- r.h:= 16;
- SDL_UpperBlit(tmpsurf, @r, Surface, @rr);
- end;
+ copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 16, 1, 16, x, yd - 15);
if (yu > 0) then
- begin
- rr.x:= x;
- rr.y:= yu;
- r.x:= x mod tmpsurf^.w;
- r.y:= 0;
- r.w:= 1;
- r.h:= Min(16, yd - yu + 1);
- SDL_UpperBlit(tmpsurf, @r, Surface, @rr);
- end;
+ copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 0, 1, Min(16, yd - yu + 1), x, yu);
yd:= yu - 1;
until yd < 0;
end;
@@ -194,7 +178,8 @@
r.x:= 0;
while r.x < LAND_WIDTH do
begin
- SDL_UpperBlit(tmpsurf, nil, Surface, @r);
+ copyToXY(tmpsurf, Surface, r.x, r.y);
+ //SDL_UpperBlit(tmpsurf, nil, Surface, @r);
inc(r.x, tmpsurf^.w)
end;
inc(y, tmpsurf^.h);
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/uLocale.pas
--- a/hedgewars/uLocale.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/uLocale.pas Sun Apr 24 21:08:12 2016 +0200
@@ -140,7 +140,12 @@
uUtils.initModule(false);
uVariables.initModule;
- uPhysFSLayer.initModule;
+
+ PathPrefix:= PathPrefix + #0;
+ UserPathPrefix:= UserPathPrefix + #0;
+ uPhysFSLayer.initModule(@PathPrefix[1], @UserPathPrefix[1]);
+ PathPrefix:= copy(PathPrefix, 1, length(PathPrefix) - 1);
+ UserPathPrefix:= copy(UserPathPrefix, 1, length(UserPathPrefix) - 1);
LoadLocale(Strpas(filename));
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/uPhysFSLayer.pas
--- a/hedgewars/uPhysFSLayer.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/uPhysFSLayer.pas Sun Apr 24 21:08:12 2016 +0200
@@ -198,7 +198,7 @@
begin
{$IFDEF HWLIBRARY}
//TODO: http://icculus.org/pipermail/physfs/2011-August/001006.html
- cPhysfsId:= GetCurrentDir() + {$IFDEF DARWIN}{$IFNDEF IPHONEOS}'/Hedgewars.app/Contents/MacOS/' + {$ENDIF}{$ENDIF} ' hedgewars';
+ cPhysfsId:= shortstring(GetCurrentDir()) + {$IFDEF DARWIN}{$IFNDEF IPHONEOS}'/Hedgewars.app/Contents/MacOS/' + {$ENDIF}{$ENDIF} ' hedgewars';
{$ELSE}
cPhysfsId:= ParamStr(0);
{$ENDIF}
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/uScript.pas
--- a/hedgewars/uScript.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/uScript.pas Sun Apr 24 21:08:12 2016 +0200
@@ -56,7 +56,6 @@
procedure freeModule;
implementation
-{$IFDEF USE_LUA_SCRIPT}
uses LuaPas,
uConsole,
@@ -104,6 +103,7 @@
PointsBuffer: shortstring;
prevCursorPoint: TPoint; // why is tpoint still in sdlh...
+{$IFDEF USE_LUA_SCRIPT}
procedure ScriptPrepareAmmoStore; forward;
procedure ScriptApplyAmmoStore; forward;
procedure ScriptSetAmmo(ammo : TAmmoType; count, probability, delay, reinforcement: Byte); forward;
@@ -338,7 +338,7 @@
LuaToMapGenOrd:= i;
end;
-// wrapped calls //
+// wrapped calls
// functions called from Lua:
// function(L : Plua_State) : LongInt; Cdecl;
@@ -490,7 +490,7 @@
cs:= 0; // current slot
fa:= 0; // first ammo item to check
- // if something is selected, find it's successor
+ // if something is selected, find it is successor
if curAmmoType <> amNothing then
begin
// get current slot index
@@ -499,7 +499,7 @@
while (fa < cMaxSlotAmmoIndex)
and (Ammo^[cs, fa].AmmoType <> CurAmmoType) do
inc(fa);
- // increase once more because we won't successor
+ // increase once more because we will not successor
inc(fa);
end;
@@ -913,7 +913,7 @@
lc_setvisualgearvalues:= 0
end;
-// so. going to use this to get/set some of the more obscure gear values which weren't already exposed elsewhere
+// so. going to use this to get/set some of the more obscure gear values which were not already exposed elsewhere
// can keep adding things in the future. isnoneornil makes it safe
function lc_getgearvalues(L : Plua_State) : LongInt; Cdecl;
var gear: PGear;
@@ -1226,8 +1226,8 @@
begin
if CheckLuaParamCount(L, 2, 'SetClanColor', 'clan, color') then
begin
- i:= lua_tointeger(L,1);
- if i >= ClansCount then exit(0);
+ i:= lua_tointeger(L,1);
+ if i >= ClansCount then exit(0);
clan := ClansArray[i];
clan^.Color:= lua_tointeger(L, 2) shr 8;
@@ -1248,7 +1248,7 @@
team^.NameTagTex:= RenderStringTex(ansistring(clan^.Teams[i]^.TeamName), clan^.Color, fnt16);
end;
- FreeAndNilTexture(clan^.HealthTex);
+ FreeAndNilTexture(clan^.HealthTex);
clan^.HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, clan^.Teams[0]^.NameTagTex^.h, clan^.Color);
end;
@@ -2287,16 +2287,16 @@
if CheckAndFetchLuaParamMinCount(L, 4, call, params, n) then
begin
if not lua_isnoneornil(L, 5) then
- tint := lua_tointeger(L, 5)
+ tint := lua_tointeger(L, 5)
else tint := $FFFFFFFF;
if not lua_isnoneornil(L, 6) then
- behind := lua_toboolean(L, 6)
+ behind := lua_toboolean(L, 6)
else behind := false;
if not lua_isnoneornil(L, 7) then
- flipHoriz := lua_toboolean(L, 7)
+ flipHoriz := lua_toboolean(L, 7)
else flipHoriz := false;
if not lua_isnoneornil(L, 8) then
- flipVert := lua_toboolean(L, 8)
+ flipVert := lua_toboolean(L, 8)
else flipVert := false;
lf:= 0;
@@ -2334,16 +2334,16 @@
if CheckAndFetchLuaParamMinCount(L, 4, call, params, n) then
begin
if not lua_isnoneornil(L, 5) then
- eraseOnLFMatch := lua_toboolean(L, 5)
+ eraseOnLFMatch := lua_toboolean(L, 5)
else eraseOnLFMatch := false;
if not lua_isnoneornil(L, 6) then
- onlyEraseLF := lua_toboolean(L, 6)
+ onlyEraseLF := lua_toboolean(L, 6)
else onlyEraseLF := false;
if not lua_isnoneornil(L, 7) then
- flipHoriz := lua_toboolean(L, 7)
+ flipHoriz := lua_toboolean(L, 7)
else flipHoriz := false;
if not lua_isnoneornil(L, 8) then
- flipVert := lua_toboolean(L, 8)
+ flipVert := lua_toboolean(L, 8)
else flipVert := false;
lf:= 0;
@@ -2869,7 +2869,7 @@
ScriptSetInteger('WaterLine', cWaterLine);
if isCursorVisible and (not bShowAmmoMenu) then
begin
- if (prevCursorPoint.X <> CursorPoint.X) or
+ if (prevCursorPoint.X <> CursorPoint.X) or
(prevCursorPoint.Y <> CursorPoint.Y) then
begin
ScriptSetInteger('CursorX', CursorPoint.X - WorldDx);
@@ -3028,13 +3028,13 @@
procedure ScriptSetAmmoDelay(ammo : TAmmoType; delay: Byte);
begin
-// change loadout string if ammo store hasn't been initialized yet
+// change loadout string if ammo store has not been initialized yet
if (StoreCnt = 0) then
begin
if (delay <= 9) then
ScriptAmmoDelay[ord(ammo)]:= inttostr(delay)[1];
end
-// change "live" delay values
+// change 'live' delay values
else if (CurrentTeam <> nil) then
ammoz[ammo].SkipTurns:= CurrentTeam^.Clan^.TurnNumber + delay;
end;
@@ -3452,6 +3452,22 @@
begin
end;
+procedure ScriptOnPreviewInit;
+begin
+end;
+
+procedure ScriptSetInteger(name : shortstring; value : LongInt);
+begin
+end;
+
+procedure ScriptSetString(name : shortstring; value : shortstring);
+begin
+end;
+
+procedure LuaParseString(s : ShortString);
+begin
+end;
+
procedure initModule;
begin
mapDims:= false;
diff -r 68eddcdc9f26 -r 989b2d54bed3 hedgewars/uSound.pas
--- a/hedgewars/uSound.pas Wed Apr 13 14:59:14 2016 +0200
+++ b/hedgewars/uSound.pas Sun Apr 24 21:08:12 2016 +0200
@@ -425,7 +425,7 @@
s:= cPathz[Soundz[snd].Path] + '/' + Soundz[snd].FileName;
WriteToConsole(msgLoading + s + ' ');
defVoicepack^.chunks[snd]:= Mix_LoadWAV_RW(rwopsOpenRead(s), 1);
- if not SDLCheck(defVoicepack^.chunks[snd] <> nil, 'Mix_LoadWAV_RW', true) then exit;
+ if SDLCheck(defVoicepack^.chunks[snd] <> nil, 'Mix_LoadWAV_RW', true) then exit;
WriteLnToConsole(msgOK);
end;
lastChan[snd]:= Mix_PlayChannelTimed(-1, defVoicepack^.chunks[snd], 0, -1)
diff -r 68eddcdc9f26 -r 989b2d54bed3 misc/liblua/CMakeLists.txt
--- a/misc/liblua/CMakeLists.txt Wed Apr 13 14:59:14 2016 +0200
+++ b/misc/liblua/CMakeLists.txt Sun Apr 24 21:08:12 2016 +0200
@@ -23,4 +23,8 @@
set(LUA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Lua include dir" FORCE)
set(LUA_LIBRARY ${lua_fullpath} CACHE STRING "Lua library" FORCE)
+#emscripten does not expose headers but has an internal binary copy
+if(BUILD_ENGINE_JS)
+ set(LUA_LIBRARY "lua_emscripten_internal" CACHE STRING "Lua library" FORCE)
+endif()
diff -r 68eddcdc9f26 -r 989b2d54bed3 misc/libphyslayer/CMakeLists.txt
--- a/misc/libphyslayer/CMakeLists.txt Wed Apr 13 14:59:14 2016 +0200
+++ b/misc/libphyslayer/CMakeLists.txt Sun Apr 24 21:08:12 2016 +0200
@@ -26,3 +26,7 @@
set(PHYSLAYER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Physlayer include dir" FORCE)
set(PHYSLAYER_LIBRARY ${physlayer_fullpath} CACHE STRING "Physlayer library" FORCE)
+if(BUILD_ENGINE_JS)
+ set_target_properties(physlayer PROPERTIES SUFFIX ".bc")
+endif()
+
diff -r 68eddcdc9f26 -r 989b2d54bed3 misc/libphyslayer/physfsrwops.c
--- a/misc/libphyslayer/physfsrwops.c Wed Apr 13 14:59:14 2016 +0200
+++ b/misc/libphyslayer/physfsrwops.c Sun Apr 24 21:08:12 2016 +0200
@@ -180,7 +180,7 @@
retval = SDL_AllocRW();
if (retval != NULL)
{
-#if TARGET_SDL13
+#if TARGET_SDL13 && !defined(EMSCRIPTEN)
retval->size = physfsrwops_size;
#endif
retval->seek = physfsrwops_seek;
diff -r 68eddcdc9f26 -r 989b2d54bed3 project_files/hwc/CMakeLists.txt
--- a/project_files/hwc/CMakeLists.txt Wed Apr 13 14:59:14 2016 +0200
+++ b/project_files/hwc/CMakeLists.txt Sun Apr 24 21:08:12 2016 +0200
@@ -57,15 +57,20 @@
list(APPEND engine_sources_pas ${CMAKE_SOURCE_DIR}/hedgewars/pas2cRedo.pas)
+set(pas2c_args -n hwengine
+ -i ${CMAKE_SOURCE_DIR}/hedgewars
+ -o ${CMAKE_CURRENT_BINARY_DIR}
+ -a ${CMAKE_CURRENT_BINARY_DIR}
+ -d ENDIAN_LITTLE
+ -d DEBUGFILE)
+if(BUILD_ENGINE_JS)
+ set(pas2c_args ${pas2c_args} -d WEBGL -d HWLIBRARY)
+endif()
+
#invoke pas2c on main module, it will call all the others
add_custom_command(OUTPUT ${engine_sources}
COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}"
- ARGS -n "hwengine"
- -i "${CMAKE_SOURCE_DIR}/hedgewars"
- -o "${CMAKE_CURRENT_BINARY_DIR}"
- -a "${CMAKE_CURRENT_BINARY_DIR}"
- -d "ENDIAN_LITTLE"
- -d "DEBUGFILE"
+ ARGS ${pas2c_args}
DEPENDS pas2c #converter tool
${engine_sources_pas} #original pascal file
)
@@ -74,12 +79,20 @@
add_custom_target(engine_c DEPENDS ${engine_sources})
+if(BUILD_ENGINE_JS)
+ add_flag_append(CMAKE_C_FLAGS "-s ABORTING_MALLOC=0")
+endif()
+
#compile the c files
add_definitions(-DPAS2C)
add_definitions(-Werror=incompatible-pointer-types)
add_executable(hwengine WIN32 ${engine_sources})
+if(BUILD_ENGINE_JS)
+ set_target_properties(hwengine PROPERTIES SUFFIX ".html")
+endif()
+
target_link_libraries(hwengine fpcrtl
${LUA_LIBRARY}
${OPENGL_LIBRARY}
diff -r 68eddcdc9f26 -r 989b2d54bed3 project_files/hwc/rtl/CMakeLists.txt
--- a/project_files/hwc/rtl/CMakeLists.txt Wed Apr 13 14:59:14 2016 +0200
+++ b/project_files/hwc/rtl/CMakeLists.txt Sun Apr 24 21:08:12 2016 +0200
@@ -5,12 +5,3 @@
add_library(fpcrtl STATIC ${fpcrtl_src})
-#if(WEBGL)
-# set_target_properties(fpcrtl PROPERTIES PREFIX "em")
-# set_target_properties(fpcrtl PROPERTIES SUFFIX ".bc")
-#endif(WEBGL)
-
-
-
-
-
diff -r 68eddcdc9f26 -r 989b2d54bed3 project_files/hwc/rtl/fileio.c
--- a/project_files/hwc/rtl/fileio.c Wed Apr 13 14:59:14 2016 +0200
+++ b/project_files/hwc/rtl/fileio.c Sun Apr 24 21:08:12 2016 +0200
@@ -8,9 +8,11 @@
#include
#include
#include
+#include
io_result_t IOResult;
int FileMode;
+char cwd[1024];
static void init(File f) {
f->fp = NULL;
@@ -219,6 +221,17 @@
return false;
}
+char * fpcrtl_getCurrentDir(void) {
+
+ IOResult = IO_NO_ERROR;
+
+ if (getcwd(cwd, sizeof(cwd)) != NULL)
+ return cwd;
+
+ IOResult = IO_ERROR_DUMMY;
+ return "";
+}
+
void __attribute__((overloadable)) fpcrtl_flush(Text f) {
fflush(f->fp);
}
diff -r 68eddcdc9f26 -r 989b2d54bed3 project_files/hwc/rtl/fileio.h
--- a/project_files/hwc/rtl/fileio.h Wed Apr 13 14:59:14 2016 +0200
+++ b/project_files/hwc/rtl/fileio.h Sun Apr 24 21:08:12 2016 +0200
@@ -75,4 +75,7 @@
bool fpcrtl_fileExists(string255 filename);
#define fpcrtl_FileExists fpcrtl_fileExists
+char * fpcrtl_getCurrentDir(void);
+#define fpcrtl_GetCurrentDir fpcrtl_getCurrentDir
+
#endif /* FILEIO_H_ */
diff -r 68eddcdc9f26 -r 989b2d54bed3 project_files/hwc/rtl/misc.c
--- a/project_files/hwc/rtl/misc.c Wed Apr 13 14:59:14 2016 +0200
+++ b/project_files/hwc/rtl/misc.c Sun Apr 24 21:08:12 2016 +0200
@@ -78,8 +78,8 @@
{
if(s.len < MAX_ANSISTRING_LENGTH)
{
+ ++s.len;
s.s[s.len] = c;
- ++s.len;
}
return s;
diff -r 68eddcdc9f26 -r 989b2d54bed3 project_files/hwc/rtl/pmath.h
--- a/project_files/hwc/rtl/pmath.h Wed Apr 13 14:59:14 2016 +0200
+++ b/project_files/hwc/rtl/pmath.h Sun Apr 24 21:08:12 2016 +0200
@@ -21,4 +21,17 @@
int __attribute__((overloadable)) fpcrtl_abs(int x);
int64_t __attribute__((overloadable)) fpcrtl_abs(int64_t x);
+/* emscripten cannot find math.h through our cmake */
+#ifdef EMSCRIPTEN
+double exp(double);
+double log(double);
+double sin(double);
+double cos(double);
+double fabs(double);
+double ceil(double);
+double sqrt(double);
+double atan(double);
+double atan2(double, double);
+#endif
+
#endif /* PMATH_H_ */
diff -r 68eddcdc9f26 -r 989b2d54bed3 project_files/hwc/rtl/system.c
--- a/project_files/hwc/rtl/system.c Wed Apr 13 14:59:14 2016 +0200
+++ b/project_files/hwc/rtl/system.c Sun Apr 24 21:08:12 2016 +0200
@@ -3,6 +3,7 @@
#include
#include
#include
+#include "pmath.h"
#ifndef M_PI
// some math.h do not have M_PI macros
diff -r 68eddcdc9f26 -r 989b2d54bed3 share/hedgewars/Data/Locale/fr.lua
--- a/share/hedgewars/Data/Locale/fr.lua Wed Apr 13 14:59:14 2016 +0200
+++ b/share/hedgewars/Data/Locale/fr.lua Sun Apr 24 21:08:12 2016 +0200
@@ -17,7 +17,7 @@
["A Classic Fairytale"] = "Un conte classique de fée",
["Actually, you aren't worthy of life! Take this..."] = "En fait, tu n'es pas digne de vivre ! Prends ça....",
["A cy-what?"] = "Un cy-quoi ?",
- ["Advanced Repositioning Mode"] = "Mode de repositionnement avancé"
+ ["Advanced Repositioning Mode"] = "Mode de repositionnement avancé",
["Adventurous"] = "Aventurier",
["a frenetic Hedgewars mini-game"] = "un mini-jeu frénétique d'HedgeWars", -- Frenzy
["Africa"] = "Afrique", -- Continental_supplies
diff -r 68eddcdc9f26 -r 989b2d54bed3 share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua
--- a/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua Wed Apr 13 14:59:14 2016 +0200
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_RCPlane_Challenge.lua Sun Apr 24 21:08:12 2016 +0200
@@ -487,4 +487,8 @@
function onAmmoStoreInit()
SetAmmo(amRCPlane, 9, 0, 0, 0)
-end
\ No newline at end of file
+end
+
+function onNewTurn()
+ SetWeapon(amRCPlane)
+end
diff -r 68eddcdc9f26 -r 989b2d54bed3 share/hedgewars/Data/Missions/Training/User_Mission_-_Rope_Knock_Challenge.lua
--- a/share/hedgewars/Data/Missions/Training/User_Mission_-_Rope_Knock_Challenge.lua Wed Apr 13 14:59:14 2016 +0200
+++ b/share/hedgewars/Data/Missions/Training/User_Mission_-_Rope_Knock_Challenge.lua Sun Apr 24 21:08:12 2016 +0200
@@ -4,6 +4,7 @@
local missionWon = nil
local endTimer = 1000
local hogsKilled = 0
+local finishTime
local HogData = {
{"Bufon", "ShaggyYeti",false},
@@ -57,21 +58,33 @@
}
function GenericEnd()
- DismissTeam(loc("Wannabe Shoppsta"))
- DismissTeam(loc("Unsuspecting Louts"))
- DismissTeam(loc("Unlucky Sods"))
+ EndGame()
end
function GameOverMan()
missionWon = false
- ShowMission(loc("ROPE-KNOCKING"), loc("MISSION FAILED"), loc("Oh no! Just try again!"), -amSkip, 0)
+ ShowMission(loc("Rope-knocking Challenge"), loc("Challenge over!"), loc("Oh no! Just try again!"), -amSkip, 0)
+ SendStat(siGameResult, loc("Challenge over!"))
+ local score = math.ceil((hogsKilled / 16)*6000)
+ SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, score))
+ SendStat(siPointType, "points")
+ SendStat(siPlayerKills, tostring(score), loc("Wannabe Shoppsta"))
PlaySound(sndHellish)
end
function GG()
missionWon = true
- ShowMission(loc("ROPE-KNOCKING"), loc("MISSION SUCCESS"), loc("Congratulations!") .. "|" .. loc("COMPLETION TIME") .. ": " .. (TurnTime - TurnTimeLeft) / 1000, 0, 0)
+ local completeTime = (TurnTime - finishTime) / 1000
+ ShowMission(loc("Rope-knocking Challenge"), loc("Challenge completed!"), loc("Congratulations!") .. "|" .. string.format(loc("Completion time: %.2fs"), completeTime), 0, 0)
PlaySound(sndHomerun)
+ SendStat(siGameResult, loc("Challenge completed!"))
+ local hogScore = math.ceil((hogsKilled / 16)*6000)
+ local timeScore = math.ceil((finishTime/TurnTime)*6000)
+ local score = hogScore + timeScore
+ SendStat(siCustomAchievement, string.format(loc("You have killed %d of 16 hedgehogs (+%d points)."), hogsKilled, hogScore))
+ SendStat(siCustomAchievement, string.format(loc("You have completed this challenge in %.2f s (+%d points)."), completeTime, timeScore))
+ SendStat(siPointType, "points")
+ SendStat(siPlayerKills, tostring(score), loc("Wannabe Shoppsta"))
end
function AssignCharacter(p)
@@ -114,16 +127,16 @@
MinesNum = 0
Explosives = 0
- AddTeam(loc("Wannabe Shoppsta"), 1175851, "Simple", "Island", "Default", "Hedgewars")
+ AddTeam(loc("Wannabe Shoppsta"), 0x11F12B, "Simple", "Island", "Default", "cm_shoppa")
hhs[0] = AddHog(loc("Ace"), 0, 1, "Gasmask")
SetGearPosition(player, 1380, 1500)
- AddTeam(loc("Unsuspecting Louts"), 14483456, "Simple", "Island", "Default", "Hedgewars")
+ AddTeam(loc("Unsuspecting Louts"), 0xDD0000, "Simple", "Island", "Default", "cm_face")
for i = 1, 8 do
hhs[i] = AddHog("generic", 0, 1, "NoHat")
end
- AddTeam(loc("Unlucky Sods"), 14483456, "Simple", "Island", "Default", "Hedgewars")
+ AddTeam(loc("Unlucky Sods"), 0xDD0000, "Simple", "Island", "Default", "cm_balrog")
for i = 9, 16 do
hhs[i] = AddHog("generic", 0, 1, "NoHat")
end
@@ -133,14 +146,16 @@
function onGameStart()
+ SendHealthStatsOff()
ShowMission (
- loc("ROPE-KNOCKING"),
- loc("a Hedgewars challenge"),
+ loc("Rope-knocking Challenge"),
+ loc("Challenge"),
loc("Use the rope to knock your enemies to their doom.") .. "|" ..
+ loc("Finish this challenge as fast as possible to earn bonus points."),
+ -amRope, 4000)
- "", -amRope, 4000
- )
+ PlaceGirder(46,1783, 0)
SetGearPosition(hhs[0], 2419, 1769)
SetGearPosition(hhs[1], 3350, 570)
@@ -180,9 +195,9 @@
end
if missionWon == true then
- AddCaption(loc("GG!"), 0xffba00ff,capgrpGameState)
+ AddCaption(loc("Victory!"), 0xFFFFFFFF,capgrpGameState)
else
- AddCaption(loc("Ouch!"), 0xffba00ff,capgrpGameState)
+ AddCaption(loc("Challenge over!"), 0xFFFFFFFF,capgrpGameState)
end
end
@@ -191,16 +206,18 @@
function onGearDamage(gear, damage)
- if gear ~= hhs[0] then
+ if gear ~= hhs[0] and GetGearType(gear) == gtHedgehog then
AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
DeleteGear(gear)
PlaySound(sndExplosion)
+ AddCaption(string.format(knockTaunt(), GetHogName(gear)), 0xFFFFFFFF, capgrpMessage)
hogsKilled = hogsKilled +1
if hogsKilled == 15 then
PlaySound(sndRideOfTheValkyries)
elseif hogsKilled == 16 then
+ finishTime = TurnTimeLeft
GG()
end
@@ -208,6 +225,37 @@
end
+function knockTaunt()
+ local r = math.random(0,23)
+ local taunt
+ if r == 0 then taunt = loc("%s has been knocked out.")
+ elseif r == 1 then taunt = loc("%s hit the ground.")
+ elseif r == 2 then taunt = loc("%s splatted.")
+ elseif r == 3 then taunt = loc("%s was smashed.")
+ elseif r == 4 then taunt = loc("%s felt unstable.")
+ elseif r == 5 then taunt = loc("%s exploded.")
+ elseif r == 6 then taunt = loc("%s fell from a high cliff.")
+ elseif r == 7 then taunt = loc("%s goes the way of the lemming.")
+ elseif r == 8 then taunt = loc("%s was knocked away.")
+ elseif r == 9 then taunt = loc("%s was really unlucky.")
+ elseif r == 10 then taunt = loc("%s felt victim to rope-knocking.")
+ elseif r == 11 then taunt = loc("%s had no chance.")
+ elseif r == 12 then taunt = loc("%s was a good target.")
+ elseif r == 13 then taunt = loc("%s spawned at a really bad position.")
+ elseif r == 14 then taunt = loc("%s was doomed from the beginning.")
+ elseif r == 15 then taunt = loc("%s has fallen victim to gravity.")
+ elseif r == 16 then taunt = loc("%s hates Newton.") -- Isaac Newton
+ elseif r == 17 then taunt = loc("%s had it coming.")
+ elseif r == 18 then taunt = loc("%s is eliminated!")
+ elseif r == 19 then taunt = loc("%s fell too fast.")
+ elseif r == 20 then taunt = loc("%s flew like a rock.")
+ elseif r == 21 then taunt = loc("%s stumpled.")
+ elseif r == 22 then taunt = loc("%s was shoved away.")
+ elseif r == 23 then taunt = loc("%s didn't expect that.")
+ end
+ return taunt
+end
+
function onGearDelete(gear)
if (gear == hhs[0]) and (missionWon == nil) then
@@ -219,3 +267,7 @@
function onAmmoStoreInit()
SetAmmo(amRope, 9, 0, 0, 0)
end
+
+function onNewTurn()
+ SetWeapon(amRope)
+end
diff -r 68eddcdc9f26 -r 989b2d54bed3 share/hedgewars/Data/Missions/Training/portal.lua
--- a/share/hedgewars/Data/Missions/Training/portal.lua Wed Apr 13 14:59:14 2016 +0200
+++ b/share/hedgewars/Data/Missions/Training/portal.lua Sun Apr 24 21:08:12 2016 +0200
@@ -2,13 +2,13 @@
HedgewarsScriptLoad("/Scripts/Utils.lua")
local MineArray = {}
-local player
+local player
local adviceGiven = false
local adviceGiven2 = false
function onGameInit()
Seed = 0 -- The base number for the random number generator
- GameFlags = gfInfAttack +gfBorder +gfDisableWind +gfSolidLand
+ GameFlags = gfInfAttack +gfBorder +gfDisableWind +gfSolidLand
TurnTime = 1500000 -- The time the player has to move each round (in ms)
CaseFreq = 0 -- The frequency of crate drops
MinesNum = 0 -- The number of mines being placed
@@ -16,32 +16,32 @@
Delay = 10 -- The delay between each round
Map = "portal" -- The map to be played
Theme = "Hell" -- The theme to be used
- Goals = loc("Use the portal to move fast and far, use it to kill, use it with caution!") --the goal ...
-
-
-----AddTeam(teamname, color, grave, fort, voicepack, flag)--
- AddTeam(loc("Subject"), 14483406, "Simple", "Island", "Default", "cm_star")
- player = AddHog(loc("player"), 0, 10, "Terminator_Glasses")
+ -- Disable Sudden Death
+ HealthDecrease = 0
+ WaterRise = 0
+
+ AddTeam(loc("Subjects"), 0xFFFF01, "Simple", "Island", "Default", "cm_test")
+ player = AddHog(loc("Subject 1"), 0, 10, "Terminator_Glasses")
- AddTeam(loc("Hell Army"), 1170801, "Simple", "Island", "Default", "cm_galaxy")
- enemy1 = AddHog(loc("Lucifer"), 1, 200, "thinkingcap")
- enemy2 = AddHog(loc("voldemort"), 1, 150, "WizardHat")
- enemy3 = AddHog(loc("zombi"), 1, 100, "zombi")
- enemy4 = AddHog(loc("Predator"), 1, 14, "predator")
- enemy5 = AddHog(loc("oneye"), 1, 50, "cyclops")
- enemy6 = AddHog(loc("razac"), 1, 50, "plaguemask")
+ AddTeam(loc("Hell Army"), 0xFF0402, "skull", "Island", "Default", "cm_hellish")
+ enemy1 = AddHog(loc("Lucifer"), 1, 200, "InfernalHorns")
+ enemy2 = AddHog(loc("Voldemort"), 1, 150, "WizardHat")
+ enemy3 = AddHog(loc("Zombi"), 1, 100, "Zombi")
+ enemy4 = AddHog(loc("Predator"), 1, 14, "anzac")
+ enemy5 = AddHog(loc("Oneye"), 1, 50, "cyclops")
+ enemy6 = AddHog(loc("Razac"), 1, 50, "Evil")
enemy7 = AddHog(loc("C-2"), 1, 50, "cyborg1")
enemy8 = AddHog(loc("Rider"), 1, 50, "scif_SparkssHelmet")
- AddTeam(loc("badmad"), 1170801, "Simple", "Island", "Default", "cm_jupiter")
+ AddTeam(loc("Badmad"), 0xFF0402, "skull", "Island", "Default", "cm_pentagram")
enemy9 = AddHog(loc("C-1"), 1, 50, "cyborg2")
- enemy10 = AddHog(loc("hiden"), 1, 40, "daftpunkguymanuel")
- enemy11 = AddHog(loc("ronald"), 1, 70, "clown")
- enemy12 = AddHog(loc("phosphatoglucidique"), 1, 50, "chef")
- enemy13 = AddHog(loc("Lestat"), 1, 30, "draculakz")
+ enemy10 = AddHog(loc("Hidden"), 1, 40, "bushhider")
+ enemy11 = AddHog(loc("Ronald"), 1, 70, "clown")
+ enemy12 = AddHog(loc("Phosphat"), 1, 50, "chef")
+ enemy13 = AddHog(loc("Lestat"), 1, 30, "vampirichog")
SetGearPosition(player, 350, 1820)
- SetGearPosition(enemy1, 2037, 1313)
+ SetGearPosition(enemy1, 2037, 1313)
SetGearPosition(enemy2, 1369, 1605)
SetGearPosition(enemy3, 1750, 1937)
SetGearPosition(enemy4, 3125, 89)
@@ -55,8 +55,6 @@
SetGearPosition(enemy12, 2666, 950)
SetGearPosition(enemy13, 3306, 1205)
-
-
end
function onAmmoStoreInit()
@@ -80,11 +78,7 @@
function onGameStart()
- SetWind(100)-- SetWind(windSpeed) Sets the current wind in the range of -100 to 100. Use together with gfDisableWind for full control.
- -- -100to0 is to the left, and 0to100 is to the right (of course more its far from 0, more the speed is high
- -- -100.............................0..................................+100
- -- <<<<<<<<--<<--<<<<<<<<<<<<<--<<<<<|||-->>>>>>>>-->>>>>>>>>>>>>>>-->>>>>> = wind direction
-
+ SetWind(100)
MineArray[0] = AddGear(840, 1847, gtMine, 0, 0, 0, 0)
MineArray[1] = AddGear(900, 1847, gtMine, 0, 0, 0, 0)
@@ -124,16 +118,14 @@
MineArray[34] = AddGear(1311, 1785, gtMine, 0, 0, 0, 0)
MineArray[35] = AddGear(4029, 89, gtMine, 0, 0, 0, 120)
- --MineArray[36] = AddGear(3376, 1947, gtMine, 0, 0, 0, 10)
- for i = 0,#MineArray do
- SetTimer(MineArray[i],050)
- SetState(MineArray[i],544)
- end
- --needed this MineArray cause timer didn't work, its was always 3sec, i wanna instant mines
+ for i = 0,#MineArray do
+ SetTimer(MineArray[i],050)
+ SetState(MineArray[i],544)
+ end
+ --needed this MineArray cause timer didn't work, its was always 3sec, i wanna instant mines
-
- --UTILITY CRATE--
+ --UTILITY CRATE--
parachute = SpawnUtilityCrate(1670, 1165, amParachute)
girder = SpawnUtilityCrate(2101, 1297, amGirder)
SpawnUtilityCrate(3965, 625, amBlowTorch)
@@ -144,9 +136,9 @@
SpawnUtilityCrate(130, 600, amPickHammer)
SpawnUtilityCrate(1660,1820, amLaserSight)
SpawnUtilityCrate(4070,1840, amLaserSight)
-
-
- --AMMO CRATE--
+
+
+ --AMMO CRATE--
portalgun = SpawnAmmoCrate(505, 1943, amPortalGun, 1000)
extratime = SpawnAmmoCrate(4020, 785, amExtraTime, 2)
SpawnAmmoCrate(425, 613, amSnowball)
@@ -159,77 +151,55 @@
SpawnAmmoCrate(2900, 1400, amRope)
SpawnAmmoCrate(4025, 1117, amFirePunch)
-
- --HEALTH CRATE--
+ --HEALTH CRATE--
SpawnHealthCrate(2000, 780)
-
- --GIRDER--
+
+ --GIRDER--
PlaceGirder(3363, 1323, 4)
-
- ShowMission (loc("Portal mission"), loc("training"), "", -amPortalGun, 5000)
- HogSay(player, loc("I should get myself a portal gun, maybe this crate has one"), SAY_THINK)
-
-
-
+ ShowMission (loc("Portal Mind Challenge"), loc("Mission"),
+ loc("Defeat all enemies!") .. "|" .. loc("In this mission you have infinite time."),
+ -amPortalGun, 5000)
+ HogSay(player, loc("I should get myself a portal device, maybe this crate has one."), SAY_THINK)
end
function onGameTick()
- if (player ~= nil) then
+ if (player ~= nil) then
if (gearIsInBox(player, 1650, 1907, 200, 60) and (adviceGiven == false)) then
adviceGiven = true
- HogSay(player, loc("Hmmm, I'll have to find some way of moving him off this anti-portal surface..."), SAY_THINK)
+ HogSay(player, loc("Hmmm, I’ll have to find some way of moving him off this anti-portal surface."), SAY_THINK)
elseif (gearIsInBox(player, 2960, 790, 200, 60) and (adviceGiven2 == false)) then
adviceGiven2 = true
- HogSay(player, loc("The anti-portal zone is all over the floor, and I have nothing to kill him...Droping something could hurt him enough to kill him..."), SAY_THINK)
- end
- end
-
+ HogSay(player, loc("The anti-portal surface is all over the floor, and I have nothing to kill him. Dropping something could hurt him enough to kill him."), SAY_THINK)
+ end
end
-
-
-
-
-function onNewturn()
-end
-
-
-function onGearAdd(gear)
end
function onGearDelete(gear)
+ -- Check gear collection
+ if CurrentHedgehog == player and (band(GetGearMessage(gear), gmDestroy) ~= 0) then
+ if gear == portalgun then
+ HogSay(player, loc("Great! Let’s kill all these enemies, using portals."), SAY_THINK)
+ end
- if gear == portalgun then
- --AddAmmo(player, amPortalGun, 10000)
- HogSay(player, loc("GREAT ! Let's kill all this enemies, using portals"), SAY_THINK)
+ if gear == girder then
+ HogSay(player, loc("This will be useful when I need a new platform or if I want to rise."), SAY_THINK)
+ end
+
+ if gear == parachute then
+ HogSay(player, loc("You can’t open a portal on the blue surface."), SAY_THINK)
+ end
+
+ if gear == extratime then
+ HogSay(player, loc("What?! For all this struggle I just win some ... time? Oh dear!"), SAY_SHOUT)
+ end
end
- if gear == girder then
- HogSay(player, loc("Will be useful if I need a new plateform or if I want to rise...."), SAY_THINK)
- end
-
- if gear == parachute then
- HogSay(player, loc("You can't fire a portal on the blue surface"), SAY_THINK)
+ if gear == player then
+ player = nil
end
---if you wanted to check for collection only
---you could probably say
---if (gear == myParachuteGear) and (band(GetGearMessage(gear), gmDestroy) ~= 0) then
-
- if gear == extratime then
- HogSay(player, loc(" What !! For all of this struggle i just win some ... TIME o0"), SAY_SHOUT)
- end
-
-
- if gear == player then
- player = nil
- end
end
-
-
-
-
-
diff -r 68eddcdc9f26 -r 989b2d54bed3 share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua Wed Apr 13 14:59:14 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua Sun Apr 24 21:08:12 2016 +0200
@@ -1,6 +1,6 @@
------------------------------------------
--- RACER 0.6
+-- RACER 0.8
-- map-independant racing script
-- by mikade
-----------------------------------------
@@ -73,6 +73,11 @@
-- switch to first available weapon if starting race with no weapon selected
+-------
+-- 0.8
+-------
+-- allow different boost directions
+
-----------------------------
-- SCRIPT BEGINS
-----------------------------
@@ -151,6 +156,10 @@
local lastRound
local RoundHasChanged
+local boostX = 0
+local boostY = 0
+local boostValue = 1
+
-------------------
-- general methods
-------------------
@@ -224,6 +233,31 @@
-- RACER METHODS
-----------------
+function onLeft()
+ boostX = boostX +boostValue
+end
+function onLeftUp()
+ boostX = boostX -boostValue
+end
+function onRight()
+ boostX = boostX -boostValue
+end
+function onRightUp()
+ boostX = boostX +boostValue
+end
+function onUp()
+ boostY = boostY +boostValue
+end
+function onUpUp()
+ boostY = boostY -boostValue
+end
+function onDown()
+ boostY = boostY -boostValue
+end
+function onDownUp()
+ boostY = boostY +boostValue
+end
+
function CheckWaypoints()
trackFinished = true
@@ -658,7 +692,7 @@
trackTime = 0
SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
- AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
+ AddGear(GetX(CurrentHedgehog)+boostX, GetY(CurrentHedgehog)+boostY, gtGrenade, 0, 0, 0, 1)
FollowGear(CurrentHedgehog)
HideMission()