# HG changeset patch # User Xeli # Date 1319819618 -7200 # Node ID 3106add9a5bfffcefc4c716ae8fbc28050276d98 # Parent 42b256eca3627a2fc5e21edccc29f38fe577eabb# Parent 3f8ba061775ebabdc797e12999ae86e74b403633 merge diff -r 3f8ba061775e -r 3106add9a5bf .hgignore --- a/.hgignore Fri Oct 28 18:27:55 2011 +0200 +++ b/.hgignore Fri Oct 28 18:33:38 2011 +0200 @@ -8,7 +8,7 @@ glob:*.hi glob:*.*~ glob:*.core -glob:hedgewars/config.inc +glob:config.inc glob:cmake_install.cmake glob:QTfrontend/hwconsts.cpp glob:CPackConfig.cmake diff -r 3f8ba061775e -r 3106add9a5bf .hgtags --- a/.hgtags Fri Oct 28 18:27:55 2011 +0200 +++ b/.hgtags Fri Oct 28 18:33:38 2011 +0200 @@ -45,3 +45,4 @@ 718f98a9df122d73f3ba9add4d1654865199de31 Hedgewars-iOS-1.3 cba92708277b6d0aeabfff2b878845b7d848bdcd Hedgewars-iOS-1.3.1 74bc72746bec68806344f4ba7be0d1bc6e05d380 0.9.16-release +652a199d4f38f5becbec0839f5a1f63294dd89bf Hedgewars-iOS-1.3.2 diff -r 3f8ba061775e -r 3106add9a5bf CMakeLists.txt --- a/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -132,17 +132,17 @@ endif(APPLE) -#this snippet sets "Release" mode by default +#build Debug only when explicitally set if (NOT CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: None Debug Release." FORCE) + set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: Debug Release." FORCE) endif (NOT CMAKE_BUILD_TYPE) -if(CMAKE_BUILD_TYPE MATCHES RELEASE OR CMAKE_BUILD_TYPE MATCHES "Release") +if(CMAKE_BUILD_TYPE MATCHES DEBUG OR CMAKE_BUILD_TYPE MATCHES "Debug" OR CMAKE_BUILD_TYPE MATCHES "debug") + message(STATUS "Building Debug") + set(Optz false) +else() message(STATUS "Building Release") set(Optz true) -else() - message(STATUS "Building Debug") - set(Optz false) endif() diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/AbstractPage.h --- a/QTfrontend/AbstractPage.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef ABSTRACTPAGE_H -#define ABSTRACTPAGE_H - -#include -#include -#include -#include -#include -#include - -class QPushButton; -class QGroupBox; -class QComboBox; -class QLabel; -class QToolBox; -class QLineEdit; -class QListWidget; -class QCheckBox; -class QSpinBox; -class QTextEdit; -class QRadioButton; -class QTableView; -class QTextBrowser; -class QTableWidget; -class QAction; -class QDataWidgetMapper; -class QAbstractItemModel; -class QSettings; -class QSlider; - -class AbstractPage : public QWidget -{ - Q_OBJECT - - signals: - void goBack(); - - protected: - AbstractPage(QWidget* parent = 0) { - Q_UNUSED(parent); - - font14 = new QFont("MS Shell Dlg", 14); - //setFocusPolicy(Qt::StrongFocus); - } - virtual ~AbstractPage() {}; - - QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) { - QPushButton* butt = new QPushButton(this); - if (!iconed) { - butt->setFont(*font14); - butt->setText(btname); - //butt->setStyleSheet("background-color: #0d0544"); - } else { - const QIcon& lp=QIcon(btname); - QSize sz = lp.actualSize(QSize(65535, 65535)); - butt->setIcon(lp); - butt->setFixedSize(sz); - butt->setIconSize(sz); - butt->setFlat(true); - butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - } - grid->addWidget(butt, wy, wx); - return butt; - }; - - QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { - QPushButton* butt = new QPushButton(this); - if (!iconed) { - butt->setFont(*font14); - butt->setText(btname); - } else { - const QIcon& lp=QIcon(btname); - QSize sz = lp.actualSize(QSize(65535, 65535)); - butt->setIcon(lp); - butt->setFixedSize(sz); - butt->setIconSize(sz); - butt->setFlat(true); - butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - } - grid->addWidget(butt, wy, wx, rowSpan, columnSpan); - return butt; - }; - - QPushButton* addButton(QString btname, QBoxLayout* box, int where, bool iconed = false) { - QPushButton* butt = new QPushButton(this); - if (!iconed) { - butt->setFont(*font14); - butt->setText(btname); - } else { - const QIcon& lp=QIcon(btname); - QSize sz = lp.actualSize(QSize(65535, 65535)); - butt->setIcon(lp); - butt->setFixedSize(sz); - butt->setIconSize(sz); - butt->setFlat(true); - butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - } - box->addWidget(butt, where); - return butt; - }; - - QFont * font14; -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -14,7 +14,7 @@ include(${QT_USE_FILE}) # Check if we need zlib -check_library_exists(${QT_QTCORE_LIBRARY} inflateInit2_ ${QT_LIBRARY_DIR} QT_PROVIDES_ZLIB_FUNCTIONS) +check_library_exists("${QT_QTCORE_LIBRARY}" inflateInit2_ ${QT_LIBRARY_DIR} QT_PROVIDES_ZLIB_FUNCTIONS) if(NOT QT_PROVIDES_ZLIB_FUNCTIONS) find_package(ZLIB REQUIRED) @@ -28,6 +28,13 @@ find_package(SDL_mixer REQUIRED) include_directories(.) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/model) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/net) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/dialog) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/page) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ui/widget) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/util) include_directories(${SDL_INCLUDE_DIR}) include_directories(${SDLMIXER_INCLUDE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/misc/quazip) @@ -57,76 +64,27 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hwconsts.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp) +file(GLOB NetCpp net/*.cpp) +file(GLOB ModelCpp model/*.cpp) +file(GLOB_RECURSE UIcpp ui/*.cpp) +file(GLOB UtilCpp util/*.cpp) + set(hwfr_src - HWApplication.cpp + ${ModelCpp} + ${NetCpp} + ${UIcpp} + ${UtilCpp} + achievements.cpp + binds.cpp + drawmapscene.cpp game.cpp + gameuiconfig.cpp + HWApplication.cpp + hwform.cpp main.cpp - hwform.cpp team.cpp - namegen.cpp - teamselect.cpp - teamselhelper.cpp - frameTeam.cpp - vertScrollArea.cpp - gameuiconfig.cpp ui_hwform.cpp - gamecfgwidget.cpp - pagemain.cpp - pageeditteam.cpp - pagemultiplayer.cpp - pageoptions.cpp - pagenet.cpp - pagenetserver.cpp - pagenetgame.cpp - pageinfo.cpp - pagedata.cpp - pagesingleplayer.cpp - pagetraining.cpp - pagecampaign.cpp - pageselectweapon.cpp - pageingame.cpp - pageroomslist.cpp - pageconnecting.cpp - pagescheme.cpp - pagegamestats.cpp - pageplayrecord.cpp - pageadmin.cpp - pagenettype.cpp - pagedrawmap.cpp - SquareLabel.cpp - hats.cpp - hedgehogerWidget.cpp - hwmap.cpp - mapContainer.cpp - tcpBase.cpp - about.cpp - proto.cpp - fpsedit.cpp - netserver.cpp - newnetclient.cpp - netudpserver.cpp - netudpwidget.cpp - netregister.cpp - netserverslist.cpp - chatwidget.cpp - binds.cpp - SDLs.cpp ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp - selectWeapon.cpp - itemNum.cpp - input_ip.cpp - igbox.cpp - weaponItem.cpp - misc.cpp - ammoSchemeModel.cpp - togglebutton.cpp - bgwidget.cpp - achievements.cpp - qaspectratiolayout.cpp - drawmapwidget.cpp - drawmapscene.cpp - themesmodel.cpp - databrowser.cpp ) #xfire integration @@ -145,77 +103,33 @@ set(hwfr_src ${hwfr_src} hedgewars.rc) endif(MINGW) +file(GLOB ModelHdr model/*.h) +file(GLOB NetHdr net/*.h) +file(GLOB_RECURSE UIhdr ui/*.h) +file(GLOB UtilHdr util/*.h) + + set(hwfr_moc_hdrs - HWApplication.h + ${ModelHdr} + ${NetHdr} + ${UIhdr} + drawmapscene.h game.h - hats.h - hwform.h - teamselect.h - teamselhelper.h - frameTeam.h - vertScrollArea.h gameuiconfig.h - gamecfgwidget.h - AbstractPage.h - pagenet.h - pagemultiplayer.h - pagenetserver.h - pageingame.h - pagetraining.h - pageeditteam.h - pageoptions.h - pagemain.h - pageinfo.h - pagedata.h - pagesingleplayer.h - pagenettype.h - pageconnecting.h - pagedrawmap.h - pagecampaign.h - pagenetgame.h - pageroomslist.h - pagegamestats.h - pageadmin.h - pagescheme.h - pageselectweapon.h - pageplayrecord.h - SquareLabel.h - hedgehogerWidget.h - hwmap.h - mapContainer.h - tcpBase.h - about.h - proto.h - fpsedit.h - netserver.h - newnetclient.h - netudpserver.h - netudpwidget.h - netregister.h - netserverslist.h - chatwidget.h - SDLs.h - selectWeapon.h - itemNum.h - input_ip.h - igbox.h - weaponItem.h - misc.h - ammoSchemeModel.h - togglebutton.h - bgwidget.h - qaspectratiolayout.h - drawmapwidget.h - drawmapscene.h - themesmodel.h - databrowser.h + HWApplication.h + hwform.h + team.h ) set(hwfr_hdrs + ${UtilHdr} + team.h + achievements.h binds.h ui_hwform.h KB.h hwconsts.h + sdlkeys.h ) set(hwfr_rez hedgewars.qrc) diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/Doxyfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/Doxyfile Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1679 @@ +# Doxyfile 1.7.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "Hedgewars Qt-Frontend" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = $(PROJECT_NUMBER) + +# Using the PROJECT_BRIEF tag one can provide an optional one line description for a project that appears at the top of each page and should give viewer a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "The default frontend of hedgewars." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = res/teamicon2.png + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = $(OUTPUT_DIRECTORY) + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = "repo{1}=http://code.google.com/p/hedgewars/source/browse/QTfrontend/\1" + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even if there is only one candidate or it is obvious which candidate to choose by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. The create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = NO + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the stylesheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.hedgewars + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [0,1..20]) +# that doxygen will group on one line in the generated HTML documentation. +# Note that a value of 0 will completely suppress the enum values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list. + +USE_INLINE_TREES = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the mathjax.org site, so you can quickly see the result without installing +# MathJax, but it is strongly recommended to install a local copy of MathJax +# before deployment. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will write a font called Helvetica to the output +# directory and reference it in all dot files that doxygen generates. +# When you want a differently looking font you can specify the font name +# using DOT_FONTNAME. You need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, svg, gif or svg. +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/HWApplication.h --- a/QTfrontend/HWApplication.h Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/HWApplication.h Fri Oct 28 18:33:38 2011 +0200 @@ -25,6 +25,14 @@ class HWForm; +/** + * @brief Main class of the Qt application. + * + * By default uses :res/css/qt.css as style sheet for the main form. + * See \repo{res/css/qt.css} for a more detailed description. + * + * @see http://doc.qt.nokia.com/4.5/stylesheet.html + */ class HWApplication : public QApplication { Q_OBJECT diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/SDLs.cpp --- a/QTfrontend/SDLs.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "SDLs.h" - -#include "SDL.h" -#include "SDL_mixer.h" -#include "hwconsts.h" -#include "HWApplication.h" - - -extern char sdlkeys[1024][2][128]; -extern char xb360buttons[][128]; -extern char xb360dpad[128]; -extern char xbox360axes[][128]; - - -SDLInteraction::SDLInteraction() -{ - - SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK); - - musicInitialized = 0; - music = NULL; - if(SDL_NumJoysticks()) - addGameControllerKeys(); - SDL_QuitSubSystem(SDL_INIT_JOYSTICK); -} - -SDLInteraction::~SDLInteraction() -{ - if (musicInitialized == 1) { - if (music != NULL) - Mix_FreeMusic(music); - Mix_CloseAudio(); - } - SDL_Quit(); -} - -QStringList SDLInteraction::getResolutions() const -{ - QStringList result; - - SDL_Rect **modes; - - modes = SDL_ListModes(NULL, SDL_FULLSCREEN); - - if((modes == (SDL_Rect **)0) || (modes == (SDL_Rect **)-1)) - { - result << "640x480"; - } else - { - for(int i = 0; modes[i]; ++i) - if ((modes[i]->w >= 640) && (modes[i]->h >= 480)) - result << QString("%1x%2").arg(modes[i]->w).arg(modes[i]->h); - } - - return result; -} - -void SDLInteraction::addGameControllerKeys() const -{ - QStringList result; - - int i = 0; - while(i < 1024 && sdlkeys[i][1][0] != '\0') - i++; - - // Iterate through all game controllers - for(int jid = 0; jid < SDL_NumJoysticks(); jid++) - { - SDL_Joystick* joy = SDL_JoystickOpen(jid); - - // Retrieve the game controller's name and strip "Controller (...)" that's added by some drivers (English only) - QString joyname = QString(SDL_JoystickName(jid)).replace(QRegExp("^Controller \\((.*)\\)$"), "\\1"); - - // Connected Xbox 360 controller? Use specific button names then - // Might be interesting to add 'named' buttons for the most often used gamepads - bool isxb = joyname.contains("Xbox 360"); - - // This part of the string won't change for multiple keys/hats, so keep it - QString prefix = QString("%1 (%2): ").arg(joyname).arg(jid + 1); - - // Register entries for missing axes not assigned to sticks of this joystick/gamepad - for(int aid = 0; aid < SDL_JoystickNumAxes(joy) && i < 1021; aid++) - { - // Again store the part of the string not changing for multiple uses - QString axis = prefix + HWApplication::translate("binds (keys)", "Axis") + QString(" %1 ").arg(aid + 1); - - // Entry for "Axis Up" - sprintf(sdlkeys[i][0], "j%da%du", jid, aid); - sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2])) : axis + HWApplication::translate("binds (keys)", "(Up)")).toUtf8().constData()); - - // Entry for "Axis Down" - sprintf(sdlkeys[i][0], "j%da%dd", jid, aid); - sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2 + 1])) : axis + HWApplication::translate("binds (keys)", "(Down)")).toUtf8().constData()); - } - - // Register entries for all coolie hats of this joystick/gamepad - for(int hid = 0; hid < SDL_JoystickNumHats(joy) && i < 1019; hid++) - { - // Again store the part of the string not changing for multiple uses - QString hat = prefix + (isxb ? (HWApplication::translate("binds (keys)", xb360dpad) + QString(" ")) : HWApplication::translate("binds (keys)", "Hat") + QString(" %1 ").arg(hid + 1)); - - // Entry for "Hat Up" - sprintf(sdlkeys[i][0], "j%dh%du", jid, hid); - sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Up)")).toUtf8().constData()); - - // Entry for "Hat Down" - sprintf(sdlkeys[i][0], "j%dh%dd", jid, hid); - sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Down)")).toUtf8().constData()); - - // Entry for "Hat Left" - sprintf(sdlkeys[i][0], "j%dh%dl", jid, hid); - sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Left)")).toUtf8().constData()); - - // Entry for "Hat Right" - sprintf(sdlkeys[i][0], "j%dh%dr", jid, hid); - sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Right)")).toUtf8().constData()); - } - - // Register entries for all buttons of this joystick/gamepad - for(int bid = 0; bid < SDL_JoystickNumButtons(joy) && i < 1022; bid++) - { - // Buttons - sprintf(sdlkeys[i][0], "j%db%d", jid, bid); - sprintf(sdlkeys[i++][1], "%s", (prefix + ((isxb && bid < 10) ? (HWApplication::translate("binds (keys)", xb360buttons[bid]) + QString(" ")) : HWApplication::translate("binds (keys)", "Button") + QString(" %1").arg(bid + 1))).toUtf8().constData()); - } - // Close the game controller as we no longer need it - SDL_JoystickClose(joy); - } - - // Terminate the list - sdlkeys[i][0][0] = '\0'; - sdlkeys[i][1][0] = '\0'; -} - -void SDLInteraction::SDLMusicInit() -{ - if (musicInitialized == 0) { - SDL_Init(SDL_INIT_AUDIO); - Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024); - musicInitialized = 1; - } -} - - -void SDLInteraction::StartMusic() -{ - SDLMusicInit(); - QFile tmpfile; - - tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Music/main_theme.ogg"); - if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "/Music/main_theme.ogg"); - if (music == NULL) { - music = Mix_LoadMUS(QFileInfo(tmpfile).absoluteFilePath().toLocal8Bit().constData()); - - } - Mix_VolumeMusic(MIX_MAX_VOLUME - 28); - Mix_FadeInMusic(music, -1, 1750); -} - -void SDLInteraction::StopMusic() -{ - if (music != NULL) { - // fade out music to finish 0,5 seconds from now - while(!Mix_FadeOutMusic(1000) && Mix_PlayingMusic()) { - SDL_Delay(100); - } - } -} - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/SDLs.h --- a/QTfrontend/SDLs.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef SDLS_H -#define SDLS_H - - -#include -#include "SDL_mixer.h" - - -class SDLInteraction : public QObject -{ - Q_OBJECT - -private: - Mix_Music *music; - int musicInitialized; - -public: - SDLInteraction(); - ~SDLInteraction(); - QStringList getResolutions() const; - void addGameControllerKeys() const; - void StartMusic(); - void StopMusic(); - void SDLMusicInit(); -}; - - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/SquareLabel.cpp --- a/QTfrontend/SquareLabel.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include "SquareLabel.h" -#include "hwform.h" - -SquareLabel::SquareLabel(QWidget * parent) : - QWidget(parent) -{ - if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true); -} - -void SquareLabel::paintEvent(QPaintEvent * event) -{ - Q_UNUSED(event); - - QPainter painter(this); - int pixsize; - if (width() > height()) { - pixsize = height(); - painter.translate((width() - pixsize) / 2, 0); - } else { - pixsize = width(); - painter.translate(0, (height() - pixsize) / 2); - } - painter.drawPixmap(0, 0, pixsize, pixsize, pixmap.scaled(pixsize, pixsize, Qt::KeepAspectRatio)); -} - -void SquareLabel::setPixmap(const QPixmap & pixmap) -{ - this->pixmap = pixmap; - repaint(); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/SquareLabel.h --- a/QTfrontend/SquareLabel.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _SQUARELABEL_H -#define _SQUARELABEL_H - -#include -#include - -class SquareLabel : public QWidget -{ - Q_OBJECT - -public: - SquareLabel(QWidget * parent = 0); - - void setPixmap(const QPixmap & pixmap); -protected: - virtual void paintEvent(QPaintEvent * event); - -private: - QPixmap pixmap; - -}; - -#endif // _SQUARELABEL_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/about.cpp --- a/QTfrontend/about.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include "about.h" -#include "hwconsts.h" - -About::About(QWidget * parent) : - QWidget(parent) -{ - QGridLayout *mainLayout = new QGridLayout(this); - - QLabel *imageLabel = new QLabel; - QImage image(":/res/Hedgehog.png"); - imageLabel->setPixmap(QPixmap::fromImage(image)); - imageLabel->setScaledContents(true); - imageLabel->setMinimumWidth(2.8); - imageLabel->setMaximumWidth(280); - imageLabel->setMinimumHeight(30); - imageLabel->setMaximumHeight(300); - - mainLayout->addWidget(imageLabel, 0, 0, 2, 1); - - QLabel *lbl1 = new QLabel(this); - lbl1->setOpenExternalLinks(true); - lbl1->setText( - "" - "

Hedgewars

" - "

" + QLabel::tr("Version") + " " + *cVersionString + "

" - "

http://www.hedgewars.org/


" + - QLabel::tr("This program is distributed under the GNU General Public License") + - "
" - ); - lbl1->setWordWrap(true); - mainLayout->addWidget(lbl1, 0, 1); - - QTextBrowser *lbl2 = new QTextBrowser(this); - - lbl2->setOpenExternalLinks(true); - lbl2->setText( - "" + - QString("

") + - QLabel::tr("Developers:") + - "

" - "Engine, frontend, net server: Andrey Korotaev <unC0Rr@gmail.com>
" - "Many frontend improvements: Igor Ulyanov <disinbox@gmail.com>
" - "Many engine and frontend improvements: Derek Pomery <nemo@m8y.org>
" - "Drill rocket, Ballgun, RC Plane weapons: Martin Boze <afffect@gmail.com>
" - "Mine number and time game settings: David A. Cuadrado <krawek@gmail.com>
" - "Frontend improvements: Martin Minarik <ttsmj@pokec.sk>
" - "Frontend improvements: Kristian Lehmann <email@thexception.net>
" - "Mac OS X/iPhone port, OpenGL-ES conversion: Vittorio Giovara <vittorio.giovara@gmail.com>
" - "Many engine and frontend improvements (and bugs): Richard Karolyi <sheepluva@" "ercatec.net>
" - "Gamepad and Lua integration: Mario Liebisch <mario.liebisch@gmail.com>
" - "Many engine improvements and graphics: Carlos Vives <mail@carlosvives.es>
" - "Maze maps: Henning Kühn <prg@cooco.de>
" - "Engine and frontend improvements: Henrik Rostedt <henrik.rostedt@gmail.com>
" - "Lua game modes and missions: John Lambert <redgrinner@gmail.com>
" - "Frontend improvements: Mayur Pawashe <zorgiepoo@gmail.com>
" - "Android port: Richard Deurwaarder <xeli@xelification.com>
" - "

" + - - QLabel::tr("Art:") + "

" - + QString::fromUtf8( - "

John Dum <fizzy@gmail.com>" - "
" - "Joshua Frese <joshfrese@gmail.com>" - "
" - "Stanko Tadić <stanko@mfhinc.net>" - "
" - "Julien Koesten <julienkoesten@aol.com>" - "
" - "Joshua O'Sullivan <coheedftw@hotmail.co.uk>" - "
" - "Nils Lück <nils.luck.design@gmail.com>" - "
" - "Guillaume Englert <genglert@hybird.org>" - "
" - "Hats: Trey Perry <tx.perry.j@gmail.com>" - "

") + - QLabel::tr("Sounds:") + "

" - "Hedgehogs voice: Stephen Alexander <ArmagonNo1@gmail.com>" - "
" - "John Dum <fizzy@gmail.com>" - "
" - "Jonatan Nilsson <jonatanfan@gmail.com>" - "
" - "Daniel Martin <elhombresinremedio@gmail.com>" - "

" + - - QLabel::tr("Translations:") + "

" - + QString::fromUtf8( - "Brazilian Portuguese: Romulo Fernandes Machado <abra185@gmail.com>
" - "Bulgarian: Svetoslav Stefanov
" - "Czech: Petr ŘezáÄek <rezacek@gmail.com>
" - "Chinese: Jie Luo <lililjlj@gmail.com>
" - "English: Andrey Korotaev <unC0Rr@gmail.com>
" - "Finnish: Nina Kuisma <ninnnu@gmail.com>
" - "French: Antoine Turmel <geekshadow@gmail.com>
" - "German: Peter Hüwe <PeterHuewe@gmx.de>, Mario Liebisch <mario.liebisch@gmail.com>, Richard Karolyi <sheepluva@" "ercatec.net>
" - "Greek: <talos_kriti@yahoo.gr>
" - "Italian: Luca Bonora <bonora.luca@gmail.com>, Marco Bresciani
" - "Japanese: ADAM Etienne <etienne.adam@gmail.com>
" - "Korean: Anthony Bellew <webmaster@anthonybellew.com>
" - "Lithuanian: Lukas Urbonas <lukasu08@gmail.com>
" - "Polish: Maciej Mroziński <mynick2@o2.pl>, Wojciech Latkowski <magik17l@gmail.com>, Piotr Mitana, Maciej Górny
" - "Portuguese: Fábio Canário <inufabie@gmail.com>
" - "Russian: Andrey Korotaev <unC0Rr@gmail.com>
" - "Slovak: Jose Riha
" - "Spanish: Carlos Vives <mail@carlosvives.es>
" - "Swedish: Niklas Grahn <raewolusjoon@yaoo.com>, Henrik Rostedt <henrik.rostedt@gmail.com>
" - "Ukrainian: Eugene V. Lyubimkin <jackyf.devel@gmail.com>, Igor Paliychuk <mansonigor@gmail.com>, Eugene Sakara <eresid@gmail.com>" - "

") + - - QLabel::tr("Special thanks:") + "

" - "Aleksey Andreev <blaknayabr@gmail.com>
" - "Aleksander Rudalev <alexv@pomorsu.ru>
" - "Natasha Korotaeva <layout@pisem.net>
" - "Adam Higerd (aka ahigerd at FreeNode)" - "

" - ); - mainLayout->addWidget(lbl2, 1, 1); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/about.h --- a/QTfrontend/about.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _ABOUT_H -#define _ABOUT_H - -#include - - -class About : public QWidget -{ - Q_OBJECT - -public: - About(QWidget * parent = 0); -}; - -#endif // _ABOUT_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ammoSchemeModel.cpp --- a/QTfrontend/ammoSchemeModel.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,786 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2005-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "ammoSchemeModel.h" -#include "hwconsts.h" - -QList defaultScheme = QList() - << QVariant("Default") // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(false) // shared ammo 15 - << QVariant(false) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(45) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(5) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(4) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(2) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - -AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) : - QAbstractTableModel(parent), - fileConfig(fileName, QSettings::IniFormat) -{ - predefSchemesNames = QStringList() - << "Default" - << "Pro Mode" - << "Shoppa" - << "Clean Slate" - << "Minefield" - << "Barrel Mayhem" - << "Tunnel Hogs" - << "Fort Mode" - << "Timeless" - << "Thinking with Portals" - << "King Mode" - ; - - numberOfDefaultSchemes = predefSchemesNames.size(); - - spNames = QStringList() - << "name" // 0 - << "fortsmode" // 1 - << "divteams" // 2 - << "solidland" // 3 - << "border" // 4 - << "lowgrav" // 5 - << "laser" // 6 - << "invulnerability" // 7 - << "resethealth" // 8 - << "vampiric" // 9 - << "karma" // 10 - << "artillery" // 11 - << "randomorder" // 12 - << "king" // 13 - << "placehog" // 14 - << "sharedammo" // 15 - << "disablegirders" // 16 - << "disablelandobjects" // 17 - << "aisurvival" // 18 - << "infattack" // 19 - << "resetweps" // 20 - << "perhogammo" // 21 - << "disablewind" // 22 - << "morewind" // 23 - << "tagteam" // 24 - << "bottomborder" // 25 - << "damagefactor" // 26 - << "turntime" // 27 - << "health" // 28 - << "suddendeath" // 29 - << "caseprobability" // 30 - << "minestime" // 31 - << "minesnum" // 32 - << "minedudpct" // 33 - << "explosives" // 34 - << "healthprobability" // 35 - << "healthcaseamount" // 36 - << "waterrise" // 37 - << "healthdecrease" // 38 - << "ropepct" // 39 - << "getawaytime" // 40 - ; - - QList proMode; - proMode - << predefSchemesNames[1] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(true) // shared ammo 15 - << QVariant(false) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(15) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(0) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(0) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(2) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList shoppa; - shoppa - << predefSchemesNames[2] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(true) // solid land 3 - << QVariant(true) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(true) // shared ammo 15 - << QVariant(true) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(true) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(30) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(50) // sudden death 29 - << QVariant(1) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(0) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(0) // explosives 34 - << QVariant(0) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList cleanslate; - cleanslate - << predefSchemesNames[3] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(true) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(false) // shared ammo 15 - << QVariant(false) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(true) // inf. attack 19 - << QVariant(true) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(45) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(5) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(4) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(2) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList minefield; - minefield - << predefSchemesNames[4] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(true) // shared ammo 15 - << QVariant(true) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(30) // turn time 27 - << QVariant(50) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(0) // case prob 30 - << QVariant(0) // mines time 31 - << QVariant(80) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(0) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList barrelmayhem; - barrelmayhem - << predefSchemesNames[5] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(true) // shared ammo 15 - << QVariant(false) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(30) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(0) // case prob 30 - << QVariant(0) // mines time 31 - << QVariant(0) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(80) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList tunnelhogs; - tunnelhogs - << predefSchemesNames[6] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(true) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(true) // shared ammo 15 - << QVariant(true) // disable girders 16 - << QVariant(true) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(30) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(5) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(10) // mines number 32 - << QVariant(10) // mine dud pct 33 - << QVariant(10) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList forts; - forts - << predefSchemesNames[7] // name 0 - << QVariant(true) // fortsmode 1 - << QVariant(true) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(true) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(false) // shared ammo 15 - << QVariant(false) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(45) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(5) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(0) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(0) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList timeless; - timeless - << predefSchemesNames[8] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(false) // shared ammo 15 - << QVariant(false) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(true) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(9999) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(5) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(5) // mines number 32 - << QVariant(10) // mine dud pct 33 - << QVariant(2) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(30) // health case amt 36 - << QVariant(0) // water rise amt 37 - << QVariant(0) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList thinkingportals; - thinkingportals - << predefSchemesNames[9] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(true) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(false) // king 13 - << QVariant(false) // place hog 14 - << QVariant(false) // shared ammo 15 - << QVariant(false) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(45) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(2) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(5) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(5) // explosives 34 - << QVariant(25) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - QList kingmode; - kingmode - << predefSchemesNames[10] // name 0 - << QVariant(false) // fortsmode 1 - << QVariant(false) // team divide 2 - << QVariant(false) // solid land 3 - << QVariant(false) // border 4 - << QVariant(false) // low gravity 5 - << QVariant(false) // laser sight 6 - << QVariant(false) // invulnerable 7 - << QVariant(false) // reset health 8 - << QVariant(false) // vampiric 9 - << QVariant(false) // karma 10 - << QVariant(false) // artillery 11 - << QVariant(true) // random order 12 - << QVariant(true) // king 13 - << QVariant(false) // place hog 14 - << QVariant(false) // shared ammo 15 - << QVariant(false) // disable girders 16 - << QVariant(false) // disable land objects 17 - << QVariant(false) // AI survival 18 - << QVariant(false) // inf. attack 19 - << QVariant(false) // reset weps 20 - << QVariant(false) // per hog ammo 21 - << QVariant(false) // no wind 22 - << QVariant(false) // more wind 23 - << QVariant(false) // tag team 24 - << QVariant(false) // bottom border 25 - << QVariant(100) // damage modfier 26 - << QVariant(45) // turn time 27 - << QVariant(100) // init health 28 - << QVariant(15) // sudden death 29 - << QVariant(5) // case prob 30 - << QVariant(3) // mines time 31 - << QVariant(4) // mines number 32 - << QVariant(0) // mine dud pct 33 - << QVariant(2) // explosives 34 - << QVariant(35) // health case pct 35 - << QVariant(25) // health case amt 36 - << QVariant(47) // water rise amt 37 - << QVariant(5) // health dec amt 38 - << QVariant(100) // rope modfier 39 - << QVariant(100) // get away time 40 - ; - - - schemes.append(defaultScheme); - schemes.append(proMode); - schemes.append(shoppa); - schemes.append(cleanslate); - schemes.append(minefield); - schemes.append(barrelmayhem); - schemes.append(tunnelhogs); - schemes.append(forts); - schemes.append(timeless); - schemes.append(thinkingportals); - schemes.append(kingmode); - - - int size = fileConfig.beginReadArray("schemes"); - for (int i = 0; i < size; ++i) { - fileConfig.setArrayIndex(i); - - if (!predefSchemesNames.contains(fileConfig.value(spNames[0]).toString())) - { - QList scheme; - - for (int k = 0; k < spNames.size(); ++k) - scheme << fileConfig.value(spNames[k], defaultScheme[k]); - - schemes.append(scheme); - } - } - fileConfig.endArray(); -} - -QVariant AmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - Q_UNUSED(section); - Q_UNUSED(orientation); - Q_UNUSED(role); - - return QVariant(); -} - -int AmmoSchemeModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - else - return schemes.size(); -} - -int AmmoSchemeModel::columnCount(const QModelIndex & parent) const -{ - if (parent.isValid()) - return 0; - else - return defaultScheme.size(); -} - -Qt::ItemFlags AmmoSchemeModel::flags(const QModelIndex & index) const -{ - Q_UNUSED(index); - - return - Qt::ItemIsEnabled - | Qt::ItemIsSelectable - | Qt::ItemIsEditable; -} - -bool AmmoSchemeModel::setData(const QModelIndex & index, const QVariant & value, int role) -{ - if (!index.isValid() || index.row() < numberOfDefaultSchemes - || index.row() >= schemes.size() - || index.column() >= defaultScheme.size() - || role != Qt::EditRole) - return false; - - schemes[index.row()][index.column()] = value; - - emit dataChanged(index, index); - return true; -} - -bool AmmoSchemeModel::insertRows(int row, int count, const QModelIndex & parent) -{ - Q_UNUSED(count); - - beginInsertRows(parent, schemes.size(), schemes.size()); - - if (row == -1) - { - QList newScheme = defaultScheme; - newScheme[0] = QVariant(tr("new")); - schemes.insert(schemes.size(), newScheme); - } - else - { - QList newScheme = schemes[row]; - newScheme[0] = QVariant(tr("copy of") + " " + newScheme[0].toString()); - schemes.insert(schemes.size(), newScheme); - } - - endInsertRows(); - - return true; -} - -bool AmmoSchemeModel::removeRows(int row, int count, const QModelIndex & parent) -{ - if(count != 1 - || row < numberOfDefaultSchemes - || row >= schemes.size()) - return false; - - beginRemoveRows(parent, row, row); - - schemes.removeAt(row); - - endRemoveRows(); - - return true; -} - -QVariant AmmoSchemeModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() < 0 - || index.row() >= schemes.size() - || index.column() >= defaultScheme.size() - || (role != Qt::EditRole && role != Qt::DisplayRole) - ) - return QVariant(); - - return schemes[index.row()][index.column()]; -} - -void AmmoSchemeModel::Save() -{ - fileConfig.beginWriteArray("schemes", schemes.size() - numberOfDefaultSchemes); - - for (int i = 0; i < schemes.size() - numberOfDefaultSchemes; ++i) { - fileConfig.setArrayIndex(i); - - QList scheme = schemes[i + numberOfDefaultSchemes]; - - for (int k = 0; k < scheme.size(); ++k) - fileConfig.setValue(spNames[k], scheme[k]); - } - fileConfig.endArray(); -} - - -NetAmmoSchemeModel::NetAmmoSchemeModel(QObject * parent) : - QAbstractTableModel(parent) -{ - netScheme = defaultScheme; -} - -QVariant NetAmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - Q_UNUSED(section); - Q_UNUSED(orientation); - Q_UNUSED(role); - - return QVariant(); -} - -int NetAmmoSchemeModel::rowCount(const QModelIndex & parent) const -{ - if (parent.isValid()) - return 0; - else - return 1; -} - -int NetAmmoSchemeModel::columnCount(const QModelIndex & parent) const -{ - if (parent.isValid()) - return 0; - else - return defaultScheme.size(); -} - -QVariant NetAmmoSchemeModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid() || index.row() < 0 - || index.row() > 1 - || index.column() >= defaultScheme.size() - || (role != Qt::EditRole && role != Qt::DisplayRole) - ) - return QVariant(); - - return netScheme[index.column()]; -} - -void NetAmmoSchemeModel::setNetSchemeConfig(QStringList & cfg) -{ - if(cfg.size() != netScheme.size()) - { - qWarning("Incorrect scheme cfg size"); - return; - } - - for(int i = 0; i < cfg.size(); ++i) - netScheme[i] = QVariant(cfg[i]); - - reset(); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ammoSchemeModel.h --- a/QTfrontend/ammoSchemeModel.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2005-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _AMMO_SCHEME_MODEL_INCLUDED -#define _AMMO_SCHEME_MODEL_INCLUDED - -#include -#include -#include -#include - -class AmmoSchemeModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - AmmoSchemeModel(QObject * parent, const QString & fileName); - - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - int rowCount(const QModelIndex & parent) const; - int columnCount(const QModelIndex & parent) const; - Qt::ItemFlags flags(const QModelIndex & index) const; - bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); - bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex()); - bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()); - QVariant data(const QModelIndex &index, int role) const; - - int numberOfDefaultSchemes; - QStringList predefSchemesNames; - QStringList spNames; - -public slots: - void Save(); - -signals: - void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight); - -protected: - QList< QList > schemes; - -private: - QSettings fileConfig; -}; - -class NetAmmoSchemeModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - NetAmmoSchemeModel(QObject * parent); - - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - int rowCount(const QModelIndex & parent) const; - int columnCount(const QModelIndex & parent) const; - QVariant data(const QModelIndex &index, int role) const; - -public slots: - void setNetSchemeConfig(QStringList & cfg); - -private: - QList netScheme; -}; - -#endif // _AMMO_SCHEME_MODEL_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/bgwidget.cpp --- a/QTfrontend/bgwidget.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2009 Kristian Lehmann - * Copyright (c) 2009-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "bgwidget.h" - -SpritePosition::SpritePosition(QWidget * parent, int sh) -{ - wParent = parent; - iSpriteHeight = sh; - reset(); -} - -SpritePosition::~SpritePosition() -{ -} - -void SpritePosition::move() -{ - fX += fXMov; - fY += fYMov; - iAngle += 4; - if (iAngle >= 360) iAngle = 0; - if (fY > wParent->height()) reset(); -} - -void SpritePosition::reset() -{ - fY = -1 * iSpriteHeight; - fX = (qrand() % ((int)(wParent->width() * 1.5))) - wParent->width()/2; - fYMov = ((qrand() % 400)+300) / 100.0f; - fXMov = fYMov * 0.2f+((qrand()%100)/100.0f * 0.6f); //so between 0.2 and 0.6, or 0.5 +/- 0.3 - iAngle = qrand() % 360; -} - -QPoint SpritePosition::pos() -{ - return QPoint((int)fX,(int)fY); -} - -int SpritePosition::getAngle() -{ - return iAngle; -} - -void SpritePosition::init() -{ - fY = qrand() % (wParent->height() + 1); - fX = qrand() % (wParent->width() + 1); -} - -BGWidget::BGWidget(QWidget * parent) : QWidget(parent) -{ - setAttribute(Qt::WA_NoSystemBackground, true); - sprite.load(":/res/Star.png"); - - setAutoFillBackground(false); - - for (int i = 0; i < SPRITE_MAX; i++) spritePositions[i] = new SpritePosition(this, sprite.height()); - - for (int i = 0; i < 360; i++) - { - rotatedSprites[i] = new QImage(sprite.width(), sprite.height(), QImage::Format_ARGB32); - rotatedSprites[i]->fill(0); - - QPoint translate(sprite.width()/2, sprite.height()/2); - - QPainter p; - p.begin(rotatedSprites[i]); - // p.setRenderHint(QPainter::Antialiasing); - p.setRenderHint(QPainter::SmoothPixmapTransform); - p.translate(translate.x(), translate.y()); - p.rotate(i); - p.translate(-1*translate.x(), -1*translate.y()); - p.drawImage(0, 0, sprite); - } - - timerAnimation = new QTimer(); - connect(timerAnimation, SIGNAL(timeout()), this, SLOT(animate())); - timerAnimation->setInterval(ANIMATION_INTERVAL); -} - -BGWidget::~BGWidget() -{ - for (int i = 0; i < SPRITE_MAX; i++) delete spritePositions[i]; - for (int i = 0; i < 360; i++) delete rotatedSprites[i]; - delete timerAnimation; -} - -void BGWidget::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - - QPainter p; - p.begin(this); - //p.setRenderHint(QPainter::Antialiasing); - for (int i = 0; i < SPRITE_MAX; i++) - { - QPoint point = spritePositions[i]->pos(); - p.drawImage(point.x(), point.y(), *rotatedSprites[spritePositions[i]->getAngle()]); - } - p.end(); -} - -void BGWidget::animate() -{ - for (int i = 0; i < SPRITE_MAX; i++) - { - // bottom edge of star *seems* clipped, but in fact, if I switch to just plain old repaint()/update() it is still clipped - artifact of transform? As for 5, is arbitrary number. 4 was noticeably clipping, 5 seemed same as update() - I assume extra room is due to rotation and value really should be calculated proportional to width/height - update(spritePositions[i]->pos().x(),spritePositions[i]->pos().y(), sprite.width()+5, sprite.height()+5); - spritePositions[i]->move(); - } -} - -void BGWidget::startAnimation() -{ - timerAnimation->start(); -} - -void BGWidget::stopAnimation() -{ - timerAnimation->stop(); -} - -void BGWidget::init() -{ - for (int i = 0; i < SPRITE_MAX; i++) spritePositions[i]->init(); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/bgwidget.h --- a/QTfrontend/bgwidget.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2009 Kristian Lehmann - * Copyright (c) 2009-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef BGWIDGET_H -#define BGWIDGET_H - -#include -//#include -#include -#include -#include -#include -#include - -#define SPRITE_MAX 12 - -#define ANIMATION_INTERVAL 40 - -class SpritePosition -{ -public: - SpritePosition(QWidget * parent, int sh); - ~SpritePosition(); -private: - float fX; - float fY; - float fXMov; - float fYMov; - int iAngle; - QWidget * wParent; - int iSpriteHeight; -public: - void move(); - void reset(); - QPoint pos(); - int getAngle(); - void init(); -}; - -class BGWidget : public QWidget -{ - Q_OBJECT -public: - BGWidget(QWidget * parent); - ~BGWidget(); - void startAnimation(); - void stopAnimation(); - void init(); -private: - QImage sprite; - QTimer * timerAnimation; - SpritePosition * spritePositions[SPRITE_MAX]; - QImage * rotatedSprites[360]; -protected: - void paintEvent(QPaintEvent * event); -private slots: - void animate(); -}; - -#endif // BGWIDGET_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/chatwidget.cpp --- a/QTfrontend/chatwidget.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,584 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hwconsts.h" -#include "SDLs.h" -#include "gameuiconfig.h" -#include "chatwidget.h" - -ListWidgetNickItem::ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored) : QListWidgetItem(nick) -{ - this->aFriend = isFriend; - this->isIgnored = isIgnored; -} - -void ListWidgetNickItem::setFriend(bool isFriend) -{ - this->aFriend = isFriend; -} - -void ListWidgetNickItem::setIgnored(bool isIgnored) -{ - this->isIgnored = isIgnored; -} - -bool ListWidgetNickItem::isFriend() -{ - return aFriend; -} - -bool ListWidgetNickItem::ignored() -{ - return isIgnored; -} - -bool ListWidgetNickItem::operator< (const QListWidgetItem & other) const -{ - // case in-sensitive comparison of the associated strings - // chars that are no letters are sorted at the end of the list - - ListWidgetNickItem otherNick = const_cast(dynamic_cast(other)); - - // ignored always down - if (isIgnored != otherNick.ignored()) - return !isIgnored; - - // friends always up - if (aFriend != otherNick.isFriend()) - return aFriend; - - QString txt1 = text().toLower(); - QString txt2 = other.text().toLower(); - - bool firstIsShorter = (txt1.size() < txt2.size()); - int len = firstIsShorter?txt1.size():txt2.size(); - - for (int i = 0; i < len; i++) - { - if (txt1[i] == txt2[i]) - continue; - if (txt1[i].isLetter() != txt2[i].isLetter()) - return txt1[i].isLetter(); - return (txt1[i] < txt2[i]); - } - - return firstIsShorter; -} - -const char* HWChatWidget::STYLE = -"\ -a { color:#c8c8ff; }\ -.nick { text-decoration: none; }\ -.UserChat .nick { color:#ffec20; }\ -.FriendChat { color: #08e008; }\ -.FriendChat .nick { color: #20ff20; }\ -.UserJoin { color: #c0c0c0; }\ -.UserJoin .nick { color: #d0d0d0; }\ -.FriendJoin { color: #c0e0c0; }\ -.FriendJoin .nick { color: #d0f0d0; }\ -.UserAction { color: #ff80ff; }\ -.UserAction .nick { color: #ffa0ff; }\ -.FriendAction { color: #ff00ff; }\ -.FriendAction .nick { color: #ff30ff; }\ -.Error { color: #ff0000 }\ -.Warning { color: #ff8000 }\ -.Notice { color: #fefefe }\ -"; - -HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) : - QWidget(parent), - mainLayout(this) -{ - this->gameSettings = gameSettings; - this->sdli = sdli; - this->notify = notify; - if(notify && gameSettings->value("frontend/sound", true).toBool()) { - QFile tmpfile; - sdli->SDLMusicInit(); - for(int i=0;i<4;i++) { - tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Sounds/voices/Classic/Hello.ogg"); - if (tmpfile.exists()) sound[i] = Mix_LoadWAV(QFileInfo(tmpfile).absoluteFilePath().toLocal8Bit().constData()); - else sound[i] = Mix_LoadWAV(QString(datadir->absolutePath() + - "/Sounds/voices/Classic/Hello.ogg").toLocal8Bit().constData()); - } - } - - mainLayout.setSpacing(1); - mainLayout.setMargin(1); - mainLayout.setSizeConstraint(QLayout::SetMinimumSize); - mainLayout.setColumnStretch(0, 76); - mainLayout.setColumnStretch(1, 24); - - chatEditLine = new QLineEdit(this); - chatEditLine->setMaxLength(300); - connect(chatEditLine, SIGNAL(returnPressed()), this, SLOT(returnPressed())); - - mainLayout.addWidget(chatEditLine, 2, 0); - - chatText = new QTextBrowser(this); - chatText->document()->setDefaultStyleSheet(STYLE); - chatText->setMinimumHeight(20); - chatText->setMinimumWidth(10); - chatText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - chatText->setOpenLinks(false); - connect(chatText, SIGNAL(anchorClicked(const QUrl&)), - this, SLOT(linkClicked(const QUrl&))); - mainLayout.addWidget(chatText, 0, 0, 2, 1); - - chatNicks = new QListWidget(this); - chatNicks->setMinimumHeight(10); - chatNicks->setMinimumWidth(10); - chatNicks->setSortingEnabled(true); - chatNicks->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - chatNicks->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(chatNicks, SIGNAL(itemDoubleClicked(QListWidgetItem *)), - this, SLOT(chatNickDoubleClicked(QListWidgetItem *))); - connect(chatNicks, SIGNAL(currentRowChanged(int)), - this, SLOT(chatNickSelected(int))); - - mainLayout.addWidget(chatNicks, 0, 1, 3, 1); - - acInfo = new QAction(QAction::tr("Info"), chatNicks); - acInfo->setIcon(QIcon(":/res/info.png")); - connect(acInfo, SIGNAL(triggered(bool)), this, SLOT(onInfo())); - acKick = new QAction(QAction::tr("Kick"), chatNicks); - acKick->setIcon(QIcon(":/res/kick.png")); - connect(acKick, SIGNAL(triggered(bool)), this, SLOT(onKick())); - acBan = new QAction(QAction::tr("Ban"), chatNicks); - acBan->setIcon(QIcon(":/res/ban.png")); - connect(acBan, SIGNAL(triggered(bool)), this, SLOT(onBan())); - acFollow = new QAction(QAction::tr("Follow"), chatNicks); - acFollow->setIcon(QIcon(":/res/follow.png")); - connect(acFollow, SIGNAL(triggered(bool)), this, SLOT(onFollow())); - acIgnore = new QAction(QAction::tr("Ignore"), chatNicks); - acIgnore->setIcon(QIcon(":/res/ignore.png")); - connect(acIgnore, SIGNAL(triggered(bool)), this, SLOT(onIgnore())); - acFriend = new QAction(QAction::tr("Add friend"), chatNicks); - acFriend->setIcon(QIcon(":/res/addfriend.png")); - connect(acFriend, SIGNAL(triggered(bool)), this, SLOT(onFriend())); - - chatNicks->insertAction(0, acFriend); - chatNicks->insertAction(0, acInfo); - chatNicks->insertAction(0, acIgnore); - - showReady = false; - setShowFollow(true); -} - -void HWChatWidget::linkClicked(const QUrl & link) -{ - if (link.scheme() == "http") - QDesktopServices::openUrl(link); - if (link.scheme() == "hwnick") - { - // decode nick - const QString& nick = QString::fromUtf8(QByteArray::fromBase64(link.encodedQuery())); - QList items = chatNicks->findItems(nick, Qt::MatchExactly); - if (items.size() < 1) - return; - QMenu * popup = new QMenu(this); - // selecting an item will automatically scroll there, so let's save old position - QScrollBar * scrollBar = chatNicks->verticalScrollBar(); - int oldScrollPos = scrollBar->sliderPosition(); - // select the nick which we want to see the actions for - chatNicks->setCurrentItem(items[0], QItemSelectionModel::Clear); - // selecting an item will automatically scroll there, so let's save old position - scrollBar->setSliderPosition(oldScrollPos); - // load actions - popup->addActions(chatNicks->actions()); - // display menu popup at mouse cursor position - popup->popup(QCursor::pos()); - } -} - -void HWChatWidget::setShowFollow(bool enabled) -{ - if (enabled) { - if (!(chatNicks->actions().contains(acFollow))) - chatNicks->insertAction(acFriend, acFollow); - } - else { - if (chatNicks->actions().contains(acFollow)) - chatNicks->removeAction(acFollow); - } -} - -void HWChatWidget::loadList(QStringList & list, const QString & file) -{ - list.clear(); - QFile txt(cfgdir->absolutePath() + "/" + file); - if(!txt.open(QIODevice::ReadOnly)) - return; - QTextStream stream(&txt); - stream.setCodec("UTF-8"); - - while(!stream.atEnd()) - { - QString str = stream.readLine(); - if(str.startsWith(";") || str.length() == 0) - continue; - list << str.trimmed(); - } - //readd once we require newer Qt than 4.4 - //list.removeDuplicates(); - txt.close(); -} - -void HWChatWidget::saveList(QStringList & list, const QString & file) -{ - QFile txt(cfgdir->absolutePath() + "/" + file); - if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate)) - return; - QTextStream stream(&txt); - stream.setCodec("UTF-8"); - - stream << "; this list is used by Hedgewars - do not edit it unless you know what you're doing!" << endl; - for(int i = 0; i < list.size(); i++) - stream << list[i] << endl; - txt.close(); -} - -void HWChatWidget::updateNickItem(QListWidgetItem *nickItem) -{ - QString nick = nickItem->text(); - ListWidgetNickItem * item = dynamic_cast(nickItem); - - item->setFriend(friendsList.contains(nick, Qt::CaseInsensitive)); - item->setIgnored(ignoreList.contains(nick, Qt::CaseInsensitive)); - - if(item->ignored()) - { - item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_ignore_on.png" : ":/res/chat_ignore_off.png") : ":/res/chat_ignore.png")); - item->setForeground(Qt::gray); - } - else if(item->isFriend()) - { - item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_friend_on.png" : ":/res/chat_friend_off.png") : ":/res/chat_friend.png")); - item->setForeground(Qt::green); - } - else - { - item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_default_on.png" : ":/res/chat_default_off.png") : ":/res/chat_default.png")); - item->setForeground(QBrush(QColor(0xff, 0xcc, 0x00))); - } -} - -void HWChatWidget::updateNickItems() -{ - for(int i = 0; i < chatNicks->count(); i++) - updateNickItem(chatNicks->item(i)); - - chatNicks->sortItems(); -} - -void HWChatWidget::loadLists(const QString & nick) -{ - loadList(ignoreList, nick.toLower() + "_ignore.txt"); - loadList(friendsList, nick.toLower() + "_friends.txt"); - updateNickItems(); -} - -void HWChatWidget::saveLists(const QString & nick) -{ - saveList(ignoreList, nick.toLower() + "_ignore.txt"); - saveList(friendsList, nick.toLower() + "_friends.txt"); -} - -void HWChatWidget::returnPressed() -{ - QStringList lines = chatEditLine->text().split('\n'); - chatEditLine->clear(); - foreach (const QString &line, lines) - emit chatLine(line); -} - - -void HWChatWidget::onChatString(const QString& str) -{ - onChatString("", str); -} - -const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http://)?(www\\.)?(hedgewars\\.org(/[^ ]*)?)"); - -void HWChatWidget::onChatString(const QString& nick, const QString& str) -{ - bool isFriend = false; - - if (!nick.isEmpty()) { - // don't show chat lines that are from ignored nicks - if (ignoreList.contains(nick, Qt::CaseInsensitive)) - return; - // friends will get special treatment, of course - isFriend = friendsList.contains(nick, Qt::CaseInsensitive); - } - - QString formattedStr = Qt::escape(str.mid(1)); - // make hedgewars.org urls actual links - formattedStr = formattedStr.replace(URLREGEXP, "\\3"); - - // "link" nick, but before that encode it in base64 to make sure it can't intefere with html/url syntax - // the nick is put as querystring as putting it as host would convert it to it's lower case variant - if(!nick.isEmpty()) - formattedStr.replace("|nick|",QString("%2").arg(QString(nick.toUtf8().toBase64())).arg(nick)); - - QString cssClass("UserChat"); - - // check first character for color code and set color properly - switch (str[0].toAscii()) { - case 3: - cssClass = (isFriend ? "FriendJoin" : "UserJoin"); - break; - case 2: - cssClass = (isFriend ? "FriendAction" : "UserAction"); - break; - default: - if (isFriend) - cssClass = "FriendChat"; - } - - addLine(cssClass,formattedStr); -} - -void HWChatWidget::addLine(const QString& cssClass, QString line) -{ - if (chatStrings.size() > 250) - chatStrings.removeFirst(); - - line = QString("%1").arg(line).arg(cssClass); - - chatStrings.append(line); - - chatText->setHtml(chatStrings.join("
")); - - chatText->moveCursor(QTextCursor::End); -} - -void HWChatWidget::onServerMessage(const QString& str) -{ - if (chatStrings.size() > 250) - chatStrings.removeFirst(); - - chatStrings.append("
" + str + "
"); - - chatText->setHtml(chatStrings.join("
")); - - chatText->moveCursor(QTextCursor::End); -} - -void HWChatWidget::nickAdded(const QString& nick, bool notifyNick) -{ - QListWidgetItem * item = new ListWidgetNickItem(nick, friendsList.contains(nick, Qt::CaseInsensitive), ignoreList.contains(nick, Qt::CaseInsensitive)); - updateNickItem(item); - chatNicks->addItem(item); - - emit nickCountUpdate(chatNicks->count()); - - if(notifyNick && notify && gameSettings->value("frontend/sound", true).toBool()) { - Mix_PlayChannel(-1, sound[rand()%4], 0); - } -} - -void HWChatWidget::nickRemoved(const QString& nick) -{ - foreach(QListWidgetItem * item, chatNicks->findItems(nick, Qt::MatchExactly)) - chatNicks->takeItem(chatNicks->row(item)); - - emit nickCountUpdate(chatNicks->count()); -} - -void HWChatWidget::clear() -{ - chatText->clear(); - chatStrings.clear(); - chatNicks->clear(); -} - -void HWChatWidget::onKick() -{ - QListWidgetItem * curritem = chatNicks->currentItem(); - if (curritem) - emit kick(curritem->text()); -} - -void HWChatWidget::onBan() -{ - QListWidgetItem * curritem = chatNicks->currentItem(); - if (curritem) - emit ban(curritem->text()); -} - -void HWChatWidget::onInfo() -{ - QListWidgetItem * curritem = chatNicks->currentItem(); - if (curritem) - emit info(curritem->text()); -} - -void HWChatWidget::onFollow() -{ - QListWidgetItem * curritem = chatNicks->currentItem(); - if (curritem) - emit follow(curritem->text()); -} - -void HWChatWidget::onIgnore() -{ - QListWidgetItem * curritem = chatNicks->currentItem(); - if(!curritem) - return; - - if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him - { - ignoreList.removeAll(curritem->text().toLower()); - onChatString(HWChatWidget::tr("%1 *** %2 has been removed from your ignore list").arg('\x03').arg(curritem->text())); - } - else // not on list - add - { - // don't consider ignored people friends - if(friendsList.contains(curritem->text(), Qt::CaseInsensitive)) - emit onFriend(); - - // scroll down on first ignore added so that people see where that nick went to - if (ignoreList.isEmpty()) - chatNicks->scrollToBottom(); - - ignoreList << curritem->text().toLower(); - onChatString(HWChatWidget::tr("%1 *** %2 has been added to your ignore list").arg('\x03').arg(curritem->text())); - } - updateNickItem(curritem); // update icon/sort order/etc - chatNicks->sortItems(); - chatNickSelected(0); // update context menu -} - -void HWChatWidget::onFriend() -{ - QListWidgetItem * curritem = chatNicks->currentItem(); - if(!curritem) - return; - - if(friendsList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him - { - friendsList.removeAll(curritem->text().toLower()); - onChatString(HWChatWidget::tr("%1 *** %2 has been removed from your friends list").arg('\x03').arg(curritem->text())); - } - else // not on list - add - { - // don't ignore the new friend - if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive)) - emit onIgnore(); - - // scroll up on first friend added so that people see where that nick went to - if (friendsList.isEmpty()) - chatNicks->scrollToTop(); - - friendsList << curritem->text().toLower(); - onChatString(HWChatWidget::tr("%1 *** %2 has been added to your friends list").arg('\x03').arg(curritem->text())); - } - updateNickItem(curritem); // update icon/sort order/etc - chatNicks->sortItems(); - chatNickSelected(0); // update context menu -} - -void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item) -{ - Q_UNUSED(item); - - QList actions = chatNicks->actions(); - actions.first()->activate(QAction::Trigger); -} - -void HWChatWidget::chatNickSelected(int index) -{ - Q_UNUSED(index); - - QListWidgetItem* item = chatNicks->currentItem(); - if (!item) - return; - - // update context menu labels according to possible action - if(ignoreList.contains(item->text(), Qt::CaseInsensitive)) - { - acIgnore->setText(QAction::tr("Unignore")); - acIgnore->setIcon(QIcon(":/res/unignore.png")); - } - else - { - acIgnore->setText(QAction::tr("Ignore")); - acIgnore->setIcon(QIcon(":/res/ignore.png")); - } - - if(friendsList.contains(item->text(), Qt::CaseInsensitive)) - { - acFriend->setText(QAction::tr("Remove friend")); - acFriend->setIcon(QIcon(":/res/remfriend.png")); - } - else - { - acFriend->setText(QAction::tr("Add friend")); - acFriend->setIcon(QIcon(":/res/addfriend.png")); - } -} - -void HWChatWidget::setShowReady(bool s) -{ - showReady = s; -} - -void HWChatWidget::setReadyStatus(const QString & nick, bool isReady) -{ - QList items = chatNicks->findItems(nick, Qt::MatchExactly); - if (items.size() != 1) - { - qWarning("Bug: cannot find user in chat"); - return; - } - - items[0]->setData(Qt::UserRole, isReady); // bulb status - updateNickItem(items[0]); - - // ensure we're still showing the status bulbs - showReady = true; -} - -void HWChatWidget::adminAccess(bool b) -{ - chatNicks->removeAction(acKick); - chatNicks->removeAction(acBan); - - if(b) - { - chatNicks->insertAction(0, acKick); -// chatNicks->insertAction(0, acBan); - } -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/chatwidget.h --- a/QTfrontend/chatwidget.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _CHAT_WIDGET_INCLUDED -#define _CHAT_WIDGET_INCLUDED - -#include -#include -#include -#include -#include - -#include "SDLs.h" - -class ListWidgetNickItem; -class QTextBrowser; -class QLineEdit; -class QListWidget; -class QSettings; -class SDLInteraction; - -// this class is for custom nick sorting -class ListWidgetNickItem : public QListWidgetItem -{ -public: - ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored); - bool operator<(const QListWidgetItem & other) const; - void setFriend(bool isFriend); - void setIgnored(bool isIgnored); - bool isFriend(); - bool ignored(); - -private: - bool aFriend; - bool isIgnored; -}; - -class HWChatWidget : public QWidget -{ - Q_OBJECT - - public: - HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify); - void loadLists(const QString & nick); - void saveLists(const QString & nick); - void setShowReady(bool s); - void setShowFollow(bool enabled); - void addLine(const QString & cssClass, QString line); - static const char* STYLE; - QStringList ignoreList, friendsList; - -private: - void loadList(QStringList & list, const QString & file); - void saveList(QStringList & list, const QString & file); - void updateNickItem(QListWidgetItem *item); - void updateNickItems(); - static const QRegExp URLREGEXP; - - public slots: - void onChatString(const QString& str); - void onChatString(const QString& nick, const QString& str); - void onServerMessage(const QString& str); - void nickAdded(const QString& nick, bool notifyNick); - void nickRemoved(const QString& nick); - void clear(); - void setReadyStatus(const QString & nick, bool isReady); - void adminAccess(bool); - - signals: - void chatLine(const QString& str); - void kick(const QString & str); - void ban(const QString & str); - void info(const QString & str); - void follow(const QString &); - void nickCountUpdate(int cnt); - - private: - QGridLayout mainLayout; - QTextBrowser* chatText; - QStringList chatStrings; - QListWidget* chatNicks; - QLineEdit* chatEditLine; - QAction * acInfo; - QAction * acKick; - QAction * acBan; - QAction * acFollow; - QAction * acIgnore; - QAction * acFriend; - QSettings * gameSettings; - SDLInteraction * sdli; - Mix_Chunk *sound[4]; - bool notify; - bool showReady; - - private slots: - void returnPressed(); - void onBan(); - void onKick(); - void onInfo(); - void onFollow(); - void onIgnore(); - void onFriend(); - void chatNickDoubleClicked(QListWidgetItem * item); - void chatNickSelected(int index); - void linkClicked(const QUrl & link); -}; - -#endif // _CHAT_WIDGET_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/databrowser.cpp --- a/QTfrontend/databrowser.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -#include -#include -#include -#include -#include - -#include "databrowser.h" - -const QNetworkRequest::Attribute typeAttribute = (QNetworkRequest::Attribute)(QNetworkRequest::User + 1); -const QNetworkRequest::Attribute urlAttribute = (QNetworkRequest::Attribute)(QNetworkRequest::User + 2); - -DataBrowser::DataBrowser(QWidget *parent) : - QTextBrowser(parent) -{ - - manager = new QNetworkAccessManager(this); -} - -QVariant DataBrowser::loadResource(int type, const QUrl & name) -{ - if(type == QTextDocument::ImageResource || type == QTextDocument::StyleSheetResource) - { - if(resources.contains(name.toString())) - { - return resources.take(name.toString()); - } - else - if(!requestedResources.contains(name.toString())) - { - qDebug() << "Requesting resource" << name.toString(); - requestedResources.insert(name.toString()); - - QNetworkRequest newRequest(QUrl("http://www.hedgewars.org" + name.toString())); - newRequest.setAttribute(typeAttribute, type); - newRequest.setAttribute(urlAttribute, name); - - QNetworkReply *reply = manager->get(newRequest); - connect(reply, SIGNAL(finished()), this, SLOT(resourceDownloaded())); - } - } - - return QVariant(); -} - -void DataBrowser::resourceDownloaded() -{ - QNetworkReply * reply = qobject_cast(sender()); - - if(reply) - { - int type = reply->request().attribute(typeAttribute).toInt(); - QUrl url = reply->request().attribute(urlAttribute).toUrl(); - resources.insert(url.toString(), reply->readAll()); - document()->addResource(type, reply->request().url(), QVariant()); - update(); - } -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/databrowser.h --- a/QTfrontend/databrowser.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#ifndef DATABROWSER_H -#define DATABROWSER_H - -#include -#include - -class QNetworkAccessManager; - -class DataBrowser : public QTextBrowser -{ - Q_OBJECT -public: - explicit DataBrowser(QWidget *parent = 0); - -signals: - -public slots: - -private: - QNetworkAccessManager *manager; - - // hash and set of QString instead of QUrl to support Qt versions - // older than 4.7 (those have no support for qHash(const QUrl &)) - QHash resources; - QSet requestedResources; - - QVariant loadResource(int type, const QUrl & name); - -private slots: - void resourceDownloaded(); -}; - -#endif // DATABROWSER_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/drawmapwidget.cpp --- a/QTfrontend/drawmapwidget.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include - -#include "drawmapwidget.h" - -DrawMapWidget::DrawMapWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::DrawMapWidget) -{ - ui->setupUi(this); - - m_scene = 0; -} - -DrawMapWidget::~DrawMapWidget() -{ - delete ui; -} - -void DrawMapWidget::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - -void DrawMapWidget::setScene(DrawMapScene * scene) -{ - ui->graphicsView->setScene(scene); - m_scene = scene; -} - -void DrawMapWidget::resizeEvent(QResizeEvent * event) -{ - Q_UNUSED(event); - - if(ui->graphicsView && ui->graphicsView->scene()) - ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio); -} - -void DrawMapWidget::showEvent(QShowEvent * event) -{ - Q_UNUSED(event); - - resizeEvent(0); -} - -void DrawMapWidget::undo() -{ - if(m_scene) m_scene->undo(); -} - -void DrawMapWidget::clear() -{ - if(m_scene) m_scene->clearMap(); -} - -void DrawMapWidget::save(const QString & fileName) -{ - if(m_scene) - { - QFile file(fileName); - - if(!file.open(QIODevice::WriteOnly)) - QMessageBox::warning(this, tr("File error"), tr("Cannot open file '%1' for writing").arg(fileName)); - else - file.write(qCompress(m_scene->encode()).toBase64()); - } -} - -void DrawMapWidget::load(const QString & fileName) -{ - if(m_scene) - { - QFile f(fileName); - - if(!f.open(QIODevice::ReadOnly)) - QMessageBox::warning(this, tr("File error"), tr("Cannot read file '%1'").arg(fileName)); - else - m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll()))); - } -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/drawmapwidget.h --- a/QTfrontend/drawmapwidget.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef DRAWMAPWIDGET_H -#define DRAWMAPWIDGET_H - -#include -#include -#include -#include - -#include "qaspectratiolayout.h" -#include "drawmapscene.h" - -namespace Ui { - class Ui_DrawMapWidget - { - public: - QGraphicsView *graphicsView; - - void setupUi(QWidget *drawMapWidget) - { - QAspectRatioLayout * arLayout = new QAspectRatioLayout(drawMapWidget); - arLayout->setMargin(0); - - graphicsView = new QGraphicsView(drawMapWidget); - arLayout->addWidget(graphicsView); - - retranslateUi(drawMapWidget); - - QMetaObject::connectSlotsByName(drawMapWidget); - } // setupUi - - void retranslateUi(QWidget *drawMapWidget) - { - Q_UNUSED(drawMapWidget); - } // retranslateUi - - }; - - class DrawMapWidget: public Ui_DrawMapWidget {}; -} - -class DrawMapWidget : public QWidget -{ - Q_OBJECT - -public: - explicit DrawMapWidget(QWidget *parent = 0); - ~DrawMapWidget(); - - void setScene(DrawMapScene * scene); - -public slots: - void undo(); - void clear(); - void save(const QString & fileName); - void load(const QString & fileName); - -protected: - void changeEvent(QEvent *e); - virtual void resizeEvent(QResizeEvent * event); - virtual void showEvent(QShowEvent * event); - -private: - Ui::DrawMapWidget *ui; - - DrawMapScene * m_scene; -}; - -#endif // DRAWMAPWIDGET_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/fpsedit.cpp --- a/QTfrontend/fpsedit.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "fpsedit.h" - -FPSEdit::FPSEdit(QWidget * parent) : - QSpinBox(parent) -{ - setRange(1, 34); - setValue(27); -} - -QString FPSEdit::textFromValue(int value) const -{ - return QString::number(1000 / (35 - value)); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/fpsedit.h --- a/QTfrontend/fpsedit.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _FPSEDIT_H -#define _FPSEDIT_H - -#include - -class FPSEdit : public QSpinBox -{ - Q_OBJECT - -public: - FPSEdit(QWidget * parent = 0); - -protected: - QString textFromValue (int value) const; -}; - -#endif // _FPSEDIT_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/frameTeam.cpp --- a/QTfrontend/frameTeam.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include - -#include "frameTeam.h" -#include "teamselhelper.h" -#include "hwconsts.h" - -FrameTeams::FrameTeams(QWidget* parent) : - QFrame(parent), maxHedgehogsPerGame(48), overallHedgehogs(0), mainLayout(this), nonInteractive(false) -{ - QPalette newPalette = palette(); - newPalette.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); - setPalette(newPalette); - setAutoFillBackground(true); - - mainLayout.setSpacing(1); - mainLayout.setContentsMargins(4, 4, 4, 4); - - int i = 0; - while(colors[i] != 0) - availableColors.push_back(QColor(colors[i++])); - - resetColors(); -} - -void FrameTeams::setInteractivity(bool interactive) -{ - nonInteractive = !interactive; - for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ++it) { - TeamShowWidget* pts = dynamic_cast(it.value()); - if(!pts) throw; - pts->setInteractivity(interactive); - } -} - -void FrameTeams::resetColors() -{ - currentColor=availableColors.end() - 1; // ensure next color is the first one -} - -QColor FrameTeams::getNextColor() const -{ - QList::ConstIterator nextColor=currentColor; - ++nextColor; - if (nextColor==availableColors.end()) nextColor=availableColors.begin(); - return *nextColor; -} - -void FrameTeams::addTeam(HWTeam team, bool willPlay) -{ - TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this); - if(nonInteractive) pTeamShowWidget->setInteractivity(false); -// int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height(); - mainLayout.addWidget(pTeamShowWidget); - teamToWidget.insert(team, pTeamShowWidget); - QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size()); - QCoreApplication::postEvent(parentWidget(), pevent); -} - -void FrameTeams::removeTeam(HWTeam team) -{ - tmapTeamToWidget::iterator it=teamToWidget.find(team); - if(it==teamToWidget.end()) return; - mainLayout.removeWidget(it.value()); - it.value()->deleteLater(); - teamToWidget.erase(it); -} - -void FrameTeams::resetTeams() -{ - for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ) { - mainLayout.removeWidget(it.value()); - it.value()->deleteLater(); - teamToWidget.erase(it++); - } -} - -void FrameTeams::setHHNum(const HWTeam& team) -{ - TeamShowWidget* pTeamShowWidget = dynamic_cast(getTeamWidget(team)); - if(!pTeamShowWidget) return; - pTeamShowWidget->setHHNum(team.numHedgehogs()); -} - -void FrameTeams::setTeamColor(const HWTeam& team) -{ - TeamShowWidget* pTeamShowWidget = dynamic_cast(getTeamWidget(team)); - if(!pTeamShowWidget) return; - pTeamShowWidget->changeTeamColor(team.color()); -} - -QWidget* FrameTeams::getTeamWidget(HWTeam team) -{ -//qDebug() << "FrameTeams::getTeamWidget getNetID() = " << team.getNetID(); - tmapTeamToWidget::iterator it=teamToWidget.find(team); - QWidget* ret = it!=teamToWidget.end() ? it.value() : 0; - return ret; -} - -bool FrameTeams::isFullTeams() const -{ - return overallHedgehogs==maxHedgehogsPerGame; -} - -void FrameTeams::emitTeamColorChanged(const HWTeam& team) -{ - emit teamColorChanged(team); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/frameTeam.h --- a/QTfrontend/frameTeam.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _FRAME_TEAM_INCLUDED -#define _FRAME_TEAM_INCLUDED - -#include -#include -#include - -#include "teamselect.h" - -class FrameTeams : public QFrame -{ - Q_OBJECT - - friend class CHedgehogerWidget; - friend class TeamShowWidget; - - public: - FrameTeams(QWidget* parent=0); - QWidget* getTeamWidget(HWTeam team); - bool isFullTeams() const; - void resetColors(); - void resetTeams(); - void setHHNum(const HWTeam& team); - void setTeamColor(const HWTeam& team); - void setInteractivity(bool interactive); - QColor getNextColor() const; - - signals: - void teamColorChanged(const HWTeam&); - - public slots: - void addTeam(HWTeam team, bool willPlay); - void removeTeam(HWTeam team); - - private: - const int maxHedgehogsPerGame; - int overallHedgehogs; - QList availableColors; - QList::Iterator currentColor; - - void emitTeamColorChanged(const HWTeam& team); - - QVBoxLayout mainLayout; - typedef QMap tmapTeamToWidget; - tmapTeamToWidget teamToWidget; - bool nonInteractive; -}; - -#endif // _FRAME_TAM_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/game.cpp --- a/QTfrontend/game.cpp Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/game.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -41,7 +41,6 @@ { this->config = config; this->gamecfg = gamecfg; - TeamCount = 0; netSuspend = false; } @@ -120,13 +119,11 @@ .arg((themesModel->rowCount() > 0) ? themesModel->index(rand() % themesModel->rowCount()).data().toString() : "steel")); HWProto::addStringToBuffer(teamscfg, "eseed " + QUuid::createUuid().toString()); - HWNamegen namegen; - HWTeam team1; team1.setDifficulty(0); team1.setColor(QColor(colors[0])); team1.setNumHedgehogs(4); - namegen.teamRandomNames(team1,TRUE); + HWNamegen::teamRandomNames(team1,true); HWProto::addStringListToBuffer(teamscfg, team1.teamGameConfig(100)); @@ -135,7 +132,7 @@ team2.setColor(QColor(colors[1])); team2.setNumHedgehogs(4); do - namegen.teamRandomNames(team2,TRUE); + HWNamegen::teamRandomNames(team2,true); while(!team2.name().compare(team1.name()) || !team2.hedgehog(0).Hat.compare(team1.hedgehog(0).Hat)); HWProto::addStringListToBuffer(teamscfg, team2.teamGameConfig(100)); @@ -318,13 +315,6 @@ return arguments; } -void HWGame::AddTeam(const QString & teamname) -{ - if (TeamCount == 5) return; - teams[TeamCount] = teamname; - TeamCount++; -} - void HWGame::PlayDemo(const QString & demofilename, bool isSave) { gameType = isSave ? gtSave : gtDemo; @@ -392,13 +382,9 @@ emit GameStateChanged(state); } -void HWGame::KillAllTeams() +void HWGame::abort() { - if (m_pTeamSelWidget) - { - QByteArray buf; - foreach(HWTeam team, m_pTeamSelWidget->getPlayingTeams()) - HWProto::addStringToBuffer(buf, QString("eteamgone %1").arg(team.name())); - RawSendIPC(buf); - } + QByteArray buf; + HWProto::addStringToBuffer(buf, QString("efinish")); + RawSendIPC(buf); } diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/game.h --- a/QTfrontend/game.h Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/game.h Fri Oct 28 18:33:38 2011 +0200 @@ -54,7 +54,7 @@ void StartNet(); void StartTraining(const QString & file); void StartCampaign(const QString & file); - void KillAllTeams(); + void abort(); GameState gameState; bool netSuspend; @@ -87,9 +87,7 @@ gtSave = 7, }; char msgbuf[MAXMSGCHARS]; - QString teams[5]; QString ammostr; - int TeamCount; GameUIConfig * config; GameCFGWidget * gamecfg; TeamSelWidget* m_pTeamSelWidget; diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/gamecfgwidget.cpp --- a/QTfrontend/gamecfgwidget.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,573 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "gamecfgwidget.h" -#include "igbox.h" -#include "hwconsts.h" -#include "ammoSchemeModel.h" -#include "proto.h" - -GameCFGWidget::GameCFGWidget(QWidget* parent) : - QGroupBox(parent) - , mainLayout(this) - , seedRegexp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}") -{ - mainLayout.setMargin(0); -// mainLayout.setSizeConstraint(QLayout::SetMinimumSize); - - pMapContainer = new HWMapContainer(this); - mainLayout.addWidget(pMapContainer, 0, 0); - - IconedGroupBox *GBoxOptions = new IconedGroupBox(this); - GBoxOptions->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - mainLayout.addWidget(GBoxOptions, 1, 0); - - QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions); - - GBoxOptions->setTitle(tr("Game Options")); - GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), GBoxOptions), 1, 0); - - Scripts = new QComboBox(GBoxOptions); - GBoxOptionsLayout->addWidget(Scripts, 1, 1); - - Scripts->addItem("Normal"); - Scripts->insertSeparator(1); - - for (int i = 0; i < scriptList->size(); ++i) { - QString script = (*scriptList)[i].remove(".lua", Qt::CaseInsensitive); - QList scriptInfo; - scriptInfo.push_back(script); - QFile scriptCfgFile; - scriptCfgFile.setFileName(QString("%1/Data/Scripts/Multiplayer/%2.cfg").arg(cfgdir->absolutePath()).arg(script)); - if (!scriptCfgFile.exists()) scriptCfgFile.setFileName(QString("%1/Scripts/Multiplayer/%2.cfg").arg(datadir->absolutePath()).arg(script)); - if (scriptCfgFile.exists() && scriptCfgFile.open(QFile::ReadOnly)) { - QString scheme; - QString weapons; - QTextStream input(&scriptCfgFile); - input >> scheme; - input >> weapons; - if (scheme.isEmpty()) - scheme = "locked"; - scheme.replace("_", " "); - if (weapons.isEmpty()) - weapons = "locked"; - weapons.replace("_", " "); - scriptInfo.push_back(scheme); - scriptInfo.push_back(weapons); - scriptCfgFile.close(); - } - else - { - scriptInfo.push_back("locked"); - scriptInfo.push_back("locked"); - } - Scripts->addItem(script.replace("_", " "), scriptInfo); - } - - connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int))); - - QWidget *SchemeWidget = new QWidget(GBoxOptions); - GBoxOptionsLayout->addWidget(SchemeWidget, 2, 0, 1, 2); - - QGridLayout *SchemeWidgetLayout = new QGridLayout(SchemeWidget); - SchemeWidgetLayout->setMargin(0); - - GameSchemes = new QComboBox(SchemeWidget); - SchemeWidgetLayout->addWidget(GameSchemes, 0, 2); - connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int))); - - SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Scheme"), SchemeWidget), 0, 0); - - QPixmap pmEdit(":/res/edit.png"); - - QPushButton * goToSchemePage = new QPushButton(SchemeWidget); - goToSchemePage->setToolTip(tr("Edit schemes")); - goToSchemePage->setIconSize(pmEdit.size()); - goToSchemePage->setIcon(pmEdit); - goToSchemePage->setMaximumWidth(pmEdit.width() + 6); - SchemeWidgetLayout->addWidget(goToSchemePage, 0, 3); - connect(goToSchemePage, SIGNAL(clicked()), this, SLOT(jumpToSchemes())); - - SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Weapons"), SchemeWidget), 1, 0); - - WeaponsName = new QComboBox(SchemeWidget); - SchemeWidgetLayout->addWidget(WeaponsName, 1, 2); - - connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int))); - - QPushButton * goToWeaponPage = new QPushButton(SchemeWidget); - goToWeaponPage->setToolTip(tr("Edit weapons")); - goToWeaponPage->setIconSize(pmEdit.size()); - goToWeaponPage->setIcon(pmEdit); - goToWeaponPage->setMaximumWidth(pmEdit.width() + 6); - SchemeWidgetLayout->addWidget(goToWeaponPage, 1, 3); - connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons())); - - bindEntries = new QCheckBox(SchemeWidget); - bindEntries->setToolTip(tr("When this option is enabled selecting a game scheme will auto-select a weapon")); - bindEntries->setChecked(true); - bindEntries->setMaximumWidth(42); - bindEntries->setStyleSheet( "QCheckBox::indicator:checked { image: url(\":/res/lock.png\"); }" - "QCheckBox::indicator:unchecked { image: url(\":/res/unlock.png\"); }" ); - SchemeWidgetLayout->addWidget(bindEntries, 0, 1, 0, 1, Qt::AlignVCenter); - - connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &))); - connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &))); - connect(pMapContainer, SIGNAL(mapgenChanged(MapGenerator)), this, SLOT(mapgenChanged(MapGenerator))); - connect(pMapContainer, SIGNAL(mazeSizeChanged(int)), this, SLOT(maze_sizeChanged(int))); - connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &))); - connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int))); - connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap())); - connect(pMapContainer, SIGNAL(drawnMapChanged(const QByteArray &)), this, SLOT(onDrawnMapChanged(const QByteArray &))); -} - -void GameCFGWidget::jumpToSchemes() -{ - emit goToSchemes(GameSchemes->currentIndex()); -} - -void GameCFGWidget::jumpToWeapons() -{ - emit goToWeapons(WeaponsName->currentIndex()); -} - -QVariant GameCFGWidget::schemeData(int column) const -{ - return GameSchemes->model()->data(GameSchemes->model()->index(GameSchemes->currentIndex(), column)); -} - -quint32 GameCFGWidget::getGameFlags() const -{ - quint32 result = 0; - - if (schemeData(1).toBool()) - result |= 0x00001000; // fort - if (schemeData(2).toBool()) - result |= 0x00000010; // divide teams - if (schemeData(3).toBool()) - result |= 0x00000004; // solid land - if (schemeData(4).toBool()) - result |= 0x00000008; // border - if (schemeData(5).toBool()) - result |= 0x00000020; // low gravity - if (schemeData(6).toBool()) - result |= 0x00000040; // laser sight - if (schemeData(7).toBool()) - result |= 0x00000080; // invulnerable - if (schemeData(8).toBool()) - result |= 0x00000100; // mines - if (schemeData(9).toBool()) - result |= 0x00000200; // vampirism - if (schemeData(10).toBool()) - result |= 0x00000400; // karma - if (schemeData(11).toBool()) - result |= 0x00000800; // artillery - if (schemeData(12).toBool()) - result |= 0x00002000; // random - if (schemeData(13).toBool()) - result |= 0x00004000; // king - if (schemeData(14).toBool()) - result |= 0x00008000; // place hogs - if (schemeData(15).toBool()) - result |= 0x00010000; // shared ammo - if (schemeData(16).toBool()) - result |= 0x00020000; // disable girders - if (schemeData(17).toBool()) - result |= 0x00040000; // disable land obj - if (schemeData(18).toBool()) - result |= 0x00080000; // ai survival - if (schemeData(19).toBool()) - result |= 0x00100000; // infinite attacks - if (schemeData(20).toBool()) - result |= 0x00200000; // reset weaps - if (schemeData(21).toBool()) - result |= 0x00400000; // per hog ammo - if (schemeData(22).toBool()) - result |= 0x00800000; // no wind - if (schemeData(23).toBool()) - result |= 0x01000000; // more wind - if (schemeData(24).toBool()) - result |= 0x02000000; // tag team - if (schemeData(25).toBool()) - result |= 0x04000000; // bottom border - - return result; -} - -quint32 GameCFGWidget::getInitHealth() const -{ - return schemeData(28).toInt(); -} - -QByteArray GameCFGWidget::getFullConfig() const -{ - QList bcfg; - int mapgen = pMapContainer->get_mapgen(); - - QString currentMap = pMapContainer->getCurrentMap(); - if (currentMap.size() > 0) - { - bcfg << QString("emap " + currentMap).toUtf8(); - if(pMapContainer->getCurrentIsMission()) - bcfg << QString("escript Maps/%1/map.lua").arg(currentMap).toUtf8(); - } - bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8(); - - if (Scripts->currentIndex() > 0) - { - bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex()).toList()[0].toString()).toUtf8(); - } - - bcfg << QString("eseed " + pMapContainer->getCurrentSeed()).toUtf8(); - bcfg << QString("e$gmflags %1").arg(getGameFlags()).toUtf8(); - bcfg << QString("e$damagepct %1").arg(schemeData(26).toInt()).toUtf8(); - bcfg << QString("e$turntime %1").arg(schemeData(27).toInt() * 1000).toUtf8(); - bcfg << QString("e$sd_turns %1").arg(schemeData(29).toInt()).toUtf8(); - bcfg << QString("e$casefreq %1").arg(schemeData(30).toInt()).toUtf8(); - bcfg << QString("e$minestime %1").arg(schemeData(31).toInt() * 1000).toUtf8(); - bcfg << QString("e$minesnum %1").arg(schemeData(32).toInt()).toUtf8(); - bcfg << QString("e$minedudpct %1").arg(schemeData(33).toInt()).toUtf8(); - bcfg << QString("e$explosives %1").arg(schemeData(34).toInt()).toUtf8(); - bcfg << QString("e$healthprob %1").arg(schemeData(35).toInt()).toUtf8(); - bcfg << QString("e$hcaseamount %1").arg(schemeData(36).toInt()).toUtf8(); - bcfg << QString("e$waterrise %1").arg(schemeData(37).toInt()).toUtf8(); - bcfg << QString("e$healthdec %1").arg(schemeData(38).toInt()).toUtf8(); - bcfg << QString("e$ropepct %1").arg(schemeData(39).toInt()).toUtf8(); - bcfg << QString("e$getawaytime %1").arg(schemeData(40).toInt()).toUtf8(); - bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8(); - bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8(); - - switch (mapgen) - { - case MAPGEN_MAZE: - bcfg << QString("e$maze_size %1").arg(pMapContainer->getMazeSize()).toUtf8(); - break; - - case MAPGEN_DRAWN: - { - QByteArray data = pMapContainer->getDrawnMapData(); - while(data.size() > 0) - { - QByteArray tmp = data; - tmp.truncate(200); - tmp.prepend("edraw "); - bcfg << tmp; - data.remove(0, 200); - } - break; - } - default: ; - } - - QByteArray result; - - foreach(QByteArray ba, bcfg) - HWProto::addByteArrayToBuffer(result, ba); - - return result; -} - -void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo) -{ - bool illegal = ammo.size() != cDefaultAmmoStore->size(); - if (illegal) - QMessageBox::critical(this, tr("Error"), tr("Illegal ammo scheme")); - - int pos = WeaponsName->findText(name); - if ((pos == -1) || illegal) { // prevent from overriding schemes with bad ones - WeaponsName->addItem(name, ammo); - WeaponsName->setCurrentIndex(WeaponsName->count() - 1); - } else { - WeaponsName->setItemData(pos, ammo); - WeaponsName->setCurrentIndex(pos); - } -} - -void GameCFGWidget::fullNetConfig() -{ - ammoChanged(WeaponsName->currentIndex()); - - seedChanged(pMapContainer->getCurrentSeed()); - templateFilterChanged(pMapContainer->getTemplateFilter()); - themeChanged(pMapContainer->getCurrentTheme()); - - schemeChanged(GameSchemes->currentIndex()); - scriptChanged(Scripts->currentIndex()); - - mapgenChanged(pMapContainer->get_mapgen()); - maze_sizeChanged(pMapContainer->getMazeSize()); - - // map must be the last - QString map = pMapContainer->getCurrentMap(); - if (map.size()) - mapChanged(map); -} - -void GameCFGWidget::setParam(const QString & param, const QStringList & slValue) -{ - if (slValue.size() == 1) - { - QString value = slValue[0]; - if (param == "MAP") { - pMapContainer->setMap(value); - return; - } - if (param == "SEED") { - pMapContainer->setSeed(value); - if (!seedRegexp.exactMatch(value)) { - pMapContainer->seedEdit->setVisible(true); - } - return; - } - if (param == "THEME") { - pMapContainer->setTheme(value); - return; - } - if (param == "TEMPLATE") { - pMapContainer->setTemplateFilter(value.toUInt()); - return; - } - if (param == "MAPGEN") { - pMapContainer->setMapgen((MapGenerator)value.toUInt()); - return; - } - if (param == "MAZE_SIZE") { - pMapContainer->setMazeSize(value.toUInt()); - return; - } - if (param == "SCRIPT") { - Scripts->setCurrentIndex(Scripts->findText(value)); - return; - } - if (param == "DRAWNMAP") { - pMapContainer->setDrawnMapData(qUncompress(QByteArray::fromBase64(slValue[0].toLatin1()))); - return; - } - } - - if (slValue.size() == 2) - { - if (param == "AMMO") { - setNetAmmo(slValue[0], slValue[1]); - return; - } - } - - if (slValue.size() == 5) - { - if (param == "FULLMAPCONFIG") - { - QString seed = slValue[3]; - if (!seedRegexp.exactMatch(seed)) - pMapContainer->seedEdit->setVisible(true); - - pMapContainer->setAllMapParameters( - slValue[0], - (MapGenerator)slValue[1].toUInt(), - slValue[2].toUInt(), - seed, - slValue[4].toUInt() - ); - return; - } - } - - qWarning("Got bad config param from net"); -} - -void GameCFGWidget::ammoChanged(int index) -{ - if (index >= 0) { - emit paramChanged( - "AMMO", - QStringList() << WeaponsName->itemText(index) << WeaponsName->itemData(index).toString() - ); - } -} - -void GameCFGWidget::mapChanged(const QString & value) -{ - if(isEnabled() && pMapContainer->getCurrentIsMission()) - { - Scripts->setEnabled(false); - Scripts->setCurrentIndex(0); - - if (pMapContainer->getCurrentScheme() == "locked") - { - GameSchemes->setEnabled(false); - GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); - } - else - { - GameSchemes->setEnabled(true); - int num = GameSchemes->findText(pMapContainer->getCurrentScheme()); - if (num != -1) - GameSchemes->setCurrentIndex(num); - else - GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); - } - - if (pMapContainer->getCurrentWeapons() == "locked") - { - WeaponsName->setEnabled(false); - WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); - } - else - { - WeaponsName->setEnabled(true); - int num = WeaponsName->findText(pMapContainer->getCurrentWeapons()); - if (num != -1) - WeaponsName->setCurrentIndex(num); - else - WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); - } - - if (pMapContainer->getCurrentScheme() != "locked" && pMapContainer->getCurrentWeapons() != "locked") - bindEntries->setEnabled(true); - else - bindEntries->setEnabled(false); - } - else - { - Scripts->setEnabled(true); - GameSchemes->setEnabled(true); - WeaponsName->setEnabled(true); - bindEntries->setEnabled(true); - } - emit paramChanged("MAP", QStringList(value)); -} - -void GameCFGWidget::templateFilterChanged(int value) -{ - emit paramChanged("TEMPLATE", QStringList(QString::number(value))); -} - -void GameCFGWidget::seedChanged(const QString & value) -{ - emit paramChanged("SEED", QStringList(value)); -} - -void GameCFGWidget::themeChanged(const QString & value) -{ - emit paramChanged("THEME", QStringList(value)); -} - -void GameCFGWidget::schemeChanged(int index) -{ - QStringList sl; - - int size = GameSchemes->model()->columnCount(); - for(int i = 0; i < size; ++i) - sl << schemeData(i).toString(); - - emit paramChanged("SCHEME", sl); - - if (isEnabled() && bindEntries->isEnabled() && bindEntries->isChecked()) { - QString schemeName = GameSchemes->itemText(index); - for (int i = 0; i < WeaponsName->count(); i++) { - QString weapName = WeaponsName->itemText(i); - int res = QString::compare(weapName, schemeName, Qt::CaseSensitive); - if (0 == res) { - WeaponsName->setCurrentIndex(i); - emit ammoChanged(i); - break; - } - } - } -} - -void GameCFGWidget::scriptChanged(int index) -{ - if(isEnabled() && index > 0) - { - QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString(); - QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[2].toString(); - - if (scheme == "locked") - { - GameSchemes->setEnabled(false); - GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); - } - else - { - GameSchemes->setEnabled(true); - int num = GameSchemes->findText(scheme); - if (num != -1) - GameSchemes->setCurrentIndex(num); - else - GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); - } - - if (weapons == "locked") - { - WeaponsName->setEnabled(false); - WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); - } - else - { - WeaponsName->setEnabled(true); - int num = WeaponsName->findText(weapons); - if (num != -1) - WeaponsName->setCurrentIndex(num); - else - WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); - } - - if (scheme != "locked" && weapons != "locked") - bindEntries->setEnabled(true); - else - bindEntries->setEnabled(false); - } - else - { - GameSchemes->setEnabled(true); - WeaponsName->setEnabled(true); - bindEntries->setEnabled(true); - } - emit paramChanged("SCRIPT", QStringList(Scripts->itemText(index))); -} - -void GameCFGWidget::mapgenChanged(MapGenerator m) -{ - emit paramChanged("MAPGEN", QStringList(QString::number(m))); -} - -void GameCFGWidget::maze_sizeChanged(int s) -{ - emit paramChanged("MAZE_SIZE", QStringList(QString::number(s))); -} - -void GameCFGWidget::resendSchemeData() -{ - schemeChanged(GameSchemes->currentIndex()); -} - -void GameCFGWidget::onDrawnMapChanged(const QByteArray & data) -{ - emit paramChanged("DRAWNMAP", QStringList(qCompress(data, 9).toBase64())); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/gamecfgwidget.h --- a/QTfrontend/gamecfgwidget.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef GAMECONFIGWIDGET_H -#define GAMECONFIGWIDGET_H - -#include -#include -#include -#include -#include - -#include "mapContainer.h" - -class QCheckBox; -class QVBoxLayout; -class QLabel; -class QTableView; - -class GameCFGWidget : public QGroupBox -{ - Q_OBJECT - -public: - GameCFGWidget(QWidget* parent); - quint32 getGameFlags() const; - quint32 getInitHealth() const; - QByteArray getFullConfig() const; - QComboBox * Scripts; - QComboBox * GameSchemes; - QComboBox * WeaponsName; - HWMapContainer* pMapContainer; - QTableView * tv; - QVariant schemeData(int column) const; - -public slots: - void setParam(const QString & param, const QStringList & value); - void fullNetConfig(); - void resendSchemeData(); - -signals: - void paramChanged(const QString & param, const QStringList & value); - void goToSchemes(int); - void goToWeapons(int); - void goToDrawMap(); - -private slots: - void ammoChanged(int index); - void mapChanged(const QString &); - void templateFilterChanged(int); - void seedChanged(const QString &); - void themeChanged(const QString &); - void schemeChanged(int); - void scriptChanged(int); - void jumpToSchemes(); - void jumpToWeapons(); - void mapgenChanged(MapGenerator m); - void maze_sizeChanged(int s); - void onDrawnMapChanged(const QByteArray & data); - -private: - QGridLayout mainLayout; - QCheckBox * bindEntries; - QString curNetAmmoName; - QString curNetAmmo; - QRegExp seedRegexp; - - void setNetAmmo(const QString& name, const QString& ammo); - -}; - -#endif // GAMECONFIGWIDGET_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hats.cpp --- a/QTfrontend/hats.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include "hwconsts.h" -#include "hwform.h" -#include "hats.h" - -HatsModel::HatsModel(QObject* parent) : - QAbstractListModel(parent) -{ - QFile hhfile; - hhfile.setFileName(cfgdir->absolutePath() + "/Data/Graphics/Hedgehog/Idle.png"); - if (!hhfile.exists()) hhfile.setFileName(datadir->absolutePath() + "/Graphics/Hedgehog/Idle.png"); - QPixmap hhpix = QPixmap(QFileInfo(hhfile).absoluteFilePath()).copy(0, 0, 32, 32); - - QDir tmpdir; - tmpdir.cd(cfgdir->absolutePath()); - tmpdir.cd("Data"); - tmpdir.cd("Graphics"); - tmpdir.cd("Hats"); - - tmpdir.setFilter(QDir::Files); - - QStringList userhatsList = tmpdir.entryList(QStringList("*.png")); - for (QStringList::Iterator it = userhatsList.begin(); it != userhatsList.end(); ++it ) - { - QString str = QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1"); - QPixmap pix(cfgdir->absolutePath() + "/Data/Graphics/Hats/" + str + ".png"); - - QPixmap tmppix(32, 37); - tmppix.fill(QColor(Qt::transparent)); - - QPainter painter(&tmppix); - painter.drawPixmap(QPoint(0, 5), hhpix); - painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32)); - if(pix.width() > 32) - painter.drawPixmap(QPoint(0, 0), pix.copy(32, 0, 32, 32)); - painter.end(); - - hats.append(qMakePair(str, QIcon(tmppix))); - } - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Graphics"); - tmpdir.cd("Hats"); - - QStringList hatsList = tmpdir.entryList(QStringList("*.png")); - for (QStringList::Iterator it = hatsList.begin(); it != hatsList.end(); ++it ) - { - if (userhatsList.contains(*it,Qt::CaseInsensitive)) continue; - QString str = (*it).replace(QRegExp("^(.*)\\.png"), "\\1"); - QPixmap pix(datadir->absolutePath() + "/Graphics/Hats/" + str + ".png"); - - QPixmap tmppix(32, 37); - tmppix.fill(QColor(Qt::transparent)); - - QPainter painter(&tmppix); - painter.drawPixmap(QPoint(0, 5), hhpix); - painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32)); - if(pix.width() > 32) - painter.drawPixmap(QPoint(0, 0), pix.copy(32, 0, 32, 32)); - painter.end(); - - hats.append(qMakePair(str, QIcon(tmppix))); - } - // Reserved hats - tmpdir.cd("Reserved"); - hatsList = tmpdir.entryList(QStringList(playerHash+"*.png")); - for (QStringList::Iterator it = hatsList.begin(); it != hatsList.end(); ++it ) - { - QString str = (*it).replace(QRegExp("^(.*)\\.png"), "\\1"); - QPixmap pix(datadir->absolutePath() + "/Graphics/Hats/Reserved/" + str + ".png"); - - QPixmap tmppix(32, 37); - tmppix.fill(QColor(Qt::transparent)); - - QPainter painter(&tmppix); - painter.drawPixmap(QPoint(0, 5), hhpix); - painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32)); - painter.end(); - - hats.append(qMakePair("Reserved "+str.remove(0,32), QIcon(tmppix))); - } -} - -QVariant HatsModel::headerData(int section, - Qt::Orientation orientation, int role) const -{ - Q_UNUSED(section); - Q_UNUSED(orientation); - Q_UNUSED(role); - - return QVariant(); -} - -int HatsModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - else - return hats.size(); -} - -/*int HatsModel::columnCount(const QModelIndex & parent) const -{ - if (parent.isValid()) - return 0; - else - return 2; -} -*/ -QVariant HatsModel::data(const QModelIndex &index, - int role) const -{ - if (!index.isValid() || index.row() < 0 - || index.row() >= hats.size() - || (role != Qt::DisplayRole && role != Qt::DecorationRole)) - return QVariant(); - - if (role == Qt::DisplayRole) - return hats.at(index.row()).first; - else // role == Qt::DecorationRole - return hats.at(index.row()).second; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hats.h --- a/QTfrontend/hats.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _HATS_INCLUDED -#define _HATS_INCLUDED - -#include -#include -#include -#include -#include - -class HatsModel : public QAbstractListModel -{ - Q_OBJECT - -public: - HatsModel(QObject *parent = 0); - - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - int rowCount(const QModelIndex & parent) const; - //int columnCount(const QModelIndex & parent) const; - - QVariant data(const QModelIndex &index, int role) const; -protected: - QVector > hats; -}; - -#endif // _HATS_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hedgehogerWidget.cpp --- a/QTfrontend/hedgehogerWidget.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Ulyanov Igor - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "hedgehogerWidget.h" - -#include "frameTeam.h" - -CHedgehogerWidget::CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent) : - ItemNum(im, img, parent, 1) -{ - // TODO: maxHedgehogsPerGame doesn't reset properly and won't match map limits for now - /*if(parent) { - pOurFrameTeams = dynamic_cast(parent->parentWidget()); - } - if(pOurFrameTeams->overallHedgehogs + 4 > pOurFrameTeams->maxHedgehogsPerGame) { - numItems = pOurFrameTeams->maxHedgehogsPerGame - pOurFrameTeams->overallHedgehogs; - } else numItems = 4; - pOurFrameTeams->overallHedgehogs += numItems;*/ -} - -void CHedgehogerWidget::incItems() -{ - //if (pOurFrameTeams->overallHedgehogs < pOurFrameTeams->maxHedgehogsPerGame) { - numItems++; - //pOurFrameTeams->overallHedgehogs++; - emit hedgehogsNumChanged(); - //} -} - -void CHedgehogerWidget::decItems() -{ - numItems--; - //pOurFrameTeams->overallHedgehogs--; - emit hedgehogsNumChanged(); -} - -CHedgehogerWidget::~CHedgehogerWidget() -{ - // TODO: not called? - //pOurFrameTeams->overallHedgehogs-=numItems; -} - -void CHedgehogerWidget::setNonInteractive() -{ - nonInteractive=true; -} - -void CHedgehogerWidget::setHHNum(unsigned int num) -{ - /*unsigned int diff = num - numItems; - numItems += diff; - pOurFrameTeams->overallHedgehogs += diff;*/ - numItems = num; - repaint(); -} - -unsigned char CHedgehogerWidget::getHedgehogsNum() const -{ - return numItems; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hedgehogerWidget.h --- a/QTfrontend/hedgehogerWidget.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Ulyanov Igor - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _HEDGEHOGER_WIDGET -#define _HEDGEHOGER_WIDGET - -#include "itemNum.h" - -class FrameTeams; - -class CHedgehogerWidget : public ItemNum -{ - Q_OBJECT - - public: - CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent); - virtual ~CHedgehogerWidget(); - unsigned char getHedgehogsNum() const; - void setHHNum (unsigned int num); - void setNonInteractive(); - - signals: - void hedgehogsNumChanged(); - - protected: - virtual void incItems(); - virtual void decItems(); - - private: - CHedgehogerWidget(); - FrameTeams* pOurFrameTeams; -}; - -#endif // _HEDGEHOGER_WIDGET diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hedgewars.qrc --- a/QTfrontend/hedgewars.qrc Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/hedgewars.qrc Fri Oct 28 18:33:38 2011 +0200 @@ -1,6 +1,8 @@ ../share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png + res/css/qt.css + res/css/chat.css res/hh25x25.png res/hh25x25grey.png res/ammopic.png @@ -45,6 +47,7 @@ res/unchecked.png res/graphicsicon.png res/miscicon.png + res/Load.png res/Save.png res/Record.png res/weaponsicon.png @@ -57,31 +60,31 @@ res/PlaySound.png res/hh_small.png res/btnDisabled.png - res/btnForts.png - res/btnBorder.png - res/btnInvulnerable.png - res/btnLaserSight.png - res/btnLowGravity.png - res/btnResetHealth.png - res/btnTeamsDivide.png - res/btnSolid.png - res/btnVampiric.png - res/btnKarma.png - res/btnArtillery.png - res/btnRandomOrder.png - res/btnKing.png - res/btnPlaceHog.png - res/btnSharedAmmo.png - res/btnDisableGirders.png - res/btnDisableLandObjects.png - res/btnAISurvival.png - res/btnInfAttack.png - res/btnResetWeps.png - res/btnPerHogAmmo.png - res/btnNoWind.png - res/btnMoreWind.png - res/btnTagTeam.png - res/btnBottomBorder.png + res/btnForts@2x.png + res/btnBorder@2x.png + res/btnInvulnerable@2x.png + res/btnLaserSight@2x.png + res/btnLowGravity@2x.png + res/btnResetHealth@2x.png + res/btnTeamsDivide@2x.png + res/btnSolid@2x.png + res/btnVampiric@2x.png + res/btnKarma@2x.png + res/btnArtillery@2x.png + res/btnRandomOrder@2x.png + res/btnKing@2x.png + res/btnPlaceHog@2x.png + res/btnSharedAmmo@2x.png + res/btnDisableGirders@2x.png + res/btnDisableLandObjects@2x.png + res/btnAISurvival@2x.png + res/btnInfAttack@2x.png + res/btnResetWeps@2x.png + res/btnPerHogAmmo@2x.png + res/btnNoWind@2x.png + res/btnMoreWind@2x.png + res/btnTagTeam@2x.png + res/btnBottomBorder@2x.png res/iconBox.png res/iconHealth.png res/iconSuddenDeath.png diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/hwform.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -44,7 +44,6 @@ #include "hwform.h" #include "game.h" #include "team.h" -#include "namegen.h" #include "teamselect.h" #include "selectWeapon.h" #include "gameuiconfig.h" @@ -81,6 +80,8 @@ #include "xfire.h" #include "drawmapwidget.h" +#include "HWDataManager.h" + #ifdef __APPLE__ #include "M3Panel.h" #ifdef SPARKLE_ENABLED @@ -95,12 +96,21 @@ QString playerHash; HWForm::HWForm(QWidget *parent, QString styleSheet) - : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0) + : QMainWindow(parent) + , game(0) + , pnetserver(0) + , pRegisterServer(0) + , editedTeam(0) + , hwnet(0) { + // set music track + SDLInteraction::instance().setMusicTrack( + HWDataManager::instance().findFileForRead("Music/main_theme.ogg") + ); + #ifdef USE_XFIRE xfire_init(); #endif - game = NULL; gameSettings = new QSettings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat); frontendEffects = gameSettings->value("frontend/effects", true).toBool(); playerHash = QString(QCryptographicHash::hash(gameSettings->value("net/nick","").toString().toLatin1(), QCryptographicHash::Md5).toHex()); @@ -111,11 +121,10 @@ //setFocusPolicy(Qt::StrongFocus); CustomizePalettes(); - ui.pageOptions->CBResolution->addItems(sdli.getResolutions()); + ui.pageOptions->CBResolution->addItems(SDLInteraction::instance().getResolutions()); config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); - namegen = new HWNamegen(); #ifdef __APPLE__ panel = new M3Panel; @@ -167,14 +176,10 @@ connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map())); pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD); - connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); - connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); + //connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); + //connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); - connect(ui.pageEditTeam->BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave())); - connect(ui.pageEditTeam->BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard())); - - connect(ui.pageEditTeam->signalMapper2, SIGNAL(mapped(const int &)), this, SLOT(RandomName(const int &))); - connect(ui.pageEditTeam->randTeamButton, SIGNAL(clicked()), this, SLOT(RandomNames())); + connect(ui.pageEditTeam, SIGNAL(teamEdited()), this, SLOT(AfterTeamEdit())); connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame())); connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)), @@ -189,11 +194,11 @@ connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo())); connect(ui.pagePlayDemo->DemosList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(PlayDemo())); - connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); - connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); - connect(ui.pageOptions->BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(DeleteTeam())); - connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions())); - connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack())); + connect(ui.pageOptions, SIGNAL(newTeamRequested()), this, SLOT(NewTeam())); + connect(ui.pageOptions, SIGNAL(editTeamRequested(const QString&)), this, SLOT(EditTeam(const QString&))); + connect(ui.pageOptions, SIGNAL(deleteTeamRequested(const QString&)), this, SLOT(DeleteTeam(const QString&))); + connect(ui.pageOptions->btnSave, SIGNAL(clicked()), config, SLOT(SaveOptions())); + connect(ui.pageOptions->btnSave, SIGNAL(clicked()), this, SLOT(GoBack())); connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles())); connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon())); @@ -240,7 +245,7 @@ connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves())); connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos())); - connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining())); + connect(ui.pageTraining, SIGNAL(startMission(const QString&)), this, SLOT(startTraining(const QString&))); connect(ui.pageCampaign->BtnStartCampaign, SIGNAL(clicked()), this, SLOT(StartCampaign())); connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int))); @@ -281,26 +286,27 @@ #ifdef USE_XFIRE void HWForm::updateXfire(void) { - if(hwnet) + if(hwnet && (hwnet->clientState() != HWNewNet::Disconnected)) { xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare("netserver.hedgewars.org:46631") ? "Official server" : hwnet->getHost().toAscii()); - switch(hwnet->getClientState()) + switch(hwnet->clientState()) { - case 1: // Connecting + case HWNewNet::Connecting: // Connecting + case HWNewNet::Connected: xfire_setvalue(XFIRE_STATUS, "Connecting"); xfire_setvalue(XFIRE_NICKNAME, "-"); xfire_setvalue(XFIRE_ROOM, "-"); - case 2: // In lobby + case HWNewNet::InLobby: // In lobby xfire_setvalue(XFIRE_STATUS, "Online"); xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii()); xfire_setvalue(XFIRE_ROOM, "In game lobby"); break; - case 3: // In room + case HWNewNet::InRoom: // In room xfire_setvalue(XFIRE_STATUS, "Online"); xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii()); xfire_setvalue(XFIRE_ROOM, (hwnet->getRoom() + " (waiting for players)").toAscii()); break; - case 5: // In game + case HWNewNet::InGame: // In game xfire_setvalue(XFIRE_STATUS, "Online"); xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii()); xfire_setvalue(XFIRE_ROOM, (hwnet->getRoom() + " (playing or spectating)").toAscii()); @@ -456,6 +462,10 @@ #ifdef USE_XFIRE updateXfire(); #endif + if (id == ID_PAGE_DATADOWNLOAD) + { + ui.pageDataDownload->fetchList(); + } if (id == ID_PAGE_DRAWMAP) { DrawMapScene * scene; if(lastid == ID_PAGE_MULTIPLAYER) @@ -473,14 +483,18 @@ ui.pageNetGame->pGameCFG->pMapContainer->mapDrawingFinished(); } + if (id == ID_PAGE_ROOMSLIST) { + if (hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills. + game->netSuspend = true; + ui.pageRoomsList->displayWarning(tr("Game aborted")); + game->abort(); + } + } + if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) { QStringList tmNames = config->GetTeamsList(); TeamSelWidget* curTeamSelWidget; - ui.pageOptions->BtnNewTeam->setVisible(false); - ui.pageOptions->BtnEditTeam->setVisible(false); - ui.pageOptions->BtnDeleteTeam->setVisible(false); - ui.pageOptions->CBTeamName->setVisible(false); - ui.pageOptions->LblNoEditTeam->setVisible(true); + ui.pageOptions->setTeamOptionsEnabled(false); if (id == ID_PAGE_MULTIPLAYER) { curTeamSelWidget = ui.pageMultiplayer->teamsSelect; @@ -511,11 +525,7 @@ } if (id == ID_PAGE_MAIN) { - ui.pageOptions->BtnNewTeam->setVisible(true); - ui.pageOptions->BtnEditTeam->setVisible(true); - ui.pageOptions->BtnDeleteTeam->setVisible(true); - ui.pageOptions->CBTeamName->setVisible(true); - ui.pageOptions->LblNoEditTeam->setVisible(false); + ui.pageOptions->setTeamOptionsEnabled(true); } // load and save ignore/friends lists @@ -527,13 +537,9 @@ if (id == ID_PAGE_NETGAME) // joining a room ui.pageNetGame->pChatWidget->loadLists(ui.pageOptions->editNetNick->text()); // joining the lobby - else if (id == ID_PAGE_ROOMSLIST) { - if (hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills. - game->netSuspend = true; - game->KillAllTeams(); - } + else if (id == ID_PAGE_ROOMSLIST) ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text()); - } + } void HWForm::GoToPage(int id) @@ -546,8 +552,11 @@ void HWForm::GoBack() { + int curid = ui.Pages->currentIndex(); + if (curid == ID_PAGE_MAIN) + exit(); + int id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop(); - int curid = ui.Pages->currentIndex(); ui.Pages->setCurrentIndex(id); OnPageShown(id, curid); @@ -563,7 +572,7 @@ GoBack(); if (curid == ID_PAGE_ROOMSLIST || curid == ID_PAGE_CONNECTING) NetDisconnect(); - if (curid == ID_PAGE_NETGAME && hwnet) hwnet->partRoom(); + if (curid == ID_PAGE_NETGAME && hwnet && hwnet->isInRoom()) hwnet->partRoom(); // need to work on this, can cause invalid state for admin quit trying to prevent bad state message on kick //if (curid == ID_PAGE_NETGAME && (!game || game->gameState != gsStarted)) hwnet->partRoom(); @@ -582,14 +591,15 @@ eggTimer.start(); } -void HWForm::btnExitClicked() +void HWForm::exit() { - if (eggTimer.elapsed() < 3000){ +// if (eggTimer.elapsed() < 3000){ #ifdef __APPLE__ panel->showInstallController(); #endif close(); - } +// TODO reactivate egg +/* } else { QPushButton * btn = findChild("imageButt"); @@ -597,7 +607,7 @@ { btn->setIcon(QIcon(":/res/bonus.png")); } - } + } */ } void HWForm::IntermediateSetup() @@ -624,61 +634,30 @@ void HWForm::NewTeam() { - editedTeam = new HWTeam(QLineEdit::tr("unnamed")); - editedTeam->SetToPage(this); - GoToPage(ID_PAGE_SETUP_TEAM); -} - -void HWForm::EditTeam() -{ - editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText()); - editedTeam->loadFromFile(); - editedTeam->SetToPage(this); + ui.pageEditTeam->createTeam(QLineEdit::tr("unnamed"), playerHash); + UpdateTeamsLists(); GoToPage(ID_PAGE_SETUP_TEAM); } -void HWForm::DeleteTeam() +void HWForm::EditTeam(const QString & teamName) { - QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel); - - if (reallyDelete.exec() == QMessageBox::Ok) { - editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText()); - editedTeam->deleteFile(); - - // Remove from lists - ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex()); - } + ui.pageEditTeam->editTeam(teamName, playerHash); + GoToPage(ID_PAGE_SETUP_TEAM); } -void HWForm::RandomNames() -{ - editedTeam->GetFromPage(this); - namegen->teamRandomNames(*editedTeam, true); - editedTeam->SetToPage(this); -} - -void HWForm::RandomName(const int &i) +void HWForm::AfterTeamEdit() { - editedTeam->GetFromPage(this); - namegen->teamRandomName(*editedTeam,i); - editedTeam->SetToPage(this); -} - -void HWForm::TeamSave() -{ - editedTeam->GetFromPage(this); - editedTeam->saveToFile(); - delete editedTeam; - editedTeam=0; UpdateTeamsLists(); GoBack(); } -void HWForm::TeamDiscard() + +void HWForm::DeleteTeam(const QString & teamName) { - delete editedTeam; - editedTeam=0; - GoBack(); + ui.pageEditTeam->deleteTeam(teamName); + QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel); + + UpdateTeamsLists(); } void HWForm::DeleteScheme() @@ -798,19 +777,19 @@ ShowErrorMessage(errmsg); // no break case ID_PAGE_NETGAME: - ui.pageNetGame->pChatWidget->addLine("Error",errmsg); + ui.pageNetGame->displayError(errmsg); break; default: - ui.pageRoomsList->chatWidget->addLine("Error",errmsg); + ui.pageRoomsList->displayError(errmsg); } } void HWForm::NetWarning(const QString & wrnmsg) { if (ui.Pages->currentIndex() == ID_PAGE_NETGAME || ui.Pages->currentIndex() == ID_PAGE_INGAME) - ui.pageNetGame->pChatWidget->addLine("Warning",wrnmsg); + ui.pageNetGame->displayWarning(wrnmsg); else - ui.pageRoomsList->chatWidget->addLine("Warning",wrnmsg); + ui.pageRoomsList->displayWarning(wrnmsg); } void HWForm::_NetConnect(const QString & hostName, quint16 port, QString nick) @@ -828,7 +807,7 @@ GoToPage(ID_PAGE_CONNECTING); connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame())); - connect(hwnet, SIGNAL(Connected()), this, SLOT(NetConnected())); + connect(hwnet, SIGNAL(connected()), this, SLOT(NetConnected())); connect(hwnet, SIGNAL(Error(const QString&)), this, SLOT(NetError(const QString&))); connect(hwnet, SIGNAL(Warning(const QString&)), this, SLOT(NetWarning(const QString&))); connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter())); @@ -944,7 +923,7 @@ connect(ui.pageAdmin, SIGNAL(clearAccountsCache()), hwnet, SLOT(clearAccountsCache())); // disconnect - connect(hwnet, SIGNAL(Disconnected(const QString&)), this, SLOT(ForcedDisconnect(const QString&)), Qt::QueuedConnection); + connect(hwnet, SIGNAL(disconnected(const QString&)), this, SLOT(ForcedDisconnect(const QString&)), Qt::QueuedConnection); // config stuff connect(hwnet, SIGNAL(paramChanged(const QString &, const QStringList &)), ui.pageNetGame->pGameCFG, SLOT(setParam(const QString &, const QStringList &))); @@ -1166,11 +1145,11 @@ demofile.close(); } -void HWForm::StartTraining() +void HWForm::startTraining(const QString & scriptName) { CreateGame(0, 0, 0); - game->StartTraining(ui.pageTraining->CBSelect->itemData(ui.pageTraining->CBSelect->currentIndex()).toString()); + game->StartTraining(scriptName); } void HWForm::StartCampaign() @@ -1187,7 +1166,7 @@ ui.pageNetGame->pGameCFG->WeaponsName->currentIndex() ).toString(); - CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo); + CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo); connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &))); connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &))); @@ -1210,9 +1189,9 @@ void HWForm::Music(bool checked) { if (checked) - sdli.StartMusic(); + SDLInteraction::instance().startMusic(); else - sdli.StopMusic(); + SDLInteraction::instance().stopMusic(); } void HWForm::NetGameChangeStatus(bool isMaster) @@ -1240,7 +1219,7 @@ // disconnect connections first to ensure their inexistance and not to connect twice ui.pageNetGame->BtnStart->disconnect(hwnet); ui.pageNetGame->BtnUpdate->disconnect(hwnet); - ui.pageNetGame->leRoomName->setText(hwnet->getRoom()); + ui.pageNetGame->setRoomName(hwnet->getRoom()); ui.pageNetGame->restrictJoins->disconnect(hwnet); ui.pageNetGame->restrictTeamAdds->disconnect(hwnet); connect(ui.pageNetGame->BtnStart, SIGNAL(clicked()), hwnet, SLOT(startGame())); @@ -1286,7 +1265,7 @@ { GoBack(); if (!reason.isEmpty()) - ui.pageRoomsList->chatWidget->addLine("Notice",reason); + ui.pageRoomsList->displayNotice(reason); } else qWarning("Left room while not in room"); @@ -1309,24 +1288,14 @@ HWTeam team(ui.pageCampaign->CBTeam->currentText()); ui.pageCampaign->CBSelect->clear(); - QDir tmpdir; - tmpdir.cd(cfgdir->absolutePath()); - tmpdir.cd("Data/Missions/Campaign"); - tmpdir.setFilter(QDir::Files); - QStringList userentries = tmpdir.entryList(QStringList("*#*.lua")); - //entries.sort(); - unsigned int n = userentries.count(); - for(unsigned int i = 0; (i < n) && (i <= team.campaignProgress()); i++) - ui.pageCampaign->CBSelect->addItem(QString(userentries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2").replace("_", " "), QString(userentries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1")); - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Missions/Campaign"); - tmpdir.setFilter(QDir::Files); - QStringList entries = tmpdir.entryList(QStringList("*#*.lua")); - //entries.sort(); - n = entries.count(); + QStringList entries = HWDataManager::instance().entryList( + "Missions/Campaign", + QDir::Files, + QStringList("*#*.lua") + ); + + unsigned int n = entries.count(); for(unsigned int i = 0; (i < n) && (i <= team.campaignProgress()); i++) { - if (userentries.contains(entries[i])) continue; ui.pageCampaign->CBSelect->addItem(QString(entries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2").replace("_", " "), QString(entries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1")); } } diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hwform.h --- a/QTfrontend/hwform.h Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/hwform.h Fri Oct 28 18:33:38 2011 +0200 @@ -22,11 +22,12 @@ #include #include #include +#include #include "netserver.h" #include "game.h" #include "ui_hwform.h" -#include "SDLs.h" +#include "SDLInteraction.h" #include "bgwidget.h" #ifdef __APPLE__ @@ -54,11 +55,11 @@ public: HWForm(QWidget *parent = 0, QString styleSheet = ""); Ui_HWForm ui; - SDLInteraction sdli; GameUIConfig * config; QSettings * gameSettings; // Same file GameUIConfig points to but without the baggage. Needs sync() calls if you want to get GameUIConfig changes though void updateXfire(); void PlayDemoQuick(const QString & demofilename); + void exit(); private slots: void GoToSaves(); @@ -76,20 +77,16 @@ QString getDemoArguments(); void AssociateFiles(); void btnExitPressed(); - void btnExitClicked(); void IntermediateSetup(); void NewTeam(); - void EditTeam(); - void DeleteTeam(); - void RandomNames(); - void RandomName(const int &i); - void TeamSave(); - void TeamDiscard(); + void EditTeam(const QString & teamName); + void AfterTeamEdit(); + void DeleteTeam(const QString & teamName); void DeleteScheme(); void DeleteWeaponSet(); void SimpleGame(); void PlayDemo(); - void StartTraining(); + void startTraining(const QString&); void StartCampaign(); void NetConnect(); void NetConnectServer(const QString & host, quint16 port); @@ -160,11 +157,11 @@ ID_PAGE_DRAWMAP = 20, ID_PAGE_DATADOWNLOAD = 21 }; - HWGame * game; - HWNetServer* pnetserver; - HWNetRegisterServer* pRegisterServer; - HWTeam * editedTeam; - HWNewNet * hwnet; + QPointer game; + QPointer pnetserver; + QPointer pRegisterServer; + QPointer editedTeam; + QPointer hwnet; HWNamegen * namegen; AmmoSchemeModel * ammoSchemeModel; QStack PagesStack; diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hwmap.cpp --- a/QTfrontend/hwmap.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Ulyanov Igor - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "hwconsts.h" -#include "hwmap.h" - -HWMap::HWMap() : - TCPBase(false) -{ -} - -HWMap::~HWMap() -{ -} - -void HWMap::getImage(const QString & seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData) -{ - m_seed = seed; - templateFilter = filter; - m_mapgen = mapgen; - m_maze_size = maze_size; - if(mapgen == MAPGEN_DRAWN) m_drawMapData = drawMapData; - Start(); -} - -QStringList HWMap::getArguments() -{ - QStringList arguments; - arguments << cfgdir->absolutePath(); - arguments << QString("%1").arg(ipc_port); - arguments << "landpreview"; - return arguments; -} - -void HWMap::onClientDisconnect() -{ - if (readbuffer.size() == 128 * 32 + 1) - { - quint8 *buf = (quint8*) readbuffer.constData(); - QImage im(buf, 256, 128, QImage::Format_Mono); - im.setNumColors(2); - emit HHLimitReceived(buf[128 * 32]); - emit ImageReceived(im); - } -} - -void HWMap::SendToClientFirst() -{ - SendIPC(QString("eseed %1").arg(m_seed).toUtf8()); - SendIPC(QString("e$template_filter %1").arg(templateFilter).toUtf8()); - SendIPC(QString("e$mapgen %1").arg(m_mapgen).toUtf8()); - - switch (m_mapgen) - { - case MAPGEN_MAZE: - SendIPC(QString("e$maze_size %1").arg(m_maze_size).toUtf8()); - break; - - case MAPGEN_DRAWN: - { - QByteArray data = m_drawMapData; - while(data.size() > 0) - { - QByteArray tmp = data; - tmp.truncate(200); - SendIPC("edraw " + tmp); - data.remove(0, 200); - } - break; - } - default: ; - } - - SendIPC("!"); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/hwmap.h --- a/QTfrontend/hwmap.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006 Igor Ulyanov - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _HWMAP_INCLUDED -#define _HWMAP_INCLUDED - -#include -#include -#include - -#include "tcpBase.h" - -enum MapGenerator -{ - MAPGEN_REGULAR, - MAPGEN_MAZE, - MAPGEN_DRAWN, - MAPGEN_MAP -}; - -class HWMap : public TCPBase -{ - Q_OBJECT - - public: - HWMap(); - virtual ~HWMap(); - void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData); - - protected: - virtual QStringList getArguments(); - virtual void onClientDisconnect(); - virtual void SendToClientFirst(); - - signals: - void ImageReceived(const QImage newImage); - void HHLimitReceived(int hhLimit); - - private: - QString m_seed; - int templateFilter; - MapGenerator m_mapgen; - int m_maze_size; - QByteArray m_drawMapData; - - private slots: -}; - -#endif // _HWMAP_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/igbox.cpp --- a/QTfrontend/igbox.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include - -#include "igbox.h" - -IconedGroupBox::IconedGroupBox(QWidget * parent) - : QGroupBox(parent) -{ -// Has issues with border-radius on children -// setAttribute(Qt::WA_PaintOnScreen, true); - titleLeftPadding = 49; - contentTopPadding = 15; -} - -void IconedGroupBox::setIcon(const QIcon & icon) -{ - if (this->icon.isNull()) - setStyleSheet(QString( - "IconedGroupBox{" - "margin-top: 46px;" - "margin-left: 12px;" - "padding: %1px 2px 5px 2px;" - "}" - "IconedGroupBox::title{" - "subcontrol-origin: margin;" - "subcontrol-position: top left;" - "padding-left: %2px;" - "padding-top: %1px;" - "text-align: left;" - "}" - ).arg(contentTopPadding).arg(titleLeftPadding) - ); - - this->icon = icon; - repaint(); -} - -void IconedGroupBox::paintEvent(QPaintEvent * event) -{ - Q_UNUSED(event); - - QStylePainter painter(this); - - QStyleOptionGroupBox option; - initStyleOption(&option); - painter.drawComplexControl(QStyle::CC_GroupBox, option); - - icon.paint(&painter, QRect(QPoint(0, 0), icon.actualSize(size()))); -} - -void IconedGroupBox::setTitleTextPadding(int px) -{ - titleLeftPadding = px; -} - -void IconedGroupBox::setContentTopPadding(int px) -{ - contentTopPadding = px; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/igbox.h --- a/QTfrontend/igbox.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _IGBOX_H -#define _IGBOX_H - -#include -#include - -class IconedGroupBox : public QGroupBox -{ - Q_OBJECT - -public: - IconedGroupBox(QWidget * parent = 0); - - void setIcon(const QIcon & icon); - void setTitleTextPadding(int px); - void setContentTopPadding(int px); -protected: - virtual void paintEvent(QPaintEvent * event); - -private: - QIcon icon; - int titleLeftPadding; - int contentTopPadding; -}; - -#endif // _IGBOX_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/input_ip.cpp --- a/QTfrontend/input_ip.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include - -#include "input_ip.h" - -HWHostPortDialog::HWHostPortDialog(QWidget* parent) : QDialog(parent) -{ - QGridLayout * layout = new QGridLayout(this); - - QLabel * lbHost = new QLabel(this); - lbHost->setText(QLabel::tr("Host:")); - layout->addWidget(lbHost, 0, 0); - - QLabel * lbPort = new QLabel(this); - lbPort->setText(QLabel::tr("Port:")); - layout->addWidget(lbPort, 1, 0); - - leHost = new QLineEdit(this); - layout->addWidget(leHost, 0, 1, 1, 2); - - sbPort = new QSpinBox(this); - sbPort->setMinimum(0); - sbPort->setMaximum(65535); - layout->addWidget(sbPort, 1, 1, 1, 2); - - pbDefault = new QPushButton(this); - pbDefault->setText(QPushButton::tr("default")); - layout->addWidget(pbDefault, 1, 3); - - pbOK = new QPushButton(this); - pbOK->setText(QPushButton::tr("OK")); - pbOK->setDefault(true); - layout->addWidget(pbOK, 3, 1); - - pbCancel = new QPushButton(this); - pbCancel->setText(QPushButton::tr("Cancel")); - layout->addWidget(pbCancel, 3, 2); - - connect(pbOK, SIGNAL(clicked()), this, SLOT(accept())); - connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject())); - connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); -} - -void HWHostPortDialog::setDefaultPort() -{ - sbPort->setValue(46631); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/input_ip.h --- a/QTfrontend/input_ip.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - - -#ifndef INPUT_IP_H -#define INPUT_IP_H - -#include -#include - -class QLineEdit; -class QSpinBox; -class QPushButton; - -class HWHostPortDialog : public QDialog -{ - Q_OBJECT -public: - HWHostPortDialog(QWidget* parent = 0); - - QLineEdit* leHost; - QSpinBox* sbPort; - -private: - QPushButton* pbOK; - QPushButton* pbCancel; - QPushButton * pbDefault; - -private slots: - void setDefaultPort(); -}; - - -#endif // INPUT_IP_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/itemNum.cpp --- a/QTfrontend/itemNum.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Igor Ulyanov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "itemNum.h" -#include "hwform.h" - -#include -#include - -ItemNum::ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min, unsigned char max) : - QFrame(parent), m_im(im), m_img(img), infinityState(false), nonInteractive(false), minItems(min), maxItems(max), - numItems(min+2 >= max ? min : min+2) -{ - enabled = true; - if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true); -} - -ItemNum::~ItemNum() -{ -} - -void ItemNum::mousePressEvent ( QMouseEvent * event ) -{ - if(nonInteractive) return; - if(event->button()==Qt::LeftButton && enabled) { - event->accept(); - if((infinityState && numItems <= maxItems) || (!infinityState && numItems < maxItems)) { - incItems(); - } else { - numItems = minItems+1; - // appears there's an emit in there - decItems(); - } - } else if (event->button()==Qt::RightButton && enabled) { - event->accept(); - if(numItems > minItems) { - decItems(); - } else { - numItems = maxItems+(infinityState?0:-1); - incItems(); - } - } else { - event->ignore(); - return; - } - repaint(); -} - -QSize ItemNum::sizeHint () const -{ - return QSize((maxItems+1)*12, 32); -} - -void ItemNum::paintEvent(QPaintEvent* event) -{ - Q_UNUSED(event); - - QPainter painter(this); - - if (numItems==maxItems+1) { - QRect target(0, 0, 100, 32); - if (enabled) { - painter.drawImage(target, QImage(":/res/infinity.png")); - } else { - painter.drawImage(target, QImage(":/res/infinitygrey.png")); - } - } else { - for(int i=0; i - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#ifndef _ITEM_NUM_INCLUDED -#define _ITEM_NUM_INCLUDED - -class ItemNum : public QFrame -{ - Q_OBJECT - - public: - void setInfinityState(bool value); - void setEnabled(bool value); - unsigned char getItemsNum() const; - void setItemsNum(const unsigned char num); - - private: - QImage m_im; - QImage m_img; - bool infinityState; - bool enabled; - - protected: - ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min=2, unsigned char max=8); - virtual QSize sizeHint () const; - virtual ~ItemNum()=0; - - bool nonInteractive; - unsigned char minItems; - unsigned char maxItems; - unsigned char numItems; - - // from QWidget - virtual void mousePressEvent ( QMouseEvent * event ); - virtual void paintEvent(QPaintEvent* event); - - // to be implemented in child - virtual void incItems()=0; - virtual void decItems()=0; -}; - -#endif // _ITEM_NUM_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/main.cpp --- a/QTfrontend/main.cpp Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/main.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -30,6 +30,8 @@ #include "hwform.h" #include "hwconsts.h" +#include "HWDataManager.h" + #ifdef _WIN32 #include #endif @@ -96,229 +98,6 @@ Q_INIT_RESOURCE(hedgewars); - QString styleSheetFromHell = - QString( - "HWForm,QDialog{" - "background-image: url(\":/res/Background.png\");" - "background-position: bottom center;" - "background-repeat: repeat-x;" - "background-color: #141250;" - "}" - - "* {" - "color: #ffcc00;" - "selection-background-color: #ffcc00;" - "selection-color: #00351d;" - "}" - - "QLineEdit, QListWidget, QTableView, QTextBrowser, QSpinBox, QComboBox, " - "QComboBox QAbstractItemView, QMenu::item {" - "background-color: rgba(13, 5, 68, 70%);" - "}" - - "QComboBox::separator {" - "border: solid; border-width: 3px; border-color: #ffcc00;" - "}" - - "QPushButton, QListWidget, QTableView, QLineEdit, QHeaderView, " - "QTextBrowser, QSpinBox, QToolBox, QComboBox, " - "QComboBox QAbstractItemView, IconedGroupBox, " - ".QGroupBox, GameCFGWidget, TeamSelWidget, SelWeaponWidget, " - "QTabWidget::pane, QTabBar::tab {" - "border: solid;" - "border-width: 3px;" - "border-color: #ffcc00;" - "}" - - "QPushButton:hover, QLineEdit:hover, QListWidget:hover, " - "QSpinBox:hover, QToolBox:hover, QComboBox:hover {" - "border-color: yellow;" - "}" - - "QLineEdit, QListWidget,QTableView, QTextBrowser, " - "QSpinBox, QToolBox { " - "border-radius: 10px;" - "}" - - "QLineEdit, QLabel, QHeaderView, QListWidget, QTableView, " - "QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView, " - "IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget, " - "SelWeaponWidget, QCheckBox, QRadioButton, QPushButton {" - "font: bold 13px;" - "}" - "SelWeaponWidget QTabWidget::pane, SelWeaponWidget QTabBar::tab:selected {" - "background-position: bottom center;" - "background-repeat: repeat-x;" - "background-color: #000000;" - "}" - ".QGroupBox,GameCFGWidget,TeamSelWidget,SelWeaponWidget {" - "background-position: bottom center;" - "background-repeat: repeat-x;" - "border-radius: 16px;" - "background-color: rgba(13, 5, 68, 70%);" - "padding: 6px;" - "}" -/* Experimenting with PaintOnScreen and border-radius on IconedGroupBox children didn't work out well - "IconedGroupBox QComboBox, IconedGroupBox QPushButton, IconedGroupBox QLineEdit, " - "IconedGroupBox QSpinBox {" - "border-radius: 0;" - "}" - "IconedGroupBox, IconedGroupBox *, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{" */ - "IconedGroupBox, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{" - "background-color: #130f2c;" - "}" - - - "QPushButton {" - "border-radius: 8px;" - "background-origin: margin;" - "background-position: top left;" - "background-color: rgba(18, 42, 5, 70%);" - "}" - - "QPushButton:pressed{" - "border-color: white;" - "}" - - "QHeaderView {" - "border-radius: 0;" - "border-width: 0;" - "border-bottom-width: 3px;" - "background-color: #00351d;" - "}" - "QTableView {" - "alternate-background-color: #2f213a;" - "gridline-color: transparent;" - "}" - - "QTabBar::tab {" - "border-bottom-width: 0;" - "border-radius: 0;" - "border-top-left-radius: 6px;" - "border-top-right-radius: 6px;" - "padding: 3px;" - "}" - "QTabBar::tab:!selected {" - "color: #0d0544;" - "background-color: #ffcc00;" - "}" - "QSpinBox::up-button{" - "background: transparent;" - "width: 16px;" - "height: 10px;" - "}" - - "QSpinBox::up-arrow {" - "image: url(\":/res/spin_up.png\");" - "}" - - "QSpinBox::down-arrow {" - "image: url(\":/res/spin_down.png\");" - "}" - - "QSpinBox::down-button {" - "background: transparent;" - "width: 16px;" - "height: 10px;" - "}" - - "QComboBox {" - "border-radius: 10px;" - "padding: 3px;" - "}" - "QComboBox:pressed{" - "border-color: white;" - "}" - "QComboBox::drop-down{" - "border: transparent;" - "width: 25px;" - "}" - "QComboBox::down-arrow {" - "image: url(\":/res/dropdown.png\");" - "}" - - "VertScrArea {" - "background-position: bottom center;" - "background-repeat: repeat-x;" - "}" - - "IconedGroupBox {" - "border-radius: 16px;" - "padding: 2px;" - "}" - - "QGroupBox::title{" - "subcontrol-origin: margin;" - "subcontrol-position: top left;" - "text-align: left;" - "left: 15px;" - "top: -4px;" - "}" - - "QCheckBox::indicator:checked{" - "image: url(\":/res/checked.png\");" - "}" - "QCheckBox::indicator:unchecked{" - "image: url(\":/res/unchecked.png\");" - "}" - - ".QWidget{" - "background: transparent;" - "}" - - "QTabWidget::pane {" - "border-top-width: 2px;" - "}" - - "QMenu{" - "background-color: #ffcc00;" - "margin: 3px;" - "}" - "QMenu::item {" - "background-color: #0d0544;" - "border: 1px solid transparent;" - "font: bold;" - "padding: 2px 25px 2px 20px;" - "}" - "QMenu::item:selected {" - "background-color: #2d2564;" - "}" - "QMenu::indicator {" - "width: 16px;" - "height: 16px;" - "}" - "QMenu::indicator:non-exclusive:checked{" - "image: url(\":/res/checked.png\");" - "}" - "QMenu::indicator:non-exclusive:unchecked{" - "image: url(\":/res/unchecked.png\");" - "}" - - "QToolTip{" - "background-color: #0d0544;" - "border: 1px solid #ffcc00;" - "}" - - ":disabled{" - "color: #a0a0a0;" - "}" - "SquareLabel, ItemNum {" - "background-color: #000000;" - "}" - "QSlider::groove::horizontal {" - "height: 2px;" - "margin: 2px 0px;" - "background-color: #ffcc00;" - "}" - "QSlider::handle::horizontal {" - "border: 0px;" - "margin: -2px 0px;" - "border-radius: 3px;" - "background-color: #ffcc00;" - "width: 8px;" - "}" - ); - bindir->cd("bin"); // workaround over NSIS installer if(cConfigDir->length() == 0) @@ -386,35 +165,36 @@ return 1; } + HWDataManager & dataMgr = HWDataManager::instance(); + { - QDir dir; - dir.setPath(cfgdir->absolutePath() + "/Data/Themes"); - QStringList themes; - themes.append(dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot)); - dir.setPath(datadir->absolutePath() + "/Themes"); - themes.append(dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot)); + themes.append(dataMgr.entryList( + "Themes", + QDir::AllDirs | QDir::NoDotAndDotDot) + ); QList > icons; themes.sort(); for(int i = themes.size() - 1; i >= 0; --i) { - QFile tmpfile; - tmpfile.setFileName(QString("%1/Data/Themes/%2/icon.png").arg(cfgdir->absolutePath()).arg(themes.at(i))); - if (!tmpfile.exists()) - tmpfile.setFileName(QString("%1/Themes/%2/icon.png").arg(datadir->absolutePath()).arg(themes.at(i))); + QString file = dataMgr.findFileForRead( + QString("Themes/%1/icon.png").arg(themes.at(i)) + ); - if(tmpfile.exists()) + if(QFile::exists(file)) { // load icon QPair ic; - ic.first = QIcon(QFileInfo(tmpfile).absoluteFilePath()); + ic.first = QIcon(file); - QFile previewIconFile; - previewIconFile.setFileName(QString("%1/Data/Themes/%2/icon@2x.png").arg(cfgdir->absolutePath()).arg(themes.at(i))); - if (previewIconFile.exists()) ic.second = QIcon(QFileInfo(previewIconFile).absoluteFilePath()); - else ic.second = QIcon(QString("%1/Themes/%2/icon@2x.png").arg(datadir->absolutePath()).arg(themes.at(i))); + // load preview icon + ic.second = QIcon( + dataMgr.findFileForRead( + QString("Themes/%1/icon@2x.png").arg(themes.at(i)) + ) + ); icons.prepend(ic); } @@ -433,30 +213,18 @@ } } - QDir tmpdir; - tmpdir.cd(cfgdir->absolutePath()); - tmpdir.cd("Data/Maps"); - tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); - mapList = new QStringList(tmpdir.entryList(QStringList("*"))); - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Maps"); - tmpdir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); - QStringList tmplist = QStringList(tmpdir.entryList(QStringList("*"))); - for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it) - if (!mapList->contains(*it,Qt::CaseInsensitive)) mapList->append(*it); + mapList = new QStringList(dataMgr.entryList( + QString("Maps"), + QDir::Dirs | QDir::NoDotAndDotDot + ) + ); - tmpdir.cd(cfgdir->absolutePath()); - tmpdir.cd("Data/Scripts/Multiplayer"); - tmpdir.setFilter(QDir::Files | QDir::NoDotAndDotDot); - scriptList = new QStringList(tmpdir.entryList(QStringList("*.lua"))); - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Scripts/Multiplayer"); - tmpdir.setFilter(QDir::Files | QDir::NoDotAndDotDot); - tmplist = QStringList(tmpdir.entryList(QStringList("*.lua"))); - for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it) - if (!scriptList->contains(*it,Qt::CaseInsensitive)) scriptList->append(*it); + scriptList = new QStringList(dataMgr.entryList( + QString("Scripts/Multiplayer"), + QDir::Files, + QStringList("*.lua") + ) + ); QTranslator Translator; { @@ -464,10 +232,13 @@ QString cc = settings.value("misc/locale", QString()).toString(); if(cc.isEmpty()) cc = QLocale::system().name(); - QFile tmpfile; - tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Locale/hedgewars_" + cc); - if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "/Locale/hedgewars_" + cc); - Translator.load(QFileInfo(tmpfile).absoluteFilePath()); + + // load locale file into translator + Translator.load( + dataMgr.findFileForRead( + QString("Locale/hedgewars_" + cc) + ) + ); app.installTranslator(&Translator); } @@ -485,8 +256,27 @@ CocoaInitializer initializer; #endif - app.form = new HWForm(NULL,styleSheetFromHell); + QString style = ""; + + // load external stylesheet if there is any + QFile extFile(dataMgr.findFileForRead("css/qt.css")); + + QFile resFile(":/res/css/qt.css"); + + QFile & file = (extFile.exists()?extFile:resFile); + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + QTextStream in(&file); + while (!in.atEnd()) + { + QString line = in.readLine(); + if(!line.isEmpty()) + style.append(line); + } + } + + app.form = new HWForm(NULL, style); app.form->show(); return app.exec(); } diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/mapContainer.cpp --- a/QTfrontend/mapContainer.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,669 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Igor Ulyanov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hwconsts.h" -#include "mapContainer.h" -#include "igbox.h" -#include "HWApplication.h" - -HWMapContainer::HWMapContainer(QWidget * parent) : - QWidget(parent), - mainLayout(this), - pMap(0), - mapgen(MAPGEN_REGULAR) -{ - hhSmall.load(":/res/hh_small.png"); - hhLimit = 18; - templateFilter = 0; - - mainLayout.setContentsMargins(HWApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin), - 1, - HWApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin), - HWApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin)); - - QWidget* mapWidget = new QWidget(this); - mainLayout.addWidget(mapWidget, 0, 0, Qt::AlignHCenter); - - QGridLayout* mapLayout = new QGridLayout(mapWidget); - mapLayout->setMargin(0); - - imageButt = new QPushButton(mapWidget); - imageButt->setObjectName("imageButt"); - imageButt->setFixedSize(256 + 6, 128 + 6); - imageButt->setFlat(true); - imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum); - mapLayout->addWidget(imageButt, 0, 0, 1, 2); - connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomMap())); - - chooseMap = new QComboBox(mapWidget); - chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - chooseMap->addItem( -// FIXME - need real icons. Disabling until then -//QIcon(":/res/mapRandom.png"), -QComboBox::tr("generated map...")); - chooseMap->addItem( -// FIXME - need real icons. Disabling until then -//QIcon(":/res/mapMaze.png"), -QComboBox::tr("generated maze...")); - - chooseMap->addItem(QComboBox::tr("hand drawn map...")); - chooseMap->insertSeparator(chooseMap->count()); // separator between generators and missions - - chooseMap->insertSeparator(chooseMap->count()); // separator between generators and missions - - int missionindex = chooseMap->count(); - numMissions = 0; - QFile mapLuaFile; - QFile mapCfgFile; - for (int i = 0; i < mapList->size(); ++i) { - QString map = (*mapList)[i]; - mapCfgFile.setFileName( - QString("%1/Data/Maps/%2/map.cfg") - .arg(cfgdir->absolutePath()) - .arg(map)); - if (mapCfgFile.exists()) { - mapLuaFile.setFileName( - QString("%1/Data/Maps/%2/map.lua") - .arg(cfgdir->absolutePath()) - .arg(map)); - } else { - mapCfgFile.setFileName( - QString("%1/Maps/%2/map.cfg") - .arg(datadir->absolutePath()) - .arg(map)); - mapLuaFile.setFileName( - QString("%1/Maps/%2/map.lua") - .arg(datadir->absolutePath()) - .arg(map)); - } - - if (mapCfgFile.open(QFile::ReadOnly)) { - QString theme; - quint32 limit = 0; - QString scheme; - QString weapons; - QList mapInfo; - QTextStream input(&mapCfgFile); - input >> theme; - input >> limit; - input >> scheme; - input >> weapons; - mapInfo.push_back(map); - mapInfo.push_back(theme); - if (limit) - mapInfo.push_back(limit); - else - mapInfo.push_back(18); - mapInfo.push_back(mapLuaFile.exists()); - if (scheme.isEmpty()) - scheme = "locked"; - scheme.replace("_", " "); - if (weapons.isEmpty()) - weapons = "locked"; - weapons.replace("_", " "); - mapInfo.push_back(scheme); - mapInfo.push_back(weapons); - if(mapLuaFile.exists()) - { - chooseMap->insertItem(missionindex++, -// FIXME - need real icons. Disabling until then -//QIcon(":/res/mapMission.png"), -QComboBox::tr("Mission") + ": " + map, mapInfo); - numMissions++; - } - else - chooseMap->addItem( -// FIXME - need real icons. Disabling until then -//QIcon(":/res/mapCustom.png"), -map, mapInfo); - mapCfgFile.close(); - } - } - chooseMap->insertSeparator(missionindex); // separator between missions and maps - - connect(chooseMap, SIGNAL(activated(int)), this, SLOT(mapChanged(int))); - mapLayout->addWidget(chooseMap, 1, 1); - - QLabel * lblMap = new QLabel(tr("Map"), mapWidget); - mapLayout->addWidget(lblMap, 1, 0); - - lblFilter = new QLabel(tr("Filter"), mapWidget); - mapLayout->addWidget(lblFilter, 2, 0); - - cbTemplateFilter = new QComboBox(mapWidget); - cbTemplateFilter->addItem(tr("All"), 0); - cbTemplateFilter->addItem(tr("Small"), 1); - cbTemplateFilter->addItem(tr("Medium"), 2); - cbTemplateFilter->addItem(tr("Large"), 3); - cbTemplateFilter->addItem(tr("Cavern"), 4); - cbTemplateFilter->addItem(tr("Wacky"), 5); - mapLayout->addWidget(cbTemplateFilter, 2, 1); - - connect(cbTemplateFilter, SIGNAL(activated(int)), this, SLOT(setTemplateFilter(int))); - - maze_size_label = new QLabel(tr("Type"), mapWidget); - mapLayout->addWidget(maze_size_label, 2, 0); - maze_size_label->hide(); - cbMazeSize = new QComboBox(mapWidget); - cbMazeSize->addItem(tr("Small tunnels"), 0); - cbMazeSize->addItem(tr("Medium tunnels"), 1); - cbMazeSize->addItem(tr("Large tunnels"), 2); - cbMazeSize->addItem(tr("Small floating islands"), 3); - cbMazeSize->addItem(tr("Medium floating islands"), 4); - cbMazeSize->addItem(tr("Large floating islands"), 5); - cbMazeSize->setCurrentIndex(1); - - mapLayout->addWidget(cbMazeSize, 2, 1); - cbMazeSize->hide(); - connect(cbMazeSize, SIGNAL(activated(int)), this, SLOT(setMazeSize(int))); - - gbThemes = new IconedGroupBox(mapWidget); - gbThemes->setTitleTextPadding(80); - gbThemes->setContentTopPadding(15); - gbThemes->setTitle(tr("Themes")); - - //gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon - mapLayout->addWidget(gbThemes, 0, 2, 3, 1); - - QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes); - gbTLayout->setContentsMargins(0, 0, 0 ,0); - gbTLayout->setSpacing(0); - lvThemes = new QListView(mapWidget); - lvThemes->setMinimumHeight(30); - lvThemes->setFixedWidth(140); - lvThemes->setModel(themesModel); - lvThemes->setIconSize(QSize(16, 16)); - lvThemes->setEditTriggers(QListView::NoEditTriggers); - - connect(lvThemes->selectionModel(), SIGNAL(currentRowChanged( const QModelIndex &, const QModelIndex &)), this, SLOT(themeSelected( const QModelIndex &, const QModelIndex &))); - - // override default style to tighten up theme scroller - lvThemes->setStyleSheet(QString( - "QListView{" - "border: solid;" - "border-width: 0px;" - "border-radius: 0px;" - "border-color: transparent;" - "background-color: #0d0544;" - "color: #ffcc00;" - "font: bold 13px;" - "}" - ) - ); - - gbTLayout->addWidget(lvThemes); - lvThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); - - mapLayout->setSizeConstraint(QLayout::SetFixedSize); - - QWidget* seedWidget = new QWidget(this); - mainLayout.addWidget(seedWidget, 1, 0); - - QGridLayout* seedLayout = new QGridLayout(seedWidget); - seedLayout->setMargin(0); - - seedLabel = new QLabel(tr("Seed"), seedWidget); - seedLayout->addWidget(seedLabel, 3, 0); - seedEdit = new QLineEdit(seedWidget); - seedEdit->setMaxLength(54); - connect(seedEdit, SIGNAL(returnPressed()), this, SLOT(seedEdited())); - seedLayout->addWidget(seedEdit, 3, 1); - seedLayout->setColumnStretch(1, 5); - seedSet = new QPushButton(seedWidget); - seedSet->setText(QPushButton::tr("more")); - connect(seedSet, SIGNAL(clicked()), this, SLOT(seedEdited())); - seedLayout->setColumnStretch(2, 1); - seedLayout->addWidget(seedSet, 3, 2); - - seedLabel->setVisible(false); - seedEdit->setVisible(false); - - setRandomSeed(); - setRandomTheme(); -} - -void HWMapContainer::setImage(const QImage newImage) -{ - QPixmap px(256, 128); - QPixmap pxres(256, 128); - QPainter p(&pxres); - - px.fill(Qt::yellow); - QBitmap bm = QBitmap::fromImage(newImage); - px.setMask(bm); - - QLinearGradient linearGrad(QPoint(128, 0), QPoint(128, 128)); - linearGrad.setColorAt(1, QColor(0, 0, 192)); - linearGrad.setColorAt(0, QColor(66, 115, 225)); - p.fillRect(QRect(0, 0, 256, 128), linearGrad); - p.drawPixmap(QPoint(0, 0), px); - - addInfoToPreview(pxres); - //chooseMap->setCurrentIndex(mapgen); - pMap = 0; -} - -void HWMapContainer::setHHLimit(int newHHLimit) -{ - hhLimit = newHHLimit; -} - -void HWMapContainer::mapChanged(int index) -{ - switch(index) { - case MAPGEN_REGULAR: - mapgen = MAPGEN_REGULAR; - updatePreview(); - gbThemes->show(); - lblFilter->show(); - cbTemplateFilter->show(); - maze_size_label->hide(); - cbMazeSize->hide(); - emit mapChanged("+rnd+"); - emit themeChanged(chooseMap->itemData(index).toList()[1].toString()); - break; - case MAPGEN_MAZE: - mapgen = MAPGEN_MAZE; - updatePreview(); - gbThemes->show(); - lblFilter->hide(); - cbTemplateFilter->hide(); - maze_size_label->show(); - cbMazeSize->show(); - emit mapChanged("+maze+"); - emit themeChanged(chooseMap->itemData(index).toList()[1].toString()); - break; - case MAPGEN_DRAWN: - mapgen = MAPGEN_DRAWN; - updatePreview(); - gbThemes->show(); - lblFilter->hide(); - cbTemplateFilter->hide(); - maze_size_label->hide(); - cbMazeSize->hide(); - emit mapChanged("+drawn+"); - emit themeChanged(chooseMap->itemData(index).toList()[1].toString()); - break; - default: - mapgen = MAPGEN_MAP; - updatePreview(); - gbThemes->hide(); - lblFilter->hide(); - cbTemplateFilter->hide(); - maze_size_label->hide(); - cbMazeSize->hide(); - emit mapChanged(chooseMap->itemData(index).toList()[0].toString()); - } - - emit mapgenChanged(mapgen); -} - -// Should this add text to identify map size? -void HWMapContainer::addInfoToPreview(QPixmap image) -{ - QPixmap finalImage = QPixmap(image.size()); - finalImage.fill(QColor(0, 0, 0, 0)); - - QPainter p(&finalImage); - p.drawPixmap(image.rect(), image); - //p.setPen(QColor(0xf4,0x9e,0xe9)); - p.setPen(QColor(0xff,0xcc,0x00)); - p.setBrush(QColor(0, 0, 0)); - p.drawRect(image.rect().width() - hhSmall.rect().width() - 28, 3, 40, 20); - p.setFont(QFont("MS Shell Dlg", 10)); - p.drawText(image.rect().width() - hhSmall.rect().width() - 14 - (hhLimit > 9 ? 10 : 0), 18, QString::number(hhLimit)); - p.drawPixmap(image.rect().width() - hhSmall.rect().width() - 5, 5, hhSmall.rect().width(), hhSmall.rect().height(), hhSmall); - - imageButt->setIcon(finalImage); - imageButt->setIconSize(image.size()); -} - -void HWMapContainer::askForGeneratedPreview() -{ - if (pMap) - { - disconnect(pMap, 0, this, SLOT(setImage(const QImage))); - disconnect(pMap, 0, this, SLOT(setHHLimit(int))); - pMap = 0; - } - - pMap = new HWMap(); - connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage))); - connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int))); - pMap->getImage(m_seed, - getTemplateFilter(), - get_mapgen(), - getMazeSize(), - getDrawnMapData() - ); -} - -void HWMapContainer::themeSelected(const QModelIndex & current, const QModelIndex &) -{ - QString theme = current.data().toString(); - QList mapInfo; - mapInfo.push_back(QString("+rnd+")); - mapInfo.push_back(theme); - mapInfo.push_back(18); - mapInfo.push_back(false); - chooseMap->setItemData(0, mapInfo); - mapInfo[0] = QString("+maze+"); - chooseMap->setItemData(1, mapInfo); - mapInfo[0] = QString("+drawn+"); - chooseMap->setItemData(2, mapInfo); - - gbThemes->setIcon(qVariantValue(current.data(Qt::UserRole))); - emit themeChanged(theme); -} - -QString HWMapContainer::getCurrentSeed() const -{ - return m_seed; -} - -QString HWMapContainer::getCurrentMap() const -{ - if(chooseMap->currentIndex() < MAPGEN_MAP) return QString(); - return chooseMap->itemData(chooseMap->currentIndex()).toList()[0].toString(); -} - -QString HWMapContainer::getCurrentTheme() const -{ - return chooseMap->itemData(chooseMap->currentIndex()).toList()[1].toString(); -} - -bool HWMapContainer::getCurrentIsMission() const -{ - if(!chooseMap->currentIndex()) return false; - return chooseMap->itemData(chooseMap->currentIndex()).toList()[3].toBool(); -} - -int HWMapContainer::getCurrentHHLimit() const -{ - return hhLimit; -} - -QString HWMapContainer::getCurrentScheme() const -{ - return chooseMap->itemData(chooseMap->currentIndex()).toList()[4].toString(); -} - -QString HWMapContainer::getCurrentWeapons() const -{ - return chooseMap->itemData(chooseMap->currentIndex()).toList()[5].toString(); -} - -quint32 HWMapContainer::getTemplateFilter() const -{ - return cbTemplateFilter->itemData(cbTemplateFilter->currentIndex()).toInt(); -} - -void HWMapContainer::resizeEvent ( QResizeEvent * event ) -{ - Q_UNUSED(event); - //imageButt->setIconSize(imageButt->size()); -} - -void HWMapContainer::intSetSeed(const QString & seed) -{ - m_seed = seed; - if (seed != seedEdit->text()) - seedEdit->setText(seed); -} - -void HWMapContainer::setSeed(const QString & seed) -{ - intSetSeed(seed); - if (chooseMap->currentIndex() < MAPGEN_DRAWN) - updatePreview(); -} - -void HWMapContainer::intSetMap(const QString & map) -{ - int id = 0; - for(int i = 0; i < chooseMap->count(); i++) - if(!chooseMap->itemData(i).isNull() && chooseMap->itemData(i).toList()[0].toString() == map) - { - id = i; - break; - } - - if(id > 0) { - if (pMap) - { - disconnect(pMap, 0, this, SLOT(setImage(const QImage))); - disconnect(pMap, 0, this, SLOT(setHHLimit(int))); - pMap = 0; - } - chooseMap->setCurrentIndex(id); - } -} - -void HWMapContainer::setMap(const QString &map) -{ - intSetMap(map); - updatePreview(); -} - -void HWMapContainer::setTheme(const QString & theme) -{ - QModelIndexList mdl = themesModel->match(themesModel->index(0), Qt::DisplayRole, theme); - - if(mdl.size()) - lvThemes->setCurrentIndex(mdl.at(0)); -} - -void HWMapContainer::setRandomMap() -{ - setRandomSeed(); - switch(chooseMap->currentIndex()) - { - case MAPGEN_REGULAR: - case MAPGEN_MAZE: - setRandomTheme(); - break; - case MAPGEN_DRAWN: - emit drawMapRequested(); - break; - default: - if(chooseMap->currentIndex() <= numMissions + MAPGEN_MAP + 1) - setRandomMission(); - else - setRandomStatic(); - break; - } -} - -void HWMapContainer::setRandomStatic() -{ - int i = MAPGEN_MAP + 3 + numMissions + rand() % (chooseMap->count() - MAPGEN_MAP - 3 - numMissions); - chooseMap->setCurrentIndex(i); - mapChanged(i); -} - -void HWMapContainer::setRandomMission() -{ - int i = MAPGEN_MAP + 2 + rand() % numMissions; - chooseMap->setCurrentIndex(i); - mapChanged(i); -} - -void HWMapContainer::setRandomSeed() -{ - m_seed = QUuid::createUuid().toString(); - seedEdit->setText(m_seed); - emit seedChanged(m_seed); - if (chooseMap->currentIndex() < MAPGEN_MAP) - updatePreview(); -} - -void HWMapContainer::setRandomTheme() -{ - if(!themesModel->rowCount()) return; - quint32 themeNum = rand() % themesModel->rowCount(); - lvThemes->setCurrentIndex(themesModel->index(themeNum)); -} - -void HWMapContainer::intSetTemplateFilter(int filter) -{ - cbTemplateFilter->setCurrentIndex(filter); - emit newTemplateFilter(filter); -} - -void HWMapContainer::setTemplateFilter(int filter) -{ - intSetTemplateFilter(filter); - updatePreview(); -} - -MapGenerator HWMapContainer::get_mapgen(void) const -{ - return mapgen; -} - -int HWMapContainer::getMazeSize(void) const -{ - return cbMazeSize->currentIndex(); -} - -void HWMapContainer::intSetMazeSize(int size) -{ - cbMazeSize->setCurrentIndex(size); - emit mazeSizeChanged(size); -} - -void HWMapContainer::setMazeSize(int size) -{ - intSetMazeSize(size); - updatePreview(); -} - -void HWMapContainer::intSetMapgen(MapGenerator m) -{ - mapgen = m; - - if(m != MAPGEN_MAP) - chooseMap->setCurrentIndex(m); - - emit mapgenChanged(m); -} - -void HWMapContainer::setMapgen(MapGenerator m) -{ - intSetMapgen(m); - updatePreview(); -} - -void HWMapContainer::setDrawnMapData(const QByteArray & ar) -{ - drawMapScene.decode(ar); - updatePreview(); -} - -QByteArray HWMapContainer::getDrawnMapData() -{ - return drawMapScene.encode(); -} - -void HWMapContainer::seedEdited() -{ - if (seedLabel->isVisible() == false ) - { - seedLabel->setVisible(true); - seedEdit->setVisible(true); - seedSet->setText(tr("Set")); - return; - } - - if (seedEdit->text().isEmpty()) - seedEdit->setText(m_seed); - else - { - setSeed(seedEdit->text()); - emit seedChanged(seedEdit->text()); - } -} - -DrawMapScene * HWMapContainer::getDrawMapScene() -{ - return &drawMapScene; -} - -void HWMapContainer::mapDrawingFinished() -{ - emit drawnMapChanged(getDrawnMapData()); - - updatePreview(); -} - -void HWMapContainer::updatePreview() -{ - int curIndex = chooseMap->currentIndex(); - - switch(curIndex) - { - case MAPGEN_REGULAR: - askForGeneratedPreview(); - break; - case MAPGEN_MAZE: - askForGeneratedPreview(); - break; - case MAPGEN_DRAWN: - askForGeneratedPreview(); - break; - default: - QPixmap mapImage; - QFile tmpfile; - tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Maps/" + chooseMap->itemData(curIndex).toList()[0].toString() + "/preview.png"); - if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "/Maps/" + chooseMap->itemData(curIndex).toList()[0].toString() + "/preview.png"); - if(!mapImage.load(QFileInfo(tmpfile).absoluteFilePath())) { - imageButt->setIcon(QIcon()); - return; - } - - hhLimit = chooseMap->itemData(curIndex).toList()[2].toInt(); - addInfoToPreview(mapImage); - } -} - -void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl) -{ - intSetMap(map); - intSetMapgen(m); - intSetMazeSize(mazesize); - intSetSeed(seed); - intSetTemplateFilter(tmpl); - - updatePreview(); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/mapContainer.h --- a/QTfrontend/mapContainer.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _HWMAP_CONTAINER_INCLUDED -#define _HWMAP_CONTAINER_INCLUDED - -#include -#include -#include -#include -#include -#include - -#include "hwmap.h" -#include "drawmapscene.h" - -class QPushButton; -class IconedGroupBox; -class QListView; - -class MapFileErrorException -{ -}; - -class HWMapContainer : public QWidget -{ - Q_OBJECT - - public: - HWMapContainer(QWidget * parent=0); - QString getCurrentSeed() const; - QString getCurrentMap() const; - QString getCurrentTheme() const; - int getCurrentHHLimit() const; - QString getCurrentScheme() const; - QString getCurrentWeapons() const; - quint32 getTemplateFilter() const; - MapGenerator get_mapgen(void) const; - int getMazeSize(void) const; - bool getCurrentIsMission() const; - QByteArray getDrawnMapData(); - DrawMapScene * getDrawMapScene(); - void mapDrawingFinished(); - QLineEdit* seedEdit; - - public slots: - void askForGeneratedPreview(); - void setSeed(const QString & seed); - void setMap(const QString & map); - void setTheme(const QString & theme); - void setTemplateFilter(int); - void setMapgen(MapGenerator m); - void setMazeSize(int size); - void setDrawnMapData(const QByteArray & ar); - void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl); - - signals: - void seedChanged(const QString & seed); - void mapChanged(const QString & map); - void themeChanged(const QString & theme); - void newTemplateFilter(int filter); - void mapgenChanged(MapGenerator m); - void mazeSizeChanged(int s); - void drawMapRequested(); - void drawnMapChanged(const QByteArray & data); - - private slots: - void setImage(const QImage newImage); - void setHHLimit(int hhLimit); - void mapChanged(int index); - void setRandomSeed(); - void setRandomTheme(); - void setRandomMap(); - void setRandomStatic(); - void setRandomMission(); - void themeSelected(const QModelIndex & current, const QModelIndex &); - void addInfoToPreview(QPixmap image); - void seedEdited(); - - protected: - virtual void resizeEvent ( QResizeEvent * event ); - - private: - QGridLayout mainLayout; - QPushButton* imageButt; - QComboBox* chooseMap; - IconedGroupBox* gbThemes; - QListView* lvThemes; - HWMap* pMap; - QString m_seed; - QPushButton* seedSet; - QLabel* seedLabel; - int hhLimit; - int templateFilter; - QPixmap hhSmall; - QLabel* lblFilter; - QComboBox* cbTemplateFilter; - QLabel *maze_size_label; - QComboBox *cbMazeSize; - MapGenerator mapgen; - int numMissions; - DrawMapScene drawMapScene; - - void intSetSeed(const QString & seed); - void intSetMap(const QString & map); - void intSetMapgen(MapGenerator m); - void intSetTemplateFilter(int); - void intSetMazeSize(int size); - void updatePreview(); -}; - -#endif // _HWMAP_CONTAINER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/misc.cpp --- a/QTfrontend/misc.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2005-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "misc.h" diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/misc.h --- a/QTfrontend/misc.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2005-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _MISC_H -#define _MISC_H - - -#include -#include - -class FreqSpinBox : public QSpinBox -{ - Q_OBJECT - -public: - FreqSpinBox(QWidget* parent) : QSpinBox(parent) - { - - } - - QString textFromValue(int value) const - { - if (!value) - return tr("Never"); - else - return tr("Every %1 turn", "", value).arg(value); - } -}; - - -#endif // _MISC_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/ammoSchemeModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/model/ammoSchemeModel.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,786 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2005-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include + +#include "ammoSchemeModel.h" +#include "hwconsts.h" + +QList defaultScheme = QList() + << QVariant("Default") // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(false) // shared ammo 15 + << QVariant(false) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(4) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + +AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) : + QAbstractTableModel(parent), + fileConfig(fileName, QSettings::IniFormat) +{ + predefSchemesNames = QStringList() + << "Default" + << "Pro Mode" + << "Shoppa" + << "Clean Slate" + << "Minefield" + << "Barrel Mayhem" + << "Tunnel Hogs" + << "Fort Mode" + << "Timeless" + << "Thinking with Portals" + << "King Mode" + ; + + numberOfDefaultSchemes = predefSchemesNames.size(); + + spNames = QStringList() + << "name" // 0 + << "fortsmode" // 1 + << "divteams" // 2 + << "solidland" // 3 + << "border" // 4 + << "lowgrav" // 5 + << "laser" // 6 + << "invulnerability" // 7 + << "resethealth" // 8 + << "vampiric" // 9 + << "karma" // 10 + << "artillery" // 11 + << "randomorder" // 12 + << "king" // 13 + << "placehog" // 14 + << "sharedammo" // 15 + << "disablegirders" // 16 + << "disablelandobjects" // 17 + << "aisurvival" // 18 + << "infattack" // 19 + << "resetweps" // 20 + << "perhogammo" // 21 + << "disablewind" // 22 + << "morewind" // 23 + << "tagteam" // 24 + << "bottomborder" // 25 + << "damagefactor" // 26 + << "turntime" // 27 + << "health" // 28 + << "suddendeath" // 29 + << "caseprobability" // 30 + << "minestime" // 31 + << "minesnum" // 32 + << "minedudpct" // 33 + << "explosives" // 34 + << "healthprobability" // 35 + << "healthcaseamount" // 36 + << "waterrise" // 37 + << "healthdecrease" // 38 + << "ropepct" // 39 + << "getawaytime" // 40 + ; + + QList proMode; + proMode + << predefSchemesNames[1] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(true) // shared ammo 15 + << QVariant(false) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(15) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(0) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(0) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList shoppa; + shoppa + << predefSchemesNames[2] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(true) // solid land 3 + << QVariant(true) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(true) // shared ammo 15 + << QVariant(true) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(true) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(30) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(50) // sudden death 29 + << QVariant(1) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(0) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(0) // explosives 34 + << QVariant(0) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList cleanslate; + cleanslate + << predefSchemesNames[3] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(true) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(false) // shared ammo 15 + << QVariant(false) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(true) // inf. attack 19 + << QVariant(true) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(4) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList minefield; + minefield + << predefSchemesNames[4] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(true) // shared ammo 15 + << QVariant(true) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(30) // turn time 27 + << QVariant(50) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(0) // case prob 30 + << QVariant(0) // mines time 31 + << QVariant(80) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(0) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList barrelmayhem; + barrelmayhem + << predefSchemesNames[5] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(true) // shared ammo 15 + << QVariant(false) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(30) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(0) // case prob 30 + << QVariant(0) // mines time 31 + << QVariant(0) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(80) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList tunnelhogs; + tunnelhogs + << predefSchemesNames[6] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(true) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(true) // shared ammo 15 + << QVariant(true) // disable girders 16 + << QVariant(true) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(30) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(10) // mines number 32 + << QVariant(10) // mine dud pct 33 + << QVariant(10) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList forts; + forts + << predefSchemesNames[7] // name 0 + << QVariant(true) // fortsmode 1 + << QVariant(true) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(true) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(false) // shared ammo 15 + << QVariant(false) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(0) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(0) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList timeless; + timeless + << predefSchemesNames[8] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(false) // shared ammo 15 + << QVariant(false) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(true) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(9999) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(5) // mines number 32 + << QVariant(10) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(30) // health case amt 36 + << QVariant(0) // water rise amt 37 + << QVariant(0) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList thinkingportals; + thinkingportals + << predefSchemesNames[9] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(true) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(false) // king 13 + << QVariant(false) // place hog 14 + << QVariant(false) // shared ammo 15 + << QVariant(false) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(2) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(5) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(5) // explosives 34 + << QVariant(25) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + QList kingmode; + kingmode + << predefSchemesNames[10] // name 0 + << QVariant(false) // fortsmode 1 + << QVariant(false) // team divide 2 + << QVariant(false) // solid land 3 + << QVariant(false) // border 4 + << QVariant(false) // low gravity 5 + << QVariant(false) // laser sight 6 + << QVariant(false) // invulnerable 7 + << QVariant(false) // reset health 8 + << QVariant(false) // vampiric 9 + << QVariant(false) // karma 10 + << QVariant(false) // artillery 11 + << QVariant(true) // random order 12 + << QVariant(true) // king 13 + << QVariant(false) // place hog 14 + << QVariant(false) // shared ammo 15 + << QVariant(false) // disable girders 16 + << QVariant(false) // disable land objects 17 + << QVariant(false) // AI survival 18 + << QVariant(false) // inf. attack 19 + << QVariant(false) // reset weps 20 + << QVariant(false) // per hog ammo 21 + << QVariant(false) // no wind 22 + << QVariant(false) // more wind 23 + << QVariant(false) // tag team 24 + << QVariant(false) // bottom border 25 + << QVariant(100) // damage modfier 26 + << QVariant(45) // turn time 27 + << QVariant(100) // init health 28 + << QVariant(15) // sudden death 29 + << QVariant(5) // case prob 30 + << QVariant(3) // mines time 31 + << QVariant(4) // mines number 32 + << QVariant(0) // mine dud pct 33 + << QVariant(2) // explosives 34 + << QVariant(35) // health case pct 35 + << QVariant(25) // health case amt 36 + << QVariant(47) // water rise amt 37 + << QVariant(5) // health dec amt 38 + << QVariant(100) // rope modfier 39 + << QVariant(100) // get away time 40 + ; + + + schemes.append(defaultScheme); + schemes.append(proMode); + schemes.append(shoppa); + schemes.append(cleanslate); + schemes.append(minefield); + schemes.append(barrelmayhem); + schemes.append(tunnelhogs); + schemes.append(forts); + schemes.append(timeless); + schemes.append(thinkingportals); + schemes.append(kingmode); + + + int size = fileConfig.beginReadArray("schemes"); + for (int i = 0; i < size; ++i) { + fileConfig.setArrayIndex(i); + + if (!predefSchemesNames.contains(fileConfig.value(spNames[0]).toString())) + { + QList scheme; + + for (int k = 0; k < spNames.size(); ++k) + scheme << fileConfig.value(spNames[k], defaultScheme[k]); + + schemes.append(scheme); + } + } + fileConfig.endArray(); +} + +QVariant AmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + Q_UNUSED(section); + Q_UNUSED(orientation); + Q_UNUSED(role); + + return QVariant(); +} + +int AmmoSchemeModel::rowCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return 0; + else + return schemes.size(); +} + +int AmmoSchemeModel::columnCount(const QModelIndex & parent) const +{ + if (parent.isValid()) + return 0; + else + return defaultScheme.size(); +} + +Qt::ItemFlags AmmoSchemeModel::flags(const QModelIndex & index) const +{ + Q_UNUSED(index); + + return + Qt::ItemIsEnabled + | Qt::ItemIsSelectable + | Qt::ItemIsEditable; +} + +bool AmmoSchemeModel::setData(const QModelIndex & index, const QVariant & value, int role) +{ + if (!index.isValid() || index.row() < numberOfDefaultSchemes + || index.row() >= schemes.size() + || index.column() >= defaultScheme.size() + || role != Qt::EditRole) + return false; + + schemes[index.row()][index.column()] = value; + + emit dataChanged(index, index); + return true; +} + +bool AmmoSchemeModel::insertRows(int row, int count, const QModelIndex & parent) +{ + Q_UNUSED(count); + + beginInsertRows(parent, schemes.size(), schemes.size()); + + if (row == -1) + { + QList newScheme = defaultScheme; + newScheme[0] = QVariant(tr("new")); + schemes.insert(schemes.size(), newScheme); + } + else + { + QList newScheme = schemes[row]; + newScheme[0] = QVariant(tr("copy of") + " " + newScheme[0].toString()); + schemes.insert(schemes.size(), newScheme); + } + + endInsertRows(); + + return true; +} + +bool AmmoSchemeModel::removeRows(int row, int count, const QModelIndex & parent) +{ + if(count != 1 + || row < numberOfDefaultSchemes + || row >= schemes.size()) + return false; + + beginRemoveRows(parent, row, row); + + schemes.removeAt(row); + + endRemoveRows(); + + return true; +} + +QVariant AmmoSchemeModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || index.row() < 0 + || index.row() >= schemes.size() + || index.column() >= defaultScheme.size() + || (role != Qt::EditRole && role != Qt::DisplayRole) + ) + return QVariant(); + + return schemes[index.row()][index.column()]; +} + +void AmmoSchemeModel::Save() +{ + fileConfig.beginWriteArray("schemes", schemes.size() - numberOfDefaultSchemes); + + for (int i = 0; i < schemes.size() - numberOfDefaultSchemes; ++i) { + fileConfig.setArrayIndex(i); + + QList scheme = schemes[i + numberOfDefaultSchemes]; + + for (int k = 0; k < scheme.size(); ++k) + fileConfig.setValue(spNames[k], scheme[k]); + } + fileConfig.endArray(); +} + + +NetAmmoSchemeModel::NetAmmoSchemeModel(QObject * parent) : + QAbstractTableModel(parent) +{ + netScheme = defaultScheme; +} + +QVariant NetAmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + Q_UNUSED(section); + Q_UNUSED(orientation); + Q_UNUSED(role); + + return QVariant(); +} + +int NetAmmoSchemeModel::rowCount(const QModelIndex & parent) const +{ + if (parent.isValid()) + return 0; + else + return 1; +} + +int NetAmmoSchemeModel::columnCount(const QModelIndex & parent) const +{ + if (parent.isValid()) + return 0; + else + return defaultScheme.size(); +} + +QVariant NetAmmoSchemeModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || index.row() < 0 + || index.row() > 1 + || index.column() >= defaultScheme.size() + || (role != Qt::EditRole && role != Qt::DisplayRole) + ) + return QVariant(); + + return netScheme[index.column()]; +} + +void NetAmmoSchemeModel::setNetSchemeConfig(QStringList & cfg) +{ + if(cfg.size() != netScheme.size()) + { + qWarning("Incorrect scheme cfg size"); + return; + } + + for(int i = 0; i < cfg.size(); ++i) + netScheme[i] = QVariant(cfg[i]); + + reset(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/ammoSchemeModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/model/ammoSchemeModel.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,79 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2005-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _AMMO_SCHEME_MODEL_INCLUDED +#define _AMMO_SCHEME_MODEL_INCLUDED + +#include +#include +#include +#include + +class AmmoSchemeModel : public QAbstractTableModel +{ + Q_OBJECT + +public: + AmmoSchemeModel(QObject * parent, const QString & fileName); + + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + int rowCount(const QModelIndex & parent) const; + int columnCount(const QModelIndex & parent) const; + Qt::ItemFlags flags(const QModelIndex & index) const; + bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); + bool insertRows(int row, int count, const QModelIndex & parent = QModelIndex()); + bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()); + QVariant data(const QModelIndex &index, int role) const; + + int numberOfDefaultSchemes; + QStringList predefSchemesNames; + QStringList spNames; + +public slots: + void Save(); + +signals: + void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight); + +protected: + QList< QList > schemes; + +private: + QSettings fileConfig; +}; + +class NetAmmoSchemeModel : public QAbstractTableModel +{ + Q_OBJECT + +public: + NetAmmoSchemeModel(QObject * parent); + + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + int rowCount(const QModelIndex & parent) const; + int columnCount(const QModelIndex & parent) const; + QVariant data(const QModelIndex &index, int role) const; + +public slots: + void setNetSchemeConfig(QStringList & cfg); + +private: + QList netScheme; +}; + +#endif // _AMMO_SCHEME_MODEL_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/hats.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/model/hats.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,129 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include "hwconsts.h" +#include "hwform.h" +#include "hats.h" + +#include "HWDataManager.h" + +HatsModel::HatsModel(QObject* parent) : + QAbstractListModel(parent) +{ + HWDataManager & dataMgr = HWDataManager::instance(); + + QPixmap hhpix = QPixmap( + dataMgr.findFileForRead("Graphics/Hedgehog/Idle.png") + ).copy(0, 0, 32, 32); + + // my reserved hats + QStringList hatsList = dataMgr.entryList( + "Graphics/Hats/Reserved", + QDir::Files, + QStringList(playerHash+"*.png") + ); + + int nReserved = hatsList.size(); + + // regular hats + hatsList.append(dataMgr.entryList( + "Graphics/Hats", + QDir::Files, + QStringList("*.png") + ) + ); + + + int nHats = hatsList.size(); + + for (int i = 0; i < nHats; i++) + { + bool isReserved = (i < nReserved); + + QString str = hatsList.at(i); + str = str.remove(QRegExp("\\.png$")); + QPixmap pix( + dataMgr.findFileForRead( + "Graphics/Hats/" + QString(isReserved?"Reserved/":"") + str + + ".png" + ) + ); + + // rename properly + if (isReserved) + str = "Reserved "+str.remove(0,32); + + QPixmap tmppix(32, 37); + tmppix.fill(QColor(Qt::transparent)); + + QPainter painter(&tmppix); + painter.drawPixmap(QPoint(0, 5), hhpix); + painter.drawPixmap(QPoint(0, 0), pix.copy(0, 0, 32, 32)); + if(pix.width() > 32) + painter.drawPixmap(QPoint(0, 0), pix.copy(32, 0, 32, 32)); + painter.end(); + + if (str == "NoHat") + hats.prepend(qMakePair(str, QIcon(tmppix))); + else + hats.append(qMakePair(str, QIcon(tmppix))); + } +} + +QVariant HatsModel::headerData(int section, + Qt::Orientation orientation, int role) const +{ + Q_UNUSED(section); + Q_UNUSED(orientation); + Q_UNUSED(role); + + return QVariant(); +} + +int HatsModel::rowCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return 0; + else + return hats.size(); +} + +/*int HatsModel::columnCount(const QModelIndex & parent) const +{ + if (parent.isValid()) + return 0; + else + return 2; +} +*/ +QVariant HatsModel::data(const QModelIndex &index, + int role) const +{ + if (!index.isValid() || index.row() < 0 + || index.row() >= hats.size() + || (role != Qt::DisplayRole && role != Qt::DecorationRole)) + return QVariant(); + + if (role == Qt::DisplayRole) + return hats.at(index.row()).first; + else // role == Qt::DecorationRole + return hats.at(index.row()).second; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/hats.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/model/hats.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,44 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _HATS_INCLUDED +#define _HATS_INCLUDED + +#include +#include +#include +#include +#include + +class HatsModel : public QAbstractListModel +{ + Q_OBJECT + +public: + HatsModel(QObject *parent = 0); + + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + int rowCount(const QModelIndex & parent) const; + //int columnCount(const QModelIndex & parent) const; + + QVariant data(const QModelIndex &index, int role) const; +protected: + QVector > hats; +}; + +#endif // _HATS_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/netserverslist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/model/netserverslist.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,68 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include + +#include "netserverslist.h" + +HWNetServersModel::HWNetServersModel(QObject* parent) : + QAbstractTableModel(parent) +{ + +} + +void HWNetServersModel::updateList() +{ + +} + +QVariant HWNetServersModel::headerData(int section, + Qt::Orientation orientation, int role) const +{ + if (role != Qt::DisplayRole) + return QVariant(); + + if (orientation == Qt::Horizontal) + { + switch (section) + { + case 0: return tr("Title"); + case 1: return tr("IP"); + case 2: return tr("Port"); + default: return QVariant(); + } + } else + return QString("%1").arg(section + 1); +} + +int HWNetServersModel::rowCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return 0; + else + return games.size(); +} + +int HWNetServersModel::columnCount(const QModelIndex & parent) const +{ + if (parent.isValid()) + return 0; + else + return 3; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/netserverslist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/model/netserverslist.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,43 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _NET_SERVERSLIST_INCLUDED +#define _NET_SERVERSLIST_INCLUDED + +#include +#include + +class HWNetServersModel : public QAbstractTableModel +{ + Q_OBJECT + +public: + HWNetServersModel(QObject *parent = 0); + + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + int rowCount(const QModelIndex & parent) const; + int columnCount(const QModelIndex & parent) const; + +public slots: + virtual void updateList(); + +protected: + QList games; +}; + +#endif // _NET_SERVERSLIST_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/themesmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/model/themesmodel.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,49 @@ + +#include "themesmodel.h" + +ThemesModel::ThemesModel(QStringList themes, QObject *parent) : + QAbstractListModel(parent) +{ +#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) + m_data.reserve(themes.size()); +#endif + + foreach(QString theme, themes) + { + m_data.append(QHash()); + m_data.last().insert(Qt::DisplayRole, theme); + } +} + +int ThemesModel::rowCount(const QModelIndex &parent) const +{ + if(parent.isValid()) + return 0; + else + return m_data.size(); +} + +QVariant ThemesModel::data(const QModelIndex &index, int role) const +{ + if(index.column() > 0 || index.row() >= m_data.size()) + return QVariant(); + else + return m_data.at(index.row()).value(role); +} + +bool ThemesModel::setData(const QModelIndex &index, const QVariant &value, int role) +{ + if(index.column() > 0 || index.row() >= m_data.size()) + return false; + else + { + m_data[index.row()].insert(role, value); + + return true; + } + +} + + + + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/model/themesmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/model/themesmodel.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,28 @@ +#ifndef THEMESMODEL_H +#define THEMESMODEL_H + +#include +#include +#include + +class ThemesModel : public QAbstractListModel +{ + Q_OBJECT +public: + explicit ThemesModel(QStringList themes, QObject *parent = 0); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + bool setData(const QModelIndex &index, const QVariant &value, + int role = Qt::EditRole); + +signals: + +public slots: + +private: + + QList > m_data; +}; + +#endif // THEMESMODEL_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/namegen.cpp --- a/QTfrontend/namegen.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2009 Martin Minarik - * Copyright (c) 2009-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include "namegen.h" -#include "hwform.h" -#include "hwconsts.h" - - -HWNamegen::HWNamegen() : - typesAvailable(false) -{ - - loadTypes(); -} - -HWNamegen::~HWNamegen() -{ -} - - - -void HWNamegen::teamRandomName(HWTeam & team, const int HedgehogNumber) -{ - randomNameByHat(team, HedgehogNumber); -} - -void HWNamegen::teamRandomNames(HWTeam & team, const bool changeteamname) -{ - if ((TypesHatnames.size() > 0) && typesAvailable){ - - int kind = (rand()%(TypesHatnames.size())); - - if (changeteamname){ - if (TypesTeamnames[kind].size() > 0){ - team.setName(TypesTeamnames[kind][rand()%(TypesTeamnames[kind].size())]); - } - team.setGrave(getRandomGrave()); - team.setFort(getRandomFort()); - team.setVoicepack("Default"); - } - - //give each hedgehog a random name: - //TODO: load the dictionary only once! (right now it's loaded once for each hedgehog) - for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) - { - if ((TypesHatnames[kind].size()) > 0){ - HWHog hh = team.hedgehog(i); - hh.Hat = TypesHatnames[kind][rand()%(TypesHatnames[kind].size())]; - team.setHedgehog(i,hh); - } - randomNameByHat(team,i); - } - - } - -} - - -void HWNamegen::randomNameByHat(HWTeam & team, const int HedgehogNumber) -{ - QStringList Dictionaries; - hatCfgLoad(team.hedgehog(HedgehogNumber).Hat,Dictionaries); - - QStringList Dictionary; - dictLoad(Dictionaries[rand()%(Dictionaries.size())],Dictionary); - - HWHog hh = team.hedgehog(HedgehogNumber); - hh.Name = Dictionary[rand()%(Dictionary.size())]; - team.setHedgehog(HedgehogNumber, hh); -} - -void HWNamegen::dictLoad(const QString filename, QStringList &list) -{ - list.clear(); - - QFile file; - file.setFileName(QString("%1/Data/Names/%2.txt").arg(cfgdir->absolutePath()).arg(filename)); - if (!file.exists()) file.setFileName(QString("%1/Names/%2.txt").arg(datadir->absolutePath()).arg(filename)); - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) - { - - QTextStream in(&file); - while (!in.atEnd()) { - QString line = in.readLine(); - if(line != QString("")) - {list.append(line);} - } - } - - if (list.size()==0) - list.append(filename); - -} - - -void HWNamegen::hatCfgLoad(const QString hatname, QStringList &list) -{ - list.clear(); - - QFile file; - file.setFileName(QString("%1/Data/Names/%2.cfg").arg(cfgdir->absolutePath()).arg(hatname)); - if (!file.exists()) file.setFileName(QString("%1/Names/%2.cfg").arg(datadir->absolutePath()).arg(hatname)); - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) - { - - QTextStream in(&file); - while (!in.atEnd()) { - QString line = in.readLine(); - if(line != QString("")) - {list.append(line);} - } - } - - if (list.size()==0) - list.append(QString("generic")); - -} - - -void HWNamegen::loadTypes() -{ - QFile file; - file.setFileName(QString("%1/Data/Names/types.ini").arg(cfgdir->absolutePath())); - if (!file.exists()) file.setFileName(QString("%1/Names/types.ini").arg(datadir->absolutePath())); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) - {typesAvailable = false; return;} - - int counter = 0; //counter starts with 0 (teamnames mode) - TypesTeamnames.append(QStringList()); - TypesHatnames.append(QStringList()); - - QTextStream in(&file); - while (!in.atEnd()) { - QString line = in.readLine(); - if (line == QString("#####")){ - counter++; //toggle mode (teamnames || hats) - if ((counter%2) == 0){ - TypesTeamnames.append(QStringList()); - TypesHatnames.append(QStringList()); - } - } else if ((line == QString("*****")) || (line == QString("*END*"))){ - typesAvailable = true; return; // bye bye - } else { - if ((counter%2) == 0){ // even => teamnames mode - TypesTeamnames[(counter/2)].append(line); - } else { // odd => hats mode - TypesHatnames[((counter-1)/2)].append(line); - } - } -// Types.append(line); - } - typesAvailable = true; - return; -} - - - -QString HWNamegen::getRandomGrave() -{ - QStringList Graves; - - //list all available Graves - QDir tmpdir; - tmpdir.cd(cfgdir->absolutePath()); - tmpdir.cd("Data/Graphics/Graves"); - tmpdir.setFilter(QDir::Files); - Graves.append(tmpdir.entryList(QStringList("*.png")).replaceInStrings(QRegExp("^(.*)\\.png"), "\\1")); - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Graphics/Graves"); - tmpdir.setFilter(QDir::Files); - QStringList tmpList = tmpdir.entryList(QStringList("*.png")).replaceInStrings(QRegExp("^(.*)\\.png"), "\\1"); - for (QStringList::Iterator it = tmpList.begin(); it != tmpList.end(); ++it) - if (!Graves.contains(*it,Qt::CaseInsensitive)) Graves.append(*it); - - if(Graves.size()==0) - { - //do some serious error handling - return "Error"; - } - - //pick a random grave - return Graves[rand()%(Graves.size())]; -} - -QString HWNamegen::getRandomFort() -{ - QStringList Forts; - - //list all available Forts - QDir tmpdir; - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Forts"); - tmpdir.setFilter(QDir::Files); - Forts.append(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); - - if(Forts.size()==0) - { - //do some serious error handling - return "Error"; - } - - //pick a random fort - return Forts[rand()%(Forts.size())]; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/namegen.h --- a/QTfrontend/namegen.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2009 Martin Minarik - * Copyright (c) 2009-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef NAMEGEN_H -#define NAMEGEN_H - -#include - -class HWForm; -class HWTeam; - -class HWNamegen -{ -public: - HWNamegen(); - ~HWNamegen(); - - void teamRandomName(HWTeam & team, const int HedgehogNumber); - void teamRandomNames(HWTeam & team, const bool changeteamname); - void randomNameByHat(HWTeam & team, const int HedgehogNumber); - -private: - - QList TypesTeamnames; - QList TypesHatnames; - bool typesAvailable; - void loadTypes(); - void dictLoad(const QString filename, QStringList &list); - void hatCfgLoad(const QString hatname, QStringList &list); - - QString getRandomGrave(); - QString getRandomFort(); -}; - - - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/hwmap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/hwmap.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,91 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Ulyanov Igor + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "hwconsts.h" +#include "hwmap.h" + +HWMap::HWMap() : + TCPBase(false) +{ +} + +HWMap::~HWMap() +{ +} + +void HWMap::getImage(const QString & seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData) +{ + m_seed = seed; + templateFilter = filter; + m_mapgen = mapgen; + m_maze_size = maze_size; + if(mapgen == MAPGEN_DRAWN) m_drawMapData = drawMapData; + Start(); +} + +QStringList HWMap::getArguments() +{ + QStringList arguments; + arguments << cfgdir->absolutePath(); + arguments << QString("%1").arg(ipc_port); + arguments << "landpreview"; + return arguments; +} + +void HWMap::onClientDisconnect() +{ + if (readbuffer.size() == 128 * 32 + 1) + { + quint8 *buf = (quint8*) readbuffer.constData(); + QImage im(buf, 256, 128, QImage::Format_Mono); + im.setNumColors(2); + emit HHLimitReceived(buf[128 * 32]); + emit ImageReceived(im); + } +} + +void HWMap::SendToClientFirst() +{ + SendIPC(QString("eseed %1").arg(m_seed).toUtf8()); + SendIPC(QString("e$template_filter %1").arg(templateFilter).toUtf8()); + SendIPC(QString("e$mapgen %1").arg(m_mapgen).toUtf8()); + + switch (m_mapgen) + { + case MAPGEN_MAZE: + SendIPC(QString("e$maze_size %1").arg(m_maze_size).toUtf8()); + break; + + case MAPGEN_DRAWN: + { + QByteArray data = m_drawMapData; + while(data.size() > 0) + { + QByteArray tmp = data; + tmp.truncate(200); + SendIPC("edraw " + tmp); + data.remove(0, 200); + } + break; + } + default: ; + } + + SendIPC("!"); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/hwmap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/hwmap.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,65 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006 Igor Ulyanov + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _HWMAP_INCLUDED +#define _HWMAP_INCLUDED + +#include +#include +#include + +#include "tcpBase.h" + +enum MapGenerator +{ + MAPGEN_REGULAR, + MAPGEN_MAZE, + MAPGEN_DRAWN, + MAPGEN_MAP +}; + +class HWMap : public TCPBase +{ + Q_OBJECT + + public: + HWMap(); + virtual ~HWMap(); + void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData); + + protected: + virtual QStringList getArguments(); + virtual void onClientDisconnect(); + virtual void SendToClientFirst(); + + signals: + void ImageReceived(const QImage newImage); + void HHLimitReceived(int hhLimit); + + private: + QString m_seed; + int templateFilter; + MapGenerator m_mapgen; + int m_maze_size; + QByteArray m_drawMapData; + + private slots: +}; + +#endif // _HWMAP_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/netregister.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/netregister.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,31 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "netregister.h" + +HWNetRegisterServer::HWNetRegisterServer(QObject *parent, const QString & descr, quint16 port) : + QObject(parent) +{ + Q_UNUSED(descr); + Q_UNUSED(port); +} + +void HWNetRegisterServer::unregister() +{ + +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/netregister.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/netregister.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,35 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _NET_REGISTER_INCLUDED +#define _NET_REGISTER_INCLUDED + +#include + +class HWNetRegisterServer : public QObject +{ + Q_OBJECT + +public: + HWNetRegisterServer(QObject *parent, const QString & descr, quint16 port); + +public slots: + virtual void unregister(); +}; + +#endif // _NET_REGISTER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/netserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/netserver.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,52 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include + +#include "hwconsts.h" +#include "netserver.h" + +HWNetServer::~HWNetServer() +{ + StopServer(); +} + +bool HWNetServer::StartServer(quint16 port) +{ + ds_port = port; + + QStringList params; + params << QString("--port=%1").arg(port); + params << "--dedicated=False"; + + process.start(bindir->absolutePath() + "/hedgewars-server", params); + + return process.waitForStarted(5000); +} + +void HWNetServer::StopServer() +{ + process.close(); +} + + +quint16 HWNetServer::getRunningPort() const +{ + return ds_port; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/netserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/netserver.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,42 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _NETSERVER_INCLUDED +#define _NETSERVER_INCLUDED + +#include +#include + +class HWNetServer : public QObject +{ + Q_OBJECT + +public: + ~HWNetServer(); + bool StartServer(quint16 port); + void StopServer(); + QString getRunningHostName() const; + quint16 getRunningPort() const; + +private: + quint16 ds_port; + QProcess process; +}; + +#endif // _NETSERVER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/netudpserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/netudpserver.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,51 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include + +#include "netudpserver.h" + +HWNetUdpServer::HWNetUdpServer(QObject *parent, const QString & descr, quint16 port) : + HWNetRegisterServer(parent, descr, port), + m_descr(descr) +{ + pUdpSocket = new QUdpSocket(this); + pUdpSocket->bind(46631); + connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead())); +} + +void HWNetUdpServer::onClientRead() +{ + while (pUdpSocket->hasPendingDatagrams()) { + QByteArray datagram; + datagram.resize(pUdpSocket->pendingDatagramSize()); + QHostAddress clientAddr; + quint16 clientPort; + pUdpSocket->readDatagram(datagram.data(), datagram.size(), &clientAddr, &clientPort); + if(datagram.startsWith("hedgewars client")) { + // send answer to client + pUdpSocket->writeDatagram(QString("hedgewars server\n%1").arg(m_descr).toUtf8(), clientAddr, clientPort); + } + } +} + +void HWNetUdpServer::unregister() +{ + deleteLater(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/netudpserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/netudpserver.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,46 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _NET_UDPSERVER_INCLUDED +#define _NET_UDPSERVER_INCLUDED + +#include +#include "netregister.h" + +class QUdpSocket; + +class HWNetUdpServer : public HWNetRegisterServer +{ + Q_OBJECT + + public: + HWNetUdpServer(QObject *parent, const QString & descr, quint16 port); + + public slots: + void unregister(); + + private slots: + void onClientRead(); + + private: + QUdpSocket* pUdpSocket; + QString m_descr; +}; + +#endif // _NET_UDPSERVER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/netudpwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/netudpwidget.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,72 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include + +#include "netudpwidget.h" + +HWNetUdpModel::HWNetUdpModel(QObject* parent) : + HWNetServersModel(parent) +{ + pUdpSocket = new QUdpSocket(this); + + pUdpSocket->bind(); + connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead())); +} + +void HWNetUdpModel::updateList() +{ + games.clear(); + + reset(); + + pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631); +} + +void HWNetUdpModel::onClientRead() +{ + while (pUdpSocket->hasPendingDatagrams()) { + QByteArray datagram; + datagram.resize(pUdpSocket->pendingDatagramSize()); + QHostAddress clientAddr; + quint16 clientPort; + + pUdpSocket->readDatagram(datagram.data(), datagram.size(), &clientAddr, &clientPort); + + QString packet = QString::fromUtf8(datagram.data()); + if(packet.startsWith("hedgewars server")) { + QStringList sl; + sl << packet.remove(0, 17) << clientAddr.toString() << "46631"; + games.append(sl); + } + } + + reset(); +} + +QVariant HWNetUdpModel::data(const QModelIndex &index, + int role) const +{ + if (!index.isValid() || index.row() < 0 + || index.row() >= games.size() + || role != Qt::DisplayRole) + return QVariant(); + + return games[index.row()][index.column()]; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/netudpwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/netudpwidget.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,46 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _NET_UDPWIDGET_INCLUDED +#define _NET_UDPWIDGET_INCLUDED + +#include "netserverslist.h" + +class QUdpSocket; + +class HWNetUdpModel : public HWNetServersModel +{ + Q_OBJECT + +public: + HWNetUdpModel(QObject *parent = 0); + + QVariant data(const QModelIndex &index, int role) const; + +public slots: + void updateList(); + +private slots: + void onClientRead(); + +private: + QUdpSocket* pUdpSocket; +}; + +#endif // _NET_UDPWIDGET_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/newnetclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/newnetclient.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,786 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include + +#include "hwconsts.h" +#include "newnetclient.h" +#include "proto.h" +#include "game.h" + +char delimeter='\n'; + +HWNewNet::HWNewNet() : + isChief(false), + m_game_connected(false), + loginStep(0), + netClientState(Disconnected) +{ +// socket stuff + connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); + connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect())); + connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect())); + connect(&NetSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, + SLOT(displayError(QAbstractSocket::SocketError))); +} + +HWNewNet::~HWNewNet() +{ + if (m_game_connected) + { + RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit")); + emit disconnected(tr("User quit")); + } + NetSocket.flush(); +} + +void HWNewNet::Connect(const QString & hostName, quint16 port, const QString & nick) +{ + netClientState = Connecting; + mynick = nick; + myhost = hostName + QString(":%1").arg(port); + NetSocket.connectToHost(hostName, port); +} + +void HWNewNet::Disconnect() +{ + if (m_game_connected) + RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit")); + m_game_connected = false; + + NetSocket.disconnectFromHost(); +} + +void HWNewNet::CreateRoom(const QString & room) +{ + if(netClientState != InLobby) + { + qWarning("Illegal try to create room!"); + return; + } + + myroom = room; + + RawSendNet(QString("CREATE_ROOM%1%2").arg(delimeter).arg(room)); + isChief = true; +} + +void HWNewNet::JoinRoom(const QString & room) +{ + if(netClientState != InLobby) + { + qWarning("Illegal try to join room!"); + return; + } + + myroom = room; + + RawSendNet(QString("JOIN_ROOM%1%2").arg(delimeter).arg(room)); + isChief = false; +} + +void HWNewNet::AddTeam(const HWTeam & team) +{ + QString cmd = QString("ADD_TEAM") + delimeter + + team.name() + delimeter + + team.color().name() + delimeter + + team.grave() + delimeter + + team.fort() + delimeter + + team.voicepack() + delimeter + + team.flag() + delimeter + + QString::number(team.difficulty()); + + for(int i = 0; i < HEDGEHOGS_PER_TEAM; ++i) + { + cmd.append(delimeter); + cmd.append(team.hedgehog(i).Name); + cmd.append(delimeter); + cmd.append(team.hedgehog(i).Hat); + } + RawSendNet(cmd); +} + +void HWNewNet::RemoveTeam(const HWTeam & team) +{ + RawSendNet(QString("REMOVE_TEAM") + delimeter + team.name()); +} + +void HWNewNet::NewNick(const QString & nick) +{ + RawSendNet(QString("NICK%1%2").arg(delimeter).arg(nick)); +} + +void HWNewNet::ToggleReady() +{ + RawSendNet(QString("TOGGLE_READY")); +} + +void HWNewNet::SendNet(const QByteArray & buf) +{ + QString msg = QString(buf.toBase64()); + + RawSendNet(QString("EM%1%2").arg(delimeter).arg(msg)); +} + +void HWNewNet::RawSendNet(const QString & str) +{ + RawSendNet(str.toUtf8()); +} + +void HWNewNet::RawSendNet(const QByteArray & buf) +{ + qDebug() << "Client: " << QString(buf).split("\n"); + NetSocket.write(buf); + NetSocket.write("\n\n", 2); +} + +void HWNewNet::ClientRead() +{ + while (NetSocket.canReadLine()) { + QString s = QString::fromUtf8(NetSocket.readLine()); + if (s.endsWith('\n')) s.chop(1); + + if (s.size() == 0) { + ParseCmd(cmdbuf); + cmdbuf.clear(); + } else + cmdbuf << s; + } +} + +void HWNewNet::OnConnect() +{ + netClientState = Connected; +} + +void HWNewNet::OnDisconnect() +{ + netClientState = Disconnected; + if(m_game_connected) emit disconnected(""); + m_game_connected = false; +} + +void HWNewNet::displayError(QAbstractSocket::SocketError socketError) +{ + m_game_connected = false; + + switch (socketError) { + case QAbstractSocket::RemoteHostClosedError: + break; + case QAbstractSocket::HostNotFoundError: + emit disconnected(tr("The host was not found. Please check the host name and port settings.")); + break; + case QAbstractSocket::ConnectionRefusedError: + emit disconnected(tr("Connection refused")); + break; + default: + emit disconnected(NetSocket.errorString()); + } +} + +void HWNewNet::SendPasswordHash(const QString & hash) +{ + RawSendNet(QString("PASSWORD%1%2").arg(delimeter).arg(hash)); +} + +void HWNewNet::ParseCmd(const QStringList & lst) +{ + qDebug() << "Server: " << lst; + + if(!lst.size()) + { + qWarning("Net client: Bad message"); + return; + } + + if (lst[0] == "NICK") + { + mynick = lst[1]; + return ; + } + + if (lst[0] == "PROTO") + return ; + + if (lst[0] == "ERROR") { + if (lst.size() == 2) + emit Error(lst[1]); + else + emit Error("Unknown error"); + return; + } + + if (lst[0] == "WARNING") { + if (lst.size() == 2) + emit Warning(lst[1]); + else + emit Warning("Unknown warning"); + return; + } + + if (lst[0] == "CONNECTED") { + if(lst.size() < 3 || lst[2].toInt() < cMinServerVersion) + { + // TODO: Warn user, disconnect + qWarning() << "Server too old"; + } + + RawSendNet(QString("NICK%1%2").arg(delimeter).arg(mynick)); + RawSendNet(QString("PROTO%1%2").arg(delimeter).arg(*cProtoVer)); + netClientState = Connected; + m_game_connected = true; + emit adminAccess(false); + return; + } + + if (lst[0] == "PING") { + if (lst.size() > 1) + RawSendNet(QString("PONG%1%2").arg(delimeter).arg(lst[1])); + else + RawSendNet(QString("PONG")); + return; + } + + if (lst[0] == "ROOMS") { + QStringList tmp = lst; + tmp.removeFirst(); + emit roomsList(tmp); + return; + } + + if (lst[0] == "SERVER_MESSAGE") { + if(lst.size() < 2) + { + qWarning("Net: Empty SERVERMESSAGE message"); + return; + } + emit serverMessage(lst[1]); + return; + } + + if (lst[0] == "CHAT") { + if(lst.size() < 3) + { + qWarning("Net: Empty CHAT message"); + return; + } + if (netClientState == InLobby) + emit chatStringLobby(lst[1], HWProto::formatChatMsgForFrontend(lst[2])); + else + emit chatStringFromNet(HWProto::formatChatMsg(lst[1], lst[2])); + return; + } + + if (lst[0] == "INFO") { + if(lst.size() < 5) + { + qWarning("Net: Malformed INFO message"); + return; + } + QStringList tmp = lst; + tmp.removeFirst(); + if (netClientState == InLobby) + emit chatStringLobby(tmp.join("\n").prepend('\x01')); + else + emit chatStringFromNet(tmp.join("\n").prepend('\x01')); + return; + } + + if (lst[0] == "SERVER_VARS") { + QStringList tmp = lst; + tmp.removeFirst(); + while (tmp.size() >= 2) + { + if(tmp[0] == "MOTD_NEW") emit serverMessageNew(tmp[1]); + else if(tmp[0] == "MOTD_OLD") emit serverMessageOld(tmp[1]); + else if(tmp[0] == "LATEST_PROTO") emit latestProtocolVar(tmp[1].toInt()); + + tmp.removeFirst(); + tmp.removeFirst(); + } + return; + } + + if (lst[0] == "CLIENT_FLAGS") + { + if(lst.size() < 3 || lst[1].size() < 2) + { + qWarning("Net: Malformed CLIENT_FLAGS message"); + return; + } + + QString flags = lst[1]; + bool setFlag = flags[0] == '+'; + + while(flags.size() > 1) + { + flags.remove(0, 1); + char c = flags[0].toAscii(); + + switch(c) + { + case 'r': + { + for(int i = 2; i < lst.size(); ++i) + { + if (lst[i] == mynick) + emit setMyReadyStatus(setFlag); + emit setReadyStatus(lst[i], setFlag); + } + } + } + } + + return; + } + + if (lst[0] == "ADD_TEAM") { + if(lst.size() != 24) + { + qWarning("Net: Bad ADDTEAM message"); + return; + } + QStringList tmp = lst; + tmp.removeFirst(); + emit AddNetTeam(tmp); + return; + } + + if (lst[0] == "REMOVE_TEAM") { + if(lst.size() != 2) + { + qWarning("Net: Bad REMOVETEAM message"); + return; + } + emit RemoveNetTeam(HWTeam(lst[1])); + return; + } + + if(lst[0] == "ROOMABANDONED") { + netClientState = InLobby; + emit LeftRoom(tr("Room destroyed")); + return; + } + + if(lst[0] == "KICKED") { + netClientState = InLobby; + emit LeftRoom(tr("You got kicked")); + return; + } + + if(lst[0] == "JOINED") { + if(lst.size() < 2) + { + qWarning("Net: Bad JOINED message"); + return; + } + + for(int i = 1; i < lst.size(); ++i) + { + if (lst[i] == mynick) + { + netClientState = InRoom; + emit EnteredGame(); + emit roomMaster(isChief); + if (isChief) + emit configAsked(); + } + + emit nickAdded(lst[i], isChief && (lst[i] != mynick)); + emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i])); + } + return; + } + + if(lst[0] == "LOBBY:JOINED") { + if(lst.size() < 2) + { + qWarning("Net: Bad JOINED message"); + return; + } + + for(int i = 1; i < lst.size(); ++i) + { + if (lst[i] == mynick) + { + netClientState = InLobby; + RawSendNet(QString("LIST")); + emit connected(); + } + + emit nickAddedLobby(lst[i], false); + emit chatStringLobby(lst[i], tr("%1 *** %2 has joined").arg('\x03').arg("|nick|")); + } + return; + } + + if(lst[0] == "LEFT") { + if(lst.size() < 2) + { + qWarning("Net: Bad LEFT message"); + return; + } + emit nickRemoved(lst[1]); + if (lst.size() < 3) + emit chatStringFromNet(tr("%1 *** %2 has left").arg('\x03').arg(lst[1])); + else + emit chatStringFromNet(tr("%1 *** %2 has left (%3)").arg('\x03').arg(lst[1], lst[2])); + return; + } + + if(lst[0] == "ROOM") { + if(lst.size() < 2) + { + qWarning("Net: Bad ROOM message"); + return; + } + RawSendNet(QString("LIST")); + return; + } + + if(lst[0] == "LOBBY:LEFT") { + if(lst.size() < 2) + { + qWarning("Net: Bad LOBBY:LEFT message"); + return; + } + emit nickRemovedLobby(lst[1]); + if (lst.size() < 3) + emit chatStringLobby(tr("%1 *** %2 has left").arg('\x03').arg(lst[1])); + else + emit chatStringLobby(lst[1], tr("%1 *** %2 has left (%3)").arg('\x03').arg("|nick|", lst[2])); + return; + } + + if (lst[0] == "RUN_GAME") { + netClientState = InGame; + emit AskForRunGame(); + return; + } + + if (lst[0] == "ASKPASSWORD") { + emit AskForPassword(mynick); + return; + } + + if (lst[0] == "NOTICE") { + if(lst.size() < 2) + { + qWarning("Net: Bad NOTICE message"); + return; + } + + bool ok; + int n = lst[1].toInt(&ok); + if(!ok) + { + qWarning("Net: Bad NOTICE message"); + return; + } + + handleNotice(n); + + return; + } + + if (lst[0] == "TEAM_ACCEPTED") { + if (lst.size() != 2) + { + qWarning("Net: Bad TEAM_ACCEPTED message"); + return; + } + emit TeamAccepted(lst[1]); + return; + } + + + if (lst[0] == "CFG") { + if(lst.size() < 3) + { + qWarning("Net: Bad CFG message"); + return; + } + QStringList tmp = lst; + tmp.removeFirst(); + tmp.removeFirst(); + if (lst[1] == "SCHEME") + emit netSchemeConfig(tmp); + else + emit paramChanged(lst[1], tmp); + return; + } + + if (lst[0] == "HH_NUM") { + if (lst.size() != 3) + { + qWarning("Net: Bad TEAM_ACCEPTED message"); + return; + } + HWTeam tmptm(lst[1]); + tmptm.setNumHedgehogs(lst[2].toUInt()); + emit hhnumChanged(tmptm); + return; + } + + if (lst[0] == "TEAM_COLOR") { + if (lst.size() != 3) + { + qWarning("Net: Bad TEAM_COLOR message"); + return; + } + HWTeam tmptm(lst[1]); + tmptm.setColor(QColor(lst[2])); + emit teamColorChanged(tmptm); + return; + } + + if (lst[0] == "EM") { + if(lst.size() < 2) + { + qWarning("Net: Bad EM message"); + return; + } + for(int i = 1; i < lst.size(); ++i) + { + QByteArray em = QByteArray::fromBase64(lst[i].toAscii()); + emit FromNet(em); + } + return; + } + + if (lst[0] == "BYE") { + if (lst.size() < 2) + { + qWarning("Net: Bad BYE message"); + return; + } + if (lst[1] == "Authentication failed") + { + emit AuthFailed(); + } + m_game_connected = false; + Disconnect(); + emit disconnected(lst[1]); + return; + } + + + if (lst[0] == "ADMIN_ACCESS") { + emit adminAccess(true); + return; + } + + if (lst[0] == "ROOM_CONTROL_ACCESS") { + if (lst.size() < 2) + { + qWarning("Net: Bad ROOM_CONTROL_ACCESS message"); + return; + } + isChief = (lst[1] != "0"); + emit roomMaster(isChief); + return; + } + + qWarning() << "Net: Unknown message:" << lst; +} + +void HWNewNet::onHedgehogsNumChanged(const HWTeam& team) +{ + if (isChief) + RawSendNet(QString("HH_NUM%1%2%1%3") + .arg(delimeter) + .arg(team.name()) + .arg(team.numHedgehogs())); +} + +void HWNewNet::onTeamColorChanged(const HWTeam& team) +{ + if (isChief) + RawSendNet(QString("TEAM_COLOR%1%2%1%3") + .arg(delimeter) + .arg(team.name()) + .arg(team.color().name())); +} + +void HWNewNet::onParamChanged(const QString & param, const QStringList & value) +{ + if (isChief) + RawSendNet( + QString("CFG%1%2%1%3") + .arg(delimeter) + .arg(param) + .arg(value.join(QString(delimeter))) + ); +} + +void HWNewNet::chatLineToNet(const QString& str) +{ + if(str != "") { + RawSendNet(QString("CHAT") + delimeter + str); + emit(chatStringFromMe(HWProto::formatChatMsg(mynick, str))); + } +} + +void HWNewNet::chatLineToLobby(const QString& str) +{ + if(str != "") { + RawSendNet(QString("CHAT") + delimeter + str); + emit chatStringLobby(mynick, HWProto::formatChatMsgForFrontend(str)); + } +} + +void HWNewNet::SendTeamMessage(const QString& str) +{ + RawSendNet(QString("TEAMCHAT") + delimeter + str); +} + +void HWNewNet::askRoomsList() +{ + if(netClientState != InLobby) + { + qWarning("Illegal try to get rooms list!"); + return; + } + RawSendNet(QString("LIST")); +} + +HWNewNet::ClientState HWNewNet::clientState() +{ + return netClientState; +} + +QString HWNewNet::getNick() +{ + return mynick; +} + +QString HWNewNet::getRoom() +{ + return myroom; +} + +QString HWNewNet::getHost() +{ + return myhost; +} + +bool HWNewNet::isRoomChief() +{ + return isChief; +} + +void HWNewNet::gameFinished(bool correctly) +{ + if (netClientState == InGame) netClientState = InRoom; + RawSendNet(QString("ROUNDFINISHED%1%2").arg(delimeter).arg(correctly ? "1" : "0")); +} + +void HWNewNet::banPlayer(const QString & nick) +{ + RawSendNet(QString("BAN%1%2").arg(delimeter).arg(nick)); +} + +void HWNewNet::kickPlayer(const QString & nick) +{ + RawSendNet(QString("KICK%1%2").arg(delimeter).arg(nick)); +} + +void HWNewNet::infoPlayer(const QString & nick) +{ + RawSendNet(QString("INFO%1%2").arg(delimeter).arg(nick)); +} + +void HWNewNet::followPlayer(const QString & nick) +{ + if (!isInRoom()) { + RawSendNet(QString("FOLLOW%1%2").arg(delimeter).arg(nick)); + isChief = false; + } +} + +void HWNewNet::startGame() +{ + RawSendNet(QString("START_GAME")); +} + +void HWNewNet::updateRoomName(const QString & name) +{ + RawSendNet(QString("ROOM_NAME%1%2").arg(delimeter).arg(name)); +} + + +void HWNewNet::toggleRestrictJoins() +{ + RawSendNet(QString("TOGGLE_RESTRICT_JOINS")); +} + +void HWNewNet::toggleRestrictTeamAdds() +{ + RawSendNet(QString("TOGGLE_RESTRICT_TEAMS")); +} + +void HWNewNet::clearAccountsCache() +{ + RawSendNet(QString("CLEAR_ACCOUNTS_CACHE")); +} + +void HWNewNet::partRoom() +{ + netClientState = InLobby; + RawSendNet(QString("PART")); +} + +bool HWNewNet::isInRoom() +{ + return netClientState >= InRoom; +} + +void HWNewNet::setServerMessageNew(const QString & msg) +{ + RawSendNet(QString("SET_SERVER_VAR%1MOTD_NEW%1%2").arg(delimeter).arg(msg)); +} + +void HWNewNet::setServerMessageOld(const QString & msg) +{ + RawSendNet(QString("SET_SERVER_VAR%1MOTD_OLD%1%2").arg(delimeter).arg(msg)); +} + +void HWNewNet::setLatestProtocolVar(int proto) +{ + RawSendNet(QString("SET_SERVER_VAR%1LATEST_PROTO%1%2").arg(delimeter).arg(proto)); +} + +void HWNewNet::askServerVars() +{ + RawSendNet(QString("GET_SERVER_VAR")); +} + +void HWNewNet::handleNotice(int n) +{ + switch(n) + { + case 0: + { + emit NickTaken(mynick); + break; + } + } +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/newnetclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/newnetclient.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,177 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _NEW_NETCLIENT_INCLUDED +#define _NEW_NETCLIENT_INCLUDED + +#include +#include +#include +#include + +#include "team.h" +#include "game.h" // for GameState + +class GameUIConfig; +class GameCFGWidget; +class TeamSelWidget; + +extern char delimeter; + +class HWNewNet : public QObject +{ + Q_OBJECT + + public: + enum ClientState { Disconnected, Connecting, Connected, InLobby, InRoom, InGame }; + + HWNewNet(); + ~HWNewNet(); + void Connect(const QString & hostName, quint16 port, const QString & nick); + void Disconnect(); + void SendPasswordHash(const QString & hash); + void NewNick(const QString & nick); + bool isRoomChief(); + bool isInRoom(); + ClientState clientState(); + QString getNick(); + QString getRoom(); + QString getHost(); + + private: + bool isChief; + QString mynick; + QString myroom; + QString myhost; + QTcpSocket NetSocket; + QString seed; + bool m_game_connected; + + template + void SendCfgStrNet(T a) { + QByteArray strmsg; + strmsg.append(a); + quint8 sz = strmsg.size(); + QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg; + QString _msg = delimeter + QString(enginemsg.toBase64()); + RawSendNet(_msg); + } + + template + void SendCfgStrLoc(T a) { + QByteArray strmsg; + strmsg.append(QString(a).toUtf8()); + quint8 sz = strmsg.size(); + QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg; + emit FromNet(enginemsg); + } + + QStringList cmdbuf; + + void RawSendNet(const QString & buf); + void RawSendNet(const QByteArray & buf); + void ParseCmd(const QStringList & lst); + void handleNotice(int n); + + int loginStep; + ClientState netClientState; + + signals: + void AskForRunGame(); + void connected(); + void disconnected(const QString & reason); + void Error(const QString & errmsg); + void Warning(const QString & wrnmsg); + void AskForPassword(const QString & nick); + void NickTaken(const QString & nick); + void AuthFailed(); + void EnteredGame(); + void LeftRoom(const QString & reason); + void nickAdded(const QString& nick, bool notifyNick); + void nickRemoved(const QString& nick); + void nickAddedLobby(const QString& nick, bool notifyNick); + void nickRemovedLobby(const QString& nick); + void FromNet(const QByteArray & buf); + void adminAccess(bool); + void roomMaster(bool); + + void netSchemeConfig(QStringList &); + void paramChanged(const QString & param, const QStringList & value); + void configAsked(); + + void TeamAccepted(const QString&); + void AddNetTeam(const HWTeam&); + void RemoveNetTeam(const HWTeam&); + void hhnumChanged(const HWTeam&); + void teamColorChanged(const HWTeam&); + void chatStringLobby(const QString&); + void chatStringLobby(const QString&, const QString&); + void chatStringFromNet(const QString&); + void chatStringFromMe(const QString&); + void chatStringFromMeLobby(const QString&); + + void roomsList(const QStringList&); + void serverMessage(const QString &); + void serverMessageNew(const QString &); + void serverMessageOld(const QString &); + void latestProtocolVar(int); + + void setReadyStatus(const QString & nick, bool isReady); + void setMyReadyStatus(bool isReady); + + public slots: + void ToggleReady(); + void chatLineToNet(const QString& str); + void chatLineToLobby(const QString& str); + void SendTeamMessage(const QString& str); + void SendNet(const QByteArray & buf); + void AddTeam(const HWTeam & team); + void RemoveTeam(const HWTeam& team); + void onHedgehogsNumChanged(const HWTeam& team); + void onTeamColorChanged(const HWTeam& team); + void onParamChanged(const QString & param, const QStringList & value); + + void setServerMessageNew(const QString &); + void setServerMessageOld(const QString &); + void setLatestProtocolVar(int proto); + void askServerVars(); + + void JoinRoom(const QString & room); + void CreateRoom(const QString & room); + void updateRoomName(const QString &); + void askRoomsList(); + void gameFinished(bool correcly); + void banPlayer(const QString &); + void kickPlayer(const QString &); + void infoPlayer(const QString &); + void followPlayer(const QString &); + void startGame(); + void toggleRestrictJoins(); + void toggleRestrictTeamAdds(); + void partRoom(); + void clearAccountsCache(); + + private slots: + void ClientRead(); + void OnConnect(); + void OnDisconnect(); + void displayError(QAbstractSocket::SocketError socketError); +}; + +#endif // _NEW_NETCLIENT_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/proto.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/proto.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,59 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "proto.h" + +HWProto::HWProto() +{ + +} + +QByteArray & HWProto::addByteArrayToBuffer(QByteArray & buf, const QByteArray & msg) +{ + QByteArray bmsg = msg; + bmsg = bmsg.left(250); + quint8 sz = bmsg.size(); + buf.append(QByteArray((char *)&sz, 1)); + buf.append(bmsg); + return buf; +} + +QByteArray & HWProto::addStringToBuffer(QByteArray & buf, const QString & string) +{ + return addByteArrayToBuffer(buf, string.toUtf8()); +} + +QByteArray & HWProto::addStringListToBuffer(QByteArray & buf, const QStringList & strList) +{ + for (int i = 0; i < strList.size(); i++) + addStringToBuffer(buf, strList[i]); + return buf; +} + +QString HWProto::formatChatMsgForFrontend(const QString & msg) +{ + return formatChatMsg("|nick|", msg); +} + +QString HWProto::formatChatMsg(const QString & nick, const QString & msg) +{ + if(msg.left(4) == "/me ") + return QString("\x02* %1 %2").arg(nick).arg(msg.mid(4)); + else + return QString("\x01%1: %2").arg(nick).arg(msg); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/proto.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/proto.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,40 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _PROTO_H +#define _PROTO_H + +#include +#include +#include + + +class HWProto : public QObject +{ + Q_OBJECT + +public: + HWProto(); + static QByteArray & addStringToBuffer(QByteArray & buf, const QString & string); + static QByteArray & addByteArrayToBuffer(QByteArray & buf, const QByteArray & msg); + static QByteArray & addStringListToBuffer(QByteArray & buf, const QStringList & strList); + static QString formatChatMsg(const QString & nick, const QString & msg); + static QString formatChatMsgForFrontend(const QString & msg); +}; + +#endif // _PROTO_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/tcpBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/tcpBase.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,166 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "tcpBase.h" + +#include +#include + +#include + +#include "hwconsts.h" + +QList srvsList; +QPointer TCPBase::IPCServer(0); + +TCPBase::~TCPBase() +{ +} + +TCPBase::TCPBase(bool demoMode) : + m_isDemoMode(demoMode), + IPCSocket(0) +{ + if(!IPCServer) { + IPCServer = new QTcpServer(0); + IPCServer->setMaxPendingConnections(1); + if (!IPCServer->listen(QHostAddress::LocalHost)) { + QMessageBox::critical(0, tr("Error"), + tr("Unable to start the server: %1.") + .arg(IPCServer->errorString())); + exit(0); // FIXME - should be graceful exit here + } + } + ipc_port=IPCServer->serverPort(); +} + +void TCPBase::NewConnection() +{ + if(IPCSocket) { + // connection should be already finished + return; + } + disconnect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); + IPCSocket = IPCServer->nextPendingConnection(); + if(!IPCSocket) return; + connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect())); + connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); + SendToClientFirst(); +} + +void TCPBase::RealStart() +{ + connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); + IPCSocket = 0; + + QProcess * process; + process = new QProcess; + connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError))); + QStringList arguments=getArguments(); + + // redirect everything written on stdout/stderr + if(isDevBuild) + process->setProcessChannelMode(QProcess::ForwardedChannels); + process->start(bindir->absolutePath() + "/hwengine", arguments); +} + +void TCPBase::ClientDisconnect() +{ + disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); + onClientDisconnect(); + + if(srvsList.size()==1) srvsList.pop_front(); + emit isReadyNow(); + IPCSocket->deleteLater(); + deleteLater(); +} + +void TCPBase::ClientRead() +{ + QByteArray readed=IPCSocket->readAll(); + if(readed.isEmpty()) return; + readbuffer.append(readed); + onClientRead(); +} + +void TCPBase::StartProcessError(QProcess::ProcessError error) +{ + QMessageBox::critical(0, tr("Error"), + tr("Unable to run engine: %1 (") + .arg(error) + bindir->absolutePath() + "/hwengine)"); +} + +void TCPBase::tcpServerReady() +{ + disconnect(srvsList.takeFirst(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); + + RealStart(); +} + +void TCPBase::Start() +{ + if(srvsList.isEmpty()) { + srvsList.push_back(this); + } else { + connect(srvsList.back(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); + srvsList.push_back(this); + return; + } + + RealStart(); +} + +void TCPBase::onClientRead() +{ +} + +void TCPBase::onClientDisconnect() +{ +} + +void TCPBase::SendToClientFirst() +{ +} + +void TCPBase::SendIPC(const QByteArray & buf) +{ + if (buf.size() > MAXMSGCHARS) return; + quint8 len = buf.size(); + RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf); +} + +void TCPBase::RawSendIPC(const QByteArray & buf) +{ + if (!IPCSocket) + { + toSendBuf += buf; + } else + { + if (toSendBuf.size() > 0) + { + IPCSocket->write(toSendBuf); + if(m_isDemoMode) demo.append(toSendBuf); + toSendBuf.clear(); + } + if(!buf.isEmpty()) { + IPCSocket->write(buf); + if(m_isDemoMode) demo.append(buf); + } + } +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/net/tcpBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/net/tcpBase.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,81 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _TCPBASE_INCLUDED +#define _TCPBASE_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define MAXMSGCHARS 255 + +class TCPBase : public QObject +{ + Q_OBJECT + + public: + TCPBase(bool demoMode); + virtual ~TCPBase(); + + signals: + void isReadyNow(); + + protected: + quint16 ipc_port; + + void Start(); + + QByteArray readbuffer; + + QByteArray toSendBuf; + QByteArray demo; + + void SendIPC(const QByteArray & buf); + void RawSendIPC(const QByteArray & buf); + + virtual QStringList getArguments()=0; + virtual void onClientRead(); + virtual void onClientDisconnect(); + virtual void SendToClientFirst(); + + private: + static QPointer IPCServer; + + bool m_isDemoMode; + void RealStart(); + QPointer IPCSocket; + + private slots: + void NewConnection(); + void ClientDisconnect(); + void ClientRead(); + void StartProcessError(QProcess::ProcessError error); + + void tcpServerReady(); +}; + +#endif // _TCPBASE_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netregister.cpp --- a/QTfrontend/netregister.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "netregister.h" - -HWNetRegisterServer::HWNetRegisterServer(QObject *parent, const QString & descr, quint16 port) : - QObject(parent) -{ - Q_UNUSED(descr); - Q_UNUSED(port); -} - -void HWNetRegisterServer::unregister() -{ - -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netregister.h --- a/QTfrontend/netregister.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _NET_REGISTER_INCLUDED -#define _NET_REGISTER_INCLUDED - -#include - -class HWNetRegisterServer : public QObject -{ - Q_OBJECT - -public: - HWNetRegisterServer(QObject *parent, const QString & descr, quint16 port); - -public slots: - virtual void unregister(); -}; - -#endif // _NET_REGISTER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netserver.cpp --- a/QTfrontend/netserver.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include - -#include "hwconsts.h" -#include "netserver.h" - -HWNetServer::~HWNetServer() -{ - StopServer(); -} - -bool HWNetServer::StartServer(quint16 port) -{ - ds_port = port; - - QStringList params; - params << QString("--port=%1").arg(port); - params << "--dedicated=False"; - - process.start(bindir->absolutePath() + "/hedgewars-server", params); - - return process.waitForStarted(5000); -} - -void HWNetServer::StopServer() -{ - process.close(); -} - - -quint16 HWNetServer::getRunningPort() const -{ - return ds_port; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netserver.h --- a/QTfrontend/netserver.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _NETSERVER_INCLUDED -#define _NETSERVER_INCLUDED - -#include -#include - -class HWNetServer : public QObject -{ - Q_OBJECT - -public: - ~HWNetServer(); - bool StartServer(quint16 port); - void StopServer(); - QString getRunningHostName() const; - quint16 getRunningPort() const; - -private: - quint16 ds_port; - QProcess process; -}; - -#endif // _NETSERVER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netserverslist.cpp --- a/QTfrontend/netserverslist.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "netserverslist.h" - -HWNetServersModel::HWNetServersModel(QObject* parent) : - QAbstractTableModel(parent) -{ - -} - -void HWNetServersModel::updateList() -{ - -} - -QVariant HWNetServersModel::headerData(int section, - Qt::Orientation orientation, int role) const -{ - if (role != Qt::DisplayRole) - return QVariant(); - - if (orientation == Qt::Horizontal) - { - switch (section) - { - case 0: return tr("Title"); - case 1: return tr("IP"); - case 2: return tr("Port"); - default: return QVariant(); - } - } else - return QString("%1").arg(section + 1); -} - -int HWNetServersModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - else - return games.size(); -} - -int HWNetServersModel::columnCount(const QModelIndex & parent) const -{ - if (parent.isValid()) - return 0; - else - return 3; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netserverslist.h --- a/QTfrontend/netserverslist.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _NET_SERVERSLIST_INCLUDED -#define _NET_SERVERSLIST_INCLUDED - -#include -#include - -class HWNetServersModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - HWNetServersModel(QObject *parent = 0); - - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - int rowCount(const QModelIndex & parent) const; - int columnCount(const QModelIndex & parent) const; - -public slots: - virtual void updateList(); - -protected: - QList games; -}; - -#endif // _NET_SERVERSLIST_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netudpserver.cpp --- a/QTfrontend/netudpserver.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include - -#include "netudpserver.h" - -HWNetUdpServer::HWNetUdpServer(QObject *parent, const QString & descr, quint16 port) : - HWNetRegisterServer(parent, descr, port), - m_descr(descr) -{ - pUdpSocket = new QUdpSocket(this); - pUdpSocket->bind(46631); - connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead())); -} - -void HWNetUdpServer::onClientRead() -{ - while (pUdpSocket->hasPendingDatagrams()) { - QByteArray datagram; - datagram.resize(pUdpSocket->pendingDatagramSize()); - QHostAddress clientAddr; - quint16 clientPort; - pUdpSocket->readDatagram(datagram.data(), datagram.size(), &clientAddr, &clientPort); - if(datagram.startsWith("hedgewars client")) { - // send answer to client - pUdpSocket->writeDatagram(QString("hedgewars server\n%1").arg(m_descr).toUtf8(), clientAddr, clientPort); - } - } -} - -void HWNetUdpServer::unregister() -{ - deleteLater(); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netudpserver.h --- a/QTfrontend/netudpserver.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _NET_UDPSERVER_INCLUDED -#define _NET_UDPSERVER_INCLUDED - -#include -#include "netregister.h" - -class QUdpSocket; - -class HWNetUdpServer : public HWNetRegisterServer -{ - Q_OBJECT - - public: - HWNetUdpServer(QObject *parent, const QString & descr, quint16 port); - - public slots: - void unregister(); - - private slots: - void onClientRead(); - - private: - QUdpSocket* pUdpSocket; - QString m_descr; -}; - -#endif // _NET_UDPSERVER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netudpwidget.cpp --- a/QTfrontend/netudpwidget.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include - -#include "netudpwidget.h" - -HWNetUdpModel::HWNetUdpModel(QObject* parent) : - HWNetServersModel(parent) -{ - pUdpSocket = new QUdpSocket(this); - - pUdpSocket->bind(); - connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead())); -} - -void HWNetUdpModel::updateList() -{ - games.clear(); - - reset(); - - pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631); -} - -void HWNetUdpModel::onClientRead() -{ - while (pUdpSocket->hasPendingDatagrams()) { - QByteArray datagram; - datagram.resize(pUdpSocket->pendingDatagramSize()); - QHostAddress clientAddr; - quint16 clientPort; - - pUdpSocket->readDatagram(datagram.data(), datagram.size(), &clientAddr, &clientPort); - - QString packet = QString::fromUtf8(datagram.data()); - if(packet.startsWith("hedgewars server")) { - QStringList sl; - sl << packet.remove(0, 17) << clientAddr.toString() << "46631"; - games.append(sl); - } - } - - reset(); -} - -QVariant HWNetUdpModel::data(const QModelIndex &index, - int role) const -{ - if (!index.isValid() || index.row() < 0 - || index.row() >= games.size() - || role != Qt::DisplayRole) - return QVariant(); - - return games[index.row()][index.column()]; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/netudpwidget.h --- a/QTfrontend/netudpwidget.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _NET_UDPWIDGET_INCLUDED -#define _NET_UDPWIDGET_INCLUDED - -#include "netserverslist.h" - -class QUdpSocket; - -class HWNetUdpModel : public HWNetServersModel -{ - Q_OBJECT - -public: - HWNetUdpModel(QObject *parent = 0); - - QVariant data(const QModelIndex &index, int role) const; - -public slots: - void updateList(); - -private slots: - void onClientRead(); - -private: - QUdpSocket* pUdpSocket; -}; - -#endif // _NET_UDPWIDGET_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/newnetclient.cpp --- a/QTfrontend/newnetclient.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,797 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include - -#include "hwconsts.h" -#include "newnetclient.h" -#include "proto.h" -#include "game.h" -#include "misc.h" -/* only to get the ignoreList from the chat widget */ -#include "hwform.h" -#include "pageroomslist.h" -#include "chatwidget.h" - -char delimeter='\n'; - -HWNewNet::HWNewNet() : - isChief(false), - m_game_connected(false), - loginStep(0), - netClientState(0) -{ -// socket stuff - connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); - connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect())); - connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect())); - connect(&NetSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, - SLOT(displayError(QAbstractSocket::SocketError))); -} - -HWNewNet::~HWNewNet() -{ - if (m_game_connected) - { - RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit")); - emit Disconnected(tr("User quit")); - } - NetSocket.flush(); -} - -void HWNewNet::Connect(const QString & hostName, quint16 port, const QString & nick) -{ - mynick = nick; - myhost = hostName + QString(":%1").arg(port); - NetSocket.connectToHost(hostName, port); -} - -void HWNewNet::Disconnect() -{ - if (m_game_connected) - RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit")); - m_game_connected = false; - - NetSocket.disconnectFromHost(); -} - -void HWNewNet::CreateRoom(const QString & room) -{ - if(netClientState != 2) - { - qWarning("Illegal try to create room!"); - return; - } - - myroom = room; - - RawSendNet(QString("CREATE_ROOM%1%2").arg(delimeter).arg(room)); - isChief = true; -} - -void HWNewNet::JoinRoom(const QString & room) -{ - if(netClientState != 2) - { - qWarning("Illegal try to join room!"); - return; - } - - myroom = room; - - RawSendNet(QString("JOIN_ROOM%1%2").arg(delimeter).arg(room)); - isChief = false; -} - -void HWNewNet::AddTeam(const HWTeam & team) -{ - QString cmd = QString("ADD_TEAM") + delimeter + - team.name() + delimeter + - team.color().name() + delimeter + - team.grave() + delimeter + - team.fort() + delimeter + - team.voicepack() + delimeter + - team.flag() + delimeter + - QString::number(team.difficulty()); - - for(unsigned int i = 0; i < HEDGEHOGS_PER_TEAM; ++i) - { - cmd.append(delimeter); - cmd.append(team.hedgehog(i).Name); - cmd.append(delimeter); - cmd.append(team.hedgehog(i).Hat); - } - RawSendNet(cmd); -} - -void HWNewNet::RemoveTeam(const HWTeam & team) -{ - RawSendNet(QString("REMOVE_TEAM") + delimeter + team.name()); -} - -void HWNewNet::NewNick(const QString & nick) -{ - RawSendNet(QString("NICK%1%2").arg(delimeter).arg(nick)); -} - -void HWNewNet::ToggleReady() -{ - RawSendNet(QString("TOGGLE_READY")); -} - -void HWNewNet::SendNet(const QByteArray & buf) -{ - QString msg = QString(buf.toBase64()); - - RawSendNet(QString("EM%1%2").arg(delimeter).arg(msg)); -} - -void HWNewNet::RawSendNet(const QString & str) -{ - RawSendNet(str.toUtf8()); -} - -void HWNewNet::RawSendNet(const QByteArray & buf) -{ - qDebug() << "Client: " << QString(buf).split("\n"); - NetSocket.write(buf); - NetSocket.write("\n\n", 2); -} - -void HWNewNet::ClientRead() -{ - while (NetSocket.canReadLine()) { - QString s = QString::fromUtf8(NetSocket.readLine()); - if (s.endsWith('\n')) s.chop(1); - - if (s.size() == 0) { - ParseCmd(cmdbuf); - cmdbuf.clear(); - } else - cmdbuf << s; - } -} - -void HWNewNet::OnConnect() -{ -} - -void HWNewNet::OnDisconnect() -{ - if(m_game_connected) emit Disconnected(""); - m_game_connected = false; -} - -void HWNewNet::displayError(QAbstractSocket::SocketError socketError) -{ - m_game_connected = false; - - switch (socketError) { - case QAbstractSocket::RemoteHostClosedError: - break; - case QAbstractSocket::HostNotFoundError: - emit Disconnected(tr("The host was not found. Please check the host name and port settings.")); - break; - case QAbstractSocket::ConnectionRefusedError: - emit Disconnected(tr("Connection refused")); - break; - default: - emit Disconnected(NetSocket.errorString()); - } -} - -void HWNewNet::SendPasswordHash(const QString & hash) -{ - RawSendNet(QString("PASSWORD%1%2").arg(delimeter).arg(hash)); -} - -void HWNewNet::ParseCmd(const QStringList & lst) -{ - qDebug() << "Server: " << lst; - - if(!lst.size()) - { - qWarning("Net client: Bad message"); - return; - } - - if (lst[0] == "NICK") - { - mynick = lst[1]; - return ; - } - - if (lst[0] == "PROTO") - return ; - - if (lst[0] == "ERROR") { - if (lst.size() == 2) - emit Error(lst[1]); - else - emit Error("Unknown error"); - return; - } - - if (lst[0] == "WARNING") { - if (lst.size() == 2) - emit Warning(lst[1]); - else - emit Warning("Unknown warning"); - return; - } - - if (lst[0] == "CONNECTED") { - if(lst.size() < 3 || lst[2].toInt() < cMinServerVersion) - { - // TODO: Warn user, disconnect - qWarning() << "Server too old"; - } - - RawSendNet(QString("NICK%1%2").arg(delimeter).arg(mynick)); - RawSendNet(QString("PROTO%1%2").arg(delimeter).arg(*cProtoVer)); - netClientState = 1; - m_game_connected = true; - emit adminAccess(false); - return; - } - - if (lst[0] == "PING") { - if (lst.size() > 1) - RawSendNet(QString("PONG%1%2").arg(delimeter).arg(lst[1])); - else - RawSendNet(QString("PONG")); - return; - } - - if (lst[0] == "ROOMS") { - QStringList tmp = lst; - tmp.removeFirst(); - emit roomsList(tmp); - return; - } - - if (lst[0] == "SERVER_MESSAGE") { - if(lst.size() < 2) - { - qWarning("Net: Empty SERVERMESSAGE message"); - return; - } - emit serverMessage(lst[1]); - return; - } - - if (lst[0] == "CHAT") { - if(lst.size() < 3) - { - qWarning("Net: Empty CHAT message"); - return; - } - if (netClientState == 2) - emit chatStringLobby(lst[1], HWProto::formatChatMsgForFrontend(lst[2])); - else - emit chatStringFromNet(HWProto::formatChatMsg(lst[1], lst[2])); - return; - } - - if (lst[0] == "INFO") { - if(lst.size() < 5) - { - qWarning("Net: Malformed INFO message"); - return; - } - QStringList tmp = lst; - tmp.removeFirst(); - if (netClientState == 2) - emit chatStringLobby(tmp.join("\n").prepend('\x01')); - else - emit chatStringFromNet(tmp.join("\n").prepend('\x01')); - return; - } - - if (lst[0] == "SERVER_VARS") { - QStringList tmp = lst; - tmp.removeFirst(); - while (tmp.size() >= 2) - { - if(tmp[0] == "MOTD_NEW") emit serverMessageNew(tmp[1]); - else if(tmp[0] == "MOTD_OLD") emit serverMessageOld(tmp[1]); - else if(tmp[0] == "LATEST_PROTO") emit latestProtocolVar(tmp[1].toInt()); - - tmp.removeFirst(); - tmp.removeFirst(); - } - return; - } - - if (lst[0] == "CLIENT_FLAGS") - { - if(lst.size() < 3 || lst[1].size() < 2) - { - qWarning("Net: Malformed CLIENT_FLAGS message"); - return; - } - - QString flags = lst[1]; - bool setFlag = flags[0] == '+'; - - while(flags.size() > 1) - { - flags.remove(0, 1); - char c = flags[0].toAscii(); - - switch(c) - { - case 'r': - { - for(int i = 2; i < lst.size(); ++i) - { - if (lst[i] == mynick) - emit setMyReadyStatus(setFlag); - emit setReadyStatus(lst[i], setFlag); - } - } - } - } - - return; - } - - if (lst[0] == "ADD_TEAM") { - if(lst.size() != 24) - { - qWarning("Net: Bad ADDTEAM message"); - return; - } - QStringList tmp = lst; - tmp.removeFirst(); - emit AddNetTeam(tmp); - return; - } - - if (lst[0] == "REMOVE_TEAM") { - if(lst.size() != 2) - { - qWarning("Net: Bad REMOVETEAM message"); - return; - } - emit RemoveNetTeam(HWTeam(lst[1])); - return; - } - - if(lst[0] == "ROOMABANDONED") { - netClientState = 2; - emit LeftRoom(tr("Room destroyed")); - return; - } - - if(lst[0] == "KICKED") { - netClientState = 2; - emit LeftRoom(tr("You got kicked")); - return; - } - - if(lst[0] == "JOINED") { - if(lst.size() < 2) - { - qWarning("Net: Bad JOINED message"); - return; - } - - for(int i = 1; i < lst.size(); ++i) - { - if (lst[i] == mynick) - { - netClientState = 3; - emit EnteredGame(); - emit roomMaster(isChief); - if (isChief) - emit configAsked(); - } - // TODO reactivate -/* - if (lst[i] != mynick && isChief && config->Form->ui.pageRoomsList->chatWidget->ignoreList.contains(lst[i], Qt::CaseInsensitive) && !config->Form->ui.pageRoomsList->chatWidget->friendsList.contains(lst[i], Qt::CaseInsensitive)) - { - kickPlayer(lst[i]); - } - else -*/ - { - emit nickAdded(lst[i], isChief && (lst[i] != mynick)); - emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i])); - } - } - return; - } - - if(lst[0] == "LOBBY:JOINED") { - if(lst.size() < 2) - { - qWarning("Net: Bad JOINED message"); - return; - } - - for(int i = 1; i < lst.size(); ++i) - { - if (lst[i] == mynick) - { - netClientState = 2; - RawSendNet(QString("LIST")); - emit Connected(); - } - - emit nickAddedLobby(lst[i], false); - emit chatStringLobby(lst[i], tr("%1 *** %2 has joined").arg('\x03').arg("|nick|")); - } - return; - } - - if(lst[0] == "LEFT") { - if(lst.size() < 2) - { - qWarning("Net: Bad LEFT message"); - return; - } - emit nickRemoved(lst[1]); - if (lst.size() < 3) - emit chatStringFromNet(tr("%1 *** %2 has left").arg('\x03').arg(lst[1])); - else - emit chatStringFromNet(tr("%1 *** %2 has left (%3)").arg('\x03').arg(lst[1], lst[2])); - return; - } - - if(lst[0] == "ROOM") { - if(lst.size() < 2) - { - qWarning("Net: Bad ROOM message"); - return; - } - RawSendNet(QString("LIST")); - return; - } - - if(lst[0] == "LOBBY:LEFT") { - if(lst.size() < 2) - { - qWarning("Net: Bad LOBBY:LEFT message"); - return; - } - emit nickRemovedLobby(lst[1]); - if (lst.size() < 3) - emit chatStringLobby(tr("%1 *** %2 has left").arg('\x03').arg(lst[1])); - else - emit chatStringLobby(tr("%1 *** %2 has left (%3)").arg('\x03').arg(lst[1], lst[2])); - return; - } - - if (lst[0] == "RUN_GAME") { - netClientState = 5; - emit AskForRunGame(); - return; - } - - if (lst[0] == "ASKPASSWORD") { - emit AskForPassword(mynick); - return; - } - - if (lst[0] == "NOTICE") { - if(lst.size() < 2) - { - qWarning("Net: Bad NOTICE message"); - return; - } - - bool ok; - int n = lst[1].toInt(&ok); - if(!ok) - { - qWarning("Net: Bad NOTICE message"); - return; - } - - handleNotice(n); - - return; - } - - if (lst[0] == "TEAM_ACCEPTED") { - if (lst.size() != 2) - { - qWarning("Net: Bad TEAM_ACCEPTED message"); - return; - } - emit TeamAccepted(lst[1]); - return; - } - - - if (lst[0] == "CFG") { - if(lst.size() < 3) - { - qWarning("Net: Bad CFG message"); - return; - } - QStringList tmp = lst; - tmp.removeFirst(); - tmp.removeFirst(); - if (lst[1] == "SCHEME") - emit netSchemeConfig(tmp); - else - emit paramChanged(lst[1], tmp); - return; - } - - if (lst[0] == "HH_NUM") { - if (lst.size() != 3) - { - qWarning("Net: Bad TEAM_ACCEPTED message"); - return; - } - HWTeam tmptm(lst[1]); - tmptm.setNumHedgehogs(lst[2].toUInt()); - emit hhnumChanged(tmptm); - return; - } - - if (lst[0] == "TEAM_COLOR") { - if (lst.size() != 3) - { - qWarning("Net: Bad TEAM_COLOR message"); - return; - } - HWTeam tmptm(lst[1]); - tmptm.setColor(QColor(lst[2])); - emit teamColorChanged(tmptm); - return; - } - - if (lst[0] == "EM") { - if(lst.size() < 2) - { - qWarning("Net: Bad EM message"); - return; - } - for(int i = 1; i < lst.size(); ++i) - { - QByteArray em = QByteArray::fromBase64(lst[i].toAscii()); - emit FromNet(em); - } - return; - } - - if (lst[0] == "BYE") { - if (lst.size() < 2) - { - qWarning("Net: Bad BYE message"); - return; - } - if (lst[1] == "Authentication failed") - { - emit AuthFailed(); - } - m_game_connected = false; - Disconnect(); - emit Disconnected(lst[1]); - return; - } - - - if (lst[0] == "ADMIN_ACCESS") { - emit adminAccess(true); - return; - } - - if (lst[0] == "ROOM_CONTROL_ACCESS") { - if (lst.size() < 2) - { - qWarning("Net: Bad ROOM_CONTROL_ACCESS message"); - return; - } - isChief = (lst[1] != "0"); - emit roomMaster(isChief); - return; - } - - qWarning() << "Net: Unknown message:" << lst; -} - -void HWNewNet::onHedgehogsNumChanged(const HWTeam& team) -{ - if (isChief) - RawSendNet(QString("HH_NUM%1%2%1%3") - .arg(delimeter) - .arg(team.name()) - .arg(team.numHedgehogs())); -} - -void HWNewNet::onTeamColorChanged(const HWTeam& team) -{ - if (isChief) - RawSendNet(QString("TEAM_COLOR%1%2%1%3") - .arg(delimeter) - .arg(team.name()) - .arg(team.color().name())); -} - -void HWNewNet::onParamChanged(const QString & param, const QStringList & value) -{ - if (isChief) - RawSendNet( - QString("CFG%1%2%1%3") - .arg(delimeter) - .arg(param) - .arg(value.join(QString(delimeter))) - ); -} - -void HWNewNet::chatLineToNet(const QString& str) -{ - if(str != "") { - RawSendNet(QString("CHAT") + delimeter + str); - emit(chatStringFromMe(HWProto::formatChatMsg(mynick, str))); - } -} - -void HWNewNet::chatLineToLobby(const QString& str) -{ - if(str != "") { - RawSendNet(QString("CHAT") + delimeter + str); - emit(chatStringFromMeLobby(HWProto::formatChatMsg(mynick, str))); - } -} - -void HWNewNet::SendTeamMessage(const QString& str) -{ - RawSendNet(QString("TEAMCHAT") + delimeter + str); -} - -void HWNewNet::askRoomsList() -{ - if(netClientState != 2) - { - qWarning("Illegal try to get rooms list!"); - return; - } - RawSendNet(QString("LIST")); -} - -int HWNewNet::getClientState() -{ - return netClientState; -} - -QString HWNewNet::getNick() -{ - return mynick; -} - -QString HWNewNet::getRoom() -{ - return myroom; -} - -QString HWNewNet::getHost() -{ - return myhost; -} - -bool HWNewNet::isRoomChief() -{ - return isChief; -} - -void HWNewNet::gameFinished(bool correctly) -{ - if (netClientState == 5) netClientState = 3; - RawSendNet(QString("ROUNDFINISHED%1%2").arg(delimeter).arg(correctly ? "1" : "0")); -} - -void HWNewNet::banPlayer(const QString & nick) -{ - RawSendNet(QString("BAN%1%2").arg(delimeter).arg(nick)); -} - -void HWNewNet::kickPlayer(const QString & nick) -{ - RawSendNet(QString("KICK%1%2").arg(delimeter).arg(nick)); -} - -void HWNewNet::infoPlayer(const QString & nick) -{ - RawSendNet(QString("INFO%1%2").arg(delimeter).arg(nick)); -} - -void HWNewNet::followPlayer(const QString & nick) -{ - if (!isInRoom()) { - RawSendNet(QString("FOLLOW%1%2").arg(delimeter).arg(nick)); - isChief = false; - } -} - -void HWNewNet::startGame() -{ - RawSendNet(QString("START_GAME")); -} - -void HWNewNet::updateRoomName(const QString & name) -{ - RawSendNet(QString("ROOM_NAME%1%2").arg(delimeter).arg(name)); -} - - -void HWNewNet::toggleRestrictJoins() -{ - RawSendNet(QString("TOGGLE_RESTRICT_JOINS")); -} - -void HWNewNet::toggleRestrictTeamAdds() -{ - RawSendNet(QString("TOGGLE_RESTRICT_TEAMS")); -} - -void HWNewNet::clearAccountsCache() -{ - RawSendNet(QString("CLEAR_ACCOUNTS_CACHE")); -} - -void HWNewNet::partRoom() -{ - netClientState = 2; - RawSendNet(QString("PART")); -} - -bool HWNewNet::isInRoom() -{ - return netClientState > 2; -} - -void HWNewNet::setServerMessageNew(const QString & msg) -{ - RawSendNet(QString("SET_SERVER_VAR%1MOTD_NEW%1%2").arg(delimeter).arg(msg)); -} - -void HWNewNet::setServerMessageOld(const QString & msg) -{ - RawSendNet(QString("SET_SERVER_VAR%1MOTD_OLD%1%2").arg(delimeter).arg(msg)); -} - -void HWNewNet::setLatestProtocolVar(int proto) -{ - RawSendNet(QString("SET_SERVER_VAR%1LATEST_PROTO%1%2").arg(delimeter).arg(proto)); -} - -void HWNewNet::askServerVars() -{ - RawSendNet(QString("GET_SERVER_VAR")); -} - -void HWNewNet::handleNotice(int n) -{ - switch(n) - { - case 0: - { - emit NickTaken(mynick); - break; - } - } -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/newnetclient.h --- a/QTfrontend/newnetclient.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _NEW_NETCLIENT_INCLUDED -#define _NEW_NETCLIENT_INCLUDED - -#include -#include -#include -#include - -#include "team.h" -#include "game.h" // for GameState - -class GameUIConfig; -class GameCFGWidget; -class TeamSelWidget; - -extern char delimeter; - -class HWNewNet : public QObject -{ - Q_OBJECT - - public: - HWNewNet(); - ~HWNewNet(); - void Connect(const QString & hostName, quint16 port, const QString & nick); - void Disconnect(); - void SendPasswordHash(const QString & hash); - void NewNick(const QString & nick); - bool isRoomChief(); - bool isInRoom(); - int getClientState(); - QString getNick(); - QString getRoom(); - QString getHost(); - - private: - bool isChief; - QString mynick; - QString myroom; - QString myhost; - QTcpSocket NetSocket; - QString seed; - bool m_game_connected; - - template - void SendCfgStrNet(T a) { - QByteArray strmsg; - strmsg.append(a); - quint8 sz = strmsg.size(); - QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg; - QString _msg = delimeter + QString(enginemsg.toBase64()); - RawSendNet(_msg); - } - - template - void SendCfgStrLoc(T a) { - QByteArray strmsg; - strmsg.append(QString(a).toUtf8()); - quint8 sz = strmsg.size(); - QByteArray enginemsg = QByteArray((char *)&sz, 1) + strmsg; - emit FromNet(enginemsg); - } - - QStringList cmdbuf; - - void RawSendNet(const QString & buf); - void RawSendNet(const QByteArray & buf); - void ParseCmd(const QStringList & lst); - void handleNotice(int n); - - int loginStep; - int netClientState; - - signals: - void AskForRunGame(); - void Connected(); - void Disconnected(const QString & reason); - void Error(const QString & errmsg); - void Warning(const QString & wrnmsg); - void AskForPassword(const QString & nick); - void NickTaken(const QString & nick); - void AuthFailed(); - void EnteredGame(); - void LeftRoom(const QString & reason); - void nickAdded(const QString& nick, bool notifyNick); - void nickRemoved(const QString& nick); - void nickAddedLobby(const QString& nick, bool notifyNick); - void nickRemovedLobby(const QString& nick); - void FromNet(const QByteArray & buf); - void adminAccess(bool); - void roomMaster(bool); - - void netSchemeConfig(QStringList &); - void paramChanged(const QString & param, const QStringList & value); - void configAsked(); - - void TeamAccepted(const QString&); - void AddNetTeam(const HWTeam&); - void RemoveNetTeam(const HWTeam&); - void hhnumChanged(const HWTeam&); - void teamColorChanged(const HWTeam&); - void chatStringLobby(const QString&); - void chatStringLobby(const QString&, const QString&); - void chatStringFromNet(const QString&); - void chatStringFromMe(const QString&); - void chatStringFromMeLobby(const QString&); - - void roomsList(const QStringList&); - void serverMessage(const QString &); - void serverMessageNew(const QString &); - void serverMessageOld(const QString &); - void latestProtocolVar(int); - - void setReadyStatus(const QString & nick, bool isReady); - void setMyReadyStatus(bool isReady); - - public slots: - void ToggleReady(); - void chatLineToNet(const QString& str); - void chatLineToLobby(const QString& str); - void SendTeamMessage(const QString& str); - void SendNet(const QByteArray & buf); - void AddTeam(const HWTeam & team); - void RemoveTeam(const HWTeam& team); - void onHedgehogsNumChanged(const HWTeam& team); - void onTeamColorChanged(const HWTeam& team); - void onParamChanged(const QString & param, const QStringList & value); - - void setServerMessageNew(const QString &); - void setServerMessageOld(const QString &); - void setLatestProtocolVar(int proto); - void askServerVars(); - - void JoinRoom(const QString & room); - void CreateRoom(const QString & room); - void updateRoomName(const QString &); - void askRoomsList(); - void gameFinished(bool correcly); - void banPlayer(const QString &); - void kickPlayer(const QString &); - void infoPlayer(const QString &); - void followPlayer(const QString &); - void startGame(); - void toggleRestrictJoins(); - void toggleRestrictTeamAdds(); - void partRoom(); - void clearAccountsCache(); - - private slots: - void ClientRead(); - void OnConnect(); - void OnDisconnect(); - void displayError(QAbstractSocket::SocketError socketError); -}; - -#endif // _NEW_NETCLIENT_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageadmin.cpp --- a/QTfrontend/pageadmin.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include - -#include "pageadmin.h" -#include "chatwidget.h" - -PageAdmin::PageAdmin(QWidget* parent) : - AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - - // 0 - pbAsk = addButton(tr("Fetch data"), pageLayout, 0, 0, 1, 3); - connect(pbAsk, SIGNAL(clicked()), this, SIGNAL(askServerVars())); - - // 1 - QLabel * lblSMN = new QLabel(this); - lblSMN->setText(tr("Server message for latest version:")); - pageLayout->addWidget(lblSMN, 1, 0); - - leServerMessageNew = new QLineEdit(this); - pageLayout->addWidget(leServerMessageNew, 1, 1); - - // 2 - QLabel * lblSMO = new QLabel(this); - lblSMO->setText(tr("Server message for previous versions:")); - pageLayout->addWidget(lblSMO, 2, 0); - - leServerMessageOld = new QLineEdit(this); - pageLayout->addWidget(leServerMessageOld, 2, 1); - - // 3 - QLabel * lblP = new QLabel(this); - lblP->setText(tr("Latest version protocol number:")); - pageLayout->addWidget(lblP, 3, 0); - - sbProtocol = new QSpinBox(this); - pageLayout->addWidget(sbProtocol, 3, 1); - - // 4 - QLabel * lblPreview = new QLabel(this); - lblPreview->setText(tr("MOTD preview:")); - pageLayout->addWidget(lblPreview, 4, 0); - - tb = new QTextBrowser(this); - tb->setOpenExternalLinks(true); - tb->document()->setDefaultStyleSheet(HWChatWidget::STYLE); - pageLayout->addWidget(tb, 4, 1, 1, 2); - connect(leServerMessageNew, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &))); - connect(leServerMessageOld, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &))); - - // 5 - pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 5, 0); - connect(pbClearAccountsCache, SIGNAL(clicked()), this, SIGNAL(clearAccountsCache())); - - // 6 - pbSetSM = addButton(tr("Set data"), pageLayout, 6, 0, 1, 3); - connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged())); - - - // 7 - BtnBack = addButton(":/res/Exit.png", pageLayout, 7, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); -} - -void PageAdmin::smChanged() -{ - emit setServerMessageNew(leServerMessageNew->text()); - emit setServerMessageOld(leServerMessageOld->text()); - emit setProtocol(sbProtocol->value()); -} - -void PageAdmin::serverMessageNew(const QString & str) -{ - leServerMessageNew->setText(str); -} - -void PageAdmin::serverMessageOld(const QString & str) -{ - leServerMessageOld->setText(str); -} -void PageAdmin::protocol(int proto) -{ - sbProtocol->setValue(proto); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageadmin.h --- a/QTfrontend/pageadmin.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_ADMIN_H -#define PAGE_ADMIN_H - -#include "AbstractPage.h" - -class PageAdmin : public AbstractPage -{ - Q_OBJECT - -public: - PageAdmin(QWidget* parent = 0); - -private: - QLineEdit * leServerMessageNew; - QLineEdit * leServerMessageOld; - QPushButton * pbSetSM; - QPushButton * pbAsk; - QSpinBox * sbProtocol; - QTextBrowser * tb; - QPushButton * BtnBack; - QPushButton * pbClearAccountsCache; - -private slots: - void smChanged(); - -public slots: - void serverMessageNew(const QString & str); - void serverMessageOld(const QString & str); - void protocol(int proto); - -signals: - void setServerMessageNew(const QString & str); - void setServerMessageOld(const QString & str); - void setProtocol(int proto); - void askServerVars(); - void clearAccountsCache(); -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagecampaign.cpp --- a/QTfrontend/pagecampaign.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include - -#include "pagecampaign.h" - -PageCampaign::PageCampaign(QWidget* parent) : AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setColumnStretch(0, 1); - pageLayout->setColumnStretch(1, 2); - pageLayout->setColumnStretch(2, 1); - pageLayout->setRowStretch(0, 1); - pageLayout->setRowStretch(3, 1); - - CBSelect = new QComboBox(this); - CBTeam = new QComboBox(this); - - pageLayout->addWidget(CBTeam, 1, 1); - pageLayout->addWidget(CBSelect, 2, 1); - - BtnStartCampaign = new QPushButton(this); - BtnStartCampaign->setFont(*font14); - BtnStartCampaign->setText(QPushButton::tr("Go!")); - pageLayout->addWidget(BtnStartCampaign, 2, 2); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagecampaign.h --- a/QTfrontend/pagecampaign.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_CAMPAIGN_H -#define PAGE_CAMPAIGN_H - -#include "AbstractPage.h" - -class PageCampaign : public AbstractPage -{ - Q_OBJECT - -public: - PageCampaign(QWidget* parent = 0); - - QPushButton *BtnStartCampaign; - QComboBox *CBSelect; - QComboBox *CBTeam; - -private: - QPushButton *BtnBack; -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageconnecting.cpp --- a/QTfrontend/pageconnecting.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pageconnecting.h" - -PageConnecting::PageConnecting(QWidget* parent) : - AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - - QLabel * lblConnecting = new QLabel(this); - lblConnecting->setText(tr("Connecting...")); - pageLayout->addWidget(lblConnecting); - - QPushButton * pbCancel = new QPushButton(this); - pbCancel->setText(tr("Cancel")); - pageLayout->addWidget(pbCancel); - connect(pbCancel, SIGNAL(clicked()), this, SIGNAL(cancelConnection())); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageconnecting.h --- a/QTfrontend/pageconnecting.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_CONNECTING_H -#define PAGE_CONNECTING_H - -#include "AbstractPage.h" - -class PageConnecting : public AbstractPage -{ - Q_OBJECT - -public: - PageConnecting(QWidget* parent = 0); - -signals: - void cancelConnection(); -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagedata.cpp --- a/QTfrontend/pagedata.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pagedata.h" -#include "databrowser.h" -#include "hwconsts.h" - -#include "quazip.h" -#include "quazipfile.h" - -PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setColumnStretch(0, 1); - pageLayout->setColumnStretch(1, 1); - pageLayout->setColumnStretch(2, 1); - - - web = new DataBrowser(this); - connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&))); - web->setOpenLinks(false); - pageLayout->addWidget(web, 0, 0, 1, 3); - - progressBarsLayout = new QVBoxLayout(); - pageLayout->addLayout(progressBarsLayout, 1, 0, 1, 3); - - fetchList(); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); -} - -void PageDataDownload::request(const QUrl &url) -{ - QUrl finalUrl; - if(url.host().isEmpty()) - finalUrl = QUrl("http://www.hedgewars.org" + url.path()); - else - finalUrl = url; - - if(url.path().endsWith(".zip")) - { - qWarning() << "Download Request" << url.toString(); - QString fileName = QFileInfo(url.toString()).fileName(); - - QNetworkRequest newRequest(finalUrl); - newRequest.setAttribute(QNetworkRequest::User, fileName); - - QNetworkAccessManager *manager = new QNetworkAccessManager(this); - QNetworkReply *reply = manager->get(newRequest); - connect(reply, SIGNAL(finished()), this, SLOT(fileDownloaded())); - connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64))); - - QProgressBar *progressBar = new QProgressBar(this); - progressBarsLayout->addWidget(progressBar); - progressBars.insert(reply, progressBar); - } else - { - qWarning() << "Page Request" << url.toString(); - - QNetworkRequest newRequest(finalUrl); - - QNetworkAccessManager *manager = new QNetworkAccessManager(this); - QNetworkReply *reply = manager->get(newRequest); - connect(reply, SIGNAL(finished()), this, SLOT(pageDownloaded())); - } -} - - -void PageDataDownload::pageDownloaded() -{ - QNetworkReply * reply = qobject_cast(sender()); - - if(reply) - { - QString html = QString::fromUtf8(reply->readAll()); - int begin = html.indexOf(""); - int end = html.indexOf(""); - if(begin != -1 && begin < end) - { - html.truncate(end); - html.remove(0, begin); - } - web->setHtml(html); - } -} - -void PageDataDownload::fileDownloaded() -{ - QNetworkReply * reply = qobject_cast(sender()); - - if(reply) - { - QByteArray fileContents = reply->readAll(); - QProgressBar *progressBar = progressBars.value(reply, 0); - - if(progressBar) - { - progressBars.remove(reply); - progressBar->deleteLater(); - } - - extractDataPack(&fileContents); - } -} - -void PageDataDownload::downloadProgress(qint64 bytesRecieved, qint64 bytesTotal) -{ - QNetworkReply * reply = qobject_cast(sender()); - - if(reply) - { - QProgressBar *progressBar = progressBars.value(reply, 0); - - if(progressBar) - { - progressBar->setValue(bytesRecieved); - progressBar->setMaximum(bytesTotal); - } - } -} - -void PageDataDownload::fetchList() -{ - request(QUrl("http://hedgewars.org/content.html")); -} - -bool PageDataDownload::extractDataPack(QByteArray * buf) -{ - QBuffer buffer; - buffer.setBuffer(buf); - - QuaZip zip; - zip.setIoDevice(&buffer); - if(!zip.open(QuaZip::mdUnzip)) - { - qWarning("testRead(): zip.open(): %d", zip.getZipError()); - return false; - } - - QuaZipFile file(&zip); - - QDir extractDir(*cfgdir); - extractDir.cd("Data"); - - for(bool more = zip.goToFirstFile(); more; more = zip.goToNextFile()) - { - if(!file.open(QIODevice::ReadOnly)) - { - qWarning("file.open(): %d", file.getZipError()); - return false; - } - - - QString fileName = file.getActualFileName(); - QString filePath = extractDir.filePath(fileName); - if (fileName.endsWith("/")) - { - QFileInfo fi(filePath); - QDir().mkpath(fi.filePath()); - } else - { - qDebug() << "Extracting" << filePath; - QFile out(filePath); - if(!out.open(QFile::WriteOnly)) - { - qWarning() << "out.open():" << out.errorString(); - return false; - } - - out.write(file.readAll()); - - out.close(); - - if(file.getZipError() != UNZ_OK) { - qWarning("file.getFileName(): %d", file.getZipError()); - return false; - } - - if(!file.atEnd()) { - qWarning("read all but not EOF"); - return false; - } - } - - file.close(); - - if(file.getZipError()!=UNZ_OK) { - qWarning("file.close(): %d", file.getZipError()); - return false; - } - } - - zip.close(); - - return true; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagedata.h --- a/QTfrontend/pagedata.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_DATA_H -#define PAGE_DATA_H - -#include -#include "AbstractPage.h" - -class DataBrowser; -class QProgressBar; -class QNetworkReply; -class QVBoxLayout; - -class PageDataDownload : public AbstractPage -{ - Q_OBJECT - -public: - PageDataDownload(QWidget* parent = 0); - -public slots: - void fetchList(); - -private: - QPushButton *BtnBack; - DataBrowser *web; - QHash progressBars; - QVBoxLayout *progressBarsLayout; - - bool extractDataPack(QByteArray * buf); - -private slots: - void request(const QUrl &url); - - void pageDownloaded(); - void fileDownloaded(); - void downloadProgress(qint64, qint64); -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagedrawmap.cpp --- a/QTfrontend/pagedrawmap.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include - -#include "pagedrawmap.h" -#include "drawmapwidget.h" - -PageDrawMap::PageDrawMap(QWidget* parent) : AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - - QPushButton * pbUndo = addButton(tr("Undo"), pageLayout, 0, 0); - QPushButton * pbClear = addButton(tr("Clear"), pageLayout, 1, 0); - QPushButton * pbLoad = addButton(tr("Load"), pageLayout, 2, 0); - QPushButton * pbSave = addButton(tr("Save"), pageLayout, 3, 0); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - drawMapWidget = new DrawMapWidget(this); - pageLayout->addWidget(drawMapWidget, 0, 1, 5, 1); - - connect(pbUndo, SIGNAL(clicked()), drawMapWidget, SLOT(undo())); - connect(pbClear, SIGNAL(clicked()), drawMapWidget, SLOT(clear())); - connect(pbLoad, SIGNAL(clicked()), this, SLOT(load())); - connect(pbSave, SIGNAL(clicked()), this, SLOT(save())); -} - -void PageDrawMap::load() -{ - QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)"); - - if(!fileName.isEmpty()) - drawMapWidget->load(fileName); -} - -void PageDrawMap::save() -{ - QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)"); - - if(!fileName.isEmpty()) - drawMapWidget->save(fileName); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagedrawmap.h --- a/QTfrontend/pagedrawmap.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_DRAWMAP_H -#define PAGE_DRAWMAP_H - -#include "AbstractPage.h" - -class DrawMapWidget; - -class PageDrawMap : public AbstractPage -{ - Q_OBJECT - -public: - PageDrawMap(QWidget* parent = 0); - - DrawMapWidget * drawMapWidget; - -private: - QPushButton * BtnBack; - -private slots: - void load(); - void save(); -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageeditteam.cpp --- a/QTfrontend/pageeditteam.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,386 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pageeditteam.h" -#include "sdlkeys.h" -#include "hwconsts.h" -#include "SquareLabel.h" -#include "hats.h" -#include "HWApplication.h" - -PageEditTeam::PageEditTeam(QWidget* parent, SDLInteraction * sdli) : - AbstractPage(parent) -{ - mySdli = sdli; - QGridLayout * pageLayout = new QGridLayout(this); - QTabWidget * tbw = new QTabWidget(this); - QWidget * page1 = new QWidget(this); - QWidget * page2 = new QWidget(this); - tbw->addTab(page1, tr("General")); - tbw->addTab(page2, tr("Advanced")); - pageLayout->addWidget(tbw, 0, 0, 1, 3); - BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true); - BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);; - BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); - BtnTeamDiscard->setFixedHeight(BtnTeamSave->height()); - BtnTeamDiscard->setStyleSheet("QPushButton{margin-top: 31px;}"); - - QHBoxLayout * page1Layout = new QHBoxLayout(page1); - page1Layout->setAlignment(Qt::AlignTop); - QGridLayout * page2Layout = new QGridLayout(page2); - -// ====== Page 1 ====== - QVBoxLayout * vbox1 = new QVBoxLayout(); - QVBoxLayout * vbox2 = new QVBoxLayout(); - page1Layout->addLayout(vbox1); - page1Layout->addLayout(vbox2); - - GBoxHedgehogs = new QGroupBox(this); - GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); - GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); - - signalMapper1 = new QSignalMapper(this); - signalMapper2 = new QSignalMapper(this); - - connect(signalMapper1, SIGNAL(mapped(int)), this, SLOT(fixHHname(int))); - - HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); - for(int i = 0; i < 8; i++) - { - HHHats[i] = new QComboBox(GBoxHedgehogs); - HHHats[i]->setModel(hatsModel); - HHHats[i]->setIconSize(QSize(32, 37)); - //HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); - //HHHats[i]->setModelColumn(1); - //HHHats[i]->setMinimumWidth(132); - GBHLayout->addWidget(HHHats[i], i, 0); - - HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); - HHNameEdit[i]->setMaxLength(64); - HHNameEdit[i]->setMinimumWidth(120); - GBHLayout->addWidget(HHNameEdit[i], i, 1); - - connect(HHNameEdit[i], SIGNAL(editingFinished()), signalMapper1, SLOT(map())); - signalMapper1->setMapping(HHNameEdit[i], i); - - randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true); - - connect(randButton[i], SIGNAL(clicked()), signalMapper2, SLOT(map())); - signalMapper2->setMapping(randButton[i], i); - } - - randTeamButton = addButton(QPushButton::tr("Random Team"), GBHLayout, 9, false); - - vbox1->addWidget(GBoxHedgehogs); - - - GBoxTeam = new QGroupBox(this); - GBoxTeam->setTitle(QGroupBox::tr("Team Settings")); - GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - QGridLayout * GBTLayout = new QGridLayout(GBoxTeam); - QLabel * tmpLabel = new QLabel(GBoxTeam); - tmpLabel->setText(QLabel::tr("Name")); - GBTLayout->addWidget(tmpLabel, 0, 0); - tmpLabel = new QLabel(GBoxTeam); - tmpLabel->setText(QLabel::tr("Type")); - GBTLayout->addWidget(tmpLabel, 1, 0); - tmpLabel = new QLabel(GBoxTeam); - tmpLabel->setText(QLabel::tr("Grave")); - GBTLayout->addWidget(tmpLabel, 2, 0); - tmpLabel = new QLabel(GBoxTeam); - tmpLabel->setText(QLabel::tr("Flag")); - GBTLayout->addWidget(tmpLabel, 3, 0); - tmpLabel = new QLabel(GBoxTeam); - tmpLabel->setText(QLabel::tr("Voice")); - GBTLayout->addWidget(tmpLabel, 4, 0); - - - TeamNameEdit = new QLineEdit(GBoxTeam); - TeamNameEdit->setMaxLength(64); - GBTLayout->addWidget(TeamNameEdit, 0, 1); - vbox2->addWidget(GBoxTeam); - - CBTeamLvl = new QComboBox(GBoxTeam); - CBTeamLvl->setIconSize(QSize(48, 48)); - CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); - for(int i = 5; i > 0; i--) - CBTeamLvl->addItem( - QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), - QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) - ); - GBTLayout->addWidget(CBTeamLvl, 1, 1); - - CBGrave = new QComboBox(GBoxTeam); - CBGrave->setMaxCount(65535); - CBGrave->setIconSize(QSize(32, 32)); - GBTLayout->addWidget(CBGrave, 2, 1); - - CBFlag = new QComboBox(GBoxTeam); - CBFlag->setMaxCount(65535); - CBFlag->setIconSize(QSize(22, 15)); - GBTLayout->addWidget(CBFlag, 3, 1); - - { - QHBoxLayout * hbox = new QHBoxLayout(); - CBVoicepack = new QComboBox(GBoxTeam); - { - QDir tmpdir; - QStringList list; - tmpdir.cd(cfgdir->absolutePath()); - if (tmpdir.cd("Data/Sounds/voices")) - { - list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); - CBVoicepack->addItems(list); - } - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Sounds/voices"); - QStringList tmplist = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); - QStringList tmplist2; - for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it) - if (!list.contains(*it,Qt::CaseInsensitive)) tmplist2.append(*it); - - CBVoicepack->addItems(tmplist2); - } - hbox->addWidget(CBVoicepack, 100); - BtnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true); - hbox->setStretchFactor(BtnTestSound, 1); - connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); - GBTLayout->addLayout(hbox, 4, 1); - } - - GBoxFort = new QGroupBox(this); - GBoxFort->setTitle(QGroupBox::tr("Fort")); - QGridLayout * GBFLayout = new QGridLayout(GBoxFort); - CBFort = new QComboBox(GBoxFort); - CBFort->setMaxCount(65535); - GBFLayout->addWidget(CBFort, 0, 0); - FortPreview = new SquareLabel(GBoxFort); - FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - FortPreview->setMinimumSize(128, 128); - FortPreview->setPixmap(QPixmap()); - // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars - //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true); - GBFLayout->addWidget(FortPreview, 1, 0); - vbox2->addWidget(GBoxFort); - - QDir tmpdir; - QStringList userforts; - tmpdir.cd(cfgdir->absolutePath()); - if (tmpdir.cd("Data/Forts")) - { - tmpdir.setFilter(QDir::Files); - userforts = tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1"); - CBFort->addItems(userforts); - } - - tmpdir.cd("../Graphics/Graves"); - QStringList userlist = tmpdir.entryList(QStringList("*.png")); - for (QStringList::Iterator it = userlist.begin(); it != userlist.end(); ++it ) - { - QPixmap pix(cfgdir->absolutePath() + "/Data/Graphics/Graves/" + *it); - QIcon icon(pix.copy(0, 0, 32, 32)); - CBGrave->addItem(icon, QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1")); - } - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Forts"); - tmpdir.setFilter(QDir::Files); - - QStringList tmplist = tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1"); - QStringList dataforts; - for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it) - if (!userforts.contains(*it,Qt::CaseInsensitive)) dataforts.append(*it); - - CBFort->addItems(dataforts); - connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); - - tmpdir.cd("../Graphics/Graves"); - QStringList datalist = tmpdir.entryList(QStringList("*.png")); - for (QStringList::Iterator it = datalist.begin(); it != datalist.end(); ++it ) - { - if (userlist.contains(*it,Qt::CaseInsensitive)) continue; - QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); - QIcon icon(pix.copy(0, 0, 32, 32)); - CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); - } - - // add the default flag - CBFlag->addItem(QIcon(QPixmap(datadir->absolutePath() + "/Graphics/Flags/hedgewars.png").copy(0, 0, 22, 15)), "Hedgewars", "hedgewars"); - CBFlag->insertSeparator(CBFlag->count()); - - tmpdir.cd(cfgdir->absolutePath()); - tmpdir.cd("Data/Graphics/Flags"); - userlist = tmpdir.entryList(QStringList("*.png")); - - // add all country flags - for (QStringList::Iterator it = userlist.begin(); it != userlist.end(); ++it ) - { - QPixmap pix(cfgdir->absolutePath() + "/Data/Graphics/Flags/" + *it); - QIcon icon(pix.copy(0, 0, 22, 15)); - if(it->compare("cpu.png") && it->compare("hedgewars.png") && (it->indexOf("cm_") == -1)) // skip cpu and hedgewars flags as well as all community flags - { - QString flag = QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1"); - CBFlag->addItem(icon, QString(flag).replace("_", " "), flag); - } - } - - CBFlag->insertSeparator(CBFlag->count()); - - // add all community flags - for (QStringList::Iterator it = userlist.begin(); it != userlist.end(); ++it ) - { - QPixmap pix(cfgdir->absolutePath() + "/Data/Graphics/Flags/" + *it); - QIcon icon(pix.copy(0, 0, 22, 15)); - if(it->indexOf("cm_") > -1) // skip non community flags this time - { - QString flag = QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1"); - CBFlag->addItem(icon, QString(flag).replace("cm_", QComboBox::tr("Community") + ": "), flag); - } - } - - CBFlag->insertSeparator(CBFlag->count()); - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Graphics/Flags"); - datalist = tmpdir.entryList(QStringList("*.png")); - - // add all country flags - for (QStringList::Iterator it = datalist.begin(); it != datalist.end(); ++it ) - { - if (userlist.contains(*it,Qt::CaseInsensitive)) continue; - QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it); - QIcon icon(pix.copy(0, 0, 22, 15)); - if(it->compare("cpu.png") && it->compare("hedgewars.png") && (it->indexOf("cm_") == -1)) // skip cpu and hedgewars flags as well as all community flags - { - QString flag = QString(*it).replace(QRegExp("^(.*)\\.png"), "\\1"); - CBFlag->addItem(icon, QString(flag).replace("_", " "), flag); - } - } - - CBFlag->insertSeparator(CBFlag->count()); - - // add all community flags - for (QStringList::Iterator it = datalist.begin(); it != datalist.end(); ++it ) - { - if (userlist.contains(*it,Qt::CaseInsensitive)) continue; - QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it); - QIcon icon(pix.copy(0, 0, 22, 15)); - if(it->indexOf("cm_") > -1) // skip non community flags this time - { - QString flag = (*it).replace(QRegExp("^(.*)\\.png"), "\\1"); - CBFlag->addItem(icon, QString(flag).replace("cm_", QComboBox::tr("Community") + ": "), flag); - } - } - - vbox1->addStretch(); - vbox2->addStretch(); - -// ====== Page 2 ====== - GBoxBinds = new QGroupBox(this); - GBoxBinds->setTitle(QGroupBox::tr("Key binds")); - QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); - BindsBox = new QToolBox(GBoxBinds); - BindsBox->setLineWidth(0); - GBBLayout->addWidget(BindsBox); - page2Layout->addWidget(GBoxBinds, 0, 0); - - quint16 i = 0; - quint16 num = 0; - QWidget * curW = NULL; - QGridLayout * pagelayout = NULL; - QLabel* l = NULL; - while (i < BINDS_NUMBER) { - if(cbinds[i].category != NULL) - { - if(curW != NULL) - { - l = new QLabel(curW); - l->setText(""); - pagelayout->addWidget(l, num++, 0, 1, 2); - } - curW = new QWidget(this); - BindsBox->addItem(curW, HWApplication::translate("binds (categories)", cbinds[i].category)); - pagelayout = new QGridLayout(curW); - num = 0; - } - if(cbinds[i].description != NULL) - { - l = new QLabel(curW); - l->setText((num > 0 ? QString("\n") : QString("")) + HWApplication::translate("binds (descriptions)", cbinds[i].description)); - pagelayout->addWidget(l, num++, 0, 1, 2); - } - - l = new QLabel(curW); - l->setText(HWApplication::translate("binds", cbinds[i].name)); - l->setAlignment(Qt::AlignRight); - pagelayout->addWidget(l, num, 0); - CBBind[i] = new QComboBox(curW); - for(int j = 0; sdlkeys[j][1][0] != '\0'; j++) - CBBind[i]->addItem(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]); - pagelayout->addWidget(CBBind[i++], num++, 1); - } -} - -void PageEditTeam::fixHHname(int idx) -{ - HHNameEdit[idx]->setText(HHNameEdit[idx]->text().trimmed()); - - if (HHNameEdit[idx]->text().isEmpty()) - HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1)); -} - -void PageEditTeam::CBFort_activated(const QString & fortname) -{ - QFile tmp; - tmp.setFileName(cfgdir->absolutePath() + "/Data/Forts/" + fortname + "L.png"); - if (!tmp.exists()) tmp.setFileName(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); - QPixmap pix(QFileInfo(tmp).absoluteFilePath()); - FortPreview->setPixmap(pix); -} - -void PageEditTeam::testSound() -{ - Mix_Chunk *sound; - QDir tmpdir; - mySdli->SDLMusicInit(); - - tmpdir.cd(cfgdir->absolutePath()); - if (!tmpdir.cd("Data/Sounds/voices/"+CBVoicepack->currentText())) - { - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Sounds/voices"); - tmpdir.cd(CBVoicepack->currentText()); - } - - QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files); - if (list.size()) { - sound = Mix_LoadWAV(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData()); - Mix_PlayChannel(-1, sound, 0); - } -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageeditteam.h --- a/QTfrontend/pageeditteam.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_EDITTEAM_H -#define PAGE_EDITTEAM_H - -#include "AbstractPage.h" -#include "binds.h" -#include "SDLs.h" - -class SquareLabel; - -class PageEditTeam : public AbstractPage -{ - Q_OBJECT - -public: - PageEditTeam(QWidget* parent, SDLInteraction * sdli); - QSignalMapper* signalMapper1; - QSignalMapper* signalMapper2; - QGroupBox *GBoxHedgehogs; - QGroupBox *GBoxTeam; - QGroupBox *GBoxFort; - QComboBox *CBFort; - SquareLabel *FortPreview; - QComboBox *CBGrave; - QComboBox *CBFlag; - QComboBox *CBTeamLvl; - QComboBox *CBVoicepack; - QGroupBox *GBoxBinds; - QToolBox *BindsBox; - QPushButton *BtnTeamDiscard; - QPushButton *BtnTeamSave; - QPushButton * BtnTestSound; - QLineEdit * TeamNameEdit; - QLineEdit * HHNameEdit[8]; - QComboBox * HHHats[8]; - QPushButton * randButton[8]; - QComboBox * CBBind[BINDS_NUMBER]; - QPushButton * randTeamButton; - -private: - SDLInteraction * mySdli; - -public slots: - void CBFort_activated(const QString & gravename); - -private slots: - void testSound(); - void fixHHname(int idx); -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagegamestats.cpp --- a/QTfrontend/pagegamestats.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,262 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2010-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include - -#include "pagegamestats.h" -#include "team.h" - -FitGraphicsView::FitGraphicsView(QWidget* parent) : QGraphicsView(parent) -{ - -} - -void FitGraphicsView::resizeEvent(QResizeEvent * event) -{ - Q_UNUSED(event); - - fitInView(sceneRect()); -} - -PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setSpacing(20); - pageLayout->setColumnStretch(0, 1); - pageLayout->setColumnStretch(1, 1); - pageLayout->setContentsMargins(7, 7, 7, 0); - - BtnSave = addButton(":/res/Save.png", pageLayout, 3, 2, true); - BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); - connect(BtnSave, SIGNAL(clicked()), this, SIGNAL(saveDemoRequested())); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); - BtnBack->setFixedHeight(BtnSave->height()); - BtnBack->setFixedWidth(BtnBack->width()+2); - BtnBack->setStyleSheet("QPushButton{margin: 22px 0 9px 2px;}"); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - QGroupBox * gb = new QGroupBox(this); - QVBoxLayout * gbl = new QVBoxLayout; - - // details - labelGameStats = new QLabel(this); - QLabel * l = new QLabel(this); - l->setTextFormat(Qt::RichText); - l->setText("

" + PageGameStats::tr("Details") + "

"); - l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - labelGameStats->setTextFormat(Qt::RichText); - labelGameStats->setAlignment(Qt::AlignTop); - labelGameStats->setWordWrap(true); - gbl->addWidget(l); - gbl->addWidget(labelGameStats); - gb->setLayout(gbl); - pageLayout->addWidget(gb, 1, 1, 1, 2); - - // graph - graphic = new FitGraphicsView(gb); - l = new QLabel(this); - l->setTextFormat(Qt::RichText); - l->setText("

" + PageGameStats::tr("Health graph") + "

"); - l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - gbl->addWidget(l); - gbl->addWidget(graphic); - graphic->scale(1.0, -1.0); - graphic->setBackgroundBrush(QBrush(Qt::black)); - - labelGameWin = new QLabel(this); - labelGameWin->setTextFormat(Qt::RichText); - pageLayout->addWidget(labelGameWin, 0, 0, 1, 2); - - // ranking box - gb = new QGroupBox(this); - gbl = new QVBoxLayout; - labelGameRank = new QLabel(gb); - l = new QLabel(this); - l->setTextFormat(Qt::RichText); - l->setText("

" + PageGameStats::tr("Ranking") + "

"); - l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - gbl->addWidget(l); - gbl->addWidget(labelGameRank); - gb->setLayout(gbl); - - labelGameRank->setTextFormat(Qt::RichText); - labelGameRank->setAlignment(Qt::AlignTop); - pageLayout->addWidget(gb, 1, 0); -} - -void PageGameStats::AddStatText(const QString & msg) -{ - labelGameStats->setText(labelGameStats->text() + msg); -} - -void PageGameStats::clear() -{ - labelGameStats->setText(""); - healthPoints.clear(); - labelGameRank->setText(""); - playerPosition = 0; - lastColor = 0; -} - -void PageGameStats::renderStats() -{ - QGraphicsScene * scene = new QGraphicsScene(); - - QMap >::const_iterator i = healthPoints.constBegin(); - while (i != healthPoints.constEnd()) - { - quint32 c = i.key(); - QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); - QVector hps = i.value(); - - QPainterPath path; - if (hps.size()) - path.moveTo(0, hps[0]); - - for(int t = 1; t < hps.size(); ++t) - path.lineTo(t, hps[t]); - - scene->addPath(path, QPen(c)); - ++i; - } - - graphic->setScene(scene); - graphic->fitInView(graphic->sceneRect()); -} - -void PageGameStats::GameStats(char type, const QString & info) -{ - switch(type) { - case 'r' : { - labelGameWin->setText(QString("

%1

").arg(info)); - break; - } - case 'D' : { - int i = info.indexOf(' '); - QString message = "

" + PageGameStats::tr("The best shot award was won by %1 with %2 pts.").arg(info.mid(i + 1), info.left(i)) + "

"; - AddStatText(message); - break; - } - case 'k' : { - int i = info.indexOf(' '); - int num = info.left(i).toInt(); - QString message = "

" + PageGameStats::tr("The best killer is %1 with %2 kills in a turn.", "", num).arg(info.mid(i + 1), info.left(i)) + "

"; - AddStatText(message); - break; - } - case 'K' : { - int num = info.toInt(); - QString message = "

" + PageGameStats::tr("A total of %1 hedgehog(s) were killed during this round.", "", num).arg(num) + "

"; - AddStatText(message); - break; - } - case 'H' : { - int i = info.indexOf(' '); - quint32 clan = info.left(i).toInt(); - quint32 hp = info.mid(i + 1).toUInt(); - healthPoints[clan].append(hp); - break; - } - case 'T': { // local team stats - //AddStatText("

local team: " + info + "

"); - QStringList infol = info.split(":"); - HWTeam team(infol[0]); - if(team.fileExists()) // do some better test to avoid influence from scripted/predefined teams? - { - team.loadFromFile(); - team.incRounds(); - if(infol[1].toInt() > 0) // might require some better test for winning condition (or changed flag) ... WIP! - team.incWins(); // should draws count as wins? - //team.SaveToFile(); // don't save yet - } - break; - } - - case 'P' : { - int i = info.indexOf(' '); - playerPosition++; - QString color = info.left(i); - quint32 c = color.toInt(); - QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); - - QString playerinfo = info.mid(i + 1); - - i = playerinfo.indexOf(' '); - - int kills = playerinfo.left(i).toInt(); - QString playername = playerinfo.mid(i + 1); - QString image; - - if (lastColor == c) playerPosition--; - lastColor = c; - - switch (playerPosition) - { - case 1: - image = ""; - break; - case 2: - image = ""; - break; - case 3: - image = ""; - break; - default: - image = ""; - break; - } - - QString message; - QString killstring = PageGameStats::tr("(%1 kill)", "", kills).arg(kills); - - message = QString("

%1 %2. %3 ").arg(image, QString::number(playerPosition), playername, clanColor.name()) + killstring + "

"; - - labelGameRank->setText(labelGameRank->text() + message); - break; - } - case 's' : { - int i = info.indexOf(' '); - int num = info.left(i).toInt(); - QString message = "

" + PageGameStats::tr("%1 thought it's good to shoot his own hedgehogs with %2 pts.", "", num).arg(info.mid(i + 1)).arg(num) + "

"; - AddStatText(message); - break; - } - case 'S' : { - int i = info.indexOf(' '); - int num = info.left(i).toInt(); - QString message = "

" + PageGameStats::tr("%1 killed %2 of his own hedgehogs.", "", num).arg(info.mid(i + 1)).arg(num) + "

"; - AddStatText(message); - break; - } - case 'B' : { - int i = info.indexOf(' '); - int num = info.left(i).toInt(); - QString message = "

" + PageGameStats::tr("%1 was scared and skipped turn %2 times.", "", num).arg(info.mid(i + 1)).arg(num) + "

"; - AddStatText(message); - break; - } - - } -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagegamestats.h --- a/QTfrontend/pagegamestats.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2010-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef STATSPAGE_H -#define STATSPAGE_H - -#include -#include -#include - -#include "AbstractPage.h" - -class FitGraphicsView : public QGraphicsView -{ - Q_OBJECT - -public: - FitGraphicsView(QWidget* parent = 0); - -protected: - void resizeEvent(QResizeEvent * event); -}; - -class PageGameStats : public AbstractPage -{ - Q_OBJECT - -public: - PageGameStats(QWidget* parent = 0); - - QPushButton *BtnSave; - QLabel *labelGameStats; - QLabel *labelGameWin; - QLabel *labelGameRank; - FitGraphicsView * graphic; - -public slots: - void GameStats(char type, const QString & info); - void clear(); - void renderStats(); - -signals: - void saveDemoRequested(); - -private: - void AddStatText(const QString & msg); - - QMap > healthPoints; - unsigned int playerPosition; - quint32 lastColor; - - QPushButton *BtnBack; -}; - -#endif // STATSPAGE_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageinfo.cpp --- a/QTfrontend/pageinfo.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pageinfo.h" -#include "about.h" - -PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setColumnStretch(0, 1); - pageLayout->setColumnStretch(1, 1); - pageLayout->setColumnStretch(2, 1); - - BtnSnapshots = addButton(":/res/Star.png", pageLayout, 1, 2, true); - - about = new About(this); - pageLayout->addWidget(about, 0, 0, 1, 3); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageinfo.h --- a/QTfrontend/pageinfo.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_INFO_H -#define PAGE_INFO_H - -#include "AbstractPage.h" - -class About; - -class PageInfo : public AbstractPage -{ - Q_OBJECT - -public: - PageInfo(QWidget* parent = 0); - - QPushButton *BtnSnapshots; - About *about; - -private: - QPushButton *BtnBack; -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageingame.cpp --- a/QTfrontend/pageingame.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include - -#include "pageingame.h" - -PageInGame::PageInGame(QWidget* parent) : - AbstractPage(parent) -{ - QLabel * label = new QLabel(this); - label->setText("In game..."); -} - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageingame.h --- a/QTfrontend/pageingame.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_INGAME_H -#define PAGE_INGAME_H - -#include "AbstractPage.h" - -class PageInGame : public AbstractPage -{ - Q_OBJECT - -public: - PageInGame(QWidget* parent = 0); -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagemain.cpp --- a/QTfrontend/pagemain.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include - -#include "pagemain.h" -#include "hwconsts.h" -#include "hwform.h" - -PageMain::PageMain(QWidget* parent) : - AbstractPage(parent) -{ - if(frontendEffects) setAttribute(Qt::WA_NoSystemBackground, true); - QGridLayout * pageLayout = new QGridLayout(this); - //pageLayout->setColumnStretch(0, 1); - //pageLayout->setColumnStretch(1, 2); - //pageLayout->setColumnStretch(2, 1); - - //QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); - //pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); - pageLayout->setRowStretch(0, 1); - pageLayout->setRowStretch(1, 1); - pageLayout->setRowStretch(2, 0); - pageLayout->setRowStretch(3, 1); - pageLayout->setRowStretch(4, 1); - pageLayout->setRowStretch(5, 1); - - BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); - BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); - pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); - - BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); - BtnNet->setToolTip(tr("Network Game (Play a game across a network)")); - pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); - - BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 4, 0, 1, 4, false); - pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter); - - mainNote = new QLabel(this); - mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - mainNote->setWordWrap(true); - mainNote->setOpenExternalLinks(true); - - if(!isDevBuild) - { - QStringList Tips; - Tips << tr("Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.", "Tips"); - Tips << tr("Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.", "Tips"); - Tips << tr("If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!", "Tips"); - Tips << tr("Want to save ropes? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!", "Tips"); - Tips << tr("If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.", "Tips"); - Tips << tr("You're bored of default gameplay? Try one of the missions - they'll offer different gameplay depending on the one you picked.", "Tips"); - Tips << tr("By default the game will always record the last game played as a demo. Select 'Local Game' and pick the 'Demos' button on the lower right corner to play or manage them.", "Tips"); - Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you've got problems, ask on our forums but please don't expect 24/7 support!", "Tips"); - Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you like it, help us with a small donation or contribute your own work!", "Tips"); - Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. Share it with your family and friends as you like!", "Tips"); - Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If someone sold you the game, you should try get a refund!", "Tips"); - Tips << tr("From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.", "Tips"); - Tips << tr("Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!", "Tips"); - Tips << tr("Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and Linux.", "Tips"); - Tips << tr("Always remember you're able to set up your own games in local and network/online play. You're not restricted to the 'Simple Game' option.", "Tips"); - Tips << tr("Connect one or more gamepads before starting the game to be able to assign their controls to your teams.", "Tips"); - Tips << tr("Create an account on %1 to keep others from using your most favourite nickname while playing on the official server.", "Tips").arg("http://www.hedgewars.org/"); - Tips << tr("While playing you should give yourself a short break at least once an hour.", "Tips"); - Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.", "Tips"); - Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to update the associated drivers.", "Tips"); - Tips << tr("We're open to suggestions and constructive feedback. If you don't like something or got a great idea, let us know!", "Tips"); - Tips << tr("Especially while playing online be polite and always remember there might be some minors playing with or against you as well!", "Tips"); - Tips << tr("Special game modes such as 'Vampirism' or 'Karma' allow you to develop completely new tactics. Try them in a custom game!", "Tips"); - Tips << tr("The Windows version of Hedgewars supports Xfire. Make sure to add Hedgewars to its game list so your friends can see you playing.", "Tips"); - Tips << tr("You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!", "Tips"); - Tips << tr("Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.", "Tips"); - Tips << tr("No hedgehogs were harmed in making this game.", "Tips"); - Tips << tr("There are three different jumps available. Tap [high jump] twice to do a very high/backwards jump.", "Tips"); - Tips << tr("Afraid of falling off a cliff? Hold down [precise] to turn [left] or [right] without actually moving.", "Tips"); - Tips << tr("Some weapons require special strategies or just lots of training, so don't give up on a particular tool if you miss an enemy once.", "Tips"); - Tips << tr("Most weapons won't work once they touch the water. The Homing Bee as well as the Cake are exceptions to this.", "Tips"); - Tips << tr("The Old Limbuger only causes a small explosion. However the wind affected smelly cloud can poison lots of hogs at once.", "Tips"); - Tips << tr("The Piano Strike is the most damaging air strike. You'll lose the hedgehog performing it, so there's a huge downside as well.", "Tips"); - Tips << tr("The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power.", "Tips"); - Tips << tr("Sticky Mines are a perfect tool to create small chain reactions knocking enemy hedgehogs into dire situations ... or water.", "Tips"); - Tips << tr("The Hammer is most effective when used on bridges or girders. Hit hogs will just break through the ground.", "Tips"); - Tips << tr("If you're stuck behind an enemy hedgehog, use the Hammer to free yourself without getting damaged by an explosion.", "Tips"); - Tips << tr("The Cake's maximum walking distance depends on the ground it has to pass. Use [attack] to detonate it early.", "Tips"); - Tips << tr("The Flame Thrower is a weapon but it can be used for tunnel digging as well.", "Tips"); - Tips << tr("Use the Molotov or Flame Thrower to temporary keep hedgehogs from passing terrain such as tunnels or platforms.", "Tips"); - Tips << tr("Want to know who's behind the game? Click on the Hedgewars logo in the main menu to see the credits.", "Tips"); - Tips << tr("Like Hedgewars? Become a fan on %1 or follow us on %2!", "Tips").arg("Facebook").arg("Twitter"); - Tips << tr("Feel free to draw your own graves, hats, flags or even maps and themes! But note that you'll have to share them somewhere to use them online.", "Tips"); - Tips << tr("Really want to wear a specific hat? Donate to us and receive an exclusive hat of your choice!", "Tips"); - // The following tip will require links to app store entries first. - //Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg(""); - // the ios version is located here: http://itunes.apple.com/us/app/hedgewars/id391234866 - Tips << tr("Keep your video card drivers up to date to avoid issues playing the game.", "Tips"); - Tips << tr("You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.", "Tips"); -#ifdef _WIN32 - Tips << tr("You can find your Hedgewars configuration files under \"My Documents\\Hedgewars\". Create backups or take the files with you, but don't edit them by hand.", "Tips"); -#elif defined __APPLE__ - Tips << tr("You can find your Hedgewars configuration files under \"Library/Application Support/Hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); -#else - Tips << tr("You can find your Hedgewars configuration files under \".hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); -#endif - mainNote->setText(QLabel::tr("Tip: ") + Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]); - } - else - mainNote->setText(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!")); - - pageLayout->addWidget(mainNote, 5, 1, 1, 2); - - BtnSetup = addButton(":/res/Settings.png", pageLayout, 5, 3, true); - - //BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); - BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); - BtnInfo->setStyleSheet("border: transparent;background: transparent;"); - pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); - //pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); - - BtnExit = addButton(":/res/Exit.png", pageLayout, 5, 0, 1, 1, true); - BtnExit->setFixedHeight(BtnSetup->height()); - BtnExit->setStyleSheet("QPushButton{margin-top: 2px;}"); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagemain.h --- a/QTfrontend/pagemain.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_MAIN_H -#define PAGE_MAIN_H - -#include "AbstractPage.h" - -class PageMain : public AbstractPage -{ - Q_OBJECT - -public: - PageMain(QWidget* parent = 0); - - QPushButton *BtnSinglePlayer; - QPushButton *BtnNet; - QPushButton *BtnSetup; - QPushButton *BtnInfo; - QPushButton *BtnExit; - QPushButton *BtnDataDownload; - QLabel *mainNote; -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagemultiplayer.cpp --- a/QTfrontend/pagemultiplayer.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pagemultiplayer.h" -#include "gamecfgwidget.h" -#include "teamselect.h" - -PageMultiplayer::PageMultiplayer(QWidget* parent) : - AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - - gameCFG = new GameCFGWidget(this); - pageLayout->addWidget(gameCFG, 0, 0, 1, 2); - - QPushButton * btnSetup = new QPushButton(this); - btnSetup->setText(QPushButton::tr("Setup")); - connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked())); - pageLayout->addWidget(btnSetup, 1, 0, 1, 2); - - pageLayout->setRowStretch(2, 1); - - teamsSelect = new TeamSelWidget(this); - pageLayout->addWidget(teamsSelect, 0, 2, 3, 2); - - BtnStartMPGame = addButton(tr("Start"), pageLayout, 3, 3); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagemultiplayer.h --- a/QTfrontend/pagemultiplayer.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_MULTIPLAYER_H -#define PAGE_MULTIPLAYER_H - -#include "AbstractPage.h" - -class GameCFGWidget; -class TeamSelWidget; - -class PageMultiplayer : public AbstractPage -{ - Q_OBJECT - -public: - PageMultiplayer(QWidget* parent = 0); - - GameCFGWidget *gameCFG; - TeamSelWidget *teamsSelect; - QPushButton *BtnStartMPGame; - -private: - QPushButton *BtnBack; - -signals: - void SetupClicked(); -}; - -#endif - - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagenet.cpp --- a/QTfrontend/pagenet.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include - -#include "pagenet.h" -#include "hwconsts.h" -#include "netudpwidget.h" - -PageNet::PageNet(QWidget* parent) : AbstractPage(parent) -{ - QFont * font14 = new QFont("MS Shell Dlg", 14); - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setColumnStretch(0, 1); - pageLayout->setColumnStretch(1, 1); - pageLayout->setColumnStretch(2, 1); - - BtnNetSvrStart = new QPushButton(this); - BtnNetSvrStart->setFont(*font14); - BtnNetSvrStart->setText(QPushButton::tr("Start server")); - BtnNetSvrStart->setVisible(haveServer); - pageLayout->addWidget(BtnNetSvrStart, 4, 2); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - ConnGroupBox = new QGroupBox(this); - ConnGroupBox->setTitle(QGroupBox::tr("Net game")); - pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); - GBClayout = new QGridLayout(ConnGroupBox); - GBClayout->setColumnStretch(0, 1); - GBClayout->setColumnStretch(1, 1); - GBClayout->setColumnStretch(2, 1); - - BtnNetConnect = new QPushButton(ConnGroupBox); - BtnNetConnect->setFont(*font14); - BtnNetConnect->setText(QPushButton::tr("Connect")); - GBClayout->addWidget(BtnNetConnect, 2, 2); - - tvServersList = new QTableView(ConnGroupBox); - tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); - GBClayout->addWidget(tvServersList, 1, 0, 1, 3); - - BtnUpdateSList = new QPushButton(ConnGroupBox); - BtnUpdateSList->setFont(*font14); - BtnUpdateSList->setText(QPushButton::tr("Update")); - GBClayout->addWidget(BtnUpdateSList, 2, 0); - - BtnSpecifyServer = new QPushButton(ConnGroupBox); - BtnSpecifyServer->setFont(*font14); - BtnSpecifyServer->setText(QPushButton::tr("Specify")); - GBClayout->addWidget(BtnSpecifyServer, 2, 1); - - connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); -} - -void PageNet::updateServersList() -{ - tvServersList->setModel(new HWNetUdpModel(tvServersList)); - - tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); - - static_cast(tvServersList->model())->updateList(); - - connect(BtnUpdateSList, SIGNAL(clicked()), static_cast(tvServersList->model()), SLOT(updateList())); - connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); -} - -void PageNet::slotConnect() -{ - HWNetServersModel * model = static_cast(tvServersList->model()); - QModelIndex mi = tvServersList->currentIndex(); - if(!mi.isValid()) - { - QMessageBox::information(this, tr("Error"), tr("Please select server from the list above")); - return; - } - QString host = model->index(mi.row(), 1).data().toString(); - quint16 port = model->index(mi.row(), 2).data().toUInt(); - - emit connectClicked(host, port); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagenet.h --- a/QTfrontend/pagenet.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_NET_H -#define PAGE_NET_H - -#include "AbstractPage.h" - -class PageNet : public AbstractPage -{ - Q_OBJECT - -public: - PageNet(QWidget* parent = 0); - - QPushButton* BtnUpdateSList; - QTableView * tvServersList; - QPushButton * BtnNetConnect; - QPushButton * BtnNetSvrStart; - QPushButton * BtnSpecifyServer; - -private: - QGroupBox * ConnGroupBox; - QGridLayout * GBClayout; - QPushButton * BtnBack; - -private slots: - void slotConnect(); - -public slots: - void updateServersList(); - -signals: - void connectClicked(const QString & host, quint16 port); -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagenetgame.cpp --- a/QTfrontend/pagenetgame.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include - -#include "pagenetgame.h" -#include "gamecfgwidget.h" -#include "teamselect.h" -#include "chatwidget.h" - -PageNetGame::PageNetGame(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli) : AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setSizeConstraint(QLayout::SetMinimumSize); - //pageLayout->setSpacing(1); - pageLayout->setColumnStretch(0, 50); - pageLayout->setColumnStretch(1, 50); - - // chatwidget - pChatWidget = new HWChatWidget(this, gameSettings, sdli, true); - pChatWidget->setShowReady(true); // show status bulbs by default - pChatWidget->setShowFollow(false); // don't show follow in nicks' context menus - pageLayout->addWidget(pChatWidget, 2, 0, 1, 2); - pageLayout->setRowStretch(1, 100); - pageLayout->setRowStretch(2, 100); - - pGameCFG = new GameCFGWidget(this); - pageLayout->addWidget(pGameCFG, 0, 0); - - QPushButton * btnSetup = new QPushButton(this); - btnSetup->setText(QPushButton::tr("Setup")); - connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked())); - pageLayout->addWidget(btnSetup, 1, 0); - - pNetTeamsWidget = new TeamSelWidget(this); - pNetTeamsWidget->setAcceptOuter(true); - pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); - - - QHBoxLayout * bottomLayout = new QHBoxLayout; - pageLayout->addLayout(bottomLayout, 4, 0, 1, 2); - - - BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - leRoomName = new QLineEdit(this); - leRoomName->setMaxLength(60); - leRoomName->setMinimumWidth(200); - leRoomName->setMaximumWidth(400); - bottomLayout->addWidget(leRoomName, 8,0); - BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 1, false); - - BtnGo = new QPushButton(this); - BtnGo->setToolTip(QPushButton::tr("Ready")); - BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); - BtnGo->setIconSize(QSize(25, 34)); - BtnGo->setMinimumWidth(50); - BtnGo->setMinimumHeight(50); - bottomLayout->addWidget(BtnGo, 4); - - - BtnMaster = addButton(tr("Control"), bottomLayout, 2); - QMenu * menu = new QMenu(BtnMaster); - restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); - restrictJoins->setCheckable(true); - restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); - restrictTeamAdds->setCheckable(true); - //menu->addAction(startGame); - menu->addAction(restrictJoins); - menu->addAction(restrictTeamAdds); - - BtnMaster->setMenu(menu); - - BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3); - - bottomLayout->insertStretch(3, 100); - - connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick())); -} - -void PageNetGame::setReadyStatus(bool isReady) -{ - if(isReady) - BtnGo->setIcon(QIcon(":/res/lightbulb_on.png")); - else - BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); -} - -void PageNetGame::onUpdateClick() -{ - if (leRoomName->text().size()) - emit askForUpdateRoomName(leRoomName->text()); - else - QMessageBox::critical(this, - tr("Error"), - tr("Please enter room name"), - tr("OK")); -} - -void PageNetGame::setMasterMode(bool isMaster) -{ - BtnMaster->setVisible(isMaster); - BtnStart->setVisible(isMaster); - BtnUpdate->setVisible(isMaster); - leRoomName->setVisible(isMaster); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagenetgame.h --- a/QTfrontend/pagenetgame.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_NETGAME_H -#define PAGE_NETGAME_H - -#include "AbstractPage.h" -#include "SDLs.h" - -class HWChatWidget; -class TeamSelWidget; -class GameCFGWidget; - -class PageNetGame : public AbstractPage -{ - Q_OBJECT - -public: - PageNetGame(QWidget* parent, QSettings * config, SDLInteraction * sdli); - - QPushButton *BtnGo; - QPushButton *BtnMaster; - QPushButton *BtnStart; - QPushButton *BtnUpdate; - - QLineEdit * leRoomName; - - QAction * restrictJoins; - QAction * restrictTeamAdds; - - HWChatWidget* pChatWidget; - - TeamSelWidget* pNetTeamsWidget; - GameCFGWidget* pGameCFG; - -private: - QPushButton *BtnBack; - -public slots: - void setReadyStatus(bool isReady); - void onUpdateClick(); - void setMasterMode(bool isMaster); - -signals: - void SetupClicked(); - void askForUpdateRoomName(const QString &); -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagenetserver.cpp --- a/QTfrontend/pagenetserver.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include - -#include "pagenetserver.h" - -PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) -{ - QFont * font14 = new QFont("MS Shell Dlg", 14); - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setColumnStretch(0, 1); - pageLayout->setColumnStretch(1, 1); - pageLayout->setColumnStretch(2, 1); - - pageLayout->setRowStretch(0, 1); - pageLayout->setRowStretch(1, 0); - - - BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - BtnStart = new QPushButton(this); - BtnStart->setFont(*font14); - BtnStart->setText(QPushButton::tr("Start")); - pageLayout->addWidget(BtnStart, 1, 2); - - QWidget * wg = new QWidget(this); - pageLayout->addWidget(wg, 0, 0, 1, 3); - - QGridLayout * wgLayout = new QGridLayout(wg); - wgLayout->setColumnStretch(0, 1); - wgLayout->setColumnStretch(1, 3); - wgLayout->setColumnStretch(2, 1); - - wgLayout->setRowStretch(0, 0); - wgLayout->setRowStretch(1, 1); - - QGroupBox * gb = new QGroupBox(wg); - wgLayout->addWidget(gb, 0, 1); - - QGridLayout * gbLayout = new QGridLayout(gb); - - labelSD = new QLabel(gb); - labelSD->setText(QLabel::tr("Server name:")); - gbLayout->addWidget(labelSD, 0, 0); - - leServerDescr = new QLineEdit(gb); - gbLayout->addWidget(leServerDescr, 0, 1); - - labelPort = new QLabel(gb); - labelPort->setText(QLabel::tr("Server port:")); - gbLayout->addWidget(labelPort, 1, 0); - - sbPort = new QSpinBox(gb); - sbPort->setMinimum(0); - sbPort->setMaximum(65535); - gbLayout->addWidget(sbPort, 1, 1); - - BtnDefault = new QPushButton(gb); - BtnDefault->setText(QPushButton::tr("default")); - gbLayout->addWidget(BtnDefault, 1, 2); - - connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); -} - -void PageNetServer::setDefaultPort() -{ - sbPort->setValue(46631); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagenetserver.h --- a/QTfrontend/pagenetserver.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_NETSERVER_H -#define PAGE_NETSERVER_H - -#include "AbstractPage.h" - -class PageNetServer : public AbstractPage -{ - Q_OBJECT - -public: - PageNetServer(QWidget* parent = 0); - - QPushButton *BtnStart; - QPushButton *BtnDefault; - QLabel *labelSD; - QLineEdit *leServerDescr; - QLabel *labelPort; - QSpinBox *sbPort; - -private: - QPushButton *BtnBack; - -private slots: - void setDefaultPort(); -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagenettype.cpp --- a/QTfrontend/pagenettype.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pagenettype.h" - -PageNetType::PageNetType(QWidget* parent) : AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setRowStretch(0, 10); - pageLayout->setRowStretch(3, 10); - - pageLayout->setColumnStretch(1, 10); - pageLayout->setColumnStretch(2, 20); - pageLayout->setColumnStretch(3, 10); - - BtnLAN = addButton(tr("LAN game"), pageLayout, 1, 2); - BtnOfficialServer = addButton(tr("Official server"), pageLayout, 2, 2); - - // hack: temporary deactivated - requires server modifications that aren't backward compatible (yet) - //BtnOfficialServer->setEnabled(false); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagenettype.h --- a/QTfrontend/pagenettype.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_NETTYPE_H -#define PAGE_NETTYPE_H - -#include "AbstractPage.h" - -class PageNetType : public AbstractPage -{ - Q_OBJECT - -public: - PageNetType(QWidget* parent = 0); - - QPushButton * BtnLAN; - QPushButton * BtnOfficialServer; - -private: - QPushButton * BtnBack; -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageoptions.cpp --- a/QTfrontend/pageoptions.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,459 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pageoptions.h" -#include "hwconsts.h" -#include "fpsedit.h" -#include "igbox.h" - -PageOptions::PageOptions(QWidget* parent) : - AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setColumnStretch(0, 100); - pageLayout->setColumnStretch(1, 100); - pageLayout->setColumnStretch(2, 100); - pageLayout->setRowStretch(0, 0); - //pageLayout->setRowStretch(1, 100); - pageLayout->setRowStretch(2, 0); - pageLayout->setContentsMargins(7, 7, 7, 0); - pageLayout->setSpacing(0); - - - QGroupBox * gbTwoBoxes = new QGroupBox(this); - pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); - QGridLayout * gbTBLayout = new QGridLayout(gbTwoBoxes); - gbTBLayout->setMargin(0); - gbTBLayout->setSpacing(0); - gbTBLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); - - QPixmap pmNew(":/res/new.png"); - QPixmap pmEdit(":/res/edit.png"); - QPixmap pmDelete(":/res/delete.png"); - - { - teamsBox = new IconedGroupBox(this); - //teamsBox->setContentTopPadding(0); - //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true); - teamsBox->setIcon(QIcon(":/res/teamicon.png")); - teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - teamsBox->setTitle(QGroupBox::tr("Teams")); - - QGridLayout * GBTlayout = new QGridLayout(teamsBox); - - CBTeamName = new QComboBox(teamsBox); - GBTlayout->addWidget(CBTeamName, 0, 0); - - BtnNewTeam = new QPushButton(teamsBox); - BtnNewTeam->setToolTip(tr("New team")); - BtnNewTeam->setIconSize(pmNew.size()); - BtnNewTeam->setIcon(pmNew); - BtnNewTeam->setMaximumWidth(pmNew.width() + 6); - GBTlayout->addWidget(BtnNewTeam, 0, 1); - - BtnEditTeam = new QPushButton(teamsBox); - BtnEditTeam->setToolTip(tr("Edit team")); - BtnEditTeam->setIconSize(pmEdit.size()); - BtnEditTeam->setIcon(pmEdit); - BtnEditTeam->setMaximumWidth(pmEdit.width() + 6); - GBTlayout->addWidget(BtnEditTeam, 0, 2); - - BtnDeleteTeam = new QPushButton(teamsBox); - BtnDeleteTeam->setToolTip(tr("Delete team")); - BtnDeleteTeam->setIconSize(pmDelete.size()); - BtnDeleteTeam->setIcon(pmDelete); - BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6); - GBTlayout->addWidget(BtnDeleteTeam, 0, 3); - - LblNoEditTeam = new QLabel(teamsBox); - LblNoEditTeam->setText(tr("You can't edit teams from team selection. Go back to main menu to add, edit or delete teams.")); - LblNoEditTeam->setWordWrap(true); - LblNoEditTeam->setVisible(false); - GBTlayout->addWidget(LblNoEditTeam, 0, 0); - - gbTBLayout->addWidget(teamsBox, 0, 0); - } - - { - IconedGroupBox* groupWeapons = new IconedGroupBox(this); - - //groupWeapons->setContentTopPadding(0); - //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); - groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons")); - QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); - - QLabel* SchemeLabel = new QLabel(groupWeapons); - SchemeLabel->setText(QLabel::tr("Game scheme")); - WeaponsLayout->addWidget(SchemeLabel, 1, 0); - - SchemesName = new QComboBox(groupWeapons); - WeaponsLayout->addWidget(SchemesName, 1, 1); - - SchemeNew = new QPushButton(groupWeapons); - SchemeNew->setToolTip(tr("New scheme")); - SchemeNew->setIconSize(pmNew.size()); - SchemeNew->setIcon(pmNew); - SchemeNew->setMaximumWidth(pmNew.width() + 6); - WeaponsLayout->addWidget(SchemeNew, 1, 2); - - SchemeEdit = new QPushButton(groupWeapons); - SchemeEdit->setToolTip(tr("Edit scheme")); - SchemeEdit->setIconSize(pmEdit.size()); - SchemeEdit->setIcon(pmEdit); - SchemeEdit->setMaximumWidth(pmEdit.width() + 6); - WeaponsLayout->addWidget(SchemeEdit, 1, 3); - - SchemeDelete = new QPushButton(groupWeapons); - SchemeDelete->setToolTip(tr("Delete scheme")); - SchemeDelete->setIconSize(pmDelete.size()); - SchemeDelete->setIcon(pmDelete); - SchemeDelete->setMaximumWidth(pmDelete.width() + 6); - WeaponsLayout->addWidget(SchemeDelete, 1, 4); - - QLabel* WeaponLabel = new QLabel(groupWeapons); - WeaponLabel->setText(QLabel::tr("Weapons")); - WeaponsLayout->addWidget(WeaponLabel, 2, 0); - - WeaponsName = new QComboBox(groupWeapons); - WeaponsLayout->addWidget(WeaponsName, 2, 1); - - WeaponNew = new QPushButton(groupWeapons); - WeaponNew->setToolTip(tr("New weapon set")); - WeaponNew->setIconSize(pmNew.size()); - WeaponNew->setIcon(pmNew); - WeaponNew->setMaximumWidth(pmNew.width() + 6); - WeaponsLayout->addWidget(WeaponNew, 2, 2); - - WeaponEdit = new QPushButton(groupWeapons); - WeaponEdit->setToolTip(tr("Edit weapon set")); - WeaponEdit->setIconSize(pmEdit.size()); - WeaponEdit->setIcon(pmEdit); - WeaponEdit->setMaximumWidth(pmEdit.width() + 6); - WeaponsLayout->addWidget(WeaponEdit, 2, 3); - - WeaponDelete = new QPushButton(groupWeapons); - WeaponDelete->setToolTip(tr("Delete weapon set")); - WeaponDelete->setIconSize(pmDelete.size()); - WeaponDelete->setIcon(pmDelete); - WeaponDelete->setMaximumWidth(pmDelete.width() + 6); - WeaponsLayout->addWidget(WeaponDelete, 2, 4); - - WeaponTooltip = new QCheckBox(this); - WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips")); - WeaponsLayout->addWidget(WeaponTooltip, 3, 0, 1, 4); - - gbTBLayout->addWidget(groupWeapons, 1, 0); - } - - { - IconedGroupBox* groupMisc = new IconedGroupBox(this); - //groupMisc->setContentTopPadding(0); - groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - groupMisc->setIcon(QIcon(":/res/miscicon.png")); - //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - groupMisc->setTitle(QGroupBox::tr("Misc")); - QGridLayout * MiscLayout = new QGridLayout(groupMisc); - - labelNN = new QLabel(groupMisc); - labelNN->setText(QLabel::tr("Net nick")); - MiscLayout->addWidget(labelNN, 0, 0); - - editNetNick = new QLineEdit(groupMisc); - editNetNick->setMaxLength(20); - editNetNick->setText(QLineEdit::tr("unnamed")); - connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick())); - MiscLayout->addWidget(editNetNick, 0, 1); - - labelNetPassword = new QLabel(groupMisc); - labelNetPassword->setText(QLabel::tr("Password")); - MiscLayout->addWidget(labelNetPassword, 1, 0); - - editNetPassword = new QLineEdit(groupMisc); - editNetPassword->setEchoMode(QLineEdit::Password); - MiscLayout->addWidget(editNetPassword, 1, 1); - - QLabel *labelLanguage = new QLabel(groupMisc); - labelLanguage->setText(QLabel::tr("Locale") + " *"); - MiscLayout->addWidget(labelLanguage, 2, 0); - - CBLanguage = new QComboBox(groupMisc); - QDir tmpdir; - tmpdir.cd(cfgdir->absolutePath()); - tmpdir.cd("Data/Locale"); - tmpdir.setFilter(QDir::Files); - QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm")); - CBLanguage->addItem(QComboBox::tr("(System default)"), QString("")); - for(int i = 0; i < locs.count(); i++) - { - QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1")); - CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name()); - } - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Locale"); - tmpdir.setFilter(QDir::Files); - QStringList tmplist = tmpdir.entryList(QStringList("hedgewars_*.qm")); - for(int i = 0; i < tmplist.count(); i++) - { - if (locs.contains(tmplist[i])) continue; - QLocale loc(tmplist[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1")); - CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name()); - } - - MiscLayout->addWidget(CBLanguage, 2, 1); - - CBAltDamage = new QCheckBox(groupMisc); - CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); - MiscLayout->addWidget(CBAltDamage, 3, 0, 1, 2); - - CBNameWithDate = new QCheckBox(groupMisc); - CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name")); - MiscLayout->addWidget(CBNameWithDate, 4, 0, 1, 2); - - BtnAssociateFiles = new QPushButton(groupMisc); - BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions")); - BtnAssociateFiles->setEnabled(!custom_data && !custom_config); - MiscLayout->addWidget(BtnAssociateFiles, 5, 0, 1, 2); - -#ifdef __APPLE__ -#ifdef SPARKLE_ENABLED - CBAutoUpdate = new QCheckBox(groupMisc); - CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup")); - MiscLayout->addWidget(CBAutoUpdate, 6, 0, 1, 3); -#endif -#endif - gbTBLayout->addWidget(groupMisc, 2, 0); - } - - { - AGGroupBox = new IconedGroupBox(this); - //AGGroupBox->setContentTopPadding(0); - AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); - //AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); - - QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); - QHBoxLayout * GBAreslayout = new QHBoxLayout(0); - QHBoxLayout * GBAstereolayout = new QHBoxLayout(0); - QHBoxLayout * GBAqualayout = new QHBoxLayout(0); - - CBFrontendFullscreen = new QCheckBox(AGGroupBox); - CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); - GBAlayout->addWidget(CBFrontendFullscreen); - - CBFrontendEffects = new QCheckBox(AGGroupBox); - CBFrontendEffects->setText(QCheckBox::tr("Frontend effects") + " *"); - GBAlayout->addWidget(CBFrontendEffects); - - CBEnableFrontendSound = new QCheckBox(AGGroupBox); - CBEnableFrontendSound->setText(QCheckBox::tr("Enable frontend sounds")); - GBAlayout->addWidget(CBEnableFrontendSound); - - CBEnableFrontendMusic = new QCheckBox(AGGroupBox); - CBEnableFrontendMusic->setText(QCheckBox::tr("Enable frontend music")); - GBAlayout->addWidget(CBEnableFrontendMusic); - - QFrame * hr = new QFrame(AGGroupBox); - hr->setFrameStyle(QFrame::HLine); - hr->setLineWidth(3); - hr->setFixedHeight(10); - GBAlayout->addWidget(hr); - - QLabel * resolution = new QLabel(AGGroupBox); - resolution->setText(QLabel::tr("Resolution")); - GBAreslayout->addWidget(resolution); - - CBResolution = new QComboBox(AGGroupBox); - GBAreslayout->addWidget(CBResolution); - GBAlayout->addLayout(GBAreslayout); - connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int))); - - CBFullscreen = new QCheckBox(AGGroupBox); - CBFullscreen->setText(QCheckBox::tr("Fullscreen")); - GBAlayout->addWidget(CBFullscreen); - connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int))); - - QLabel * quality = new QLabel(AGGroupBox); - quality->setText(QLabel::tr("Quality")); - quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - GBAqualayout->addWidget(quality); - - SLQuality = new QSlider(Qt::Horizontal, AGGroupBox); - SLQuality->setTickPosition(QSlider::TicksBelow); - SLQuality->setMaximum(5); - SLQuality->setMinimum(0); - SLQuality->setFixedWidth(150); - GBAqualayout->addWidget(SLQuality); - GBAlayout->addLayout(GBAqualayout); - connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int))); - - QLabel * stereo = new QLabel(AGGroupBox); - stereo->setText(QLabel::tr("Stereo rendering")); - GBAstereolayout->addWidget(stereo); - - CBStereoMode = new QComboBox(AGGroupBox); - CBStereoMode->addItem(QComboBox::tr("Disabled")); - CBStereoMode->addItem(QComboBox::tr("Red/Cyan")); - CBStereoMode->addItem(QComboBox::tr("Cyan/Red")); - CBStereoMode->addItem(QComboBox::tr("Red/Blue")); - CBStereoMode->addItem(QComboBox::tr("Blue/Red")); - CBStereoMode->addItem(QComboBox::tr("Red/Green")); - CBStereoMode->addItem(QComboBox::tr("Green/Red")); - CBStereoMode->addItem(QComboBox::tr("Side-by-side")); - CBStereoMode->addItem(QComboBox::tr("Top-Bottom")); - CBStereoMode->addItem(QComboBox::tr("Wiggle")); - CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale")); - CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale")); - CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale")); - CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale")); - CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale")); - CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale")); - connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int))); - - GBAstereolayout->addWidget(CBStereoMode); - GBAlayout->addLayout(GBAstereolayout); - - hr = new QFrame(AGGroupBox); - hr->setFrameStyle(QFrame::HLine); - hr->setLineWidth(3); - hr->setFixedHeight(10); - GBAlayout->addWidget(hr); - - QHBoxLayout * GBAvollayout = new QHBoxLayout(0); - QLabel * vol = new QLabel(AGGroupBox); - vol->setText(QLabel::tr("Initial sound volume")); - GBAvollayout->addWidget(vol); - GBAlayout->addLayout(GBAvollayout); - volumeBox = new QSpinBox(AGGroupBox); - volumeBox->setRange(0, 100); - volumeBox->setSingleStep(5); - GBAvollayout->addWidget(volumeBox); - - CBEnableSound = new QCheckBox(AGGroupBox); - CBEnableSound->setText(QCheckBox::tr("Enable sound")); - GBAlayout->addWidget(CBEnableSound); - - CBEnableMusic = new QCheckBox(AGGroupBox); - CBEnableMusic->setText(QCheckBox::tr("Enable music")); - GBAlayout->addWidget(CBEnableMusic); - - hr = new QFrame(AGGroupBox); - hr->setFrameStyle(QFrame::HLine); - hr->setLineWidth(3); - hr->setFixedHeight(10); - GBAlayout->addWidget(hr); - - QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); - QLabel * maxfps = new QLabel(AGGroupBox); - maxfps->setText(QLabel::tr("FPS limit")); - GBAfpslayout->addWidget(maxfps); - GBAlayout->addLayout(GBAfpslayout); - fpsedit = new FPSEdit(AGGroupBox); - GBAfpslayout->addWidget(fpsedit); - - CBShowFPS = new QCheckBox(AGGroupBox); - CBShowFPS->setText(QCheckBox::tr("Show FPS")); - GBAlayout->addWidget(CBShowFPS); - - hr = new QFrame(AGGroupBox); - hr->setFrameStyle(QFrame::HLine); - hr->setLineWidth(3); - hr->setFixedHeight(10); - GBAlayout->addWidget(hr); - - QLabel *restartNote = new QLabel(this); - restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply")); - restartNote->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - GBAlayout->addWidget(restartNote); - - gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1); - } - - BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 2, 2, true); - BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); - BtnBack->setFixedHeight(BtnSaveOptions->height()); - BtnBack->setFixedWidth(BtnBack->width()+2); - BtnBack->setStyleSheet("QPushButton{margin: 22px 0 9px 2px;}"); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - previousQuality = this->SLQuality->value(); - previousResolutionIndex = this->CBResolution->currentIndex(); - previousFullscreenValue = this->CBFullscreen->isChecked(); -} - -void PageOptions::forceFullscreen(int index) -{ - bool forced = (index == 7 || index == 8 || index == 9); - - if (index != 0) { - this->SLQuality->setValue(this->SLQuality->maximum()); - this->SLQuality->setEnabled(false); - this->CBFullscreen->setEnabled(!forced); - this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue); - this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex); - } else { - this->SLQuality->setEnabled(true); - this->CBFullscreen->setEnabled(true); - this->SLQuality->setValue(previousQuality); - this->CBFullscreen->setChecked(previousFullscreenValue); - this->CBResolution->setCurrentIndex(previousResolutionIndex); - } -} - -void PageOptions::setQuality(int value) -{ - int index = this->CBStereoMode->currentIndex(); - if (index == 0) - previousQuality = this->SLQuality->value(); -} - -void PageOptions::setFullscreen(int state) -{ - int index = this->CBStereoMode->currentIndex(); - if (index != 7 && index != 8 && index != 9) - previousFullscreenValue = this->CBFullscreen->isChecked(); -} - -void PageOptions::setResolution(int state) -{ - int index = this->CBStereoMode->currentIndex(); - if (index != 7 && index != 8 && index != 9) - previousResolutionIndex = this->CBResolution->currentIndex(); -} - -void PageOptions::trimNetNick() -{ - editNetNick->setText(editNetNick->text().trimmed()); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageoptions.h --- a/QTfrontend/pageoptions.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_OPTIONS_H -#define PAGE_OPTIONS_H - -#include "AbstractPage.h" - -class FPSEdit; -class IconedGroupBox; - -class PageOptions : public AbstractPage -{ - Q_OBJECT - -public: - PageOptions(QWidget* parent = 0); - - QCheckBox *WeaponTooltip; - QPushButton *WeaponNew; - QPushButton *WeaponEdit; - QPushButton *WeaponDelete; - QComboBox *WeaponsName; - QPushButton *SchemeNew; - QPushButton *SchemeEdit; - QPushButton *SchemeDelete; - QComboBox *SchemesName; - - QComboBox *CBLanguage; - - IconedGroupBox *teamsBox; - QPushButton *BtnNewTeam; - QPushButton *BtnEditTeam; - QPushButton *BtnDeleteTeam; - QPushButton *BtnAssociateFiles; - QLabel *LblNoEditTeam; - QComboBox *CBTeamName; - IconedGroupBox *AGGroupBox; - QComboBox *CBResolution; - QComboBox *CBStereoMode; - QCheckBox *CBEnableSound; - QCheckBox *CBEnableFrontendSound; - QCheckBox *CBEnableMusic; - QCheckBox *CBEnableFrontendMusic; - QCheckBox *CBFullscreen; - QCheckBox *CBFrontendFullscreen; - QCheckBox *CBShowFPS; - QCheckBox *CBAltDamage; - QCheckBox *CBNameWithDate; -#ifdef __APPLE__ - QCheckBox *CBAutoUpdate; -#endif - - FPSEdit *fpsedit; - QPushButton *BtnSaveOptions; - QLabel *labelNN; - QLabel *labelNetPassword; - QSpinBox * volumeBox; - QLineEdit *editNetNick; - QLineEdit *editNetPassword; - QSlider *SLQuality; - QCheckBox *CBFrontendEffects; - -private: - bool previousFullscreenValue; - int previousResolutionIndex; - int previousQuality; - QPushButton *BtnBack; - -private slots: - void forceFullscreen(int index); - void setFullscreen(int state); - void setResolution(int state); - void setQuality(int value); - void trimNetNick(); -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageplayrecord.cpp --- a/QTfrontend/pageplayrecord.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hwconsts.h" -#include "pageplayrecord.h" - -PagePlayDemo::PagePlayDemo(QWidget* parent) : AbstractPage(parent) -{ - QFont * font14 = new QFont("MS Shell Dlg", 14); - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setColumnStretch(0, 1); - pageLayout->setColumnStretch(1, 2); - pageLayout->setColumnStretch(2, 1); - pageLayout->setRowStretch(2, 100); - - BtnPlayDemo = new QPushButton(this); - BtnPlayDemo->setFont(*font14); - BtnPlayDemo->setText(QPushButton::tr("Play demo")); - pageLayout->addWidget(BtnPlayDemo, 3, 2); - - BtnRenameRecord = new QPushButton(this); - BtnRenameRecord->setText(QPushButton::tr("Rename")); - pageLayout->addWidget(BtnRenameRecord, 0, 2); - - BtnRemoveRecord = new QPushButton(this); - BtnRemoveRecord->setText(QPushButton::tr("Delete")); - pageLayout->addWidget(BtnRemoveRecord, 1, 2); - - DemosList = new QListWidget(this); - DemosList->setGeometry(QRect(170, 10, 311, 311)); - pageLayout->addWidget(DemosList, 0, 1, 3, 1); - - connect(BtnRenameRecord, SIGNAL(clicked()), this, SLOT(renameRecord())); - connect(BtnRemoveRecord, SIGNAL(clicked()), this, SLOT(removeRecord())); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); -} - -void PagePlayDemo::FillFromDir(RecordType rectype) -{ - QDir dir; - QString extension; - - recType = rectype; - - dir.cd(cfgdir->absolutePath()); - if (rectype == RT_Demo) - { - dir.cd("Demos"); - extension = "hwd"; - BtnPlayDemo->setText(QPushButton::tr("Play demo")); - } else - { - dir.cd("Saves"); - extension = "hws"; - BtnPlayDemo->setText(QPushButton::tr("Load")); - } - dir.setFilter(QDir::Files); - - QStringList sl = dir.entryList(QStringList(QString("*.%2.%1").arg(extension, *cProtoVer))); - sl.replaceInStrings(QRegExp(QString("^(.*)\\.%2\\.%1$").arg(extension, *cProtoVer)), "\\1"); - - DemosList->clear(); - DemosList->addItems(sl); - - for (int i = 0; i < DemosList->count(); ++i) - { - DemosList->item(i)->setData(Qt::UserRole, dir.absoluteFilePath(QString("%1.%3.%2").arg(sl[i], extension, *cProtoVer))); - DemosList->item(i)->setIcon(recType == RT_Demo ? QIcon(":/res/file_demo.png") : QIcon(":/res/file_save.png")); - } -} - -void PagePlayDemo::renameRecord() -{ - QListWidgetItem * curritem = DemosList->currentItem(); - if (!curritem) - { - QMessageBox::critical(this, - tr("Error"), - tr("Please select record from the list"), - tr("OK")); - return ; - } - QFile rfile(curritem->data(Qt::UserRole).toString()); - - QFileInfo finfo(rfile); - - bool ok; - - QString newname = QInputDialog::getText(this, tr("Rename dialog"), tr("Enter new file name:"), QLineEdit::Normal, finfo.completeBaseName().replace("." + *cProtoVer, ""), &ok); - - if(ok && newname.size()) - { - QString newfullname = QString("%1/%2.%3.%4") - .arg(finfo.absolutePath()) - .arg(newname) - .arg(*cProtoVer) - .arg(finfo.suffix()); - - ok = rfile.rename(newfullname); - if(!ok) - QMessageBox::critical(this, tr("Error"), tr("Cannot rename to") + newfullname); - else - FillFromDir(recType); - } -} - -void PagePlayDemo::removeRecord() -{ - QListWidgetItem * curritem = DemosList->currentItem(); - if (!curritem) - { - QMessageBox::critical(this, - tr("Error"), - tr("Please select record from the list"), - tr("OK")); - return ; - } - QFile rfile(curritem->data(Qt::UserRole).toString()); - - bool ok; - - ok = rfile.remove(); - if(!ok) - QMessageBox::critical(this, tr("Error"), tr("Cannot delete file")); - else - FillFromDir(recType); -} - -bool PagePlayDemo::isSave() -{ - return recType == RT_Save; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageplayrecord.h --- a/QTfrontend/pageplayrecord.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PLAYRECORDPAGE_H -#define PLAYRECORDPAGE_H - -#include - -#include "AbstractPage.h" - -class QPushButton; -class QListWidget; - -class PagePlayDemo : public AbstractPage -{ - Q_OBJECT - -public: - enum RecordType { - RT_Demo, - RT_Save - }; - - PagePlayDemo(QWidget* parent = 0); - - void FillFromDir(RecordType rectype); - bool isSave(); - - QPushButton *BtnPlayDemo; - QPushButton *BtnRenameRecord; - QPushButton *BtnRemoveRecord; - QListWidget *DemosList; - -private: - RecordType recType; - QPushButton *BtnBack; - -private slots: - void renameRecord(); - void removeRecord(); -}; - - -#endif // PLAYRECORDPAGE_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageroomslist.cpp --- a/QTfrontend/pageroomslist.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,399 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ammoSchemeModel.h" -#include "pageroomslist.h" -#include "hwconsts.h" -#include "chatwidget.h" - -PageRoomsList::PageRoomsList(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli) : - AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - - QHBoxLayout * newRoomLayout = new QHBoxLayout(); - QLabel * roomNameLabel = new QLabel(this); - roomNameLabel->setText(tr("Room Name:")); - roomName = new QLineEdit(this); - roomName->setMaxLength(60); - newRoomLayout->addWidget(roomNameLabel); - newRoomLayout->addWidget(roomName); - pageLayout->addLayout(newRoomLayout, 0, 0, 1, 2); - - roomsList = new QTableWidget(this); - roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); - roomsList->verticalHeader()->setVisible(false); - roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); - roomsList->setAlternatingRowColors(true); - roomsList->setShowGrid(false); - roomsList->setSelectionMode(QAbstractItemView::SingleSelection); - pageLayout->addWidget(roomsList, 1, 0, 3, 2); - pageLayout->setRowStretch(2, 100); - - QHBoxLayout * filterLayout = new QHBoxLayout(); - - QLabel * stateLabel = new QLabel(this); - stateLabel->setText(tr("State:")); - CBState = new QComboBox(this); - CBState->addItem(QComboBox::tr("Any")); - CBState->addItem(QComboBox::tr("In lobby")); - CBState->addItem(QComboBox::tr("In progress")); - filterLayout->addWidget(stateLabel); - filterLayout->addWidget(CBState); - filterLayout->addSpacing(30); - - QLabel * ruleLabel = new QLabel(this); - ruleLabel->setText(tr("Rules:")); - CBRules = new QComboBox(this); - CBRules->addItem(QComboBox::tr("Any")); - // not the most elegant solution but it works - ammoSchemeModel = new AmmoSchemeModel(this, NULL); - for (int i = 0; i < ammoSchemeModel->predefSchemesNames.count(); i++) - CBRules->addItem(ammoSchemeModel->predefSchemesNames.at(i).toAscii().constData()); - filterLayout->addWidget(ruleLabel); - filterLayout->addWidget(CBRules); - filterLayout->addSpacing(30); - - QLabel * weaponLabel = new QLabel(this); - weaponLabel->setText(tr("Weapons:")); - CBWeapons = new QComboBox(this); - CBWeapons->addItem(QComboBox::tr("Any")); - for (int i = 0; i < cDefaultAmmos.count(); i++) { - QPair ammo = cDefaultAmmos.at(i); - CBWeapons->addItem(ammo.first.toAscii().constData()); - } - filterLayout->addWidget(weaponLabel); - filterLayout->addWidget(CBWeapons); - filterLayout->addSpacing(30); - - QLabel * searchLabel = new QLabel(this); - searchLabel->setText(tr("Search:")); - searchText = new QLineEdit(this); - searchText->setMaxLength(60); - filterLayout->addWidget(searchLabel); - filterLayout->addWidget(searchText); - - pageLayout->addLayout(filterLayout, 4, 0, 1, 2); - - chatWidget = new HWChatWidget(this, gameSettings, sdli, false); - pageLayout->addWidget(chatWidget, 5, 0, 1, 3); - pageLayout->setRowStretch(5, 350); - - BtnCreate = addButton(tr("Create"), pageLayout, 0, 2); - BtnJoin = addButton(tr("Join"), pageLayout, 1, 2); - BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 2); - BtnClear = addButton(tr("Clear"), pageLayout, 4, 2); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 6, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - lblCount = new QLabel(this); - pageLayout->addWidget(lblCount, 6, 1, Qt::AlignHCenter); - lblCount->setText("?"); - lblCount->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); - - connect(chatWidget, SIGNAL(nickCountUpdate(const int)), this, SLOT(updateNickCounter(const int))); - - BtnAdmin = addButton(tr("Admin features"), pageLayout, 6, 2); - - connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); - connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); - connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); - connect(BtnClear, SIGNAL(clicked()), this, SLOT(onClearClick())); - connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); - connect(CBState, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick())); - connect(CBRules, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick())); - connect(CBWeapons, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick())); - connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onRefreshClick())); - connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection); - - gameInLobby = false; -} - -void PageRoomsList::setAdmin(bool flag) -{ - BtnAdmin->setVisible(flag); -} - -void PageRoomsList::setRoomsList(const QStringList & list) -{ - QBrush red(QColor(255, 0, 0)); - QBrush orange(QColor(127, 127, 0)); - QBrush yellow(QColor(255, 255, 0)); - QBrush green(QColor(0, 255, 0)); - - listFromServer = list; - - QString selection = ""; - - if(QTableWidgetItem *item = roomsList->item(roomsList->currentRow(), 0)) - selection = item->text(); - - roomsList->clear(); - roomsList->setColumnCount(7); - roomsList->setHorizontalHeaderLabels( - QStringList() << - QTableWidget::tr("Room Name") << - QTableWidget::tr("C") << - QTableWidget::tr("T") << - QTableWidget::tr("Owner") << - QTableWidget::tr("Map") << - QTableWidget::tr("Rules") << - QTableWidget::tr("Weapons") - ); - - // set minimum sizes -// roomsList->horizontalHeader()->resizeSection(0, 200); -// roomsList->horizontalHeader()->resizeSection(1, 50); -// roomsList->horizontalHeader()->resizeSection(2, 50); -// roomsList->horizontalHeader()->resizeSection(3, 100); -// roomsList->horizontalHeader()->resizeSection(4, 100); -// roomsList->horizontalHeader()->resizeSection(5, 100); -// roomsList->horizontalHeader()->resizeSection(6, 100); - - // set resize modes -// roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); - - bool gameCanBeJoined = true; - - if (list.size() % 8) - return; - - roomsList->setRowCount(list.size() / 8); - for(int i = 0, r = 0; i < list.size(); i += 8, r++) - { - // if we are joining a game - // TODO: Should NOT be done here - if (gameInLobby) { - if (gameInLobbyName == list[i + 1]) { - gameCanBeJoined = list[i].compare("True"); - } - } - - // check filter settings - #define NO_FILTER_MATCH roomsList->setRowCount(roomsList->rowCount() - 1); --r; continue - - if (list[i].compare("True") && CBState->currentIndex() == 2) { NO_FILTER_MATCH; } - if (list[i].compare("False") && CBState->currentIndex() == 1) { NO_FILTER_MATCH; } - if (CBRules->currentIndex() != 0 && list[i + 6].compare(CBRules->currentText())) { NO_FILTER_MATCH; } - if (CBWeapons->currentIndex() != 0 && list[i + 7].compare(CBWeapons->currentText())) { NO_FILTER_MATCH; } - bool found = list[i + 1].contains(searchText->text(), Qt::CaseInsensitive); - if (!found) { - for (int a = 4; a <= 7; ++a) { - QString compString = list[i + a]; - if (a == 5 && compString == "+rnd+") { - compString = "Random Map"; - } else if (a == 5 && compString == "+maze+") { - compString = "Random Maze"; - } else if (a == 5 && compString == "+drawn+") { - compString = "Drawn Map"; - } - if (compString.contains(searchText->text(), Qt::CaseInsensitive)) { - found = true; - break; - } - } - } - if (!searchText->text().isEmpty() && !found) { NO_FILTER_MATCH; } - - QTableWidgetItem * item; - item = new QTableWidgetItem(list[i + 1]); // room name - item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - - // pick appropriate room icon and tooltip (game in progress yes/no; later maybe locked rooms etc.) - if(list[i].compare("True")) - { - item->setIcon(QIcon(":/res/iconTime.png"));// game is in lobby - item->setToolTip(tr("This game is in lobby.\nYou may join and start playing once the game starts.")); - } - else - { - item->setIcon(QIcon(":/res/iconDamage.png"));// game has started - item->setToolTip(tr("This game is in progress.\nYou may join and spectate now but you'll have to wait for the game to end to start playing.")); - } - - roomsList->setItem(r, 0, item); - - item = new QTableWidgetItem(list[i + 2]); // number of clients - item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - item->setTextAlignment(Qt::AlignCenter); - item->setToolTip(tr("There are %1 clients connected to this room.", "", list[i + 2].toInt()).arg(list[i + 2])); - roomsList->setItem(r, 1, item); - - item = new QTableWidgetItem(list[i + 3]); // number of teams - item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - item->setTextAlignment(Qt::AlignCenter); - item->setToolTip(tr("There are %1 teams participating in this room.", "", list[i + 3].toInt()).arg(list[i + 3])); - //Should we highlight "full" games? Might get misinterpreted - //if(list[i + 3].toInt() >= cMaxTeams) - // item->setForeground(red); - roomsList->setItem(r, 2, item); - - item = new QTableWidgetItem(list[i + 4].left(15)); // name of host - item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - item->setToolTip(tr("%1 is the host. He may adjust settings and start the game.").arg(list[i + 4])); - roomsList->setItem(r, 3, item); - - if(list[i + 5] == "+rnd+") - { - item = new QTableWidgetItem(tr("Random Map")); // selected map (is randomized) -// FIXME - need real icons. Disabling until then -// item->setIcon(QIcon(":/res/mapRandom.png")); - } - else if (list[i+5] == "+maze+") - { - item = new QTableWidgetItem(tr("Random Maze")); -// FIXME - need real icons. Disabling until then -// item->setIcon(QIcon(":/res/mapMaze.png")); - } - else - { - item = new QTableWidgetItem(list[i + 5]); // selected map - - // check to see if we've got this map - // not perfect but a start - if(!mapList->contains(list[i + 5])) - { - item->setForeground(red); - item->setIcon(QIcon(":/res/mapMissing.png")); - } - else - { - // todo: mission icon? -// FIXME - need real icons. Disabling until then -// item->setIcon(QIcon(":/res/mapCustom.png")); - } - } - - item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - item->setToolTip(tr("Games may be played on precreated or randomized maps.")); - roomsList->setItem(r, 4, item); - - item = new QTableWidgetItem(list[i + 6].left(24)); // selected game scheme - item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - item->setToolTip(tr("The Game Scheme defines general options and preferences like Round Time, Sudden Death or Vampirism.")); - roomsList->setItem(r, 5, item); - - item = new QTableWidgetItem(list[i + 7].left(24)); // selected weapon scheme - item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count.")); - roomsList->setItem(r, 6, item); - - if(!list[i + 1].compare(selection) && !selection.isEmpty()) - roomsList->selectionModel()->setCurrentIndex(roomsList->model()->index(r, 0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); - } - - roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); - roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents); - roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents); - - // TODO: Should NOT be done here - if (gameInLobby) { - gameInLobby = false; - if (gameCanBeJoined) { - emit askForJoinRoom(gameInLobbyName); - } else { - emit askJoinConfirmation(gameInLobbyName); - } - } - -// roomsList->resizeColumnsToContents(); -} - -void PageRoomsList::onCreateClick() -{ - if (roomName->text().size()) - emit askForCreateRoom(roomName->text()); - else - QMessageBox::critical(this, - tr("Error"), - tr("Please enter room name"), - tr("OK")); -} - -void PageRoomsList::onJoinClick() -{ - QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); - if (!curritem) - { - QMessageBox::critical(this, - tr("Error"), - tr("Please select room from the list"), - tr("OK")); - return; - } - - for (int i = 0; i < listFromServer.size(); i += 8) { - if (listFromServer[i + 1] == curritem->data(Qt::DisplayRole).toString()) { - gameInLobby = listFromServer[i].compare("True"); - break; - } - } - - if (gameInLobby) { - gameInLobbyName = curritem->data(Qt::DisplayRole).toString(); - emit askForRoomList(); - } else { - emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); - } -} - -void PageRoomsList::onRefreshClick() -{ - emit askForRoomList(); -} - -void PageRoomsList::onClearClick() -{ - CBState->setCurrentIndex(0); - CBRules->setCurrentIndex(0); - CBWeapons->setCurrentIndex(0); - searchText->clear(); -} - -void PageRoomsList::onJoinConfirmation(const QString & room) -{ - if (QMessageBox::warning(this, - tr("Warning"), - tr("The game you are trying to join has started.\nDo you still want to join the room?"), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) - { - emit askForJoinRoom(room); - } -} - -void PageRoomsList::updateNickCounter(int cnt) -{ - lblCount->setText(tr("%1 players online", 0, cnt).arg(cnt)); -} - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageroomslist.h --- a/QTfrontend/pageroomslist.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_ROOMLIST_H -#define PAGE_ROOMLIST_H - -#include "AbstractPage.h" -#include "SDLs.h" - -class HWChatWidget; -class AmmoSchemeModel; - -class PageRoomsList : public AbstractPage -{ - Q_OBJECT - -public: - PageRoomsList(QWidget* parent, QSettings * config, SDLInteraction * sdli); - - QLineEdit * roomName; - QLineEdit * searchText; - QTableWidget * roomsList; - QPushButton * BtnCreate; - QPushButton * BtnJoin; - QPushButton * BtnRefresh; - QPushButton * BtnAdmin; - QPushButton * BtnClear; - QComboBox * CBState; - QComboBox * CBRules; - QComboBox * CBWeapons; - HWChatWidget * chatWidget; - QLabel * lblCount; - -private: - bool gameInLobby; - QString gameInLobbyName; - QStringList listFromServer; - AmmoSchemeModel * ammoSchemeModel; - QPushButton * BtnBack; - -public slots: - void setRoomsList(const QStringList & list); - void setAdmin(bool); - void updateNickCounter(int cnt); - -private slots: - void onCreateClick(); - void onJoinClick(); - void onRefreshClick(); - void onClearClick(); - void onJoinConfirmation(const QString &); - -signals: - void askForCreateRoom(const QString &); - void askForJoinRoom(const QString &); - void askForRoomList(); - void askJoinConfirmation(const QString &); -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagescheme.cpp --- a/QTfrontend/pagescheme.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,492 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ammoSchemeModel.h" -#include "pagescheme.h" -#include "misc.h" - -PageScheme::PageScheme(QWidget* parent) : - AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - QGroupBox * gb = new QGroupBox(this); - - QGridLayout * gl = new QGridLayout(); - gb->setLayout(gl); - QSizePolicy sp; - sp.setVerticalPolicy(QSizePolicy::MinimumExpanding); - sp.setHorizontalPolicy(QSizePolicy::Expanding); - - pageLayout->addWidget(gb, 1,0,13,5); - - gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb); - gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb); - - gbGameModes->setStyleSheet(".QGroupBox {" - "background-color: #130f2c; background-image:url();" - "}"); - gbBasicSettings->setStyleSheet(".QGroupBox {" - "background-color: #130f2c; background-image:url();" - "}"); - - gbGameModes->setSizePolicy(sp); - gbBasicSettings->setSizePolicy(sp); - gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop); - gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop); - - QGridLayout * glGMLayout = new QGridLayout(gbGameModes); - QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings); - gbGameModes->setLayout(glGMLayout); - gbBasicSettings->setLayout(glBSLayout); - // Left - - TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png"); - TBW_mode_Forts->setToolTip("" + ToggleButtonWidget::tr("Fort Mode") + ":
" + 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.png"); - TBW_teamsDivide->setToolTip("" + ToggleButtonWidget::tr("Divide Teams") + ":
" + tr("Teams will start on opposite sides of the terrain, two team colours max!")); - glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1); - - TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid.png"); - TBW_solid->setToolTip("" + ToggleButtonWidget::tr("Solid Land") + ":
" + tr("Land can not be destroyed!")); - glGMLayout->addWidget(TBW_solid,0,2,1,1); - - TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder.png"); - TBW_border->setToolTip("" + ToggleButtonWidget::tr("Add Border") + ":
" + tr("Add an indestructible border around the terrain")); - glGMLayout->addWidget(TBW_border,0,3,1,1); - - TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png"); - TBW_lowGravity->setToolTip("" + ToggleButtonWidget::tr("Low Gravity") + ":
" + tr("Lower gravity")); - glGMLayout->addWidget(TBW_lowGravity,0,4,1,1); - - TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png"); - TBW_laserSight->setToolTip("" + ToggleButtonWidget::tr("Laser Sight") + ":
" + tr("Assisted aiming with laser sight")); - glGMLayout->addWidget(TBW_laserSight,1,0,1,1); - - TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png"); - TBW_invulnerable->setToolTip("" + ToggleButtonWidget::tr("Invulnerable") + ":
" + tr("All hogs have a personal forcefield")); - glGMLayout->addWidget(TBW_invulnerable,1,1,1,1); - - TBW_resethealth = new ToggleButtonWidget(gbGameModes, ":/res/btnResetHealth.png"); - TBW_resethealth->setToolTip("" + ToggleButtonWidget::tr("Reset Health") + ":
" + tr("All (living) hedgehogs are fully restored at the end of turn")); - glGMLayout->addWidget(TBW_resethealth,1,2,1,1); - - TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png"); - TBW_vampiric->setToolTip("" + ToggleButtonWidget::tr("Vampirism") + ":
" + 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.png"); - TBW_karma->setToolTip("" + ToggleButtonWidget::tr("Karma") + ":
" + tr("Share your opponents pain, share their damage")); - glGMLayout->addWidget(TBW_karma,1,4,1,1); - - TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png"); - TBW_artillery->setToolTip("" + ToggleButtonWidget::tr("Artillery") + ":
" + tr("Your hogs are unable to move, put your artillery skills to the test")); - glGMLayout->addWidget(TBW_artillery,2,0,1,1); - - TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder.png"); - TBW_randomorder->setToolTip("" + ToggleButtonWidget::tr("Random Order") + ":
" + tr("Order of play is random instead of in room order.")); - glGMLayout->addWidget(TBW_randomorder,2,1,1,1); - - TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing.png"); - TBW_king->setToolTip("" + ToggleButtonWidget::tr("King") + ":
" + tr("Play with a King. If he dies, your side dies.")); - glGMLayout->addWidget(TBW_king,2,2,1,1); - - TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png"); - TBW_placehog->setToolTip("" + ToggleButtonWidget::tr("Place Hedgehogs") + ":
" + tr("Take turns placing your hedgehogs before the start of play.")); - glGMLayout->addWidget(TBW_placehog,2,3,1,1); - - TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo.png"); - TBW_sharedammo->setToolTip("" + ToggleButtonWidget::tr("Clan Shares Ammo") + ":
" + 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.png"); - TBW_disablegirders->setToolTip("" + ToggleButtonWidget::tr("Disable Girders") + ":
" + tr("Disable girders when generating random maps.")); - glGMLayout->addWidget(TBW_disablegirders,3,0,1,1); - - TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects.png"); - TBW_disablelandobjects->setToolTip("" + ToggleButtonWidget::tr("Disable Land Objects") + ":
" + tr("Disable land objects when generating random maps.")); - glGMLayout->addWidget(TBW_disablelandobjects,3,1,1,1); - - TBW_aisurvival = new ToggleButtonWidget(gbGameModes, ":/res/btnAISurvival.png"); - TBW_aisurvival->setToolTip("" + ToggleButtonWidget::tr("AI Survival Mode") + ":
" + tr("AI respawns on death.")); - glGMLayout->addWidget(TBW_aisurvival,3,2,1,1); - - TBW_infattack = new ToggleButtonWidget(gbGameModes, ":/res/btnInfAttack.png"); - TBW_infattack->setToolTip("" + ToggleButtonWidget::tr("Unlimited Attacks") + ":
" + tr("Attacking does not end your turn.")); - glGMLayout->addWidget(TBW_infattack,3,3,1,1); - - TBW_resetweps = new ToggleButtonWidget(gbGameModes, ":/res/btnResetWeps.png"); - TBW_resetweps->setToolTip("" + ToggleButtonWidget::tr("Reset Weapons") + ":
" + tr("Weapons are reset to starting values each turn.")); - glGMLayout->addWidget(TBW_resetweps,3,4,1,1); - - TBW_perhogammo = new ToggleButtonWidget(gbGameModes, ":/res/btnPerHogAmmo.png"); - TBW_perhogammo->setToolTip("" + ToggleButtonWidget::tr("Per Hedgehog Ammo") + ":
" + tr("Each hedgehog has its own ammo. It does not share with the team.")); - glGMLayout->addWidget(TBW_perhogammo,4,0,1,1); - - TBW_nowind = new ToggleButtonWidget(gbGameModes, ":/res/btnNoWind.png"); - TBW_nowind->setToolTip("" + ToggleButtonWidget::tr("Disable Wind") + ":
" + tr("You will not have to worry about wind anymore.")); - glGMLayout->addWidget(TBW_nowind,4,1,1,1); - - TBW_morewind = new ToggleButtonWidget(gbGameModes, ":/res/btnMoreWind.png"); - TBW_morewind->setToolTip("" + ToggleButtonWidget::tr("More Wind") + ":
" + tr("Wind will affect almost everything.")); - glGMLayout->addWidget(TBW_morewind,4,2,1,1); - - TBW_tagteam = new ToggleButtonWidget(gbGameModes, ":/res/btnTagTeam.png"); - TBW_tagteam->setToolTip("" + ToggleButtonWidget::tr("Tag Team") + ":
" + 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.png"); - TBW_bottomborder->setToolTip("" + ToggleButtonWidget::tr("Add Bottom Border") + ":
" + tr("Add an indestructible border along the bottom")); - glGMLayout->addWidget(TBW_bottomborder,4,4,1,1); - - - // Right - QLabel * l; - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Damage Modifier")); - l->setWordWrap(true); - glBSLayout->addWidget(l,0,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconDamage.png")); - glBSLayout->addWidget(l,0,1,1,1); - SB_DamageModifier = new QSpinBox(gbBasicSettings); - SB_DamageModifier->setRange(10, 300); - SB_DamageModifier->setValue(100); - SB_DamageModifier->setSingleStep(25); - glBSLayout->addWidget(SB_DamageModifier,0,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Turn Time")); - l->setWordWrap(true); - glBSLayout->addWidget(l,1,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconTime.png")); - glBSLayout->addWidget(l,1,1,1,1); - SB_TurnTime = new QSpinBox(gbBasicSettings); - SB_TurnTime->setRange(1, 9999); - SB_TurnTime->setValue(45); - SB_TurnTime->setSingleStep(15); - glBSLayout->addWidget(SB_TurnTime,1,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Initial Health")); - l->setWordWrap(true); - glBSLayout->addWidget(l,2,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconHealth.png")); - glBSLayout->addWidget(l,2,1,1,1); - SB_InitHealth = new QSpinBox(gbBasicSettings); - SB_InitHealth->setRange(50, 200); - SB_InitHealth->setValue(100); - SB_InitHealth->setSingleStep(25); - glBSLayout->addWidget(SB_InitHealth,2,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Sudden Death Timeout")); - l->setWordWrap(true); - glBSLayout->addWidget(l,3,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); - glBSLayout->addWidget(l,3,1,1,1); - SB_SuddenDeath = new QSpinBox(gbBasicSettings); - SB_SuddenDeath->setRange(0, 50); - SB_SuddenDeath->setValue(15); - SB_SuddenDeath->setSingleStep(3); - glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Sudden Death Water Rise")); - l->setWordWrap(true); - glBSLayout->addWidget(l,4,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); // TODO: icon - glBSLayout->addWidget(l,4,1,1,1); - SB_WaterRise = new QSpinBox(gbBasicSettings); - SB_WaterRise->setRange(0, 100); - SB_WaterRise->setValue(47); - SB_WaterRise->setSingleStep(5); - glBSLayout->addWidget(SB_WaterRise,4,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Sudden Death Health Decrease")); - l->setWordWrap(true); - glBSLayout->addWidget(l,5,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); // TODO: icon - glBSLayout->addWidget(l,5,1,1,1); - SB_HealthDecrease = new QSpinBox(gbBasicSettings); - SB_HealthDecrease->setRange(0, 100); - SB_HealthDecrease->setValue(5); - SB_HealthDecrease->setSingleStep(1); - glBSLayout->addWidget(SB_HealthDecrease,5,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("% Rope Length")); - l->setWordWrap(true); - glBSLayout->addWidget(l,6,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconRope.png")); - glBSLayout->addWidget(l,6,1,1,1); - SB_RopeModifier = new QSpinBox(gbBasicSettings); - SB_RopeModifier->setRange(25, 999); - SB_RopeModifier->setValue(100); - SB_RopeModifier->setSingleStep(25); - glBSLayout->addWidget(SB_RopeModifier,6,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Crate Drops")); - l->setWordWrap(true); - glBSLayout->addWidget(l,7,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconBox.png")); - glBSLayout->addWidget(l,7,1,1,1); - SB_CaseProb = new FreqSpinBox(gbBasicSettings); - SB_CaseProb->setRange(0, 9); - SB_CaseProb->setValue(5); - glBSLayout->addWidget(SB_CaseProb,7,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("% Health Crates")); - l->setWordWrap(true); - glBSLayout->addWidget(l,8,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon - glBSLayout->addWidget(l,8,1,1,1); - SB_HealthCrates = new QSpinBox(gbBasicSettings); - SB_HealthCrates->setRange(0, 100); - SB_HealthCrates->setValue(35); - SB_HealthCrates->setSingleStep(5); - glBSLayout->addWidget(SB_HealthCrates,8,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Health in Crates")); - l->setWordWrap(true); - glBSLayout->addWidget(l,9,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon - glBSLayout->addWidget(l,9,1,1,1); - SB_CrateHealth = new QSpinBox(gbBasicSettings); - SB_CrateHealth->setRange(0, 200); - SB_CrateHealth->setValue(25); - SB_CrateHealth->setSingleStep(5); - glBSLayout->addWidget(SB_CrateHealth,9,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Mines Time")); - l->setWordWrap(true); - glBSLayout->addWidget(l,10,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon - glBSLayout->addWidget(l,10,1,1,1); - SB_MinesTime = new QSpinBox(gbBasicSettings); - SB_MinesTime->setRange(-1, 5); - SB_MinesTime->setValue(3); - SB_MinesTime->setSingleStep(1); - SB_MinesTime->setSpecialValueText(tr("Random")); - SB_MinesTime->setSuffix(" "+ tr("Seconds")); - glBSLayout->addWidget(SB_MinesTime,10,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Mines")); - l->setWordWrap(true); - glBSLayout->addWidget(l,11,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon - glBSLayout->addWidget(l,11,1,1,1); - SB_Mines = new QSpinBox(gbBasicSettings); - SB_Mines->setRange(0, 80); - SB_Mines->setValue(0); - SB_Mines->setSingleStep(5); - glBSLayout->addWidget(SB_Mines,11,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("% Dud Mines")); - l->setWordWrap(true); - glBSLayout->addWidget(l,12,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconDud.png")); - glBSLayout->addWidget(l,12,1,1,1); - SB_MineDuds = new QSpinBox(gbBasicSettings); - SB_MineDuds->setRange(0, 100); - SB_MineDuds->setValue(0); - SB_MineDuds->setSingleStep(5); - glBSLayout->addWidget(SB_MineDuds,12,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Explosives")); - l->setWordWrap(true); - glBSLayout->addWidget(l,13,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconDamage.png")); - glBSLayout->addWidget(l,13,1,1,1); - SB_Explosives = new QSpinBox(gbBasicSettings); - SB_Explosives->setRange(0, 40); - SB_Explosives->setValue(0); - SB_Explosives->setSingleStep(1); - glBSLayout->addWidget(SB_Explosives,13,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("% Get Away Time")); - l->setWordWrap(true); - glBSLayout->addWidget(l,14,0,1,1); - l = new QLabel(gbBasicSettings); - l->setFixedSize(32,32); - l->setPixmap(QPixmap(":/res/iconTime.png")); - glBSLayout->addWidget(l,14,1,1,1); - SB_GetAwayTime = new QSpinBox(gbBasicSettings); - SB_GetAwayTime->setRange(0, 999); - SB_GetAwayTime->setValue(100); - SB_GetAwayTime->setSingleStep(25); - glBSLayout->addWidget(SB_GetAwayTime,14,2,1,1); - - l = new QLabel(gbBasicSettings); - l->setText(QLabel::tr("Scheme Name:")); - - LE_name = new QLineEdit(this); - - gl->addWidget(LE_name,15,1,1,5); - gl->addWidget(l,15,0,1,1); - - mapper = new QDataWidgetMapper(this); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 16, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - BtnCopy = addButton(tr("Copy"), pageLayout, 16, 2); - BtnNew = addButton(tr("New"), pageLayout, 16, 3); - BtnDelete = addButton(tr("Delete"), pageLayout, 16, 4); - - selectScheme = new QComboBox(this); - pageLayout->addWidget(selectScheme, 16, 1); - - connect(BtnCopy, SIGNAL(clicked()), this, SLOT(copyRow())); - connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow())); - connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow())); - connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int))); - connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int))); -} - -void PageScheme::setModel(QAbstractItemModel * model) -{ - mapper->setModel(model); - selectScheme->setModel(model); - - mapper->addMapping(LE_name, 0); - mapper->addMapping(TBW_mode_Forts, 1); - mapper->addMapping(TBW_teamsDivide, 2); - mapper->addMapping(TBW_solid, 3); - mapper->addMapping(TBW_border, 4); - mapper->addMapping(TBW_lowGravity, 5); - mapper->addMapping(TBW_laserSight, 6); - mapper->addMapping(TBW_invulnerable, 7); - mapper->addMapping(TBW_resethealth, 8); - mapper->addMapping(TBW_vampiric, 9); - mapper->addMapping(TBW_karma, 10); - mapper->addMapping(TBW_artillery, 11); - mapper->addMapping(TBW_randomorder, 12); - mapper->addMapping(TBW_king, 13); - mapper->addMapping(TBW_placehog, 14); - mapper->addMapping(TBW_sharedammo, 15); - mapper->addMapping(TBW_disablegirders, 16); - mapper->addMapping(TBW_disablelandobjects, 17); - mapper->addMapping(TBW_aisurvival, 18); - mapper->addMapping(TBW_infattack, 19); - mapper->addMapping(TBW_resetweps, 20); - mapper->addMapping(TBW_perhogammo, 21); - mapper->addMapping(TBW_nowind, 22); - mapper->addMapping(TBW_morewind, 23); - mapper->addMapping(TBW_tagteam, 24); - mapper->addMapping(TBW_bottomborder, 25); - mapper->addMapping(SB_DamageModifier, 26); - mapper->addMapping(SB_TurnTime, 27); - mapper->addMapping(SB_InitHealth, 28); - mapper->addMapping(SB_SuddenDeath, 29); - mapper->addMapping(SB_CaseProb, 30); - mapper->addMapping(SB_MinesTime, 31); - mapper->addMapping(SB_Mines, 32); - mapper->addMapping(SB_MineDuds, 33); - mapper->addMapping(SB_Explosives, 34); - mapper->addMapping(SB_HealthCrates, 35); - mapper->addMapping(SB_CrateHealth, 36); - mapper->addMapping(SB_WaterRise, 37); - mapper->addMapping(SB_HealthDecrease, 38); - mapper->addMapping(SB_RopeModifier, 39); - mapper->addMapping(SB_GetAwayTime, 40); - - mapper->toFirst(); -} - -void PageScheme::newRow() -{ - QAbstractItemModel * model = mapper->model(); - model->insertRow(-1); - selectScheme->setCurrentIndex(model->rowCount() - 1); -} - -void PageScheme::copyRow() -{ - QAbstractItemModel * model = mapper->model(); - model->insertRow(selectScheme->currentIndex()); - selectScheme->setCurrentIndex(model->rowCount() - 1); -} - -void PageScheme::deleteRow() -{ - QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel); - - if (reallyDelete.exec() == QMessageBox::Ok) { - QAbstractItemModel * model = mapper->model(); - model->removeRow(selectScheme->currentIndex()); - } -} - -void PageScheme::schemeSelected(int n) -{ - int c = ((AmmoSchemeModel*)mapper->model())->numberOfDefaultSchemes; - gbGameModes->setEnabled(n >= c); - gbBasicSettings->setEnabled(n >= c); - LE_name->setEnabled(n >= c); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagescheme.h --- a/QTfrontend/pagescheme.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_SCHEME_H -#define PAGE_SCHEME_H - -#include "AbstractPage.h" -#include "togglebutton.h" - -class FreqSpinBox; - -class PageScheme : public AbstractPage -{ - Q_OBJECT - -public: - PageScheme(QWidget* parent = 0); - - QPushButton * BtnCopy; - QPushButton * BtnNew; - QPushButton * BtnDelete; - QPushButton * BtnSave; - QComboBox * selectScheme; - - void setModel(QAbstractItemModel * model); - -public slots: - void newRow(); - void copyRow(); - void deleteRow(); - -private: - QPushButton * BtnBack; - - QDataWidgetMapper * mapper; - ToggleButtonWidget * TBW_mode_Forts; - ToggleButtonWidget * TBW_teamsDivide; - ToggleButtonWidget * TBW_solid; - ToggleButtonWidget * TBW_border; - ToggleButtonWidget * TBW_lowGravity; - ToggleButtonWidget * TBW_laserSight; - ToggleButtonWidget * TBW_invulnerable; - ToggleButtonWidget * TBW_resethealth; - ToggleButtonWidget * TBW_vampiric; - ToggleButtonWidget * TBW_karma; - ToggleButtonWidget * TBW_artillery; - ToggleButtonWidget * TBW_randomorder; - ToggleButtonWidget * TBW_king; - ToggleButtonWidget * TBW_placehog; - ToggleButtonWidget * TBW_sharedammo; - ToggleButtonWidget * TBW_disablegirders; - ToggleButtonWidget * TBW_disablelandobjects; - ToggleButtonWidget * TBW_aisurvival; - ToggleButtonWidget * TBW_infattack; - ToggleButtonWidget * TBW_resetweps; - ToggleButtonWidget * TBW_perhogammo; - ToggleButtonWidget * TBW_nowind; - ToggleButtonWidget * TBW_morewind; - ToggleButtonWidget * TBW_tagteam; - ToggleButtonWidget * TBW_bottomborder; - - QSpinBox * SB_DamageModifier; - QSpinBox * SB_TurnTime; - QSpinBox * SB_InitHealth; - QSpinBox * SB_SuddenDeath; - QSpinBox * SB_WaterRise; - QSpinBox * SB_HealthDecrease; - FreqSpinBox * SB_CaseProb; - QSpinBox * SB_HealthCrates; - QSpinBox * SB_CrateHealth; - QSpinBox * SB_MinesTime; - QSpinBox * SB_Mines; - QSpinBox * SB_MineDuds; - QSpinBox * SB_Explosives; - QSpinBox * SB_RopeModifier; - QSpinBox * SB_GetAwayTime; - QLineEdit * LE_name; - - QGroupBox * gbGameModes; - QGroupBox * gbBasicSettings; - -private slots: - void schemeSelected(int); - -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageselectweapon.cpp --- a/QTfrontend/pageselectweapon.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include - -#include "pageselectweapon.h" -#include "hwconsts.h" -#include "selectWeapon.h" - -PageSelectWeapon::PageSelectWeapon(QWidget* parent) : - AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - - pWeapons = new SelWeaponWidget(cAmmoNumber, this); - pageLayout->addWidget(pWeapons, 0, 0, 1, 5); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, 2, 1, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - BtnDefault = addButton(tr("Default"), pageLayout, 1, 3); - BtnNew = addButton(tr("New"), pageLayout, 1, 2); - BtnCopy = addButton(tr("Copy"), pageLayout, 2, 2); - BtnDelete = addButton(tr("Delete"), pageLayout, 2, 3); - BtnSave = addButton(":/res/Save.png", pageLayout, 1, 4, 2, 1, true); - BtnSave->setStyleSheet("QPushButton{margin: 24px 0px 0px 0px;}"); - BtnBack->setFixedHeight(BtnSave->height()); - BtnBack->setStyleSheet("QPushButton{margin-top: 31px;}"); - - selectWeaponSet = new QComboBox(this); - pageLayout->addWidget(selectWeaponSet, 1, 1, 2, 1); - - connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault())); - connect(BtnSave, SIGNAL(clicked()), pWeapons, SLOT(save())); - connect(BtnNew, SIGNAL(clicked()), pWeapons, SLOT(newWeaponsName())); - connect(BtnCopy, SIGNAL(clicked()), pWeapons, SLOT(copy())); - connect(selectWeaponSet, SIGNAL(currentIndexChanged(const QString&)), pWeapons, SLOT(setWeaponsName(const QString&))); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pageselectweapon.h --- a/QTfrontend/pageselectweapon.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_SELECTWEAPON_H -#define PAGE_SELECTWEAPON_H - -#include "AbstractPage.h" - -class SelWeaponWidget; - -class PageSelectWeapon : public AbstractPage -{ - Q_OBJECT - -public: - PageSelectWeapon(QWidget* parent = 0); - - QPushButton *BtnSave; - QPushButton *BtnDefault; - QPushButton *BtnDelete; - QPushButton *BtnNew; - QPushButton *BtnCopy; - SelWeaponWidget* pWeapons; - QComboBox* selectWeaponSet; - -private: - QPushButton *BtnBack; -}; - -#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagesingleplayer.cpp --- a/QTfrontend/pagesingleplayer.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pagesingleplayer.h" -#include "gamecfgwidget.h" - -PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) -{ - QVBoxLayout * vLayout = new QVBoxLayout(this); - QHBoxLayout * topLine = new QHBoxLayout(); - QHBoxLayout * middleLine = new QHBoxLayout(); - QHBoxLayout * bottomLine = new QHBoxLayout(); - vLayout->addStretch(); - vLayout->addLayout(topLine); - vLayout->addSpacing(30); - vLayout->addLayout(middleLine); - vLayout->addStretch(); - vLayout->addLayout(bottomLine); - - topLine->addStretch(); - BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); - BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); - topLine->addSpacing(60); - BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); - BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); - topLine->addStretch(); - - - BtnCampaignPage = addButton(":/res/Campaign.png", middleLine, 0, true); - BtnCampaignPage->setToolTip(tr("Campaign Mode (...). IN DEVELOPMENT")); - BtnCampaignPage->setVisible(false); - - BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 1, true); - BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT")); - - - BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); - - - bottomLine->addStretch(); - - BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); - BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); - BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true); - BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); - BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); - BtnBack->setFixedHeight(BtnLoad->height()); - BtnBack->setStyleSheet("QPushButton{margin-top: 31px;}"); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagesingleplayer.h --- a/QTfrontend/pagesingleplayer.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_SINGLE_PLAYER_H -#define PAGE_SINGLE_PLAYER_H - -#include "AbstractPage.h" - -class GameCFGWidget; - -class PageSinglePlayer : public AbstractPage -{ - Q_OBJECT - -public: - PageSinglePlayer(QWidget* parent = 0); - - QPushButton *BtnSimpleGamePage; - QPushButton *BtnTrainPage; - QPushButton *BtnCampaignPage; - QPushButton *BtnMultiplayer; - QPushButton *BtnLoad; - QPushButton *BtnDemos; - GameCFGWidget *gameCFG; - -private: - QPushButton *BtnBack; -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagetraining.cpp --- a/QTfrontend/pagetraining.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include - -#include "pagetraining.h" -#include "hwconsts.h" - -PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) -{ - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->setColumnStretch(0, 1); - pageLayout->setColumnStretch(1, 2); - pageLayout->setColumnStretch(2, 1); - pageLayout->setRowStretch(0, 1); - pageLayout->setRowStretch(2, 1); - - CBSelect = new QComboBox(this); - - QDir tmpdir; - tmpdir.cd(cfgdir->absolutePath()); - tmpdir.cd("Data/Missions/Training"); - tmpdir.setFilter(QDir::Files); - QStringList userlist = tmpdir.entryList(QStringList("*.lua")).replaceInStrings(QRegExp("^(.*)\\.lua"), "\\1"); - CBSelect->addItems(userlist); - - tmpdir.cd(datadir->absolutePath()); - tmpdir.cd("Missions/Training"); - tmpdir.setFilter(QDir::Files); - QStringList tmplist = tmpdir.entryList(QStringList("*.lua")).replaceInStrings(QRegExp("^(.*)\\.lua"), "\\1"); - QStringList datalist; - for (QStringList::Iterator it = tmplist.begin(); it != tmplist.end(); ++it) - if (!userlist.contains(*it,Qt::CaseInsensitive)) datalist.append(*it); - CBSelect->addItems(datalist); - - for(int i = 0; i < CBSelect->count(); i++) - { - CBSelect->setItemData(i, CBSelect->itemText(i)); - CBSelect->setItemText(i, CBSelect->itemText(i).replace("_", " ")); - } - - pageLayout->addWidget(CBSelect, 1, 1); - - BtnStartTrain = new QPushButton(this); - BtnStartTrain->setFont(*font14); - BtnStartTrain->setText(QPushButton::tr("Go!")); - pageLayout->addWidget(BtnStartTrain, 1, 2); - - - BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); - connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/pagetraining.h --- a/QTfrontend/pagetraining.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PAGE_TRAINING_H -#define PAGE_TRAINING_H - -#include "AbstractPage.h" - -class PageTraining : public AbstractPage -{ - Q_OBJECT - -public: - PageTraining(QWidget* parent = 0); - - QPushButton *BtnStartTrain; - QComboBox *CBSelect; - -private: - QPushButton *BtnBack; -}; - -#endif - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/proto.cpp --- a/QTfrontend/proto.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "proto.h" - -HWProto::HWProto() -{ - -} - -QByteArray & HWProto::addByteArrayToBuffer(QByteArray & buf, const QByteArray & msg) -{ - QByteArray bmsg = msg; - bmsg = bmsg.left(250); - quint8 sz = bmsg.size(); - buf.append(QByteArray((char *)&sz, 1)); - buf.append(bmsg); - return buf; -} - -QByteArray & HWProto::addStringToBuffer(QByteArray & buf, const QString & string) -{ - return addByteArrayToBuffer(buf, string.toUtf8()); -} - -QByteArray & HWProto::addStringListToBuffer(QByteArray & buf, const QStringList & strList) -{ - for (int i = 0; i < strList.size(); i++) - addStringToBuffer(buf, strList[i]); - return buf; -} - -QString HWProto::formatChatMsgForFrontend(const QString & msg) -{ - return formatChatMsg("|nick|", msg); -} - -QString HWProto::formatChatMsg(const QString & nick, const QString & msg) -{ - if(msg.left(4) == "/me ") - return QString("\x02* %1 %2").arg(nick).arg(msg.mid(4)); - else - return QString("\x01%1: %2").arg(nick).arg(msg); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/proto.h --- a/QTfrontend/proto.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _PROTO_H -#define _PROTO_H - -#include -#include -#include - - -class HWProto : public QObject -{ - Q_OBJECT - -public: - HWProto(); - static QByteArray & addStringToBuffer(QByteArray & buf, const QString & string); - static QByteArray & addByteArrayToBuffer(QByteArray & buf, const QByteArray & msg); - static QByteArray & addStringListToBuffer(QByteArray & buf, const QStringList & strList); - static QString formatChatMsg(const QString & nick, const QString & msg); - static QString formatChatMsgForFrontend(const QString & msg); -}; - -#endif // _PROTO_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/qaspectratiolayout.cpp --- a/QTfrontend/qaspectratiolayout.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation. - */ - -#include "qaspectratiolayout.h" - -QAspectRatioLayout::QAspectRatioLayout(QWidget* parent, int spacing) : QLayout(parent) { - init(spacing); -} - -QAspectRatioLayout::QAspectRatioLayout(int spacing) { - init(spacing); -} - -QAspectRatioLayout::~QAspectRatioLayout() { - delete item; - delete lastReceivedRect; - delete _geometry; -} - -void QAspectRatioLayout::init(int spacing) { - item = 0; - lastReceivedRect = new QRect(0, 0, 0, 0); - _geometry = new QRect(0, 0, 0, 0); - setSpacing(spacing); -} - - -/* Adds item if place isn't already taken. */ -void QAspectRatioLayout::add(QLayoutItem* item) { - if(!hasItem()) { - replaceItem(item); - } -} - -/* Adds item if place isn't already taken. */ -void QAspectRatioLayout::addItem(QLayoutItem* item) { - if(!hasItem()) { - replaceItem(item); - } -} - -/* Adds widget if place isn't already taken. */ -void QAspectRatioLayout::addWidget(QWidget* widget) { - if(!hasItem()) { - replaceItem(new QWidgetItem(widget)); - } -} - -/* Returns the item pointer and dereferences it here. */ -QLayoutItem* QAspectRatioLayout::take() { - QLayoutItem* item = 0; - if(this->hasItem()) { - item = this->item; - this->item = 0; - } - return item; -} - -/* Returns the item pointer and dereferences it here. */ -QLayoutItem* QAspectRatioLayout::takeAt(int index) { - if(index != 0) { - return 0; - } - return this->take(); -} - -/* Returns the item pointer. */ -QLayoutItem* QAspectRatioLayout::itemAt(int index) const { - if(index != 0) { - return 0; - } - if(hasItem()) { - return this->item; - } - return 0; -} - -/* Checks if we have an item. */ -bool QAspectRatioLayout::hasItem() const { - return this->item != 0; -} - -/* Returns the count of items which can be either 0 or 1. */ -int QAspectRatioLayout::count() const { - int returnValue = 0; - if(hasItem()) { - returnValue = 1; - } - return returnValue; -} - -/* Replaces the item with the new and returns the old. */ -QLayoutItem* QAspectRatioLayout::replaceItem(QLayoutItem* item) { - QLayoutItem* old = 0; - if(this->hasItem()) { - old = this->item; - } - this->item = item; - setGeometry(*this->_geometry); - return old; -} - -/* Tells which way layout expands. */ -Qt::Orientations QAspectRatioLayout::expandingDirections() const { - return Qt::Horizontal | Qt::Vertical; -} - -/* Tells which size is preferred. */ -QSize QAspectRatioLayout::sizeHint() const { - return this->item->minimumSize(); -} - -/* Tells minimum size. */ -QSize QAspectRatioLayout::minimumSize() const { - return this->item->minimumSize(); -} - -/* - * Tells if heightForWidth calculations is handled. - * It isn't since width isn't enough to calculate - * proper size. - */ -bool QAspectRatioLayout::hasHeightForWidth() const { - return false; -} - -/* Replaces lastReceivedRect. */ -void QAspectRatioLayout::setLastReceivedRect(const QRect& rect) { - QRect* oldRect = this->lastReceivedRect; - this->lastReceivedRect = new QRect(rect.topLeft(), rect.size()); - delete oldRect; -} - -/* Returns geometry */ -QRect QAspectRatioLayout::geometry() { - return QRect(*this->_geometry); -} - -/* Sets geometry to given size. */ -void QAspectRatioLayout::setGeometry(const QRect& rect) { - /* - * We check if the item is set and - * if size is the same previously received. - * If either is false nothing is done. - */ - if(!this->hasItem() || - areRectsEqual(*this->lastReceivedRect, rect)) { - return; - } - /* Replace the last received rectangle. */ - setLastReceivedRect(rect); - /* Calculate proper size for the item relative to the received size. */ - QSize properSize = calculateProperSize(rect.size()); - /* Calculate center location in the rect and with item size. */ - QPoint properLocation = calculateCenterLocation(rect.size(), properSize); - /* Set items geometry */ - this->item->setGeometry(QRect(properLocation, properSize)); - QRect* oldRect = this->_geometry; - /* Cache the calculated geometry. */ - this->_geometry = new QRect(properLocation, properSize); - delete oldRect; - /* Super classes setGeometry */ - QLayout::setGeometry(*this->_geometry); -} - -/* Takes the shortest side and creates QSize - * with the shortest side as width and height. */ -QSize QAspectRatioLayout::calculateProperSize(QSize from) const { - QSize properSize; - if(from.height() * 2 < from.width()) { - properSize.setHeight(from.height() - this->margin()); - properSize.setWidth(from.height() * 2 - this->margin()); - } - else { - properSize.setWidth(from.width() - this->margin()); - properSize.setHeight(from.width() / 2 - this->margin()); - } - return properSize; -} - -/* Calculates center location from the given height and width for item size. */ -QPoint QAspectRatioLayout::calculateCenterLocation(QSize from, - QSize itemSize) const { - QPoint centerLocation; - if((from.width() - itemSize.width()) > 0) { - centerLocation.setX((from.width() - itemSize.width())/2); - } - if((from.height() - itemSize.height()) > 0) { - centerLocation.setY((from.height() - itemSize.height())/2); - } - return centerLocation; -} - -/* Compares if two QRects are equal. */ -bool QAspectRatioLayout::areRectsEqual(const QRect& a, - const QRect& b) const { - bool result = false; - if(a.x() == b.x() && - a.y() == b.y() && - a.height() == b.height() && - a.width() == b.width()) { - result = true; - } - return result; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/qaspectratiolayout.h --- a/QTfrontend/qaspectratiolayout.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation. - */ - -#ifndef QASPECTRATIOLAYOUT_H_ -#define QASPECTRATIOLAYOUT_H_ - -#include -#include -#include -#include -#include - - -class QAspectRatioLayout : public QLayout -{ - Q_OBJECT - -public: - QAspectRatioLayout(QWidget* parent, int spacing =-1); - QAspectRatioLayout(int spacing = -1); - ~QAspectRatioLayout(); - - /* Convenience method */ - virtual void add(QLayoutItem* item); - -/* http://doc.trolltech.com/qlayout.html#addItem */ - virtual void addItem(QLayoutItem* item); - /* http://doc.trolltech.com/qlayout.html#addWidget */ - virtual void addWidget(QWidget* widget); - /* http://doc.trolltech.com/qlayout.html#takeAt */ - virtual QLayoutItem* takeAt(int index); - /* http://doc.trolltech.com/qlayout.html#itemAt */ - virtual QLayoutItem* itemAt(int index) const; - /* http://doc.trolltech.com/qlayout.html#count */ - virtual int count() const; - - /* - * These are ours since we do have only one item. - */ - virtual QLayoutItem* replaceItem(QLayoutItem* item); - virtual QLayoutItem* take(); - virtual bool hasItem() const; - -/* http://doc.trolltech.com/qlayout.html#expandingDirections */ - virtual Qt::Orientations expandingDirections() const; - - /* - * This method contains most of the juice of this article. - * http://doc.trolltech.com/qlayoutitem.html#setGeometry - */ - virtual void setGeometry(const QRect& rect); - /* http://doc.trolltech.com/qlayoutitem.html#geometry */ - virtual QRect geometry(); - - /* http://doc.trolltech.com/qlayoutitem.html#sizeHint */ - virtual QSize sizeHint() const; - /* http://doc.trolltech.com/qlayout.html#minimumSize */ - virtual QSize minimumSize() const; - /* http://doc.trolltech.com/qlayoutitem.html#hasHeightForWidth */ - virtual bool hasHeightForWidth() const; - -private: - /* Saves the last received rect. */ - void setLastReceivedRect(const QRect& rect); - /* Used to initialize the object. */ - void init(int spacing); - /* Calculates the maximum size for the item from the assigned size. */ - QSize calculateProperSize(QSize from) const; - /* Calculates the center location from the assigned size and - * the items size. */ - QPoint calculateCenterLocation(QSize from, QSize itemSize) const; - /* Check if two QRects are equal */ - bool areRectsEqual(const QRect& a, const QRect& b) const; - /* Contains item reference */ - QLayoutItem* item; - /* - * Used for caching so we won't do calculations every time - * setGeometry is called. - */ - QRect* lastReceivedRect; - /* Contains geometry */ - QRect* _geometry; - -}; - -#endif /* QASPECTRATIOLAYOUT_H_ */ diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/Load.png Binary file QTfrontend/res/Load.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/Trainings.png Binary file QTfrontend/res/Trainings.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnAISurvival.png Binary file QTfrontend/res/btnAISurvival.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnAISurvival@2x.png Binary file QTfrontend/res/btnAISurvival@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnArtillery.png Binary file QTfrontend/res/btnArtillery.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnArtillery@2x.png Binary file QTfrontend/res/btnArtillery@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnBorder.png Binary file QTfrontend/res/btnBorder.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnBorder@2x.png Binary file QTfrontend/res/btnBorder@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnBottomBorder.png Binary file QTfrontend/res/btnBottomBorder.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnBottomBorder@2x.png Binary file QTfrontend/res/btnBottomBorder@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnDisableGirders.png Binary file QTfrontend/res/btnDisableGirders.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnDisableGirders@2x.png Binary file QTfrontend/res/btnDisableGirders@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnDisableLandObjects.png Binary file QTfrontend/res/btnDisableLandObjects.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnDisableLandObjects@2x.png Binary file QTfrontend/res/btnDisableLandObjects@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnDisabled.png Binary file QTfrontend/res/btnDisabled.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnForts.png Binary file QTfrontend/res/btnForts.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnForts@2x.png Binary file QTfrontend/res/btnForts@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnInfAttack.png Binary file QTfrontend/res/btnInfAttack.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnInfAttack@2x.png Binary file QTfrontend/res/btnInfAttack@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnInvulnerable.png Binary file QTfrontend/res/btnInvulnerable.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnInvulnerable@2x.png Binary file QTfrontend/res/btnInvulnerable@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnKarma.png Binary file QTfrontend/res/btnKarma.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnKarma@2x.png Binary file QTfrontend/res/btnKarma@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnKing.png Binary file QTfrontend/res/btnKing.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnKing@2x.png Binary file QTfrontend/res/btnKing@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnLaserSight.png Binary file QTfrontend/res/btnLaserSight.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnLaserSight@2x.png Binary file QTfrontend/res/btnLaserSight@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnLowGravity.png Binary file QTfrontend/res/btnLowGravity.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnLowGravity@2x.png Binary file QTfrontend/res/btnLowGravity@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnMoreWind.png Binary file QTfrontend/res/btnMoreWind.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnMoreWind@2x.png Binary file QTfrontend/res/btnMoreWind@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnNoWind.png Binary file QTfrontend/res/btnNoWind.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnNoWind@2x.png Binary file QTfrontend/res/btnNoWind@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnOverlay.png Binary file QTfrontend/res/btnOverlay.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnOverlay@2x.png Binary file QTfrontend/res/btnOverlay@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnPerHogAmmo.png Binary file QTfrontend/res/btnPerHogAmmo.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnPerHogAmmo@2x.png Binary file QTfrontend/res/btnPerHogAmmo@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnPlaceHog.png Binary file QTfrontend/res/btnPlaceHog.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnPlaceHog@2x.png Binary file QTfrontend/res/btnPlaceHog@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnRandomOrder.png Binary file QTfrontend/res/btnRandomOrder.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnRandomOrder@2x.png Binary file QTfrontend/res/btnRandomOrder@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnResetHealth.png Binary file QTfrontend/res/btnResetHealth.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnResetHealth@2x.png Binary file QTfrontend/res/btnResetHealth@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnResetWeps.png Binary file QTfrontend/res/btnResetWeps.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnResetWeps@2x.png Binary file QTfrontend/res/btnResetWeps@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnSharedAmmo.png Binary file QTfrontend/res/btnSharedAmmo.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnSharedAmmo@2x.png Binary file QTfrontend/res/btnSharedAmmo@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnSolid.png Binary file QTfrontend/res/btnSolid.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnSolid@2x.png Binary file QTfrontend/res/btnSolid@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnTagTeam.png Binary file QTfrontend/res/btnTagTeam.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnTagTeam@2x.png Binary file QTfrontend/res/btnTagTeam@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnTeamsDivide.png Binary file QTfrontend/res/btnTeamsDivide.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnTeamsDivide@2x.png Binary file QTfrontend/res/btnTeamsDivide@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnVampiric.png Binary file QTfrontend/res/btnVampiric.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/btnVampiric@2x.png Binary file QTfrontend/res/btnVampiric@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/css/chat.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/res/css/chat.css Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,76 @@ + +/****************************************************************************** + * + * CSS-like definition of chat appearance + * + ****************************************************************************** + * + * see http://doc.qt.nokia.com/4.5/richtext-html-subset.html#css-properties + * + * In the QTfrontend of hedgewars also display:none; will work for class names + * that start with msg_ and .TimeStamp - as long as they are referenced + * directly and not within any hierachy. + * + ****************************************************************************** + * + * This file can be stored at different locations, but it will be read only + * once, based on first file found in this order: + * + * /Data/css/chat.css + * /css/chat.css + * + * + *****************************************************************************/ + +/* links */ +a { color:#c8c8ff; } + +/* appearance of the whole chat */ +/* body { color: white; background-color: #000000; } */ + +/* appearance of all elements in chat */ +/* * { color: white; background-color: #000000; } */ + +/* nick names (they are also sometimes linked) */ +.nick { text-decoration: none; } + +/* various chat messages */ +.msg_UserChat { color:#ffcc00; } /* chat of people who aren't your friends */ +.msg_UserChat .nick { color:#ffec20; } +.msg_FriendChat { color: #b0ff08; } +.msg_FriendChat .nick { color: #30ff30; } +.msg_UserJoin { color: #c0c0c0; } +.msg_UserJoin .nick { color: #d0d0d0; } +.msg_FriendJoin { font-weight: bold; color: #c0f0c0; } +.msg_FriendJoin .nick { color: #d8f0d8; } +.msg_UserAction { color: #ff80ff; } +.msg_UserAction .nick { color: #ffa0ff;} +.msg_FriendAction { color: #ff00ff; } +.msg_FriendAction .nick { color: #ff30ff; } + +/* timestamps */ +.timestamp { + color: #e0d8e0; + font-family: courier; + font-size: 11px; + vertical-align: center; + /* uncomment next line to hide timestamps */ + /* display: none; */ +} + +/* you can also set timestamp style for different msg types */ +.msg_FriendChat .timestamp { color: #ffffff; } + +/* messages that contain your nickname */ +.highlight { } +.highlight .nick { color: red; } /* nicknames in highlighted messages */ + +/* uncomment next line to disable join and leave messages of non-friends */ +/* .msg_UserJoin { display:none; } */ + +/* system messages */ +.msg_Error { color: #ff0000; } +.msg_Warning { color: #ff8000; } +.msg_Notice { color: #fefefe; } +.msg_Notice .nick { color: #ffffd0; } + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/res/css/qt.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/res/css/qt.css Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,246 @@ +/****************************************************************************** + * + * CSS-like definition of Qt frontend appearance + * + ****************************************************************************** + * + * see http://doc.qt.nokia.com/4.5/stylesheet.html + * + ****************************************************************************** + * + * This file can be stored at different locations, but it will be read only + * once, based on first file found in this order: + * + * /Data/css/qt.css + * /css/qt.css + * (:/res/css/qt.css) + * + *****************************************************************************/ + +HWForm,QDialog { +background-image: url(":/res/Background.png"); +background-position: bottom center; +background-repeat: repeat-x; +background-color: #141250; +} + +* { +color: #ffcc00; +selection-background-color: #ffcc00; +selection-color: #00351d; +} + +QLineEdit, QListWidget, QTableView, QTextBrowser, QSpinBox, QComboBox, +QComboBox QAbstractItemView, QMenu::item { +background-color: rgba(13, 5, 68, 70%); +} + +QComboBox::separator { +border: solid; border-width: 3px; border-color: #ffcc00; +} + +QPushButton, QListWidget, QTableView, QLineEdit, QHeaderView, +QTextBrowser, QSpinBox, QToolBox, QComboBox, +QComboBox QAbstractItemView, IconedGroupBox, +.QGroupBox, GameCFGWidget, TeamSelWidget, SelWeaponWidget, +QTabWidget::pane, QTabBar::tab { +border: solid; +border-width: 3px; +border-color: #ffcc00; +} + +QPushButton:hover, QLineEdit:hover, QListWidget:hover, +QSpinBox:hover, QToolBox:hover, QComboBox:hover { +border-color: yellow; +} + +QLineEdit, QListWidget,QTableView, QTextBrowser, +QSpinBox, QToolBox { +border-radius: 10px; +} + +QLineEdit, QLabel, QHeaderView, QListWidget, QTableView, +QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView, +IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget, +SelWeaponWidget, QCheckBox, QRadioButton, QPushButton { +font: bold 13px; +} +SelWeaponWidget QTabWidget::pane, SelWeaponWidget QTabBar::tab:selected { +background-position: bottom center; +background-repeat: repeat-x; +background-color: #000000; +} +.QGroupBox,GameCFGWidget,TeamSelWidget,SelWeaponWidget { +background-position: bottom center; +background-repeat: repeat-x; +border-radius: 16px; +background-color: rgba(13, 5, 68, 70%); +padding: 6px; +} +/* Experimenting with PaintOnScreen and border-radius on IconedGroupBox children didn't work out well +IconedGroupBox QComboBox, IconedGroupBox QPushButton, IconedGroupBox QLineEdit, +IconedGroupBox QSpinBox { +border-radius: 0; +} +IconedGroupBox, IconedGroupBox *, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{" */ +IconedGroupBox, QTabWidget::pane, QTabBar::tab:selected, QToolBox::tab QWidget{ +background-color: #130f2c; +} + + +QPushButton { +border-radius: 8px; +background-origin: margin; +background-position: top left; +background-color: rgba(18, 42, 5, 70%); +} + +QPushButton:pressed{ +border-color: white; +} + +QPushButton:focus { +outline: none; +} + + +QHeaderView { +border-radius: 0; +border-width: 0; +border-bottom-width: 3px; +background-color: #00351d; +} +QTableView { +alternate-background-color: #2f213a; +gridline-color: transparent; +} + +QTabBar::tab { +border-bottom-width: 0; +border-radius: 0; +border-top-left-radius: 6px; +border-top-right-radius: 6px; +padding: 3px; +} +QTabBar::tab:!selected { +color: #0d0544; +background-color: #ffcc00; +} +QSpinBox::up-button{ +background: transparent; +width: 16px; +height: 10px; +} + +QSpinBox::up-arrow { +image: url(":/res/spin_up.png"); +} + +QSpinBox::down-arrow { +image: url(":/res/spin_down.png"); +} + +QSpinBox::down-button { +background: transparent; +width: 16px; +height: 10px; +} + +QComboBox { +border-radius: 10px; +padding: 3px; +} +QComboBox:pressed{ +border-color: white; +} +QComboBox::drop-down{ +border: transparent; +width: 25px; +} +QComboBox::down-arrow { +image: url(":/res/dropdown.png"); +} + +VertScrArea { +background-position: bottom center; +background-repeat: repeat-x; +} + +IconedGroupBox { +border-radius: 16px; +padding: 2px; +} + +QGroupBox::title{ +subcontrol-origin: margin; +subcontrol-position: top left; +text-align: left; +left: 15px; +top: -4px; +} + +QCheckBox::indicator:checked{ +image: url(":/res/checked.png"); +} +QCheckBox::indicator:unchecked{ +image: url(":/res/unchecked.png"); +} + +.QWidget{ +background: transparent; +} + +QTabWidget::pane { +border-top-width: 2px; +} + +QMenu{ +background-color: #ffcc00; +margin: 3px; +} +QMenu::item { +background-color: #0d0544; +border: 1px solid transparent; +font: bold; +padding: 2px 25px 2px 20px; +} +QMenu::item:selected { +background-color: #2d2564; +} +QMenu::indicator { +width: 16px; +height: 16px; +} +QMenu::indicator:non-exclusive:checked{ +image: url(":/res/checked.png"); +} +QMenu::indicator:non-exclusive:unchecked{ +image: url(":/res/unchecked.png"); +} + +QToolTip{ +background-color: #0d0544; +border: 1px solid #ffcc00; +} + +:disabled{ +color: #a0a0a0; +} +SquareLabel, ItemNum { +background-color: #000000; +} + +QSlider::groove::horizontal { +height: 2px; +margin: 2px 0px; +background-color: #ffcc00; +} + +QSlider::handle::horizontal { +border: 0px; +margin: -2px 0px; +border-radius: 3px; +background-color: #ffcc00; +width: 8px; +} + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/selectWeapon.cpp --- a/QTfrontend/selectWeapon.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "selectWeapon.h" -#include "weaponItem.h" -#include "hwconsts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QImage getAmmoImage(int num) -{ - static QImage ammo(":Ammos.png"); - int x = num/(ammo.height()/32); - int y = (num-((ammo.height()/32)*x))*32; - x*=32; - return ammo.copy(x, y, 32, 32); -} - -SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent) : - QWidget(parent) -{ - QHBoxLayout* hbLayout = new QHBoxLayout(this); - hbLayout->setSpacing(1); - hbLayout->setMargin(1); - - QLabel* lbl = new QLabel(this); - lbl->setPixmap(QPixmap::fromImage(getAmmoImage(iconNum))); - lbl->setMaximumWidth(30); - lbl->setGeometry(0, 0, 30, 30); - hbLayout->addWidget(lbl); - - item = new WeaponItem(image, imagegrey, this); - item->setItemsNum(wNum); - item->setInfinityState(allowInfinite); - hbLayout->addWidget(item); - - hbLayout->setStretchFactor(lbl, 1); - hbLayout->setStretchFactor(item, 99); - hbLayout->setAlignment(lbl, Qt::AlignLeft | Qt::AlignVCenter); - hbLayout->setAlignment(item, Qt::AlignLeft | Qt::AlignVCenter); -} - -void SelWeaponItem::setItemsNum(const unsigned char num) -{ - item->setItemsNum(num); -} - -unsigned char SelWeaponItem::getItemsNum() const -{ - return item->getItemsNum(); -} - -void SelWeaponItem::setEnabled(bool value) -{ - item->setEnabled(value); -} - -SelWeaponWidget::SelWeaponWidget(int numItems, QWidget* parent) : - QFrame(parent), - m_numItems(numItems) -{ - wconf = new QSettings(cfgdir->absolutePath() + "/weapons.ini", QSettings::IniFormat, this); - - for(int i = 0; i < cDefaultAmmos.size(); ++i) - wconf->setValue(cDefaultAmmos[i].first, cDefaultAmmos[i].second); - - QStringList keys = wconf->allKeys(); - for(int i = 0; i < keys.size(); i++) - { - if (wconf->value(keys[i]).toString().size() != cDefaultAmmoStore->size()) - wconf->remove(keys[i]); - } - - QString currentState = *cDefaultAmmoStore; - - QTabWidget * tbw = new QTabWidget(this); - QWidget * page1 = new QWidget(this); - p1Layout = new QGridLayout(page1); - p1Layout->setSpacing(1); - p1Layout->setMargin(1); - QWidget * page2 = new QWidget(this); - p2Layout = new QGridLayout(page2); - p2Layout->setSpacing(1); - p2Layout->setMargin(1); - QWidget * page3 = new QWidget(this); - p3Layout = new QGridLayout(page3); - p3Layout->setSpacing(1); - p3Layout->setMargin(1); - QWidget * page4 = new QWidget(this); - p4Layout = new QGridLayout(page4); - p4Layout->setSpacing(1); - p4Layout->setMargin(1); - - tbw->addTab(page1, tr("Weapon set")); - tbw->addTab(page2, tr("Probabilities")); - tbw->addTab(page4, tr("Ammo in boxes")); - tbw->addTab(page3, tr("Delays")); - - QGridLayout * pageLayout = new QGridLayout(this); - pageLayout->addWidget(tbw); - - - int j = -1; - int i = 0, k = 0; - for(; i < m_numItems; ++i) { - if (i == 6) continue; - if (i == 52) continue; // Disable structures for now - if (k % 4 == 0) ++j; - SelWeaponItem * swi = new SelWeaponItem(true, i, currentState[i].digitValue(), QImage(":/res/ammopic.png"), QImage(":/res/ammopicgrey.png"), this); - weaponItems[i].append(swi); - p1Layout->addWidget(swi, j, k % 4); - - SelWeaponItem * pwi = new SelWeaponItem(false, i, currentState[numItems + i].digitValue(), QImage(":/res/ammopicbox.png"), QImage(":/res/ammopicboxgrey.png"), this); - weaponItems[i].append(pwi); - p2Layout->addWidget(pwi, j, k % 4); - - SelWeaponItem * dwi = new SelWeaponItem(false, i, currentState[numItems*2 + i].digitValue(), QImage(":/res/ammopicdelay.png"), QImage(":/res/ammopicdelaygrey.png"), this); - weaponItems[i].append(dwi); - p3Layout->addWidget(dwi, j, k % 4); - - SelWeaponItem * awi = new SelWeaponItem(false, i, currentState[numItems*3 + i].digitValue(), QImage(":/res/ammopic.png"), QImage(":/res/ammopicgrey.png"), this); - weaponItems[i].append(awi); - p4Layout->addWidget(awi, j, k % 4); - - ++k; - } - - //pLayout->setRowStretch(5, 100); - m_name = new QLineEdit(this); - pageLayout->addWidget(m_name, i, 0, 1, 5); -} - -void SelWeaponWidget::setWeapons(const QString& ammo) -{ - bool enable = true; - for(int i = 0; i < cDefaultAmmos.size(); i++) - if (!cDefaultAmmos[i].first.compare(m_name->text())) { - enable = false; - } - for(int i = 0; i < m_numItems; ++i) { - twi::iterator it = weaponItems.find(i); - if (it == weaponItems.end()) continue; - it.value()[0]->setItemsNum(ammo[i].digitValue()); - it.value()[1]->setItemsNum(ammo[m_numItems + i].digitValue()); - it.value()[2]->setItemsNum(ammo[m_numItems*2 + i].digitValue()); - it.value()[3]->setItemsNum(ammo[m_numItems*3 + i].digitValue()); - it.value()[0]->setEnabled(enable); - it.value()[1]->setEnabled(enable); - it.value()[2]->setEnabled(enable); - it.value()[3]->setEnabled(enable); - } - m_name->setEnabled(enable); -} - -void SelWeaponWidget::setDefault() -{ - for(int i = 0; i < cDefaultAmmos.size(); i++) - if (!cDefaultAmmos[i].first.compare(m_name->text())) { - return; - } - setWeapons(*cDefaultAmmoStore); -} - -void SelWeaponWidget::save() -{ - for(int i = 0; i < cDefaultAmmos.size(); i++) - if (!cDefaultAmmos[i].first.compare(m_name->text())) { - QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not overwrite default weapon set '%1'!").arg(cDefaultAmmos[i].first)); - return; - } - - if (m_name->text() == "") return; - - QString state1; - QString state2; - QString state3; - QString state4; - - for(int i = 0; i < m_numItems; ++i) { - twi::const_iterator it = weaponItems.find(i); - int num = it == weaponItems.end() ? 9 : it.value()[0]->getItemsNum(); // 9 is for 'skip turn' - state1.append(QString::number(num)); - int prob = it == weaponItems.end() ? 0 : it.value()[1]->getItemsNum(); - state2.append(QString::number(prob)); - int del = it == weaponItems.end() ? 0 : it.value()[2]->getItemsNum(); - state3.append(QString::number(del)); - int am = it == weaponItems.end() ? 0 : it.value()[3]->getItemsNum(); - state4.append(QString::number(am)); - } - if (curWeaponsName != "") { - // remove old entry - wconf->remove(curWeaponsName); - } - wconf->setValue(m_name->text(), state1 + state2 + state3 + state4); - emit weaponsChanged(); -} - -int SelWeaponWidget::operator [] (unsigned int weaponIndex) const -{ - twi::const_iterator it = weaponItems.find(weaponIndex); - return it == weaponItems.end() ? 9 : it.value()[0]->getItemsNum(); -} - -QString SelWeaponWidget::getWeaponsString(const QString& name) const -{ - return wconf->value(name).toString(); -} - -void SelWeaponWidget::deleteWeaponsName() -{ - if (curWeaponsName == "") return; - - for(int i = 0; i < cDefaultAmmos.size(); i++) - if (!cDefaultAmmos[i].first.compare(m_name->text())) { - QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not delete default weapon set '%1'!").arg(cDefaultAmmos[i].first)); - return; - } - - QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Weapons"), QMessageBox::tr("Really delete this weapon set?"), QMessageBox::Ok | QMessageBox::Cancel); - - if (reallyDelete.exec() == QMessageBox::Ok) { - wconf->remove(curWeaponsName); - emit weaponsDeleted(); - } -} - -void SelWeaponWidget::newWeaponsName() -{ - QString newName = tr("new"); - if(wconf->contains(newName)) { - //name already used -> look for an appropriate name: - int i=2; - while(wconf->contains(newName = tr("new")+QString::number(i++))); - } - setWeaponsName(newName); -} - -void SelWeaponWidget::setWeaponsName(const QString& name) -{ - m_name->setText(name); - - curWeaponsName = name; - - if(name != "" && wconf->contains(name)) { - setWeapons(wconf->value(name).toString()); - } else { - setWeapons(*cDefaultAmmoStore); - } -} - -QStringList SelWeaponWidget::getWeaponNames() const -{ - return wconf->allKeys(); -} - -void SelWeaponWidget::copy() -{ - if(wconf->contains(curWeaponsName)) { - QString ammo = getWeaponsString(curWeaponsName); - QString newName = tr("copy of") + " " + curWeaponsName; - if(wconf->contains(newName)) { - //name already used -> look for an appropriate name: - int i=2; - while(wconf->contains(newName = tr("copy of") + " " + curWeaponsName+QString::number(i++))); - } - setWeaponsName(newName); - setWeapons(ammo); - } -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/selectWeapon.h --- a/QTfrontend/selectWeapon.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _SELECT_WEAPON_INCLUDED -#define _SELECT_WEAPON_INCLUDED - -#include -#include -#include - -class QGridLayout; -class WeaponItem; -class QLineEdit; -class QSettings; - -class SelWeaponItem : public QWidget -{ - Q_OBJECT - -public: - SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent=0); - - unsigned char getItemsNum() const; - void setItemsNum(const unsigned char num); - void setEnabled(bool value); - - private: - WeaponItem* item; -}; - -class SelWeaponWidget : public QFrame -{ - Q_OBJECT - - public: - SelWeaponWidget(int numItems, QWidget* parent=0); - QString getWeaponsString(const QString& name) const; - QStringList getWeaponNames() const; - - public slots: - void setDefault(); - void setWeapons(const QString& ammo); - //sets the name of the current set - void setWeaponsName(const QString& name); - void deleteWeaponsName(); - void newWeaponsName(); - void save(); - void copy(); - - signals: - void weaponsChanged(); - void weaponsDeleted(); - - private: - //the name of the current weapon set - QString curWeaponsName; - - QLineEdit* m_name; - - //storage for all the weapons sets - QSettings* wconf; - - const int m_numItems; - int operator [] (unsigned int weaponIndex) const; - - typedef QList ItemsList; - typedef QMap twi; - twi weaponItems; - //layout element for each tab: - QGridLayout* p1Layout; - QGridLayout* p2Layout; - QGridLayout* p3Layout; - QGridLayout* p4Layout; -}; - -#endif // _SELECT_WEAPON_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/tcpBase.cpp --- a/QTfrontend/tcpBase.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "tcpBase.h" - -#include -#include - -#include - -#include "hwconsts.h" - -QList srvsList; -QPointer TCPBase::IPCServer(0); - -TCPBase::~TCPBase() -{ -} - -TCPBase::TCPBase(bool demoMode) : - m_isDemoMode(demoMode), - IPCSocket(0) -{ - if(!IPCServer) { - IPCServer = new QTcpServer(0); - IPCServer->setMaxPendingConnections(1); - if (!IPCServer->listen(QHostAddress::LocalHost)) { - QMessageBox::critical(0, tr("Error"), - tr("Unable to start the server: %1.") - .arg(IPCServer->errorString())); - exit(0); // FIXME - should be graceful exit here - } - } - ipc_port=IPCServer->serverPort(); -} - -void TCPBase::NewConnection() -{ - if(IPCSocket) { - // connection should be already finished - return; - } - disconnect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); - IPCSocket = IPCServer->nextPendingConnection(); - if(!IPCSocket) return; - connect(IPCSocket, SIGNAL(disconnected()), this, SLOT(ClientDisconnect())); - connect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); - SendToClientFirst(); -} - -void TCPBase::RealStart() -{ - connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection())); - IPCSocket = 0; - - QProcess * process; - process = new QProcess; - connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(StartProcessError(QProcess::ProcessError))); - QStringList arguments=getArguments(); - - // redirect everything written on stdout/stderr - if(isDevBuild) - process->setProcessChannelMode(QProcess::ForwardedChannels); - process->start(bindir->absolutePath() + "/hwengine", arguments); -} - -void TCPBase::ClientDisconnect() -{ - disconnect(IPCSocket, SIGNAL(readyRead()), this, SLOT(ClientRead())); - onClientDisconnect(); - - if(srvsList.size()==1) srvsList.pop_front(); - emit isReadyNow(); - IPCSocket->deleteLater(); - deleteLater(); -} - -void TCPBase::ClientRead() -{ - QByteArray readed=IPCSocket->readAll(); - if(readed.isEmpty()) return; - readbuffer.append(readed); - onClientRead(); -} - -void TCPBase::StartProcessError(QProcess::ProcessError error) -{ - QMessageBox::critical(0, tr("Error"), - tr("Unable to run engine: %1 (") - .arg(error) + bindir->absolutePath() + "/hwengine)"); -} - -void TCPBase::tcpServerReady() -{ - disconnect(srvsList.takeFirst(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); - - RealStart(); -} - -void TCPBase::Start() -{ - if(srvsList.isEmpty()) { - srvsList.push_back(this); - } else { - connect(srvsList.back(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady())); - srvsList.push_back(this); - return; - } - - RealStart(); -} - -void TCPBase::onClientRead() -{ -} - -void TCPBase::onClientDisconnect() -{ -} - -void TCPBase::SendToClientFirst() -{ -} - -void TCPBase::SendIPC(const QByteArray & buf) -{ - if (buf.size() > MAXMSGCHARS) return; - quint8 len = buf.size(); - RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf); -} - -void TCPBase::RawSendIPC(const QByteArray & buf) -{ - if (!IPCSocket) - { - toSendBuf += buf; - } else - { - if (toSendBuf.size() > 0) - { - IPCSocket->write(toSendBuf); - if(m_isDemoMode) demo.append(toSendBuf); - toSendBuf.clear(); - } - if(!buf.isEmpty()) { - IPCSocket->write(buf); - if(m_isDemoMode) demo.append(buf); - } - } -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/tcpBase.h --- a/QTfrontend/tcpBase.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _TCPBASE_INCLUDED -#define _TCPBASE_INCLUDED - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define MAXMSGCHARS 255 - -class TCPBase : public QObject -{ - Q_OBJECT - - public: - TCPBase(bool demoMode); - virtual ~TCPBase(); - - signals: - void isReadyNow(); - - protected: - quint16 ipc_port; - - void Start(); - - QByteArray readbuffer; - - QByteArray toSendBuf; - QByteArray demo; - - void SendIPC(const QByteArray & buf); - void RawSendIPC(const QByteArray & buf); - - virtual QStringList getArguments()=0; - virtual void onClientRead(); - virtual void onClientDisconnect(); - virtual void SendToClientFirst(); - - private: - static QPointer IPCServer; - - bool m_isDemoMode; - void RealStart(); - QPointer IPCSocket; - - private slots: - void NewConnection(); - void ClientDisconnect(); - void ClientRead(); - void StartProcessError(QProcess::ProcessError error); - - void tcpServerReady(); -}; - -#endif // _TCPBASE_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/team.cpp --- a/QTfrontend/team.cpp Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/team.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -25,13 +25,13 @@ #include "team.h" #include "hwform.h" -#include "pageeditteam.h" #include "hats.h" HWTeam::HWTeam(const QString & teamname) : - m_difficulty(0), - m_numHedgehogs(4), - m_isNetTeam(false) + QObject(0) + , m_difficulty(0) + , m_numHedgehogs(4) + , m_isNetTeam(false) { m_name = teamname; OldTeamName = m_name; @@ -46,8 +46,8 @@ m_flag = "hedgewars"; for(int i = 0; i < BINDS_NUMBER; i++) { - binds[i].action = cbinds[i].action; - binds[i].strbind = cbinds[i].strbind; + m_binds[i].action = cbinds[i].action; + m_binds[i].strbind = cbinds[i].strbind; } m_rounds = 0; m_wins = 0; @@ -55,8 +55,9 @@ } HWTeam::HWTeam(const QStringList& strLst) : - m_numHedgehogs(4), - m_isNetTeam(true) + QObject(0) + , m_numHedgehogs(4) + , m_isNetTeam(true) { // net teams are configured from QStringList if(strLst.size() != 23) throw HWTeamConstructException(); @@ -81,9 +82,10 @@ } HWTeam::HWTeam() : - m_difficulty(0), - m_numHedgehogs(4), - m_isNetTeam(false) + QObject(0) + , m_difficulty(0) + , m_numHedgehogs(4) + , m_isNetTeam(false) { m_name = QString("Team"); for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) @@ -99,14 +101,61 @@ for(int i = 0; i < BINDS_NUMBER; i++) { - binds[i].action = cbinds[i].action; - binds[i].strbind = cbinds[i].strbind; + m_binds[i].action = cbinds[i].action; + m_binds[i].strbind = cbinds[i].strbind; } m_rounds = 0; m_wins = 0; m_campaignProgress = 0; } +HWTeam::HWTeam(const HWTeam & other) : + QObject(0) + , OldTeamName(other.OldTeamName) + , m_name(other.m_name) + , m_grave(other.m_grave) + , m_fort(other.m_fort) + , m_flag(other.m_flag) + , m_voicepack(other.m_voicepack) + , m_hedgehogs(other.m_hedgehogs) + , m_difficulty(other.m_difficulty) + , m_binds(other.m_binds) + , m_numHedgehogs(other.m_numHedgehogs) + , m_color(other.m_color) + , m_isNetTeam(other.m_isNetTeam) + , m_owner(other.m_owner) + , m_campaignProgress(other.m_campaignProgress) + , m_rounds(other.m_rounds) + , m_wins(other.m_wins) +// , AchievementProgress(other.AchievementProgress) +{ + +} + +HWTeam & HWTeam::operator = (const HWTeam & other) +{ + if(this != &other) + { + OldTeamName = other.OldTeamName; + m_name = other.m_name; + m_grave = other.m_grave; + m_fort = other.m_fort; + m_flag = other.m_flag; + m_voicepack = other.m_voicepack; +// m_hedgehogs = other.m_hedgehogs; + m_difficulty = other.m_difficulty; +// m_binds = other.m_binds; + m_numHedgehogs = other.m_numHedgehogs; + m_color = other.m_color; + m_isNetTeam = other.m_isNetTeam; + m_owner = other.m_owner; + m_campaignProgress = other.m_campaignProgress; + m_rounds = other.m_rounds; + m_wins = other.m_wins; + } + + return *this; +} bool HWTeam::loadFromFile() { @@ -132,7 +181,7 @@ m_hedgehogs[i].Suicides = teamfile.value(hh + "Suicides", 0).toInt(); } for(int i = 0; i < BINDS_NUMBER; i++) - binds[i].strbind = teamfile.value(QString("Binds/%1").arg(binds[i].action), cbinds[i].strbind).toString(); + m_binds[i].strbind = teamfile.value(QString("Binds/%1").arg(m_binds[i].action), cbinds[i].strbind).toString(); for(int i = 0; i < MAX_ACHIEVEMENTS; i++) if(achievements[i][0][0]) AchievementProgress[i] = teamfile.value(QString("Achievements/%1").arg(achievements[i][0]), 0).toUInt(); @@ -186,7 +235,7 @@ teamfile.setValue(hh + "Suicides", m_hedgehogs[i].Suicides); } for(int i = 0; i < BINDS_NUMBER; i++) - teamfile.setValue(QString("Binds/%1").arg(binds[i].action), binds[i].strbind); + teamfile.setValue(QString("Binds/%1").arg(m_binds[i].action), m_binds[i].strbind); for(int i = 0; i < MAX_ACHIEVEMENTS; i++) if(achievements[i][0][0]) teamfile.setValue(QString("Achievements/%1").arg(achievements[i][0]), AchievementProgress[i]); @@ -195,54 +244,6 @@ return true; } -void HWTeam::SetToPage(HWForm * hwform) -{ - hwform->ui.pageEditTeam->TeamNameEdit->setText(m_name); - hwform->ui.pageEditTeam->CBTeamLvl->setCurrentIndex(m_difficulty); - for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) - { - hwform->ui.pageEditTeam->HHNameEdit[i]->setText(m_hedgehogs[i].Name); - if (m_hedgehogs[i].Hat.startsWith("Reserved")) - hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData("Reserved "+m_hedgehogs[i].Hat.remove(0,40), Qt::DisplayRole)); - else - hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData(m_hedgehogs[i].Hat, Qt::DisplayRole)); - } - hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(m_grave)); - hwform->ui.pageEditTeam->CBFlag->setCurrentIndex(hwform->ui.pageEditTeam->CBFlag->findData(m_flag)); - - hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(m_fort)); - hwform->ui.pageEditTeam->CBVoicepack->setCurrentIndex(hwform->ui.pageEditTeam->CBVoicepack->findText(m_voicepack)); - //hwform->ui.pageEditTeam->CBFort_activated(Fort); - - for(int i = 0; i < BINDS_NUMBER; i++) - { - hwform->ui.pageEditTeam->CBBind[i]->setCurrentIndex(hwform->ui.pageEditTeam->CBBind[i]->findData(binds[i].strbind)); - } -} - -void HWTeam::GetFromPage(HWForm * hwform) -{ - m_name = hwform->ui.pageEditTeam->TeamNameEdit->text(); - m_difficulty = hwform->ui.pageEditTeam->CBTeamLvl->currentIndex(); - for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) - { - m_hedgehogs[i].Name = hwform->ui.pageEditTeam->HHNameEdit[i]->text(); - if (hwform->ui.pageEditTeam->HHHats[i]->currentText().startsWith("Reserved")) - m_hedgehogs[i].Hat = "Reserved"+playerHash+hwform->ui.pageEditTeam->HHHats[i]->currentText().remove(0,9); - else - m_hedgehogs[i].Hat = hwform->ui.pageEditTeam->HHHats[i]->currentText(); - } - - m_grave = hwform->ui.pageEditTeam->CBGrave->currentText(); - m_fort = hwform->ui.pageEditTeam->CBFort->currentText(); - m_voicepack = hwform->ui.pageEditTeam->CBVoicepack->currentText(); - m_flag = hwform->ui.pageEditTeam->CBFlag->itemData(hwform->ui.pageEditTeam->CBFlag->currentIndex()).toString(); - for(int i = 0; i < BINDS_NUMBER; i++) - { - binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->itemData(hwform->ui.pageEditTeam->CBBind[i]->currentIndex()).toString(); - } -} - QStringList HWTeam::teamGameConfig(quint32 InitHealth) const { QStringList sl; @@ -260,8 +261,8 @@ if (!m_isNetTeam) for(int i = 0; i < BINDS_NUMBER; i++) - if(!binds[i].strbind.isEmpty()) - sl.push_back(QString("ebind " + binds[i].strbind + " " + binds[i].action)); + if(!m_binds[i].strbind.isEmpty()) + sl.push_back(QString("ebind " + m_binds[i].strbind + " " + m_binds[i].action)); for (int t = 0; t < m_numHedgehogs; t++) { @@ -299,7 +300,7 @@ // single hedgehog const HWHog & HWTeam::hedgehog(unsigned int idx) const { return m_hedgehogs[idx]; } - void HWTeam::setHedgehog(unsigned int idx, const HWHog & hh) { m_hedgehogs[idx] = hh; } + void HWTeam::setHedgehog(unsigned int idx, HWHog hh) { m_hedgehogs[idx] = hh; } // owner QString HWTeam::owner() const { return m_owner; } @@ -315,6 +316,9 @@ void HWTeam::setColor(const QColor & color) { m_color = color; } +// binds +QString HWTeam::keyBind(unsigned int idx) const { return m_binds[idx].strbind; } + void HWTeam::bindKey(unsigned int idx, const QString & key) { m_binds[idx].strbind = key; } // flag void HWTeam::setFlag(const QString & flag) { m_flag = flag; } diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/team.h --- a/QTfrontend/team.h Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/team.h Fri Oct 28 18:33:38 2011 +0200 @@ -42,16 +42,20 @@ }; // class representing a team -class HWTeam +class HWTeam : public QObject { + Q_OBJECT + public: // constructors HWTeam(const QString & teamname); HWTeam(const QStringList& strLst); HWTeam(); + HWTeam(const HWTeam & other); // file operations + static HWTeam loadFromFile(const QString & teamName); bool loadFromFile(); bool deleteFile(); bool saveToFile(); @@ -66,18 +70,20 @@ QString grave() const; const HWHog & hedgehog(unsigned int idx) const; bool isNetTeam() const; + QString keyBind(unsigned int idx) const; QString name() const; unsigned char numHedgehogs() const; QString owner() const; QString voicepack() const; // attribute setters + void bindKey(unsigned int idx, const QString & key); void setColor(const QColor & color); void setDifficulty(unsigned int level); void setFlag(const QString & flag); void setFort(const QString & fort); void setGrave(const QString & grave); - void setHedgehog(unsigned int idx, const HWHog & hh); + void setHedgehog(unsigned int idx, HWHog hh); void setName(const QString & name); void setNumHedgehogs(unsigned char num); void setVoicepack(const QString & voicepack); @@ -86,17 +92,13 @@ void incRounds(); void incWins(); - // pages... wait... wth is THIS doing in this class? FIXME!!!! - void SetToPage(HWForm * hwform); - void GetFromPage(HWForm * hwform); - // convert team info into strings for further computation QStringList teamGameConfig(quint32 InitHealth) const; // comparison operators - bool operator==(const HWTeam& t1) const; - bool operator<(const HWTeam& t1) const; - + bool operator == (const HWTeam& t1) const; + bool operator < (const HWTeam& t1) const; + HWTeam & operator = (const HWTeam & other); private: @@ -110,11 +112,11 @@ QString m_flag; QString m_voicepack; HWHog m_hedgehogs[HEDGEHOGS_PER_TEAM]; - unsigned int m_difficulty; - BindAction binds[BINDS_NUMBER]; + quint8 m_difficulty; + BindAction m_binds[BINDS_NUMBER]; // class members that contain info for the current game setup - unsigned char m_numHedgehogs; + quint8 m_numHedgehogs; QColor m_color; bool m_isNetTeam; QString m_owner; @@ -124,8 +126,6 @@ unsigned int m_rounds; unsigned int m_wins; unsigned int AchievementProgress[MAX_ACHIEVEMENTS]; - - }; #endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/teamselect.cpp --- a/QTfrontend/teamselect.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,281 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include - -#include -#include -#include -#include -#include - -#include "vertScrollArea.h" -#include "teamselect.h" -#include "teamselhelper.h" -#include "frameTeam.h" - -void TeamSelWidget::addTeam(HWTeam team) -{ - if(team.isNetTeam()) { - framePlaying->addTeam(team, true); - curPlayingTeams.push_back(team); - connect(framePlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), - this, SLOT(netTeamStatusChanged(const HWTeam&))); - connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)), - this, SLOT(hhNumChanged(const HWTeam&))); - dynamic_cast(framePlaying->getTeamWidget(team))->hhNumChanged(); - connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), - this, SLOT(proxyTeamColorChanged(const HWTeam&))); - } else { - frameDontPlaying->addTeam(team, false); - m_curNotPlayingTeams.push_back(team); - if(m_acceptOuter) { - connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), - this, SLOT(pre_changeTeamStatus(HWTeam))); - } else { - connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), - this, SLOT(changeTeamStatus(HWTeam))); - } - } - emit setEnabledGameStart(curPlayingTeams.size()>1); -} - -void TeamSelWidget::setInteractivity(bool interactive) -{ - framePlaying->setInteractivity(interactive); -} - -void TeamSelWidget::hhNumChanged(const HWTeam& team) -{ - QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); - if(itPlay==curPlayingTeams.end()) - { - qWarning() << QString("hhNumChanged: team '%1' not found").arg(team.name()); - return; - } - itPlay->setNumHedgehogs(team.numHedgehogs()); - emit hhogsNumChanged(team); -} - -void TeamSelWidget::proxyTeamColorChanged(const HWTeam& team) -{ - QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); - if(itPlay==curPlayingTeams.end()) - { - qWarning() << QString("proxyTeamColorChanged: team '%1' not found").arg(team.name()); - return; - } - itPlay->setColor(team.color()); - emit teamColorChanged(team); -} - -void TeamSelWidget::changeHHNum(const HWTeam& team) -{ - QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); - if(itPlay==curPlayingTeams.end()) - { - qWarning() << QString("changeHHNum: team '%1' not found").arg(team.name()); - return; - } - itPlay->setNumHedgehogs(team.numHedgehogs()); - - framePlaying->setHHNum(team); -} - -void TeamSelWidget::changeTeamColor(const HWTeam& team) -{ - QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); - if(itPlay==curPlayingTeams.end()) - { - qWarning() << QString("changeTeamColor: team '%1' not found").arg(team.name()); - return; - } - itPlay->setColor(team.color()); - - framePlaying->setTeamColor(team); -} - -void TeamSelWidget::removeNetTeam(const HWTeam& team) -{ - //qDebug() << QString("removeNetTeam: removing team '%1'").arg(team.TeamName); - for(;;) { - QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); - if(itPlay==curPlayingTeams.end()) - { - qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name()); - break; - } - if(itPlay->isNetTeam()) { - QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam))); - framePlaying->removeTeam(team); - curPlayingTeams.erase(itPlay); - break; - } - } - emit setEnabledGameStart(curPlayingTeams.size()>1); -} - -void TeamSelWidget::netTeamStatusChanged(const HWTeam& team) -{ - QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); - -} - -//void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team) -//{ - //curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team)); -//} - -void TeamSelWidget::changeTeamStatus(HWTeam team) -{ - QList::iterator itDontPlay=std::find(m_curNotPlayingTeams.begin(), m_curNotPlayingTeams.end(), team); - QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); - - bool willBePlaying=itDontPlay!=m_curNotPlayingTeams.end(); - - if(!willBePlaying) { - // playing team => dont playing - m_curNotPlayingTeams.push_back(*itPlay); - emit teamNotPlaying(*itPlay); - curPlayingTeams.erase(itPlay); - } else { - // return if max playing teams reached - if(framePlaying->isFullTeams()) return; - // dont playing team => playing - team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network) - itDontPlay->setColor(framePlaying->getNextColor()); - curPlayingTeams.push_back(*itDontPlay); - if(!m_acceptOuter) emit teamWillPlay(*itDontPlay); - m_curNotPlayingTeams.erase(itDontPlay); - } - - FrameTeams* pRemoveTeams; - FrameTeams* pAddTeams; - if(!willBePlaying) { - pRemoveTeams=framePlaying; - pAddTeams=frameDontPlaying; - } else { - pRemoveTeams=frameDontPlaying; - pAddTeams=framePlaying; - } - - pAddTeams->addTeam(team, willBePlaying); - pRemoveTeams->removeTeam(team); - if(!team.isNetTeam() && m_acceptOuter && !willBePlaying) { - connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), - this, SLOT(pre_changeTeamStatus(HWTeam))); - } else { - connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), - this, SLOT(changeTeamStatus(HWTeam))); - } - if(willBePlaying) { - connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)), - this, SLOT(hhNumChanged(const HWTeam&))); - dynamic_cast(framePlaying->getTeamWidget(team))->hhNumChanged(); - connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), - this, SLOT(proxyTeamColorChanged(const HWTeam&))); - emit teamColorChanged(((TeamShowWidget*)framePlaying->getTeamWidget(team))->getTeam()); - } - - QSize szh=pAddTeams->sizeHint(); - QSize szh1=pRemoveTeams->sizeHint(); - if(szh.isValid() && szh1.isValid()) { - pAddTeams->resize(pAddTeams->size().width(), szh.height()); - pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height()); - } - - emit setEnabledGameStart(curPlayingTeams.size()>1); -} - -void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color, int fixedHeight) -{ - VertScrArea* area = new VertScrArea(color); - area->setWidget(pfteams); - mainLayout.addWidget(area, 30); - if (fixedHeight > 0) - { - area->setMinimumHeight(fixedHeight); - area->setMaximumHeight(fixedHeight); - area->setStyleSheet( - "FrameTeams{" - "border: solid;" - "border-width: 1px;" - "border-radius: 16px;" - "border-color: #ffcc00;" - "}" - ); - } -} - -TeamSelWidget::TeamSelWidget(QWidget* parent) : - QGroupBox(parent), mainLayout(this), m_acceptOuter(false) -{ - setTitle(QGroupBox::tr("Playing teams")); - framePlaying = new FrameTeams(); - frameDontPlaying = new FrameTeams(); - - QPalette p; - p.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); - addScrArea(framePlaying, p.color(QPalette::Window).light(105), 250); - addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105), 0); -} - -void TeamSelWidget::setAcceptOuter(bool acceptOuter) -{ - m_acceptOuter=acceptOuter; -} - -void TeamSelWidget::resetPlayingTeams(const QList& teamslist) -{ - //for(it=curPlayingTeams.begin(); it!=curPlayingTeams.end(); it++) { - //framePlaying->removeTeam(*it); - //} - framePlaying->resetTeams(); - framePlaying->resetColors(); - curPlayingTeams.clear(); - //for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) { - //frameDontPlaying->removeTeam(*it); - //} - frameDontPlaying->resetTeams(); - m_curNotPlayingTeams.clear(); - - foreach(HWTeam team, teamslist) - addTeam(team); -} - -bool TeamSelWidget::isPlaying(HWTeam team) const -{ - return std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team)!=curPlayingTeams.end(); -} - -QList TeamSelWidget::getPlayingTeams() const -{ - return curPlayingTeams; -} - -QList TeamSelWidget::getNotPlayingTeams() const -{ - return m_curNotPlayingTeams; -} - -void TeamSelWidget::pre_changeTeamStatus(HWTeam team) -{ - team.setColor(framePlaying->getNextColor()); - emit acceptRequested(team); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/teamselect.h --- a/QTfrontend/teamselect.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _TEAM_SELECT_INCLUDED -#define _TEAM_SELECT_INCLUDED - -#include -#include -#include -#include - -#include "team.h" - -class TeamSelWidget; -class FrameTeams; -class QFrame; -class QPushButton; - -using namespace std; - -class TeamSelWidget : public QGroupBox -{ - Q_OBJECT - - public: - TeamSelWidget(QWidget* parent); - void setAcceptOuter(bool acceptOuter); - void removeNetTeam(const HWTeam& team); - void resetPlayingTeams(const QList& teamslist); - bool isPlaying(HWTeam team) const; - QList getPlayingTeams() const; - QList getNotPlayingTeams() const; - void setInteractivity(bool interactive); - - public slots: - void addTeam(HWTeam team); - void netTeamStatusChanged(const HWTeam& team); - void changeHHNum(const HWTeam&); - void changeTeamColor(const HWTeam&); - void changeTeamStatus(HWTeam team); - - signals: - void setEnabledGameStart(bool); - void teamWillPlay(HWTeam team); - void teamNotPlaying(const HWTeam& team); - void hhogsNumChanged(const HWTeam&); - void teamColorChanged(const HWTeam&); - void acceptRequested(HWTeam team); - - private slots: - void pre_changeTeamStatus(HWTeam); - void hhNumChanged(const HWTeam& team); - void proxyTeamColorChanged(const HWTeam& team); - - private: - void addScrArea(FrameTeams* pfteams, QColor color, int maxHeight); - FrameTeams* frameDontPlaying; - FrameTeams* framePlaying; - - QVBoxLayout mainLayout; - bool m_acceptOuter; - - QList curPlayingTeams; - QList m_curNotPlayingTeams; -}; - -#endif // _TEAM_SELECT_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/teamselhelper.cpp --- a/QTfrontend/teamselhelper.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include -#include - -#include - -#include "teamselhelper.h" -#include "hwconsts.h" -#include "frameTeam.h" - -void TeamLabel::teamButtonClicked() -{ - emit teamActivated(text()); -} - -TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) : - QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0), - colorButt(0) -{ - QPalette newPalette = palette(); - newPalette.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); - setPalette(newPalette); - setAutoFillBackground(true); - - mainLayout.setSpacing(3); - mainLayout.setMargin(0); - this->setMaximumHeight(38); - this->setMinimumHeight(38); - QIcon difficultyIcon=team.isNetTeam() ? - QIcon(QString(":/res/botlevels/net%1.png").arg(m_team.difficulty())) - : QIcon(QString(":/res/botlevels/%1.png").arg(m_team.difficulty())); - - butt = new QPushButton(difficultyIcon, team.name().replace("&","&&"), this); - butt->setFlat(true); - butt->setToolTip(team.owner()); - mainLayout.addWidget(butt); - butt->setStyleSheet("QPushButton{" - "icon-size: 48px;" - "text-align: left;" - "background-color: #0d0544;" - "color: orange;" - "font: bold;" - "border-width: 2px;" - "margin: 6px 0px 6px 0px;" - "}"); - - if(m_isPlaying) { - // team color - colorButt = new QPushButton(this); - colorButt->setMaximumWidth(26); - colorButt->setMinimumHeight(26); - colorButt->setGeometry(0, 0, 26, 26); - - changeTeamColor(); - connect(colorButt, SIGNAL(clicked()), this, SLOT(changeTeamColor())); - mainLayout.addWidget(colorButt); - - phhoger = new CHedgehogerWidget(QImage(":/res/hh25x25.png"), QImage(":/res/hh25x25grey.png"), this); - connect(phhoger, SIGNAL(hedgehogsNumChanged()), this, SLOT(hhNumChanged())); - phhoger->setHHNum(team.numHedgehogs()); - mainLayout.addWidget(phhoger); - } else { - } - - QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam())); - //QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam())); -} - -void TeamShowWidget::setInteractivity(bool interactive) -{ - if(m_team.isNetTeam()) { - butt->setEnabled(interactive); - } - - colorButt->setEnabled(interactive); - phhoger->setEnabled(interactive); -} - -void TeamShowWidget::setHHNum(unsigned int num) -{ - phhoger->setHHNum(num); -} - -void TeamShowWidget::hhNumChanged() -{ - m_team.setNumHedgehogs(phhoger->getHedgehogsNum()); - emit hhNmChanged(m_team); -} - -void TeamShowWidget::activateTeam() -{ - emit teamStatusChanged(m_team); -} - -/*HWTeamTempParams TeamShowWidget::getTeamParams() const -{ - if(!phhoger) throw; - HWTeamTempParams params; - params.numHedgehogs=phhoger->getHedgehogsNum(); - params.teamColor=colorButt->palette().color(QPalette::Button); - return params; -}*/ - -void TeamShowWidget::changeTeamColor(QColor color) -{ - FrameTeams* pOurFrameTeams=dynamic_cast(parentWidget()); - if(!color.isValid()) { - if(++pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) { - pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin(); - } - color=*pOurFrameTeams->currentColor; - } else { - // set according color iterator - pOurFrameTeams->currentColor=std::find(pOurFrameTeams->availableColors.begin(), - pOurFrameTeams->availableColors.end(), color); - if(pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) { - // error condition - pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin(); - } - } - - colorButt->setStyleSheet(QString("QPushButton{" - "background-color: %1;" - "border-width: 1px;" - "border-radius: 2px;" - "}").arg(pOurFrameTeams->currentColor->name())); - - m_team.setColor(color); - emit teamColorChanged(m_team); -} - -HWTeam TeamShowWidget::getTeam() const -{ - return m_team; -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/teamselhelper.h --- a/QTfrontend/teamselhelper.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2007 Igor Ulyanov - * Copyright (c) 2007-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _TEAMSEL_HELPER_INCLUDED -#define _TEAMSEL_HELPER_INCLUDED - -#include -#include -#include -#include - -#include "teamselect.h" -#include "hedgehogerWidget.h" - -class TeamLabel : public QLabel -{ - Q_OBJECT - - public: - TeamLabel(const QString& inp_str) : QLabel(inp_str) {}; - - signals: - void teamActivated(QString team_name); - - public slots: - void teamButtonClicked(); - -}; - -class TeamShowWidget : public QWidget -{ - Q_OBJECT - - public slots: - void changeTeamColor(QColor color=QColor()); - void hhNumChanged(); - - private slots: - void activateTeam(); - - public: - TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent); - void setPlaying(bool isPlaying); - void setHHNum(unsigned int num); - void setInteractivity(bool interactive); - HWTeam getTeam() const; - - private: - TeamShowWidget(); - QHBoxLayout mainLayout; - HWTeam m_team; - bool m_isPlaying; - CHedgehogerWidget* phhoger; - QPushButton* colorButt; - QPushButton* butt; -// QPushButton* bText; - - signals: - void teamStatusChanged(HWTeam team); - void hhNmChanged(const HWTeam&); - void teamColorChanged(const HWTeam&); -}; - -#endif // _TEAMSEL_HELPER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/themesmodel.cpp --- a/QTfrontend/themesmodel.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - -#include "themesmodel.h" - -ThemesModel::ThemesModel(QStringList themes, QObject *parent) : - QAbstractListModel(parent) -{ -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) - m_data.reserve(themes.size()); -#endif - - foreach(QString theme, themes) - { - m_data.append(QHash()); - m_data.last().insert(Qt::DisplayRole, theme); - } -} - -int ThemesModel::rowCount(const QModelIndex &parent) const -{ - if(parent.isValid()) - return 0; - else - return m_data.size(); -} - -QVariant ThemesModel::data(const QModelIndex &index, int role) const -{ - if(index.column() > 0 || index.row() >= m_data.size()) - return QVariant(); - else - return m_data.at(index.row()).value(role); -} - -bool ThemesModel::setData(const QModelIndex &index, const QVariant &value, int role) -{ - if(index.column() > 0 || index.row() >= m_data.size()) - return false; - else - { - m_data[index.row()].insert(role, value); - - return true; - } - -} - - - - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/themesmodel.h --- a/QTfrontend/themesmodel.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#ifndef THEMESMODEL_H -#define THEMESMODEL_H - -#include -#include -#include - -class ThemesModel : public QAbstractListModel -{ - Q_OBJECT -public: - explicit ThemesModel(QStringList themes, QObject *parent = 0); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role) const; - bool setData(const QModelIndex &index, const QVariant &value, - int role = Qt::EditRole); - -signals: - -public slots: - -private: - - QList > m_data; -}; - -#endif // THEMESMODEL_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/togglebutton.cpp --- a/QTfrontend/togglebutton.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2009 Kristian Lehmann - * Copyright (c) 2009-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "togglebutton.h" - -ToggleButtonWidget::ToggleButtonWidget(QWidget * parent, QString img) - : QPushButton(parent) -{ - setCheckable(true); - - QPixmap pm(":/res/btnDisabled.png"); - QPainter * painter = new QPainter(); - - pmChecked.load(img); - pmDisabled.load(img); - - setMaximumWidth(pmChecked.width() + 6); - - painter->begin(&pmDisabled); - painter->drawPixmap(pmDisabled.rect(), pm); - painter->end(); - - setIconSize(pmDisabled.size()); - setIcon(pmDisabled); - - connect(this, SIGNAL(toggled(bool)), this, SLOT(eventToggled(bool))); -} - -ToggleButtonWidget::~ToggleButtonWidget() -{ -} - -void ToggleButtonWidget::eventToggled(bool checked) -{ - setIcon(checked ? pmChecked : pmDisabled); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/togglebutton.h --- a/QTfrontend/togglebutton.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2009 Kristian Lehmann - * Copyright (c) 2009-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef TOGGLEBUTTONWIDGET_H -#define TOGGLEBUTTONWIDGET_H - -#include -#include -#include -#include -#include - -class ToggleButtonWidget : public QPushButton -{ - Q_OBJECT -public: - ToggleButtonWidget(QWidget * parent, QString img); - ~ToggleButtonWidget(); -private: - QPixmap pmChecked; - QPixmap pmDisabled; -private slots: - void eventToggled(bool checked); -}; - -#endif // TOGGLEBUTTONWIDGET_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/dialog/input_ip.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/dialog/input_ip.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,68 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include + +#include "input_ip.h" + +HWHostPortDialog::HWHostPortDialog(QWidget* parent) : QDialog(parent) +{ + QGridLayout * layout = new QGridLayout(this); + + QLabel * lbHost = new QLabel(this); + lbHost->setText(QLabel::tr("Host:")); + layout->addWidget(lbHost, 0, 0); + + QLabel * lbPort = new QLabel(this); + lbPort->setText(QLabel::tr("Port:")); + layout->addWidget(lbPort, 1, 0); + + leHost = new QLineEdit(this); + layout->addWidget(leHost, 0, 1, 1, 2); + + sbPort = new QSpinBox(this); + sbPort->setMinimum(0); + sbPort->setMaximum(65535); + layout->addWidget(sbPort, 1, 1, 1, 2); + + pbDefault = new QPushButton(this); + pbDefault->setText(QPushButton::tr("default")); + layout->addWidget(pbDefault, 1, 3); + + pbOK = new QPushButton(this); + pbOK->setText(QPushButton::tr("OK")); + pbOK->setDefault(true); + layout->addWidget(pbOK, 3, 1); + + pbCancel = new QPushButton(this); + pbCancel->setText(QPushButton::tr("Cancel")); + layout->addWidget(pbCancel, 3, 2); + + connect(pbOK, SIGNAL(clicked()), this, SLOT(accept())); + connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); +} + +void HWHostPortDialog::setDefaultPort() +{ + sbPort->setValue(46631); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/dialog/input_ip.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/dialog/input_ip.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,49 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +#ifndef INPUT_IP_H +#define INPUT_IP_H + +#include +#include + +class QLineEdit; +class QSpinBox; +class QPushButton; + +class HWHostPortDialog : public QDialog +{ + Q_OBJECT +public: + HWHostPortDialog(QWidget* parent = 0); + + QLineEdit* leHost; + QSpinBox* sbPort; + +private: + QPushButton* pbOK; + QPushButton* pbCancel; + QPushButton * pbDefault; + +private slots: + void setDefaultPort(); +}; + + +#endif // INPUT_IP_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/AbstractPage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/AbstractPage.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,99 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief AbstractPage class implementation + */ + +#include "AbstractPage.h" + +AbstractPage::AbstractPage(QWidget* parent) +{ + Q_UNUSED(parent); + + font14 = new QFont("MS Shell Dlg", 14); +} + +void AbstractPage::initPage() +{ + QGridLayout * pageLayout = new QGridLayout(this); + + // stretch grid space for body and footer + pageLayout->setColumnStretch(0,0); + pageLayout->setColumnStretch(1,1); + pageLayout->setRowStretch(0,1); + pageLayout->setRowStretch(1,0); + + // add back/exit button + btnBack = formattedButton(":/res/Exit.png", true); + pageLayout->addWidget(btnBack, 1, 0, 1, 1, Qt::AlignLeft | Qt::AlignBottom); + + // add body layout as defined by the subclass + pageLayout->addLayout(bodyLayoutDefinition(), 0, 0, 1, 2); + + // add footer layout + QLayout * fld = footerLayoutDefinition(); + if (fld != NULL) + pageLayout->addLayout(fld, 1, 1); + + // connect signals + connect(btnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); + connectSignals(); +} + +QPushButton * AbstractPage::formattedButton(const QString & name, bool hasIcon) +{ + QPushButton * btn = new QPushButton(this); + + if (hasIcon) + { + const QIcon& lp=QIcon(name); + QSize sz = lp.actualSize(QSize(65535, 65535)); + btn->setIcon(lp); + btn->setFixedSize(sz); + btn->setIconSize(sz); + btn->setFlat(true); + btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + } + else + { + btn->setFont(*font14); + btn->setText(name); + } + return btn; +} + +QPushButton * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon) +{ + QPushButton * btn = formattedButton(name, hasIcon); + grid->addWidget(btn, row, column, rowSpan, columnSpan); + return btn; +} + +QPushButton * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon) +{ + QPushButton * btn = formattedButton(name, hasIcon); + box->addWidget(btn, where); + return btn; +} + +void AbstractPage::setBackButtonVisible(bool visible) +{ + btnBack->setVisible(visible); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/AbstractPage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/AbstractPage.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,162 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief AbstractPage class definition + */ + +#ifndef ABSTRACTPAGE_H +#define ABSTRACTPAGE_H + +#include +#include +#include +#include +#include +#include + +class QPushButton; +class QGroupBox; +class QComboBox; +class QLabel; +class QToolBox; +class QLineEdit; +class QListWidget; +class QCheckBox; +class QSpinBox; +class QTextEdit; +class QRadioButton; +class QTableView; +class QTextBrowser; +class QTableWidget; +class QAction; +class QDataWidgetMapper; +class QAbstractItemModel; +class QSettings; +class QSlider; +class QGridlayout; + +class AbstractPage : public QWidget +{ + Q_OBJECT + + signals: + /** + * @brief This signal is emitted when going back to the previous is + * requested - e.g. when the back-button is clicked. + */ + void goBack(); + + protected: + /** + * @brief Class constructor + * + * @param parent parent widget. + */ + AbstractPage(QWidget * parent = 0); + + /// Class Destructor + virtual ~AbstractPage() {}; + + /// Call this in the constructor of your subclass. + void initPage(); + + /** + * @brief Used during page construction. + * You MUST implement this method in your subclass. + * + * Use it to define the main layout (no behavior) of the page. + */ + virtual QLayout * bodyLayoutDefinition() = 0; + + /** + * @brief Used during page construction. + * You can implement this method in your subclass. + * + * Use it to define layout (not behavior) of the page's footer. + */ + virtual QLayout * footerLayoutDefinition() { return NULL; }; + + /** + * @brief Used during page construction. + * You can implement this method in your subclass. + * + * This is a good place to connect signals within your page in order + * to get the desired page behavior.
+ * Keep in mind not to expose twidgets as public! + * instead define a signal with a meaningful name and connect the widget + * signals to your page signals + */ + virtual void connectSignals() {}; + + /** + * @brief Creates a default formatted button for this page. + * + * @param name name of the button - used as its text if not hasIcon. + * @param hasIcon set to true if this is a picture button. + * + * @return the button. + */ + QPushButton * formattedButton(const QString & name, bool hasIcon = false); + + /** + * @brief Creates a default formatted button and adds it to a + * grid layout at the location specified. + * + * @param name label or path to icon of the button (depends on hasIcon) + * @param grid pointer of the grid layout in which to insert the button. + * @param row layout row index in which to insert the button. + * @param column layout column index in which to insert the button. + * @param rowSpan how many layout rows the button will span. + * @param columnSpan how many layout columns the button will span. + * @param hasIcon set to true if this is a picture button. + * + * @return the button. + */ + QPushButton * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false); + + /** + * @brief Creates a default formatted button and adds it to a + * grid layout at the location specified. + * + * @param name label or path to icon of the button (depends on hasIcon) + * @param box pointer of the box layout in which to insert the button. + * @param where layout ndex in which to insert the button. + * @param hasIcon set to true if this is a picture button. + * + * @return the button. + */ + QPushButton * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false); + + /** + * @brief Changes visibility of the back-button. + * + * @param visible set to true if the button should be visible. + */ + void setBackButtonVisible(bool visible = true); + + QFont * font14; ///< used font + + private: + + QPushButton * btnBack; ///< back button +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageadmin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageadmin.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,112 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include + +#include "pageadmin.h" +#include "chatwidget.h" + +QLayout * PageAdmin::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + + // 0 + pbAsk = addButton(tr("Fetch data"), pageLayout, 0, 0, 1, 3); + + // 1 + QLabel * lblSMN = new QLabel(this); + lblSMN->setText(tr("Server message for latest version:")); + pageLayout->addWidget(lblSMN, 1, 0); + + leServerMessageNew = new QLineEdit(this); + pageLayout->addWidget(leServerMessageNew, 1, 1); + + // 2 + QLabel * lblSMO = new QLabel(this); + lblSMO->setText(tr("Server message for previous versions:")); + pageLayout->addWidget(lblSMO, 2, 0); + + leServerMessageOld = new QLineEdit(this); + pageLayout->addWidget(leServerMessageOld, 2, 1); + + // 3 + QLabel * lblP = new QLabel(this); + lblP->setText(tr("Latest version protocol number:")); + pageLayout->addWidget(lblP, 3, 0); + + sbProtocol = new QSpinBox(this); + pageLayout->addWidget(sbProtocol, 3, 1); + + // 4 + QLabel * lblPreview = new QLabel(this); + lblPreview->setText(tr("MOTD preview:")); + pageLayout->addWidget(lblPreview, 4, 0); + + tb = new QTextBrowser(this); + tb->setOpenExternalLinks(true); + tb->document()->setDefaultStyleSheet(HWChatWidget::styleSheet()); + pageLayout->addWidget(tb, 4, 1, 1, 2); + + // 5 + pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 5, 0); + + // 6 + pbSetSM = addButton(tr("Set data"), pageLayout, 6, 0, 1, 3); + + return pageLayout; +} + +void PageAdmin::connectSignals() +{ + connect(pbAsk, SIGNAL(clicked()), this, SIGNAL(askServerVars())); + connect(leServerMessageNew, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &))); + connect(leServerMessageOld, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &))); + connect(pbClearAccountsCache, SIGNAL(clicked()), this, SIGNAL(clearAccountsCache())); + connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged())); +} + +PageAdmin::PageAdmin(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + +void PageAdmin::smChanged() +{ + emit setServerMessageNew(leServerMessageNew->text()); + emit setServerMessageOld(leServerMessageOld->text()); + emit setProtocol(sbProtocol->value()); +} + +void PageAdmin::serverMessageNew(const QString & str) +{ + leServerMessageNew->setText(str); +} + +void PageAdmin::serverMessageOld(const QString & str) +{ + leServerMessageOld->setText(str); +} +void PageAdmin::protocol(int proto) +{ + sbProtocol->setValue(proto); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageadmin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageadmin.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,60 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_ADMIN_H +#define PAGE_ADMIN_H + +#include "AbstractPage.h" + +class PageAdmin : public AbstractPage +{ + Q_OBJECT + +public: + PageAdmin(QWidget* parent = 0); + +public slots: + void serverMessageNew(const QString & str); + void serverMessageOld(const QString & str); + void protocol(int proto); + +signals: + void setServerMessageNew(const QString & str); + void setServerMessageOld(const QString & str); + void setProtocol(int proto); + void askServerVars(); + void clearAccountsCache(); + +protected: + QLayout * bodyLayoutDefinition(); + void connectSignals(); + +private: + QLineEdit * leServerMessageNew; + QLineEdit * leServerMessageOld; + QPushButton * pbSetSM; + QPushButton * pbAsk; + QSpinBox * sbProtocol; + QTextBrowser * tb; + QPushButton * pbClearAccountsCache; + +private slots: + void smChanged(); +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagecampaign.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagecampaign.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,53 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include + +#include "pagecampaign.h" + +QLayout * PageCampaign::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 2); + pageLayout->setColumnStretch(2, 1); + pageLayout->setRowStretch(0, 1); + pageLayout->setRowStretch(3, 1); + + CBSelect = new QComboBox(this); + CBTeam = new QComboBox(this); + + pageLayout->addWidget(CBTeam, 1, 1); + pageLayout->addWidget(CBSelect, 2, 1); + + BtnStartCampaign = new QPushButton(this); + BtnStartCampaign->setFont(*font14); + BtnStartCampaign->setText(QPushButton::tr("Go!")); + pageLayout->addWidget(BtnStartCampaign, 2, 2); + + return pageLayout; +} + +PageCampaign::PageCampaign(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagecampaign.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagecampaign.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,39 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_CAMPAIGN_H +#define PAGE_CAMPAIGN_H + +#include "AbstractPage.h" + +class PageCampaign : public AbstractPage +{ + Q_OBJECT + +public: + PageCampaign(QWidget* parent = 0); + + QPushButton *BtnStartCampaign; + QComboBox *CBSelect; + QComboBox *CBTeam; + +protected: + QLayout * bodyLayoutDefinition(); +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageconnecting.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageconnecting.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,43 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include + +#include "pageconnecting.h" + +QLayout * PageConnecting::bodyLayoutDefinition() +{ + QVBoxLayout * pageLayout = new QVBoxLayout(); + + QLabel * lblConnecting = new QLabel(this); + lblConnecting->setText(tr("Connecting...")); + pageLayout->addWidget(lblConnecting); + + return pageLayout; +} + +void PageConnecting::connectSignals() +{ + connect(this, SIGNAL(goBack()), this, SIGNAL(cancelConnection())); +} + +PageConnecting::PageConnecting(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageconnecting.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageconnecting.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,39 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_CONNECTING_H +#define PAGE_CONNECTING_H + +#include "AbstractPage.h" + +class PageConnecting : public AbstractPage +{ + Q_OBJECT + +public: + PageConnecting(QWidget* parent = 0); + +signals: + void cancelConnection(); + +protected: + QLayout * bodyLayoutDefinition(); + void connectSignals(); +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagedata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagedata.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,229 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pagedata.h" +#include "databrowser.h" +#include "hwconsts.h" + +#include "quazip.h" +#include "quazipfile.h" + +QLayout * PageDataDownload::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 1); + pageLayout->setColumnStretch(2, 1); + + web = new DataBrowser(this); + pageLayout->addWidget(web, 0, 0, 1, 3); + + progressBarsLayout = new QVBoxLayout(); + pageLayout->addLayout(progressBarsLayout, 1, 0, 1, 3); + return pageLayout; +} + +void PageDataDownload::connectSignals() +{ + connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&))); +} + +PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent) +{ + initPage(); + + web->setOpenLinks(false); + fetchList(); +} + +void PageDataDownload::request(const QUrl &url) +{ + QUrl finalUrl; + if(url.host().isEmpty()) + finalUrl = QUrl("http://www.hedgewars.org" + url.path()); + else + finalUrl = url; + + if(url.path().endsWith(".zip")) + { + qWarning() << "Download Request" << url.toString(); + QString fileName = QFileInfo(url.toString()).fileName(); + + QNetworkRequest newRequest(finalUrl); + newRequest.setAttribute(QNetworkRequest::User, fileName); + + QNetworkAccessManager *manager = new QNetworkAccessManager(this); + QNetworkReply *reply = manager->get(newRequest); + connect(reply, SIGNAL(finished()), this, SLOT(fileDownloaded())); + connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64))); + + QProgressBar *progressBar = new QProgressBar(this); + progressBarsLayout->addWidget(progressBar); + progressBars.insert(reply, progressBar); + } else + { + qWarning() << "Page Request" << url.toString(); + + QNetworkRequest newRequest(finalUrl); + + QNetworkAccessManager *manager = new QNetworkAccessManager(this); + QNetworkReply *reply = manager->get(newRequest); + connect(reply, SIGNAL(finished()), this, SLOT(pageDownloaded())); + } +} + + +void PageDataDownload::pageDownloaded() +{ + QNetworkReply * reply = qobject_cast(sender()); + + if(reply) + { + QString html = QString::fromUtf8(reply->readAll()); + int begin = html.indexOf(""); + int end = html.indexOf(""); + if(begin != -1 && begin < end) + { + html.truncate(end); + html.remove(0, begin); + } + web->setHtml(html); + } +} + +void PageDataDownload::fileDownloaded() +{ + QNetworkReply * reply = qobject_cast(sender()); + + if(reply) + { + QByteArray fileContents = reply->readAll(); + QProgressBar *progressBar = progressBars.value(reply, 0); + + if(progressBar) + { + progressBars.remove(reply); + progressBar->deleteLater(); + } + + extractDataPack(&fileContents); + } +} + +void PageDataDownload::downloadProgress(qint64 bytesRecieved, qint64 bytesTotal) +{ + QNetworkReply * reply = qobject_cast(sender()); + + if(reply) + { + QProgressBar *progressBar = progressBars.value(reply, 0); + + if(progressBar) + { + progressBar->setValue(bytesRecieved); + progressBar->setMaximum(bytesTotal); + } + } +} + +void PageDataDownload::fetchList() +{ + request(QUrl("http://hedgewars.org/content.html")); +} + +bool PageDataDownload::extractDataPack(QByteArray * buf) +{ + QBuffer buffer; + buffer.setBuffer(buf); + + QuaZip zip; + zip.setIoDevice(&buffer); + if(!zip.open(QuaZip::mdUnzip)) + { + qWarning("testRead(): zip.open(): %d", zip.getZipError()); + return false; + } + + QuaZipFile file(&zip); + + QDir extractDir(*cfgdir); + extractDir.cd("Data"); + + for(bool more = zip.goToFirstFile(); more; more = zip.goToNextFile()) + { + if(!file.open(QIODevice::ReadOnly)) + { + qWarning("file.open(): %d", file.getZipError()); + return false; + } + + + QString fileName = file.getActualFileName(); + QString filePath = extractDir.filePath(fileName); + if (fileName.endsWith("/")) + { + QFileInfo fi(filePath); + QDir().mkpath(fi.filePath()); + } else + { + qDebug() << "Extracting" << filePath; + QFile out(filePath); + if(!out.open(QFile::WriteOnly)) + { + qWarning() << "out.open():" << out.errorString(); + return false; + } + + out.write(file.readAll()); + + out.close(); + + if(file.getZipError() != UNZ_OK) { + qWarning("file.getFileName(): %d", file.getZipError()); + return false; + } + + if(!file.atEnd()) { + qWarning("read all but not EOF"); + return false; + } + } + + file.close(); + + if(file.getZipError()!=UNZ_OK) { + qWarning("file.close(): %d", file.getZipError()); + return false; + } + } + + zip.close(); + + return true; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagedata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagedata.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,59 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_DATA_H +#define PAGE_DATA_H + +#include +#include "AbstractPage.h" + +class DataBrowser; +class QProgressBar; +class QNetworkReply; +class QVBoxLayout; + +class PageDataDownload : public AbstractPage +{ + Q_OBJECT + +public: + PageDataDownload(QWidget* parent = 0); + +public slots: + void fetchList(); + +protected: + QLayout * bodyLayoutDefinition(); + void connectSignals(); + +private: + DataBrowser *web; + QHash progressBars; + QVBoxLayout *progressBarsLayout; + + bool extractDataPack(QByteArray * buf); + +private slots: + void request(const QUrl &url); + + void pageDownloaded(); + void fileDownloaded(); + void downloadProgress(qint64, qint64); +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagedrawmap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagedrawmap.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,69 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include + +#include "pagedrawmap.h" +#include "drawmapwidget.h" + + +QLayout * PageDrawMap::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + + pbUndo = addButton(tr("Undo"), pageLayout, 0, 0); + pbClear = addButton(tr("Clear"), pageLayout, 1, 0); + pbLoad = addButton(tr("Load"), pageLayout, 2, 0); + pbSave = addButton(tr("Save"), pageLayout, 3, 0); + + drawMapWidget = new DrawMapWidget(this); + pageLayout->addWidget(drawMapWidget, 0, 1, 5, 1); + + return pageLayout; +} + +void PageDrawMap::connectSignals() +{ + connect(pbUndo, SIGNAL(clicked()), drawMapWidget, SLOT(undo())); + connect(pbClear, SIGNAL(clicked()), drawMapWidget, SLOT(clear())); + connect(pbLoad, SIGNAL(clicked()), this, SLOT(load())); + connect(pbSave, SIGNAL(clicked()), this, SLOT(save())); +} + +PageDrawMap::PageDrawMap(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + +void PageDrawMap::load() +{ + QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)"); + + if(!fileName.isEmpty()) + drawMapWidget->load(fileName); +} + +void PageDrawMap::save() +{ + QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)"); + + if(!fileName.isEmpty()) + drawMapWidget->save(fileName); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagedrawmap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagedrawmap.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,51 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_DRAWMAP_H +#define PAGE_DRAWMAP_H + +#include "AbstractPage.h" + +class DrawMapWidget; + +class PageDrawMap : public AbstractPage +{ + Q_OBJECT + +public: + PageDrawMap(QWidget* parent = 0); + + DrawMapWidget * drawMapWidget; + +protected: + QLayout * bodyLayoutDefinition(); + void connectSignals(); + +private: + QPushButton * pbUndo; + QPushButton * pbClear; + QPushButton * pbLoad; + QPushButton * pbSave; + +private slots: + void load(); + void save(); +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageeditteam.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageeditteam.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,470 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sdlkeys.h" +#include "SquareLabel.h" +#include "hats.h" +#include "HWApplication.h" + +#include "HWDataManager.h" + +#include "pageeditteam.h" + +QLayout * PageEditTeam::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + QTabWidget * tbw = new QTabWidget(); + QWidget * page1 = new QWidget(this); + QWidget * page2 = new QWidget(this); + tbw->addTab(page1, tr("General")); + tbw->addTab(page2, tr("Advanced")); + pageLayout->addWidget(tbw, 0, 0, 1, 3); + + QHBoxLayout * page1Layout = new QHBoxLayout(page1); + page1Layout->setAlignment(Qt::AlignTop); + QGridLayout * page2Layout = new QGridLayout(page2); + +// ====== Page 1 ====== + QVBoxLayout * vbox1 = new QVBoxLayout(); + QVBoxLayout * vbox2 = new QVBoxLayout(); + page1Layout->addLayout(vbox1); + page1Layout->addLayout(vbox2); + + GBoxHedgehogs = new QGroupBox(this); + GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); + GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); + + HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); + for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) + { + HHHats[i] = new QComboBox(GBoxHedgehogs); + HHHats[i]->setModel(hatsModel); + HHHats[i]->setIconSize(QSize(32, 37)); + //HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); + //HHHats[i]->setModelColumn(1); + //HHHats[i]->setMinimumWidth(132); + GBHLayout->addWidget(HHHats[i], i, 0); + + HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); + HHNameEdit[i]->setMaxLength(64); + HHNameEdit[i]->setMinimumWidth(120); + GBHLayout->addWidget(HHNameEdit[i], i, 1); + + btnRandomHogName[i] = addButton(":/res/dice.png", GBHLayout, i, 3, 1, 1, true); + } + + btnRandomTeam = addButton(QPushButton::tr("Random Team"), GBHLayout, 9, 0); + + vbox1->addWidget(GBoxHedgehogs); + + GBoxTeam = new QGroupBox(this); + GBoxTeam->setTitle(QGroupBox::tr("Team Settings")); + GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + QGridLayout * GBTLayout = new QGridLayout(GBoxTeam); + QLabel * tmpLabel = new QLabel(GBoxTeam); + tmpLabel->setText(QLabel::tr("Name")); + GBTLayout->addWidget(tmpLabel, 0, 0); + tmpLabel = new QLabel(GBoxTeam); + tmpLabel->setText(QLabel::tr("Type")); + GBTLayout->addWidget(tmpLabel, 1, 0); + tmpLabel = new QLabel(GBoxTeam); + tmpLabel->setText(QLabel::tr("Grave")); + GBTLayout->addWidget(tmpLabel, 2, 0); + tmpLabel = new QLabel(GBoxTeam); + tmpLabel->setText(QLabel::tr("Flag")); + GBTLayout->addWidget(tmpLabel, 3, 0); + tmpLabel = new QLabel(GBoxTeam); + tmpLabel->setText(QLabel::tr("Voice")); + GBTLayout->addWidget(tmpLabel, 4, 0); + + TeamNameEdit = new QLineEdit(GBoxTeam); + TeamNameEdit->setMaxLength(64); + GBTLayout->addWidget(TeamNameEdit, 0, 1); + vbox2->addWidget(GBoxTeam); + + CBTeamLvl = new QComboBox(GBoxTeam); + CBTeamLvl->setIconSize(QSize(48, 48)); + CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); + for(int i = 5; i > 0; i--) + CBTeamLvl->addItem( + QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), + QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) + ); + GBTLayout->addWidget(CBTeamLvl, 1, 1); + + CBGrave = new QComboBox(GBoxTeam); + CBGrave->setMaxCount(65535); + CBGrave->setIconSize(QSize(32, 32)); + GBTLayout->addWidget(CBGrave, 2, 1); + + CBFlag = new QComboBox(GBoxTeam); + CBFlag->setMaxCount(65535); + CBFlag->setIconSize(QSize(22, 15)); + GBTLayout->addWidget(CBFlag, 3, 1); + + QHBoxLayout * hbox = new QHBoxLayout(); + CBVoicepack = new QComboBox(GBoxTeam); + + hbox->addWidget(CBVoicepack, 100); + btnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true); + hbox->setStretchFactor(btnTestSound, 1); + + GBTLayout->addLayout(hbox, 4, 1); + + GBoxFort = new QGroupBox(this); + GBoxFort->setTitle(QGroupBox::tr("Fort")); + QGridLayout * GBFLayout = new QGridLayout(GBoxFort); + CBFort = new QComboBox(GBoxFort); + CBFort->setMaxCount(65535); + GBFLayout->addWidget(CBFort, 0, 0); + FortPreview = new SquareLabel(GBoxFort); + FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + FortPreview->setMinimumSize(128, 128); + FortPreview->setPixmap(QPixmap()); + // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars + //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true); + GBFLayout->addWidget(FortPreview, 1, 0); + vbox2->addWidget(GBoxFort); + + vbox1->addStretch(); + vbox2->addStretch(); + +// ====== Page 2 ====== + GBoxBinds = new QGroupBox(this); + GBoxBinds->setTitle(QGroupBox::tr("Key binds")); + QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); + BindsBox = new QToolBox(GBoxBinds); + BindsBox->setLineWidth(0); + GBBLayout->addWidget(BindsBox); + page2Layout->addWidget(GBoxBinds, 0, 0); + + quint16 i = 0; + quint16 num = 0; + QWidget * curW = NULL; + QGridLayout * pagelayout = NULL; + QLabel* l = NULL; + while (i < BINDS_NUMBER) { + if(cbinds[i].category != NULL) + { + if(curW != NULL) + { + l = new QLabel(curW); + l->setText(""); + pagelayout->addWidget(l, num++, 0, 1, 2); + } + curW = new QWidget(this); + BindsBox->addItem(curW, HWApplication::translate("binds (categories)", cbinds[i].category)); + pagelayout = new QGridLayout(curW); + num = 0; + } + if(cbinds[i].description != NULL) + { + l = new QLabel(curW); + l->setText((num > 0 ? QString("\n") : QString("")) + HWApplication::translate("binds (descriptions)", cbinds[i].description)); + pagelayout->addWidget(l, num++, 0, 1, 2); + } + + l = new QLabel(curW); + l->setText(HWApplication::translate("binds", cbinds[i].name)); + l->setAlignment(Qt::AlignRight); + pagelayout->addWidget(l, num, 0); + CBBind[i] = new QComboBox(curW); + for(int j = 0; sdlkeys[j][1][0] != '\0'; j++) + CBBind[i]->addItem(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]); + pagelayout->addWidget(CBBind[i++], num++, 1); + } + + return pageLayout; +} + +QLayout * PageEditTeam::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout(); + + btnSave = addButton(":/res/Save.png", bottomLayout, 0, true);; + btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}"); + bottomLayout->setAlignment(btnSave, Qt::AlignRight | Qt::AlignBottom); + + return bottomLayout; +} + +void PageEditTeam::connectSignals() +{ + connect(btnSave, SIGNAL(clicked()), this, SLOT(saveTeam())); + + signalMapper1 = new QSignalMapper(this); + signalMapper2 = new QSignalMapper(this); + + connect(signalMapper1, SIGNAL(mapped(int)), this, SLOT(fixHHname(int))); + connect(signalMapper2, SIGNAL(mapped(int)), this, SLOT(setRandomName(int))); + + for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) + { + connect(HHNameEdit[i], SIGNAL(editingFinished()), signalMapper1, SLOT(map())); + signalMapper1->setMapping(HHNameEdit[i], i); + + connect(btnRandomHogName[i], SIGNAL(clicked()), signalMapper2, SLOT(map())); + signalMapper2->setMapping(btnRandomHogName[i], i); + } + + connect(btnRandomTeam, SIGNAL(clicked()), this, SLOT(setRandomNames())); + + connect(btnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); + + connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); +} + +PageEditTeam::PageEditTeam(QWidget* parent) : + AbstractPage(parent) +{ + initPage(); + + QRegExp pngSuffix("\\.png$"); + + m_playerHash = "0000000000000000000000000000000000000000"; + + HWDataManager & dataMgr = HWDataManager::instance(); + + QStringList list; + + + // voicepacks + list = dataMgr.entryList("Sounds/voices", + QDir::AllDirs | QDir::NoDotAndDotDot); + + CBVoicepack->addItems(list); + + + // forts + list = dataMgr.entryList("Forts", QDir::Files, QStringList("*L.png")); + list.replaceInStrings(QRegExp("L\\.png$"), ""); + CBFort->addItems(list); + + + // graves + list = + dataMgr.entryList("Graphics/Graves", QDir::Files, QStringList("*.png")); + + foreach (QString file, list) + { + QPixmap pix(dataMgr.findFileForRead("Graphics/Graves/" + file)); + if ((pix.height() > 32) || pix.width() > 32) + pix = pix.copy(0, 0, 32, 32); + QIcon icon(pix); + + QString grave = QString(file).remove(pngSuffix); + + CBGrave->addItem(icon, grave); + } + + // flags + + list = + dataMgr.entryList("Graphics/Flags", QDir::Files, QStringList("*.png")); + + // skip cpu and hedgewars flags + int idx = list.indexOf("cpu.png"); + if (idx >= 0) + list.removeAt(idx); + idx = list.indexOf("hedgewars.png"); + if (idx >= 0) + list.removeAt(idx); + + // add the default flag + QPixmap hwFlag(dataMgr.findFileForRead("Graphics/Flags/hedgewars.png")); + CBFlag->addItem(QIcon(hwFlag.copy(0, 0, 22, 15)), "Hedgewars", "hedgewars"); + + // add seperator after + CBFlag->insertSeparator(1); + + int insertAt = 2; // insert country flags after Hedgewars flag and seperator + + // add all country flags + foreach (const QString & file, list) + { + QIcon icon(QPixmap(dataMgr.findFileForRead("Graphics/Flags/" + file))); + + QString flag = QString(file).remove(pngSuffix); + + bool isCountryFlag = !file.startsWith("cm_"); + + if (isCountryFlag) + { + CBFlag->insertItem(insertAt, icon, flag.replace("_", " "), flag); + insertAt++; + } + else // append community flags at end + CBFlag->addItem(icon, flag.replace("cm_", QComboBox::tr("Community") + ": "), flag); + } + + // add separator between country flags and community flags + CBFlag->insertSeparator(insertAt); +} + +void PageEditTeam::fixHHname(int idx) +{ + HHNameEdit[idx]->setText(HHNameEdit[idx]->text().trimmed()); + + if (HHNameEdit[idx]->text().isEmpty()) + HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1)); +} + +void PageEditTeam::CBFort_activated(const QString & fortname) +{ + HWDataManager & dataMgr = HWDataManager::instance(); + QPixmap pix(dataMgr.findFileForRead("Forts/" + fortname + "L.png")); + FortPreview->setPixmap(pix); +} + +void PageEditTeam::testSound() +{ + HWDataManager & dataMgr = HWDataManager::instance(); + + QString voiceDir = QString("Sounds/voices/") + CBVoicepack->currentText(); + + QStringList list = dataMgr.entryList( + voiceDir, + QDir::Files, + QStringList() << + "Illgetyou.ogg" << + "Incoming.ogg" << + "Stupid.ogg" << + "Coward.ogg" << + "Firstblood.ogg" + ); + + if (!list.isEmpty()) + SDLInteraction::instance().playSoundFile( + dataMgr.findFileForRead(voiceDir + "/" + + list[rand() % list.size()]) + ); +} + +void PageEditTeam::createTeam(const QString & name, const QString & playerHash) +{ + m_playerHash = playerHash; + HWTeam newTeam(name); + loadTeam(newTeam); +} + +void PageEditTeam::editTeam(const QString & name, const QString & playerHash) +{ + m_playerHash = playerHash; + HWTeam team(name); + team.loadFromFile(); + loadTeam(team); +} + +void PageEditTeam::deleteTeam(const QString & name) +{ + QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel, this); + + if (reallyDelete.exec() == QMessageBox::Ok) + HWTeam(name).deleteFile(); +} + +void PageEditTeam::setRandomNames() +{ + HWTeam team = data(); + HWNamegen::teamRandomNames(team, true); + loadTeam(team); +} + +void PageEditTeam::setRandomName(int hh_index) +{ + HWTeam team = data(); + HWNamegen::teamRandomName(team,hh_index); + loadTeam(team); +} + +void PageEditTeam::loadTeam(const HWTeam & team) +{ + TeamNameEdit->setText(team.name()); + CBTeamLvl->setCurrentIndex(team.difficulty()); + + for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) + { + HWHog hh = team.hedgehog(i); + + HHNameEdit[i]->setText(hh.Name); + + if (hh.Hat.startsWith("Reserved")) + hh.Hat = "Reserved "+hh.Hat.remove(0,40); + + HHHats[i]->setCurrentIndex(HHHats[i]->findData(hh.Hat, Qt::DisplayRole)); + } + + CBGrave->setCurrentIndex(CBGrave->findText(team.grave())); + CBFlag->setCurrentIndex(CBFlag->findData(team.flag())); + + CBFort->setCurrentIndex(CBFort->findText(team.fort())); + CBVoicepack->setCurrentIndex(CBVoicepack->findText(team.voicepack())); + + for(int i = 0; i < BINDS_NUMBER; i++) + { + CBBind[i]->setCurrentIndex(CBBind[i]->findData(team.keyBind(i))); + } +} + +HWTeam PageEditTeam::data() +{ + HWTeam team(TeamNameEdit->text()); + team.setDifficulty(CBTeamLvl->currentIndex()); + + for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) + { + HWHog hh; + hh.Name = HHNameEdit[i]->text(); + hh.Hat = HHHats[i]->currentText(); + + if (hh.Hat.startsWith("Reserved")) + hh.Hat = "Reserved"+m_playerHash+hh.Hat.remove(0,9); + + team.setHedgehog(i,hh); + } + + team.setGrave(CBGrave->currentText()); + team.setFort(CBFort->currentText()); + team.setVoicepack(CBVoicepack->currentText()); + team.setFlag(CBFlag->itemData(CBFlag->currentIndex()).toString()); + + for(int i = 0; i < BINDS_NUMBER; i++) + { + team.bindKey(i,CBBind[i]->itemData(CBBind[i]->currentIndex()).toString()); + } + + return team; +} + +void PageEditTeam::saveTeam() +{ + data().saveToFile(); + emit teamEdited(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageeditteam.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageeditteam.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,97 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_EDITTEAM_H +#define PAGE_EDITTEAM_H + +#include "AbstractPage.h" +#include "binds.h" +#include "hwconsts.h" +#include "namegen.h" +#include "SDLInteraction.h" + +#include "team.h" + +class SquareLabel; + +class PageEditTeam : public AbstractPage +{ + Q_OBJECT + +public: + PageEditTeam(QWidget* parent); + + void createTeam(const QString & name, const QString & playerHash); + void editTeam(const QString & name, const QString & playerHash); + void deleteTeam(const QString & name); + +signals: + void teamEdited(); + +public slots: + void CBFort_activated(const QString & gravename); + +private: + QSignalMapper* signalMapper1; + QSignalMapper* signalMapper2; + QGroupBox *GBoxHedgehogs; + QGroupBox *GBoxTeam; + QGroupBox *GBoxFort; + QComboBox *CBFort; + SquareLabel *FortPreview; + QComboBox *CBGrave; + QComboBox *CBFlag; + QComboBox *CBTeamLvl; + QComboBox *CBVoicepack; + QGroupBox *GBoxBinds; + QToolBox *BindsBox; + QLineEdit * TeamNameEdit; + QLineEdit * HHNameEdit[HEDGEHOGS_PER_TEAM]; + QComboBox * HHHats[HEDGEHOGS_PER_TEAM]; + QComboBox * CBBind[BINDS_NUMBER]; + HWTeam data(); + QString m_playerHash; + + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + + void loadTeam(const HWTeam & team); + + // page 1 + QPushButton * btnRandomHogName[HEDGEHOGS_PER_TEAM]; + QPushButton * btnRandomTeam; + QPushButton * btnTestSound; + + // footer + QPushButton * btnSave; + +private slots: + void saveTeam(); + void setRandomNames(); + + void setRandomName(int hh_index); + + /// Plays a random voice sound of the currently edited team. + void testSound(); + + void fixHHname(int idx); +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagegamestats.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagegamestats.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,274 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2010-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include + +#include "pagegamestats.h" +#include "team.h" + +FitGraphicsView::FitGraphicsView(QWidget* parent) : QGraphicsView(parent) +{ + +} + +void FitGraphicsView::resizeEvent(QResizeEvent * event) +{ + Q_UNUSED(event); + + fitInView(sceneRect()); +} + +QLayout * PageGameStats::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + pageLayout->setSpacing(20); + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 1); + pageLayout->setContentsMargins(7, 7, 7, 0); + + QGroupBox * gb = new QGroupBox(this); + QVBoxLayout * gbl = new QVBoxLayout; + + // details + labelGameStats = new QLabel(this); + QLabel * l = new QLabel(this); + l->setTextFormat(Qt::RichText); + l->setText("

" + PageGameStats::tr("Details") + "

"); + l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + labelGameStats->setTextFormat(Qt::RichText); + labelGameStats->setAlignment(Qt::AlignTop); + labelGameStats->setWordWrap(true); + gbl->addWidget(l); + gbl->addWidget(labelGameStats); + gb->setLayout(gbl); + pageLayout->addWidget(gb, 1, 1, 1, 2); + + // graph + graphic = new FitGraphicsView(gb); + l = new QLabel(this); + l->setTextFormat(Qt::RichText); + l->setText("

" + PageGameStats::tr("Health graph") + "

"); + l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + gbl->addWidget(l); + gbl->addWidget(graphic); + graphic->scale(1.0, -1.0); + graphic->setBackgroundBrush(QBrush(Qt::black)); + + labelGameWin = new QLabel(this); + labelGameWin->setTextFormat(Qt::RichText); + pageLayout->addWidget(labelGameWin, 0, 0, 1, 2); + + // ranking box + gb = new QGroupBox(this); + gbl = new QVBoxLayout; + labelGameRank = new QLabel(gb); + l = new QLabel(this); + l->setTextFormat(Qt::RichText); + l->setText("

" + PageGameStats::tr("Ranking") + "

"); + l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + gbl->addWidget(l); + gbl->addWidget(labelGameRank); + gb->setLayout(gbl); + + labelGameRank->setTextFormat(Qt::RichText); + labelGameRank->setAlignment(Qt::AlignTop); + pageLayout->addWidget(gb, 1, 0); + + return pageLayout; +} + +QLayout * PageGameStats::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout(); + + btnSave = addButton(":/res/Save.png", bottomLayout, 0, true); + btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}"); + bottomLayout->setAlignment(btnSave, Qt::AlignRight | Qt::AlignBottom); + + return bottomLayout; +} + +void PageGameStats::connectSignals() +{ + connect(btnSave, SIGNAL(clicked()), this, SIGNAL(saveDemoRequested())); +} + +PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + +void PageGameStats::AddStatText(const QString & msg) +{ + labelGameStats->setText(labelGameStats->text() + msg); +} + +void PageGameStats::clear() +{ + labelGameStats->setText(""); + healthPoints.clear(); + labelGameRank->setText(""); + playerPosition = 0; + lastColor = 0; +} + +void PageGameStats::renderStats() +{ + QGraphicsScene * scene = new QGraphicsScene(); + + QMap >::const_iterator i = healthPoints.constBegin(); + while (i != healthPoints.constEnd()) + { + quint32 c = i.key(); + QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); + QVector hps = i.value(); + + QPainterPath path; + if (hps.size()) + path.moveTo(0, hps[0]); + + for(int t = 1; t < hps.size(); ++t) + path.lineTo(t, hps[t]); + + scene->addPath(path, QPen(c)); + ++i; + } + + graphic->setScene(scene); + graphic->fitInView(graphic->sceneRect()); +} + +void PageGameStats::GameStats(char type, const QString & info) +{ + switch(type) { + case 'r' : { + labelGameWin->setText(QString("

%1

").arg(info)); + break; + } + case 'D' : { + int i = info.indexOf(' '); + QString message = "

" + PageGameStats::tr("The best shot award was won by %1 with %2 pts.").arg(info.mid(i + 1), info.left(i)) + "

"; + AddStatText(message); + break; + } + case 'k' : { + int i = info.indexOf(' '); + int num = info.left(i).toInt(); + QString message = "

" + PageGameStats::tr("The best killer is %1 with %2 kills in a turn.", "", num).arg(info.mid(i + 1), info.left(i)) + "

"; + AddStatText(message); + break; + } + case 'K' : { + int num = info.toInt(); + QString message = "

" + PageGameStats::tr("A total of %1 hedgehog(s) were killed during this round.", "", num).arg(num) + "

"; + AddStatText(message); + break; + } + case 'H' : { + int i = info.indexOf(' '); + quint32 clan = info.left(i).toInt(); + quint32 hp = info.mid(i + 1).toUInt(); + healthPoints[clan].append(hp); + break; + } + case 'T': { // local team stats + //AddStatText("

local team: " + info + "

"); + QStringList infol = info.split(":"); + HWTeam team(infol[0]); + if(team.fileExists()) // do some better test to avoid influence from scripted/predefined teams? + { + team.loadFromFile(); + team.incRounds(); + if(infol[1].toInt() > 0) // might require some better test for winning condition (or changed flag) ... WIP! + team.incWins(); // should draws count as wins? + //team.SaveToFile(); // don't save yet + } + break; + } + + case 'P' : { + int i = info.indexOf(' '); + playerPosition++; + QString color = info.left(i); + quint32 c = color.toInt(); + QColor clanColor = QColor(qRgb((c >> 16) & 255, (c >> 8) & 255, c & 255)); + + QString playerinfo = info.mid(i + 1); + + i = playerinfo.indexOf(' '); + + int kills = playerinfo.left(i).toInt(); + QString playername = playerinfo.mid(i + 1); + QString image; + + if (lastColor == c) playerPosition--; + lastColor = c; + + switch (playerPosition) + { + case 1: + image = ""; + break; + case 2: + image = ""; + break; + case 3: + image = ""; + break; + default: + image = ""; + break; + } + + QString message; + QString killstring = PageGameStats::tr("(%1 kill)", "", kills).arg(kills); + + message = QString("

%1 %2. %3 ").arg(image, QString::number(playerPosition), playername, clanColor.name()) + killstring + "

"; + + labelGameRank->setText(labelGameRank->text() + message); + break; + } + case 's' : { + int i = info.indexOf(' '); + int num = info.left(i).toInt(); + QString message = "

" + PageGameStats::tr("%1 thought it's good to shoot his own hedgehogs with %2 pts.", "", num).arg(info.mid(i + 1)).arg(num) + "

"; + AddStatText(message); + break; + } + case 'S' : { + int i = info.indexOf(' '); + int num = info.left(i).toInt(); + QString message = "

" + PageGameStats::tr("%1 killed %2 of his own hedgehogs.", "", num).arg(info.mid(i + 1)).arg(num) + "

"; + AddStatText(message); + break; + } + case 'B' : { + int i = info.indexOf(' '); + int num = info.left(i).toInt(); + QString message = "

" + PageGameStats::tr("%1 was scared and skipped turn %2 times.", "", num).arg(info.mid(i + 1)).arg(num) + "

"; + AddStatText(message); + break; + } + + } +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagegamestats.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagegamestats.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,73 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2010-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef STATSPAGE_H +#define STATSPAGE_H + +#include +#include +#include + +#include "AbstractPage.h" + +class FitGraphicsView : public QGraphicsView +{ + Q_OBJECT + +public: + FitGraphicsView(QWidget* parent = 0); + +protected: + void resizeEvent(QResizeEvent * event); +}; + +class PageGameStats : public AbstractPage +{ + Q_OBJECT + +public: + PageGameStats(QWidget* parent = 0); + + QPushButton *btnSave; + QLabel *labelGameStats; + QLabel *labelGameWin; + QLabel *labelGameRank; + FitGraphicsView * graphic; + +public slots: + void GameStats(char type, const QString & info); + void clear(); + void renderStats(); + +signals: + void saveDemoRequested(); + +private: + void AddStatText(const QString & msg); + + QMap > healthPoints; + unsigned int playerPosition; + quint32 lastColor; + +protected: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); +}; + +#endif // STATSPAGE_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageinfo.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,57 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include + +#include "pageinfo.h" +#include "about.h" + +QLayout * PageInfo::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 1); + pageLayout->setColumnStretch(2, 1); + + about = new About(); + pageLayout->addWidget(about, 0, 0, 1, 3); + + return pageLayout; +} + +QLayout * PageInfo::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout(); + BtnSnapshots = addButton(":/res/Star.png", bottomLayout, 0, true); + bottomLayout->setAlignment(BtnSnapshots, Qt::AlignRight | Qt::AlignVCenter); + return bottomLayout; +} + +void PageInfo::connectSignals() +{ + //TODO +} + +PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageinfo.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,43 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_INFO_H +#define PAGE_INFO_H + +#include "AbstractPage.h" + +class About; + +class PageInfo : public AbstractPage +{ + Q_OBJECT + +public: + PageInfo(QWidget* parent = 0); + + QPushButton *BtnSnapshots; + About *about; + +private: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageingame.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageingame.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,40 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include + +#include "pageingame.h" + +QLayout * PageInGame::bodyLayoutDefinition() +{ + QHBoxLayout * pageLayout = new QHBoxLayout(); + + QLabel * label = new QLabel(this); + label->setText(tr("In game...")); + pageLayout->addWidget(label); + + setBackButtonVisible(false); + + return pageLayout; +} + +PageInGame::PageInGame(QWidget * parent) : AbstractPage(parent) +{ + initPage(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageingame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageingame.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,35 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_INGAME_H +#define PAGE_INGAME_H + +#include "AbstractPage.h" + +class PageInGame : public AbstractPage +{ + Q_OBJECT + + public: + PageInGame(QWidget * parent = 0); + + QLayout * bodyLayoutDefinition(); +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagemain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagemain.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,162 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include + +#include "pagemain.h" +#include "hwconsts.h" +#include "hwform.h" + +QLayout * PageMain::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + //pageLayout->setColumnStretch(0, 1); + //pageLayout->setColumnStretch(1, 2); + //pageLayout->setColumnStretch(2, 1); + + //QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); + //pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); + pageLayout->setRowStretch(0, 1); + pageLayout->setRowStretch(1, 1); + pageLayout->setRowStretch(2, 0); + pageLayout->setRowStretch(3, 1); + pageLayout->setRowStretch(4, 1); + + BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); + BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); + pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); + + BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); + BtnNet->setToolTip(tr("Network Game (Play a game across a network)")); + pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); + + // button order matters for overlapping (what's on top and what isn't) + BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); + BtnInfo->setStyleSheet("border: transparent;background: transparent;"); + pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); + + BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 4, 0, 1, 4, false); + pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter); + + return pageLayout; +} + +QLayout * PageMain::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout(); + + mainNote = new QLabel(this); + mainNote->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + mainNote->setWordWrap(true); + + bottomLayout->addWidget(mainNote, 0); + bottomLayout->setStretch(0,1); + + BtnSetup = addButton(":/res/Settings.png", bottomLayout, 1, true); + bottomLayout->setStretch(1,0); + + return bottomLayout; +} + +void PageMain::connectSignals() +{ + //TODO +} + +PageMain::PageMain(QWidget* parent) : AbstractPage(parent) +{ + initPage(); + + if(frontendEffects) setAttribute(Qt::WA_NoSystemBackground, true); + mainNote->setOpenExternalLinks(true); + + if(!isDevBuild) + { + mainNote->setText(QLabel::tr("Tip: ") + randomTip()); + } + else + mainNote->setText(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!")); + +} + +QString PageMain::randomTip() const +{ + QStringList Tips; + Tips << tr("Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they'll win or lose together.", "Tips"); + Tips << tr("Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.", "Tips"); + Tips << tr("If you're unsure what to do and don't want to waste ammo, skip one round. But don't let too much time pass as there will be Sudden Death!", "Tips"); + Tips << tr("Want to save ropes? Release the rope in mid air and then shoot again. As long as you don't touch the ground you'll reuse your rope without wasting ammo!", "Tips"); + Tips << tr("If you'd like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.", "Tips"); + Tips << tr("You're bored of default gameplay? Try one of the missions - they'll offer different gameplay depending on the one you picked.", "Tips"); + Tips << tr("By default the game will always record the last game played as a demo. Select 'Local Game' and pick the 'Demos' button on the lower right corner to play or manage them.", "Tips"); + Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you've got problems, ask on our forums but please don't expect 24/7 support!", "Tips"); + Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If you like it, help us with a small donation or contribute your own work!", "Tips"); + Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. Share it with your family and friends as you like!", "Tips"); + Tips << tr("Hedgewars is Open Source and Freeware we create in our spare time. If someone sold you the game, you should try get a refund!", "Tips"); + Tips << tr("From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.", "Tips"); + Tips << tr("Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!", "Tips"); + Tips << tr("Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and Linux.", "Tips"); + Tips << tr("Always remember you're able to set up your own games in local and network/online play. You're not restricted to the 'Simple Game' option.", "Tips"); + Tips << tr("Connect one or more gamepads before starting the game to be able to assign their controls to your teams.", "Tips"); + Tips << tr("Create an account on %1 to keep others from using your most favourite nickname while playing on the official server.", "Tips").arg("http://www.hedgewars.org/"); + Tips << tr("While playing you should give yourself a short break at least once an hour.", "Tips"); + Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.", "Tips"); + Tips << tr("If your graphics card isn't able to provide hardware accelerated OpenGL, try to update the associated drivers.", "Tips"); + Tips << tr("We're open to suggestions and constructive feedback. If you don't like something or got a great idea, let us know!", "Tips"); + Tips << tr("Especially while playing online be polite and always remember there might be some minors playing with or against you as well!", "Tips"); + Tips << tr("Special game modes such as 'Vampirism' or 'Karma' allow you to develop completely new tactics. Try them in a custom game!", "Tips"); + Tips << tr("The Windows version of Hedgewars supports Xfire. Make sure to add Hedgewars to its game list so your friends can see you playing.", "Tips"); + Tips << tr("You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!", "Tips"); + Tips << tr("Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.", "Tips"); + Tips << tr("No hedgehogs were harmed in making this game.", "Tips"); + Tips << tr("There are three different jumps available. Tap [high jump] twice to do a very high/backwards jump.", "Tips"); + Tips << tr("Afraid of falling off a cliff? Hold down [precise] to turn [left] or [right] without actually moving.", "Tips"); + Tips << tr("Some weapons require special strategies or just lots of training, so don't give up on a particular tool if you miss an enemy once.", "Tips"); + Tips << tr("Most weapons won't work once they touch the water. The Homing Bee as well as the Cake are exceptions to this.", "Tips"); + Tips << tr("The Old Limbuger only causes a small explosion. However the wind affected smelly cloud can poison lots of hogs at once.", "Tips"); + Tips << tr("The Piano Strike is the most damaging air strike. You'll lose the hedgehog performing it, so there's a huge downside as well.", "Tips"); + Tips << tr("The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power.", "Tips"); + Tips << tr("Sticky Mines are a perfect tool to create small chain reactions knocking enemy hedgehogs into dire situations ... or water.", "Tips"); + Tips << tr("The Hammer is most effective when used on bridges or girders. Hit hogs will just break through the ground.", "Tips"); + Tips << tr("If you're stuck behind an enemy hedgehog, use the Hammer to free yourself without getting damaged by an explosion.", "Tips"); + Tips << tr("The Cake's maximum walking distance depends on the ground it has to pass. Use [attack] to detonate it early.", "Tips"); + Tips << tr("The Flame Thrower is a weapon but it can be used for tunnel digging as well.", "Tips"); + Tips << tr("Use the Molotov or Flame Thrower to temporary keep hedgehogs from passing terrain such as tunnels or platforms.", "Tips"); + Tips << tr("Want to know who's behind the game? Click on the Hedgewars logo in the main menu to see the credits.", "Tips"); + Tips << tr("Like Hedgewars? Become a fan on %1 or follow us on %2!", "Tips").arg("Facebook").arg("Twitter"); + Tips << tr("Feel free to draw your own graves, hats, flags or even maps and themes! But note that you'll have to share them somewhere to use them online.", "Tips"); + Tips << tr("Really want to wear a specific hat? Donate to us and receive an exclusive hat of your choice!", "Tips"); + // The following tip will require links to app store entries first. + //Tips << tr("Want to play Hedgewars any time? Grab the Mobile version for %1 and %2.", "Tips").arg("").arg(""); + // the ios version is located here: http://itunes.apple.com/us/app/hedgewars/id391234866 + Tips << tr("Keep your video card drivers up to date to avoid issues playing the game.", "Tips"); + Tips << tr("You're able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.", "Tips"); +#ifdef _WIN32 + Tips << tr("You can find your Hedgewars configuration files under \"My Documents\\Hedgewars\". Create backups or take the files with you, but don't edit them by hand.", "Tips"); +#elif defined __APPLE__ + Tips << tr("You can find your Hedgewars configuration files under \"Library/Application Support/Hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); +#else + Tips << tr("You can find your Hedgewars configuration files under \".hedgewars\" in your home directory. Create backups or take the files with you, but don't edit them by hand.", "Tips"); +#endif + + return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()]; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagemain.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagemain.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_MAIN_H +#define PAGE_MAIN_H + +#include "AbstractPage.h" + +class PageMain : public AbstractPage +{ + Q_OBJECT + +public: + PageMain(QWidget * parent = 0); + + QPushButton * BtnSinglePlayer; + QPushButton * BtnNet; + QPushButton * BtnSetup; + QPushButton * BtnInfo; + QPushButton * BtnDataDownload; + QLabel * mainNote; + +private: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + + QString randomTip() const; +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagemultiplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagemultiplayer.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,72 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief PageMultiplayer class implementation + */ + +#include +#include +#include + +#include "pagemultiplayer.h" +#include "gamecfgwidget.h" +#include "teamselect.h" + +QLayout * PageMultiplayer::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + + gameCFG = new GameCFGWidget(this); + pageLayout->addWidget(gameCFG, 0, 0, 1, 2); + + btnSetup = new QPushButton(this); + btnSetup->setText(QPushButton::tr("Setup")); + pageLayout->addWidget(btnSetup, 1, 0, 1, 2); + + pageLayout->setRowStretch(2, 1); + + teamsSelect = new TeamSelWidget(this); + pageLayout->addWidget(teamsSelect, 0, 2, 3, 2); + + return pageLayout; +} + +QLayout * PageMultiplayer::footerLayoutDefinition() +{ + QHBoxLayout * footerLayout = new QHBoxLayout(); + + BtnStartMPGame = formattedButton(tr("Start")); + BtnStartMPGame->setMinimumWidth(180); + + footerLayout->addStretch(); + footerLayout->addWidget(BtnStartMPGame); + + return footerLayout; +} + +void PageMultiplayer::connectSignals() +{ + PageMultiplayer::connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked())); +} + +PageMultiplayer::PageMultiplayer(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagemultiplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagemultiplayer.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,51 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_MULTIPLAYER_H +#define PAGE_MULTIPLAYER_H + +#include "AbstractPage.h" + +class GameCFGWidget; +class TeamSelWidget; + +class PageMultiplayer : public AbstractPage +{ + Q_OBJECT + +public: + PageMultiplayer(QWidget* parent = 0); + + GameCFGWidget *gameCFG; + TeamSelWidget *teamsSelect; + QPushButton *BtnStartMPGame; + +signals: + void SetupClicked(); + +private: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + + QPushButton * btnSetup; +}; + +#endif + + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagenet.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagenet.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,118 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "pagenet.h" +#include "hwconsts.h" +#include "netudpwidget.h" + +QLayout * PageNet::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 1); + pageLayout->setColumnStretch(2, 1); + + ConnGroupBox = new QGroupBox(this); + ConnGroupBox->setTitle(QGroupBox::tr("Net game")); + pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); + GBClayout = new QGridLayout(ConnGroupBox); + GBClayout->setColumnStretch(0, 1); + GBClayout->setColumnStretch(1, 1); + GBClayout->setColumnStretch(2, 1); + + BtnNetConnect = new QPushButton(ConnGroupBox); + BtnNetConnect->setFont(*font14); + BtnNetConnect->setText(QPushButton::tr("Connect")); + GBClayout->addWidget(BtnNetConnect, 2, 2); + + tvServersList = new QTableView(ConnGroupBox); + tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); + GBClayout->addWidget(tvServersList, 1, 0, 1, 3); + + BtnUpdateSList = new QPushButton(ConnGroupBox); + BtnUpdateSList->setFont(*font14); + BtnUpdateSList->setText(QPushButton::tr("Update")); + GBClayout->addWidget(BtnUpdateSList, 2, 0); + + BtnSpecifyServer = new QPushButton(ConnGroupBox); + BtnSpecifyServer->setFont(*font14); + BtnSpecifyServer->setText(QPushButton::tr("Specify")); + GBClayout->addWidget(BtnSpecifyServer, 2, 1); + + return pageLayout; +} + +QLayout * PageNet::footerLayoutDefinition() +{ + QHBoxLayout * footerLayout = new QHBoxLayout(); + + BtnNetSvrStart = formattedButton(QPushButton::tr("Start server")); + BtnNetSvrStart->setMinimumWidth(180); + BtnNetSvrStart->setVisible(haveServer); + + footerLayout->addStretch(); + footerLayout->addWidget(BtnNetSvrStart); + + return footerLayout; +} + +void PageNet::connectSignals() +{ + connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); +} + +PageNet::PageNet(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + +void PageNet::updateServersList() +{ + tvServersList->setModel(new HWNetUdpModel(tvServersList)); + + tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); + + static_cast(tvServersList->model())->updateList(); + + connect(BtnUpdateSList, SIGNAL(clicked()), static_cast(tvServersList->model()), SLOT(updateList())); + connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); +} + +void PageNet::slotConnect() +{ + HWNetServersModel * model = static_cast(tvServersList->model()); + QModelIndex mi = tvServersList->currentIndex(); + if(!mi.isValid()) + { + QMessageBox::information(this, tr("Error"), tr("Please select server from the list above")); + return; + } + QString host = model->index(mi.row(), 1).data().toString(); + quint16 port = model->index(mi.row(), 2).data().toUInt(); + + emit connectClicked(host, port); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagenet.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagenet.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,56 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_NET_H +#define PAGE_NET_H + +#include "AbstractPage.h" + +class PageNet : public AbstractPage +{ + Q_OBJECT + +public: + PageNet(QWidget* parent = 0); + + QPushButton* BtnUpdateSList; + QTableView * tvServersList; + QPushButton * BtnNetConnect; + QPushButton * BtnNetSvrStart; + QPushButton * BtnSpecifyServer; + +public slots: + void updateServersList(); + +signals: + void connectClicked(const QString & host, quint16 port); + +private: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + + QGroupBox * ConnGroupBox; + QGridLayout * GBClayout; + +private slots: + void slotConnect(); +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagenetgame.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagenetgame.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,176 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include + +#include "pagenetgame.h" +#include "gamecfgwidget.h" +#include "teamselect.h" +#include "chatwidget.h" + +QLayout * PageNetGame::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + pageLayout->setSizeConstraint(QLayout::SetMinimumSize); + //pageLayout->setSpacing(1); + pageLayout->setColumnStretch(0, 50); + pageLayout->setColumnStretch(1, 50); + + // chatwidget + pChatWidget = new HWChatWidget(this, m_gameSettings, true); + pChatWidget->setShowReady(true); // show status bulbs by default + pChatWidget->setShowFollow(false); // don't show follow in nicks' context menus + pageLayout->addWidget(pChatWidget, 2, 0, 1, 2); + pageLayout->setRowStretch(1, 100); + pageLayout->setRowStretch(2, 100); + + pGameCFG = new GameCFGWidget(this); + pageLayout->addWidget(pGameCFG, 0, 0); + + btnSetup = new QPushButton(this); + btnSetup->setText(QPushButton::tr("Setup")); + pageLayout->addWidget(btnSetup, 1, 0); + + pNetTeamsWidget = new TeamSelWidget(this); + pNetTeamsWidget->setAcceptOuter(true); + pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); + + return pageLayout; +} + +QLayout * PageNetGame::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout; + + leRoomName = new HistoryLineEdit(this,10); + leRoomName->setMaxLength(60); + leRoomName->setMinimumWidth(200); + leRoomName->setMaximumWidth(400); + + BtnGo = new QPushButton(this); + BtnGo->setToolTip(QPushButton::tr("Ready")); + BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); + BtnGo->setIconSize(QSize(25, 34)); + BtnGo->setMinimumWidth(50); + BtnGo->setMinimumHeight(50); + + + bottomLayout->addWidget(leRoomName); + BtnUpdate = addButton(QAction::tr("Update"), bottomLayout, 1); + + bottomLayout->addStretch(); + bottomLayout->addWidget(BtnGo); + + BtnMaster = addButton(tr("Control"), bottomLayout, 3); + bottomLayout->insertStretch(3, 100); + + BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3); + + return bottomLayout; +} + +void PageNetGame::connectSignals() +{ + connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked())); + + connect(BtnUpdate, SIGNAL(clicked()), this, SLOT(onUpdateClick())); +} + +PageNetGame::PageNetGame(QWidget* parent, QSettings * gameSettings) : AbstractPage(parent) +{ + m_gameSettings = gameSettings; + + initPage(); + + QMenu * menu = new QMenu(BtnMaster); + + restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); + restrictJoins->setCheckable(true); + restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); + restrictTeamAdds->setCheckable(true); + //menu->addAction(startGame); + menu->addAction(restrictJoins); + menu->addAction(restrictTeamAdds); + + BtnMaster->setMenu(menu); + +} + + +void PageNetGame::displayError(const QString & message) +{ + pChatWidget->displayError(message); +} + + +void PageNetGame::displayNotice(const QString & message) +{ + pChatWidget->displayNotice(message); +} + +void PageNetGame::displayWarning(const QString & message) +{ + pChatWidget->displayWarning(message); +} + + +void PageNetGame::setReadyStatus(bool isReady) +{ + if(isReady) + BtnGo->setIcon(QIcon(":/res/lightbulb_on.png")); + else + BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); +} + +void PageNetGame::onUpdateClick() +{ + if (!leRoomName->text().trimmed().isEmpty()) + { + emit askForUpdateRoomName(leRoomName->text()); + leRoomName->rememberCurrentText(); + } + else + { + leRoomName->clear(); + QMessageBox::critical(this, + tr("Error"), + tr("Please enter room name"), + tr("OK")); + } +} + + +void PageNetGame::setRoomName(const QString & roomName) +{ + leRoomName->setText(roomName); + leRoomName->rememberCurrentText(); +} + +void PageNetGame::setMasterMode(bool isMaster) +{ + BtnMaster->setVisible(isMaster); + BtnStart->setVisible(isMaster); + BtnUpdate->setVisible(isMaster); + leRoomName->setVisible(isMaster); +} + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagenetgame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagenetgame.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,80 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_NETGAME_H +#define PAGE_NETGAME_H + +#include "HistoryLineEdit.h" + +#include "AbstractPage.h" + +class HWChatWidget; +class TeamSelWidget; +class GameCFGWidget; + +class PageNetGame : public AbstractPage +{ + Q_OBJECT + +public: + PageNetGame(QWidget* parent, QSettings * gameSettings); + + /** + * Sets the room name to display. + * @param roomName room name to be displayed. + */ + void setRoomName(const QString & roomName); + + void displayError(const QString & message); + void displayNotice(const QString & message); + void displayWarning(const QString & message); + + QPushButton *BtnGo; + QPushButton *BtnMaster; + QPushButton *BtnStart; + QPushButton *BtnUpdate; + + QAction * restrictJoins; + QAction * restrictTeamAdds; + + HWChatWidget* pChatWidget; + + TeamSelWidget* pNetTeamsWidget; + GameCFGWidget* pGameCFG; + +public slots: + void setReadyStatus(bool isReady); + void onUpdateClick(); + void setMasterMode(bool isMaster); + +signals: + void SetupClicked(); + void askForUpdateRoomName(const QString &); + +private: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + + QSettings * m_gameSettings; + + HistoryLineEdit * leRoomName; + QPushButton * btnSetup; +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagenetserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagenetserver.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,99 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pagenetserver.h" + +QLayout * PageNetServer::bodyLayoutDefinition() +{ + QVBoxLayout * pageLayout = new QVBoxLayout(); + + QWidget * wg = new QWidget(this); + pageLayout->addWidget(wg); + + QGridLayout * wgLayout = new QGridLayout(wg); + wgLayout->setColumnStretch(0, 1); + wgLayout->setColumnStretch(1, 3); + wgLayout->setColumnStretch(2, 1); + + wgLayout->setRowStretch(0, 0); + wgLayout->setRowStretch(1, 1); + + QGroupBox * gb = new QGroupBox(wg); + wgLayout->addWidget(gb, 0, 1); + + QGridLayout * gbLayout = new QGridLayout(gb); + + labelSD = new QLabel(gb); + labelSD->setText(QLabel::tr("Server name:")); + gbLayout->addWidget(labelSD, 0, 0); + + leServerDescr = new QLineEdit(gb); + gbLayout->addWidget(leServerDescr, 0, 1); + + labelPort = new QLabel(gb); + labelPort->setText(QLabel::tr("Server port:")); + gbLayout->addWidget(labelPort, 1, 0); + + sbPort = new QSpinBox(gb); + sbPort->setMinimum(0); + sbPort->setMaximum(65535); + gbLayout->addWidget(sbPort, 1, 1); + + BtnDefault = new QPushButton(gb); + BtnDefault->setText(QPushButton::tr("default")); + gbLayout->addWidget(BtnDefault, 1, 2); + + return pageLayout; +} + +QLayout * PageNetServer::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout(); + + BtnStart = formattedButton(QPushButton::tr("Start")); + BtnStart->setMinimumWidth(180); + + bottomLayout->addStretch(); + bottomLayout->addWidget(BtnStart); + + return bottomLayout; +} + +void PageNetServer::connectSignals() +{ + connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); +} + +PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + +void PageNetServer::setDefaultPort() +{ + sbPort->setValue(46631); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagenetserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagenetserver.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_NETSERVER_H +#define PAGE_NETSERVER_H + +#include "AbstractPage.h" + +class PageNetServer : public AbstractPage +{ + Q_OBJECT + +public: + PageNetServer(QWidget* parent = 0); + + QPushButton *BtnStart; + QPushButton *BtnDefault; + QLabel *labelSD; + QLineEdit *leServerDescr; + QLabel *labelPort; + QSpinBox *sbPort; + +protected: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + +private slots: + void setDefaultPort(); +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagenettype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagenettype.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include + +#include "pagenettype.h" + + +QLayout * PageNetType::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + pageLayout->setRowStretch(0, 10); + pageLayout->setRowStretch(3, 10); + + pageLayout->setColumnStretch(1, 10); + pageLayout->setColumnStretch(2, 20); + pageLayout->setColumnStretch(3, 10); + + BtnLAN = addButton(tr("LAN game"), pageLayout, 1, 2); + BtnOfficialServer = addButton(tr("Official server"), pageLayout, 2, 2); + + // hack: temporary deactivated - requires server modifications that aren't backward compatible (yet) + //BtnOfficialServer->setEnabled(false); + + return pageLayout; +} + +PageNetType::PageNetType(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagenettype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagenettype.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,38 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_NETTYPE_H +#define PAGE_NETTYPE_H + +#include "AbstractPage.h" + +class PageNetType : public AbstractPage +{ + Q_OBJECT + +public: + PageNetType(QWidget* parent = 0); + + QPushButton * BtnLAN; + QPushButton * BtnOfficialServer; + +protected: + QLayout * bodyLayoutDefinition(); +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageoptions.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageoptions.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,498 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pageoptions.h" +#include "hwconsts.h" +#include "fpsedit.h" +#include "igbox.h" + +// TODO cleanup +QLayout * PageOptions::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + pageLayout->setColumnStretch(0, 100); + pageLayout->setColumnStretch(1, 100); + pageLayout->setColumnStretch(2, 100); + pageLayout->setRowStretch(0, 0); + //pageLayout->setRowStretch(1, 100); + pageLayout->setRowStretch(2, 0); + pageLayout->setContentsMargins(7, 7, 7, 0); + pageLayout->setSpacing(0); + + + QGroupBox * gbTwoBoxes = new QGroupBox(this); + pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); + QGridLayout * gbTBLayout = new QGridLayout(gbTwoBoxes); + gbTBLayout->setMargin(0); + gbTBLayout->setSpacing(0); + gbTBLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); + + QPixmap pmNew(":/res/new.png"); + QPixmap pmEdit(":/res/edit.png"); + QPixmap pmDelete(":/res/delete.png"); + + { + teamsBox = new IconedGroupBox(this); + //teamsBox->setContentTopPadding(0); + //teamsBox->setAttribute(Qt::WA_PaintOnScreen, true); + teamsBox->setIcon(QIcon(":/res/teamicon.png")); + teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + teamsBox->setTitle(QGroupBox::tr("Teams")); + + QGridLayout * GBTlayout = new QGridLayout(teamsBox); + + CBTeamName = new QComboBox(teamsBox); + GBTlayout->addWidget(CBTeamName, 0, 0); + + BtnNewTeam = new QPushButton(teamsBox); + BtnNewTeam->setToolTip(tr("New team")); + BtnNewTeam->setIconSize(pmNew.size()); + BtnNewTeam->setIcon(pmNew); + BtnNewTeam->setMaximumWidth(pmNew.width() + 6); + connect(BtnNewTeam, SIGNAL(clicked()), this, SIGNAL(newTeamRequested())); + GBTlayout->addWidget(BtnNewTeam, 0, 1); + + BtnEditTeam = new QPushButton(teamsBox); + BtnEditTeam->setToolTip(tr("Edit team")); + BtnEditTeam->setIconSize(pmEdit.size()); + BtnEditTeam->setIcon(pmEdit); + BtnEditTeam->setMaximumWidth(pmEdit.width() + 6); + connect(BtnEditTeam, SIGNAL(clicked()), this, SLOT(requestEditSelectedTeam())); + GBTlayout->addWidget(BtnEditTeam, 0, 2); + + BtnDeleteTeam = new QPushButton(teamsBox); + BtnDeleteTeam->setToolTip(tr("Delete team")); + BtnDeleteTeam->setIconSize(pmDelete.size()); + BtnDeleteTeam->setIcon(pmDelete); + BtnDeleteTeam->setMaximumWidth(pmDelete.width() + 6); + connect(BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(requestDeleteSelectedTeam())); + GBTlayout->addWidget(BtnDeleteTeam, 0, 3); + + LblNoEditTeam = new QLabel(teamsBox); + LblNoEditTeam->setText(tr("You can't edit teams from team selection. Go back to main menu to add, edit or delete teams.")); + LblNoEditTeam->setWordWrap(true); + LblNoEditTeam->setVisible(false); + GBTlayout->addWidget(LblNoEditTeam, 0, 0); + + gbTBLayout->addWidget(teamsBox, 0, 0); + } + + { + IconedGroupBox* groupWeapons = new IconedGroupBox(this); + + //groupWeapons->setContentTopPadding(0); + //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); + groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons")); + QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); + + QLabel* SchemeLabel = new QLabel(groupWeapons); + SchemeLabel->setText(QLabel::tr("Game scheme")); + WeaponsLayout->addWidget(SchemeLabel, 1, 0); + + SchemesName = new QComboBox(groupWeapons); + WeaponsLayout->addWidget(SchemesName, 1, 1); + + SchemeNew = new QPushButton(groupWeapons); + SchemeNew->setToolTip(tr("New scheme")); + SchemeNew->setIconSize(pmNew.size()); + SchemeNew->setIcon(pmNew); + SchemeNew->setMaximumWidth(pmNew.width() + 6); + WeaponsLayout->addWidget(SchemeNew, 1, 2); + + SchemeEdit = new QPushButton(groupWeapons); + SchemeEdit->setToolTip(tr("Edit scheme")); + SchemeEdit->setIconSize(pmEdit.size()); + SchemeEdit->setIcon(pmEdit); + SchemeEdit->setMaximumWidth(pmEdit.width() + 6); + WeaponsLayout->addWidget(SchemeEdit, 1, 3); + + SchemeDelete = new QPushButton(groupWeapons); + SchemeDelete->setToolTip(tr("Delete scheme")); + SchemeDelete->setIconSize(pmDelete.size()); + SchemeDelete->setIcon(pmDelete); + SchemeDelete->setMaximumWidth(pmDelete.width() + 6); + WeaponsLayout->addWidget(SchemeDelete, 1, 4); + + QLabel* WeaponLabel = new QLabel(groupWeapons); + WeaponLabel->setText(QLabel::tr("Weapons")); + WeaponsLayout->addWidget(WeaponLabel, 2, 0); + + WeaponsName = new QComboBox(groupWeapons); + WeaponsLayout->addWidget(WeaponsName, 2, 1); + + WeaponNew = new QPushButton(groupWeapons); + WeaponNew->setToolTip(tr("New weapon set")); + WeaponNew->setIconSize(pmNew.size()); + WeaponNew->setIcon(pmNew); + WeaponNew->setMaximumWidth(pmNew.width() + 6); + WeaponsLayout->addWidget(WeaponNew, 2, 2); + + WeaponEdit = new QPushButton(groupWeapons); + WeaponEdit->setToolTip(tr("Edit weapon set")); + WeaponEdit->setIconSize(pmEdit.size()); + WeaponEdit->setIcon(pmEdit); + WeaponEdit->setMaximumWidth(pmEdit.width() + 6); + WeaponsLayout->addWidget(WeaponEdit, 2, 3); + + WeaponDelete = new QPushButton(groupWeapons); + WeaponDelete->setToolTip(tr("Delete weapon set")); + WeaponDelete->setIconSize(pmDelete.size()); + WeaponDelete->setIcon(pmDelete); + WeaponDelete->setMaximumWidth(pmDelete.width() + 6); + WeaponsLayout->addWidget(WeaponDelete, 2, 4); + + WeaponTooltip = new QCheckBox(this); + WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips")); + WeaponsLayout->addWidget(WeaponTooltip, 3, 0, 1, 4); + + gbTBLayout->addWidget(groupWeapons, 1, 0); + } + + { + IconedGroupBox* groupMisc = new IconedGroupBox(this); + //groupMisc->setContentTopPadding(0); + groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + groupMisc->setIcon(QIcon(":/res/miscicon.png")); + //groupMisc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + groupMisc->setTitle(QGroupBox::tr("Misc")); + QGridLayout * MiscLayout = new QGridLayout(groupMisc); + + labelNN = new QLabel(groupMisc); + labelNN->setText(QLabel::tr("Net nick")); + MiscLayout->addWidget(labelNN, 0, 0); + + editNetNick = new QLineEdit(groupMisc); + editNetNick->setMaxLength(20); + editNetNick->setText(QLineEdit::tr("unnamed")); + connect(editNetNick, SIGNAL(editingFinished()), this, SLOT(trimNetNick())); + MiscLayout->addWidget(editNetNick, 0, 1); + + labelNetPassword = new QLabel(groupMisc); + labelNetPassword->setText(QLabel::tr("Password")); + MiscLayout->addWidget(labelNetPassword, 1, 0); + + editNetPassword = new QLineEdit(groupMisc); + editNetPassword->setEchoMode(QLineEdit::Password); + MiscLayout->addWidget(editNetPassword, 1, 1); + + QLabel *labelLanguage = new QLabel(groupMisc); + labelLanguage->setText(QLabel::tr("Locale") + " *"); + MiscLayout->addWidget(labelLanguage, 2, 0); + + CBLanguage = new QComboBox(groupMisc); + QDir tmpdir; + tmpdir.cd(cfgdir->absolutePath()); + tmpdir.cd("Data/Locale"); + tmpdir.setFilter(QDir::Files); + QStringList locs = tmpdir.entryList(QStringList("hedgewars_*.qm")); + CBLanguage->addItem(QComboBox::tr("(System default)"), QString("")); + for(int i = 0; i < locs.count(); i++) + { + QLocale loc(locs[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1")); + CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name()); + } + + tmpdir.cd(datadir->absolutePath()); + tmpdir.cd("Locale"); + tmpdir.setFilter(QDir::Files); + QStringList tmplist = tmpdir.entryList(QStringList("hedgewars_*.qm")); + for(int i = 0; i < tmplist.count(); i++) + { + if (locs.contains(tmplist[i])) continue; + QLocale loc(tmplist[i].replace(QRegExp("hedgewars_(.*)\\.qm"), "\\1")); + CBLanguage->addItem(QLocale::languageToString(loc.language()) + " (" + QLocale::countryToString(loc.country()) + ")", loc.name()); + } + + MiscLayout->addWidget(CBLanguage, 2, 1); + + CBAltDamage = new QCheckBox(groupMisc); + CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); + MiscLayout->addWidget(CBAltDamage, 3, 0, 1, 2); + + CBNameWithDate = new QCheckBox(groupMisc); + CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name")); + MiscLayout->addWidget(CBNameWithDate, 4, 0, 1, 2); + + BtnAssociateFiles = new QPushButton(groupMisc); + BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions")); + BtnAssociateFiles->setEnabled(!custom_data && !custom_config); + MiscLayout->addWidget(BtnAssociateFiles, 5, 0, 1, 2); + +#ifdef __APPLE__ +#ifdef SPARKLE_ENABLED + CBAutoUpdate = new QCheckBox(groupMisc); + CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup")); + MiscLayout->addWidget(CBAutoUpdate, 6, 0, 1, 3); +#endif +#endif + gbTBLayout->addWidget(groupMisc, 2, 0); + } + + { + AGGroupBox = new IconedGroupBox(this); + //AGGroupBox->setContentTopPadding(0); + AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); + //AGGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); + + QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); + QHBoxLayout * GBAreslayout = new QHBoxLayout(0); + QHBoxLayout * GBAstereolayout = new QHBoxLayout(0); + QHBoxLayout * GBAqualayout = new QHBoxLayout(0); + + CBFrontendFullscreen = new QCheckBox(AGGroupBox); + CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); + GBAlayout->addWidget(CBFrontendFullscreen); + + CBFrontendEffects = new QCheckBox(AGGroupBox); + CBFrontendEffects->setText(QCheckBox::tr("Frontend effects") + " *"); + GBAlayout->addWidget(CBFrontendEffects); + + CBEnableFrontendSound = new QCheckBox(AGGroupBox); + CBEnableFrontendSound->setText(QCheckBox::tr("Enable frontend sounds")); + GBAlayout->addWidget(CBEnableFrontendSound); + + CBEnableFrontendMusic = new QCheckBox(AGGroupBox); + CBEnableFrontendMusic->setText(QCheckBox::tr("Enable frontend music")); + GBAlayout->addWidget(CBEnableFrontendMusic); + + QFrame * hr = new QFrame(AGGroupBox); + hr->setFrameStyle(QFrame::HLine); + hr->setLineWidth(3); + hr->setFixedHeight(10); + GBAlayout->addWidget(hr); + + QLabel * resolution = new QLabel(AGGroupBox); + resolution->setText(QLabel::tr("Resolution")); + GBAreslayout->addWidget(resolution); + + CBResolution = new QComboBox(AGGroupBox); + GBAreslayout->addWidget(CBResolution); + GBAlayout->addLayout(GBAreslayout); + + CBFullscreen = new QCheckBox(AGGroupBox); + CBFullscreen->setText(QCheckBox::tr("Fullscreen")); + GBAlayout->addWidget(CBFullscreen); + + QLabel * quality = new QLabel(AGGroupBox); + quality->setText(QLabel::tr("Quality")); + quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + GBAqualayout->addWidget(quality); + + SLQuality = new QSlider(Qt::Horizontal, AGGroupBox); + SLQuality->setTickPosition(QSlider::TicksBelow); + SLQuality->setMaximum(5); + SLQuality->setMinimum(0); + SLQuality->setFixedWidth(150); + GBAqualayout->addWidget(SLQuality); + GBAlayout->addLayout(GBAqualayout); + + QLabel * stereo = new QLabel(AGGroupBox); + stereo->setText(QLabel::tr("Stereo rendering")); + GBAstereolayout->addWidget(stereo); + + CBStereoMode = new QComboBox(AGGroupBox); + CBStereoMode->addItem(QComboBox::tr("Disabled")); + CBStereoMode->addItem(QComboBox::tr("Red/Cyan")); + CBStereoMode->addItem(QComboBox::tr("Cyan/Red")); + CBStereoMode->addItem(QComboBox::tr("Red/Blue")); + CBStereoMode->addItem(QComboBox::tr("Blue/Red")); + CBStereoMode->addItem(QComboBox::tr("Red/Green")); + CBStereoMode->addItem(QComboBox::tr("Green/Red")); + CBStereoMode->addItem(QComboBox::tr("Side-by-side")); + CBStereoMode->addItem(QComboBox::tr("Top-Bottom")); + CBStereoMode->addItem(QComboBox::tr("Wiggle")); + CBStereoMode->addItem(QComboBox::tr("Red/Cyan grayscale")); + CBStereoMode->addItem(QComboBox::tr("Cyan/Red grayscale")); + CBStereoMode->addItem(QComboBox::tr("Red/Blue grayscale")); + CBStereoMode->addItem(QComboBox::tr("Blue/Red grayscale")); + CBStereoMode->addItem(QComboBox::tr("Red/Green grayscale")); + CBStereoMode->addItem(QComboBox::tr("Green/Red grayscale")); + connect(CBStereoMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceFullscreen(int))); + + GBAstereolayout->addWidget(CBStereoMode); + GBAlayout->addLayout(GBAstereolayout); + + hr = new QFrame(AGGroupBox); + hr->setFrameStyle(QFrame::HLine); + hr->setLineWidth(3); + hr->setFixedHeight(10); + GBAlayout->addWidget(hr); + + QHBoxLayout * GBAvollayout = new QHBoxLayout(0); + QLabel * vol = new QLabel(AGGroupBox); + vol->setText(QLabel::tr("Initial sound volume")); + GBAvollayout->addWidget(vol); + GBAlayout->addLayout(GBAvollayout); + volumeBox = new QSpinBox(AGGroupBox); + volumeBox->setRange(0, 100); + volumeBox->setSingleStep(5); + GBAvollayout->addWidget(volumeBox); + + CBEnableSound = new QCheckBox(AGGroupBox); + CBEnableSound->setText(QCheckBox::tr("Enable sound")); + GBAlayout->addWidget(CBEnableSound); + + CBEnableMusic = new QCheckBox(AGGroupBox); + CBEnableMusic->setText(QCheckBox::tr("Enable music")); + GBAlayout->addWidget(CBEnableMusic); + + hr = new QFrame(AGGroupBox); + hr->setFrameStyle(QFrame::HLine); + hr->setLineWidth(3); + hr->setFixedHeight(10); + GBAlayout->addWidget(hr); + + QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); + QLabel * maxfps = new QLabel(AGGroupBox); + maxfps->setText(QLabel::tr("FPS limit")); + GBAfpslayout->addWidget(maxfps); + GBAlayout->addLayout(GBAfpslayout); + fpsedit = new FPSEdit(AGGroupBox); + GBAfpslayout->addWidget(fpsedit); + + CBShowFPS = new QCheckBox(AGGroupBox); + CBShowFPS->setText(QCheckBox::tr("Show FPS")); + GBAlayout->addWidget(CBShowFPS); + + hr = new QFrame(AGGroupBox); + hr->setFrameStyle(QFrame::HLine); + hr->setLineWidth(3); + hr->setFixedHeight(10); + GBAlayout->addWidget(hr); + + QLabel *restartNote = new QLabel(this); + restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply")); + restartNote->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + GBAlayout->addWidget(restartNote); + + gbTBLayout->addWidget(AGGroupBox, 0, 1, 3, 1); + } + + previousQuality = this->SLQuality->value(); + previousResolutionIndex = this->CBResolution->currentIndex(); + previousFullscreenValue = this->CBFullscreen->isChecked(); + + return pageLayout; +} + +QLayout * PageOptions::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout(); + btnSave = addButton(":/res/Save.png", bottomLayout, 0, true); + btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}"); + bottomLayout->setAlignment(btnSave, Qt::AlignRight | Qt::AlignBottom); + return bottomLayout; +} + +void PageOptions::connectSignals() +{ + connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int))); + connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int))); + connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int))); +} + +PageOptions::PageOptions(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + +void PageOptions::forceFullscreen(int index) +{ + bool forced = (index == 7 || index == 8 || index == 9); + + if (index != 0) { + this->SLQuality->setValue(this->SLQuality->maximum()); + this->SLQuality->setEnabled(false); + this->CBFullscreen->setEnabled(!forced); + this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue); + this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex); + } else { + this->SLQuality->setEnabled(true); + this->CBFullscreen->setEnabled(true); + this->SLQuality->setValue(previousQuality); + this->CBFullscreen->setChecked(previousFullscreenValue); + this->CBResolution->setCurrentIndex(previousResolutionIndex); + } +} + +void PageOptions::setQuality(int value) +{ + Q_UNUSED(value); + + int index = this->CBStereoMode->currentIndex(); + if (index == 0) + previousQuality = this->SLQuality->value(); +} + +void PageOptions::setFullscreen(int state) +{ + Q_UNUSED(state); + + int index = this->CBStereoMode->currentIndex(); + if (index != 7 && index != 8 && index != 9) + previousFullscreenValue = this->CBFullscreen->isChecked(); +} + +void PageOptions::setResolution(int state) +{ + Q_UNUSED(state); + + int index = this->CBStereoMode->currentIndex(); + if (index != 7 && index != 8 && index != 9) + previousResolutionIndex = this->CBResolution->currentIndex(); +} + +void PageOptions::trimNetNick() +{ + editNetNick->setText(editNetNick->text().trimmed()); +} + +void PageOptions::requestEditSelectedTeam() +{ + emit editTeamRequested(CBTeamName->currentText()); +} + +void PageOptions::requestDeleteSelectedTeam() +{ + emit deleteTeamRequested(CBTeamName->currentText()); +} + +void PageOptions::setTeamOptionsEnabled(bool enabled) +{ + BtnNewTeam->setVisible(enabled); + BtnEditTeam->setVisible(enabled); + BtnDeleteTeam->setVisible(enabled); + CBTeamName->setVisible(enabled); + LblNoEditTeam->setVisible(!enabled); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageoptions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageoptions.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,107 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_OPTIONS_H +#define PAGE_OPTIONS_H + +#include "AbstractPage.h" + +class FPSEdit; +class IconedGroupBox; + +class PageOptions : public AbstractPage +{ + Q_OBJECT + +public: + PageOptions(QWidget* parent = 0); + + QCheckBox *WeaponTooltip; + QPushButton *WeaponNew; + QPushButton *WeaponEdit; + QPushButton *WeaponDelete; + QComboBox *WeaponsName; + QPushButton *SchemeNew; + QPushButton *SchemeEdit; + QPushButton *SchemeDelete; + QComboBox *SchemesName; + + QComboBox *CBLanguage; + + IconedGroupBox *teamsBox;; + QPushButton *BtnAssociateFiles; + QComboBox *CBTeamName; + IconedGroupBox *AGGroupBox; + QComboBox *CBResolution; + QComboBox *CBStereoMode; + QCheckBox *CBEnableSound; + QCheckBox *CBEnableFrontendSound; + QCheckBox *CBEnableMusic; + QCheckBox *CBEnableFrontendMusic; + QCheckBox *CBFullscreen; + QCheckBox *CBFrontendFullscreen; + QCheckBox *CBShowFPS; + QCheckBox *CBAltDamage; + QCheckBox *CBNameWithDate; +#ifdef __APPLE__ + QCheckBox *CBAutoUpdate; +#endif + + FPSEdit *fpsedit; + QPushButton *btnSave; + QLabel *labelNN; + QLabel *labelNetPassword; + QSpinBox * volumeBox; + QLineEdit *editNetNick; + QLineEdit *editNetPassword; + QSlider *SLQuality; + QCheckBox *CBFrontendEffects; + + void setTeamOptionsEnabled(bool enabled); + +signals: + void newTeamRequested(); + void editTeamRequested(const QString & teamName); + void deleteTeamRequested(const QString & teamName); + + +private: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + + bool previousFullscreenValue; + int previousResolutionIndex; + int previousQuality; + QLabel *LblNoEditTeam; + QPushButton *BtnNewTeam; + QPushButton *BtnEditTeam; + QPushButton *BtnDeleteTeam; + +private slots: + void forceFullscreen(int index); + void setFullscreen(int state); + void setResolution(int state); + void setQuality(int value); + void trimNetNick(); + void requestEditSelectedTeam(); + void requestDeleteSelectedTeam(); +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageplayrecord.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageplayrecord.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,165 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hwconsts.h" +#include "pageplayrecord.h" + +QLayout * PagePlayDemo::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 2); + pageLayout->setColumnStretch(2, 1); + pageLayout->setRowStretch(2, 100); + + BtnPlayDemo = new QPushButton(this); + BtnPlayDemo->setFont(*font14); + BtnPlayDemo->setText(QPushButton::tr("Play demo")); + pageLayout->addWidget(BtnPlayDemo, 3, 2); + + BtnRenameRecord = new QPushButton(this); + BtnRenameRecord->setText(QPushButton::tr("Rename")); + pageLayout->addWidget(BtnRenameRecord, 0, 2); + + BtnRemoveRecord = new QPushButton(this); + BtnRemoveRecord->setText(QPushButton::tr("Delete")); + pageLayout->addWidget(BtnRemoveRecord, 1, 2); + + DemosList = new QListWidget(this); + DemosList->setGeometry(QRect(170, 10, 311, 311)); + pageLayout->addWidget(DemosList, 0, 1, 3, 1); + + return pageLayout; +} + +void PagePlayDemo::connectSignals() +{ + connect(BtnRenameRecord, SIGNAL(clicked()), this, SLOT(renameRecord())); + connect(BtnRemoveRecord, SIGNAL(clicked()), this, SLOT(removeRecord())); +} + +PagePlayDemo::PagePlayDemo(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + +void PagePlayDemo::FillFromDir(RecordType rectype) +{ + QDir dir; + QString extension; + + recType = rectype; + + dir.cd(cfgdir->absolutePath()); + if (rectype == RT_Demo) + { + dir.cd("Demos"); + extension = "hwd"; + BtnPlayDemo->setText(QPushButton::tr("Play demo")); + } else + { + dir.cd("Saves"); + extension = "hws"; + BtnPlayDemo->setText(QPushButton::tr("Load")); + } + dir.setFilter(QDir::Files); + + QStringList sl = dir.entryList(QStringList(QString("*.%2.%1").arg(extension, *cProtoVer))); + sl.replaceInStrings(QRegExp(QString("^(.*)\\.%2\\.%1$").arg(extension, *cProtoVer)), "\\1"); + + DemosList->clear(); + DemosList->addItems(sl); + + for (int i = 0; i < DemosList->count(); ++i) + { + DemosList->item(i)->setData(Qt::UserRole, dir.absoluteFilePath(QString("%1.%3.%2").arg(sl[i], extension, *cProtoVer))); + DemosList->item(i)->setIcon(recType == RT_Demo ? QIcon(":/res/file_demo.png") : QIcon(":/res/file_save.png")); + } +} + +void PagePlayDemo::renameRecord() +{ + QListWidgetItem * curritem = DemosList->currentItem(); + if (!curritem) + { + QMessageBox::critical(this, + tr("Error"), + tr("Please select record from the list"), + tr("OK")); + return ; + } + QFile rfile(curritem->data(Qt::UserRole).toString()); + + QFileInfo finfo(rfile); + + bool ok; + + QString newname = QInputDialog::getText(this, tr("Rename dialog"), tr("Enter new file name:"), QLineEdit::Normal, finfo.completeBaseName().replace("." + *cProtoVer, ""), &ok); + + if(ok && newname.size()) + { + QString newfullname = QString("%1/%2.%3.%4") + .arg(finfo.absolutePath()) + .arg(newname) + .arg(*cProtoVer) + .arg(finfo.suffix()); + + ok = rfile.rename(newfullname); + if(!ok) + QMessageBox::critical(this, tr("Error"), tr("Cannot rename to") + newfullname); + else + FillFromDir(recType); + } +} + +void PagePlayDemo::removeRecord() +{ + QListWidgetItem * curritem = DemosList->currentItem(); + if (!curritem) + { + QMessageBox::critical(this, + tr("Error"), + tr("Please select record from the list"), + tr("OK")); + return ; + } + QFile rfile(curritem->data(Qt::UserRole).toString()); + + bool ok; + + ok = rfile.remove(); + if(!ok) + QMessageBox::critical(this, tr("Error"), tr("Cannot delete file")); + else + FillFromDir(recType); +} + +bool PagePlayDemo::isSave() +{ + return recType == RT_Save; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageplayrecord.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageplayrecord.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,61 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PLAYRECORDPAGE_H +#define PLAYRECORDPAGE_H + +#include + +#include "AbstractPage.h" + +class QPushButton; +class QListWidget; + +class PagePlayDemo : public AbstractPage +{ + Q_OBJECT + +public: + enum RecordType { + RT_Demo, + RT_Save + }; + + PagePlayDemo(QWidget* parent = 0); + + void FillFromDir(RecordType rectype); + bool isSave(); + + QPushButton *BtnPlayDemo; + QPushButton *BtnRenameRecord; + QPushButton *BtnRemoveRecord; + QListWidget *DemosList; + +private: + QLayout * bodyLayoutDefinition(); + void connectSignals(); + + RecordType recType; + +private slots: + void renameRecord(); + void removeRecord(); +}; + + +#endif // PLAYRECORDPAGE_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageroomslist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageroomslist.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,448 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ammoSchemeModel.h" +#include "pageroomslist.h" +#include "hwconsts.h" +#include "chatwidget.h" + +QLayout * PageRoomsList::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + + QHBoxLayout * newRoomLayout = new QHBoxLayout(); + QLabel * roomNameLabel = new QLabel(this); + roomNameLabel->setText(tr("Room Name:")); + roomName = new QLineEdit(this); + roomName->setMaxLength(60); + newRoomLayout->addWidget(roomNameLabel); + newRoomLayout->addWidget(roomName); + pageLayout->addLayout(newRoomLayout, 0, 0, 1, 2); + + roomsList = new QTableWidget(this); + roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); + roomsList->verticalHeader()->setVisible(false); + roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); + roomsList->setAlternatingRowColors(true); + roomsList->setShowGrid(false); + roomsList->setSelectionMode(QAbstractItemView::SingleSelection); + pageLayout->addWidget(roomsList, 1, 0, 3, 2); + pageLayout->setRowStretch(2, 100); + + QHBoxLayout * filterLayout = new QHBoxLayout(); + + QLabel * stateLabel = new QLabel(this); + CBState = new QComboBox(this); + + filterLayout->addWidget(stateLabel); + filterLayout->addWidget(CBState); + filterLayout->addSpacing(30); + + QLabel * ruleLabel = new QLabel(this); + ruleLabel->setText(tr("Rules:")); + CBRules = new QComboBox(this); + + filterLayout->addWidget(ruleLabel); + filterLayout->addWidget(CBRules); + filterLayout->addSpacing(30); + + QLabel * weaponLabel = new QLabel(this); + weaponLabel->setText(tr("Weapons:")); + CBWeapons = new QComboBox(this); + + filterLayout->addWidget(weaponLabel); + filterLayout->addWidget(CBWeapons); + filterLayout->addSpacing(30); + + QLabel * searchLabel = new QLabel(this); + searchLabel->setText(tr("Search:")); + searchText = new QLineEdit(this); + searchText->setMaxLength(60); + filterLayout->addWidget(searchLabel); + filterLayout->addWidget(searchText); + + pageLayout->addLayout(filterLayout, 4, 0, 1, 2); + + chatWidget = new HWChatWidget(this, m_gameSettings, false); + pageLayout->addWidget(chatWidget, 5, 0, 1, 3); + pageLayout->setRowStretch(5, 350); + + BtnCreate = addButton(tr("Create"), pageLayout, 0, 2); + BtnJoin = addButton(tr("Join"), pageLayout, 1, 2); + BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 2); + BtnClear = addButton(tr("Clear"), pageLayout, 4, 2); + + // strech all but the buttons column + pageLayout->setColumnStretch(0, 1); + pageLayout->setColumnStretch(1, 1); + pageLayout->setColumnStretch(2, 0); + + CBRules->addItem(QComboBox::tr("Any")); + CBState->addItem(QComboBox::tr("Any")); + CBState->addItem(QComboBox::tr("In lobby")); + CBState->addItem(QComboBox::tr("In progress")); + + return pageLayout; +} + +QLayout * PageRoomsList::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout(); + + lblCount = new QLabel(this); + bottomLayout->addWidget(lblCount, 0, Qt::AlignHCenter); + bottomLayout->setStretchFactor(lblCount, 1); + lblCount->setText("?"); + lblCount->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); + + BtnAdmin = addButton(tr("Admin features"), bottomLayout, 1); + BtnAdmin->setMinimumWidth(160); + + // strech left part + bottomLayout->setStretch(0, 1); + bottomLayout->setStretch(1, 0); + + return bottomLayout; +} + +void PageRoomsList::connectSignals() +{ + connect(chatWidget, SIGNAL(nickCountUpdate(const int)), this, SLOT(updateNickCounter(const int))); + + connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); + connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); + connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); + connect(BtnClear, SIGNAL(clicked()), this, SLOT(onClearClick())); + connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); + connect(CBState, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick())); + connect(CBRules, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick())); + connect(CBWeapons, SIGNAL(currentIndexChanged (int)), this, SLOT(onRefreshClick())); + connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onRefreshClick())); + connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection); +} + + +PageRoomsList::PageRoomsList(QWidget* parent, QSettings * gameSettings) : + AbstractPage(parent) +{ + m_gameSettings = gameSettings; + + initPage(); + + // not the most elegant solution but it works + ammoSchemeModel = new AmmoSchemeModel(this, NULL); + for (int i = 0; i < ammoSchemeModel->predefSchemesNames.count(); i++) + CBRules->addItem(ammoSchemeModel->predefSchemesNames.at(i).toAscii().constData()); + + CBWeapons->addItem(QComboBox::tr("Any")); + for (int i = 0; i < cDefaultAmmos.count(); i++) { + QPair ammo = cDefaultAmmos.at(i); + CBWeapons->addItem(ammo.first.toAscii().constData()); + } + + gameInLobby = false; +} + + +void PageRoomsList::displayError(const QString & message) +{ + chatWidget->displayError(message); +} + + +void PageRoomsList::displayNotice(const QString & message) +{ + chatWidget->displayNotice(message); +} + +void PageRoomsList::displayWarning(const QString & message) +{ + chatWidget->displayWarning(message); +} + + +void PageRoomsList::setAdmin(bool flag) +{ + BtnAdmin->setVisible(flag); +} + +void PageRoomsList::setRoomsList(const QStringList & list) +{ + QBrush red(QColor(255, 0, 0)); + QBrush orange(QColor(127, 127, 0)); + QBrush yellow(QColor(255, 255, 0)); + QBrush green(QColor(0, 255, 0)); + + listFromServer = list; + + QString selection = ""; + + if(QTableWidgetItem *item = roomsList->item(roomsList->currentRow(), 0)) + selection = item->text(); + + roomsList->clear(); + roomsList->setColumnCount(7); + roomsList->setHorizontalHeaderLabels( + QStringList() << + QTableWidget::tr("Room Name") << + QTableWidget::tr("C") << + QTableWidget::tr("T") << + QTableWidget::tr("Owner") << + QTableWidget::tr("Map") << + QTableWidget::tr("Rules") << + QTableWidget::tr("Weapons") + ); + + // set minimum sizes +// roomsList->horizontalHeader()->resizeSection(0, 200); +// roomsList->horizontalHeader()->resizeSection(1, 50); +// roomsList->horizontalHeader()->resizeSection(2, 50); +// roomsList->horizontalHeader()->resizeSection(3, 100); +// roomsList->horizontalHeader()->resizeSection(4, 100); +// roomsList->horizontalHeader()->resizeSection(5, 100); +// roomsList->horizontalHeader()->resizeSection(6, 100); + + // set resize modes +// roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); + + bool gameCanBeJoined = true; + + if (list.size() % 8) + return; + + roomsList->setRowCount(list.size() / 8); + for(int i = 0, r = 0; i < list.size(); i += 8, r++) + { + // if we are joining a game + // TODO: Should NOT be done here + if (gameInLobby) { + if (gameInLobbyName == list[i + 1]) { + gameCanBeJoined = list[i].compare("True"); + } + } + + // check filter settings + #define NO_FILTER_MATCH roomsList->setRowCount(roomsList->rowCount() - 1); --r; continue + + if (list[i].compare("True") && CBState->currentIndex() == 2) { NO_FILTER_MATCH; } + if (list[i].compare("False") && CBState->currentIndex() == 1) { NO_FILTER_MATCH; } + if (CBRules->currentIndex() != 0 && list[i + 6].compare(CBRules->currentText())) { NO_FILTER_MATCH; } + if (CBWeapons->currentIndex() != 0 && list[i + 7].compare(CBWeapons->currentText())) { NO_FILTER_MATCH; } + bool found = list[i + 1].contains(searchText->text(), Qt::CaseInsensitive); + if (!found) { + for (int a = 4; a <= 7; ++a) { + QString compString = list[i + a]; + if (a == 5 && compString == "+rnd+") { + compString = "Random Map"; + } else if (a == 5 && compString == "+maze+") { + compString = "Random Maze"; + } else if (a == 5 && compString == "+drawn+") { + compString = "Drawn Map"; + } + if (compString.contains(searchText->text(), Qt::CaseInsensitive)) { + found = true; + break; + } + } + } + if (!searchText->text().isEmpty() && !found) { NO_FILTER_MATCH; } + + QTableWidgetItem * item; + item = new QTableWidgetItem(list[i + 1]); // room name + item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + + // pick appropriate room icon and tooltip (game in progress yes/no; later maybe locked rooms etc.) + if(list[i].compare("True")) + { + item->setIcon(QIcon(":/res/iconTime.png"));// game is in lobby + item->setToolTip(tr("This game is in lobby.\nYou may join and start playing once the game starts.")); + } + else + { + item->setIcon(QIcon(":/res/iconDamage.png"));// game has started + item->setToolTip(tr("This game is in progress.\nYou may join and spectate now but you'll have to wait for the game to end to start playing.")); + } + + roomsList->setItem(r, 0, item); + + item = new QTableWidgetItem(list[i + 2]); // number of clients + item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + item->setTextAlignment(Qt::AlignCenter); + item->setToolTip(tr("There are %1 clients connected to this room.", "", list[i + 2].toInt()).arg(list[i + 2])); + roomsList->setItem(r, 1, item); + + item = new QTableWidgetItem(list[i + 3]); // number of teams + item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + item->setTextAlignment(Qt::AlignCenter); + item->setToolTip(tr("There are %1 teams participating in this room.", "", list[i + 3].toInt()).arg(list[i + 3])); + //Should we highlight "full" games? Might get misinterpreted + //if(list[i + 3].toInt() >= cMaxTeams) + // item->setForeground(red); + roomsList->setItem(r, 2, item); + + item = new QTableWidgetItem(list[i + 4].left(15)); // name of host + item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + item->setToolTip(tr("%1 is the host. He may adjust settings and start the game.").arg(list[i + 4])); + roomsList->setItem(r, 3, item); + + if(list[i + 5] == "+rnd+") + { + item = new QTableWidgetItem(tr("Random Map")); // selected map (is randomized) +// FIXME - need real icons. Disabling until then +// item->setIcon(QIcon(":/res/mapRandom.png")); + } + else if (list[i+5] == "+maze+") + { + item = new QTableWidgetItem(tr("Random Maze")); +// FIXME - need real icons. Disabling until then +// item->setIcon(QIcon(":/res/mapMaze.png")); + } + else + { + item = new QTableWidgetItem(list[i + 5]); // selected map + + // check to see if we've got this map + // not perfect but a start + if(!mapList->contains(list[i + 5])) + { + item->setForeground(red); + item->setIcon(QIcon(":/res/mapMissing.png")); + } + else + { + // todo: mission icon? +// FIXME - need real icons. Disabling until then +// item->setIcon(QIcon(":/res/mapCustom.png")); + } + } + + item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + item->setToolTip(tr("Games may be played on precreated or randomized maps.")); + roomsList->setItem(r, 4, item); + + item = new QTableWidgetItem(list[i + 6].left(24)); // selected game scheme + item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + item->setToolTip(tr("The Game Scheme defines general options and preferences like Round Time, Sudden Death or Vampirism.")); + roomsList->setItem(r, 5, item); + + item = new QTableWidgetItem(list[i + 7].left(24)); // selected weapon scheme + item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + item->setToolTip(tr("The Weapon Scheme defines available weapons and their ammunition count.")); + roomsList->setItem(r, 6, item); + + if(!list[i + 1].compare(selection) && !selection.isEmpty()) + roomsList->selectionModel()->setCurrentIndex(roomsList->model()->index(r, 0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); + } + + roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); + roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(4, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(5, QHeaderView::ResizeToContents); + roomsList->horizontalHeader()->setResizeMode(6, QHeaderView::ResizeToContents); + + // TODO: Should NOT be done here + if (gameInLobby) { + gameInLobby = false; + if (gameCanBeJoined) { + emit askForJoinRoom(gameInLobbyName); + } else { + emit askJoinConfirmation(gameInLobbyName); + } + } + +// roomsList->resizeColumnsToContents(); +} + +void PageRoomsList::onCreateClick() +{ + if (roomName->text().size()) + emit askForCreateRoom(roomName->text()); + else + QMessageBox::critical(this, + tr("Error"), + tr("Please enter room name"), + tr("OK")); +} + +void PageRoomsList::onJoinClick() +{ + QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); + if (!curritem) + { + QMessageBox::critical(this, + tr("Error"), + tr("Please select room from the list"), + tr("OK")); + return; + } + + for (int i = 0; i < listFromServer.size(); i += 8) { + if (listFromServer[i + 1] == curritem->data(Qt::DisplayRole).toString()) { + gameInLobby = listFromServer[i].compare("True"); + break; + } + } + + if (gameInLobby) { + gameInLobbyName = curritem->data(Qt::DisplayRole).toString(); + emit askForRoomList(); + } else { + emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); + } +} + +void PageRoomsList::onRefreshClick() +{ + emit askForRoomList(); +} + +void PageRoomsList::onClearClick() +{ + CBState->setCurrentIndex(0); + CBRules->setCurrentIndex(0); + CBWeapons->setCurrentIndex(0); + searchText->clear(); +} + +void PageRoomsList::onJoinConfirmation(const QString & room) +{ + if (QMessageBox::warning(this, + tr("Warning"), + tr("The game you are trying to join has started.\nDo you still want to join the room?"), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) + { + emit askForJoinRoom(room); + } +} + +void PageRoomsList::updateNickCounter(int cnt) +{ + lblCount->setText(tr("%1 players online", 0, cnt).arg(cnt)); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageroomslist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageroomslist.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,84 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_ROOMLIST_H +#define PAGE_ROOMLIST_H + +#include "AbstractPage.h" + +class HWChatWidget; +class AmmoSchemeModel; + +class PageRoomsList : public AbstractPage +{ + Q_OBJECT + +public: + PageRoomsList(QWidget* parent, QSettings * config); + void displayError(const QString & message); + void displayNotice(const QString & message); + void displayWarning(const QString & message); + + QLineEdit * roomName; + QLineEdit * searchText; + QTableWidget * roomsList; + QPushButton * BtnCreate; + QPushButton * BtnJoin; + QPushButton * BtnRefresh; + QPushButton * BtnAdmin; + QPushButton * BtnClear; + QComboBox * CBState; + QComboBox * CBRules; + QComboBox * CBWeapons; + HWChatWidget * chatWidget; + QLabel * lblCount; + +public slots: + void setRoomsList(const QStringList & list); + void setAdmin(bool); + void updateNickCounter(int cnt); + +signals: + void askForCreateRoom(const QString &); + void askForJoinRoom(const QString &); + void askForRoomList(); + void askJoinConfirmation(const QString &); + +protected: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + +private slots: + void onCreateClick(); + void onJoinClick(); + void onRefreshClick(); + void onClearClick(); + void onJoinConfirmation(const QString &); + +private: + QSettings * m_gameSettings; + + bool gameInLobby; + QString gameInLobbyName; + QStringList listFromServer; + AmmoSchemeModel * ammoSchemeModel; + +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagescheme.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagescheme.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,510 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ammoSchemeModel.h" +#include "pagescheme.h" +#include "FreqSpinBox.h" + + +QLayout * PageScheme::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + QGroupBox * gb = new QGroupBox(this); + + QGridLayout * gl = new QGridLayout(); + gb->setLayout(gl); + QSizePolicy sp; + sp.setVerticalPolicy(QSizePolicy::MinimumExpanding); + sp.setHorizontalPolicy(QSizePolicy::Expanding); + + pageLayout->addWidget(gb, 1,0,13,5); + + gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb); + gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb); + + // TODO name stuff and put CSS into main style sheet + gbGameModes->setStyleSheet(".QGroupBox {" + "background-color: #130f2c; background-image:url();" + "}"); + gbBasicSettings->setStyleSheet(".QGroupBox {" + "background-color: #130f2c; background-image:url();" + "}"); + + gbGameModes->setSizePolicy(sp); + gbBasicSettings->setSizePolicy(sp); + gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop); + gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop); + + QGridLayout * glGMLayout = new QGridLayout(gbGameModes); + QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings); + gbGameModes->setLayout(glGMLayout); + gbBasicSettings->setLayout(glBSLayout); + // Left + + TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts@2x.png"); + TBW_mode_Forts->setToolTip("" + ToggleButtonWidget::tr("Fort Mode") + ":
" + 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->setToolTip("" + ToggleButtonWidget::tr("Divide Teams") + ":
" + tr("Teams will start on opposite sides of the terrain, two team colours max!")); + glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1); + + TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid@2x.png"); + TBW_solid->setToolTip("" + ToggleButtonWidget::tr("Solid Land") + ":
" + tr("Land can not be destroyed!")); + glGMLayout->addWidget(TBW_solid,0,2,1,1); + + TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder@2x.png"); + TBW_border->setToolTip("" + ToggleButtonWidget::tr("Add Border") + ":
" + tr("Add an indestructible border around the terrain")); + glGMLayout->addWidget(TBW_border,0,3,1,1); + + TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity@2x.png"); + TBW_lowGravity->setToolTip("" + ToggleButtonWidget::tr("Low Gravity") + ":
" + tr("Lower gravity")); + glGMLayout->addWidget(TBW_lowGravity,0,4,1,1); + + TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight@2x.png"); + TBW_laserSight->setToolTip("" + ToggleButtonWidget::tr("Laser Sight") + ":
" + 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->setToolTip("" + ToggleButtonWidget::tr("Invulnerable") + ":
" + tr("All hogs have a personal forcefield")); + glGMLayout->addWidget(TBW_invulnerable,1,1,1,1); + + TBW_resethealth = new ToggleButtonWidget(gbGameModes, ":/res/btnResetHealth@2x.png"); + TBW_resethealth->setToolTip("" + ToggleButtonWidget::tr("Reset Health") + ":
" + tr("All (living) hedgehogs are fully restored at the end of turn")); + glGMLayout->addWidget(TBW_resethealth,1,2,1,1); + + TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric@2x.png"); + TBW_vampiric->setToolTip("" + ToggleButtonWidget::tr("Vampirism") + ":
" + 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->setToolTip("" + ToggleButtonWidget::tr("Karma") + ":
" + tr("Share your opponents pain, share their damage")); + glGMLayout->addWidget(TBW_karma,1,4,1,1); + + TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery@2x.png"); + TBW_artillery->setToolTip("" + ToggleButtonWidget::tr("Artillery") + ":
" + tr("Your hogs are unable to move, put your artillery skills to the test")); + glGMLayout->addWidget(TBW_artillery,2,0,1,1); + + TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder@2x.png"); + TBW_randomorder->setToolTip("" + ToggleButtonWidget::tr("Random Order") + ":
" + tr("Order of play is random instead of in room order.")); + glGMLayout->addWidget(TBW_randomorder,2,1,1,1); + + TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing@2x.png"); + TBW_king->setToolTip("" + ToggleButtonWidget::tr("King") + ":
" + tr("Play with a King. If he dies, your side dies.")); + glGMLayout->addWidget(TBW_king,2,2,1,1); + + TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog@2x.png"); + TBW_placehog->setToolTip("" + ToggleButtonWidget::tr("Place Hedgehogs") + ":
" + tr("Take turns placing your hedgehogs before the start of play.")); + glGMLayout->addWidget(TBW_placehog,2,3,1,1); + + TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo@2x.png"); + TBW_sharedammo->setToolTip("" + ToggleButtonWidget::tr("Clan Shares Ammo") + ":
" + 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->setToolTip("" + ToggleButtonWidget::tr("Disable Girders") + ":
" + tr("Disable girders when generating random maps.")); + glGMLayout->addWidget(TBW_disablegirders,3,0,1,1); + + TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects@2x.png"); + TBW_disablelandobjects->setToolTip("" + ToggleButtonWidget::tr("Disable Land Objects") + ":
" + 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->setToolTip("" + ToggleButtonWidget::tr("AI Survival Mode") + ":
" + tr("AI respawns on death.")); + glGMLayout->addWidget(TBW_aisurvival,3,2,1,1); + + TBW_infattack = new ToggleButtonWidget(gbGameModes, ":/res/btnInfAttack@2x.png"); + TBW_infattack->setToolTip("" + ToggleButtonWidget::tr("Unlimited Attacks") + ":
" + 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->setToolTip("" + ToggleButtonWidget::tr("Reset Weapons") + ":
" + tr("Weapons are reset to starting values each turn.")); + glGMLayout->addWidget(TBW_resetweps,3,4,1,1); + + TBW_perhogammo = new ToggleButtonWidget(gbGameModes, ":/res/btnPerHogAmmo@2x.png"); + TBW_perhogammo->setToolTip("" + ToggleButtonWidget::tr("Per Hedgehog Ammo") + ":
" + tr("Each hedgehog has its own ammo. It does not share with the team.")); + glGMLayout->addWidget(TBW_perhogammo,4,0,1,1); + + TBW_nowind = new ToggleButtonWidget(gbGameModes, ":/res/btnNoWind@2x.png"); + TBW_nowind->setToolTip("" + ToggleButtonWidget::tr("Disable Wind") + ":
" + tr("You will not have to worry about wind anymore.")); + glGMLayout->addWidget(TBW_nowind,4,1,1,1); + + TBW_morewind = new ToggleButtonWidget(gbGameModes, ":/res/btnMoreWind@2x.png"); + TBW_morewind->setToolTip("" + ToggleButtonWidget::tr("More Wind") + ":
" + tr("Wind will affect almost everything.")); + glGMLayout->addWidget(TBW_morewind,4,2,1,1); + + TBW_tagteam = new ToggleButtonWidget(gbGameModes, ":/res/btnTagTeam@2x.png"); + TBW_tagteam->setToolTip("" + ToggleButtonWidget::tr("Tag Team") + ":
" + 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->setToolTip("" + ToggleButtonWidget::tr("Add Bottom Border") + ":
" + tr("Add an indestructible border along the bottom")); + glGMLayout->addWidget(TBW_bottomborder,4,4,1,1); + + + // Right + QLabel * l; + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Damage Modifier")); + l->setWordWrap(true); + glBSLayout->addWidget(l,0,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconDamage.png")); + glBSLayout->addWidget(l,0,1,1,1); + SB_DamageModifier = new QSpinBox(gbBasicSettings); + SB_DamageModifier->setRange(10, 300); + SB_DamageModifier->setValue(100); + SB_DamageModifier->setSingleStep(25); + glBSLayout->addWidget(SB_DamageModifier,0,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Turn Time")); + l->setWordWrap(true); + glBSLayout->addWidget(l,1,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconTime.png")); + glBSLayout->addWidget(l,1,1,1,1); + SB_TurnTime = new QSpinBox(gbBasicSettings); + SB_TurnTime->setRange(1, 9999); + SB_TurnTime->setValue(45); + SB_TurnTime->setSingleStep(15); + glBSLayout->addWidget(SB_TurnTime,1,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Initial Health")); + l->setWordWrap(true); + glBSLayout->addWidget(l,2,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconHealth.png")); + glBSLayout->addWidget(l,2,1,1,1); + SB_InitHealth = new QSpinBox(gbBasicSettings); + SB_InitHealth->setRange(50, 200); + SB_InitHealth->setValue(100); + SB_InitHealth->setSingleStep(25); + glBSLayout->addWidget(SB_InitHealth,2,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Sudden Death Timeout")); + l->setWordWrap(true); + glBSLayout->addWidget(l,3,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); + glBSLayout->addWidget(l,3,1,1,1); + SB_SuddenDeath = new QSpinBox(gbBasicSettings); + SB_SuddenDeath->setRange(0, 50); + SB_SuddenDeath->setValue(15); + SB_SuddenDeath->setSingleStep(3); + glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Sudden Death Water Rise")); + l->setWordWrap(true); + glBSLayout->addWidget(l,4,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); // TODO: icon + glBSLayout->addWidget(l,4,1,1,1); + SB_WaterRise = new QSpinBox(gbBasicSettings); + SB_WaterRise->setRange(0, 100); + SB_WaterRise->setValue(47); + SB_WaterRise->setSingleStep(5); + glBSLayout->addWidget(SB_WaterRise,4,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Sudden Death Health Decrease")); + l->setWordWrap(true); + glBSLayout->addWidget(l,5,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); // TODO: icon + glBSLayout->addWidget(l,5,1,1,1); + SB_HealthDecrease = new QSpinBox(gbBasicSettings); + SB_HealthDecrease->setRange(0, 100); + SB_HealthDecrease->setValue(5); + SB_HealthDecrease->setSingleStep(1); + glBSLayout->addWidget(SB_HealthDecrease,5,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("% Rope Length")); + l->setWordWrap(true); + glBSLayout->addWidget(l,6,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconRope.png")); + glBSLayout->addWidget(l,6,1,1,1); + SB_RopeModifier = new QSpinBox(gbBasicSettings); + SB_RopeModifier->setRange(25, 999); + SB_RopeModifier->setValue(100); + SB_RopeModifier->setSingleStep(25); + glBSLayout->addWidget(SB_RopeModifier,6,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Crate Drops")); + l->setWordWrap(true); + glBSLayout->addWidget(l,7,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconBox.png")); + glBSLayout->addWidget(l,7,1,1,1); + SB_CaseProb = new FreqSpinBox(gbBasicSettings); + SB_CaseProb->setRange(0, 9); + SB_CaseProb->setValue(5); + glBSLayout->addWidget(SB_CaseProb,7,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("% Health Crates")); + l->setWordWrap(true); + glBSLayout->addWidget(l,8,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon + glBSLayout->addWidget(l,8,1,1,1); + SB_HealthCrates = new QSpinBox(gbBasicSettings); + SB_HealthCrates->setRange(0, 100); + SB_HealthCrates->setValue(35); + SB_HealthCrates->setSingleStep(5); + glBSLayout->addWidget(SB_HealthCrates,8,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Health in Crates")); + l->setWordWrap(true); + glBSLayout->addWidget(l,9,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon + glBSLayout->addWidget(l,9,1,1,1); + SB_CrateHealth = new QSpinBox(gbBasicSettings); + SB_CrateHealth->setRange(0, 200); + SB_CrateHealth->setValue(25); + SB_CrateHealth->setSingleStep(5); + glBSLayout->addWidget(SB_CrateHealth,9,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Mines Time")); + l->setWordWrap(true); + glBSLayout->addWidget(l,10,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon + glBSLayout->addWidget(l,10,1,1,1); + SB_MinesTime = new QSpinBox(gbBasicSettings); + SB_MinesTime->setRange(-1, 5); + SB_MinesTime->setValue(3); + SB_MinesTime->setSingleStep(1); + SB_MinesTime->setSpecialValueText(tr("Random")); + SB_MinesTime->setSuffix(" "+ tr("Seconds")); + glBSLayout->addWidget(SB_MinesTime,10,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Mines")); + l->setWordWrap(true); + glBSLayout->addWidget(l,11,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon + glBSLayout->addWidget(l,11,1,1,1); + SB_Mines = new QSpinBox(gbBasicSettings); + SB_Mines->setRange(0, 80); + SB_Mines->setValue(0); + SB_Mines->setSingleStep(5); + glBSLayout->addWidget(SB_Mines,11,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("% Dud Mines")); + l->setWordWrap(true); + glBSLayout->addWidget(l,12,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconDud.png")); + glBSLayout->addWidget(l,12,1,1,1); + SB_MineDuds = new QSpinBox(gbBasicSettings); + SB_MineDuds->setRange(0, 100); + SB_MineDuds->setValue(0); + SB_MineDuds->setSingleStep(5); + glBSLayout->addWidget(SB_MineDuds,12,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Explosives")); + l->setWordWrap(true); + glBSLayout->addWidget(l,13,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconDamage.png")); + glBSLayout->addWidget(l,13,1,1,1); + SB_Explosives = new QSpinBox(gbBasicSettings); + SB_Explosives->setRange(0, 40); + SB_Explosives->setValue(0); + SB_Explosives->setSingleStep(1); + glBSLayout->addWidget(SB_Explosives,13,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("% Get Away Time")); + l->setWordWrap(true); + glBSLayout->addWidget(l,14,0,1,1); + l = new QLabel(gbBasicSettings); + l->setFixedSize(32,32); + l->setPixmap(QPixmap(":/res/iconTime.png")); + glBSLayout->addWidget(l,14,1,1,1); + SB_GetAwayTime = new QSpinBox(gbBasicSettings); + SB_GetAwayTime->setRange(0, 999); + SB_GetAwayTime->setValue(100); + SB_GetAwayTime->setSingleStep(25); + glBSLayout->addWidget(SB_GetAwayTime,14,2,1,1); + + l = new QLabel(gbBasicSettings); + l->setText(QLabel::tr("Scheme Name:")); + + LE_name = new QLineEdit(this); + + gl->addWidget(LE_name,15,1,1,5); + gl->addWidget(l,15,0,1,1); + + return pageLayout; +} + +QLayout * PageScheme::footerLayoutDefinition() +{ + QHBoxLayout * bottomLayout = new QHBoxLayout(); + selectScheme = new QComboBox(this); + + bottomLayout->addWidget(selectScheme, 0); + BtnCopy = addButton(tr("Copy"), bottomLayout, 1); + BtnNew = addButton(tr("New"), bottomLayout, 2); + BtnDelete = addButton(tr("Delete"), bottomLayout, 3); + + bottomLayout->setStretch(1,1); + bottomLayout->setStretch(2,1); + bottomLayout->setStretch(3,1); + + return bottomLayout; +} + +void PageScheme::connectSignals() +{ + connect(BtnCopy, SIGNAL(clicked()), this, SLOT(copyRow())); + connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow())); + connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow())); + mapper = new QDataWidgetMapper(this); + connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int))); + connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int))); +} + +PageScheme::PageScheme(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} + +void PageScheme::setModel(QAbstractItemModel * model) +{ + mapper->setModel(model); + selectScheme->setModel(model); + + mapper->addMapping(LE_name, 0); + mapper->addMapping(TBW_mode_Forts, 1); + mapper->addMapping(TBW_teamsDivide, 2); + mapper->addMapping(TBW_solid, 3); + mapper->addMapping(TBW_border, 4); + mapper->addMapping(TBW_lowGravity, 5); + mapper->addMapping(TBW_laserSight, 6); + mapper->addMapping(TBW_invulnerable, 7); + mapper->addMapping(TBW_resethealth, 8); + mapper->addMapping(TBW_vampiric, 9); + mapper->addMapping(TBW_karma, 10); + mapper->addMapping(TBW_artillery, 11); + mapper->addMapping(TBW_randomorder, 12); + mapper->addMapping(TBW_king, 13); + mapper->addMapping(TBW_placehog, 14); + mapper->addMapping(TBW_sharedammo, 15); + mapper->addMapping(TBW_disablegirders, 16); + mapper->addMapping(TBW_disablelandobjects, 17); + mapper->addMapping(TBW_aisurvival, 18); + mapper->addMapping(TBW_infattack, 19); + mapper->addMapping(TBW_resetweps, 20); + mapper->addMapping(TBW_perhogammo, 21); + mapper->addMapping(TBW_nowind, 22); + mapper->addMapping(TBW_morewind, 23); + mapper->addMapping(TBW_tagteam, 24); + mapper->addMapping(TBW_bottomborder, 25); + mapper->addMapping(SB_DamageModifier, 26); + mapper->addMapping(SB_TurnTime, 27); + mapper->addMapping(SB_InitHealth, 28); + mapper->addMapping(SB_SuddenDeath, 29); + mapper->addMapping(SB_CaseProb, 30); + mapper->addMapping(SB_MinesTime, 31); + mapper->addMapping(SB_Mines, 32); + mapper->addMapping(SB_MineDuds, 33); + mapper->addMapping(SB_Explosives, 34); + mapper->addMapping(SB_HealthCrates, 35); + mapper->addMapping(SB_CrateHealth, 36); + mapper->addMapping(SB_WaterRise, 37); + mapper->addMapping(SB_HealthDecrease, 38); + mapper->addMapping(SB_RopeModifier, 39); + mapper->addMapping(SB_GetAwayTime, 40); + + mapper->toFirst(); +} + +void PageScheme::newRow() +{ + QAbstractItemModel * model = mapper->model(); + model->insertRow(-1); + selectScheme->setCurrentIndex(model->rowCount() - 1); +} + +void PageScheme::copyRow() +{ + QAbstractItemModel * model = mapper->model(); + model->insertRow(selectScheme->currentIndex()); + selectScheme->setCurrentIndex(model->rowCount() - 1); +} + +void PageScheme::deleteRow() +{ + QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel); + + if (reallyDelete.exec() == QMessageBox::Ok) { + QAbstractItemModel * model = mapper->model(); + model->removeRow(selectScheme->currentIndex()); + } +} + +void PageScheme::schemeSelected(int n) +{ + int c = ((AmmoSchemeModel*)mapper->model())->numberOfDefaultSchemes; + gbGameModes->setEnabled(n >= c); + gbBasicSettings->setEnabled(n >= c); + LE_name->setEnabled(n >= c); +} + + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagescheme.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagescheme.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,104 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_SCHEME_H +#define PAGE_SCHEME_H + +#include "AbstractPage.h" +#include "togglebutton.h" + +class FreqSpinBox; + +class PageScheme : public AbstractPage +{ + Q_OBJECT + +public: + PageScheme(QWidget* parent = 0); + + QPushButton * BtnCopy; + QPushButton * BtnNew; + QPushButton * BtnDelete; + QPushButton * btnSave; + QComboBox * selectScheme; + + void setModel(QAbstractItemModel * model); + +public slots: + void newRow(); + void copyRow(); + void deleteRow(); + +protected: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + +private: + QDataWidgetMapper * mapper; + ToggleButtonWidget * TBW_mode_Forts; + ToggleButtonWidget * TBW_teamsDivide; + ToggleButtonWidget * TBW_solid; + ToggleButtonWidget * TBW_border; + ToggleButtonWidget * TBW_lowGravity; + ToggleButtonWidget * TBW_laserSight; + ToggleButtonWidget * TBW_invulnerable; + ToggleButtonWidget * TBW_resethealth; + ToggleButtonWidget * TBW_vampiric; + ToggleButtonWidget * TBW_karma; + ToggleButtonWidget * TBW_artillery; + ToggleButtonWidget * TBW_randomorder; + ToggleButtonWidget * TBW_king; + ToggleButtonWidget * TBW_placehog; + ToggleButtonWidget * TBW_sharedammo; + ToggleButtonWidget * TBW_disablegirders; + ToggleButtonWidget * TBW_disablelandobjects; + ToggleButtonWidget * TBW_aisurvival; + ToggleButtonWidget * TBW_infattack; + ToggleButtonWidget * TBW_resetweps; + ToggleButtonWidget * TBW_perhogammo; + ToggleButtonWidget * TBW_nowind; + ToggleButtonWidget * TBW_morewind; + ToggleButtonWidget * TBW_tagteam; + ToggleButtonWidget * TBW_bottomborder; + + QSpinBox * SB_DamageModifier; + QSpinBox * SB_TurnTime; + QSpinBox * SB_InitHealth; + QSpinBox * SB_SuddenDeath; + QSpinBox * SB_WaterRise; + QSpinBox * SB_HealthDecrease; + FreqSpinBox * SB_CaseProb; + QSpinBox * SB_HealthCrates; + QSpinBox * SB_CrateHealth; + QSpinBox * SB_MinesTime; + QSpinBox * SB_Mines; + QSpinBox * SB_MineDuds; + QSpinBox * SB_Explosives; + QSpinBox * SB_RopeModifier; + QSpinBox * SB_GetAwayTime; + QLineEdit * LE_name; + + QGroupBox * gbGameModes; + QGroupBox * gbBasicSettings; + +private slots: + void schemeSelected(int); +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageselectweapon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageselectweapon.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,75 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include + +#include "pageselectweapon.h" +#include "hwconsts.h" +#include "selectWeapon.h" + +QLayout * PageSelectWeapon::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + + pWeapons = new SelWeaponWidget(cAmmoNumber, this); + pageLayout->addWidget(pWeapons); + + return pageLayout; +} + +QLayout * PageSelectWeapon::footerLayoutDefinition() +{ + QGridLayout * bottomLayout = new QGridLayout(); + + selectWeaponSet = new QComboBox(this); + bottomLayout->addWidget(selectWeaponSet, 0, 0, 2, 1); + + // first row + BtnNew = addButton(tr("New"), bottomLayout, 0, 1); + BtnDefault = addButton(tr("Default"), bottomLayout, 0, 2); + + // second row + BtnCopy = addButton(tr("Copy"), bottomLayout, 1, 1); + BtnDelete = addButton(tr("Delete"), bottomLayout, 1, 2); + + bottomLayout->setColumnStretch(1,1); + bottomLayout->setColumnStretch(2,1); + + btnSave = addButton(":/res/Save.png", bottomLayout, 0, 3, 2, 1, true); + btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}"); + bottomLayout->setAlignment(btnSave, Qt::AlignRight | Qt::AlignBottom); + + return bottomLayout; +} + +void PageSelectWeapon::connectSignals() +{ + connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault())); + connect(btnSave, SIGNAL(clicked()), pWeapons, SLOT(save())); + connect(BtnNew, SIGNAL(clicked()), pWeapons, SLOT(newWeaponsName())); + connect(BtnCopy, SIGNAL(clicked()), pWeapons, SLOT(copy())); + connect(selectWeaponSet, SIGNAL(currentIndexChanged(const QString&)), pWeapons, SLOT(setWeaponsName(const QString&))); +} + +PageSelectWeapon::PageSelectWeapon(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pageselectweapon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pageselectweapon.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_SELECTWEAPON_H +#define PAGE_SELECTWEAPON_H + +#include "AbstractPage.h" + +class SelWeaponWidget; + +class PageSelectWeapon : public AbstractPage +{ + Q_OBJECT + +public: + PageSelectWeapon(QWidget* parent = 0); + + QPushButton *btnSave; + QPushButton *BtnDefault; + QPushButton *BtnDelete; + QPushButton *BtnNew; + QPushButton *BtnCopy; + SelWeaponWidget* pWeapons; + QComboBox* selectWeaponSet; + +protected: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); +}; + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagesingleplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagesingleplayer.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,83 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include + +#include "pagesingleplayer.h" +#include "gamecfgwidget.h" + +QLayout * PageSinglePlayer::bodyLayoutDefinition() +{ + QVBoxLayout * vLayout = new QVBoxLayout(); + + QHBoxLayout * topLine = new QHBoxLayout(); + QHBoxLayout * middleLine = new QHBoxLayout(); + vLayout->addStretch(); + vLayout->addLayout(topLine); + vLayout->addSpacing(30); + vLayout->addLayout(middleLine); + vLayout->addStretch(); + + topLine->addStretch(); + BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); + BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); + topLine->addSpacing(60); + BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); + BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); + topLine->addStretch(); + + + BtnCampaignPage = addButton(":/res/Campaign.png", middleLine, 0, true); + BtnCampaignPage->setToolTip(tr("Campaign Mode (...)")); + BtnCampaignPage->setVisible(false); + + BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 1, true); + BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions)")); + + return vLayout; +} + +QLayout * PageSinglePlayer::footerLayoutDefinition() +{ + QHBoxLayout * bottomLine = new QHBoxLayout(); + bottomLine->addStretch(); + + BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); + BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); + BtnLoad = addButton(":/res/Load.png", bottomLine, 2, true); + BtnLoad->setStyleSheet("QPushButton{margin: 24px 0 0 0;}"); + BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); + + bottomLine->setStretch(1,0); + bottomLine->setStretch(2,0); + bottomLine->setAlignment(BtnDemos, Qt::AlignRight | Qt::AlignBottom); + bottomLine->setAlignment(BtnLoad, Qt::AlignRight | Qt::AlignBottom); + + return bottomLine; +} + +void PageSinglePlayer::connectSignals() +{ + //TODO +} + +PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) +{ + initPage(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagesingleplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagesingleplayer.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,48 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_SINGLE_PLAYER_H +#define PAGE_SINGLE_PLAYER_H + +#include "AbstractPage.h" + +class GameCFGWidget; + +class PageSinglePlayer : public AbstractPage +{ + Q_OBJECT + +public: + PageSinglePlayer(QWidget* parent = 0); + + QPushButton *BtnSimpleGamePage; + QPushButton *BtnTrainPage; + QPushButton *BtnCampaignPage; + QPushButton *BtnMultiplayer; + QPushButton *BtnLoad; + QPushButton *BtnDemos; + GameCFGWidget *gameCFG; + +private: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagetraining.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagetraining.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,221 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "hwconsts.h" +#include "HWDataManager.h" + +#include "pagetraining.h" + +QLayout * PageTraining::bodyLayoutDefinition() +{ + QGridLayout * pageLayout = new QGridLayout(); + +// left column + + // declare start button, caption and description + btnPreview = formattedButton(":/res/Trainings.png", true); + btnPreview->setToolTip(QPushButton::tr("Go!")); + + // make both rows equal height + pageLayout->setRowStretch(0, 1); + pageLayout->setRowStretch(1, 1); + + // add start button, caption and description to 3 different rows + pageLayout->addWidget(btnPreview, 0, 0); + + // center preview + pageLayout->setAlignment(btnPreview, Qt::AlignRight | Qt::AlignVCenter); + + +// right column + + // info area (caption on top, description below) + QVBoxLayout * infoLayout = new QVBoxLayout(); + + lblCaption = new QLabel(); + lblCaption->setMinimumWidth(360); + lblCaption->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); + lblCaption->setWordWrap(true); + lblDescription = new QLabel(); + lblDescription->setMinimumWidth(360); + lblDescription->setAlignment(Qt::AlignHCenter | Qt::AlignTop); + lblDescription->setWordWrap(true); + + infoLayout->addWidget(lblCaption); + infoLayout->addWidget(lblDescription); + + pageLayout->addLayout(infoLayout, 0, 1); + pageLayout->setAlignment(infoLayout, Qt::AlignLeft); + + + // mission list + lstMissions = new QListWidget(this); + pageLayout->addWidget(lstMissions, 1, 0, 1, 2); // span 2 columns + + // let's not make the list use more space than needed + lstMissions->setFixedWidth(360); + pageLayout->setAlignment(lstMissions, Qt::AlignHCenter); + + return pageLayout; +} + +QLayout * PageTraining::footerLayoutDefinition() +{ + QBoxLayout * bottomLayout = new QVBoxLayout(); + + btnStart = formattedButton(QPushButton::tr("Go!")); + btnStart->setFixedWidth(140); + + bottomLayout->addWidget(btnStart); + + bottomLayout->setAlignment(btnStart, Qt::AlignRight | Qt::AlignVCenter); + + return bottomLayout; +} + + +void PageTraining::connectSignals() +{ + connect(lstMissions, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateInfo())); + connect(lstMissions, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(updateInfo())); + connect(lstMissions, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(startSelected())); + connect(btnPreview, SIGNAL(clicked()), this, SLOT(startSelected())); + connect(btnStart, SIGNAL(clicked()), this, SLOT(startSelected())); +} + + +PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) +{ + initPage(); + + HWDataManager & dataMgr = HWDataManager::instance(); + + // get locale + QSettings settings(cfgdir->absolutePath() + "/hedgewars.ini", + QSettings::IniFormat); + + QString loc = settings.value("misc/locale", "").toString(); + if (loc.isEmpty()) + loc = QLocale::system().name(); + + QString infoFile = dataMgr.findFileForRead( + QString("Locale/missions_" + loc + ".txt")); + + // if file is non-existant try with language only + if (!QFile::exists(infoFile)) + infoFile = dataMgr.findFileForRead(QString( + "Locale/missions_" + loc.remove(QRegExp("_.*$")) + ".txt")); + + // fallback if file for current locale is non-existant + if (!QFile::exists(infoFile)) + infoFile = dataMgr.findFileForRead(QString("Locale/missions_en.txt")); + + + // preload mission info for current locale + m_info = new QSettings(infoFile, QSettings::IniFormat, this); + + + QStringList missionList = dataMgr.entryList( + "Missions/Training", + QDir::Files, QStringList("*.lua")). + replaceInStrings(QRegExp("\\.lua$"), ""); + + // scripts to lost - TODO: model? + foreach (const QString & mission, missionList) + { + QListWidgetItem * item = new QListWidgetItem(mission); + + // fallback name: replace underscores in mission name with spaces + QString name = item->text().replace("_", " "); + + // see if we can get a prettier/translated name + name = m_info->value(mission + ".name", name).toString(); + + item->setText(name); + + // store original name in data + item->setData(Qt::UserRole, mission); + + lstMissions->addItem(item); + } + + updateInfo(); + + // pre-select first mission + if (lstMissions->count() > 0) + lstMissions->setCurrentRow(0); +} + + +void PageTraining::startSelected() +{ + QListWidgetItem * curItem = lstMissions->currentItem(); + + if (curItem != NULL) + emit startMission(curItem->data(Qt::UserRole).toString()); +} + + +void PageTraining::updateInfo() +{ + HWDataManager & dataMgr = HWDataManager::instance(); + + if (lstMissions->currentItem()) + { + // TODO also use .pngs in userdata folder + QString thumbFile = dataMgr.findFileForRead( + "Graphics/Missions/Training/" + + lstMissions->currentItem()->data(Qt::UserRole).toString() + + "@2x.png"); + + if (QFile::exists(thumbFile)) + btnPreview->setIcon(QIcon(thumbFile)); + else + btnPreview->setIcon(QIcon(":/res/Trainings.png")); + + QString realName = lstMissions->currentItem()->data( + Qt::UserRole).toString(); + + QString caption = m_info->value(realName + ".name", + lstMissions->currentItem()->text()).toString(); + + QString description = m_info->value(realName + ".desc", + tr("No description available")).toString(); + + lblCaption->setText("

" + caption +"

"); + lblDescription->setText(description); + } + else + { + btnPreview->setIcon(QIcon(":/res/Trainings.png")); + lblCaption->setText(tr("Select a mission!")); + // TODO better text and tr() + lblDescription->setText(""); + } +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/page/pagetraining.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/page/pagetraining.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,58 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef PAGE_TRAINING_H +#define PAGE_TRAINING_H + +#include "AbstractPage.h" + +class PageTraining : public AbstractPage +{ + Q_OBJECT + +public: + PageTraining(QWidget* parent = 0); + + +signals: + void startMission(const QString & scriptName); + + +protected: + QLayout * bodyLayoutDefinition(); + QLayout * footerLayoutDefinition(); + void connectSignals(); + + +private: + QPushButton * btnPreview; + QPushButton * btnStart; + QLabel * lblCaption; + QLabel * lblDescription; + QListWidget * lstMissions; + QSettings * m_info; + + +private slots: + void startSelected(); + void updateInfo(); + +}; + +#endif + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/qaspectratiolayout.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/qaspectratiolayout.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2009 Nokia Corporation. + */ + +#include "qaspectratiolayout.h" + +QAspectRatioLayout::QAspectRatioLayout(QWidget* parent, int spacing) : QLayout(parent) { + init(spacing); +} + +QAspectRatioLayout::QAspectRatioLayout(int spacing) { + init(spacing); +} + +QAspectRatioLayout::~QAspectRatioLayout() { + delete item; + delete lastReceivedRect; + delete _geometry; +} + +void QAspectRatioLayout::init(int spacing) { + item = 0; + lastReceivedRect = new QRect(0, 0, 0, 0); + _geometry = new QRect(0, 0, 0, 0); + setSpacing(spacing); +} + + +/* Adds item if place isn't already taken. */ +void QAspectRatioLayout::add(QLayoutItem* item) { + if(!hasItem()) { + replaceItem(item); + } +} + +/* Adds item if place isn't already taken. */ +void QAspectRatioLayout::addItem(QLayoutItem* item) { + if(!hasItem()) { + replaceItem(item); + } +} + +/* Adds widget if place isn't already taken. */ +void QAspectRatioLayout::addWidget(QWidget* widget) { + if(!hasItem()) { + replaceItem(new QWidgetItem(widget)); + } +} + +/* Returns the item pointer and dereferences it here. */ +QLayoutItem* QAspectRatioLayout::take() { + QLayoutItem* item = 0; + if(this->hasItem()) { + item = this->item; + this->item = 0; + } + return item; +} + +/* Returns the item pointer and dereferences it here. */ +QLayoutItem* QAspectRatioLayout::takeAt(int index) { + if(index != 0) { + return 0; + } + return this->take(); +} + +/* Returns the item pointer. */ +QLayoutItem* QAspectRatioLayout::itemAt(int index) const { + if(index != 0) { + return 0; + } + if(hasItem()) { + return this->item; + } + return 0; +} + +/* Checks if we have an item. */ +bool QAspectRatioLayout::hasItem() const { + return this->item != 0; +} + +/* Returns the count of items which can be either 0 or 1. */ +int QAspectRatioLayout::count() const { + int returnValue = 0; + if(hasItem()) { + returnValue = 1; + } + return returnValue; +} + +/* Replaces the item with the new and returns the old. */ +QLayoutItem* QAspectRatioLayout::replaceItem(QLayoutItem* item) { + QLayoutItem* old = 0; + if(this->hasItem()) { + old = this->item; + } + this->item = item; + setGeometry(*this->_geometry); + return old; +} + +/* Tells which way layout expands. */ +Qt::Orientations QAspectRatioLayout::expandingDirections() const { + return Qt::Horizontal | Qt::Vertical; +} + +/* Tells which size is preferred. */ +QSize QAspectRatioLayout::sizeHint() const { + return this->item->minimumSize(); +} + +/* Tells minimum size. */ +QSize QAspectRatioLayout::minimumSize() const { + return this->item->minimumSize(); +} + +/* + * Tells if heightForWidth calculations is handled. + * It isn't since width isn't enough to calculate + * proper size. + */ +bool QAspectRatioLayout::hasHeightForWidth() const { + return false; +} + +/* Replaces lastReceivedRect. */ +void QAspectRatioLayout::setLastReceivedRect(const QRect& rect) { + QRect* oldRect = this->lastReceivedRect; + this->lastReceivedRect = new QRect(rect.topLeft(), rect.size()); + delete oldRect; +} + +/* Returns geometry */ +QRect QAspectRatioLayout::geometry() { + return QRect(*this->_geometry); +} + +/* Sets geometry to given size. */ +void QAspectRatioLayout::setGeometry(const QRect& rect) { + /* + * We check if the item is set and + * if size is the same previously received. + * If either is false nothing is done. + */ + if(!this->hasItem() || + areRectsEqual(*this->lastReceivedRect, rect)) { + return; + } + /* Replace the last received rectangle. */ + setLastReceivedRect(rect); + /* Calculate proper size for the item relative to the received size. */ + QSize properSize = calculateProperSize(rect.size()); + /* Calculate center location in the rect and with item size. */ + QPoint properLocation = calculateCenterLocation(rect.size(), properSize); + /* Set items geometry */ + this->item->setGeometry(QRect(properLocation, properSize)); + QRect* oldRect = this->_geometry; + /* Cache the calculated geometry. */ + this->_geometry = new QRect(properLocation, properSize); + delete oldRect; + /* Super classes setGeometry */ + QLayout::setGeometry(*this->_geometry); +} + +/* Takes the shortest side and creates QSize + * with the shortest side as width and height. */ +QSize QAspectRatioLayout::calculateProperSize(QSize from) const { + QSize properSize; + if(from.height() * 2 < from.width()) { + properSize.setHeight(from.height() - this->margin()); + properSize.setWidth(from.height() * 2 - this->margin()); + } + else { + properSize.setWidth(from.width() - this->margin()); + properSize.setHeight(from.width() / 2 - this->margin()); + } + return properSize; +} + +/* Calculates center location from the given height and width for item size. */ +QPoint QAspectRatioLayout::calculateCenterLocation(QSize from, + QSize itemSize) const { + QPoint centerLocation; + if((from.width() - itemSize.width()) > 0) { + centerLocation.setX((from.width() - itemSize.width())/2); + } + if((from.height() - itemSize.height()) > 0) { + centerLocation.setY((from.height() - itemSize.height())/2); + } + return centerLocation; +} + +/* Compares if two QRects are equal. */ +bool QAspectRatioLayout::areRectsEqual(const QRect& a, + const QRect& b) const { + bool result = false; + if(a.x() == b.x() && + a.y() == b.y() && + a.height() == b.height() && + a.width() == b.width()) { + result = true; + } + return result; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/qaspectratiolayout.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/qaspectratiolayout.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2009 Nokia Corporation. + */ + +#ifndef QASPECTRATIOLAYOUT_H_ +#define QASPECTRATIOLAYOUT_H_ + +#include +#include +#include +#include +#include + + +class QAspectRatioLayout : public QLayout +{ + Q_OBJECT + +public: + QAspectRatioLayout(QWidget* parent, int spacing =-1); + QAspectRatioLayout(int spacing = -1); + ~QAspectRatioLayout(); + + /* Convenience method */ + virtual void add(QLayoutItem* item); + +/* http://doc.trolltech.com/qlayout.html#addItem */ + virtual void addItem(QLayoutItem* item); + /* http://doc.trolltech.com/qlayout.html#addWidget */ + virtual void addWidget(QWidget* widget); + /* http://doc.trolltech.com/qlayout.html#takeAt */ + virtual QLayoutItem* takeAt(int index); + /* http://doc.trolltech.com/qlayout.html#itemAt */ + virtual QLayoutItem* itemAt(int index) const; + /* http://doc.trolltech.com/qlayout.html#count */ + virtual int count() const; + + /* + * These are ours since we do have only one item. + */ + virtual QLayoutItem* replaceItem(QLayoutItem* item); + virtual QLayoutItem* take(); + virtual bool hasItem() const; + +/* http://doc.trolltech.com/qlayout.html#expandingDirections */ + virtual Qt::Orientations expandingDirections() const; + + /* + * This method contains most of the juice of this article. + * http://doc.trolltech.com/qlayoutitem.html#setGeometry + */ + virtual void setGeometry(const QRect& rect); + /* http://doc.trolltech.com/qlayoutitem.html#geometry */ + virtual QRect geometry(); + + /* http://doc.trolltech.com/qlayoutitem.html#sizeHint */ + virtual QSize sizeHint() const; + /* http://doc.trolltech.com/qlayout.html#minimumSize */ + virtual QSize minimumSize() const; + /* http://doc.trolltech.com/qlayoutitem.html#hasHeightForWidth */ + virtual bool hasHeightForWidth() const; + +private: + /* Saves the last received rect. */ + void setLastReceivedRect(const QRect& rect); + /* Used to initialize the object. */ + void init(int spacing); + /* Calculates the maximum size for the item from the assigned size. */ + QSize calculateProperSize(QSize from) const; + /* Calculates the center location from the assigned size and + * the items size. */ + QPoint calculateCenterLocation(QSize from, QSize itemSize) const; + /* Check if two QRects are equal */ + bool areRectsEqual(const QRect& a, const QRect& b) const; + /* Contains item reference */ + QLayoutItem* item; + /* + * Used for caching so we won't do calculations every time + * setGeometry is called. + */ + QRect* lastReceivedRect; + /* Contains geometry */ + QRect* _geometry; + +}; + +#endif /* QASPECTRATIOLAYOUT_H_ */ diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/FreqSpinBox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/FreqSpinBox.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,39 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2005-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief FreqSpinBox class implementation + */ + +#include "FreqSpinBox.h" + + +FreqSpinBox::FreqSpinBox(QWidget* parent) : QSpinBox(parent) +{ + // do nothing +}; + + +QString FreqSpinBox::textFromValue(int value) const +{ + if (value == 0) + return tr("Never"); + else + return tr("Every %1 turn", "", value).arg(value); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/FreqSpinBox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/FreqSpinBox.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,58 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2005-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief FreqSpinBox class definition + */ + +#ifndef HEDGEWARS_FREQSPINBOX_H +#define HEDGEWARS_FREQSPINBOX_H + +#include +#include + +/** + * SpinBox that returns its value as localized turn frequency. + * 'Never', 'Every Turn', 'Every 2 Turns', etc. + * @author unc0rr + * @since 0.9.12 + */ +class FreqSpinBox : public QSpinBox +{ + Q_OBJECT + +public: + /** + * @brief Class constructor. + * @param parent parent widget. + */ + FreqSpinBox(QWidget * parent); + +protected: + /** + * Returns it's value as localized frequency. + * 'Never', 'Every Turn', 'Every 2 Turns', etc. + * @param value integer value to be representing as string. + * @return the turn frequence-like string representation. + */ + QString textFromValue(int value) const; +}; + + +#endif // HEDGEWARS_FREQSPINBOX_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/HistoryLineEdit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/HistoryLineEdit.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,142 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief HistoryLineEdit class implementation + */ + +#include + +#include "HistoryLineEdit.h" + +HistoryLineEdit::HistoryLineEdit(QWidget * parent, int maxHistorySize) +: QLineEdit(parent) +{ + m_curHistEntryIdx = 0; + m_maxHistorySize = maxHistorySize; + m_history = new QStringList(); +} + + +HistoryLineEdit::~HistoryLineEdit() +{ + delete m_history; +} + + +void HistoryLineEdit::rememberCurrentText() +{ + QString newEntry = text(); + + // don't store whitespace-only/empty text + if (newEntry.trimmed().isEmpty()) + return; + + m_history->removeOne(newEntry); // no duplicates please + m_history->append(newEntry); + + // do not keep more entries than allowed + if (m_history->size() > m_maxHistorySize) + m_history->removeFirst(); + + // we're looking at the latest entry + m_curHistEntryIdx = m_history->size() - 1; +} + + +void HistoryLineEdit::clear() +{ + QLineEdit::clear(); + m_curHistEntryIdx = m_history->size(); +} + + +void HistoryLineEdit::reset() +{ + // forget history + m_history->clear(); + m_curHistEntryIdx = 0; +} + + +void HistoryLineEdit::navigateHistory(bool isGoingUp) +{ + // save possible changes to new entry + if ((m_curHistEntryIdx >= m_history->size() || + (text() != m_history->at(m_curHistEntryIdx)))) + { + rememberCurrentText(); + } + + if (isGoingUp) + m_curHistEntryIdx--; + else + m_curHistEntryIdx++; + + // if Idx higher than valid range + if (m_curHistEntryIdx >= m_history->size()) + { + QLineEdit::clear(); + m_curHistEntryIdx = m_history->size(); + } + // if Idx in valid range + else if (m_curHistEntryIdx >= 0) + { + setText(m_history->at(m_curHistEntryIdx)); + } + // if Idx below 0 + else + m_curHistEntryIdx = 0; + +} + + +void HistoryLineEdit::keyPressEvent(QKeyEvent * event) +{ + int key = event->key(); // retrieve pressed key + + // navigate history with arrow keys + if (event->modifiers() == Qt::NoModifier) + switch (key) + { + case Qt::Key_Escape: + clear(); + event->accept(); + break; + + case Qt::Key_Up: + navigateHistory(true); + event->accept(); + break; + + case Qt::Key_Down: + navigateHistory(false); + event->accept(); + break; + + default: + QLineEdit::keyPressEvent(event); + break; + } + // otherwise forward keys to parent + else + QLineEdit::keyPressEvent(event); +} + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/HistoryLineEdit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/HistoryLineEdit.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,111 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief HistoryLineEdit class definition + */ + +#ifndef HEDGEWARS_HISTORYLINEEDIT +#define HEDGEWARS_HISTORYLINEEDIT + +#include +#include + +#include + +#include + + +class QLineEdit; + +/** + * @brief QLineEdit that features a history of previous contents, + * re-selectable using the arrow keys. + * + * @author sheepluva + * @since 0.9.17 + */ +class HistoryLineEdit : public QLineEdit +{ + Q_OBJECT + +public: + /** + * @brief Class constructor. + * @param parent parent QWidget. + * @param maxHistorySize maximum amount of history entries kept. + */ + HistoryLineEdit(QWidget * parent = 0, int maxHistorySize = 64); + + /** + * @brief Class destructor. + */ + ~HistoryLineEdit(); + + /** + * @brief Appends current text to history (if not only whitespaces); + */ + void rememberCurrentText(); + + /** + * @brief Forget all history. + */ + void reset(); + + +public slots: + /** + * @brief Clears the contents. + */ + void clear(); + + +protected: + /** + * @brief Overrides method of parent class. + * Arrow keys are used for navigating the history. + * + * All other keys are forwarded to the parent's method. + * + * @param event the key event. + */ + virtual void keyPressEvent(QKeyEvent * event); + + +private: + int m_maxHistorySize; ///< the maximum allowed size for the history + int m_curHistEntryIdx; ///< the index of the displayed used entry + + QStringList * m_history; ///< history of previous inputs + + /** + * @brief Navigates content history in the desired direction. + * + * Note: no wrap-around on purpose (so that holding down/up will get the + * the user to the respective end rather than into an endless cycle :P) + * + * @param isGoingUp true: next older entry, false: next more recent entry. + */ + void navigateHistory(bool isGoingUp); +}; + + + +#endif // HEDGEWARS_HISTORYLINEEDIT diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/SmartLineEdit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/SmartLineEdit.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,256 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief SmartLineEdit class implementation + */ + +#include "SmartLineEdit.h" + +SmartLineEdit::SmartLineEdit(QWidget * parent, int maxHistorySize) +: HistoryLineEdit(parent, maxHistorySize) +{ + m_whitespace = QRegExp("\\s"); + + m_cmds = new QStringList(); + m_nicks = new QStringList(); + m_sorted_nicks = new QMap(); + + resetAutoCompletionStatus(); + + // reset autocompletion status when cursor is moved or content is changed + connect(this, SIGNAL(cursorPositionChanged(int, int)), + this, SLOT(resetAutoCompletionStatus())); + connect(this, SIGNAL(textChanged(const QString&)), + this, SLOT(resetAutoCompletionStatus())); +} + + +SmartLineEdit::~SmartLineEdit() +{ + delete m_cmds; + delete m_nicks; + delete m_sorted_nicks; +} + + +void SmartLineEdit::addCommands(const QStringList & commands) +{ + m_cmds->append(commands); +} + + +void SmartLineEdit::removeCommands(const QStringList & commands) +{ + foreach (const QString & cmd, commands) + { + m_cmds->removeAll(cmd); + } +} + + +void SmartLineEdit::addNickname(const QString & name) +{ + m_sorted_nicks->insert(name.toLower(), name); + m_nicks->append(name); +} + + +void SmartLineEdit::removeNickname(const QString & name) +{ + m_sorted_nicks->remove(name.toLower()); + m_nicks->removeAll(name); +} + + +void SmartLineEdit::reset() +{ + // forget keywords + m_cmds->clear(); + m_sorted_nicks->clear(); + m_nicks->clear(); + resetAutoCompletionStatus(); + + // forget history + HistoryLineEdit::reset(); +} + + +bool SmartLineEdit::event(QEvent * event) +{ + // we only want special treatment for key press events + if (event->type() == QEvent::KeyPress) + { + QKeyEvent * keyEvent = static_cast(event); + + // TAB key pressed and any useful chars in the matchMe -> let's process those + if ((keyEvent->key() == Qt::Key_Tab) && (!text().trimmed().isEmpty())) + { + keyPressEvent(keyEvent); + if (event->isAccepted()) + return true; + } + } + return HistoryLineEdit::event(event); +} + +void SmartLineEdit::keyPressEvent(QKeyEvent * event) +{ + int key = event->key(); // retrieve pressed key + + // auto-complete on pressed TAB (except for whitespace-only contents) + if ((key == Qt::Key_Tab) && (!text().trimmed().isEmpty())) + { + autoComplete(); + event->accept(); + } + // clear contents on pressed ESC + else if ((event->modifiers() == Qt::NoModifier) && (key == Qt::Key_Escape)) + { + clear(); + event->accept(); + } + // otherwise forward keys to parent + else + HistoryLineEdit::keyPressEvent(event); +} + + +void SmartLineEdit::autoComplete() +{ + QString match = ""; + bool isNick = false; + QString matchMe = text(); + QString prefix = ""; + QString postfix = ""; + bool isFirstWord; + + // we are trying to rematch, so use the data from earlier + if (m_hasJustMatched) + { + // restore values from earlier auto-completion + matchMe = m_beforeMatch; + prefix = m_prefix; + postfix = m_postfix; + isFirstWord = prefix.isEmpty(); + } + else + { + m_cmds->sort(); + m_nicks = new QStringList(m_sorted_nicks->values()); + + int cp = cursorPosition(); + + // cursor is not in or at end/beginning of word + if ((cp = matchMe.length()) || (QString(matchMe.at(cp)).contains(m_whitespace))) + if ((cp < 1) || (QString(matchMe.at(cp-1)).contains(m_whitespace))) + return; + + // crop matchMe at cursor position + prefix = matchMe.left (cp); + postfix = matchMe.right(matchMe.length()-cp); + + matchMe = ""; + + + // use the whole word the curser is on for matching + int prefixLen = prefix.lastIndexOf(m_whitespace) + 1; + int preWordLen = prefix.length() - prefixLen; + int postWordLen = postfix.indexOf(m_whitespace); + int postfixLen = 0; + if (postWordLen < 0) + postWordLen = postfix.length(); + else + postfixLen = postfix.length() - (postWordLen + 1); + + matchMe = prefix.right(preWordLen) + postfix.left(postWordLen); + prefix = prefix.left(prefixLen); + postfix = postfix.right(postfixLen); + + + isFirstWord = prefix.isEmpty(); // true if first word + } + + + if (isFirstWord) + { + // find matching commands + foreach (const QString & cmd, *m_cmds) + { + if (cmd.startsWith(matchMe, Qt::CaseInsensitive)) + { + match = cmd; + + // move match to end so next time new matches will be preferred + m_cmds->removeAll(cmd); + m_cmds->append(cmd); + + break; + } + } + } + + if (match.isEmpty()) + { + // find matching nicks + foreach (const QString & nick, *m_nicks) + { + if (nick.startsWith(matchMe, Qt::CaseInsensitive)) + { + match = nick; + isNick = true; + + // move match to end so next time new matches will be prefered + m_nicks->removeAll(nick); + m_nicks->append(nick); + + break; + } + } + } + + // we found a single match? + if (!match.isEmpty()) + { + // replace last word with match + // and append ':' if a name at the beginning of the matchMe got completed + // also add a space at the very end to ease further typing + QString addAfter = ((isNick && isFirstWord)?": ":" "); + match = prefix + match + addAfter; + setText(match + postfix); + + setCursorPosition(match.length()); + + // save values for for the case a rematch is requested + m_beforeMatch = matchMe; + m_hasJustMatched = true; + m_prefix = prefix; + m_postfix = postfix; + } +} + +void SmartLineEdit::resetAutoCompletionStatus() +{ + m_beforeMatch = ""; + m_hasJustMatched = false; + m_prefix = ""; + m_postfix = ""; +} + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/SmartLineEdit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/SmartLineEdit.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,154 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief SmartLineEdit class definition + */ + +#ifndef HEDGEWARS_SMARTLINEEDIT_H +#define HEDGEWARS_SMARTLINEEDIT_H + +#include +#include +#include + +#include +#include + +#include + +#include "HistoryLineEdit.h" + +/** + * @brief {@link HistoryLineEdit} that features auto-completion with TAB key + * and clear with ESC key. + * + * Notes: + *
    + *
  • A Keyword can either be a command (if first word) or + * a nickname (completed regardless of position in text).
  • + *
+ * + * @author sheepluva + * @since 0.9.17 + */ +class SmartLineEdit : public HistoryLineEdit +{ + Q_OBJECT + +public: + /** + * @brief Class constructor. + * @param parent parent QWidget. + * @param maxHistorySize maximum amount of history entries kept. + */ + SmartLineEdit(QWidget * parent = 0, int maxHistorySize = 64); + + /** + * @brief Class destructor. + */ + ~SmartLineEdit(); + + /** + * @brief Adds commands to the auto-completion feature. + * @param commands list of commands to be added. + */ + void addCommands(const QStringList & commands); + + /** + * @brief Adds a single nickname to the auto-completion feature. + * @param nickname name to be added. + */ + void addNickname(const QString & nickname); + + /** + * @brief Removes commands from the auto-completion feature. + * @param commands list of commands to be removed. + */ + void removeCommands(const QStringList & commands); + + /** + * @brief Removes a single nickname from the auto-completion feature. + * @param nickname name to be removed. + */ + void removeNickname(const QString & nickname); + + /** + * @brief Forget all keywords and input history. + */ + void reset(); + + +protected: + /** + * @brief Overrides method of parent class. + * Forward pressed TAB to parent class' method (for focus handling etc) + * only if line is empty. + * + * @param event the event. + * @return returns true if the event was recognized. + */ + virtual bool event(QEvent * event); + + /** + * @brief Overrides method of parent class. + * Autocompletes if TAB is reported as pressed key in the key event, + * ESC leads to the contents being cleared. + * + * Other keys are forwarded to parent method. + * + * @param event the key event. + */ + virtual void keyPressEvent(QKeyEvent * event); + + +private: + QRegExp m_whitespace; ///< regexp that matches a whitespace + + QStringList * m_cmds; ///< list of recognized commands + QStringList * m_nicks; ///< list of recognized nicknames + + /// recognized nicknames, sorted case-insensitive + QMap * m_sorted_nicks; + + // these variables contain information about the last replacement + // they get reset whenever cursor is moved or text is changed + + QString m_beforeMatch; ///< the string that was just matched + bool m_hasJustMatched; ///< whether this widget just did an auto-completion + QString m_prefix; ///< prefix of the text replacement this widget just did + QString m_postfix; ///< postfix of the text replacement this widget just did + + /** + * @brief Autocompletes the contents based on the known commands and/or names. + */ + void autoComplete(); + + +private slots: + /** + * @brief Resets the information about the last match and text replacement. + */ + void resetAutoCompletionStatus(); +}; + + + +#endif // HEDGEWARS_SMARTLINEEDIT_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/SquareLabel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/SquareLabel.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,50 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include "SquareLabel.h" +#include "hwform.h" + +SquareLabel::SquareLabel(QWidget * parent) : + QWidget(parent) +{ + if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true); +} + +void SquareLabel::paintEvent(QPaintEvent * event) +{ + Q_UNUSED(event); + + QPainter painter(this); + int pixsize; + if (width() > height()) { + pixsize = height(); + painter.translate((width() - pixsize) / 2, 0); + } else { + pixsize = width(); + painter.translate(0, (height() - pixsize) / 2); + } + painter.drawPixmap(0, 0, pixsize, pixsize, pixmap.scaled(pixsize, pixsize, Qt::KeepAspectRatio)); +} + +void SquareLabel::setPixmap(const QPixmap & pixmap) +{ + this->pixmap = pixmap; + repaint(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/SquareLabel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/SquareLabel.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,41 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _SQUARELABEL_H +#define _SQUARELABEL_H + +#include +#include + +class SquareLabel : public QWidget +{ + Q_OBJECT + +public: + SquareLabel(QWidget * parent = 0); + + void setPixmap(const QPixmap & pixmap); +protected: + virtual void paintEvent(QPaintEvent * event); + +private: + QPixmap pixmap; + +}; + +#endif // _SQUARELABEL_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/about.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/about.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,174 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include "hwconsts.h" +#include "SDLInteraction.h" + +#include "about.h" + +About::About(QWidget * parent) : + QWidget(parent) +{ + QGridLayout *mainLayout = new QGridLayout(this); + + QLabel *imageLabel = new QLabel; + QImage image(":/res/Hedgehog.png"); + imageLabel->setPixmap(QPixmap::fromImage(image)); + imageLabel->setScaledContents(true); + imageLabel->setMinimumWidth(2.8); + imageLabel->setMaximumWidth(280); + imageLabel->setMinimumHeight(30); + imageLabel->setMaximumHeight(300); + + mainLayout->addWidget(imageLabel, 0, 0, 2, 1); + + QLabel *lbl1 = new QLabel(this); + lbl1->setOpenExternalLinks(true); + lbl1->setText( + "" + "

Hedgewars

" + "

" + QLabel::tr("Version") + " " + *cVersionString + "

" + "

http://www.hedgewars.org/


" + + QLabel::tr("This program is distributed under the GNU General Public License v2") + + "
" + ); + lbl1->setWordWrap(true); + mainLayout->addWidget(lbl1, 0, 1); + + lbl2 = new QTextBrowser(this); + + lbl2->setOpenExternalLinks(true); + lbl2->setText( + "" + + QString("

") + + QLabel::tr("Developers:") + + "

" + "Engine, frontend, net server: Andrey Korotaev <unC0Rr@gmail.com>
" + "Many frontend improvements: Igor Ulyanov <disinbox@gmail.com>
" + "Many engine and frontend improvements: Derek Pomery <nemo@m8y.org>
" + "Drill rocket, Ballgun, RC Plane weapons: Martin Boze <afffect@gmail.com>
" + "Mine number and time game settings: David A. Cuadrado <krawek@gmail.com>
" + "Frontend improvements: Martin Minarik <ttsmj@pokec.sk>
" + "Frontend improvements: Kristian Lehmann <email@thexception.net>
" + "Mac OS X/iPhone port, OpenGL-ES conversion: Vittorio Giovara <vittorio.giovara@gmail.com>
" + "Many engine and frontend improvements (and bugs): Richard Karolyi <sheepluva@" "ercatec.net>
" + "Gamepad and Lua integration: Mario Liebisch <mario.liebisch@gmail.com>
" + "Many engine improvements and graphics: Carlos Vives <mail@carlosvives.es>
" + "Maze maps: Henning Kühn <prg@cooco.de>
" + "Engine and frontend improvements: Henrik Rostedt <henrik.rostedt@gmail.com>
" + "Lua game modes and missions: John Lambert <redgrinner@gmail.com>
" + "Frontend improvements: Mayur Pawashe <zorgiepoo@gmail.com>
" + "Android port: Richard Deurwaarder <xeli@xelification.com>
" + "

" + + + QLabel::tr("Art:") + "

" + + QString::fromUtf8( + "

John Dum <fizzy@gmail.com>" + "
" + "Joshua Frese <joshfrese@gmail.com>" + "
" + "Stanko Tadić <stanko@mfhinc.net>" + "
" + "Julien Koesten <julienkoesten@aol.com>" + "
" + "Joshua O'Sullivan <coheedftw@hotmail.co.uk>" + "
" + "Nils Lück <nils.luck.design@gmail.com>" + "
" + "Guillaume Englert <genglert@hybird.org>" + "
" + "Hats: Trey Perry <tx.perry.j@gmail.com>" + "

") + + QLabel::tr("Sounds:") + "

" + "Hedgehogs voice: Stephen Alexander <ArmagonNo1@gmail.com>" + "
" + "John Dum <fizzy@gmail.com>" + "
" + "Jonatan Nilsson <jonatanfan@gmail.com>" + "
" + "Daniel Martin <elhombresinremedio@gmail.com>" + "

" + + + QLabel::tr("Translations:") + "

" + + QString::fromUtf8( + "Brazilian Portuguese: Romulo Fernandes Machado <abra185@gmail.com>
" + "Bulgarian: Svetoslav Stefanov
" + "Czech: Petr ŘezáÄek <rezacek@gmail.com>
" + "Chinese: Jie Luo <lililjlj@gmail.com>
" + "English: Andrey Korotaev <unC0Rr@gmail.com>
" + "Finnish: Nina Kuisma <ninnnu@gmail.com>
" + "French: Antoine Turmel <geekshadow@gmail.com>
" + "German: Peter Hüwe <PeterHuewe@gmx.de>, Mario Liebisch <mario.liebisch@gmail.com>, Richard Karolyi <sheepluva@" "ercatec.net>
" + "Greek: <talos_kriti@yahoo.gr>
" + "Italian: Luca Bonora <bonora.luca@gmail.com>, Marco Bresciani
" + "Japanese: ADAM Etienne <etienne.adam@gmail.com>
" + "Korean: Anthony Bellew <webmaster@anthonybellew.com>
" + "Lithuanian: Lukas Urbonas <lukasu08@gmail.com>
" + "Polish: Maciej Mroziński <mynick2@o2.pl>, Wojciech Latkowski <magik17l@gmail.com>, Piotr Mitana, Maciej Górny
" + "Portuguese: Fábio Canário <inufabie@gmail.com>
" + "Russian: Andrey Korotaev <unC0Rr@gmail.com>
" + "Slovak: Jose Riha
" + "Spanish: Carlos Vives <mail@carlosvives.es>
" + "Swedish: Niklas Grahn <raewolusjoon@yaoo.com>, Henrik Rostedt <henrik.rostedt@gmail.com>
" + "Ukrainian: Eugene V. Lyubimkin <jackyf.devel@gmail.com>, Igor Paliychuk <mansonigor@gmail.com>, Eugene Sakara <eresid@gmail.com>" + "

") + + + QLabel::tr("Special thanks:") + "

" + "Aleksey Andreev <blaknayabr@gmail.com>
" + "Aleksander Rudalev <alexv@pomorsu.ru>
" + "Natasha Korotaeva <layout@pisem.net>
" + "Adam Higerd (aka ahigerd at FreeNode)" + "

" + ); + mainLayout->addWidget(lbl2, 1, 1); + + setAcceptDrops(true); +} + +void About::dragEnterEvent(QDragEnterEvent * event) +{ + if (event->mimeData()->hasUrls()) + { + QList urls = event->mimeData()->urls(); + QString url = urls[0].toString(); + if (urls.count() == 1) + if (url.contains(QRegExp("^file://.*\\.ogg$"))) + event->acceptProposedAction(); + } +} + +void About::dropEvent(QDropEvent * event) +{ + QString file = + event->mimeData()->urls()[0].toString().remove(QRegExp("^file://")); + + SDLInteraction::instance().setMusicTrack(file); + + event->acceptProposedAction(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/about.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/about.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,42 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _ABOUT_H +#define _ABOUT_H + +#include +#include +#include + + +class About : public QWidget +{ + Q_OBJECT + +public: + About(QWidget * parent = 0); + +protected: + virtual void dragEnterEvent(QDragEnterEvent * event); + virtual void dropEvent(QDropEvent * event); + +private: + QTextBrowser * lbl2; +}; + +#endif // _ABOUT_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/bgwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/bgwidget.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,143 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2009 Kristian Lehmann + * Copyright (c) 2009-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "bgwidget.h" + +SpritePosition::SpritePosition(QWidget * parent, int sh) +{ + wParent = parent; + iSpriteHeight = sh; + reset(); +} + +SpritePosition::~SpritePosition() +{ +} + +void SpritePosition::move() +{ + fX += fXMov; + fY += fYMov; + iAngle += 4; + if (iAngle >= 360) iAngle = 0; + if (fY > wParent->height()) reset(); +} + +void SpritePosition::reset() +{ + fY = -1 * iSpriteHeight; + fX = (qrand() % ((int)(wParent->width() * 1.5))) - wParent->width()/2; + fYMov = ((qrand() % 400)+300) / 100.0f; + fXMov = fYMov * 0.2f+((qrand()%100)/100.0f * 0.6f); //so between 0.2 and 0.6, or 0.5 +/- 0.3 + iAngle = qrand() % 360; +} + +QPoint SpritePosition::pos() +{ + return QPoint((int)fX,(int)fY); +} + +int SpritePosition::getAngle() +{ + return iAngle; +} + +void SpritePosition::init() +{ + fY = qrand() % (wParent->height() + 1); + fX = qrand() % (wParent->width() + 1); +} + +BGWidget::BGWidget(QWidget * parent) : QWidget(parent) +{ + setAttribute(Qt::WA_NoSystemBackground, true); + sprite.load(":/res/Star.png"); + + setAutoFillBackground(false); + + for (int i = 0; i < SPRITE_MAX; i++) spritePositions[i] = new SpritePosition(this, sprite.height()); + + for (int i = 0; i < 360; i++) + { + rotatedSprites[i] = new QImage(sprite.width(), sprite.height(), QImage::Format_ARGB32); + rotatedSprites[i]->fill(0); + + QPoint translate(sprite.width()/2, sprite.height()/2); + + QPainter p; + p.begin(rotatedSprites[i]); + // p.setRenderHint(QPainter::Antialiasing); + p.setRenderHint(QPainter::SmoothPixmapTransform); + p.translate(translate.x(), translate.y()); + p.rotate(i); + p.translate(-1*translate.x(), -1*translate.y()); + p.drawImage(0, 0, sprite); + } + + timerAnimation = new QTimer(); + connect(timerAnimation, SIGNAL(timeout()), this, SLOT(animate())); + timerAnimation->setInterval(ANIMATION_INTERVAL); +} + +BGWidget::~BGWidget() +{ + for (int i = 0; i < SPRITE_MAX; i++) delete spritePositions[i]; + for (int i = 0; i < 360; i++) delete rotatedSprites[i]; + delete timerAnimation; +} + +void BGWidget::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + + QPainter p; + p.begin(this); + //p.setRenderHint(QPainter::Antialiasing); + for (int i = 0; i < SPRITE_MAX; i++) + { + QPoint point = spritePositions[i]->pos(); + p.drawImage(point.x(), point.y(), *rotatedSprites[spritePositions[i]->getAngle()]); + } + p.end(); +} + +void BGWidget::animate() +{ + for (int i = 0; i < SPRITE_MAX; i++) + { + // bottom edge of star *seems* clipped, but in fact, if I switch to just plain old repaint()/update() it is still clipped - artifact of transform? As for 5, is arbitrary number. 4 was noticeably clipping, 5 seemed same as update() - I assume extra room is due to rotation and value really should be calculated proportional to width/height + update(spritePositions[i]->pos().x(),spritePositions[i]->pos().y(), sprite.width()+5, sprite.height()+5); + spritePositions[i]->move(); + } +} + +void BGWidget::startAnimation() +{ + timerAnimation->start(); +} + +void BGWidget::stopAnimation() +{ + timerAnimation->stop(); +} + +void BGWidget::init() +{ + for (int i = 0; i < SPRITE_MAX; i++) spritePositions[i]->init(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/bgwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/bgwidget.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,76 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2009 Kristian Lehmann + * Copyright (c) 2009-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef BGWIDGET_H +#define BGWIDGET_H + +#include +//#include +#include +#include +#include +#include +#include + +#define SPRITE_MAX 12 + +#define ANIMATION_INTERVAL 40 + +class SpritePosition +{ +public: + SpritePosition(QWidget * parent, int sh); + ~SpritePosition(); +private: + float fX; + float fY; + float fXMov; + float fYMov; + int iAngle; + QWidget * wParent; + int iSpriteHeight; +public: + void move(); + void reset(); + QPoint pos(); + int getAngle(); + void init(); +}; + +class BGWidget : public QWidget +{ + Q_OBJECT +public: + BGWidget(QWidget * parent); + ~BGWidget(); + void startAnimation(); + void stopAnimation(); + void init(); +private: + QImage sprite; + QTimer * timerAnimation; + SpritePosition * spritePositions[SPRITE_MAX]; + QImage * rotatedSprites[360]; +protected: + void paintEvent(QPaintEvent * event); +private slots: + void animate(); +}; + +#endif // BGWIDGET_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/chatwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/chatwidget.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,973 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "HWDataManager.h" +#include "hwconsts.h" +#include "gameuiconfig.h" + +#include "chatwidget.h" + +ListWidgetNickItem::ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored) : QListWidgetItem(nick) +{ + this->aFriend = isFriend; + this->isIgnored = isIgnored; +} + +void ListWidgetNickItem::setFriend(bool isFriend) +{ + this->aFriend = isFriend; +} + +void ListWidgetNickItem::setIgnored(bool isIgnored) +{ + this->isIgnored = isIgnored; +} + +bool ListWidgetNickItem::isFriend() +{ + return aFriend; +} + +bool ListWidgetNickItem::ignored() +{ + return isIgnored; +} + +bool ListWidgetNickItem::operator< (const QListWidgetItem & other) const +{ + // case in-sensitive comparison of the associated strings + // chars that are no letters are sorted at the end of the list + + ListWidgetNickItem otherNick = const_cast(dynamic_cast(other)); + + // ignored always down + if (isIgnored != otherNick.ignored()) + return !isIgnored; + + // friends always up + if (aFriend != otherNick.isFriend()) + return aFriend; + + QString txt1 = text().toLower(); + QString txt2 = other.text().toLower(); + + bool firstIsShorter = (txt1.size() < txt2.size()); + int len = firstIsShorter?txt1.size():txt2.size(); + + for (int i = 0; i < len; i++) + { + if (txt1[i] == txt2[i]) + continue; + if (txt1[i].isLetter() != txt2[i].isLetter()) + return txt1[i].isLetter(); + return (txt1[i] < txt2[i]); + } + + return firstIsShorter; +} + +QString * HWChatWidget::s_styleSheet = NULL; +QStringList * HWChatWidget::s_displayNone = NULL; +bool HWChatWidget::s_isTimeStamped = true; + +const QString & HWChatWidget::styleSheet() +{ + if (s_styleSheet != NULL) + return *s_styleSheet; + + setStyleSheet(); + + return *s_styleSheet; +} + +void HWChatWidget::setStyleSheet(const QString & styleSheet) +{ + QString orgStyleSheet = styleSheet; + QString style = QString(orgStyleSheet); + + // no stylesheet supplied, search for one or use default + if (orgStyleSheet.isEmpty()) + { + // load external stylesheet if there is any + QFile extFile(HWDataManager::instance().findFileForRead("css/chat.css")); + + QFile resFile(":/res/css/chat.css"); + + QFile & file = (extFile.exists()?extFile:resFile); + + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + QTextStream in(&file); + while (!in.atEnd()) + { + style.append(in.readLine()+"\n"); + } + orgStyleSheet = style; + + file.close(); + } + } + + // let's parse display:none; ... + + // prepare for MAGIC :D + + // matches (multi-)whitespaces (for replacement with simple space) + QRegExp ws("\\s+"); + + // matches comments (for removal) + QRegExp rem("/\\*([^*]|\\*(?!/))*\\*/"); + + // strip comments and multi-whitespaces to compress the style-sheet a bit + style = style.remove(rem).replace(ws," "); + + + // now let's see what messages the user does not want to be displayed + // by checking for display:none; (since QTextBrowser does not support it) + + // MOAR MAGIC :DDD + + // matches definitions lacking display:none; (for removal) + QRegExp displayed( + "([^{}]*\\{)(?!([^}]*;)* ?display ?: ?none ?(;[^}]*)?\\})[^}]*\\}"); + + // matches all {...} and , (used as seperator for splitting into names) + QRegExp split(" *(\\{[^}]*\\}|,) *"); + + // matches class names that are referenced without hierachy + QRegExp nohierarchy("^.[^ .]+$"); + + QStringList victims = QString(style). + remove(displayed). // remove visible stuff + split(split). // get a list of the names + filter(nohierarchy). // only direct class names + replaceInStrings(QRegExp("^."),""); // crop . + + + if (victims.contains("timestamp")) + { + s_isTimeStamped = false; + victims.removeAll("timestamp"); + } + + victims.removeDuplicates(); + + QStringList * oldDisplayNone = s_displayNone; + QString * oldStyleSheet = s_styleSheet; + + s_displayNone = new QStringList(victims); + s_styleSheet = new QString(orgStyleSheet); + + if (oldDisplayNone != NULL) + delete oldDisplayNone; + + if (oldStyleSheet != NULL) + delete oldStyleSheet; + +} + +void HWChatWidget::displayError(const QString & message) +{ + addLine("msg_Error", " !!! " + message); + // scroll to the end + chatText->moveCursor(QTextCursor::End); +} + + +void HWChatWidget::displayNotice(const QString & message) +{ + addLine("msg_Notice", " *** " + message); + // scroll to the end + chatText->moveCursor(QTextCursor::End); +} + + +void HWChatWidget::displayWarning(const QString & message) +{ + addLine("msg_Warning", " *!* " + message); + // scroll to the end + chatText->moveCursor(QTextCursor::End); +} + + +HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, bool notify) : + QWidget(parent), + mainLayout(this) +{ + this->gameSettings = gameSettings; + this->notify = notify; + if(gameSettings->value("frontend/sound", true).toBool()) + { + if (notify) + m_helloSound = HWDataManager::instance().findFileForRead( + "Sounds/voices/Classic/Hello.ogg"); + m_hilightSound = HWDataManager::instance().findFileForRead( + "Sounds/1C.ogg"); + } + + mainLayout.setSpacing(1); + mainLayout.setMargin(1); + mainLayout.setSizeConstraint(QLayout::SetMinimumSize); + mainLayout.setColumnStretch(0, 76); + mainLayout.setColumnStretch(1, 24); + + chatEditLine = new SmartLineEdit(this); + chatEditLine->setMaxLength(300); + connect(chatEditLine, SIGNAL(returnPressed()), this, SLOT(returnPressed())); + + mainLayout.addWidget(chatEditLine, 2, 0); + + chatText = new QTextBrowser(this); + + chatText->document()->setDefaultStyleSheet(styleSheet()); + + chatText->setMinimumHeight(20); + chatText->setMinimumWidth(10); + chatText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + chatText->setOpenLinks(false); + connect(chatText, SIGNAL(anchorClicked(const QUrl&)), + this, SLOT(linkClicked(const QUrl&))); + mainLayout.addWidget(chatText, 0, 0, 2, 1); + + chatNicks = new QListWidget(this); + chatNicks->setMinimumHeight(10); + chatNicks->setMinimumWidth(10); + chatNicks->setSortingEnabled(true); + chatNicks->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + chatNicks->setContextMenuPolicy(Qt::ActionsContextMenu); + connect(chatNicks, SIGNAL(itemDoubleClicked(QListWidgetItem *)), + this, SLOT(chatNickDoubleClicked(QListWidgetItem *))); + connect(chatNicks, SIGNAL(currentRowChanged(int)), + this, SLOT(chatNickSelected(int))); + + mainLayout.addWidget(chatNicks, 0, 1, 3, 1); + + // the userData is used to flag things that are even available when user + // is offline + acInfo = new QAction(QAction::tr("Info"), chatNicks); + acInfo->setIcon(QIcon(":/res/info.png")); + acInfo->setData(QVariant(false)); + connect(acInfo, SIGNAL(triggered(bool)), this, SLOT(onInfo())); + acKick = new QAction(QAction::tr("Kick"), chatNicks); + acKick->setIcon(QIcon(":/res/kick.png")); + acKick->setData(QVariant(false)); + connect(acKick, SIGNAL(triggered(bool)), this, SLOT(onKick())); + acBan = new QAction(QAction::tr("Ban"), chatNicks); + acBan->setIcon(QIcon(":/res/ban.png")); + acBan->setData(QVariant(true)); + connect(acBan, SIGNAL(triggered(bool)), this, SLOT(onBan())); + acFollow = new QAction(QAction::tr("Follow"), chatNicks); + acFollow->setIcon(QIcon(":/res/follow.png")); + acFollow->setData(QVariant(false)); + connect(acFollow, SIGNAL(triggered(bool)), this, SLOT(onFollow())); + acIgnore = new QAction(QAction::tr("Ignore"), chatNicks); + acIgnore->setIcon(QIcon(":/res/ignore.png")); + acIgnore->setData(QVariant(true)); + connect(acIgnore, SIGNAL(triggered(bool)), this, SLOT(onIgnore())); + acFriend = new QAction(QAction::tr("Add friend"), chatNicks); + acFriend->setIcon(QIcon(":/res/addfriend.png")); + acFriend->setData(QVariant(true)); + connect(acFriend, SIGNAL(triggered(bool)), this, SLOT(onFriend())); + + chatNicks->insertAction(0, acFriend); + chatNicks->insertAction(0, acInfo); + chatNicks->insertAction(0, acIgnore); + + showReady = false; + setShowFollow(true); + + setAcceptDrops(true); + clear(); +} + + +void HWChatWidget::linkClicked(const QUrl & link) +{ + if (link.scheme() == "http") + QDesktopServices::openUrl(link); + if (link.scheme() == "hwnick") + { + // decode nick + QString nick = QString::fromUtf8(QByteArray::fromBase64(link.encodedQuery())); + QList items = chatNicks->findItems(nick, Qt::MatchExactly); + + bool isOffline = (items.size() < 1); + + QMenu * popup = new QMenu(this); + + if (isOffline) + { + m_clickedNick = nick; + chatNickSelected(0); // update friend and ignore entry + chatNicks->setCurrentItem(NULL, QItemSelectionModel::Clear); + } + else + { + // selecting an item will automatically scroll there, so let's save old position + QScrollBar * scrollBar = chatNicks->verticalScrollBar(); + int oldScrollPos = scrollBar->sliderPosition(); + // select the nick which we want to see the actions for + chatNicks->setCurrentItem(items[0], QItemSelectionModel::Clear); + // selecting an item will automatically scroll there, so let's save old position + scrollBar->setSliderPosition(oldScrollPos); + } + + // load actions + QList actions = chatNicks->actions(); + + foreach(QAction * action, actions) + { + if ((!isOffline) || (action->data().toBool())) + popup->addAction(action); + } + + // display menu popup at mouse cursor position + popup->popup(QCursor::pos()); + } +} + +void HWChatWidget::setShowFollow(bool enabled) +{ + if (enabled) { + if (!(chatNicks->actions().contains(acFollow))) + chatNicks->insertAction(acFriend, acFollow); + } + else { + if (chatNicks->actions().contains(acFollow)) + chatNicks->removeAction(acFollow); + } +} + +void HWChatWidget::loadList(QStringList & list, const QString & file) +{ + list.clear(); + QFile txt(cfgdir->absolutePath() + "/" + file); + if(!txt.open(QIODevice::ReadOnly)) + return; + QTextStream stream(&txt); + stream.setCodec("UTF-8"); + + while(!stream.atEnd()) + { + QString str = stream.readLine(); + if(str.startsWith(";") || str.length() == 0) + continue; + list << str.trimmed(); + } + //readd once we require newer Qt than 4.4 + //list.removeDuplicates(); + txt.close(); +} + +void HWChatWidget::saveList(QStringList & list, const QString & file) +{ + QFile txt(cfgdir->absolutePath() + "/" + file); + + // list empty? => rather have no file for the list than an empty one + if (list.isEmpty()) + { + if (txt.exists()) + { + // try to remove file, if successful we're done here. + if (txt.remove()) + return; + } + else + // there is no file + return; + } + + if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate)) + return; + QTextStream stream(&txt); + stream.setCodec("UTF-8"); + + stream << "; this list is used by Hedgewars - do not edit it unless you know what you're doing!" << endl; + for(int i = 0; i < list.size(); i++) + stream << list[i] << endl; + txt.close(); +} + +void HWChatWidget::updateNickItem(QListWidgetItem *nickItem) +{ + QString nick = nickItem->text(); + ListWidgetNickItem * item = dynamic_cast(nickItem); + + item->setFriend(friendsList.contains(nick, Qt::CaseInsensitive)); + item->setIgnored(ignoreList.contains(nick, Qt::CaseInsensitive)); + + if(item->ignored()) + { + item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_ignore_on.png" : ":/res/chat_ignore_off.png") : ":/res/chat_ignore.png")); + item->setForeground(Qt::gray); + } + else if(item->isFriend()) + { + item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_friend_on.png" : ":/res/chat_friend_off.png") : ":/res/chat_friend.png")); + item->setForeground(Qt::green); + } + else + { + item->setIcon(QIcon(showReady ? (item->data(Qt::UserRole).toBool() ? ":/res/chat_default_on.png" : ":/res/chat_default_off.png") : ":/res/chat_default.png")); + item->setForeground(QBrush(QColor(0xff, 0xcc, 0x00))); + } +} + +void HWChatWidget::updateNickItems() +{ + for(int i = 0; i < chatNicks->count(); i++) + updateNickItem(chatNicks->item(i)); + + chatNicks->sortItems(); +} + +void HWChatWidget::loadLists(const QString & nick) +{ + loadList(ignoreList, nick.toLower() + "_ignore.txt"); + loadList(friendsList, nick.toLower() + "_friends.txt"); + updateNickItems(); +} + +void HWChatWidget::saveLists(const QString & nick) +{ + saveList(ignoreList, nick.toLower() + "_ignore.txt"); + saveList(friendsList, nick.toLower() + "_friends.txt"); +} + +void HWChatWidget::returnPressed() +{ + QStringList lines = chatEditLine->text().split('\n'); + chatEditLine->rememberCurrentText(); + foreach (const QString &line, lines) + { + if (!parseCommand(line)) + emit chatLine(line); + } + chatEditLine->clear(); +} + +// "link" nick, but before that encode it in base64 to make sure it can't +// intefere with html/url syntax the nick is put as querystring as putting +// it as host would convert it to it's lower case variant +QString HWChatWidget::linkedNick(const QString & nickName) +{ + if (nickName != m_userNick) + return QString("%2").arg( + QString(nickName.toUtf8().toBase64())).arg(nickName); + else + return QString("%1").arg(nickName); +} + + +void HWChatWidget::onChatString(const QString& str) +{ + onChatString("", str); +} + +const QRegExp HWChatWidget::URLREGEXP = QRegExp("(http://)?(www\\.)?(hedgewars\\.org(/[^ ]*)?)"); + +void HWChatWidget::onChatString(const QString& nick, const QString& str) +{ + bool isFriend = false; + + if (!nick.isEmpty()) { + // don't show chat lines that are from ignored nicks + if (ignoreList.contains(nick, Qt::CaseInsensitive)) + return; + // friends will get special treatment, of course + isFriend = friendsList.contains(nick, Qt::CaseInsensitive); + } + + QString formattedStr = Qt::escape(str.mid(1)); + // make hedgewars.org urls actual links + formattedStr = formattedStr.replace(URLREGEXP, "\\3"); + + // link the nick + if(!nick.isEmpty()) + formattedStr.replace("|nick|", linkedNick(nick)); + + QString cssClass("msg_UserChat"); + + // check first character for color code and set color properly + char c = str[0].toAscii(); + switch (c) + { + case 3: + cssClass = (isFriend ? "msg_FriendJoin" : "msg_UserJoin"); + break; + case 2: + cssClass = (isFriend ? "msg_FriendAction" : "msg_UserAction"); + break; + default: + if (isFriend) + cssClass = "msg_FriendChat"; + } + + bool isHL = false; + + if ((!nick.isEmpty()) && (nick != m_userNick)) + { + QString lcStr = str.toLower(); + + foreach (const QRegExp & hl, m_highlights) + { + if (lcStr.contains(hl)) + { + isHL = true; + break; + } + } + } + + addLine(cssClass, formattedStr, isHL); +} + +void HWChatWidget::addLine(const QString & cssClass, QString line, bool isHighlight) +{ + if (s_displayNone->contains(cssClass)) + return; // the css forbids us to display this line + + if (chatStrings.size() > 250) + chatStrings.removeFirst(); + + if (s_isTimeStamped) + { + QString tsMarkUp = "[%1] "; + QTime now = QDateTime::currentDateTime().time(); + line = tsMarkUp.arg(now.toString(":mm:ss")) + line; + } + + line = QString("%2").arg(cssClass).arg(line); + + if (isHighlight) + { + line = QString("%1").arg(line); + SDLInteraction::instance().playSoundFile(m_hilightSound); + } + + chatStrings.append(line); + + chatText->setHtml(""+chatStrings.join("
")+""); + + chatText->moveCursor(QTextCursor::End); +} + +void HWChatWidget::onServerMessage(const QString& str) +{ + if (chatStrings.size() > 250) + chatStrings.removeFirst(); + + chatStrings.append("
" + str + "
"); + + chatText->setHtml(""+chatStrings.join("
")+""); + + chatText->moveCursor(QTextCursor::End); +} + +void HWChatWidget::nickAdded(const QString & nick, bool notifyNick) +{ + bool isIgnored = ignoreList.contains(nick, Qt::CaseInsensitive); + QListWidgetItem * item = new ListWidgetNickItem(nick, friendsList.contains(nick, Qt::CaseInsensitive), isIgnored); + updateNickItem(item); + chatNicks->addItem(item); + + if ((!isIgnored) && (nick != m_userNick)) // don't auto-complete own name + chatEditLine->addNickname(nick); + + emit nickCountUpdate(chatNicks->count()); + + if(notifyNick && notify && gameSettings->value("frontend/sound", true).toBool()) { + SDLInteraction::instance().playSoundFile(m_helloSound); + } +} + +void HWChatWidget::nickRemoved(const QString& nick) +{ + chatEditLine->removeNickname(nick); + + foreach(QListWidgetItem * item, chatNicks->findItems(nick, Qt::MatchExactly)) + chatNicks->takeItem(chatNicks->row(item)); + + emit nickCountUpdate(chatNicks->count()); +} + +void HWChatWidget::clear() +{ + chatEditLine->reset(); + + // add default commands + QStringList cmds; + cmds << "/me" << "/discardStyleSheet" << "/saveStyleSheet"; + chatEditLine->addCommands(cmds); + + chatText->clear(); + chatStrings.clear(); + chatNicks->clear(); + m_userNick = gameSettings->value("net/nick","").toString(); + + // clear and re compile regexp for highlighting + m_highlights.clear(); + + QString hlRegExp("^(.* )?%1[^-a-z0-9_]*( .*)?$"); + QRegExp whitespace("\\s"); + + m_highlights.append(QRegExp(hlRegExp.arg(m_userNick))); + + QFile file(cfgdir->absolutePath() + "/" + m_userNick + "_highlight.txt"); + + if (file.exists() && (file.open(QIODevice::ReadOnly | QIODevice::Text))) + { + QTextStream in(&file); + while (!in.atEnd()) + { + QString line = in.readLine(); + QStringList list = line.split(whitespace); + foreach (QString word, list) + { + m_highlights.append(QRegExp( + hlRegExp.arg(QRegExp::escape(word.toLower())))); + } + } + + if (file.isOpen()) + file.close(); + } + + QFile file2(cfgdir->absolutePath() + "/" + m_userNick + "_hlregexp.txt"); + + if (file2.exists() && (file2.open(QIODevice::ReadOnly | QIODevice::Text))) + { + QTextStream in(&file2); + while (!in.atEnd()) + { + m_highlights.append(QRegExp(in.readLine().toLower())); + } + + if (file2.isOpen()) + file2.close(); + } +} + +void HWChatWidget::onKick() +{ + QListWidgetItem * curritem = chatNicks->currentItem(); + if (curritem) + emit kick(curritem->text()); +} + +void HWChatWidget::onBan() +{ + QListWidgetItem * curritem = chatNicks->currentItem(); + if (curritem) + emit ban(curritem->text()); +} + +void HWChatWidget::onInfo() +{ + QListWidgetItem * curritem = chatNicks->currentItem(); + if (curritem) + emit info(curritem->text()); +} + +void HWChatWidget::onFollow() +{ + QListWidgetItem * curritem = chatNicks->currentItem(); + if (curritem) + emit follow(curritem->text()); +} + +void HWChatWidget::onIgnore() +{ + QListWidgetItem * curritem = chatNicks->currentItem(); + QString nick = ""; + if(curritem != NULL) + nick = curritem->text(); + else + nick = m_clickedNick; + + if(ignoreList.contains(nick, Qt::CaseInsensitive)) // already on list - remove him + { + ignoreList.removeAll(nick.toLower()); + chatEditLine->addNickname(nick); + displayNotice(tr("%1 has been removed from your ignore list").arg(linkedNick(nick))); + } + else // not on list - add + { + // don't consider ignored people friends + if(friendsList.contains(nick, Qt::CaseInsensitive)) + emit onFriend(); + + // scroll down on first ignore added so that people see where that nick went to + if (ignoreList.isEmpty()) + chatNicks->scrollToBottom(); + + ignoreList << nick.toLower(); + chatEditLine->removeNickname(nick); + displayNotice(tr("%1 has been added to your ignore list").arg(linkedNick(nick))); + } + + if(curritem != NULL) + { + updateNickItem(curritem); // update icon/sort order/etc + chatNicks->sortItems(); + chatNickSelected(0); // update context menu + } +} + +void HWChatWidget::onFriend() +{ + QListWidgetItem * curritem = chatNicks->currentItem(); + QString nick = ""; + if(curritem != NULL) + nick = curritem->text(); + else + nick = m_clickedNick; + + if(friendsList.contains(nick, Qt::CaseInsensitive)) // already on list - remove him + { + friendsList.removeAll(nick.toLower()); + displayNotice(tr("%1 has been removed from your friends list").arg(linkedNick(nick))); + } + else // not on list - add + { + // don't ignore the new friend + if(ignoreList.contains(nick, Qt::CaseInsensitive)) + emit onIgnore(); + + // scroll up on first friend added so that people see where that nick went to + if (friendsList.isEmpty()) + chatNicks->scrollToTop(); + + friendsList << nick.toLower(); + displayNotice(tr("%1 has been added to your friends list").arg(linkedNick(nick))); + } + + if(curritem != NULL) + { + updateNickItem(curritem); // update icon/sort order/etc + chatNicks->sortItems(); + chatNickSelected(0); // update context menu + } +} + +void HWChatWidget::chatNickDoubleClicked(QListWidgetItem * item) +{ + if (item != NULL) + m_clickedNick = item->text(); + else + m_clickedNick = ""; + QList actions = chatNicks->actions(); + actions.first()->activate(QAction::Trigger); +} + +void HWChatWidget::chatNickSelected(int index) +{ + Q_UNUSED(index); + + QListWidgetItem* item = chatNicks->currentItem(); + QString nick = ""; + if (item != NULL) + nick = item->text(); + else + nick = m_clickedNick; + + // update context menu labels according to possible action + if(ignoreList.contains(nick, Qt::CaseInsensitive)) + { + acIgnore->setText(QAction::tr("Unignore")); + acIgnore->setIcon(QIcon(":/res/unignore.png")); + } + else + { + acIgnore->setText(QAction::tr("Ignore")); + acIgnore->setIcon(QIcon(":/res/ignore.png")); + } + + if(friendsList.contains(nick, Qt::CaseInsensitive)) + { + acFriend->setText(QAction::tr("Remove friend")); + acFriend->setIcon(QIcon(":/res/remfriend.png")); + } + else + { + acFriend->setText(QAction::tr("Add friend")); + acFriend->setIcon(QIcon(":/res/addfriend.png")); + } +} + +void HWChatWidget::setShowReady(bool s) +{ + showReady = s; +} + +void HWChatWidget::setReadyStatus(const QString & nick, bool isReady) +{ + QList items = chatNicks->findItems(nick, Qt::MatchExactly); + if (items.size() != 1) + { + qWarning("Bug: cannot find user in chat"); + return; + } + + items[0]->setData(Qt::UserRole, isReady); // bulb status + updateNickItem(items[0]); + + // ensure we're still showing the status bulbs + showReady = true; +} + +void HWChatWidget::adminAccess(bool b) +{ + chatNicks->removeAction(acKick); + chatNicks->removeAction(acBan); + + if(b) + { + chatNicks->insertAction(0, acKick); +// chatNicks->insertAction(0, acBan); + } +} + +void HWChatWidget::dragEnterEvent(QDragEnterEvent * event) +{ + if (event->mimeData()->hasUrls()) + { + QList urls = event->mimeData()->urls(); + if (urls.count() == 1) + { + QUrl url = urls[0]; + + static QRegExp localFileRegExp("file://.*\\.css$"); + localFileRegExp.setCaseSensitivity(Qt::CaseInsensitive); + + if (url.toString().contains(localFileRegExp)) + event->acceptProposedAction(); + } + } +} + +void HWChatWidget::dropEvent(QDropEvent * event) +{ + const QString path(event->mimeData()->urls()[0].toString()); + + QFile file(event->mimeData()->urls()[0].toLocalFile()); + + if (file.exists() && (file.open(QIODevice::ReadOnly | QIODevice::Text))) + { + QString style; + QTextStream in(&file); + while (!in.atEnd()) + { + QString line = in.readLine(); + style.append(line + "\n"); + } + + setStyleSheet(style); + chatText->document()->setDefaultStyleSheet(*s_styleSheet); + displayNotice(tr("Stylesheet imported from %1").arg(path)); + displayNotice(tr("Enter %1 if you want to use the current styleSheet in future, enter %2 to reset!").arg("/saveStyleSheet").arg("/discardStyleSheet")); + + if (file.isOpen()) + file.close(); + + event->acceptProposedAction(); + } + else + displayError(tr("Couldn't read %1").arg(event->mimeData()->urls()[0].toString())); +} + + +void HWChatWidget::discardStyleSheet() +{ + setStyleSheet(); + chatText->document()->setDefaultStyleSheet(*s_styleSheet); + displayNotice(tr("StyleSheet discarded")); +} + + +void HWChatWidget::saveStyleSheet() +{ + QString dest = + HWDataManager::instance().findFileForWrite("css/chat.css"); + + QFile file(dest); + if (file.open(QIODevice::WriteOnly | QIODevice::Text)) + { + QTextStream out(&file); + QStringList lines = s_styleSheet->split("\n", QString::KeepEmptyParts); + + // strip trailing empty lines + while (lines.last().isEmpty()) + lines.takeLast(); + + foreach (const QString & line, lines) + { + out << line << endl; + } + out << endl; + file.close(); + displayNotice(tr("StyleSheet saved to %1").arg(dest)); + } + else + displayError(tr("Failed to save StyleSheet to %1").arg(dest)); +} + + +bool HWChatWidget::parseCommand(const QString & line) +{ + if (line[0] == '/') + { + QString tline = line.trimmed(); + if (tline.startsWith("/me")) + return false; // not a real command + + else if (tline == "/discardStyleSheet") + discardStyleSheet(); + else if (tline == "/saveStyleSheet") + saveStyleSheet(); + else + { + static QRegExp post("\\s.*$"); + tline.remove(post); + displayWarning(tr("%1 is not a valid command!").arg(tline)); + } + + return true; + } + + return false; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/chatwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/chatwidget.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,156 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _CHAT_WIDGET_INCLUDED +#define _CHAT_WIDGET_INCLUDED + +#include +#include +#include +#include +#include +#include + +#include "SDLInteraction.h" + +#include "SmartLineEdit.h" + +class ListWidgetNickItem; +class QTextBrowser; +class QLineEdit; +class QListWidget; +class QSettings; + +/// Class for custom nickname sorting +class ListWidgetNickItem : public QListWidgetItem +{ +public: + ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored); + bool operator<(const QListWidgetItem & other) const; + void setFriend(bool isFriend); + void setIgnored(bool isIgnored); + bool isFriend(); + bool ignored(); + +private: + bool aFriend; + bool isIgnored; +}; + + +/** + * @brief Chat widget. + * + * By default uses :res/css/chat.css as style sheet for chat. + * See \repo{res/css/chat.css} for a more detailed description. + * + * @see http://doc.qt.nokia.com/4.5/richtext-html-subset.html#css-properties + */ + +class HWChatWidget : public QWidget +{ + Q_OBJECT + + public: + HWChatWidget(QWidget* parent, QSettings * gameSettings, bool notify); + void loadLists(const QString & nick); + void saveLists(const QString & nick); + void setShowReady(bool s); + void setShowFollow(bool enabled); + QStringList ignoreList, friendsList; + static const QString & styleSheet(); + void displayError(const QString & message); + void displayNotice(const QString & message); + void displayWarning(const QString & message); + +protected: + virtual void dragEnterEvent(QDragEnterEvent * event); + virtual void dropEvent(QDropEvent * event); + +private: + static QString * s_styleSheet; + static QStringList * s_displayNone; + static bool s_isTimeStamped; + static const QRegExp URLREGEXP; + + static void setStyleSheet(const QString & styleSheet = ""); + + void loadList(QStringList & list, const QString & file); + void saveList(QStringList & list, const QString & file); + void updateNickItem(QListWidgetItem *item); + void updateNickItems(); + void addLine(const QString & cssClass, QString line, bool isHighlight = false); + bool parseCommand(const QString & line); + void discardStyleSheet(); + void saveStyleSheet(); + QString linkedNick(const QString & nickName); + + public slots: + void onChatString(const QString& str); + void onChatString(const QString& nick, const QString& str); + void onServerMessage(const QString& str); + void nickAdded(const QString& nick, bool notifyNick); + void nickRemoved(const QString& nick); + void clear(); + void setReadyStatus(const QString & nick, bool isReady); + void adminAccess(bool); + + signals: + void chatLine(const QString& str); + void kick(const QString & str); + void ban(const QString & str); + void info(const QString & str); + void follow(const QString &); + void nickCountUpdate(int cnt); + + private: + QGridLayout mainLayout; + QTextBrowser* chatText; + QStringList chatStrings; + QListWidget* chatNicks; + SmartLineEdit* chatEditLine; + QAction * acInfo; + QAction * acKick; + QAction * acBan; + QAction * acFollow; + QAction * acIgnore; + QAction * acFriend; + QSettings * gameSettings; + QString m_helloSound; + QString m_hilightSound; + QString m_userNick; + QString m_clickedNick; + QList m_highlights; ///< regular expressions used for highlighting + bool notify; + bool showReady; + + private slots: + void returnPressed(); + void onBan(); + void onKick(); + void onInfo(); + void onFollow(); + void onIgnore(); + void onFriend(); + void chatNickDoubleClicked(QListWidgetItem * item); + void chatNickSelected(int index); + void linkClicked(const QUrl & link); +}; + +#endif // _CHAT_WIDGET_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/databrowser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/databrowser.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,57 @@ +#include +#include +#include +#include +#include + +#include "databrowser.h" + +const QNetworkRequest::Attribute typeAttribute = (QNetworkRequest::Attribute)(QNetworkRequest::User + 1); +const QNetworkRequest::Attribute urlAttribute = (QNetworkRequest::Attribute)(QNetworkRequest::User + 2); + +DataBrowser::DataBrowser(QWidget *parent) : + QTextBrowser(parent) +{ + + manager = new QNetworkAccessManager(this); +} + +QVariant DataBrowser::loadResource(int type, const QUrl & name) +{ + if(type == QTextDocument::ImageResource || type == QTextDocument::StyleSheetResource) + { + if(resources.contains(name.toString())) + { + return resources.take(name.toString()); + } + else + if(!requestedResources.contains(name.toString())) + { + qDebug() << "Requesting resource" << name.toString(); + requestedResources.insert(name.toString()); + + QNetworkRequest newRequest(QUrl("http://www.hedgewars.org" + name.toString())); + newRequest.setAttribute(typeAttribute, type); + newRequest.setAttribute(urlAttribute, name); + + QNetworkReply *reply = manager->get(newRequest); + connect(reply, SIGNAL(finished()), this, SLOT(resourceDownloaded())); + } + } + + return QVariant(); +} + +void DataBrowser::resourceDownloaded() +{ + QNetworkReply * reply = qobject_cast(sender()); + + if(reply) + { + int type = reply->request().attribute(typeAttribute).toInt(); + QUrl url = reply->request().attribute(urlAttribute).toUrl(); + resources.insert(url.toString(), reply->readAll()); + document()->addResource(type, reply->request().url(), QVariant()); + update(); + } +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/databrowser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/databrowser.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,33 @@ +#ifndef DATABROWSER_H +#define DATABROWSER_H + +#include +#include + +class QNetworkAccessManager; + +class DataBrowser : public QTextBrowser +{ + Q_OBJECT +public: + explicit DataBrowser(QWidget *parent = 0); + +signals: + +public slots: + +private: + QNetworkAccessManager *manager; + + // hash and set of QString instead of QUrl to support Qt versions + // older than 4.7 (those have no support for qHash(const QUrl &)) + QHash resources; + QSet requestedResources; + + QVariant loadResource(int type, const QUrl & name); + +private slots: + void resourceDownloaded(); +}; + +#endif // DATABROWSER_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/drawmapwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/drawmapwidget.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,106 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include + +#include "drawmapwidget.h" + +DrawMapWidget::DrawMapWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::DrawMapWidget) +{ + ui->setupUi(this); + + m_scene = 0; +} + +DrawMapWidget::~DrawMapWidget() +{ + delete ui; +} + +void DrawMapWidget::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void DrawMapWidget::setScene(DrawMapScene * scene) +{ + ui->graphicsView->setScene(scene); + m_scene = scene; +} + +void DrawMapWidget::resizeEvent(QResizeEvent * event) +{ + Q_UNUSED(event); + + if(ui->graphicsView && ui->graphicsView->scene()) + ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio); +} + +void DrawMapWidget::showEvent(QShowEvent * event) +{ + Q_UNUSED(event); + + resizeEvent(0); +} + +void DrawMapWidget::undo() +{ + if(m_scene) m_scene->undo(); +} + +void DrawMapWidget::clear() +{ + if(m_scene) m_scene->clearMap(); +} + +void DrawMapWidget::save(const QString & fileName) +{ + if(m_scene) + { + QFile file(fileName); + + if(!file.open(QIODevice::WriteOnly)) + QMessageBox::warning(this, tr("File error"), tr("Cannot open file '%1' for writing").arg(fileName)); + else + file.write(qCompress(m_scene->encode()).toBase64()); + } +} + +void DrawMapWidget::load(const QString & fileName) +{ + if(m_scene) + { + QFile f(fileName); + + if(!f.open(QIODevice::ReadOnly)) + QMessageBox::warning(this, tr("File error"), tr("Cannot read file '%1'").arg(fileName)); + else + m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll()))); + } +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/drawmapwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/drawmapwidget.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,86 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef DRAWMAPWIDGET_H +#define DRAWMAPWIDGET_H + +#include +#include +#include +#include + +#include "qaspectratiolayout.h" +#include "drawmapscene.h" + +namespace Ui { + class Ui_DrawMapWidget + { + public: + QGraphicsView *graphicsView; + + void setupUi(QWidget *drawMapWidget) + { + QAspectRatioLayout * arLayout = new QAspectRatioLayout(drawMapWidget); + arLayout->setMargin(0); + + graphicsView = new QGraphicsView(drawMapWidget); + arLayout->addWidget(graphicsView); + + retranslateUi(drawMapWidget); + + QMetaObject::connectSlotsByName(drawMapWidget); + } // setupUi + + void retranslateUi(QWidget *drawMapWidget) + { + Q_UNUSED(drawMapWidget); + } // retranslateUi + + }; + + class DrawMapWidget: public Ui_DrawMapWidget {}; +} + +class DrawMapWidget : public QWidget +{ + Q_OBJECT + +public: + explicit DrawMapWidget(QWidget *parent = 0); + ~DrawMapWidget(); + + void setScene(DrawMapScene * scene); + +public slots: + void undo(); + void clear(); + void save(const QString & fileName); + void load(const QString & fileName); + +protected: + void changeEvent(QEvent *e); + virtual void resizeEvent(QResizeEvent * event); + virtual void showEvent(QShowEvent * event); + +private: + Ui::DrawMapWidget *ui; + + DrawMapScene * m_scene; +}; + +#endif // DRAWMAPWIDGET_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/fpsedit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/fpsedit.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,31 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "fpsedit.h" + +FPSEdit::FPSEdit(QWidget * parent) : + QSpinBox(parent) +{ + setRange(1, 34); + setValue(27); +} + +QString FPSEdit::textFromValue(int value) const +{ + return QString::number(1000 / (35 - value)); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/fpsedit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/fpsedit.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,35 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _FPSEDIT_H +#define _FPSEDIT_H + +#include + +class FPSEdit : public QSpinBox +{ + Q_OBJECT + +public: + FPSEdit(QWidget * parent = 0); + +protected: + QString textFromValue (int value) const; +}; + +#endif // _FPSEDIT_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/frameTeam.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/frameTeam.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,128 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include + +#include "frameTeam.h" +#include "teamselhelper.h" +#include "hwconsts.h" + +FrameTeams::FrameTeams(QWidget* parent) : + QFrame(parent), maxHedgehogsPerGame(48), overallHedgehogs(0), mainLayout(this), nonInteractive(false) +{ + QPalette newPalette = palette(); + newPalette.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); + setPalette(newPalette); + setAutoFillBackground(true); + + mainLayout.setSpacing(1); + mainLayout.setContentsMargins(4, 4, 4, 4); + + int i = 0; + while(colors[i] != 0) + availableColors.push_back(QColor(colors[i++])); + + resetColors(); +} + +void FrameTeams::setInteractivity(bool interactive) +{ + nonInteractive = !interactive; + for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ++it) { + TeamShowWidget* pts = dynamic_cast(it.value()); + if(!pts) throw; + pts->setInteractivity(interactive); + } +} + +void FrameTeams::resetColors() +{ + currentColor=availableColors.end() - 1; // ensure next color is the first one +} + +QColor FrameTeams::getNextColor() const +{ + QList::ConstIterator nextColor=currentColor; + ++nextColor; + if (nextColor==availableColors.end()) nextColor=availableColors.begin(); + return *nextColor; +} + +void FrameTeams::addTeam(HWTeam team, bool willPlay) +{ + TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this); + if(nonInteractive) pTeamShowWidget->setInteractivity(false); +// int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height(); + mainLayout.addWidget(pTeamShowWidget); + teamToWidget.insert(team, pTeamShowWidget); + QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size()); + QCoreApplication::postEvent(parentWidget(), pevent); +} + +void FrameTeams::removeTeam(HWTeam team) +{ + tmapTeamToWidget::iterator it=teamToWidget.find(team); + if(it==teamToWidget.end()) return; + mainLayout.removeWidget(it.value()); + it.value()->deleteLater(); + teamToWidget.erase(it); +} + +void FrameTeams::resetTeams() +{ + for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ) { + mainLayout.removeWidget(it.value()); + it.value()->deleteLater(); + teamToWidget.erase(it++); + } +} + +void FrameTeams::setHHNum(const HWTeam& team) +{ + TeamShowWidget* pTeamShowWidget = dynamic_cast(getTeamWidget(team)); + if(!pTeamShowWidget) return; + pTeamShowWidget->setHHNum(team.numHedgehogs()); +} + +void FrameTeams::setTeamColor(const HWTeam& team) +{ + TeamShowWidget* pTeamShowWidget = dynamic_cast(getTeamWidget(team)); + if(!pTeamShowWidget) return; + pTeamShowWidget->changeTeamColor(team.color()); +} + +QWidget* FrameTeams::getTeamWidget(HWTeam team) +{ +//qDebug() << "FrameTeams::getTeamWidget getNetID() = " << team.getNetID(); + tmapTeamToWidget::iterator it=teamToWidget.find(team); + QWidget* ret = it!=teamToWidget.end() ? it.value() : 0; + return ret; +} + +bool FrameTeams::isFullTeams() const +{ + return overallHedgehogs==maxHedgehogsPerGame; +} + +void FrameTeams::emitTeamColorChanged(const HWTeam& team) +{ + emit teamColorChanged(team); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/frameTeam.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/frameTeam.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,68 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _FRAME_TEAM_INCLUDED +#define _FRAME_TEAM_INCLUDED + +#include +#include +#include + +#include "teamselect.h" + +class FrameTeams : public QFrame +{ + Q_OBJECT + + friend class CHedgehogerWidget; + friend class TeamShowWidget; + + public: + FrameTeams(QWidget* parent=0); + QWidget* getTeamWidget(HWTeam team); + bool isFullTeams() const; + void resetColors(); + void resetTeams(); + void setHHNum(const HWTeam& team); + void setTeamColor(const HWTeam& team); + void setInteractivity(bool interactive); + QColor getNextColor() const; + + signals: + void teamColorChanged(const HWTeam&); + + public slots: + void addTeam(HWTeam team, bool willPlay); + void removeTeam(HWTeam team); + + private: + const int maxHedgehogsPerGame; + int overallHedgehogs; + QList availableColors; + QList::Iterator currentColor; + + void emitTeamColorChanged(const HWTeam& team); + + QVBoxLayout mainLayout; + typedef QMap tmapTeamToWidget; + tmapTeamToWidget teamToWidget; + bool nonInteractive; +}; + +#endif // _FRAME_TAM_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/gamecfgwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/gamecfgwidget.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,575 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gamecfgwidget.h" +#include "igbox.h" +#include "HWDataManager.h" +#include "hwconsts.h" +#include "ammoSchemeModel.h" +#include "proto.h" + +GameCFGWidget::GameCFGWidget(QWidget* parent) : + QGroupBox(parent) + , mainLayout(this) + , seedRegexp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}") +{ + mainLayout.setMargin(0); +// mainLayout.setSizeConstraint(QLayout::SetMinimumSize); + + pMapContainer = new HWMapContainer(this); + mainLayout.addWidget(pMapContainer, 0, 0); + + IconedGroupBox *GBoxOptions = new IconedGroupBox(this); + GBoxOptions->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + mainLayout.addWidget(GBoxOptions, 1, 0); + + QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions); + + GBoxOptions->setTitle(tr("Game Options")); + GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), GBoxOptions), 1, 0); + + Scripts = new QComboBox(GBoxOptions); + GBoxOptionsLayout->addWidget(Scripts, 1, 1); + + Scripts->addItem("Normal"); + Scripts->insertSeparator(1); + + for (int i = 0; i < scriptList->size(); ++i) { + QString script = (*scriptList)[i].remove(".lua", Qt::CaseInsensitive); + QList scriptInfo; + scriptInfo.push_back(script); + QFile scriptCfgFile(HWDataManager::instance().findFileForRead( + QString("Scripts/Multiplayer/%2.cfg").arg(script))); + if (scriptCfgFile.exists() && scriptCfgFile.open(QFile::ReadOnly)) { + QString scheme; + QString weapons; + QTextStream input(&scriptCfgFile); + input >> scheme; + input >> weapons; + if (scheme.isEmpty()) + scheme = "locked"; + scheme.replace("_", " "); + if (weapons.isEmpty()) + weapons = "locked"; + weapons.replace("_", " "); + scriptInfo.push_back(scheme); + scriptInfo.push_back(weapons); + scriptCfgFile.close(); + } + else + { + scriptInfo.push_back("locked"); + scriptInfo.push_back("locked"); + } + Scripts->addItem(script.replace("_", " "), scriptInfo); + } + + connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int))); + + QWidget *SchemeWidget = new QWidget(GBoxOptions); + GBoxOptionsLayout->addWidget(SchemeWidget, 2, 0, 1, 2); + + QGridLayout *SchemeWidgetLayout = new QGridLayout(SchemeWidget); + SchemeWidgetLayout->setMargin(0); + + GameSchemes = new QComboBox(SchemeWidget); + SchemeWidgetLayout->addWidget(GameSchemes, 0, 2); + connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int))); + + SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Scheme"), SchemeWidget), 0, 0); + + QPixmap pmEdit(":/res/edit.png"); + + QPushButton * goToSchemePage = new QPushButton(SchemeWidget); + goToSchemePage->setToolTip(tr("Edit schemes")); + goToSchemePage->setIconSize(pmEdit.size()); + goToSchemePage->setIcon(pmEdit); + goToSchemePage->setMaximumWidth(pmEdit.width() + 6); + SchemeWidgetLayout->addWidget(goToSchemePage, 0, 3); + connect(goToSchemePage, SIGNAL(clicked()), this, SLOT(jumpToSchemes())); + + SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Weapons"), SchemeWidget), 1, 0); + + WeaponsName = new QComboBox(SchemeWidget); + SchemeWidgetLayout->addWidget(WeaponsName, 1, 2); + + connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int))); + + QPushButton * goToWeaponPage = new QPushButton(SchemeWidget); + goToWeaponPage->setToolTip(tr("Edit weapons")); + goToWeaponPage->setIconSize(pmEdit.size()); + goToWeaponPage->setIcon(pmEdit); + goToWeaponPage->setMaximumWidth(pmEdit.width() + 6); + SchemeWidgetLayout->addWidget(goToWeaponPage, 1, 3); + connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons())); + + bindEntries = new QCheckBox(SchemeWidget); + bindEntries->setToolTip(tr("When this option is enabled selecting a game scheme will auto-select a weapon")); + bindEntries->setChecked(true); + bindEntries->setMaximumWidth(42); + bindEntries->setStyleSheet( "QCheckBox::indicator:checked { image: url(\":/res/lock.png\"); }" + "QCheckBox::indicator:unchecked { image: url(\":/res/unlock.png\"); }" ); + SchemeWidgetLayout->addWidget(bindEntries, 0, 1, 0, 1, Qt::AlignVCenter); + + connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &))); + connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &))); + connect(pMapContainer, SIGNAL(mapgenChanged(MapGenerator)), this, SLOT(mapgenChanged(MapGenerator))); + connect(pMapContainer, SIGNAL(mazeSizeChanged(int)), this, SLOT(maze_sizeChanged(int))); + connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &))); + connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int))); + connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap())); + connect(pMapContainer, SIGNAL(drawnMapChanged(const QByteArray &)), this, SLOT(onDrawnMapChanged(const QByteArray &))); +} + +void GameCFGWidget::jumpToSchemes() +{ + emit goToSchemes(GameSchemes->currentIndex()); +} + +void GameCFGWidget::jumpToWeapons() +{ + emit goToWeapons(WeaponsName->currentIndex()); +} + +QVariant GameCFGWidget::schemeData(int column) const +{ + return GameSchemes->model()->data(GameSchemes->model()->index(GameSchemes->currentIndex(), column)); +} + +quint32 GameCFGWidget::getGameFlags() const +{ + quint32 result = 0; + + if (schemeData(1).toBool()) + result |= 0x00001000; // fort + if (schemeData(2).toBool()) + result |= 0x00000010; // divide teams + if (schemeData(3).toBool()) + result |= 0x00000004; // solid land + if (schemeData(4).toBool()) + result |= 0x00000008; // border + if (schemeData(5).toBool()) + result |= 0x00000020; // low gravity + if (schemeData(6).toBool()) + result |= 0x00000040; // laser sight + if (schemeData(7).toBool()) + result |= 0x00000080; // invulnerable + if (schemeData(8).toBool()) + result |= 0x00000100; // mines + if (schemeData(9).toBool()) + result |= 0x00000200; // vampirism + if (schemeData(10).toBool()) + result |= 0x00000400; // karma + if (schemeData(11).toBool()) + result |= 0x00000800; // artillery + if (schemeData(12).toBool()) + result |= 0x00002000; // random + if (schemeData(13).toBool()) + result |= 0x00004000; // king + if (schemeData(14).toBool()) + result |= 0x00008000; // place hogs + if (schemeData(15).toBool()) + result |= 0x00010000; // shared ammo + if (schemeData(16).toBool()) + result |= 0x00020000; // disable girders + if (schemeData(17).toBool()) + result |= 0x00040000; // disable land obj + if (schemeData(18).toBool()) + result |= 0x00080000; // ai survival + if (schemeData(19).toBool()) + result |= 0x00100000; // infinite attacks + if (schemeData(20).toBool()) + result |= 0x00200000; // reset weaps + if (schemeData(21).toBool()) + result |= 0x00400000; // per hog ammo + if (schemeData(22).toBool()) + result |= 0x00800000; // no wind + if (schemeData(23).toBool()) + result |= 0x01000000; // more wind + if (schemeData(24).toBool()) + result |= 0x02000000; // tag team + if (schemeData(25).toBool()) + result |= 0x04000000; // bottom border + + return result; +} + +quint32 GameCFGWidget::getInitHealth() const +{ + return schemeData(28).toInt(); +} + +QByteArray GameCFGWidget::getFullConfig() const +{ + QList bcfg; + int mapgen = pMapContainer->get_mapgen(); + + QString currentMap = pMapContainer->getCurrentMap(); + if (currentMap.size() > 0) + { + bcfg << QString("emap " + currentMap).toUtf8(); + +// engine should figure it out on its own +// if(pMapContainer->getCurrentIsMission()) +// bcfg << QString("escript Maps/%1/map.lua").arg(currentMap).toUtf8(); + } + bcfg << QString("etheme " + pMapContainer->getCurrentTheme()).toUtf8(); + + if (Scripts->currentIndex() > 0) + { + bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex()).toList()[0].toString()).toUtf8(); + } + + bcfg << QString("eseed " + pMapContainer->getCurrentSeed()).toUtf8(); + bcfg << QString("e$gmflags %1").arg(getGameFlags()).toUtf8(); + bcfg << QString("e$damagepct %1").arg(schemeData(26).toInt()).toUtf8(); + bcfg << QString("e$turntime %1").arg(schemeData(27).toInt() * 1000).toUtf8(); + bcfg << QString("e$sd_turns %1").arg(schemeData(29).toInt()).toUtf8(); + bcfg << QString("e$casefreq %1").arg(schemeData(30).toInt()).toUtf8(); + bcfg << QString("e$minestime %1").arg(schemeData(31).toInt() * 1000).toUtf8(); + bcfg << QString("e$minesnum %1").arg(schemeData(32).toInt()).toUtf8(); + bcfg << QString("e$minedudpct %1").arg(schemeData(33).toInt()).toUtf8(); + bcfg << QString("e$explosives %1").arg(schemeData(34).toInt()).toUtf8(); + bcfg << QString("e$healthprob %1").arg(schemeData(35).toInt()).toUtf8(); + bcfg << QString("e$hcaseamount %1").arg(schemeData(36).toInt()).toUtf8(); + bcfg << QString("e$waterrise %1").arg(schemeData(37).toInt()).toUtf8(); + bcfg << QString("e$healthdec %1").arg(schemeData(38).toInt()).toUtf8(); + bcfg << QString("e$ropepct %1").arg(schemeData(39).toInt()).toUtf8(); + bcfg << QString("e$getawaytime %1").arg(schemeData(40).toInt()).toUtf8(); + bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8(); + bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8(); + + switch (mapgen) + { + case MAPGEN_MAZE: + bcfg << QString("e$maze_size %1").arg(pMapContainer->getMazeSize()).toUtf8(); + break; + + case MAPGEN_DRAWN: + { + QByteArray data = pMapContainer->getDrawnMapData(); + while(data.size() > 0) + { + QByteArray tmp = data; + tmp.truncate(200); + tmp.prepend("edraw "); + bcfg << tmp; + data.remove(0, 200); + } + break; + } + default: ; + } + + QByteArray result; + + foreach(QByteArray ba, bcfg) + HWProto::addByteArrayToBuffer(result, ba); + + return result; +} + +void GameCFGWidget::setNetAmmo(const QString& name, const QString& ammo) +{ + bool illegal = ammo.size() != cDefaultAmmoStore->size(); + if (illegal) + QMessageBox::critical(this, tr("Error"), tr("Illegal ammo scheme")); + + int pos = WeaponsName->findText(name); + if ((pos == -1) || illegal) { // prevent from overriding schemes with bad ones + WeaponsName->addItem(name, ammo); + WeaponsName->setCurrentIndex(WeaponsName->count() - 1); + } else { + WeaponsName->setItemData(pos, ammo); + WeaponsName->setCurrentIndex(pos); + } +} + +void GameCFGWidget::fullNetConfig() +{ + ammoChanged(WeaponsName->currentIndex()); + + seedChanged(pMapContainer->getCurrentSeed()); + templateFilterChanged(pMapContainer->getTemplateFilter()); + themeChanged(pMapContainer->getCurrentTheme()); + + schemeChanged(GameSchemes->currentIndex()); + scriptChanged(Scripts->currentIndex()); + + mapgenChanged(pMapContainer->get_mapgen()); + maze_sizeChanged(pMapContainer->getMazeSize()); + + // map must be the last + QString map = pMapContainer->getCurrentMap(); + if (map.size()) + mapChanged(map); +} + +void GameCFGWidget::setParam(const QString & param, const QStringList & slValue) +{ + if (slValue.size() == 1) + { + QString value = slValue[0]; + if (param == "MAP") { + pMapContainer->setMap(value); + return; + } + if (param == "SEED") { + pMapContainer->setSeed(value); + if (!seedRegexp.exactMatch(value)) { + pMapContainer->seedEdit->setVisible(true); + } + return; + } + if (param == "THEME") { + pMapContainer->setTheme(value); + return; + } + if (param == "TEMPLATE") { + pMapContainer->setTemplateFilter(value.toUInt()); + return; + } + if (param == "MAPGEN") { + pMapContainer->setMapgen((MapGenerator)value.toUInt()); + return; + } + if (param == "MAZE_SIZE") { + pMapContainer->setMazeSize(value.toUInt()); + return; + } + if (param == "SCRIPT") { + Scripts->setCurrentIndex(Scripts->findText(value)); + return; + } + if (param == "DRAWNMAP") { + pMapContainer->setDrawnMapData(qUncompress(QByteArray::fromBase64(slValue[0].toLatin1()))); + return; + } + } + + if (slValue.size() == 2) + { + if (param == "AMMO") { + setNetAmmo(slValue[0], slValue[1]); + return; + } + } + + if (slValue.size() == 5) + { + if (param == "FULLMAPCONFIG") + { + QString seed = slValue[3]; + if (!seedRegexp.exactMatch(seed)) + pMapContainer->seedEdit->setVisible(true); + + pMapContainer->setAllMapParameters( + slValue[0], + (MapGenerator)slValue[1].toUInt(), + slValue[2].toUInt(), + seed, + slValue[4].toUInt() + ); + return; + } + } + + qWarning("Got bad config param from net"); +} + +void GameCFGWidget::ammoChanged(int index) +{ + if (index >= 0) { + emit paramChanged( + "AMMO", + QStringList() << WeaponsName->itemText(index) << WeaponsName->itemData(index).toString() + ); + } +} + +void GameCFGWidget::mapChanged(const QString & value) +{ + if(isEnabled() && pMapContainer->getCurrentIsMission()) + { + Scripts->setEnabled(false); + Scripts->setCurrentIndex(0); + + if (pMapContainer->getCurrentScheme() == "locked") + { + GameSchemes->setEnabled(false); + GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); + } + else + { + GameSchemes->setEnabled(true); + int num = GameSchemes->findText(pMapContainer->getCurrentScheme()); + if (num != -1) + GameSchemes->setCurrentIndex(num); + else + GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); + } + + if (pMapContainer->getCurrentWeapons() == "locked") + { + WeaponsName->setEnabled(false); + WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); + } + else + { + WeaponsName->setEnabled(true); + int num = WeaponsName->findText(pMapContainer->getCurrentWeapons()); + if (num != -1) + WeaponsName->setCurrentIndex(num); + else + WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); + } + + if (pMapContainer->getCurrentScheme() != "locked" && pMapContainer->getCurrentWeapons() != "locked") + bindEntries->setEnabled(true); + else + bindEntries->setEnabled(false); + } + else + { + Scripts->setEnabled(true); + GameSchemes->setEnabled(true); + WeaponsName->setEnabled(true); + bindEntries->setEnabled(true); + } + emit paramChanged("MAP", QStringList(value)); +} + +void GameCFGWidget::templateFilterChanged(int value) +{ + emit paramChanged("TEMPLATE", QStringList(QString::number(value))); +} + +void GameCFGWidget::seedChanged(const QString & value) +{ + emit paramChanged("SEED", QStringList(value)); +} + +void GameCFGWidget::themeChanged(const QString & value) +{ + emit paramChanged("THEME", QStringList(value)); +} + +void GameCFGWidget::schemeChanged(int index) +{ + QStringList sl; + + int size = GameSchemes->model()->columnCount(); + for(int i = 0; i < size; ++i) + sl << schemeData(i).toString(); + + emit paramChanged("SCHEME", sl); + + if (isEnabled() && bindEntries->isEnabled() && bindEntries->isChecked()) { + QString schemeName = GameSchemes->itemText(index); + for (int i = 0; i < WeaponsName->count(); i++) { + QString weapName = WeaponsName->itemText(i); + int res = QString::compare(weapName, schemeName, Qt::CaseSensitive); + if (0 == res) { + WeaponsName->setCurrentIndex(i); + emit ammoChanged(i); + break; + } + } + } +} + +void GameCFGWidget::scriptChanged(int index) +{ + if(isEnabled() && index > 0) + { + QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString(); + QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[2].toString(); + + if (scheme == "locked") + { + GameSchemes->setEnabled(false); + GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); + } + else + { + GameSchemes->setEnabled(true); + int num = GameSchemes->findText(scheme); + if (num != -1) + GameSchemes->setCurrentIndex(num); + else + GameSchemes->setCurrentIndex(GameSchemes->findText("Default")); + } + + if (weapons == "locked") + { + WeaponsName->setEnabled(false); + WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); + } + else + { + WeaponsName->setEnabled(true); + int num = WeaponsName->findText(weapons); + if (num != -1) + WeaponsName->setCurrentIndex(num); + else + WeaponsName->setCurrentIndex(WeaponsName->findText("Default")); + } + + if (scheme != "locked" && weapons != "locked") + bindEntries->setEnabled(true); + else + bindEntries->setEnabled(false); + } + else + { + GameSchemes->setEnabled(true); + WeaponsName->setEnabled(true); + bindEntries->setEnabled(true); + } + emit paramChanged("SCRIPT", QStringList(Scripts->itemText(index))); +} + +void GameCFGWidget::mapgenChanged(MapGenerator m) +{ + emit paramChanged("MAPGEN", QStringList(QString::number(m))); +} + +void GameCFGWidget::maze_sizeChanged(int s) +{ + emit paramChanged("MAZE_SIZE", QStringList(QString::number(s))); +} + +void GameCFGWidget::resendSchemeData() +{ + schemeChanged(GameSchemes->currentIndex()); +} + +void GameCFGWidget::onDrawnMapChanged(const QByteArray & data) +{ + emit paramChanged("DRAWNMAP", QStringList(qCompress(data, 9).toBase64())); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/gamecfgwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/gamecfgwidget.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,87 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef GAMECONFIGWIDGET_H +#define GAMECONFIGWIDGET_H + +#include +#include +#include +#include +#include + +#include "mapContainer.h" + +class QCheckBox; +class QVBoxLayout; +class QLabel; +class QTableView; + +class GameCFGWidget : public QGroupBox +{ + Q_OBJECT + +public: + GameCFGWidget(QWidget* parent); + quint32 getGameFlags() const; + quint32 getInitHealth() const; + QByteArray getFullConfig() const; + QComboBox * Scripts; + QComboBox * GameSchemes; + QComboBox * WeaponsName; + HWMapContainer* pMapContainer; + QTableView * tv; + QVariant schemeData(int column) const; + +public slots: + void setParam(const QString & param, const QStringList & value); + void fullNetConfig(); + void resendSchemeData(); + +signals: + void paramChanged(const QString & param, const QStringList & value); + void goToSchemes(int); + void goToWeapons(int); + void goToDrawMap(); + +private slots: + void ammoChanged(int index); + void mapChanged(const QString &); + void templateFilterChanged(int); + void seedChanged(const QString &); + void themeChanged(const QString &); + void schemeChanged(int); + void scriptChanged(int); + void jumpToSchemes(); + void jumpToWeapons(); + void mapgenChanged(MapGenerator m); + void maze_sizeChanged(int s); + void onDrawnMapChanged(const QByteArray & data); + +private: + QGridLayout mainLayout; + QCheckBox * bindEntries; + QString curNetAmmoName; + QString curNetAmmo; + QRegExp seedRegexp; + + void setNetAmmo(const QString& name, const QString& ammo); + +}; + +#endif // GAMECONFIGWIDGET_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/hedgehogerWidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/hedgehogerWidget.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,76 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Ulyanov Igor + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "hedgehogerWidget.h" + +#include "frameTeam.h" + +CHedgehogerWidget::CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent) : + ItemNum(im, img, parent, 1) +{ + // TODO: maxHedgehogsPerGame doesn't reset properly and won't match map limits for now + /*if(parent) { + pOurFrameTeams = dynamic_cast(parent->parentWidget()); + } + if(pOurFrameTeams->overallHedgehogs + 4 > pOurFrameTeams->maxHedgehogsPerGame) { + numItems = pOurFrameTeams->maxHedgehogsPerGame - pOurFrameTeams->overallHedgehogs; + } else numItems = 4; + pOurFrameTeams->overallHedgehogs += numItems;*/ +} + +void CHedgehogerWidget::incItems() +{ + //if (pOurFrameTeams->overallHedgehogs < pOurFrameTeams->maxHedgehogsPerGame) { + numItems++; + //pOurFrameTeams->overallHedgehogs++; + emit hedgehogsNumChanged(); + //} +} + +void CHedgehogerWidget::decItems() +{ + numItems--; + //pOurFrameTeams->overallHedgehogs--; + emit hedgehogsNumChanged(); +} + +CHedgehogerWidget::~CHedgehogerWidget() +{ + // TODO: not called? + //pOurFrameTeams->overallHedgehogs-=numItems; +} + +void CHedgehogerWidget::setNonInteractive() +{ + nonInteractive=true; +} + +void CHedgehogerWidget::setHHNum(unsigned int num) +{ + /*unsigned int diff = num - numItems; + numItems += diff; + pOurFrameTeams->overallHedgehogs += diff;*/ + numItems = num; + repaint(); +} + +unsigned char CHedgehogerWidget::getHedgehogsNum() const +{ + return numItems; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/hedgehogerWidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/hedgehogerWidget.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,50 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Ulyanov Igor + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _HEDGEHOGER_WIDGET +#define _HEDGEHOGER_WIDGET + +#include "itemNum.h" + +class FrameTeams; + +class CHedgehogerWidget : public ItemNum +{ + Q_OBJECT + + public: + CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent); + virtual ~CHedgehogerWidget(); + unsigned char getHedgehogsNum() const; + void setHHNum (unsigned int num); + void setNonInteractive(); + + signals: + void hedgehogsNumChanged(); + + protected: + virtual void incItems(); + virtual void decItems(); + + private: + CHedgehogerWidget(); + FrameTeams* pOurFrameTeams; +}; + +#endif // _HEDGEHOGER_WIDGET diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/igbox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/igbox.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,79 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include + +#include "igbox.h" + +IconedGroupBox::IconedGroupBox(QWidget * parent) + : QGroupBox(parent) +{ +// Has issues with border-radius on children +// setAttribute(Qt::WA_PaintOnScreen, true); + titleLeftPadding = 49; + contentTopPadding = 15; +} + +void IconedGroupBox::setIcon(const QIcon & icon) +{ + if (this->icon.isNull()) + setStyleSheet(QString( + "IconedGroupBox{" + "margin-top: 46px;" + "margin-left: 12px;" + "padding: %1px 2px 5px 2px;" + "}" + "IconedGroupBox::title{" + "subcontrol-origin: margin;" + "subcontrol-position: top left;" + "padding-left: %2px;" + "padding-top: %1px;" + "text-align: left;" + "}" + ).arg(contentTopPadding).arg(titleLeftPadding) + ); + + this->icon = icon; + repaint(); +} + +void IconedGroupBox::paintEvent(QPaintEvent * event) +{ + Q_UNUSED(event); + + QStylePainter painter(this); + + QStyleOptionGroupBox option; + initStyleOption(&option); + painter.drawComplexControl(QStyle::CC_GroupBox, option); + + icon.paint(&painter, QRect(QPoint(0, 0), icon.actualSize(size()))); +} + +void IconedGroupBox::setTitleTextPadding(int px) +{ + titleLeftPadding = px; +} + +void IconedGroupBox::setContentTopPadding(int px) +{ + contentTopPadding = px; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/igbox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/igbox.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,44 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _IGBOX_H +#define _IGBOX_H + +#include +#include + +class IconedGroupBox : public QGroupBox +{ + Q_OBJECT + +public: + IconedGroupBox(QWidget * parent = 0); + + void setIcon(const QIcon & icon); + void setTitleTextPadding(int px); + void setContentTopPadding(int px); +protected: + virtual void paintEvent(QPaintEvent * event); + +private: + QIcon icon; + int titleLeftPadding; + int contentTopPadding; +}; + +#endif // _IGBOX_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/itemNum.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/itemNum.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,142 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Igor Ulyanov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "itemNum.h" +#include "hwform.h" + +#include +#include + +ItemNum::ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min, unsigned char max) : + QFrame(parent), m_im(im), m_img(img), infinityState(false), nonInteractive(false), minItems(min), maxItems(max), + numItems(min+2 >= max ? min : min+2) +{ + enabled = true; + if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true); +} + +ItemNum::~ItemNum() +{ +} + +void ItemNum::mousePressEvent ( QMouseEvent * event ) +{ + if(nonInteractive) return; + if(event->button()==Qt::LeftButton && enabled) { + event->accept(); + if((infinityState && numItems <= maxItems) || (!infinityState && numItems < maxItems)) { + incItems(); + } else { + numItems = minItems+1; + // appears there's an emit in there + decItems(); + } + } else if (event->button()==Qt::RightButton && enabled) { + event->accept(); + if(numItems > minItems) { + decItems(); + } else { + numItems = maxItems+(infinityState?0:-1); + incItems(); + } + } else { + event->ignore(); + return; + } + repaint(); +} +void ItemNum::wheelEvent ( QWheelEvent * event ) +{ + if (nonInteractive) return; + if (!enabled) + { + event->ignore(); + return; + } + event->accept(); + + bool up = (event->delta() > 0); // positive delta is up, negative is down + + // negative delta on horizontal wheel is not left, but right + if (event->orientation() == Qt::Horizontal) + up = !up; + + if(up) + { + if((infinityState && numItems <= maxItems) || (!infinityState && numItems < maxItems)) + incItems(); + } + else + { + if(numItems > minItems) + decItems(); + } + repaint(); +} + +QSize ItemNum::sizeHint () const +{ + return QSize((maxItems+1)*12, 32); +} + +void ItemNum::paintEvent(QPaintEvent* event) +{ + Q_UNUSED(event); + + QPainter painter(this); + + if (numItems==maxItems+1) { + QRect target(0, 0, 100, 32); + if (enabled) { + painter.drawImage(target, QImage(":/res/infinity.png")); + } else { + painter.drawImage(target, QImage(":/res/infinitygrey.png")); + } + } else { + for(int i=0; i + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include + +#ifndef _ITEM_NUM_INCLUDED +#define _ITEM_NUM_INCLUDED + +class ItemNum : public QFrame +{ + Q_OBJECT + + public: + void setInfinityState(bool value); + void setEnabled(bool value); + unsigned char getItemsNum() const; + void setItemsNum(const unsigned char num); + + private: + QImage m_im; + QImage m_img; + bool infinityState; + bool enabled; + + protected: + ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min=2, unsigned char max=8); + virtual QSize sizeHint () const; + virtual ~ItemNum()=0; + + bool nonInteractive; + unsigned char minItems; + unsigned char maxItems; + unsigned char numItems; + + // from QWidget + virtual void mousePressEvent ( QMouseEvent * event ); + virtual void wheelEvent ( QWheelEvent * event ); + virtual void paintEvent(QPaintEvent* event); + + // to be implemented in child + virtual void incItems()=0; + virtual void decItems()=0; +}; + +#endif // _ITEM_NUM_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/mapContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/mapContainer.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,677 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2011 Igor Ulyanov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hwconsts.h" +#include "mapContainer.h" +#include "igbox.h" +#include "HWApplication.h" + +HWMapContainer::HWMapContainer(QWidget * parent) : + QWidget(parent), + mainLayout(this), + pMap(0), + mapgen(MAPGEN_REGULAR) +{ + hhSmall.load(":/res/hh_small.png"); + hhLimit = 18; + templateFilter = 0; + + mainLayout.setContentsMargins(HWApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin), + 1, + HWApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin), + HWApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin)); + + QWidget* mapWidget = new QWidget(this); + mainLayout.addWidget(mapWidget, 0, 0, Qt::AlignHCenter); + + QGridLayout* mapLayout = new QGridLayout(mapWidget); + mapLayout->setMargin(0); + + imageButt = new QPushButton(mapWidget); + imageButt->setObjectName("imageButt"); + imageButt->setFixedSize(256 + 6, 128 + 6); + imageButt->setFlat(true); + imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum); + mapLayout->addWidget(imageButt, 0, 0, 1, 2); + connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomMap())); + + chooseMap = new QComboBox(mapWidget); + chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + chooseMap->addItem( +// FIXME - need real icons. Disabling until then +//QIcon(":/res/mapRandom.png"), +QComboBox::tr("generated map...")); + chooseMap->addItem( +// FIXME - need real icons. Disabling until then +//QIcon(":/res/mapMaze.png"), +QComboBox::tr("generated maze...")); + + chooseMap->addItem(QComboBox::tr("hand drawn map...")); + chooseMap->insertSeparator(chooseMap->count()); // separator between generators and missions + + chooseMap->insertSeparator(chooseMap->count()); // separator between generators and missions + + int missionindex = chooseMap->count(); + numMissions = 0; + QFile mapLuaFile; + QFile mapCfgFile; + for (int i = 0; i < mapList->size(); ++i) { + QString map = (*mapList)[i]; + mapCfgFile.setFileName( + QString("%1/Data/Maps/%2/map.cfg") + .arg(cfgdir->absolutePath()) + .arg(map)); + if (mapCfgFile.exists()) { + mapLuaFile.setFileName( + QString("%1/Data/Maps/%2/map.lua") + .arg(cfgdir->absolutePath()) + .arg(map)); + } else { + mapCfgFile.setFileName( + QString("%1/Maps/%2/map.cfg") + .arg(datadir->absolutePath()) + .arg(map)); + mapLuaFile.setFileName( + QString("%1/Maps/%2/map.lua") + .arg(datadir->absolutePath()) + .arg(map)); + } + + if (mapCfgFile.open(QFile::ReadOnly)) { + QString theme; + quint32 limit = 0; + QString scheme; + QString weapons; + QList mapInfo; + bool isMission = mapLuaFile.exists(); + + QTextStream input(&mapCfgFile); + input >> theme; + input >> limit; + input >> scheme; + input >> weapons; + mapInfo.push_back(map); + mapInfo.push_back(theme); + if (limit) + mapInfo.push_back(limit); + else + mapInfo.push_back(18); + + + mapInfo.push_back(isMission); + + if (scheme.isEmpty()) + scheme = "locked"; + scheme.replace("_", " "); + + if (weapons.isEmpty()) + weapons = "locked"; + weapons.replace("_", " "); + + mapInfo.push_back(scheme); + mapInfo.push_back(weapons); + + if(isMission) + { + chooseMap->insertItem(missionindex++, +// FIXME - need real icons. Disabling until then +//QIcon(":/res/mapMission.png"), +QComboBox::tr("Mission") + ": " + map, mapInfo); + numMissions++; + } + else + chooseMap->addItem( +// FIXME - need real icons. Disabling until then +//QIcon(":/res/mapCustom.png"), +map, mapInfo); + mapCfgFile.close(); + } + } + chooseMap->insertSeparator(missionindex); // separator between missions and maps + + connect(chooseMap, SIGNAL(activated(int)), this, SLOT(mapChanged(int))); + mapLayout->addWidget(chooseMap, 1, 1); + + QLabel * lblMap = new QLabel(tr("Map"), mapWidget); + mapLayout->addWidget(lblMap, 1, 0); + + lblFilter = new QLabel(tr("Filter"), mapWidget); + mapLayout->addWidget(lblFilter, 2, 0); + + cbTemplateFilter = new QComboBox(mapWidget); + cbTemplateFilter->addItem(tr("All"), 0); + cbTemplateFilter->addItem(tr("Small"), 1); + cbTemplateFilter->addItem(tr("Medium"), 2); + cbTemplateFilter->addItem(tr("Large"), 3); + cbTemplateFilter->addItem(tr("Cavern"), 4); + cbTemplateFilter->addItem(tr("Wacky"), 5); + mapLayout->addWidget(cbTemplateFilter, 2, 1); + + connect(cbTemplateFilter, SIGNAL(activated(int)), this, SLOT(setTemplateFilter(int))); + + maze_size_label = new QLabel(tr("Type"), mapWidget); + mapLayout->addWidget(maze_size_label, 2, 0); + maze_size_label->hide(); + cbMazeSize = new QComboBox(mapWidget); + cbMazeSize->addItem(tr("Small tunnels"), 0); + cbMazeSize->addItem(tr("Medium tunnels"), 1); + cbMazeSize->addItem(tr("Large tunnels"), 2); + cbMazeSize->addItem(tr("Small floating islands"), 3); + cbMazeSize->addItem(tr("Medium floating islands"), 4); + cbMazeSize->addItem(tr("Large floating islands"), 5); + cbMazeSize->setCurrentIndex(1); + + mapLayout->addWidget(cbMazeSize, 2, 1); + cbMazeSize->hide(); + connect(cbMazeSize, SIGNAL(activated(int)), this, SLOT(setMazeSize(int))); + + gbThemes = new IconedGroupBox(mapWidget); + gbThemes->setTitleTextPadding(80); + gbThemes->setContentTopPadding(15); + gbThemes->setTitle(tr("Themes")); + + //gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon + mapLayout->addWidget(gbThemes, 0, 2, 3, 1); + + QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes); + gbTLayout->setContentsMargins(0, 0, 0 ,0); + gbTLayout->setSpacing(0); + lvThemes = new QListView(mapWidget); + lvThemes->setMinimumHeight(30); + lvThemes->setFixedWidth(140); + lvThemes->setModel(themesModel); + lvThemes->setIconSize(QSize(16, 16)); + lvThemes->setEditTriggers(QListView::NoEditTriggers); + + connect(lvThemes->selectionModel(), SIGNAL(currentRowChanged( const QModelIndex &, const QModelIndex &)), this, SLOT(themeSelected( const QModelIndex &, const QModelIndex &))); + + // override default style to tighten up theme scroller + lvThemes->setStyleSheet(QString( + "QListView{" + "border: solid;" + "border-width: 0px;" + "border-radius: 0px;" + "border-color: transparent;" + "background-color: #0d0544;" + "color: #ffcc00;" + "font: bold 13px;" + "}" + ) + ); + + gbTLayout->addWidget(lvThemes); + lvThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); + + mapLayout->setSizeConstraint(QLayout::SetFixedSize); + + QWidget* seedWidget = new QWidget(this); + mainLayout.addWidget(seedWidget, 1, 0); + + QGridLayout* seedLayout = new QGridLayout(seedWidget); + seedLayout->setMargin(0); + + seedLabel = new QLabel(tr("Seed"), seedWidget); + seedLayout->addWidget(seedLabel, 3, 0); + seedEdit = new QLineEdit(seedWidget); + seedEdit->setMaxLength(54); + connect(seedEdit, SIGNAL(returnPressed()), this, SLOT(seedEdited())); + seedLayout->addWidget(seedEdit, 3, 1); + seedLayout->setColumnStretch(1, 5); + seedSet = new QPushButton(seedWidget); + seedSet->setText(QPushButton::tr("more")); + connect(seedSet, SIGNAL(clicked()), this, SLOT(seedEdited())); + seedLayout->setColumnStretch(2, 1); + seedLayout->addWidget(seedSet, 3, 2); + + seedLabel->setVisible(false); + seedEdit->setVisible(false); + + setRandomSeed(); + setRandomTheme(); +} + +void HWMapContainer::setImage(const QImage newImage) +{ + QPixmap px(256, 128); + QPixmap pxres(256, 128); + QPainter p(&pxres); + + px.fill(Qt::yellow); + QBitmap bm = QBitmap::fromImage(newImage); + px.setMask(bm); + + QLinearGradient linearGrad(QPoint(128, 0), QPoint(128, 128)); + linearGrad.setColorAt(1, QColor(0, 0, 192)); + linearGrad.setColorAt(0, QColor(66, 115, 225)); + p.fillRect(QRect(0, 0, 256, 128), linearGrad); + p.drawPixmap(QPoint(0, 0), px); + + addInfoToPreview(pxres); + //chooseMap->setCurrentIndex(mapgen); + pMap = 0; +} + +void HWMapContainer::setHHLimit(int newHHLimit) +{ + hhLimit = newHHLimit; +} + +void HWMapContainer::mapChanged(int index) +{ + switch(index) { + case MAPGEN_REGULAR: + mapgen = MAPGEN_REGULAR; + updatePreview(); + gbThemes->show(); + lblFilter->show(); + cbTemplateFilter->show(); + maze_size_label->hide(); + cbMazeSize->hide(); + emit mapChanged("+rnd+"); + emit themeChanged(chooseMap->itemData(index).toList()[1].toString()); + break; + case MAPGEN_MAZE: + mapgen = MAPGEN_MAZE; + updatePreview(); + gbThemes->show(); + lblFilter->hide(); + cbTemplateFilter->hide(); + maze_size_label->show(); + cbMazeSize->show(); + emit mapChanged("+maze+"); + emit themeChanged(chooseMap->itemData(index).toList()[1].toString()); + break; + case MAPGEN_DRAWN: + mapgen = MAPGEN_DRAWN; + updatePreview(); + gbThemes->show(); + lblFilter->hide(); + cbTemplateFilter->hide(); + maze_size_label->hide(); + cbMazeSize->hide(); + emit mapChanged("+drawn+"); + emit themeChanged(chooseMap->itemData(index).toList()[1].toString()); + break; + default: + mapgen = MAPGEN_MAP; + updatePreview(); + gbThemes->hide(); + lblFilter->hide(); + cbTemplateFilter->hide(); + maze_size_label->hide(); + cbMazeSize->hide(); + emit mapChanged(chooseMap->itemData(index).toList()[0].toString()); + } + + emit mapgenChanged(mapgen); +} + +// Should this add text to identify map size? +void HWMapContainer::addInfoToPreview(QPixmap image) +{ + QPixmap finalImage = QPixmap(image.size()); + finalImage.fill(QColor(0, 0, 0, 0)); + + QPainter p(&finalImage); + p.drawPixmap(image.rect(), image); + //p.setPen(QColor(0xf4,0x9e,0xe9)); + p.setPen(QColor(0xff,0xcc,0x00)); + p.setBrush(QColor(0, 0, 0)); + p.drawRect(image.rect().width() - hhSmall.rect().width() - 28, 3, 40, 20); + p.setFont(QFont("MS Shell Dlg", 10)); + p.drawText(image.rect().width() - hhSmall.rect().width() - 14 - (hhLimit > 9 ? 10 : 0), 18, QString::number(hhLimit)); + p.drawPixmap(image.rect().width() - hhSmall.rect().width() - 5, 5, hhSmall.rect().width(), hhSmall.rect().height(), hhSmall); + + imageButt->setIcon(finalImage); + imageButt->setIconSize(image.size()); +} + +void HWMapContainer::askForGeneratedPreview() +{ + if (pMap) + { + disconnect(pMap, 0, this, SLOT(setImage(const QImage))); + disconnect(pMap, 0, this, SLOT(setHHLimit(int))); + pMap = 0; + } + + pMap = new HWMap(); + connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage))); + connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int))); + pMap->getImage(m_seed, + getTemplateFilter(), + get_mapgen(), + getMazeSize(), + getDrawnMapData() + ); +} + +void HWMapContainer::themeSelected(const QModelIndex & current, const QModelIndex &) +{ + QString theme = current.data().toString(); + QList mapInfo; + mapInfo.push_back(QString("+rnd+")); + mapInfo.push_back(theme); + mapInfo.push_back(18); + mapInfo.push_back(false); + chooseMap->setItemData(0, mapInfo); + mapInfo[0] = QString("+maze+"); + chooseMap->setItemData(1, mapInfo); + mapInfo[0] = QString("+drawn+"); + chooseMap->setItemData(2, mapInfo); + + gbThemes->setIcon(qVariantValue(current.data(Qt::UserRole))); + emit themeChanged(theme); +} + +QString HWMapContainer::getCurrentSeed() const +{ + return m_seed; +} + +QString HWMapContainer::getCurrentMap() const +{ + if(chooseMap->currentIndex() < MAPGEN_MAP) return QString(); + return chooseMap->itemData(chooseMap->currentIndex()).toList()[0].toString(); +} + +QString HWMapContainer::getCurrentTheme() const +{ + return chooseMap->itemData(chooseMap->currentIndex()).toList()[1].toString(); +} + +bool HWMapContainer::getCurrentIsMission() const +{ + if(!chooseMap->currentIndex()) return false; + return chooseMap->itemData(chooseMap->currentIndex()).toList()[3].toBool(); +} + +int HWMapContainer::getCurrentHHLimit() const +{ + return hhLimit; +} + +QString HWMapContainer::getCurrentScheme() const +{ + return chooseMap->itemData(chooseMap->currentIndex()).toList()[4].toString(); +} + +QString HWMapContainer::getCurrentWeapons() const +{ + return chooseMap->itemData(chooseMap->currentIndex()).toList()[5].toString(); +} + +quint32 HWMapContainer::getTemplateFilter() const +{ + return cbTemplateFilter->itemData(cbTemplateFilter->currentIndex()).toInt(); +} + +void HWMapContainer::resizeEvent ( QResizeEvent * event ) +{ + Q_UNUSED(event); + //imageButt->setIconSize(imageButt->size()); +} + +void HWMapContainer::intSetSeed(const QString & seed) +{ + m_seed = seed; + if (seed != seedEdit->text()) + seedEdit->setText(seed); +} + +void HWMapContainer::setSeed(const QString & seed) +{ + intSetSeed(seed); + if (chooseMap->currentIndex() < MAPGEN_DRAWN) + updatePreview(); +} + +void HWMapContainer::intSetMap(const QString & map) +{ + int id = 0; + for(int i = 0; i < chooseMap->count(); i++) + if(!chooseMap->itemData(i).isNull() && chooseMap->itemData(i).toList()[0].toString() == map) + { + id = i; + break; + } + + if(id > 0) { + if (pMap) + { + disconnect(pMap, 0, this, SLOT(setImage(const QImage))); + disconnect(pMap, 0, this, SLOT(setHHLimit(int))); + pMap = 0; + } + chooseMap->setCurrentIndex(id); + } +} + +void HWMapContainer::setMap(const QString &map) +{ + intSetMap(map); + updatePreview(); +} + +void HWMapContainer::setTheme(const QString & theme) +{ + QModelIndexList mdl = themesModel->match(themesModel->index(0), Qt::DisplayRole, theme); + + if(mdl.size()) + lvThemes->setCurrentIndex(mdl.at(0)); +} + +void HWMapContainer::setRandomMap() +{ + setRandomSeed(); + switch(chooseMap->currentIndex()) + { + case MAPGEN_REGULAR: + case MAPGEN_MAZE: + setRandomTheme(); + break; + case MAPGEN_DRAWN: + emit drawMapRequested(); + break; + default: + if(chooseMap->currentIndex() <= numMissions + MAPGEN_MAP + 1) + setRandomMission(); + else + setRandomStatic(); + break; + } +} + +void HWMapContainer::setRandomStatic() +{ + int i = MAPGEN_MAP + 3 + numMissions + rand() % (chooseMap->count() - MAPGEN_MAP - 3 - numMissions); + chooseMap->setCurrentIndex(i); + mapChanged(i); +} + +void HWMapContainer::setRandomMission() +{ + int i = MAPGEN_MAP + 2 + rand() % numMissions; + chooseMap->setCurrentIndex(i); + mapChanged(i); +} + +void HWMapContainer::setRandomSeed() +{ + m_seed = QUuid::createUuid().toString(); + seedEdit->setText(m_seed); + emit seedChanged(m_seed); + if (chooseMap->currentIndex() < MAPGEN_MAP) + updatePreview(); +} + +void HWMapContainer::setRandomTheme() +{ + if(!themesModel->rowCount()) return; + quint32 themeNum = rand() % themesModel->rowCount(); + lvThemes->setCurrentIndex(themesModel->index(themeNum)); +} + +void HWMapContainer::intSetTemplateFilter(int filter) +{ + cbTemplateFilter->setCurrentIndex(filter); + emit newTemplateFilter(filter); +} + +void HWMapContainer::setTemplateFilter(int filter) +{ + intSetTemplateFilter(filter); + updatePreview(); +} + +MapGenerator HWMapContainer::get_mapgen(void) const +{ + return mapgen; +} + +int HWMapContainer::getMazeSize(void) const +{ + return cbMazeSize->currentIndex(); +} + +void HWMapContainer::intSetMazeSize(int size) +{ + cbMazeSize->setCurrentIndex(size); + emit mazeSizeChanged(size); +} + +void HWMapContainer::setMazeSize(int size) +{ + intSetMazeSize(size); + updatePreview(); +} + +void HWMapContainer::intSetMapgen(MapGenerator m) +{ + mapgen = m; + + if(m != MAPGEN_MAP) + chooseMap->setCurrentIndex(m); + + emit mapgenChanged(m); +} + +void HWMapContainer::setMapgen(MapGenerator m) +{ + intSetMapgen(m); + updatePreview(); +} + +void HWMapContainer::setDrawnMapData(const QByteArray & ar) +{ + drawMapScene.decode(ar); + updatePreview(); +} + +QByteArray HWMapContainer::getDrawnMapData() +{ + return drawMapScene.encode(); +} + +void HWMapContainer::seedEdited() +{ + if (seedLabel->isVisible() == false ) + { + seedLabel->setVisible(true); + seedEdit->setVisible(true); + seedSet->setText(tr("Set")); + return; + } + + if (seedEdit->text().isEmpty()) + seedEdit->setText(m_seed); + else + { + setSeed(seedEdit->text()); + emit seedChanged(seedEdit->text()); + } +} + +DrawMapScene * HWMapContainer::getDrawMapScene() +{ + return &drawMapScene; +} + +void HWMapContainer::mapDrawingFinished() +{ + emit drawnMapChanged(getDrawnMapData()); + + updatePreview(); +} + +void HWMapContainer::updatePreview() +{ + int curIndex = chooseMap->currentIndex(); + + switch(curIndex) + { + case MAPGEN_REGULAR: + askForGeneratedPreview(); + break; + case MAPGEN_MAZE: + askForGeneratedPreview(); + break; + case MAPGEN_DRAWN: + askForGeneratedPreview(); + break; + default: + QPixmap mapImage; + QFile tmpfile; + tmpfile.setFileName(cfgdir->absolutePath() + "/Data/Maps/" + chooseMap->itemData(curIndex).toList()[0].toString() + "/preview.png"); + if (!tmpfile.exists()) tmpfile.setFileName(datadir->absolutePath() + "/Maps/" + chooseMap->itemData(curIndex).toList()[0].toString() + "/preview.png"); + if(!mapImage.load(QFileInfo(tmpfile).absoluteFilePath())) { + imageButt->setIcon(QIcon()); + return; + } + + hhLimit = chooseMap->itemData(curIndex).toList()[2].toInt(); + addInfoToPreview(mapImage); + } +} + +void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl) +{ + intSetMap(map); + intSetMapgen(m); + intSetMazeSize(mazesize); + intSetSeed(seed); + intSetTemplateFilter(tmpl); + + updatePreview(); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/mapContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/mapContainer.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,128 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _HWMAP_CONTAINER_INCLUDED +#define _HWMAP_CONTAINER_INCLUDED + +#include +#include +#include +#include +#include +#include + +#include "hwmap.h" +#include "drawmapscene.h" + +class QPushButton; +class IconedGroupBox; +class QListView; + +class MapFileErrorException +{ +}; + +class HWMapContainer : public QWidget +{ + Q_OBJECT + + public: + HWMapContainer(QWidget * parent=0); + QString getCurrentSeed() const; + QString getCurrentMap() const; + QString getCurrentTheme() const; + int getCurrentHHLimit() const; + QString getCurrentScheme() const; + QString getCurrentWeapons() const; + quint32 getTemplateFilter() const; + MapGenerator get_mapgen(void) const; + int getMazeSize(void) const; + bool getCurrentIsMission() const; + QByteArray getDrawnMapData(); + DrawMapScene * getDrawMapScene(); + void mapDrawingFinished(); + QLineEdit* seedEdit; + + public slots: + void askForGeneratedPreview(); + void setSeed(const QString & seed); + void setMap(const QString & map); + void setTheme(const QString & theme); + void setTemplateFilter(int); + void setMapgen(MapGenerator m); + void setMazeSize(int size); + void setDrawnMapData(const QByteArray & ar); + void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl); + + signals: + void seedChanged(const QString & seed); + void mapChanged(const QString & map); + void themeChanged(const QString & theme); + void newTemplateFilter(int filter); + void mapgenChanged(MapGenerator m); + void mazeSizeChanged(int s); + void drawMapRequested(); + void drawnMapChanged(const QByteArray & data); + + private slots: + void setImage(const QImage newImage); + void setHHLimit(int hhLimit); + void mapChanged(int index); + void setRandomSeed(); + void setRandomTheme(); + void setRandomMap(); + void setRandomStatic(); + void setRandomMission(); + void themeSelected(const QModelIndex & current, const QModelIndex &); + void addInfoToPreview(QPixmap image); + void seedEdited(); + + protected: + virtual void resizeEvent ( QResizeEvent * event ); + + private: + QGridLayout mainLayout; + QPushButton* imageButt; + QComboBox* chooseMap; + IconedGroupBox* gbThemes; + QListView* lvThemes; + HWMap* pMap; + QString m_seed; + QPushButton* seedSet; + QLabel* seedLabel; + int hhLimit; + int templateFilter; + QPixmap hhSmall; + QLabel* lblFilter; + QComboBox* cbTemplateFilter; + QLabel *maze_size_label; + QComboBox *cbMazeSize; + MapGenerator mapgen; + int numMissions; + DrawMapScene drawMapScene; + + void intSetSeed(const QString & seed); + void intSetMap(const QString & map); + void intSetMapgen(MapGenerator m); + void intSetTemplateFilter(int); + void intSetMazeSize(int size); + void updatePreview(); +}; + +#endif // _HWMAP_CONTAINER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/selectWeapon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/selectWeapon.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,294 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "selectWeapon.h" +#include "weaponItem.h" +#include "hwconsts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QImage getAmmoImage(int num) +{ + static QImage ammo(":Ammos.png"); + int x = num/(ammo.height()/32); + int y = (num-((ammo.height()/32)*x))*32; + x*=32; + return ammo.copy(x, y, 32, 32); +} + +SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent) : + QWidget(parent) +{ + QHBoxLayout* hbLayout = new QHBoxLayout(this); + hbLayout->setSpacing(1); + hbLayout->setMargin(1); + + QLabel* lbl = new QLabel(this); + lbl->setPixmap(QPixmap::fromImage(getAmmoImage(iconNum))); + lbl->setMaximumWidth(30); + lbl->setGeometry(0, 0, 30, 30); + hbLayout->addWidget(lbl); + + item = new WeaponItem(image, imagegrey, this); + item->setItemsNum(wNum); + item->setInfinityState(allowInfinite); + hbLayout->addWidget(item); + + hbLayout->setStretchFactor(lbl, 1); + hbLayout->setStretchFactor(item, 99); + hbLayout->setAlignment(lbl, Qt::AlignLeft | Qt::AlignVCenter); + hbLayout->setAlignment(item, Qt::AlignLeft | Qt::AlignVCenter); +} + +void SelWeaponItem::setItemsNum(const unsigned char num) +{ + item->setItemsNum(num); +} + +unsigned char SelWeaponItem::getItemsNum() const +{ + return item->getItemsNum(); +} + +void SelWeaponItem::setEnabled(bool value) +{ + item->setEnabled(value); +} + +SelWeaponWidget::SelWeaponWidget(int numItems, QWidget* parent) : + QFrame(parent), + m_numItems(numItems) +{ + wconf = new QSettings(cfgdir->absolutePath() + "/weapons.ini", QSettings::IniFormat, this); + + for(int i = 0; i < cDefaultAmmos.size(); ++i) + wconf->setValue(cDefaultAmmos[i].first, cDefaultAmmos[i].second); + + QStringList keys = wconf->allKeys(); + for(int i = 0; i < keys.size(); i++) + { + if (wconf->value(keys[i]).toString().size() != cDefaultAmmoStore->size()) + wconf->remove(keys[i]); + } + + QString currentState = *cDefaultAmmoStore; + + QTabWidget * tbw = new QTabWidget(this); + QWidget * page1 = new QWidget(this); + p1Layout = new QGridLayout(page1); + p1Layout->setSpacing(1); + p1Layout->setMargin(1); + QWidget * page2 = new QWidget(this); + p2Layout = new QGridLayout(page2); + p2Layout->setSpacing(1); + p2Layout->setMargin(1); + QWidget * page3 = new QWidget(this); + p3Layout = new QGridLayout(page3); + p3Layout->setSpacing(1); + p3Layout->setMargin(1); + QWidget * page4 = new QWidget(this); + p4Layout = new QGridLayout(page4); + p4Layout->setSpacing(1); + p4Layout->setMargin(1); + + tbw->addTab(page1, tr("Weapon set")); + tbw->addTab(page2, tr("Probabilities")); + tbw->addTab(page4, tr("Ammo in boxes")); + tbw->addTab(page3, tr("Delays")); + + QGridLayout * pageLayout = new QGridLayout(this); + pageLayout->addWidget(tbw); + + + int j = -1; + int i = 0, k = 0; + for(; i < m_numItems; ++i) { + if (i == 6) continue; + if (i == 52) continue; // Disable structures for now + if (k % 4 == 0) ++j; + SelWeaponItem * swi = new SelWeaponItem(true, i, currentState[i].digitValue(), QImage(":/res/ammopic.png"), QImage(":/res/ammopicgrey.png"), this); + weaponItems[i].append(swi); + p1Layout->addWidget(swi, j, k % 4); + + SelWeaponItem * pwi = new SelWeaponItem(false, i, currentState[numItems + i].digitValue(), QImage(":/res/ammopicbox.png"), QImage(":/res/ammopicboxgrey.png"), this); + weaponItems[i].append(pwi); + p2Layout->addWidget(pwi, j, k % 4); + + SelWeaponItem * dwi = new SelWeaponItem(false, i, currentState[numItems*2 + i].digitValue(), QImage(":/res/ammopicdelay.png"), QImage(":/res/ammopicdelaygrey.png"), this); + weaponItems[i].append(dwi); + p3Layout->addWidget(dwi, j, k % 4); + + SelWeaponItem * awi = new SelWeaponItem(false, i, currentState[numItems*3 + i].digitValue(), QImage(":/res/ammopic.png"), QImage(":/res/ammopicgrey.png"), this); + weaponItems[i].append(awi); + p4Layout->addWidget(awi, j, k % 4); + + ++k; + } + + //pLayout->setRowStretch(5, 100); + m_name = new QLineEdit(this); + pageLayout->addWidget(m_name, i, 0, 1, 5); +} + +void SelWeaponWidget::setWeapons(const QString& ammo) +{ + bool enable = true; + for(int i = 0; i < cDefaultAmmos.size(); i++) + if (!cDefaultAmmos[i].first.compare(m_name->text())) { + enable = false; + } + for(int i = 0; i < m_numItems; ++i) { + twi::iterator it = weaponItems.find(i); + if (it == weaponItems.end()) continue; + it.value()[0]->setItemsNum(ammo[i].digitValue()); + it.value()[1]->setItemsNum(ammo[m_numItems + i].digitValue()); + it.value()[2]->setItemsNum(ammo[m_numItems*2 + i].digitValue()); + it.value()[3]->setItemsNum(ammo[m_numItems*3 + i].digitValue()); + it.value()[0]->setEnabled(enable); + it.value()[1]->setEnabled(enable); + it.value()[2]->setEnabled(enable); + it.value()[3]->setEnabled(enable); + } + m_name->setEnabled(enable); +} + +void SelWeaponWidget::setDefault() +{ + for(int i = 0; i < cDefaultAmmos.size(); i++) + if (!cDefaultAmmos[i].first.compare(m_name->text())) { + return; + } + setWeapons(*cDefaultAmmoStore); +} + +void SelWeaponWidget::save() +{ + for(int i = 0; i < cDefaultAmmos.size(); i++) + if (!cDefaultAmmos[i].first.compare(m_name->text())) { + QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not overwrite default weapon set '%1'!").arg(cDefaultAmmos[i].first)); + return; + } + + if (m_name->text() == "") return; + + QString state1; + QString state2; + QString state3; + QString state4; + + for(int i = 0; i < m_numItems; ++i) { + twi::const_iterator it = weaponItems.find(i); + int num = it == weaponItems.end() ? 9 : it.value()[0]->getItemsNum(); // 9 is for 'skip turn' + state1.append(QString::number(num)); + int prob = it == weaponItems.end() ? 0 : it.value()[1]->getItemsNum(); + state2.append(QString::number(prob)); + int del = it == weaponItems.end() ? 0 : it.value()[2]->getItemsNum(); + state3.append(QString::number(del)); + int am = it == weaponItems.end() ? 0 : it.value()[3]->getItemsNum(); + state4.append(QString::number(am)); + } + if (curWeaponsName != "") { + // remove old entry + wconf->remove(curWeaponsName); + } + wconf->setValue(m_name->text(), state1 + state2 + state3 + state4); + emit weaponsChanged(); +} + +int SelWeaponWidget::operator [] (unsigned int weaponIndex) const +{ + twi::const_iterator it = weaponItems.find(weaponIndex); + return it == weaponItems.end() ? 9 : it.value()[0]->getItemsNum(); +} + +QString SelWeaponWidget::getWeaponsString(const QString& name) const +{ + return wconf->value(name).toString(); +} + +void SelWeaponWidget::deleteWeaponsName() +{ + if (curWeaponsName == "") return; + + for(int i = 0; i < cDefaultAmmos.size(); i++) + if (!cDefaultAmmos[i].first.compare(m_name->text())) { + QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not delete default weapon set '%1'!").arg(cDefaultAmmos[i].first)); + return; + } + + QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Weapons"), QMessageBox::tr("Really delete this weapon set?"), QMessageBox::Ok | QMessageBox::Cancel); + + if (reallyDelete.exec() == QMessageBox::Ok) { + wconf->remove(curWeaponsName); + emit weaponsDeleted(); + } +} + +void SelWeaponWidget::newWeaponsName() +{ + QString newName = tr("new"); + if(wconf->contains(newName)) { + //name already used -> look for an appropriate name: + int i=2; + while(wconf->contains(newName = tr("new")+QString::number(i++))); + } + setWeaponsName(newName); +} + +void SelWeaponWidget::setWeaponsName(const QString& name) +{ + m_name->setText(name); + + curWeaponsName = name; + + if(name != "" && wconf->contains(name)) { + setWeapons(wconf->value(name).toString()); + } else { + setWeapons(*cDefaultAmmoStore); + } +} + +QStringList SelWeaponWidget::getWeaponNames() const +{ + return wconf->allKeys(); +} + +void SelWeaponWidget::copy() +{ + if(wconf->contains(curWeaponsName)) { + QString ammo = getWeaponsString(curWeaponsName); + QString newName = tr("copy of") + " " + curWeaponsName; + if(wconf->contains(newName)) { + //name already used -> look for an appropriate name: + int i=2; + while(wconf->contains(newName = tr("copy of") + " " + curWeaponsName+QString::number(i++))); + } + setWeaponsName(newName); + setWeapons(ammo); + } +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/selectWeapon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/selectWeapon.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,92 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _SELECT_WEAPON_INCLUDED +#define _SELECT_WEAPON_INCLUDED + +#include +#include +#include + +class QGridLayout; +class WeaponItem; +class QLineEdit; +class QSettings; + +class SelWeaponItem : public QWidget +{ + Q_OBJECT + +public: + SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent=0); + + unsigned char getItemsNum() const; + void setItemsNum(const unsigned char num); + void setEnabled(bool value); + + private: + WeaponItem* item; +}; + +class SelWeaponWidget : public QFrame +{ + Q_OBJECT + + public: + SelWeaponWidget(int numItems, QWidget* parent=0); + QString getWeaponsString(const QString& name) const; + QStringList getWeaponNames() const; + + public slots: + void setDefault(); + void setWeapons(const QString& ammo); + //sets the name of the current set + void setWeaponsName(const QString& name); + void deleteWeaponsName(); + void newWeaponsName(); + void save(); + void copy(); + + signals: + void weaponsChanged(); + void weaponsDeleted(); + + private: + //the name of the current weapon set + QString curWeaponsName; + + QLineEdit* m_name; + + //storage for all the weapons sets + QSettings* wconf; + + const int m_numItems; + int operator [] (unsigned int weaponIndex) const; + + typedef QList ItemsList; + typedef QMap twi; + twi weaponItems; + //layout element for each tab: + QGridLayout* p1Layout; + QGridLayout* p2Layout; + QGridLayout* p3Layout; + QGridLayout* p4Layout; +}; + +#endif // _SELECT_WEAPON_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/teamselect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/teamselect.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,281 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include + +#include +#include +#include +#include +#include + +#include "vertScrollArea.h" +#include "teamselect.h" +#include "teamselhelper.h" +#include "frameTeam.h" + +void TeamSelWidget::addTeam(HWTeam team) +{ + if(team.isNetTeam()) { + framePlaying->addTeam(team, true); + curPlayingTeams.push_back(team); + connect(framePlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), + this, SLOT(netTeamStatusChanged(const HWTeam&))); + connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)), + this, SLOT(hhNumChanged(const HWTeam&))); + dynamic_cast(framePlaying->getTeamWidget(team))->hhNumChanged(); + connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), + this, SLOT(proxyTeamColorChanged(const HWTeam&))); + } else { + frameDontPlaying->addTeam(team, false); + m_curNotPlayingTeams.push_back(team); + if(m_acceptOuter) { + connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), + this, SLOT(pre_changeTeamStatus(HWTeam))); + } else { + connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), + this, SLOT(changeTeamStatus(HWTeam))); + } + } + emit setEnabledGameStart(curPlayingTeams.size()>1); +} + +void TeamSelWidget::setInteractivity(bool interactive) +{ + framePlaying->setInteractivity(interactive); +} + +void TeamSelWidget::hhNumChanged(const HWTeam& team) +{ + QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); + if(itPlay==curPlayingTeams.end()) + { + qWarning() << QString("hhNumChanged: team '%1' not found").arg(team.name()); + return; + } + itPlay->setNumHedgehogs(team.numHedgehogs()); + emit hhogsNumChanged(team); +} + +void TeamSelWidget::proxyTeamColorChanged(const HWTeam& team) +{ + QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); + if(itPlay==curPlayingTeams.end()) + { + qWarning() << QString("proxyTeamColorChanged: team '%1' not found").arg(team.name()); + return; + } + itPlay->setColor(team.color()); + emit teamColorChanged(team); +} + +void TeamSelWidget::changeHHNum(const HWTeam& team) +{ + QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); + if(itPlay==curPlayingTeams.end()) + { + qWarning() << QString("changeHHNum: team '%1' not found").arg(team.name()); + return; + } + itPlay->setNumHedgehogs(team.numHedgehogs()); + + framePlaying->setHHNum(team); +} + +void TeamSelWidget::changeTeamColor(const HWTeam& team) +{ + QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); + if(itPlay==curPlayingTeams.end()) + { + qWarning() << QString("changeTeamColor: team '%1' not found").arg(team.name()); + return; + } + itPlay->setColor(team.color()); + + framePlaying->setTeamColor(team); +} + +void TeamSelWidget::removeNetTeam(const HWTeam& team) +{ + //qDebug() << QString("removeNetTeam: removing team '%1'").arg(team.TeamName); + for(;;) { + QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); + if(itPlay==curPlayingTeams.end()) + { + qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name()); + break; + } + if(itPlay->isNetTeam()) { + QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam))); + framePlaying->removeTeam(team); + curPlayingTeams.erase(itPlay); + break; + } + } + emit setEnabledGameStart(curPlayingTeams.size()>1); +} + +void TeamSelWidget::netTeamStatusChanged(const HWTeam& team) +{ + QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); + +} + +//void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team) +//{ + //curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team)); +//} + +void TeamSelWidget::changeTeamStatus(HWTeam team) +{ + QList::iterator itDontPlay=std::find(m_curNotPlayingTeams.begin(), m_curNotPlayingTeams.end(), team); + QList::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); + + bool willBePlaying=itDontPlay!=m_curNotPlayingTeams.end(); + + if(!willBePlaying) { + // playing team => dont playing + m_curNotPlayingTeams.push_back(*itPlay); + emit teamNotPlaying(*itPlay); + curPlayingTeams.erase(itPlay); + } else { + // return if max playing teams reached + if(framePlaying->isFullTeams()) return; + // dont playing team => playing + team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network) + itDontPlay->setColor(framePlaying->getNextColor()); + curPlayingTeams.push_back(*itDontPlay); + if(!m_acceptOuter) emit teamWillPlay(*itDontPlay); + m_curNotPlayingTeams.erase(itDontPlay); + } + + FrameTeams* pRemoveTeams; + FrameTeams* pAddTeams; + if(!willBePlaying) { + pRemoveTeams=framePlaying; + pAddTeams=frameDontPlaying; + } else { + pRemoveTeams=frameDontPlaying; + pAddTeams=framePlaying; + } + + pAddTeams->addTeam(team, willBePlaying); + pRemoveTeams->removeTeam(team); + if(!team.isNetTeam() && m_acceptOuter && !willBePlaying) { + connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), + this, SLOT(pre_changeTeamStatus(HWTeam))); + } else { + connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), + this, SLOT(changeTeamStatus(HWTeam))); + } + if(willBePlaying) { + connect(framePlaying->getTeamWidget(team), SIGNAL(hhNmChanged(const HWTeam&)), + this, SLOT(hhNumChanged(const HWTeam&))); + dynamic_cast(framePlaying->getTeamWidget(team))->hhNumChanged(); + connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), + this, SLOT(proxyTeamColorChanged(const HWTeam&))); + emit teamColorChanged(((TeamShowWidget*)framePlaying->getTeamWidget(team))->getTeam()); + } + + QSize szh=pAddTeams->sizeHint(); + QSize szh1=pRemoveTeams->sizeHint(); + if(szh.isValid() && szh1.isValid()) { + pAddTeams->resize(pAddTeams->size().width(), szh.height()); + pRemoveTeams->resize(pRemoveTeams->size().width(), szh1.height()); + } + + emit setEnabledGameStart(curPlayingTeams.size()>1); +} + +void TeamSelWidget::addScrArea(FrameTeams* pfteams, QColor color, int fixedHeight) +{ + VertScrArea* area = new VertScrArea(color); + area->setWidget(pfteams); + mainLayout.addWidget(area, 30); + if (fixedHeight > 0) + { + area->setMinimumHeight(fixedHeight); + area->setMaximumHeight(fixedHeight); + area->setStyleSheet( + "FrameTeams{" + "border: solid;" + "border-width: 1px;" + "border-radius: 16px;" + "border-color: #ffcc00;" + "}" + ); + } +} + +TeamSelWidget::TeamSelWidget(QWidget* parent) : + QGroupBox(parent), mainLayout(this), m_acceptOuter(false) +{ + setTitle(QGroupBox::tr("Playing teams")); + framePlaying = new FrameTeams(); + frameDontPlaying = new FrameTeams(); + + QPalette p; + p.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); + addScrArea(framePlaying, p.color(QPalette::Window).light(105), 250); + addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105), 0); +} + +void TeamSelWidget::setAcceptOuter(bool acceptOuter) +{ + m_acceptOuter=acceptOuter; +} + +void TeamSelWidget::resetPlayingTeams(const QList& teamslist) +{ + //for(it=curPlayingTeams.begin(); it!=curPlayingTeams.end(); it++) { + //framePlaying->removeTeam(*it); + //} + framePlaying->resetTeams(); + framePlaying->resetColors(); + curPlayingTeams.clear(); + //for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) { + //frameDontPlaying->removeTeam(*it); + //} + frameDontPlaying->resetTeams(); + m_curNotPlayingTeams.clear(); + + foreach(HWTeam team, teamslist) + addTeam(team); +} + +bool TeamSelWidget::isPlaying(HWTeam team) const +{ + return std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team)!=curPlayingTeams.end(); +} + +QList TeamSelWidget::getPlayingTeams() const +{ + return curPlayingTeams; +} + +QList TeamSelWidget::getNotPlayingTeams() const +{ + return m_curNotPlayingTeams; +} + +void TeamSelWidget::pre_changeTeamStatus(HWTeam team) +{ + team.setColor(framePlaying->getNextColor()); + emit acceptRequested(team); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/teamselect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/teamselect.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,83 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _TEAM_SELECT_INCLUDED +#define _TEAM_SELECT_INCLUDED + +#include +#include +#include +#include + +#include "team.h" + +class TeamSelWidget; +class FrameTeams; +class QFrame; +class QPushButton; + +using namespace std; + +class TeamSelWidget : public QGroupBox +{ + Q_OBJECT + + public: + TeamSelWidget(QWidget* parent); + void setAcceptOuter(bool acceptOuter); + void removeNetTeam(const HWTeam& team); + void resetPlayingTeams(const QList& teamslist); + bool isPlaying(HWTeam team) const; + QList getPlayingTeams() const; + QList getNotPlayingTeams() const; + void setInteractivity(bool interactive); + + public slots: + void addTeam(HWTeam team); + void netTeamStatusChanged(const HWTeam& team); + void changeHHNum(const HWTeam&); + void changeTeamColor(const HWTeam&); + void changeTeamStatus(HWTeam team); + + signals: + void setEnabledGameStart(bool); + void teamWillPlay(HWTeam team); + void teamNotPlaying(const HWTeam& team); + void hhogsNumChanged(const HWTeam&); + void teamColorChanged(const HWTeam&); + void acceptRequested(HWTeam team); + + private slots: + void pre_changeTeamStatus(HWTeam); + void hhNumChanged(const HWTeam& team); + void proxyTeamColorChanged(const HWTeam& team); + + private: + void addScrArea(FrameTeams* pfteams, QColor color, int maxHeight); + FrameTeams* frameDontPlaying; + FrameTeams* framePlaying; + + QVBoxLayout mainLayout; + bool m_acceptOuter; + + QList curPlayingTeams; + QList m_curNotPlayingTeams; +}; + +#endif // _TEAM_SELECT_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/teamselhelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/teamselhelper.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,154 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include + +#include + +#include "teamselhelper.h" +#include "hwconsts.h" +#include "frameTeam.h" + +void TeamLabel::teamButtonClicked() +{ + emit teamActivated(text()); +} + +TeamShowWidget::TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent) : + QWidget(parent), mainLayout(this), m_team(team), m_isPlaying(isPlaying), phhoger(0), + colorButt(0) +{ + QPalette newPalette = palette(); + newPalette.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); + setPalette(newPalette); + setAutoFillBackground(true); + + mainLayout.setSpacing(3); + mainLayout.setMargin(0); + this->setMaximumHeight(38); + this->setMinimumHeight(38); + QIcon difficultyIcon=team.isNetTeam() ? + QIcon(QString(":/res/botlevels/net%1.png").arg(m_team.difficulty())) + : QIcon(QString(":/res/botlevels/%1.png").arg(m_team.difficulty())); + + butt = new QPushButton(difficultyIcon, team.name().replace("&","&&"), this); + butt->setFlat(true); + butt->setToolTip(team.owner()); + mainLayout.addWidget(butt); + butt->setStyleSheet("QPushButton{" + "icon-size: 48px;" + "text-align: left;" + "background-color: #0d0544;" + "color: orange;" + "font: bold;" + "border-width: 2px;" + "margin: 6px 0px 6px 0px;" + "}"); + + if(m_isPlaying) { + // team color + colorButt = new QPushButton(this); + colorButt->setMaximumWidth(26); + colorButt->setMinimumHeight(26); + colorButt->setGeometry(0, 0, 26, 26); + + changeTeamColor(); + connect(colorButt, SIGNAL(clicked()), this, SLOT(changeTeamColor())); + mainLayout.addWidget(colorButt); + + phhoger = new CHedgehogerWidget(QImage(":/res/hh25x25.png"), QImage(":/res/hh25x25grey.png"), this); + connect(phhoger, SIGNAL(hedgehogsNumChanged()), this, SLOT(hhNumChanged())); + phhoger->setHHNum(team.numHedgehogs()); + mainLayout.addWidget(phhoger); + } else { + } + + QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam())); + //QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam())); +} + +void TeamShowWidget::setInteractivity(bool interactive) +{ + if(m_team.isNetTeam()) { + butt->setEnabled(interactive); + } + + colorButt->setEnabled(interactive); + phhoger->setEnabled(interactive); +} + +void TeamShowWidget::setHHNum(unsigned int num) +{ + phhoger->setHHNum(num); +} + +void TeamShowWidget::hhNumChanged() +{ + m_team.setNumHedgehogs(phhoger->getHedgehogsNum()); + emit hhNmChanged(m_team); +} + +void TeamShowWidget::activateTeam() +{ + emit teamStatusChanged(m_team); +} + +/*HWTeamTempParams TeamShowWidget::getTeamParams() const +{ + if(!phhoger) throw; + HWTeamTempParams params; + params.numHedgehogs=phhoger->getHedgehogsNum(); + params.teamColor=colorButt->palette().color(QPalette::Button); + return params; +}*/ + +void TeamShowWidget::changeTeamColor(QColor color) +{ + FrameTeams* pOurFrameTeams=dynamic_cast(parentWidget()); + if(!color.isValid()) { + if(++pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) { + pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin(); + } + color=*pOurFrameTeams->currentColor; + } else { + // set according color iterator + pOurFrameTeams->currentColor=std::find(pOurFrameTeams->availableColors.begin(), + pOurFrameTeams->availableColors.end(), color); + if(pOurFrameTeams->currentColor==pOurFrameTeams->availableColors.end()) { + // error condition + pOurFrameTeams->currentColor=pOurFrameTeams->availableColors.begin(); + } + } + + colorButt->setStyleSheet(QString("QPushButton{" + "background-color: %1;" + "border-width: 1px;" + "border-radius: 2px;" + "}").arg(pOurFrameTeams->currentColor->name())); + + m_team.setColor(color); + emit teamColorChanged(m_team); +} + +HWTeam TeamShowWidget::getTeam() const +{ + return m_team; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/teamselhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/teamselhelper.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,80 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _TEAMSEL_HELPER_INCLUDED +#define _TEAMSEL_HELPER_INCLUDED + +#include +#include +#include +#include + +#include "teamselect.h" +#include "hedgehogerWidget.h" + +class TeamLabel : public QLabel +{ + Q_OBJECT + + public: + TeamLabel(const QString& inp_str) : QLabel(inp_str) {}; + + signals: + void teamActivated(QString team_name); + + public slots: + void teamButtonClicked(); + +}; + +class TeamShowWidget : public QWidget +{ + Q_OBJECT + + public slots: + void changeTeamColor(QColor color=QColor()); + void hhNumChanged(); + + private slots: + void activateTeam(); + + public: + TeamShowWidget(HWTeam team, bool isPlaying, QWidget * parent); + void setPlaying(bool isPlaying); + void setHHNum(unsigned int num); + void setInteractivity(bool interactive); + HWTeam getTeam() const; + + private: + TeamShowWidget(); + QHBoxLayout mainLayout; + HWTeam m_team; + bool m_isPlaying; + CHedgehogerWidget* phhoger; + QPushButton* colorButt; + QPushButton* butt; +// QPushButton* bText; + + signals: + void teamStatusChanged(HWTeam team); + void hhNmChanged(const HWTeam&); + void teamColorChanged(const HWTeam&); +}; + +#endif // _TEAMSEL_HELPER_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/togglebutton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/togglebutton.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,52 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2009 Kristian Lehmann + * Copyright (c) 2009-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "togglebutton.h" + +ToggleButtonWidget::ToggleButtonWidget(QWidget * parent, QString img) + : QPushButton(parent) +{ + setCheckable(true); + + QPixmap pm(":/res/btnDisabled.png"); + QPainter * painter = new QPainter(); + + pmChecked.load(img); + pmDisabled.load(img); + + setMaximumWidth(pmChecked.width() + 6); + + painter->begin(&pmDisabled); + painter->drawPixmap(pmDisabled.rect(), pm); + painter->end(); + + setIconSize(pmDisabled.size()); + setIcon(pmDisabled); + + connect(this, SIGNAL(toggled(bool)), this, SLOT(eventToggled(bool))); +} + +ToggleButtonWidget::~ToggleButtonWidget() +{ +} + +void ToggleButtonWidget::eventToggled(bool checked) +{ + setIcon(checked ? pmChecked : pmDisabled); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/togglebutton.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/togglebutton.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,42 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2009 Kristian Lehmann + * Copyright (c) 2009-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef TOGGLEBUTTONWIDGET_H +#define TOGGLEBUTTONWIDGET_H + +#include +#include +#include +#include +#include + +class ToggleButtonWidget : public QPushButton +{ + Q_OBJECT +public: + ToggleButtonWidget(QWidget * parent, QString img); + ~ToggleButtonWidget(); +private: + QPixmap pmChecked; + QPixmap pmDisabled; +private slots: + void eventToggled(bool checked); +}; + +#endif // TOGGLEBUTTONWIDGET_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/vertScrollArea.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/vertScrollArea.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,35 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006 Igor Ulyanov + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "vertScrollArea.h" + +#include + +VertScrArea::VertScrArea(QColor frameColor, QWidget * parent) : + QScrollArea(parent) +{ + QPalette newPalette = palette(); + newPalette.setColor(QPalette::Background, frameColor); + setPalette(newPalette); +} + +void VertScrArea::resizeEvent(QResizeEvent * event) +{ + widget()->resize(event->size().width(), widget()->sizeHint().height()); +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/vertScrollArea.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/vertScrollArea.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,36 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006 Igor Ulyanov + * Copyright (c) 2006-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _VERT_SCROLL_AREA_INCLUDED +#define _VERT_SCROLL_AREA_INCLUDED + +#include + +class VertScrArea : public QScrollArea +{ + Q_OBJECT + +public: + VertScrArea(QColor frameColor, QWidget * parent = 0); + +protected: + virtual void resizeEvent(QResizeEvent * event); +}; + +#endif // _VERT_SCROLL_AREA_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/weaponItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/weaponItem.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,40 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "weaponItem.h" + +WeaponItem::WeaponItem(const QImage& im, const QImage& img, QWidget * parent) : + ItemNum(im, img, parent, 0) +{ +} + +WeaponItem::~WeaponItem() +{ +} + +void WeaponItem::incItems() +{ + ++numItems; +} + +void WeaponItem::decItems() +{ + --numItems; +} + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui/widget/weaponItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/ui/widget/weaponItem.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,44 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2008 Igor Ulyanov + * Copyright (c) 2008-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef _WEAPON_ITEM +#define _WEAPON_ITEM + +#include "itemNum.h" + +class WeaponItem : public ItemNum +{ + Q_OBJECT + + public: + WeaponItem(const QImage& im, const QImage& img, QWidget * parent); + virtual ~WeaponItem(); + + signals: + void hedgehogsNumChanged(); + + protected: + virtual void incItems(); + virtual void decItems(); + + private: + WeaponItem(); +}; + +#endif // _WEAPON_ITEM diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/ui_hwform.cpp --- a/QTfrontend/ui_hwform.cpp Fri Oct 28 18:27:55 2011 +0200 +++ b/QTfrontend/ui_hwform.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -76,7 +76,7 @@ { Pages = new QStackedLayout(Parent); - pageEditTeam = new PageEditTeam(Parent, &HWForm->sdli); + pageEditTeam = new PageEditTeam(Parent); Pages->addWidget(pageEditTeam); pageOptions = new PageOptions(); @@ -91,7 +91,7 @@ pageNet = new PageNet(); Pages->addWidget(pageNet); - pageNetGame = new PageNetGame(Parent, HWForm->gameSettings, &HWForm->sdli); + pageNetGame = new PageNetGame(Parent, HWForm->gameSettings); Pages->addWidget(pageNetGame); pageInfo = new PageInfo(); @@ -118,7 +118,7 @@ pageInGame = new PageInGame(); Pages->addWidget(pageInGame); - pageRoomsList = new PageRoomsList(Parent, HWForm->gameSettings, &HWForm->sdli); + pageRoomsList = new PageRoomsList(Parent, HWForm->gameSettings); Pages->addWidget(pageRoomsList); pageConnecting = new PageConnecting(); diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/util/HWDataManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/util/HWDataManager.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,117 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief HWDataManager class implementation + */ + +#include +#include + +#include + +#include "hwconsts.h" + +#include "HWDataManager.h" + + +HWDataManager::HWDataManager() +{ + userData = new QDir(cfgdir->absolutePath()); + if (!userData->cd("Data")) + userData = NULL; + + defaultData = new QDir(datadir->absolutePath()); +} + + +HWDataManager & HWDataManager::instance() +{ + static HWDataManager instance; + return instance; +} + + +QStringList HWDataManager::entryList( + const QString & subDirectory, + QDir::Filters filters, + const QStringList & nameFilters + ) const +{ + QStringList result; + + if (userData != NULL) + { + QDir tmpDir(*userData); + if (tmpDir.cd(subDirectory)) + result.append(tmpDir.entryList(nameFilters, filters)); + } + + QDir tmpDir(*defaultData); + if (tmpDir.cd(subDirectory)) + result.append(tmpDir.entryList(nameFilters, filters)); + + result.removeDuplicates(); + + // sort case-insensitive + QMap sortedFileNames; + foreach ( QString fn, result) + { + sortedFileNames.insert(fn.toLower(), fn); + } + result = sortedFileNames.values(); + + return result; +} + + +QString HWDataManager::findFileForRead( + const QString & relativeDataFilePath) const +{ + QString path; + + if (userData != NULL) + path = userData->absolutePath()+"/"+relativeDataFilePath; + + if ((!path.isEmpty()) && (!QFile::exists(path))) + path = defaultData->absolutePath()+"/"+relativeDataFilePath; + + return path; +} + + +QString HWDataManager::findFileForWrite( + const QString & relativeDataFilePath) const +{ + if (userData != NULL) + { + QString path = userData->absolutePath()+"/"+relativeDataFilePath; + + // create folders if needed + QDir tmp; + tmp.mkpath(QFileInfo(path).absolutePath()); + + return path; + } + + + return ""; +} + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/util/HWDataManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/util/HWDataManager.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,107 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2006-2007 Igor Ulyanov + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief HWDataManager class definition + */ + +#ifndef HEDGEWARS_HWDATAMANAGER_H +#define HEDGEWARS_HWDATAMANAGER_H + +#include +#include + +#include + +class QDir; +class QFile; +class QStringList; + +/** + * @brief Offers access to the data files of hedgewars. + * + * @see singleton pattern + * + * @author sheepluva + * @since 0.9.17 + */ +class HWDataManager +{ +public: + /** + * @brief Returns reference to the singleton instance of this class. + * + * @see singleton pattern + * + * @return reference to the instance. + */ + static HWDataManager & instance(); + + /** + * @brief Returns a sorted list of data directory entries. + * + * @param subDirectory sub-directory to search. + * @param filters filters for entry type. + * @param nameFilters filters by name patterns. + * @return a sorted list of matches in the subDirectory of data directory. + */ + QStringList entryList(const QString & subDirectory, + QDir::Filters filters = QDir::NoFilter, + const QStringList & nameFilters = QStringList("*") + ) const; + + /** + * @brief Returns the path for the desires data file. + * + * Use this method if you want to read an existing data file. + * + * @param relativeDataFilePath relative path of the data file. + * @return real path to the file. + */ + QString findFileForRead(const QString & relativeDataFilePath) const; + + + /** + * @brief Returns the path for the data file that is to be written. + * + * Use this method if you want to create or write into a data file. + * + * @param relativeDataFilePath relative path of data file write path. + * @return destination of path data file. + */ + QString findFileForWrite(const QString & relativeDataFilePath) const; + + +private: + /** + * @brief Class constructor of the singleton. + * + * Not to be used from outside the class, + * use the static {@link HWDataManager::instance()} instead. + * + * @see singleton pattern + */ + HWDataManager(); + + QDir * defaultData; ///< directory of the installed data + QDir * userData; ///< directory of custom data in the user's directory +}; + +#endif // HEDGEWARS_HWDATAMANAGER_H diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/util/SDLInteraction.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/util/SDLInteraction.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,248 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief SDLInteraction class implementation + */ + +#include "SDL.h" +#include "SDL_mixer.h" + +#include "HWApplication.h" + +#include "SDLInteraction.h" + +extern char sdlkeys[1024][2][128]; +extern char xb360buttons[][128]; +extern char xb360dpad[128]; +extern char xbox360axes[][128]; + + +SDLInteraction & SDLInteraction::instance() +{ + static SDLInteraction instance; + return instance; +} + + +SDLInteraction::SDLInteraction() +{ + + SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK); + + m_audioInitialized = false; + m_music = NULL; + m_musicTrack = ""; + m_isPlayingMusic = false; + if(SDL_NumJoysticks()) + addGameControllerKeys(); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + + m_soundMap = new QMap(); +} + + +SDLInteraction::~SDLInteraction() +{ + stopMusic(); + if (m_audioInitialized) + { + if (m_music != NULL) + Mix_FreeMusic(m_music); + Mix_CloseAudio(); + } + SDL_Quit(); + + delete m_soundMap; +} + + +QStringList SDLInteraction::getResolutions() const +{ + QStringList result; + + SDL_Rect **modes; + + modes = SDL_ListModes(NULL, SDL_FULLSCREEN); + + if((modes == (SDL_Rect **)0) || (modes == (SDL_Rect **)-1)) + { + result << "640x480"; + } else + { + for(int i = 0; modes[i]; ++i) + if ((modes[i]->w >= 640) && (modes[i]->h >= 480)) + result << QString("%1x%2").arg(modes[i]->w).arg(modes[i]->h); + } + + return result; +} + + +void SDLInteraction::addGameControllerKeys() const +{ + QStringList result; + + int i = 0; + while(i < 1024 && sdlkeys[i][1][0] != '\0') + i++; + + // Iterate through all game controllers + for(int jid = 0; jid < SDL_NumJoysticks(); jid++) + { + SDL_Joystick* joy = SDL_JoystickOpen(jid); + + // Retrieve the game controller's name and strip "Controller (...)" that's added by some drivers (English only) + QString joyname = QString(SDL_JoystickName(jid)).replace(QRegExp("^Controller \\((.*)\\)$"), "\\1"); + + // Connected Xbox 360 controller? Use specific button names then + // Might be interesting to add 'named' buttons for the most often used gamepads + bool isxb = joyname.contains("Xbox 360"); + + // This part of the string won't change for multiple keys/hats, so keep it + QString prefix = QString("%1 (%2): ").arg(joyname).arg(jid + 1); + + // Register entries for missing axes not assigned to sticks of this joystick/gamepad + for(int aid = 0; aid < SDL_JoystickNumAxes(joy) && i < 1021; aid++) + { + // Again store the part of the string not changing for multiple uses + QString axis = prefix + HWApplication::translate("binds (keys)", "Axis") + QString(" %1 ").arg(aid + 1); + + // Entry for "Axis Up" + sprintf(sdlkeys[i][0], "j%da%du", jid, aid); + sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2])) : axis + HWApplication::translate("binds (keys)", "(Up)")).toUtf8().constData()); + + // Entry for "Axis Down" + sprintf(sdlkeys[i][0], "j%da%dd", jid, aid); + sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2 + 1])) : axis + HWApplication::translate("binds (keys)", "(Down)")).toUtf8().constData()); + } + + // Register entries for all coolie hats of this joystick/gamepad + for(int hid = 0; hid < SDL_JoystickNumHats(joy) && i < 1019; hid++) + { + // Again store the part of the string not changing for multiple uses + QString hat = prefix + (isxb ? (HWApplication::translate("binds (keys)", xb360dpad) + QString(" ")) : HWApplication::translate("binds (keys)", "Hat") + QString(" %1 ").arg(hid + 1)); + + // Entry for "Hat Up" + sprintf(sdlkeys[i][0], "j%dh%du", jid, hid); + sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Up)")).toUtf8().constData()); + + // Entry for "Hat Down" + sprintf(sdlkeys[i][0], "j%dh%dd", jid, hid); + sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Down)")).toUtf8().constData()); + + // Entry for "Hat Left" + sprintf(sdlkeys[i][0], "j%dh%dl", jid, hid); + sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Left)")).toUtf8().constData()); + + // Entry for "Hat Right" + sprintf(sdlkeys[i][0], "j%dh%dr", jid, hid); + sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Right)")).toUtf8().constData()); + } + + // Register entries for all buttons of this joystick/gamepad + for(int bid = 0; bid < SDL_JoystickNumButtons(joy) && i < 1022; bid++) + { + // Buttons + sprintf(sdlkeys[i][0], "j%db%d", jid, bid); + sprintf(sdlkeys[i++][1], "%s", (prefix + ((isxb && bid < 10) ? (HWApplication::translate("binds (keys)", xb360buttons[bid]) + QString(" ")) : HWApplication::translate("binds (keys)", "Button") + QString(" %1").arg(bid + 1))).toUtf8().constData()); + } + // Close the game controller as we no longer need it + SDL_JoystickClose(joy); + } + + // Terminate the list + sdlkeys[i][0][0] = '\0'; + sdlkeys[i][1][0] = '\0'; +} + + +void SDLInteraction::SDLAudioInit() +{ + // don't init again + if (m_audioInitialized) + return; + + SDL_Init(SDL_INIT_AUDIO); + Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024); + m_audioInitialized = true; +} + + +void SDLInteraction::playSoundFile(const QString & soundFile) +{ + SDLAudioInit(); + if (!m_soundMap->contains(soundFile)) + m_soundMap->insert(soundFile, Mix_LoadWAV(soundFile.toLocal8Bit().constData())); + + Mix_PlayChannel(-1, m_soundMap->value(soundFile), 0); +} + + +void SDLInteraction::setMusicTrack(const QString & musicFile) +{ + bool wasPlayingMusic = m_isPlayingMusic; + + stopMusic(); + + if (m_music != NULL) + { + Mix_FreeMusic(m_music); + m_music = NULL; + } + + m_musicTrack = musicFile; + + if (wasPlayingMusic) + startMusic(); +} + + +void SDLInteraction::startMusic() +{ + if (m_isPlayingMusic) + return; + + m_isPlayingMusic = true; + + if (m_musicTrack.isEmpty()) + return; + + SDLAudioInit(); + + if (m_music == NULL) + m_music = Mix_LoadMUS(m_musicTrack.toLocal8Bit().constData()); + + Mix_VolumeMusic(MIX_MAX_VOLUME - 28); + Mix_FadeInMusic(m_music, -1, 1750); +} + + +void SDLInteraction::stopMusic() +{ + if (m_isPlayingMusic && (m_music != NULL)) { + // fade out music to finish 0,5 seconds from now + while(!Mix_FadeOutMusic(1000) && Mix_PlayingMusic()) { + SDL_Delay(100); + } + } + + m_isPlayingMusic = false; +} + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/util/SDLInteraction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/util/SDLInteraction.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,108 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2007-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/** + * @file + * @brief SDLInteraction class definition + */ + +#ifndef HEDGEWARS_SDLINTERACTION_H +#define HEDGEWARS_SDLINTERACTION_H + + +#include +#include + +#include "SDL_mixer.h" + +/** + * @brief Class for interacting with SDL (used for music and keys) + * + * @see singleton pattern + */ +class SDLInteraction +{ + +private: + /** + * @brief Class constructor of the singleton. + * + * Not to be used from outside the class, + * use the static {@link HWDataManager::instance()} instead. + * + * @see singleton pattern + */ + SDLInteraction(); + + /// Initializes SDL for sound output if needed. + void SDLAudioInit(); + + bool m_audioInitialized; ///< true if audio is initialized already + Mix_Music * m_music; ///< pointer to the music channel of the mixer + QString m_musicTrack; ///< path to the music track; + bool m_isPlayingMusic; ///< true if music was started but not stopped again. + + QMap * m_soundMap; ///< maps sound file paths to channels + +public: + /** + * @brief Returns reference to the singleton instance of this class. + * + * @see singleton pattern + * + * @return reference to the instance. + */ + static SDLInteraction & instance(); + + /// Class Destructor. + ~SDLInteraction(); + + /** + * @brief Returns available (screen) resolutions. + * + * @return list of resolutions in the format WIDTHxHEIGHT. + */ + QStringList getResolutions() const; + + /// Adds all available joystick controlls to the list of SDL keys. + void addGameControllerKeys() const; + + /** + * @brief Plays a sound file. + * + * @param soundFile path of the sound file. + */ + void playSoundFile(const QString & soundFile); + + /** + * @brief Sets the music track to be played (or not). + * + * @param musicFile path of the music file. + */ + void setMusicTrack(const QString & musicFile); + + /// Starts the background music if not already playing. + void startMusic(); + + /// Fades out and stops the background music (if playing). + void stopMusic(); +}; + + +#endif //HEDGEWARS_SDLINTERACTION_H + diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/util/namegen.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/util/namegen.cpp Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,283 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2009 Martin Minarik + * Copyright (c) 2009-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include + +#include "hwform.h" +#include "HWDataManager.h" + +#include "namegen.h" + +HWNamegen::HWNamegen() {} + +QList HWNamegen::TypesTeamnames; +QList HWNamegen::TypesHatnames; +bool HWNamegen::typesAvailable = false; + + +void HWNamegen::teamRandomNames(HWTeam & team, const bool changeteamname) +{ + // load types if not already loaded + if (!typesAvailable) + if (!loadTypes()) + return; // abort if loading failed + + // abort if there are no hat types + if (TypesHatnames.size() <= 0) + return; + + // the hat will influence which names the hogs get + int kind = (rand()%(TypesHatnames.size())); + + // pick team name based on hat + if (changeteamname) + { + if (TypesTeamnames[kind].size() > 0) + team.setName(TypesTeamnames[kind][rand()%(TypesTeamnames[kind].size())]); + + team.setGrave(getRandomGrave()); + team.setFort(getRandomFort()); + team.setVoicepack("Default"); + } + + QStringList dicts; + QStringList dict; + + if ((TypesHatnames[kind].size()) <= 0) + { + dicts = dictsForHat(team.hedgehog(0).Hat); + dict = dictContents(dicts[rand()%(dicts.size())]); + } + + for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) + { + if ((TypesHatnames[kind].size()) > 0) + { + HWHog hh = team.hedgehog(i); + hh.Hat = TypesHatnames[kind][rand()%(TypesHatnames[kind].size())]; + team.setHedgehog(i,hh); + } + + // there is a chance that this hog has the same hat as the previous one + // let's reuse the hat-specific dict in this case + if ((i == 0) or (team.hedgehog(i).Hat != team.hedgehog(i-1).Hat)) + { + dicts = dictsForHat(team.hedgehog(i).Hat); + dict = dictContents(dicts[rand()%(dicts.size())]); + } + + // give each hedgehog a random name + HWNamegen::teamRandomName(team,i,dict); + } + +} + +void HWNamegen::teamRandomName(HWTeam & team, const int HedgehogNumber) +{ + QStringList dicts = dictsForHat(team.hedgehog(HedgehogNumber).Hat); + + QStringList dict = dictContents(dicts[rand()%(dicts.size())]); + + teamRandomName(team, HedgehogNumber, dict); +} + +void HWNamegen::teamRandomName(HWTeam & team, const int HedgehogNumber, const QStringList & dict) +{ + QStringList namesDict = dict; + + for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) + { + namesDict.removeOne(team.hedgehog(i).Name); + } + + // if our dict doesn't have any new names we'll have to use duplicates + if (namesDict.size() < 1) + namesDict = dict; + + HWHog hh = team.hedgehog(HedgehogNumber); + + hh.Name = namesDict[rand()%(namesDict.size())]; + + team.setHedgehog(HedgehogNumber, hh); +} + +QStringList HWNamegen::dictContents(const QString filename) +{ + QStringList list; + + // find .txt to load the names from + QFile * file = new QFile(HWDataManager::instance().findFileForRead(QString( + "Names/%1.txt").arg(filename))); + + if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text)) + { + QTextStream in(file); + while (!in.atEnd()) + { + QString line = in.readLine(); + if(!line.isEmpty()) + list.append(line); + } + } + + // this QFile isn't needed any further + delete file; + + if (list.size() == 0) + list.append(filename); + + return list; +} + + +QStringList HWNamegen::dictsForHat(const QString hatname) +{ + QStringList list; + + // find .cfg to load the dicts from + QFile * file = new QFile(HWDataManager::instance().findFileForRead(QString( + "Names/%1.cfg").arg(hatname))); + + if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text)) + { + QTextStream in(file); + while (!in.atEnd()) + { + QString line = in.readLine(); + if(!line.isEmpty()) + list.append(line); + } + } + + // this QFile isn't needed any further + delete file; + + if (list.size() == 0) + list.append(QString("generic")); + + return list; +} + +// loades types from ini files. returns true on success. +bool HWNamegen::loadTypes() +{ + typesAvailable = false; + + // find .ini to load the names from + QFile * file = new QFile( + HWDataManager::instance().findFileForRead(QString("Names/types.ini"))); + + + if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text)) + { + + int counter = 0; //counter starts with 0 (teamnames mode) + TypesTeamnames.append(QStringList()); + TypesHatnames.append(QStringList()); + + QTextStream in(file); + while (!in.atEnd()) + { + QString line = in.readLine(); + if (line == QString("#####")) + { + counter++; //toggle mode (teamnames || hats) + if ((counter%2) == 0) + { + TypesTeamnames.append(QStringList()); + TypesHatnames.append(QStringList()); + } + } + else if ((line == QString("*****")) || (line == QString("*END*"))) + { + typesAvailable = true; + return true; // bye bye + } + else + { + if ((counter%2) == 0) + { + // even => teamnames mode + TypesTeamnames[(counter/2)].append(line); + } + else + { + // odd => hats mode + TypesHatnames[((counter-1)/2)].append(line); + } + } + } + + typesAvailable = true; + } + + // this QFile isn't needed any further + delete file; + + return typesAvailable; +} + + + +QString HWNamegen::getRandomGrave() +{ + QStringList Graves; + + //list all available Graves + Graves.append(HWDataManager::instance().entryList( + "Graphics/Graves", + QDir::Files, + QStringList("*.png") + ).replaceInStrings(QRegExp("\\.png$"), "") + ); + + if(Graves.size()==0) + { + // TODO do some serious error handling + return "Error"; + } + + //pick a random grave + return Graves[rand()%(Graves.size())]; +} + +QString HWNamegen::getRandomFort() +{ + QStringList Forts; + + //list all available Forts + Forts.append(HWDataManager::instance().entryList( + "Forts", + QDir::Files, + QStringList("*L.png") + ).replaceInStrings(QRegExp("L\\.png$"), "") + ); + + if(Forts.size()==0) + { + // TODO do some serious error handling + return "Error"; + } + + //pick a random fort + return Forts[rand()%(Forts.size())]; +} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/util/namegen.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QTfrontend/util/namegen.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,53 @@ +/* + * Hedgewars, a free turn based strategy game + * Copyright (c) 2009 Martin Minarik + * Copyright (c) 2009-2011 Andrey Korotaev + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef NAMEGEN_H +#define NAMEGEN_H + +#include + +class HWForm; +class HWTeam; + +class HWNamegen +{ +public: + + static void teamRandomName(HWTeam & team, const int HedgehogNumber); + static void teamRandomNames(HWTeam & team, const bool changeteamname); + +private: + HWNamegen(); + + static QList TypesTeamnames; + static QList TypesHatnames; + static bool typesAvailable; + + static bool loadTypes(); + static QStringList dictContents(const QString filename); + static QStringList dictsForHat(const QString hatname); + + static QString getRandomGrave(); + static QString getRandomFort(); + static void teamRandomName(HWTeam & team, const int HedgehogNumber, const QStringList & dict); +}; + + + +#endif diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/vertScrollArea.cpp --- a/QTfrontend/vertScrollArea.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006 Igor Ulyanov - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "vertScrollArea.h" - -#include - -VertScrArea::VertScrArea(QColor frameColor, QWidget * parent) : - QScrollArea(parent) -{ - QPalette newPalette = palette(); - newPalette.setColor(QPalette::Background, frameColor); - setPalette(newPalette); -} - -void VertScrArea::resizeEvent(QResizeEvent * event) -{ - widget()->resize(event->size().width(), widget()->sizeHint().height()); -} diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/vertScrollArea.h --- a/QTfrontend/vertScrollArea.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006 Igor Ulyanov - * Copyright (c) 2006-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _VERT_SCROLL_AREA_INCLUDED -#define _VERT_SCROLL_AREA_INCLUDED - -#include - -class VertScrArea : public QScrollArea -{ - Q_OBJECT - -public: - VertScrArea(QColor frameColor, QWidget * parent = 0); - -protected: - virtual void resizeEvent(QResizeEvent * event); -}; - -#endif // _VERT_SCROLL_AREA_INCLUDED diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/weaponItem.cpp --- a/QTfrontend/weaponItem.cpp Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "weaponItem.h" - -WeaponItem::WeaponItem(const QImage& im, const QImage& img, QWidget * parent) : - ItemNum(im, img, parent, 0) -{ -} - -WeaponItem::~WeaponItem() -{ -} - -void WeaponItem::incItems() -{ - ++numItems; -} - -void WeaponItem::decItems() -{ - --numItems; -} - diff -r 3f8ba061775e -r 3106add9a5bf QTfrontend/weaponItem.h --- a/QTfrontend/weaponItem.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Hedgewars, a free turn based strategy game - * Copyright (c) 2006-2008 Igor Ulyanov - * Copyright (c) 2008-2011 Andrey Korotaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _WEAPON_ITEM -#define _WEAPON_ITEM - -#include "itemNum.h" - -class WeaponItem : public ItemNum -{ - Q_OBJECT - - public: - WeaponItem(const QImage& im, const QImage& img, QWidget * parent); - virtual ~WeaponItem(); - - signals: - void hedgehogsNumChanged(); - - protected: - virtual void incItems(); - virtual void decItems(); - - private: - WeaponItem(); -}; - -#endif // _WEAPON_ITEM diff -r 3f8ba061775e -r 3106add9a5bf gameServer/Actions.hs --- a/gameServer/Actions.hs Fri Oct 28 18:27:55 2011 +0200 +++ b/gameServer/Actions.hs Fri Oct 28 18:33:38 2011 +0200 @@ -27,6 +27,7 @@ import ServerState import Consts import ConfigFile +import EngineInteraction data Action = AnswerClients ![ClientChan] ![B.ByteString] @@ -339,7 +340,7 @@ h <- client's host p <- client's clientProto uid <- client's clUID - haveSameNick <- liftM (not . null . tail . filter (\c -> nick c == n)) allClientsS + haveSameNick <- liftM (not . null . tail . filter (\c -> caseInsensitiveCompare (nick c) n)) allClientsS if haveSameNick then if p < 38 then mapM_ processAction [ByeClient "Nickname is already in use", removeNick] diff -r 3f8ba061775e -r 3106add9a5bf gameServer/CoreTypes.hs --- a/gameServer/CoreTypes.hs Fri Oct 28 18:27:55 2011 +0200 +++ b/gameServer/CoreTypes.hs Fri Oct 28 18:33:38 2011 +0200 @@ -69,10 +69,12 @@ roundMsgs :: Seq B.ByteString, leftTeams :: [B.ByteString], teamsAtStart :: [TeamInfo], - allPlayersHaveRegisteredAccounts :: Bool - } + allPlayersHaveRegisteredAccounts :: Bool, + giMapParams :: Map.Map B.ByteString B.ByteString, + giParams :: Map.Map B.ByteString [B.ByteString] + } deriving (Show, Read) -newGameInfo :: Bool -> GameInfo +--newGameInfo :: -> GameInfo newGameInfo = GameInfo Data.Sequence.empty diff -r 3f8ba061775e -r 3106add9a5bf gameServer/EngineInteraction.hs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gameServer/EngineInteraction.hs Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,38 @@ +module EngineInteraction where + +import qualified Data.Set as Set +import qualified Data.List as List +import Control.Monad +import qualified Codec.Binary.Base64 as Base64 +import qualified Data.ByteString.Char8 as B +import qualified Data.ByteString as BW +------------- +import CoreTypes + + +toEngineMsg :: B.ByteString -> B.ByteString +toEngineMsg msg = B.pack $ Base64.encode (fromIntegral (BW.length msg) : BW.unpack msg) + + +fromEngineMsg :: B.ByteString -> Maybe B.ByteString +fromEngineMsg msg = liftM BW.pack (Base64.decode (B.unpack msg) >>= removeLength) + where + removeLength (x:xs) = if length xs == fromIntegral x then Just xs else Nothing + removeLength _ = Nothing + + +checkNetCmd :: B.ByteString -> (Bool, Bool) +checkNetCmd msg = check decoded + where + decoded = fromEngineMsg msg + check Nothing = (False, False) + check (Just ms) | B.length ms > 0 = let m = B.head ms in (m `Set.member` legalMessages, m == '+') + | otherwise = (False, False) + legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sNpPwtghbc12345" ++ slotMessages + slotMessages = "\128\129\130\131\132\133\134\135\136\137\138" + +gameInfo2Replay :: GameInfo -> B.ByteString +gameInfo2Replay GameInfo{roundMsgs = rm, + teamsAtStart = teams, + giMapParams = params1, + giParams = params2} = undefined diff -r 3f8ba061775e -r 3106add9a5bf gameServer/HWProtoInRoomState.hs --- a/gameServer/HWProtoInRoomState.hs Fri Oct 28 18:27:55 2011 +0200 +++ b/gameServer/HWProtoInRoomState.hs Fri Oct 28 18:33:38 2011 +0200 @@ -14,6 +14,7 @@ import Utils import HandlerUtils import RoomsAndClients +import EngineInteraction handleCmd_inRoom :: CmdHandler @@ -178,7 +179,7 @@ return [ ModifyRoom (\r -> r{ - gameInfo = Just $ newGameInfo allPlayersRegistered + gameInfo = Just $ newGameInfo allPlayersRegistered (mapParams rm) (params rm) } ), AnswerClients chans ["RUN_GAME"] diff -r 3f8ba061775e -r 3106add9a5bf gameServer/HWProtoLobbyState.hs --- a/gameServer/HWProtoLobbyState.hs Fri Oct 28 18:27:55 2011 +0200 +++ b/gameServer/HWProtoLobbyState.hs Fri Oct 28 18:33:38 2011 +0200 @@ -12,6 +12,7 @@ import Utils import HandlerUtils import RoomsAndClients +import EngineInteraction answerAllTeams :: ClientInfo -> [TeamInfo] -> [Action] @@ -81,7 +82,7 @@ let chans = map sendChan (cl : jRoomClients) return $ if isNothing maybeRI || not sameProto then - [Warning "No such rooms"] + [Warning "No such room"] else if isRestrictedJoins jRoom then [Warning "Joining restricted"] else if roomPassword /= password jRoom then diff -r 3f8ba061775e -r 3106add9a5bf gameServer/OfficialServer/GameReplayStore.hs --- a/gameServer/OfficialServer/GameReplayStore.hs Fri Oct 28 18:27:55 2011 +0200 +++ b/gameServer/OfficialServer/GameReplayStore.hs Fri Oct 28 18:33:38 2011 +0200 @@ -1,18 +1,23 @@ {-# LANGUAGE ScopedTypeVariables #-} module OfficialServer.GameReplayStore where -import CoreTypes import Data.Time import Control.Exception as E import qualified Data.Map as Map import Data.Sequence() import System.Log.Logger import Data.Maybe +import Data.Unique +import Control.Monad +--------------- +import CoreTypes + saveReplay :: RoomInfo -> IO () saveReplay r = do time <- getCurrentTime - let fileName = "replays/" ++ show time + u <- liftM hashUnique newUnique + let fileName = "replays/" ++ show time ++ "-" ++ show u let gi = fromJust $ gameInfo r let replayInfo = (teamsAtStart gi, Map.toList $ mapParams r, Map.toList $ params r, roundMsgs gi) E.catch diff -r 3f8ba061775e -r 3106add9a5bf gameServer/OfficialServer/extdbinterface.hs --- a/gameServer/OfficialServer/extdbinterface.hs Fri Oct 28 18:27:55 2011 +0200 +++ b/gameServer/OfficialServer/extdbinterface.hs Fri Oct 28 18:33:38 2011 +0200 @@ -17,7 +17,7 @@ "SELECT users.pass, users_roles.rid FROM users LEFT JOIN users_roles ON users.uid = users_roles.uid WHERE users.name = ?" dbQueryStats = - "UPDATE gameserver_stats SET players = ?, rooms = ?, last_update = UNIX_TIMESTAMP()" + "INSERT INTO gameserver_stats (players, rooms, last_update) VALUES (?, ?, UNIX_TIMESTAMP())" dbInteractionLoop dbConn = forever $ do q <- liftM read getLine diff -r 3f8ba061775e -r 3106add9a5bf gameServer/Utils.hs --- a/gameServer/Utils.hs Fri Oct 28 18:27:55 2011 +0200 +++ b/gameServer/Utils.hs Fri Oct 28 18:33:38 2011 +0200 @@ -5,6 +5,7 @@ import Data.Word import qualified Data.Map as Map import qualified Data.Set as Set +import qualified Data.Char as Char import Numeric import Network.Socket import System.IO @@ -14,6 +15,7 @@ import qualified Data.ByteString.Lazy as BL import qualified Text.Show.ByteString as BS import qualified Data.ByteString.Char8 as B +import qualified Data.ByteString.UTF8 as UTF8 import qualified Data.ByteString as BW ------------------------------------------------- import CoreTypes @@ -26,25 +28,6 @@ $ List.intersperse (':':) $ concatMap (\n -> (\(a0, a1) -> [showHex a0, showHex a1]) $ divMod n 65536) [a, b, c, d]) [] -toEngineMsg :: B.ByteString -> B.ByteString -toEngineMsg msg = B.pack $ Base64.encode (fromIntegral (BW.length msg) : BW.unpack msg) - -fromEngineMsg :: B.ByteString -> Maybe B.ByteString -fromEngineMsg msg = liftM BW.pack (Base64.decode (B.unpack msg) >>= removeLength) - where - removeLength (x:xs) = if length xs == fromIntegral x then Just xs else Nothing - removeLength _ = Nothing - -checkNetCmd :: B.ByteString -> (Bool, Bool) -checkNetCmd msg = check decoded - where - decoded = fromEngineMsg msg - check Nothing = (False, False) - check (Just ms) | B.length ms > 0 = let m = B.head ms in (m `Set.member` legalMessages, m == '+') - | otherwise = (False, False) - legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sFNpPwtghbc12345" ++ slotMessages - slotMessages = "\128\129\130\131\132\133\134\135\136\137\138" - maybeRead :: Read a => String -> Maybe a maybeRead s = case reads s of [(x, rest)] | all isSpace rest -> Just x @@ -131,3 +114,8 @@ cutHost :: B.ByteString -> B.ByteString cutHost = B.intercalate "." . flip (++) ["*","*"] . List.take 2 . B.split '.' + +caseInsensitiveCompare :: B.ByteString -> B.ByteString -> Bool +caseInsensitiveCompare a b = f a == f b + where + f = map Char.toUpper . UTF8.toString diff -r 3f8ba061775e -r 3106add9a5bf gameServer/hedgewars-server.cabal --- a/gameServer/hedgewars-server.cabal Fri Oct 28 18:27:55 2011 +0200 +++ b/gameServer/hedgewars-server.cabal Fri Oct 28 18:33:38 2011 +0200 @@ -27,6 +27,7 @@ dataenc, hslogger, process, - deepseq + deepseq, + utf8-string ghc-options: -O2 diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/CMakeLists.txt diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/GSHandlers.inc Fri Oct 28 18:33:38 2011 +0200 @@ -174,7 +174,7 @@ Gear^.RenderTimer := false; if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then - if Gear^.Kind = gtHedgehog then + if Gear^.Kind = gtHedgehog then begin if Gear^.Hedgehog^.Effects[heResurrectable] then ResurrectHedgehog(Gear) @@ -219,9 +219,8 @@ procedure CheckCollision(Gear: PGear); inline; begin - if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) or TestCollisionYwithGear(Gear, hwSign(Gear^.dY) - ) - then Gear^.State := Gear^.State or gstCollision + if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) or (TestCollisionYwithGear(Gear, hwSign(Gear^.dY)) <> 0) then + Gear^.State := Gear^.State or gstCollision else Gear^.State := Gear^.State and not gstCollision end; @@ -303,6 +302,7 @@ //tmp: QWord; tdX, tdY: hwFloat; collV, collH: LongInt; + land: word; begin // clip velocity at 1.9 - over 1 per pixel, but really shouldn't cause many actual problems. if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862; @@ -320,28 +320,37 @@ if Gear^.dY.isNegative then begin isFalling := true; - if TestCollisionYwithGear(Gear, -1) then + land:= TestCollisionYwithGear(Gear, -1); + if land <> 0 then begin collV := -1; - Gear^.dX := Gear^.dX * Gear^.Friction; + if land and lfIce <> 0 then Gear^.dX := Gear^.dX * (_1 - (_1 - Gear^.Friction) / _10) + else Gear^.dX := Gear^.dX * Gear^.Friction; + Gear^.dY := - Gear^.dY * Gear^.Elasticity; Gear^.State := Gear^.State or gstCollision end - else if (Gear^.AdvBounce=1) and TestCollisionYwithGear(Gear, 1) then collV := 1; + else if (Gear^.AdvBounce=1) and (TestCollisionYwithGear(Gear, 1) <> 0) then collV := 1; end - else if TestCollisionYwithGear(Gear, 1) then + else begin - collV := 1; - isFalling := false; - Gear^.dX := Gear^.dX * Gear^.Friction; - Gear^.dY := - Gear^.dY * Gear^.Elasticity; - Gear^.State := Gear^.State or gstCollision - end - else - begin - isFalling := true; - if (Gear^.AdvBounce=1) and not Gear^.dY.isNegative and TestCollisionYwithGear(Gear, -1) then - collV := -1; + land:= TestCollisionYwithGear(Gear, 1); + if land <> 0 then + begin + collV := 1; + isFalling := false; + if land and lfIce <> 0 then Gear^.dX := Gear^.dX * (_1 - (_1 - Gear^.Friction) / _10) + else Gear^.dX := Gear^.dX * Gear^.Friction; + + Gear^.dY := - Gear^.dY * Gear^.Elasticity; + Gear^.State := Gear^.State or gstCollision + end + else + begin + isFalling := true; + if (Gear^.AdvBounce=1) and not Gear^.dY.isNegative and (TestCollisionYwithGear(Gear, -1) <> 0) then + collV := -1 + end end; @@ -352,7 +361,7 @@ Gear^.dY := Gear^.dY * Gear^.Elasticity; Gear^.State := Gear^.State or gstCollision end - else if (Gear^.AdvBounce=1) and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then + else if (Gear^.AdvBounce=1) and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then collH := -hwSign(Gear^.dX); //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then if (Gear^.AdvBounce=1) and (collV <>0) and (collH <> 0) and ((collV=-1) or ((tdX.QWordValue + @@ -368,7 +377,7 @@ if Gear^.AdvBounce > 1 then dec(Gear^.AdvBounce); - if isFalling then + if isFalling then begin Gear^.dY := Gear^.dY + cGravity; if (GameFlags and gfMoreWind) <> 0 then Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density @@ -398,7 +407,6 @@ var i, x, y: LongInt; dX, dY: hwFloat; - Fire: PGear; vg: PVisualGear; begin AllInactive := false; @@ -443,7 +451,7 @@ begin dX := rndSign(GetRandom * _0_1) + Gear^.dX / 5; dY := (GetRandom - _3) * _0_08; - AddGear(x, y, gtCluster, 0, dX, dY, 25); + FollowGear := AddGear(x, y, gtCluster, 0, dX, dY, 25) end end; gtWatermelon: @@ -455,7 +463,8 @@ begin dX := rndSign(GetRandom * _0_1) + Gear^.dX / 5; dY := (GetRandom - _1_5) * _0_3; - AddGear(x, y, gtMelonPiece, 0, dX, dY, 75)^.DirAngle := i * 60; + FollowGear:= AddGear(x, y, gtMelonPiece, 0, dX, dY, 75); + FollowGear^.DirAngle := i * 60 end end; gtHellishBomb: @@ -468,10 +477,16 @@ begin dX := AngleCos(i * 16) * _0_5 * (GetRandom + _1); dY := AngleSin(i * 16) * _0_5 * (GetRandom + _1); - Fire := AddGear(x, y, gtFlame, 0, dX, dY, 0); - if i mod 2 = 0 then Fire^.State := Fire^.State or gsttmpFlag; - Fire := AddGear(x, y, gtFlame, 0, dX, -dY, 0); - if i mod 2 <> 0 then Fire^.State := Fire^.State or gsttmpFlag; + if i mod 2 = 0 then + begin + AddGear(x, y, gtFlame, gstTmpFlag, dX, dY, 0); + AddGear(x, y, gtFlame, 0, dX, -dY, 0) + end + else + begin + AddGear(x, y, gtFlame, 0, dX, dY, 0); + AddGear(x, y, gtFlame, gstTmpFlag, dX, -dY, 0) + end; end end; gtGasBomb: @@ -481,7 +496,7 @@ begin x:= GetRandom(60); y:= GetRandom(40); - AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0); + FollowGear:= AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0); end end; end; @@ -512,7 +527,6 @@ s: Longword; i, gX, gY: LongInt; dX, dY: hwFloat; - Fire: PGear; smoke, glass: PVisualGear; begin AllInactive := false; @@ -546,7 +560,7 @@ glass^.dY:= -1/(random(4)+5); end;*) glass:= AddVisualGear(gx+random(7)-3, gy+random(7)-3, vgtStraightShot); - if glass <> nil then + if glass <> nil then with glass^ do begin Frame:= 2; @@ -560,18 +574,14 @@ end; end; for i:= 0 to 24 do - begin + begin dX := AngleCos(i * 2) * ((_0_15*(i div 5))) * (GetRandom + _1); dY := AngleSin(i * 8) * _0_5 * (GetRandom + _1); - Fire := AddGear(gX, gY, gtFlame, 0, dX, dY, 0); - Fire^.State := Fire^.State or gsttmpFlag; - Fire := AddGear(gX, gY, gtFlame, 0, dX, -dY, 0); - Fire^.State := Fire^.State or gsttmpFlag; - Fire := AddGear(gX, gY, gtFlame, 0, -dX, dY, 0); - Fire^.State := Fire^.State or gsttmpFlag; - Fire := AddGear(gX, gY, gtFlame, 0, -dX, -dY, 0); - Fire^.State := Fire^.State or gsttmpFlag; - end; + AddGear(gX, gY, gtFlame, gstTmpFlag, dX, dY, 0); + AddGear(gX, gY, gtFlame, gstTmpFlag, dX,-dY, 0); + AddGear(gX, gY, gtFlame, gstTmpFlag,-dX, dY, 0); + AddGear(gX, gY, gtFlame, gstTmpFlag,-dX,-dY, 0); + end; DeleteGear(Gear); exit end; @@ -726,7 +736,7 @@ end end end; -if draw then +if draw then with Gear^ do begin // we've collided with land. draw some stuff and get back into the clouds @@ -884,7 +894,7 @@ for i:= 0 to 31 do begin flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); - if flower <> nil then + if flower <> nil then with flower^ do begin Scale:= 0.75; @@ -1240,7 +1250,7 @@ if (Gear^.Timer mod 47) = 0 then begin // ok. this was an attempt to turn off dust if not actually drilling land. I have no idea why it isn't working as expected - if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then + if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then for i:= 0 to 1 do AddVisualGear(x - 5 + Random(10), y + 12, vgtDust); @@ -1260,7 +1270,7 @@ end; SetAllHHToActive; end; - if TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) <> 0 then begin Gear^.dY := _0; SetLittle(HHGear^.dX); @@ -1429,7 +1439,7 @@ HHGear := Gear^.Hedgehog^.Gear; if ((HHGear^.State and gstHHDriven) = 0) or (CheckGearDrowning(HHGear)) - or TestCollisionYwithGear(HHGear, 1) then + or (TestCollisionYwithGear(HHGear, 1) <> 0) then begin DeleteGear(Gear); isCursorVisible := false; @@ -1441,7 +1451,7 @@ if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); - if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, -1) then HHGear^.dY := _0; + if HHGear^.dY.isNegative and (TestCollisionYwithGear(HHGear, -1) <> 0) then HHGear^.dY := _0; HHGear^.X := HHGear^.X + HHGear^.dX; HHGear^.Y := HHGear^.Y + HHGear^.dY; HHGear^.dY := HHGear^.dY + cGravity; @@ -1514,7 +1524,7 @@ ropeDx := HHGear^.X - Gear^.X; ropeDy := HHGear^.Y - Gear^.Y; - if not TestCollisionYwithGear(HHGear, 1) then + if TestCollisionYwithGear(HHGear, 1) = 0 then begin // depending on the rope vector we know which X-side to check for collision @@ -1551,12 +1561,12 @@ if ((Gear^.Message and gmDown) <> 0) and (Gear^.Elasticity < Gear^.Friction) then if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx)) - or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then + or (TestCollisionYwithGear(HHGear, hwSign(ropeDy)) <> 0)) then Gear^.Elasticity := Gear^.Elasticity + _0_3; if ((Gear^.Message and gmUp) <> 0) and (Gear^.Elasticity > _30) then if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx)) - or TestCollisionYwithGear(HHGear, -hwSign(ropeDy))) then + or (TestCollisionYwithGear(HHGear, -hwSign(ropeDy)) <> 0)) then Gear^.Elasticity := Gear^.Elasticity - _0_3; HHGear^.X := Gear^.X + mdX * Gear^.Elasticity; @@ -1648,7 +1658,7 @@ HHGear^.dX := -_0_6 * HHGear^.dX; haveCollision := true end; - if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) then + if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) <> 0 then begin HHGear^.dY := -_0_6 * HHGear^.dY; haveCollision := true @@ -1750,12 +1760,12 @@ if (HHGear^.State and gstMoving) <> 0 then begin if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); - if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, -1) then HHGear^.dY := _0; + if HHGear^.dY.isNegative and (TestCollisionYwithGear(HHGear, -1) <> 0) then HHGear^.dY := _0; HHGear^.X := HHGear^.X + HHGear^.dX; Gear^.X := Gear^.X + HHGear^.dX; - if TestCollisionYwithGear(HHGear, 1) then + if TestCollisionYwithGear(HHGear, 1) <> 0 then begin CheckHHDamage(HHGear); HHGear^.dY := _0 @@ -1863,11 +1873,11 @@ doStepFallingGear(Gear); if (Gear^.Health = 0) then begin - if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and TestCollisionYwithGear(Gear, 1) then + if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then inc(Gear^.Damage, hwRound(Gear^.dY * _70)) else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then inc(Gear^.Damage, hwRound(Gear^.dX * _70)) - else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and TestCollisionYwithGear(Gear, -1) then + else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then inc(Gear^.Damage, hwRound(Gear^.dY * -_70)) else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then inc(Gear^.Damage, hwRound(Gear^.dX * -_70)); @@ -1920,14 +1930,14 @@ dec(Gear^.Timer); end else // gsttmpFlag = 0 - if (TurnTimeLeft = 0) or ((GameFlags and gfInfAttack) <> 0) then Gear^.State := Gear^.State or gsttmpFlag; + if (TurnTimeLeft = 0) or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) or (Gear^.Hedgehog^.Gear = nil) then Gear^.State := Gear^.State or gsttmpFlag; end; //////////////////////////////////////////////////////////////////////////////// procedure doStepSMine(Gear: PGear); begin // TODO: do real calculation? - if TestCollisionXwithGear(Gear, 2) or TestCollisionYwithGear(Gear, -2) or TestCollisionXwithGear(Gear, -2) or TestCollisionYwithGear(Gear, 2) then + if TestCollisionXwithGear(Gear, 2) or (TestCollisionYwithGear(Gear, -2) <> 0) or TestCollisionXwithGear(Gear, -2) or (TestCollisionYwithGear(Gear, 2) <> 0) then begin if (hwAbs(Gear^.dX) > _0) or (hwAbs(Gear^.dY) > _0) then begin @@ -1967,7 +1977,7 @@ end end else // gsttmpFlag = 0 - if TurnTimeLeft = 0 then Gear^.State := Gear^.State or gsttmpFlag; + if (TurnTimeLeft = 0) or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) or (Gear^.Hedgehog^.Gear = nil) then Gear^.State := Gear^.State or gsttmpFlag; end; //////////////////////////////////////////////////////////////////////////////// @@ -1999,13 +2009,13 @@ i: LongInt; particle: PVisualGear; begin - if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and not TestCollisionYwithGear(Gear, 1) then SetLittle(Gear^.dY); + if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and (TestCollisionYwithGear(Gear, 1) = 0) then SetLittle(Gear^.dY); Gear^.State := Gear^.State or gstAnimation; if ((Gear^.dX.QWordValue <> 0) or (Gear^.dY.QWordValue <> 0)) then begin DeleteCI(Gear); AllInactive := false; - if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and TestCollisionYwithGear(Gear, 1) then + if not Gear^.dY.isNegative and (Gear^.dY > _0_2) and (TestCollisionYwithGear(Gear, 1) <> 0) then begin Gear^.State := Gear^.State or gsttmpFlag; inc(Gear^.Damage, hwRound(Gear^.dY * _70)); @@ -2019,7 +2029,7 @@ else if not Gear^.dX.isNegative and (Gear^.dX > _0_2) and TestCollisionXwithGear(Gear, 1) then inc(Gear^.Damage, hwRound(Gear^.dX * _70)) - else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and TestCollisionYwithGear(Gear, -1) + else if Gear^.dY.isNegative and (Gear^.dY < -_0_2) and (TestCollisionYwithGear(Gear, -1) <> 0) then inc(Gear^.Damage, hwRound(Gear^.dY * -_70)) else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) @@ -2052,7 +2062,7 @@ if Gear^.dX.QWordValue = 0 then AddGearCI(Gear) end; *) - if not Gear^.dY.isNegative and (Gear^.dY < _0_001) and TestCollisionYwithGear(Gear, 1) then Gear + if not Gear^.dY.isNegative and (Gear^.dY < _0_001) and (TestCollisionYwithGear(Gear, 1) <> 0) then Gear ^.dY := _0; if hwAbs(Gear^.dX) < _0_001 then Gear^.dX := _0; @@ -2130,20 +2140,20 @@ dX := AngleCos(i * 64) * _0_5 * (getrandom + _1); dY := AngleSin(i * 64) * _0_5 * (getrandom + _1); AddGear(x, y, gtFlame, 0, dX, dY, 0); - AddGear(x, y, gtFlame, 0, -dX, -dY, 0)^.State := gsttmpFlag; + AddGear(x, y, gtFlame, gstTmpFlag, -dX, -dY, 0); end end; exit end; - if (Gear^.dY.QWordValue <> 0) or (not TestCollisionYwithGear(Gear, 1)) then + if (Gear^.dY.QWordValue <> 0) or (TestCollisionYwithGear(Gear, 1) = 0) then begin AllInactive := false; Gear^.dY := Gear^.dY + cGravity; Gear^.Y := Gear^.Y + Gear^.dY; if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then SetAllHHToActive; - if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY := _0; - if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then + if (Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, -1) <> 0) then Gear^.dY := _0; + if (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0) then begin if (Gear^.dY > _0_2) and (k = gtExplosives) then inc(Gear^.Damage, hwRound(Gear^.dY * _70)); @@ -2249,7 +2259,7 @@ sticky:= (Gear^.State and gsttmpFlag) <> 0; if not sticky then AllInactive := false; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin AllInactive := false; @@ -2423,7 +2433,7 @@ AllInactive := false; HHGear := Gear^.Hedgehog^.Gear; DeleteCI(HHGear); - HHGear^.X := int2hwFloat(hwRound(HHGear^.X)) - _0_5; + //HHGear^.X := int2hwFloat(hwRound(HHGear^.X)) - _0_5; WTF? HHGear^.dX := SignAs(cLittle, Gear^.dX); HHGear^.dY := - _0_3; @@ -2447,7 +2457,7 @@ inc(Gear^.Timer); - if TestCollisionYwithGear(HHGear, 1) + if (TestCollisionYwithGear(HHGear, 1) <> 0) or ((HHGear^.State and gstHHDriven) = 0) or CheckGearDrowning(HHGear) or ((Gear^.Message and gmAttack) <> 0) then @@ -2633,7 +2643,7 @@ HHGear^.X := HHGear^.X + HHGear^.dX; // hedgehog falling to collect cases HHGear^.dY := HHGear^.dY + cGravity; - if TestCollisionYwithGear(HHGear, 1) + if (TestCollisionYwithGear(HHGear, 1) <> 0) or CheckGearDrowning(HHGear) then begin DeleteGear(Gear); @@ -2816,7 +2826,7 @@ if (GameTicks mod 2 = 0) and hasWishes then begin sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1); - if sparkles <> nil then + if sparkles <> nil then begin sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; sparkles^.Angle:= random * 360; @@ -2857,7 +2867,7 @@ HHGear^.dX, HHGear^.dY, 20 + cHHRadius * 2, - cHHRadius * 2 + 6); + cHHRadius * 2 + 7); upd := 0 end; @@ -2865,21 +2875,22 @@ if Gear^.Health < Gear^.Damage then begin doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound); - for i:= 0 to 31 do - begin - sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); - if sparkles <> nil then - with sparkles^ do - begin - Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; - Angle:= random * 360; - dx:= 0.001 * (random(200)); - dy:= 0.001 * (random(200)); - if random(2) = 0 then dx := -dx; - if random(2) = 0 then dy := -dy; - FrameTicks:= random(400) + 250 - end; - end; + if hasWishes then + for i:= 0 to 31 do + begin + sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); + if sparkles <> nil then + with sparkles^ do + begin + Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; + Angle:= random * 360; + dx:= 0.001 * (random(200)); + dy:= 0.001 * (random(200)); + if random(2) = 0 then dx := -dx; + if random(2) = 0 then dy := -dy; + FrameTicks:= random(400) + 250 + end + end; AfterAttack; DeleteGear(Gear); DeleteGear(HHGear); @@ -3006,7 +3017,7 @@ yyn := dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].y; if (xx = 0) then - if TestCollisionYwithGear(Gear, yy) then + if TestCollisionYwithGear(Gear, yy) <> 0 then PrevAngle else begin @@ -3083,13 +3094,12 @@ AllInactive := false; Gear^.dY := Gear^.dY + cGravity; - if TestCollisionYwithGear(Gear, 1) then - Gear^.doStep := @doStepCakeUp + if TestCollisionYwithGear(Gear, 1) <> 0 then Gear^.doStep := @doStepCakeUp else - begin + begin Gear^.Y := Gear^.Y + Gear^.dY; if CheckGearDrowning(Gear) then AfterAttack - end + end end; procedure doStepCake(Gear: PGear); @@ -3169,10 +3179,10 @@ PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack) end; - if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then + if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then begin heart:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); - if heart <> nil then + if heart <> nil then with heart^ do begin dx:= 0.001 * (random(200)); @@ -3254,11 +3264,10 @@ t := CheckGearsCollision(Gear); //fixes drill not exploding when touching HH bug - if (Gear^.Timer = 0) - or (t^.Count <> 0) - or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) - and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) - and ((Gear^.State and gsttmpFlag) = 0)) + if (Gear^.Timer = 0) or (t^.Count <> 0) or + ( ((Gear^.State and gsttmpFlag) = 0) and + (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) + and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) // CheckLandValue returns true if the type isn't matched or not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible) then begin @@ -3271,7 +3280,7 @@ DeleteGear(Gear); exit end - else if not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) then + else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) then begin StopSound(Gear^.SoundChannel); Gear^.Tag := 1; @@ -3570,7 +3579,7 @@ for i:= random(5)+5 downto 0 do begin bubble := AddVisualGear(hwRound(HHGear^.X)+random(8), hwRound(HHGear^.Y) - 8 + random(16), vgtBubble); - if bubble <> nil then + if bubble <> nil then begin bubble^.dX:= (random(10)/10 + 0.02) * -1; if (move.isNegative) then @@ -3625,8 +3634,7 @@ or (cWaterLine + 512 < hwRound(HHGear^.Y)) or (TurnTimeLeft = 0) // allow brief ground touches - to be fair on this, might need another counter - or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and TestCollisionYwithGear( - HHGear, 1)) + or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and (TestCollisionYwithGear(HHGear, 1) <> 0)) or ((Gear^.Message and gmAttack) <> 0) then begin with HHGear^ do @@ -3687,7 +3695,12 @@ fuel, i: LongInt; move: hwFloat; begin - HHGear := CurrentHedgehog^.Gear; + HHGear := Gear^.Hedgehog^.Gear; + if HHGear = nil then + begin + DeleteGear(Gear); + exit + end; move := _0_2; fuel := 50; @@ -3733,7 +3746,7 @@ end; end; - if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then + if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then Gear^.State := Gear^.State and not gsttmpFlag; HHGear^.Message := HHGear^.Message and not (gmUp or gmPrecise or gmLeft or gmRight); HHGear^.State := HHGear^.State or gstMoving; @@ -3750,8 +3763,7 @@ or CheckGearDrowning(HHGear) or (TurnTimeLeft = 0) // allow brief ground touches - to be fair on this, might need another counter - or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and TestCollisionYwithGear( - HHGear, 1)) + or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and (TestCollisionYwithGear(HHGear, 1) <> 0)) or ((Gear^.Message and gmAttack) <> 0) then begin with HHGear^ do @@ -3780,13 +3792,13 @@ begin if Gear^.Timer > 0 then dec(Gear^.Timer, 1) - else if CurrentHedgehog = nil then + else if Gear^.Hedgehog^.Gear = nil then begin DeleteGear(Gear); AfterAttack; exit end; - HHGear := CurrentHedgehog^.Gear; + HHGear := Gear^.Hedgehog^.Gear; HHGear^.Message := HHGear^.Message and not (gmUp or gmPrecise or gmLeft or gmRight); if abs(hwRound(HHGear^.Y - Gear^.Y)) > 32 then begin @@ -4200,7 +4212,8 @@ iterator:= GearsList; while iterator <> nil do begin - if iterator^.Kind <> gtPortal then + if (iterator^.Kind <> gtPortal) and + ((iterator^.Hedgehog <> CurrentHedgehog) or ((iterator^.Message and gmAllStoppable) = 0)) then begin iterator^.Active:= true; if iterator^.dY.QWordValue = _0.QWordValue then iterator^.dY.isNegative:= false; @@ -4584,7 +4597,6 @@ HHGear: PGear; rx, ry, speed: hwFloat; i, gX, gY: LongInt; - Fire: PGear; begin AllInactive := false; HHGear := Gear^.Hedgehog^.Gear; @@ -4616,15 +4628,14 @@ ry := rndSign(getRandom * _0_1); speed := _0_5 * (_10 / Gear^.Tag); - Fire := AddGear(gx, gy, gtFlame, 0, - SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, - AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); - Fire^.State := Fire^.State or gsttmpFlag; + AddGear(gx, gy, gtFlame, gstTmpFlag, + SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, + AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); - if (Gear^.Health mod 30) = 0 then - Fire := AddGear(gx, gy, gtFlame, 0, - SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, - AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); + if (Gear^.Health mod 30) = 0 then + AddGear(gx, gy, gtFlame, 0, + SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, + AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); end; Gear^.Timer:= Gear^.Tag end; @@ -4663,7 +4674,6 @@ HHGear: PGear; rx, ry, speed: hwFloat; i, gX, gY: LongInt; - Flake: PGear; begin AllInactive := false; HHGear := Gear^.Hedgehog^.Gear; @@ -4694,10 +4704,9 @@ ry := rndSign(getRandom * _0_1); speed := (_3 / Gear^.Tag); - Flake := AddGear(gx, gy, gtFlake, 0, _0, _0, 0); - Flake^.dX:= SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx; - Flake^.dY:= AngleCos(HHGear^.Angle) * ( - speed) + ry; - Flake^.State := Flake^.State or gsttmpFlag; + AddGear(gx, gy, gtFlake, gstTmpFlag, + SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, + AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); Gear^.Timer:= Gear^.Tag end; @@ -4824,7 +4833,7 @@ Gear^.Y := Gear^.Y + _1_9; end; end; - if TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) <> 0 then begin Gear^.dY := _0; SetLittle(HitGear^.dX); @@ -4890,21 +4899,21 @@ (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF, $FF);*) - if ((Gear^.Message and gmUp) <> 0) then + if ((Gear^.Message and gmUp) <> 0) then begin if (GameTicks and $F) <> 0 then exit; end else if (GameTicks and $1FF) <> 0 then exit; - if Gear^.Power < 45 then + if Gear^.Power < 45 then begin inc(Gear^.Power); - if not TestCollisionYwithGear(hh^.Gear, -1) then hh^.Gear^.Y := hh^.Gear^.Y - _1; + if TestCollisionYwithGear(hh^.Gear, -1) = 0 then hh^.Gear^.Y := hh^.Gear^.Y - _1; end; graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius); - if Length(graves) = 0 then + if Length(graves) = 0 then begin StopSound(Gear^.SoundChannel); Gear^.Timer := 250; @@ -4912,7 +4921,7 @@ exit; end; - if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then + if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then begin if Length(graves) <= Gear^.Tag then Gear^.Tag:= 0; dec(hh^.Gear^.Health); @@ -5036,7 +5045,7 @@ if CurAmmoGear = Gear then begin - if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then + if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then begin DeleteGear(Gear); exit @@ -5127,7 +5136,7 @@ end end; -if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then +if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then begin inc(Gear^.Power); if (Gear^.Power = 172) and (HH^.Gear <> nil) and @@ -5172,7 +5181,7 @@ Gear^.Power:= 0; Gear^.Timer:= 0; if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true); - if HH^.GearHidden <> nil then + if HH^.GearHidden <> nil then begin Gear^.X:= HH^.GearHidden^.X; Gear^.Y:= HH^.GearHidden^.Y; @@ -5197,10 +5206,10 @@ 3. Hog is a king *) HH:= Gear^.Hedgehog; - if HH^.Gear <> nil then + if HH^.Gear <> nil then if (HH^.Gear = nil) or (HH^.King) or (SuddenDeathDmg) then begin - if HH^.Gear <> nil then + if HH^.Gear <> nil then begin HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack; HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking; @@ -5218,7 +5227,7 @@ HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt); if cnt < 2 then begin - if HH^.Gear <> nil then + if HH^.Gear <> nil then begin HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack; HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/HHHandlers.inc Fri Oct 28 18:33:38 2011 +0200 @@ -373,6 +373,7 @@ amResurrector, amStructure, amTardis: CurAmmoGear:= newGear; end; + if (CurAmmoType = amMine) or (CurAmmoType = amSMine) and (GameFlags and gfInfAttack <> 0) then newGear^.FlightTime:= GameTicks + 1000; if Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then begin newGear^.Target.X:= TargetPoint.X; @@ -638,11 +639,11 @@ begin Gear^.Message:= Gear^.Message and not gmLJump; DeleteCI(Gear); - if not TestCollisionYwithGear(Gear, -1) then + if TestCollisionYwithGear(Gear, -1) = 0 then if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then + or (TestCollisionYwithGear(Gear, -1) <> 0)) then begin Gear^.dY:= -_0_15; if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX); @@ -685,17 +686,17 @@ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; end; if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then @@ -703,25 +704,25 @@ SetAllHHToActive; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y - _6; Gear^.dY:= _0; @@ -758,7 +759,9 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepHedgehogMoving(Gear: PGear); var isFalling, isUnderwater: boolean; + land: Word; begin +land:= 0; isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius; if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862; if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862; @@ -796,7 +799,8 @@ end else begin - if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) + land:= TestCollisionYwithGear(Gear, 1); + if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) and ((land and lfIce) = 0) and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX); if not Gear^.dY.isNegative then @@ -810,7 +814,11 @@ Gear^.dY:= _0; end else Gear^.dY:= Gear^.dY + cGravity; - if ((Gear^.State and gstMoving) <> 0) then Gear^.dX:= Gear^.dX * Gear^.Friction + if ((Gear^.State and gstMoving) <> 0) then + begin + if land and lfIce <> 0 then Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2) + else Gear^.dX:= Gear^.dX * Gear^.Friction; + end end; if (Gear^.State <> 0) then DeleteCI(Gear); @@ -894,11 +902,13 @@ Hedgehog: PHedgehog; begin Hedgehog:= HHGear^.Hedgehog; -if not isInMultiShoot then - AllInactive:= false -else +if isInMultiShoot then HHGear^.Message:= 0; +if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Utility) <> 0) and isInMultiShoot then + AllInactive:= true +else if not isInMultiShoot then AllInactive:= false; + if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then begin if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft; @@ -1074,7 +1084,7 @@ begin if Gear^.Timer = 0 then begin - Gear^.State:= Gear^.State and not (gstWait or gstLoser or gstWinner); + Gear^.State:= Gear^.State and not (gstWait or gstLoser or gstWinner or gstAttacked or gstNotKickable); Gear^.Active:= false; AddGearCI(Gear); exit @@ -1086,6 +1096,9 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepHedgehog(Gear: PGear); +(* +var x,y,tx,ty: LongInt; + tdX, tdY, slope: hwFloat; *) begin if (Gear^.Message and gmDestroy) <> 0 then begin @@ -1103,4 +1116,32 @@ else doStepHedgehogDriven(Gear) end; + +if ((GameTicks mod 50) = 0) and (Gear^.State and (gstMoving or gstHHJumping or gstHHHJump) = 0) and ((Gear^.Message and gmAllStoppable) = 0) and + (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then + begin + if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)+cHHRadius, lfIce) then + begin + Gear^.dX.QWordValue:= Gear^.dX.QWordValue + cGravity.QWordValue * 75; + Gear^.State:= Gear^.State or gstMoving; + end +(* + // check land slope, and impart a dX based on it + tdX:= Gear^.dX; + tdY:= Gear^.dY; + Gear^.dX:= _0; + Gear^.dY:= _1; + x := hwRound(Gear^.X); + y := hwRound(Gear^.Y); + tx := 0; + ty := 0; + if not CalcSlopeTangent(Gear, x, y+cHHRadius, tx, ty, 255) then + begin + slope:= _1/DistanceI(tx,ty); + AddFileLog(FloatToStr(tdX)+ ' == '+FloatToStr(slope)); + tdX:= tdX + (cGravity * slope / _10) // this will need tuning + end; + Gear^.dX:= tdX; + Gear^.dY:= tdY *) + end; end; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/SDLh.pas Fri Oct 28 18:33:38 2011 +0200 @@ -233,6 +233,8 @@ SDL_HWPALETTE = $20000000; SDL_DOUBLEBUF = $40000000; SDL_FULLSCREEN = $80000000; + + SDL_ALLEVENTS = $FFFFFFFF; {$ENDIF} {$IFDEF ENDIAN_LITTLE} @@ -284,9 +286,6 @@ IMG_INIT_TIF = $00000004; {* SDL_EventMask type definition *} -{$IFNDEF SDL13} - SDL_ALLEVENTS = $FFFFFFFF; -{$ENDIF} ///////////////////////////////////////////////////////////////// /////////////////////// TYPE DEFINITIONS /////////////////////// @@ -898,8 +897,8 @@ procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName; (* SDL_mixer *) -function Mix_Init(flags: LongInt): LongInt; cdecl; external SDL_MixerLibName; -procedure Mix_Quit; cdecl; external SDL_MixerLibName; +function Mix_Init(flags: LongInt): LongInt; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName;{$ENDIF} +procedure Mix_Quit; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName;{$ENDIF} function Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName; procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName; @@ -930,8 +929,8 @@ function Mix_FadeOutChannel(channel: LongInt; fadems: LongInt): LongInt; cdecl; external SDL_MixerLibName; (* SDL_image *) -function IMG_Init(flags: LongInt): LongInt; cdecl; external SDL_ImageLibName; -procedure IMG_Quit; cdecl; external SDL_ImageLibName; +function IMG_Init(flags: LongInt): LongInt; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName;{$ENDIF} +procedure IMG_Quit; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName;{$ENDIF} function IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName; function IMG_Load_RW(rwop: PSDL_RWops; freesrc: LongInt): PSDL_Surface; cdecl; external SDL_ImageLibName; @@ -990,13 +989,36 @@ function SDL_MustLock(Surface: PSDL_Surface): Boolean; begin + SDL_MustLock:= {$IFDEF SDL13} - SDL_MustLock:= ((surface^.flags and SDL_RLEACCEL) <> 0) + ((surface^.flags and SDL_RLEACCEL) <> 0) {$ELSE} - SDL_MustLock:= ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) + ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0) {$ENDIF} end; +{$IFNDEF SDL_MIXER_NEWER} +function Mix_Init(flags: LongInt): LongInt; +begin + exit(flags); +end; + +procedure Mix_Quit; +begin +end; +{$ENDIF} + +{$IFNDEF SDL_IMAGE_NEWER} +function IMG_Init(flags: LongInt): LongInt; +begin + exit(flags); +end; + +procedure IMG_Quit; +begin +end; +{$ENDIF} + procedure SDLNet_Write16(value: Word; buf: pointer); begin PByteArray(buf)^[1]:= value; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/VGSHandlers.inc Fri Oct 28 18:33:38 2011 +0200 @@ -79,7 +79,7 @@ if round(X) < cLeftScreenBorder then X:= X + cScreenSpace else if round(X) > cRightScreenBorder then X:= X - cScreenSpace; // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + 25.0; // For if flag is set for flakes rising upwards? - if round(Y) - 75 > LAND_HEIGHT then Y:= Y - (1024 + 150); // TODO - configure in theme (jellies for example could use limited range) + if round(Y) - 225 > LAND_HEIGHT then Y:= Y - (1024 + 300); // TODO - configure in theme (jellies for example could use limited range) Timer:= 0; tdX:= 0; tdY:= 0 @@ -172,7 +172,10 @@ Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; if Gear^.FrameTicks <= Steps then - DeleteVisualGear(Gear) + begin + DeleteVisualGear(Gear); + exit + end else dec(Gear^.FrameTicks, Steps); diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/hwengine.pas Fri Oct 28 18:33:38 2011 +0200 @@ -164,15 +164,11 @@ while isTerminated = false do begin SDL_PumpEvents(); -{$IFDEF SDL13} - while SDL_PeepEvents(@event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) > 0 do -{$ELSE} - while SDL_PeepEvents(@event, 1, SDL_GETEVENT, SDL_ALLEVENTS) > 0 do -{$ENDIF} + while SDL_PeepEvents(@event, 1, SDL_GETEVENT, {$IFDEF SDL13}SDL_FIRSTEVENT, SDL_LASTEVENT{$ELSE}SDL_ALLEVENTS{$ENDIF}) > 0 do begin case event.type_ of +{$IFDEF SDL13} SDL_KEYDOWN: if GameState = gsChat then -{$IFDEF SDL13} // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3 KeyPressChat(event.key.keysym.sym); SDL_WINDOWEVENT: @@ -192,14 +188,18 @@ end else if event.window.event = SDL_WINDOWEVENT_RESIZED then begin + // way too broken right now + (* cNewScreenWidth:= max(2 * (event.window.data1 div 2), cMinScreenWidth); cNewScreenHeight:= max(2 * (event.window.data2 div 2), cMinScreenHeight); cScreenResizeDelay:= RealTicks+500; + *) end; SDL_FINGERMOTION: onTouchMotion(event.tfinger.x, event.tfinger.y,event.tfinger.dx, event.tfinger.dy, event.tfinger.fingerId); SDL_FINGERDOWN: onTouchDown(event.tfinger.x, event.tfinger.y, event.tfinger.fingerId); SDL_FINGERUP: onTouchUp(event.tfinger.x, event.tfinger.y, event.tfinger.fingerId); {$ELSE} + SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode); SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then wheelDown:= true; SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then wheelUp:= true; @@ -228,6 +228,7 @@ SDL_QUITEV: isTerminated:= true end; //end case event.type_ of end; //end while SDL_PollEvent(@event) <> 0 do + if (cScreenResizeDelay <> 0) and (cScreenResizeDelay < RealTicks) and ((cNewScreenWidth <> cScreenWidth) or (cNewScreenHeight <> cScreenHeight)) then begin cScreenResizeDelay:= 0; @@ -241,25 +242,21 @@ end; if isTerminated = false then - begin + begin CurrTime:= SDL_GetTicks; if PrevTime + longword(cTimerInterval) <= CurrTime then - begin + begin DoTimer(CurrTime - PrevTime); PrevTime:= CurrTime - end + end else SDL_Delay(1); IPCCheckSock(); - end; + end; end; end; /////////////// -{$IFDEF HWLIBRARY} -procedure Game(gameArgs: PPChar); cdecl; export; -{$ELSE} -procedure Game; -{$ENDIF} +procedure Game{$IFDEF HWLIBRARY}(gameArgs: PPChar); cdecl; export{$ENDIF}; var p: TPathType; s: shortstring; i: LongInt; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uAIMisc.pas Fri Oct 28 18:33:38 2011 +0200 @@ -332,18 +332,18 @@ bY:= hwRound(Gear^.Y); case JumpType of jmpNone: exit(bRes); - jmpHJump: if not TestCollisionYwithGear(Gear, -1) then + jmpHJump: if TestCollisionYwithGear(Gear, -1) = 0 then begin Gear^.dY:= -_0_2; SetLittle(Gear^.dX); Gear^.State:= Gear^.State or gstMoving or gstHHJumping; end else exit(bRes); jmpLJump: begin - if not TestCollisionYwithGear(Gear, -1) then + if TestCollisionYwithGear(Gear, -1) <> 0 then if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - int2hwFloat(2) else if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then + or (TestCollisionYwithGear(Gear, -1) <> 0)) then begin Gear^.dY:= -_0_15; Gear^.dX:= SignAs(_0_15, Gear^.dX); @@ -367,9 +367,9 @@ inc(GoInfo.Ticks); Gear^.dY:= Gear^.dY + cGravity; if Gear^.dY > _0_4 then exit(bRes); - if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0; + if (Gear^.dY.isNegative)and (TestCollisionYwithGear(Gear, -1) <> 0) then Gear^.dY:= _0; Gear^.Y:= Gear^.Y + Gear^.dY; - if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then + if (not Gear^.dY.isNegative)and (TestCollisionYwithGear(Gear, 1) <> 0) then begin Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); Gear^.dY:= _0; @@ -417,7 +417,7 @@ end; Gear^.Y:= Gear^.Y + Gear^.dY; if hwRound(Gear^.Y) > pY then inc(GoInfo.FallPix); - if TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) <> 0 then begin inc(GoInfo.Ticks, 410); Gear^.State:= Gear^.State and not (gstMoving or gstHHJumping); @@ -432,17 +432,17 @@ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; end; if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then @@ -450,25 +450,25 @@ Gear^.X:= Gear^.X + int2hwFloat(hwSign(Gear^.dX)); inc(GoInfo.Ticks, cHHStepTicks) end; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y + _1; - if not TestCollisionYwithGear(Gear, 1) then + if TestCollisionYwithGear(Gear, 1) = 0 then begin Gear^.Y:= Gear^.Y - _6; Gear^.dY:= _0; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uAmmos.pas diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uCollisions.pas --- a/hedgewars/uCollisions.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uCollisions.pas Fri Oct 28 18:33:38 2011 +0200 @@ -39,7 +39,7 @@ function CheckGearsCollision(Gear: PGear): PGearArray; function TestCollisionXwithGear(Gear: PGear; Dir: LongInt): boolean; -function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): boolean; +function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): Word; function TestCollisionXKick(Gear: PGear; Dir: LongInt): boolean; function TestCollisionYKick(Gear: PGear; Dir: LongInt): boolean; @@ -51,6 +51,8 @@ function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt; withGear: boolean = true): boolean; function TestRectancleForObstacle(x1, y1, x2, y2: LongInt; landOnly: boolean): boolean; + +function CalcSlopeTangentBelowGear(Gear: PGear; var outDeltaX, outDeltaY: LongInt): boolean; function CalcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean; implementation @@ -157,7 +159,7 @@ TestCollisionXwithGear:= false end; -function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): boolean; +function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): Word; var x, y, i: LongInt; TestWord: LongWord; begin @@ -181,11 +183,11 @@ i:= x + Gear^.Radius * 2 - 2; repeat if (x and LAND_WIDTH_MASK) = 0 then - if Land[y, x] > TestWord then exit(true); + if Land[y, x] > TestWord then exit(Land[y, x]); inc(x) until (x > i); end; -TestCollisionYwithGear:= false +TestCollisionYwithGear:= 0 end; function TestCollisionXKick(Gear: PGear; Dir: LongInt): boolean; @@ -344,7 +346,7 @@ begin Gear^.X:= Gear^.X + int2hwFloat(ShiftX); Gear^.Y:= Gear^.Y + int2hwFloat(ShiftY); -if withGear then TestCollisionYwithXYShift:= TestCollisionYwithGear(Gear, Dir) +if withGear then TestCollisionYwithXYShift:= TestCollisionYwithGear(Gear, Dir) <> 0 else TestCollisionYwithXYShift:= TestCollisionY(Gear, Dir); Gear^.X:= Gear^.X - int2hwFloat(ShiftX); Gear^.Y:= Gear^.Y - int2hwFloat(ShiftY) @@ -387,10 +389,11 @@ function CalcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): boolean; var ldx, ldy, rdx, rdy: LongInt; - i, j, mx, my, li, ri, jfr, jto, tmpo : ShortInt; + i, j, k, mx, my, li, ri, jfr, jto, tmpo : ShortInt; tmpx, tmpy: LongWord; dx, dy, s: hwFloat; offset: Array[0..7,0..1] of ShortInt; + isColl: Boolean; begin dx:= Gear^.dX; @@ -418,21 +421,25 @@ offset[i,0]:= mx; offset[i,1]:= my; - tmpx:= collisionX + mx; - tmpy:= collisionY + my; + // multiplicator k tries to skip small pixels/gaps when possible + for k:= 4 downto 1 do + begin + tmpx:= collisionX + k * mx; + tmpy:= collisionY + k * my; - if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK) = 0) then - if (Land[tmpy,tmpx] > TestWord) then - begin - // remember the index belonging to the first and last collision (if in 1st half) - if (i <> 0) then + if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK) = 0) then + if (Land[tmpy,tmpx] > TestWord) then begin - if (ri = -1) then - ri:= i - else - li:= i; + // remember the index belonging to the first and last collision (if in 1st half) + if (i <> 0) then + begin + if (ri = -1) then + ri:= i + else + li:= i; + end; end; - end; + end; if i = 7 then break; @@ -457,35 +464,48 @@ jfr:= 8+li+1; jto:= 8+li-1; + isColl:= false; for j:= jfr downto jto do begin tmpo:= j mod 8; - tmpx:= ldx + offset[tmpo,0]; - tmpy:= ldy + offset[tmpo,1]; - if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK) = 0) - and (Land[tmpy,tmpx] > TestWord) then - begin - ldx:= tmpx; - ldy:= tmpy; - break; - end; + // multiplicator k tries to skip small pixels/gaps when possible + for k:= 3 downto 1 do + begin + tmpx:= ldx + k * offset[tmpo,0]; + tmpy:= ldy + k * offset[tmpo,1]; + if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK) = 0) + and (Land[tmpy,tmpx] > TestWord) then + begin + ldx:= tmpx; + ldy:= tmpy; + isColl:= true; + break; + end; + end; + if isColl then break; end; jfr:= 8+ri-1; jto:= 8+ri+1; + isColl:= false; for j:= jfr to jto do begin tmpo:= j mod 8; - tmpx:= rdx + offset[tmpo,0]; - tmpy:= rdy + offset[tmpo,1]; - if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK) = 0) - and (Land[tmpy,tmpx] > TestWord) then - begin - rdx:= tmpx; - rdy:= tmpy; - break; - end; + for k:= 3 downto 1 do + begin + tmpx:= rdx + k * offset[tmpo,0]; + tmpy:= rdy + k * offset[tmpo,1]; + if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK) = 0) + and (Land[tmpy,tmpx] > TestWord) then + begin + rdx:= tmpx; + rdy:= tmpy; + isColl:= true; + break; + end; + end; + if isColl then break; end; end; @@ -499,6 +519,51 @@ exit(true); end; +function CalcSlopeTangentBelowGear(Gear: PGear; var outDeltaX, outDeltaY: LongInt): boolean; +var dx, dy: hwFloat; + collX, i, y, x, gx: LongInt; + isColl, succ: Boolean; +begin +// save original dx/dy +dx:= Gear^.dX; +dy:= Gear^.dY; + +Gear^.dX.QWordValue:= 0; +Gear^.dY:= _1; + +y:= hwRound(Gear^.Y) + Gear^.Radius; +gx:= hwRound(Gear^.X); +collX := gx; +isColl:= false; + +if (y and LAND_HEIGHT_MASK) = 0 then + begin + x:= hwRound(Gear^.X) - Gear^.Radius + 1; + i:= x + Gear^.Radius * 2 - 2; + repeat + if (x and LAND_WIDTH_MASK) = 0 then + if Land[y, x] > 255 then + if not isColl or (abs(x-gx) < abs(collX-gx)) then + begin + isColl:= true; + collX := x; + end; + inc(x) + until (x > i); + end; + +if isColl then + succ := CalcSlopeTangent(Gear, collX, y, outDeltaX, outDeltaY, 255) +else + succ := false; + +// restore original dx/dy +Gear^.dX:= dx; +Gear^.dY:= dy; + +CalcSlopeTangentBelowGear := succ; +end; + procedure initModule; begin Count:= 0; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uCommandHandlers.pas Fri Oct 28 18:33:38 2011 +0200 @@ -85,13 +85,13 @@ procedure chCheckProto(var s: shortstring); var i, c: LongInt; begin -if isDeveloperMode then -begin -val(s, i, c); -if (c <> 0) or (i = 0) then exit; -TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true); -TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true) -end + if isDeveloperMode then + begin + val(s, i, c); + if (c <> 0) or (i = 0) then exit; + TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); + TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); + end end; procedure chTeamLocal(var s: shortstring); @@ -451,11 +451,13 @@ procedure chSetMap(var s: shortstring); begin if isDeveloperMode then -begin -UserPathz[ptMapCurrent]:= UserPathz[ptMaps] + '/' + s; -Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; -InitStepsFlags:= InitStepsFlags or cifMap -end + begin + UserPathz[ptMapCurrent]:= UserPathz[ptMaps] + '/' + s; + Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s; + InitStepsFlags:= InitStepsFlags or cifMap + end; + +ScriptLoad(s) end; procedure chSetTheme(var s: shortstring); diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uConsts.pas Fri Oct 28 18:33:38 2011 +0200 @@ -89,10 +89,12 @@ // To allow these to layer, going to treat them as masks. The bottom byte is reserved for objects // TODO - set lfBasic for all solid land, ensure all uses of the flags can handle multiple flag bits +// lfObject and lfBasic are only to be different *graphically* in all other ways they should be treated the same lfBasic = $8000; // white lfIndestructible = $4000; // red - lfObject = $2000; // no idea - lfDamaged = $1000; // no idea + lfObject = $2000; + lfDamaged = $1000; // + lfIce = $0800; // blue cMaxPower = 1500; cMaxAngle = 2048; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uGears.pas --- a/hedgewars/uGears.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uGears.pas Fri Oct 28 18:33:38 2011 +0200 @@ -295,12 +295,15 @@ Pos:= 0; Radius:= 1; DirAngle:= random * 360; - dx.isNegative:= GetRandom(2) = 0; - dx.QWordValue:= GetRandom(100000000); - dy.isNegative:= false; - dy.QWordValue:= GetRandom(70000000); + if State and gstTmpFlag = 0 then + begin + dx.isNegative:= GetRandom(2) = 0; + dx.QWordValue:= GetRandom(100000000); + dy.isNegative:= false; + dy.QWordValue:= GetRandom(70000000); + if GetRandom(2) = 0 then dx := -dx + end; State:= State or gstInvisible; - if GetRandom(2) = 0 then dx := -dx; Health:= random(vobFrameTicks); Timer:= random(vobFramesCount); Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity @@ -1241,11 +1244,8 @@ cArtillery:= true; if not hasBorder and ((Theme = 'Snow') or (Theme = 'Christmas')) then - begin for i:= 0 to Pred(vobCount*2) do AddGear(GetRandom(LAND_WIDTH+1024)-512, LAND_HEIGHT - GetRandom(LAND_HEIGHT div 2), gtFlake, 0, _0, _0, 0); - //disableLandBack:= true - end end; procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord); @@ -1286,6 +1286,11 @@ case Gear^.Kind of gtHedgehog, gtMine, + gtBall, + gtMelonPiece, + gtGrenade, + gtClusterBomb, + gtCluster, gtSMine, gtCase, gtTarget, @@ -1490,11 +1495,11 @@ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) - or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; + or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1; end; if (Ammo^.Kind <> gtFlame) or ((Ammo^.State and gsttmpFlag) = 0) then FollowGear:= Gear diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uGearsRender.pas Fri Oct 28 18:33:38 2011 +0200 @@ -894,10 +894,19 @@ else DrawSprite(sprMolotov, x, y, 8); gtRCPlane: begin - if (Gear^.Tag = -1) then - DrawRotated(sprPlane, x, y, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) + Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF); + if Gear^.Tag = -1 then + begin + DrawRotatedTextureF(SpritesData[sprPlane].Texture, 1, 0, 0, x, y, 0, -1, SpritesData[sprPlane].Width, SpritesData[sprPlane].Height, DxDy2Angle(Gear^.dX, Gear^.dY) + 90); + Tint($FF, $FF, $FF, $FF); + DrawRotatedTextureF(SpritesData[sprPlane].Texture, 1, 0, 0, x, y, 1, -1, SpritesData[sprPlane].Width, SpritesData[sprPlane].Height, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) + end else - DrawRotated(sprPlane, x, y,0,DxDy2Angle(Gear^.dY, Gear^.dX)); + begin + DrawRotatedTextureF(SpritesData[sprPlane].Texture, 1, 0, 0, x, y, 0, 0, SpritesData[sprPlane].Width, SpritesData[sprPlane].Height, DxDy2Angle(Gear^.dY, Gear^.dX)); + Tint($FF, $FF, $FF, $FF); + DrawRotatedTextureF(SpritesData[sprPlane].Texture, 1, 0, 0, x, y, 1, 0, SpritesData[sprPlane].Width, SpritesData[sprPlane].Height, DxDy2Angle(Gear^.dY, Gear^.dX)) + end end; gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle); diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uKeys.pas Fri Oct 28 18:33:38 2011 +0200 @@ -129,7 +129,7 @@ end; {$ENDIF} -// ctrl/cmd + w/q to close engine and/or frontend +// ctrl/cmd + q to close engine and frontend {$IFDEF DARWIN} if ((tkbdn[KeyNameToCode('left_meta')] = 1) or (tkbdn[KeyNameToCode('right_meta')] = 1)) then {$ELSE} @@ -137,7 +137,6 @@ {$ENDIF} begin if tkbdn[KeyNameToCode('q')] = 1 then ParseCommand ('halt', true) - else if tkbdn[KeyNameToCode('w')] = 1 then ParseCommand ('forcequit', true); end; // now process strokes diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uLand.pas --- a/hedgewars/uLand.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uLand.pas Fri Oct 28 18:33:38 2011 +0200 @@ -1142,34 +1142,50 @@ if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptMissionMaps] + '/' + mapName + '/mask', ifAlpha or ifTransparent or ifIgnoreCaps); end; - if (tmpsurf <> nil) and (tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT) and (tmpsurf^.format^.BytesPerPixel = 4) then - begin - cpX:= (LAND_WIDTH - tmpsurf^.w) div 2; - cpY:= LAND_HEIGHT - tmpsurf^.h; - if SDL_MustLock(tmpsurf) then - SDLTry(SDL_LockSurface(tmpsurf) >= 0, true); + +if (tmpsurf <> nil) and (tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT) and (tmpsurf^.format^.BytesPerPixel = 4) then +begin + disableLandBack:= true; - p:= tmpsurf^.pixels; - for y:= 0 to Pred(tmpsurf^.h) do + cpX:= (LAND_WIDTH - tmpsurf^.w) div 2; + cpY:= LAND_HEIGHT - tmpsurf^.h; + if SDL_MustLock(tmpsurf) then + SDLTry(SDL_LockSurface(tmpsurf) >= 0, true); + + p:= tmpsurf^.pixels; + for y:= 0 to Pred(tmpsurf^.h) do + begin + for x:= 0 to Pred(tmpsurf^.w) do begin - for x:= 0 to Pred(tmpsurf^.w) do - begin - if ((AMask and p^[x]) = 0) then // Tiy was having trouble generating transparent black - Land[cpY + y, cpX + x]:= 0 - else if p^[x] = (AMask or RMask) then - Land[cpY + y, cpX + x]:= lfIndestructible - else if p^[x] = $FFFFFFFF then - Land[cpY + y, cpX + x]:= lfBasic; - end; - p:= @(p^[tmpsurf^.pitch div 4]); + if ((AMask and p^[x]) = 0) then + Land[cpY + y, cpX + x]:= 0 + else if p^[x] = $FFFFFFFF then + Land[cpY + y, cpX + x]:= lfObject + else if p^[x] = (AMask or RMask) then + Land[cpY + y, cpX + x]:= lfIndestructible + else if p^[x] = AMask then + begin + Land[cpY + y, cpX + x]:= lfBasic; + disableLandBack:= false + end + else if p^[x] = (AMask or BMask) then + Land[cpY + y, cpX + x]:= lfObject or lfIce end; + p:= @(p^[tmpsurf^.pitch div 4]); + end; - if SDL_MustLock(tmpsurf) then - SDL_UnlockSurface(tmpsurf); - end; - if (tmpsurf <> nil) then - SDL_FreeSurface(tmpsurf); - tmpsurf:= nil; + if SDL_MustLock(tmpsurf) then + SDL_UnlockSurface(tmpsurf); + if not disableLandBack then + begin + // freed in freeModule() below + LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); + if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent) + end; +end; +if (tmpsurf <> nil) then + SDL_FreeSurface(tmpsurf); +tmpsurf:= nil; end; procedure LoadMap; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uLandGraphics.pas Fri Oct 28 18:33:38 2011 +0200 @@ -180,7 +180,7 @@ t:= y + dy; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if (not isMap and ((Land[t, i] and lfIndestructible) = 0)) or ((Land[t, i] and lfBasic) <> 0) then + if ((Land[t, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[t, i] > 255)) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 else @@ -189,7 +189,7 @@ t:= y - dy; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if (not isMap and ((Land[t, i] and lfIndestructible) = 0)) or ((Land[t, i] and lfBasic) <> 0) then + if ((Land[t, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[t, i] > 255)) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 else @@ -198,7 +198,7 @@ t:= y + dx; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if (not isMap and ((Land[t, i] and lfIndestructible) = 0)) or ((Land[t, i] and lfBasic) <> 0) then + if ((Land[t, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[t, i] > 255)) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 else @@ -207,7 +207,7 @@ t:= y - dx; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if (not isMap and ((Land[t, i] and lfIndestructible) = 0)) or ((Land[t, i] and lfBasic) <> 0) then + if ((Land[t, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[t, i] > 255)) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 else @@ -223,86 +223,89 @@ t:= y + dy; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - begin - if (cReducedQuality and rqBlurryLand) = 0 then + if (Land[t, i] and lfIndestructible) = 0 then begin - by:= t; bx:= i; - end - else - begin - by:= t div 2; bx:= i div 2; + if (cReducedQuality and rqBlurryLand) = 0 then + begin + by:= t; bx:= i; + end + else + begin + by:= t div 2; bx:= i div 2; + end; + if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and not disableLandBack then + begin + inc(cnt); + LandPixels[by, bx]:= LandBackPixel(i, t) + end + else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then + LandPixels[by, bx]:= 0 end; - if ((Land[t, i] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then - begin - inc(cnt); - LandPixels[by, bx]:= LandBackPixel(i, t) - end - else - if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then - LandPixels[by, bx]:= 0 - end; t:= y - dy; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - begin - if (cReducedQuality and rqBlurryLand) = 0 then + if (Land[t, i] and lfIndestructible) = 0 then begin - by:= t; bx:= i; - end - else - begin - by:= t div 2; bx:= i div 2; + if (cReducedQuality and rqBlurryLand) = 0 then + begin + by:= t; bx:= i; + end + else + begin + by:= t div 2; bx:= i div 2; + end; + if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and not disableLandBack then + begin + inc(cnt); + LandPixels[by, bx]:= LandBackPixel(i, t) + end + else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then + LandPixels[by, bx]:= 0 end; - if ((Land[t, i] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then - begin - inc(cnt); - LandPixels[by, bx]:= LandBackPixel(i, t) - end - else if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then - LandPixels[by, bx]:= 0 - end; t:= y + dx; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - begin - if (cReducedQuality and rqBlurryLand) = 0 then + if (Land[t, i] and lfIndestructible) = 0 then begin - by:= t; bx:= i; - end - else - begin - by:= t div 2; bx:= i div 2; + if (cReducedQuality and rqBlurryLand) = 0 then + begin + by:= t; bx:= i; + end + else + begin + by:= t div 2; bx:= i div 2; + end; + if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and not disableLandBack then + begin + inc(cnt); + LandPixels[by, bx]:= LandBackPixel(i, t) + end + else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then + LandPixels[by, bx]:= 0 end; - if ((Land[t, i] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then - begin - inc(cnt); - LandPixels[by, bx]:= LandBackPixel(i, t) - end - else if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then - LandPixels[by, bx]:= 0 - end; t:= y - dx; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - begin - if (cReducedQuality and rqBlurryLand) = 0 then + if (Land[t, i] and lfIndestructible) = 0 then begin - by:= t; bx:= i; - end - else - begin - by:= t div 2; bx:= i div 2; + if (cReducedQuality and rqBlurryLand) = 0 then + begin + by:= t; bx:= i; + end + else + begin + by:= t div 2; bx:= i div 2; + end; + if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and not disableLandBack then + begin + inc(cnt); + LandPixels[by, bx]:= LandBackPixel(i, t) + end + else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then + LandPixels[by, bx]:= 0 end; - if ((Land[t, i] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then - begin - inc(cnt); - LandPixels[by, bx]:= LandBackPixel(i, t) - end - else if ((Land[t, i] and lfObject) <> 0) or (disableLandBack and ((Land[t, i] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then - LandPixels[by, bx]:= 0 - end; FillLandCircleLinesBG:= cnt; end; @@ -455,18 +458,21 @@ for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do begin - if (cReducedQuality and rqBlurryLand) = 0 then - begin - by:= ty; bx:= tx; - end - else + if (Land[ty, tx] and lfIndestructible) = 0 then begin - by:= ty div 2; bx:= tx div 2; - end; - if ((Land[ty, tx] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then - LandPixels[by, bx]:= LandBackPixel(tx, ty) - else if ((Land[ty, tx] and lfObject) <> 0) or (disableLandBack and ((Land[ty, tx] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then - LandPixels[by, bx]:= 0 + if (cReducedQuality and rqBlurryLand) = 0 then + begin + by:= ty; bx:= tx; + end + else + begin + by:= ty div 2; bx:= tx div 2; + end; + if ((Land[ty, tx] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and not disableLandBack then + LandPixels[by, bx]:= LandBackPixel(tx, ty) + else if ((Land[ty, tx] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then + LandPixels[by, bx]:= 0 + end end; inc(y, dY) end; @@ -582,11 +588,10 @@ begin by:= ty div 2; bx:= tx div 2; end; - if ((Land[ty, tx] and lfBasic) <> 0) and ((LandPixels[by,bx] and AMask) shr AShift = 255) and not disableLandBack then - LandPixels[by, bx]:= LandBackPixel(tx, ty) - else if ((Land[ty, tx] and lfObject) <> 0) or (disableLandBack and ((Land[ty, tx] and lfIndestructible) = 0)) or ((LandPixels[by,bx] and AMask) shr AShift < 255) then + if ((Land[ty, tx] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and not disableLandBack then + LandPixels[by, bx]:= LandBackPixel(tx, ty) + else if ((Land[ty, tx] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then LandPixels[by, bx]:= 0; - Land[ty, tx]:= 0; end end; @@ -647,7 +652,7 @@ end; function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean; -var X, Y, bpp, h, w, row, col, numFramesFirstCol: LongInt; +var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; p: PByteArray; Image: PSDL_Surface; begin @@ -702,14 +707,25 @@ for x:= 0 to Pred(w) do if PLongword(@(p^[x * 4]))^ <> 0 then begin + if (cReducedQuality and rqBlurryLand) = 0 then + begin + gX:= cpX + x; + gY:= cpY + y; + end + else + begin + gX:= (cpX + x) div 2; + gY:= (cpY + y) div 2; + end; if indestructible then Land[cpY + y, cpX + x]:= lfIndestructible + else if (LandPixels[gY, gX] and AMask) shr AShift = 255 then // This test assumes lfBasic and lfObject differ only graphically + Land[cpY + y, cpX + x]:= lfBasic else Land[cpY + y, cpX + x]:= lfObject; - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^ - else - LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= PLongword(@(p^[x * 4]))^ + // For testing only. Intent is to flag this on objects with masks, or use it for an ice ray gun + if (Theme = 'Snow') or (Theme = 'Christmas') then Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or lfIce; + LandPixels[gY, gX]:= PLongword(@(p^[x * 4]))^ end; p:= @(p^[Image^.pitch]); end; @@ -824,6 +840,33 @@ else Land[y,x]:= lfBasic end end +else if ((cReducedQuality and rqBlurryLand) = 0) and (LandPixels[Y, X] and AMask = 255) and + ((Land[Y, X] and (lfDamaged or lfBasic) = lfBasic) or (Land[Y, X] and (lfDamaged or lfBasic) = lfBasic)) and + (Y > LongInt(topY) + 1) and (Y < LAND_HEIGHT-2) and (X > LongInt(leftX) + 1) and (X < LongInt(rightX) - 1) then + begin + if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0)) or + (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then + begin + LandPixels[y,x]:= + (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or + (((((LandPixels[y,x] and GMask shr GShift) div 2)+((cExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or + (((((LandPixels[y,x] and BMask shr BShift) div 2)+((cExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift) + end + else if ((((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0)) or + (((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0)) or + (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0)) or + (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0)) or + (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0)) or + (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0)) or + (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0)) or + (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))) then + begin + LandPixels[y,x]:= + (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or + (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((cExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or + (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((cExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift) + end + end end; function SweepDirty: boolean; @@ -902,12 +945,12 @@ // Return true if outside of land or not the value tested, used right now for some X/Y movement that does not use normal hedgehog movement in GSHandlers.inc -function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean; +function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean; inline; begin CheckLandValue:= ((X and LAND_WIDTH_MASK <> 0) or (Y and LAND_HEIGHT_MASK <> 0)) or ((Land[Y, X] and LandFlag) = 0) end; -function LandBackPixel(x, y: LongInt): LongWord; +function LandBackPixel(x, y: LongInt): LongWord; inline; var p: PLongWordArray; begin if LandBackSurface = nil then LandBackPixel:= 0 diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uLandObjects.pas Fri Oct 28 18:33:38 2011 +0200 @@ -25,7 +25,7 @@ procedure AddObjects(); procedure FreeLandObjects(); procedure LoadThemeConfig; -procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); +procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word = 0); procedure AddOnLandObjects(Surface: PSDL_Surface); implementation @@ -66,7 +66,7 @@ SprayObjects: TSprayObjects; -procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); +procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word = 0); var p: PLongwordArray; x, y: Longword; bpp: LongInt; @@ -96,8 +96,12 @@ if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x]; + if ((Land[cpY + y, cpX + x] and $FF00) = 0) and ((p^[x] and AMask) <> 0) then - Land[cpY + y, cpX + x]:= lfObject + begin + Land[cpY + y, cpX + x]:= lfObject; + Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or extraFlags + end; end; p:= @(p^[Image^.pitch shr 2]) end; @@ -204,7 +208,11 @@ rr.x:= x1; while rr.x < x2 do begin - BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf); + // For testing only. Intent is to flag this on objects with masks, or use it for an ice ray gun + if (Theme = 'Snow') or (Theme = 'Christmas') then + BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf, lfIce) + else + BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf); inc(rr.x, tmpsurf^.w); end; SDL_FreeSurface(tmpsurf); diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uScript.pas --- a/hedgewars/uScript.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uScript.pas Fri Oct 28 18:33:38 2011 +0200 @@ -960,8 +960,12 @@ end else lua_pushinteger(L, 0) end - else LuaError('Lua: Wrong number of parameters passed to GetAmmoCount!'); - lc_getammocount:= 0 + else + begin + LuaError('Lua: Wrong number of parameters passed to GetAmmoCount!'); + lua_pushnil(L) + end; + lc_getammocount:= 1 end; function lc_sethealth(L : Plua_State) : LongInt; Cdecl; @@ -1594,6 +1598,7 @@ exit; // push game variables so they may be modified by the script +ScriptSetInteger('BorderColor', cExplosionBorderColor); ScriptSetInteger('GameFlags', GameFlags); ScriptSetString('Seed', cSeed); ScriptSetInteger('TemplateFilter', cTemplateFilter); @@ -1672,6 +1677,8 @@ begin s:= UserPathz[ptData] + '/' + name; if not FileExists(s) then s:= Pathz[ptData] + '/' + name; +if not FileExists(s) then exit; + ret:= luaL_loadfile(luaState, Str2PChar(s)); if ret <> 0 then begin diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uSound.pas --- a/hedgewars/uSound.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uSound.pas Fri Oct 28 18:33:38 2011 +0200 @@ -157,11 +157,9 @@ if isSoundEnabled then isSoundEnabled:= Mix_OpenAudio(44100, $8010, channels, 1024) = 0; -{$IFDEF SDL_MIXER_NEWER} WriteToConsole('Init SDL_mixer... '); SDLTry(Mix_Init(MIX_INIT_OGG) <> 0, true); WriteLnToConsole(msgOK); -{$ENDIF} if isSoundEnabled then WriteLnToConsole(msgOK) @@ -191,11 +189,9 @@ if Mus <> nil then Mix_FreeMusic(Mus); -{$IFDEF SDL_MIXER_NEWER} // make sure all instances of sdl_mixer are unloaded before continuing while Mix_Init(0) <> 0 do Mix_Quit(); -{$ENDIF} Mix_CloseAudio(); end; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uStore.pas --- a/hedgewars/uStore.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uStore.pas Fri Oct 28 18:33:38 2011 +0200 @@ -399,10 +399,7 @@ end; AddProgress; - -{$IFDEF SDL_IMAGE_NEWER} IMG_Quit(); -{$ENDIF} end; procedure StoreRelease(reload: boolean); @@ -949,38 +946,32 @@ procedure chFullScr(var s: shortstring); var flags: Longword = 0; - {$IFNDEF IPHONEOS}ico: PSDL_Surface;{$ENDIF} - reinit: boolean; + reinit: boolean = false; + {$IFNDEF DARWIN}ico: PSDL_Surface;{$ENDIF} {$IFDEF SDL13}x, y: LongInt;{$ENDIF} begin if Length(s) = 0 then cFullScreen:= not cFullScreen else cFullScreen:= s = '1'; AddFileLog('Preparing to change video parameters...'); - reinit:= false; {$IFNDEF IPHONEOS} if SDLPrimSurface = nil then begin // set window title SDL_WM_SetCaption('Hedgewars', nil); -{$IFDEF SDL_IMAGE_NEWER} WriteToConsole('Init SDL_image... '); SDLTry(IMG_Init(IMG_INIT_PNG) <> 0, true); WriteLnToConsole(msgOK); -{$ENDIF} // load engine icon -{$IFDEF DARWIN} - ico:= LoadImage(UserPathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps); - if ico = nil then ico:= LoadImage(Pathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps); -{$ELSE} +{$IFNDEF DARWIN} ico:= LoadImage(UserPathz[ptGraphics] + '/hwengine', ifIgnoreCaps); if ico = nil then ico:= LoadImage(Pathz[ptGraphics] + '/hwengine', ifIgnoreCaps); -{$ENDIF} if ico <> nil then begin SDL_WM_SetIcon(ico, 0); SDL_FreeSurface(ico) end; +{$ENDIF} end else begin diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uTeams.pas Fri Oct 28 18:33:38 2011 +0200 @@ -542,6 +542,23 @@ end; +procedure chFinish(var s:shortstring); +var t: LongInt; +begin +// avoid compiler hint +s:= s; + +t:= 0; +while (t < cMaxTeams) and (TeamsArray[t] <> nil) do + begin + TeamsArray[t]^.hasGone:= true; + inc(t); + end; + +AddChatString('** Good-bye!'); +RecountAllTeamsHealth(); +end; + procedure initModule; begin RegisterVariable('addhh', vtCommand, @chAddHH, false); @@ -549,6 +566,7 @@ RegisterVariable('hhcoords', vtCommand, @chSetHHCoords, false); RegisterVariable('bind', vtCommand, @chBind, true ); RegisterVariable('teamgone', vtCommand, @chTeamGone, true ); + RegisterVariable('finish', vtCommand, @chFinish, true ); // all teams gone CurrentTeam:= nil; PreviousTeam:= nil; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uVariables.pas Fri Oct 28 18:33:38 2011 +0200 @@ -348,7 +348,7 @@ Width: 254; Height: 101; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAirplane (FileName: 'amAirplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmAirplane - (FileName: 'amGirder'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + (FileName: 'amGirder'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; Width: 160; Height:160; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmGirder (FileName: 'hhMask'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHHTelepMask @@ -453,7 +453,7 @@ (FileName: 'Balls'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; Width: 32; Height: 20; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprBalls (FileName: 'RCPlane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPlane + Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPlane (FileName: 'amRCPlane'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandPlane (FileName: 'Utility'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; @@ -2338,11 +2338,7 @@ framel, framer, depthl, depthr: GLuint; texl, texr: GLuint; - - VisualGearsLayer0: PVisualGear; - VisualGearsLayer1: PVisualGear; - VisualGearsLayer2: PVisualGear; - VisualGearsLayer3: PVisualGear; + VisualGearLayers: array[0..3] of PVisualGear; lastVisualGearByUID: PVisualGear; vobFrameTicks, vobFramesCount, vobCount: Longword; vobVelocity, vobFallSpeed: LongInt; diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uVisualGears.pas Fri Oct 28 18:33:38 2011 +0200 @@ -145,6 +145,7 @@ gear^.State:= 0; gear^.Tint:= $FFFFFFFF; gear^.uid:= VGCounter; +gear^.Layer:= 0; with gear^ do case Kind of @@ -336,19 +337,15 @@ if State <> 0 then gear^.State:= State; case Gear^.Kind of + vgtFlake: if random(2) = 0 then gear^.Layer:= 0 // 50% + else if random(2) = 0 then gear^.Layer:= 1 // 25% + else gear^.Layer:= random(2)+2; // 12.5% each + // 0: this layer is very distant in the background when stereo vgtTeamHealthSorter, vgtSmoothWindBar, - vgtFlake, - vgtCloud: begin - if VisualGearsLayer0 <> nil then - begin - VisualGearsLayer0^.PrevGear:= gear; - gear^.NextGear:= VisualGearsLayer0 - end; - gear^.Layer:= 0; - VisualGearsLayer0:= gear - end; + vgtCloud: gear^.Layer:= 0; + // 1: this layer is on the land level (which is close but behind the screen plane) when stereo vgtSmokeTrace, vgtEvilTrace, @@ -359,29 +356,15 @@ vgtFire, vgtSplash, vgtDroplet, - vgtBubble: begin - if VisualGearsLayer1 <> nil then - begin - VisualGearsLayer1^.PrevGear:= gear; - gear^.NextGear:= VisualGearsLayer1 - end; - gear^.Layer:= 1; - VisualGearsLayer1:= gear - end; + vgtBubble: gear^.Layer:= 1; + // 3: this layer is on the screen plane (depth = 0) when stereo vgtSpeechBubble, vgtSmallDamageTag, vgtHealthTag, vgtStraightShot, - vgtChunk: begin - if VisualGearsLayer3 <> nil then - begin - VisualGearsLayer3^.PrevGear:= gear; - gear^.NextGear:= VisualGearsLayer3 - end; - gear^.Layer:= 3; - VisualGearsLayer3:= gear - end; + vgtChunk: gear^.Layer:= 3; + // 2: this layer is outside the screen when stereo vgtExplosion, vgtBigExplosion, @@ -396,17 +379,16 @@ vgtSmokeRing, vgtNote, vgtBulletHit, - vgtCircle: begin - if VisualGearsLayer2 <> nil then - begin - VisualGearsLayer2^.PrevGear:= gear; - gear^.NextGear:= VisualGearsLayer2 - end; - gear^.Layer:= 2; - VisualGearsLayer2:= gear - end; + vgtCircle: gear^.Layer:= 2 end; +if VisualGearLayers[gear^.Layer] <> nil then + begin + VisualGearLayers[gear^.Layer]^.PrevGear:= gear; + gear^.NextGear:= VisualGearLayers[gear^.Layer] + end; +VisualGearLayers[gear^.Layer]:= gear; + AddVisualGear:= gear; end; @@ -418,13 +400,7 @@ if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear; if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear - else - case Gear^.Layer of - 0: VisualGearsLayer0:= Gear^.NextGear; - 1: VisualGearsLayer1:= Gear^.NextGear; - 2: VisualGearsLayer2:= Gear^.NextGear; - 3: VisualGearsLayer3:= Gear^.NextGear; - end; + else VisualGearLayers[Gear^.Layer]:= Gear^.NextGear; if lastVisualGearByUID = Gear then lastVisualGearByUID:= nil; @@ -433,37 +409,20 @@ procedure ProcessVisualGears(Steps: Longword); var Gear, t: PVisualGear; + i: LongWord; begin if Steps = 0 then exit; -t:= VisualGearsLayer0; -while t <> nil do - begin - Gear:= t; - t:= Gear^.NextGear; - Gear^.doStep(Gear, Steps) - end; -t:= VisualGearsLayer1; -while t <> nil do - begin - Gear:= t; - t:= Gear^.NextGear; - Gear^.doStep(Gear, Steps) - end; -t:= VisualGearsLayer2; -while t <> nil do - begin - Gear:= t; - t:= Gear^.NextGear; - Gear^.doStep(Gear, Steps) - end; -t:= VisualGearsLayer3; -while t <> nil do - begin - Gear:= t; - t:= Gear^.NextGear; - Gear^.doStep(Gear, Steps) - end +for i:= 0 to 3 do + begin + t:= VisualGearLayers[i]; + while t <> nil do + begin + Gear:= t; + t:= Gear^.NextGear; + Gear^.doStep(Gear, Steps) + end; + end end; procedure KickFlakes(Radius, X, Y: LongInt); @@ -471,7 +430,26 @@ dmg: LongInt; begin if (vobCount = 0) or (vobCount > 200) then exit; -t:= VisualGearsLayer0; +t:= VisualGearLayers[1]; +while t <> nil do + begin + Gear:= t; + if Gear^.Kind = vgtFlake then + begin + // Damage calc from doMakeExplosion + dmg:= Min(101, Radius + cHHRadius div 2 - LongInt(abs(round(Gear^.X) - X) + abs(round(Gear^.Y) - Y)) div 5); + if dmg > 1 then + begin + Gear^.tdX:= 0.02 * dmg + 0.01; + if Gear^.X - X < 0 then Gear^.tdX := -Gear^.tdX; + Gear^.tdY:= 0.02 * dmg + 0.01; + if Gear^.Y - Y < 0 then Gear^.tdY := -Gear^.tdY; + Gear^.Timer:= 200 + end + end; + t:= Gear^.NextGear + end; +t:= VisualGearLayers[3]; while t <> nil do begin Gear:= t; @@ -501,21 +479,21 @@ case Layer of // this layer is very distant in the background when stereo 0: begin - Gear:= VisualGearsLayer0; + Gear:= VisualGearLayers[0]; while Gear <> nil do begin if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint); case Gear^.Kind of vgtFlake: if SuddenDeathDmg then if vobSDVelocity = 0 then - DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame) + DrawTextureF(SpritesData[sprSDFlake].Texture, 0.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height) else - DrawRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle) + DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, 0.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle) else if vobVelocity = 0 then - DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame) + DrawTextureF(SpritesData[sprFlake].Texture, 0.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height) else - DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle); + DrawRotatedTextureF(SpritesData[sprFlake].Texture, 0.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle); vgtCloud: if SuddenDeathDmg then DrawSprite(sprSDCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame) else @@ -527,12 +505,22 @@ end; // this layer is on the land level (which is close but behind the screen plane) when stereo 1: begin - Gear:= VisualGearsLayer1; + Gear:= VisualGearLayers[1]; while Gear <> nil do begin //tinted:= false; if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint); case Gear^.Kind of + vgtFlake: if SuddenDeathDmg then + if vobSDVelocity = 0 then + DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame) + else + DrawRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle) + else + if vobVelocity = 0 then + DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame) + else + DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle); vgtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State); vgtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State); vgtLineTrail: DrawLine(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 1.0, $FF, min(Gear^.Timer, $C0), min(Gear^.Timer, $80), min(Gear^.Timer, $FF)); @@ -566,12 +554,22 @@ end; // this layer is on the screen plane (depth = 0) when stereo 3: begin - Gear:= VisualGearsLayer3; + Gear:= VisualGearLayers[3]; while Gear <> nil do begin tinted:= false; if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint); case Gear^.Kind of + vgtFlake: if SuddenDeathDmg then + if vobSDVelocity = 0 then + DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame) + else + DrawRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle) + else + if vobVelocity = 0 then + DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame) + else + DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle); vgtSpeechBubble: begin if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team <> CurrentTeam)) or (Gear^.State = 1)) then begin @@ -610,7 +608,7 @@ end; // this layer is outside the screen when stereo 2: begin - Gear:= VisualGearsLayer2; + Gear:= VisualGearLayers[2]; while Gear <> nil do begin tinted:= false; @@ -668,6 +666,16 @@ vgtBulletHit: DrawRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle); end; case Gear^.Kind of + vgtFlake: if SuddenDeathDmg then + if vobSDVelocity = 0 then + DrawTextureF(SpritesData[sprSDFlake].Texture, 1.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height) + else + DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, 1.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle) + else + if vobVelocity = 0 then + DrawTextureF(SpritesData[sprFlake].Texture, 1.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height) + else + DrawRotatedTextureF(SpritesData[sprFlake].Texture, 1.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle); vgtCircle: if gear^.Angle = 1 then begin tmp:= Gear^.State / 100; @@ -684,6 +692,7 @@ function VisualGearByUID(uid : Longword) : PVisualGear; var vg: PVisualGear; + i: LongWord; begin VisualGearByUID:= nil; if uid = 0 then exit; @@ -692,49 +701,20 @@ VisualGearByUID:= lastVisualGearByUID; exit end; -vg:= VisualGearsLayer0; -while vg <> nil do +// search in an order that is more likely to return layers they actually use. Could perhaps track statistically AddVisualGear in uScript, since that is most likely the ones they want +for i:= 2 to 5 do begin - if vg^.uid = uid then - begin - lastVisualGearByUID:= vg; - VisualGearByUID:= vg; - exit - end; - vg:= vg^.NextGear - end; -vg:= VisualGearsLayer1; -while vg <> nil do - begin - if vg^.uid = uid then + vg:= VisualGearLayers[i mod 4]; + while vg <> nil do begin - lastVisualGearByUID:= vg; - VisualGearByUID:= vg; - exit - end; - vg:= vg^.NextGear - end; -vg:= VisualGearsLayer2; -while vg <> nil do - begin - if vg^.uid = uid then - begin - lastVisualGearByUID:= vg; - VisualGearByUID:= vg; - exit - end; - vg:= vg^.NextGear - end; -vg:= VisualGearsLayer3; -while vg <> nil do - begin - if vg^.uid = uid then - begin - lastVisualGearByUID:= vg; - VisualGearByUID:= vg; - exit - end; - vg:= vg^.NextGear + if vg^.uid = uid then + begin + lastVisualGearByUID:= vg; + VisualGearByUID:= vg; + exit + end; + vg:= vg^.NextGear + end end end; @@ -750,7 +730,7 @@ vg, tmp: PVisualGear; begin if cCloudsNumber = cSDCloudsNumber then exit; -vg:= VisualGearsLayer0; +vg:= VisualGearLayers[0]; while vg <> nil do if vg^.Kind = vgtCloud then begin @@ -768,7 +748,7 @@ begin if (cReducedQuality and rqKillFlakes) <> 0 then exit; -if ((GameFlags and gfBorder) <> 0) or ((Theme <> 'Snow') and (Theme <> 'Christmas')) then +if hasBorder or ((Theme <> 'Snow') and (Theme <> 'Christmas')) then for i:= 0 to Pred(vobCount * cScreenSpace div LAND_WIDTH) do AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake) else @@ -782,15 +762,18 @@ begin if (cReducedQuality and rqKillFlakes) <> 0 then exit; if vobCount = vobSDCount then exit; -vg:= VisualGearsLayer0; -while vg <> nil do - if vg^.Kind = vgtFlake then +for i:= 0 to 3 do + begin + vg:= VisualGearLayers[i]; + while vg <> nil do + if vg^.Kind = vgtFlake then begin tmp:= vg^.NextGear; DeleteVisualGear(vg); vg:= tmp end - else vg:= vg^.NextGear; + else vg:= vg^.NextGear; + end; if ((GameFlags and gfBorder) <> 0) or ((Theme <> 'Snow') and (Theme <> 'Christmas')) then for i:= 0 to Pred(vobSDCount * cScreenSpace div LAND_WIDTH) do AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake) @@ -800,19 +783,17 @@ end; procedure initModule; +var i: LongWord; begin - VisualGearsLayer0:= nil; - VisualGearsLayer1:= nil; - VisualGearsLayer2:= nil; - VisualGearsLayer3:= nil; +for i:= 0 to 3 do + VisualGearLayers[i]:= nil; end; procedure freeModule; +var i: LongWord; begin - while VisualGearsLayer0 <> nil do DeleteVisualGear(VisualGearsLayer0); - while VisualGearsLayer1 <> nil do DeleteVisualGear(VisualGearsLayer1); - while VisualGearsLayer2 <> nil do DeleteVisualGear(VisualGearsLayer2); - while VisualGearsLayer3 <> nil do DeleteVisualGear(VisualGearsLayer3); +for i:= 0 to 3 do + while VisualGearLayers[i] <> nil do DeleteVisualGear(VisualGearLayers[i]); end; end. diff -r 3f8ba061775e -r 3106add9a5bf hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Fri Oct 28 18:27:55 2011 +0200 +++ b/hedgewars/uWorld.pas Fri Oct 28 18:33:38 2011 +0200 @@ -536,7 +536,7 @@ var i, w, h, lw, lh, rw, rh, sw: LongInt; begin sw:= round(cScreenWidth / cScaleFactor); - if ((SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil)) and (SpritesData[spr].Texture <> nil) then + if (SpritesData[sprL].Texture = nil) and (SpritesData[spr].Texture <> nil) then begin w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale; h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; @@ -554,8 +554,11 @@ h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale; lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale; lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale; - rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale; - rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale; + if SpritesData[sprR].Texture <> nil then + begin + rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale; + rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale + end; dec(Shift, w div 2); DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); @@ -567,11 +570,18 @@ end; i:= Shift + w; - while i <= sw do - begin - DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale); - inc(i, rw) - end + if SpritesData[sprR].Texture <> nil then + while i <= sw do + begin + DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale); + inc(i, rw) + end + else + while i <= sw do + begin + DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale); + inc(i, lw) + end end end; @@ -1201,7 +1211,7 @@ else begin CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8; - if isPhone() then + if isPhone() or (cScreenHeight < 600) or ((hwSign(FollowGear^.dY) * z) < 10) then CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8 else CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8; diff -r 3f8ba061775e -r 3106add9a5bf misc/libfreetype/Xcode-iPhoneOS/Freetype.xcodeproj/project.pbxproj --- a/misc/libfreetype/Xcode-iPhoneOS/Freetype.xcodeproj/project.pbxproj Fri Oct 28 18:27:55 2011 +0200 +++ b/misc/libfreetype/Xcode-iPhoneOS/Freetype.xcodeproj/project.pbxproj Fri Oct 28 18:33:38 2011 +0200 @@ -1102,7 +1102,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../include\""; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; @@ -1126,7 +1126,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../include\""; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; diff -r 3f8ba061775e -r 3106add9a5bf misc/liblua/Xcode/Lua.xcodeproj/project.pbxproj --- a/misc/liblua/Xcode/Lua.xcodeproj/project.pbxproj Fri Oct 28 18:27:55 2011 +0200 +++ b/misc/liblua/Xcode/Lua.xcodeproj/project.pbxproj Fri Oct 28 18:33:38 2011 +0200 @@ -392,7 +392,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; @@ -410,7 +410,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; diff -r 3f8ba061775e -r 3106add9a5bf misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj --- a/misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj Fri Oct 28 18:27:55 2011 +0200 +++ b/misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj Fri Oct 28 18:33:38 2011 +0200 @@ -312,7 +312,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; @@ -330,7 +330,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; OTHER_LDFLAGS = "-ObjC"; PREBINDING = NO; SDKROOT = iphoneos; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/AboutViewController.m --- a/project_files/HedgewarsMobile/Classes/AboutViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/AboutViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,7 @@ #import "AboutViewController.h" -#import "CommodityFunctions.h" + @implementation AboutViewController @synthesize tableView, segmentedControl, people; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/AboutViewController.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/AboutViewController.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,658 @@ + + + + 1024 + 10F569 + 804 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 123 + + + YES + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 290 + + YES + + + 292 + {{127, 7}, {289, 30}} + + NO + IBIPadFramework + 2 + 5 + 0 + + YES + Code + Art + Sound + Locale + Special + + + YES + + + + + + + + YES + + + + + + + + YES + {0, 0} + {0, 0} + {0, 0} + {0, 0} + {0, 0} + + + YES + + + + + + + + + {543, 44} + + IBIPadFramework + + YES + + + + IBIPadFramework + 1 + + 0 + + + IBIPadFramework + + + + + + 274 + {{0, 44}, {543, 577}} + + + 1 + MCAwIDAgMAA + + YES + IBIPadFramework + YES + 1 + 2 + 0 + YES + 44 + 10 + 10 + + + {543, 621} + + 3 + MQA + + NO + NO + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + + 8 + + + + dataSource + + + + 12 + + + + delegate + + + + 13 + + + + tableView + + + + 14 + + + + segmentedControlChanged: + + + 13 + + 15 + + + + segmentedControl + + + + 16 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + + 5 + + + YES + + + + + + 6 + + + YES + + + + + + + 7 + + + + + 10 + + + + + 11 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.IBPluginDependency + 11.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + + + YES + AboutViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{376, 170}, {543, 621}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 16 + + + + YES + + AboutViewController + UIViewController + + YES + + YES + buttonPressed: + segmentedControlChanged: + + + YES + id + id + + + + YES + + YES + buttonPressed: + segmentedControlChanged: + + + YES + + buttonPressed: + id + + + segmentedControlChanged: + id + + + + + YES + + YES + segmentedControl + tableView + + + YES + UISegmentedControl + UITableView + + + + YES + + YES + segmentedControl + tableView + + + YES + + segmentedControl + UISegmentedControl + + + tableView + UITableView + + + + + IBProjectSource + Classes/AboutViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UINavigationBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UINavigationBar.h + + + + UINavigationItem + NSObject + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + 123 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -21,9 +21,7 @@ #import "AmmoMenuViewController.h" #import -#import "CommodityFunctions.h" -#import "UIImageExtra.h" -#import "PascalImports.h" + #define BTNS_PER_ROW 9 #define DEFAULT_DESCRIPTION IS_IPAD() ? \ @@ -92,7 +90,7 @@ int y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*44 + 18; UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(x, y, 200, 20)]; name.backgroundColor = [UIColor clearColor]; - name.textColor = UICOLOR_HW_YELLOW_BODER; + name.textColor = [UIColor darkYellowColor]; name.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; self.nameLabel = name; [self.view addSubview:self.nameLabel]; @@ -125,6 +123,7 @@ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()]; UIImage *ammoStoreImage = [[UIImage alloc] initWithContentsOfFile:str]; + CGFloat theScale = [[UIScreen mainScreen] safeScale]; NSMutableArray *imgs = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()]; NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()]; @@ -152,14 +151,14 @@ UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(x, y, 40, 40); button.tag = i; - button.layer.borderColor = [UICOLOR_HW_YELLOW_TEXT CGColor]; + button.layer.borderColor = [[UIColor lightYellowColor] CGColor]; button.layer.borderWidth = w; [button.layer setCornerRadius:radius]; [button.layer setMasksToBounds:YES]; [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchDown]; [button addTarget:self action:@selector(buttonReleased:) forControlEvents:UIControlEventTouchUpInside]; [button addTarget:self action:@selector(buttonCancelled:) forControlEvents:UIControlEventTouchUpOutside|UIControlEventTouchCancel]; - [button setTitleColor:UICOLOR_HW_YELLOW_TEXT forState:UIControlStateNormal]; + [button setTitleColor:[UIColor lightYellowColor] forState:UIControlStateNormal]; button.titleLabel.backgroundColor = [UIColor blackColor]; button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]]; [button.titleLabel.layer setCornerRadius:3]; @@ -169,9 +168,9 @@ [self.view addSubview:button]; [array addObject:button]; - int size = 32*getScreenScale(); - int x_src = ((i*size)/(int)(ammoStoreImage.size.height*getScreenScale()))*size; - int y_src = (i*size)%(int)(ammoStoreImage.size.height*getScreenScale()); + int size = 32 * theScale; + int x_src = ((i*size)/(int)(ammoStoreImage.size.height * theScale))*size; + int y_src = (i*size)%(int)(ammoStoreImage.size.height * theScale); UIImage *img = [ammoStoreImage cutAt:CGRectMake(x_src, y_src, size, size)]; [imgs addObject:img]; } @@ -221,7 +220,7 @@ shouldUpdateImage[i] = YES; } } else { - button.layer.borderColor = [UICOLOR_HW_YELLOW_TEXT CGColor]; + button.layer.borderColor = [[UIColor lightYellowColor] CGColor]; [button setTitle:nil forState:UIControlStateNormal]; if (button.currentBackgroundImage == nil || shouldUpdateImage[i] == YES) { UIImage *img = [self.imagesArray objectAtIndex:i]; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/Appirater.m --- a/project_files/HedgewarsMobile/Classes/Appirater.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/Appirater.m Fri Oct 28 18:33:38 2011 +0200 @@ -37,7 +37,7 @@ #import "Appirater.h" #import #import -#import "CommodityFunctions.h" +#import "ServerSetup.h" NSString *const kAppiraterLaunchDate = @"kAppiraterLaunchDate"; NSString *const kAppiraterLaunchCount = @"kAppiraterLaunchCount"; @@ -106,7 +106,7 @@ launchCount > LAUNCHES_UNTIL_PROMPT && !declinedToRate && !ratedApp) { - if (isNetworkReachable()) { // check if they can reach the app store + if ([ServerSetup isNetworkReachable]) { // check if they can reach the app store willShowPrompt = YES; [self performSelectorOnMainThread:@selector(showPrompt) withObject:nil waitUntilDone:NO]; } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/AudioManagerController.h --- a/project_files/HedgewarsMobile/Classes/AudioManagerController.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/AudioManagerController.h Fri Oct 28 18:33:38 2011 +0200 @@ -34,6 +34,6 @@ +(void) playBackSound; +(void) playSelectSound; -+(void) cleanupMemory; ++(void) releaseCache; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/AudioManagerController.m --- a/project_files/HedgewarsMobile/Classes/AudioManagerController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/AudioManagerController.m Fri Oct 28 18:33:38 2011 +0200 @@ -108,7 +108,7 @@ #pragma mark - #pragma mark memory management -+(void) cleanupMemory { ++(void) releaseCache { [backgroundMusic stop]; [backgroundMusic release], backgroundMusic = nil; AudioServicesDisposeSystemSoundID(clickSound), clickSound = -1; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/CommodityFunctions.h --- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2010 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * File created on 08/04/2010. - */ - - -#import - -#define DOCUMENTS_FOLDER() [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] - -#define DEBUG_FILE() [DOCUMENTS_FOLDER() stringByAppendingString:@"/hw-game.log"] -#define BASICFLAGS_FILE() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Settings/basicFlags.plist"] -#define GAMEMODS_FILE() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Settings/gameMods.plist"] -#define CREDITS_FILE() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Settings/credits.plist"] - -#define TEAMS_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Teams/"] -#define WEAPONS_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Weapons/"] -#define SCHEMES_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Schemes/"] -#define SAVES_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Saves/"] - -#define GRAPHICS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/"] -#define ICONS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Icons/"] -#define HATS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Hats/"] -#define GRAVES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Graves/"] -#define FLAGS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Flags/"] -#define FORTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Forts/"] -#define VOICES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Sounds/voices/"] -#define THEMES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Themes/"] -#define MAPS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Maps/"] -#define MISSIONS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Maps/"] -#define LOCALE_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Locale/"] -#define SCRIPTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Scripts/plist/"] - -#define MSG_MEMCLEAN() DLog(@"has cleaned up some memory"); -#define MSG_DIDUNLOAD() DLog(@"unloaded"); - -#define UICOLOR_HW_YELLOW_BODER [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xC0/255 blue:0 alpha:1] -#define UICOLOR_HW_YELLOW_TEXT [UIColor colorWithRed:(CGFloat)0xF0/255 green:(CGFloat)0xD0/255 blue:0 alpha:1] -#define UICOLOR_HW_DARKBLUE [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:1] -#define UICOLOR_HW_ALPHABLUE [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:0.58f] -#define UICOLOR_HW_ALMOSTBLACK (IS_NOT_POWERFUL(getModelType())) ? [UIColor blackColor] : [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6] - -#define IS_DUALHEAD() ([[UIScreen class] respondsToSelector:@selector(screens)] && [[UIScreen screens] count] > 1) -#define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) -#define IS_NOT_POWERFUL(x) ([x hasPrefix:@"iPhone1"] || [x hasPrefix:@"iPod1,1"] || [x hasPrefix:@"iPod2,1"]) -#define IS_NOT_VERY_POWERFUL(x) ([x hasPrefix:@"iPad1"] || [x hasPrefix:@"iPhone2"] || [x hasPrefix:@"iPod3"] || [x hasPrefix:@"iPod4"]) -#define IS_VERY_POWERFUL(x) (IS_NOT_POWERFUL(x) == NO && IS_NOT_VERY_POWERFUL(x) == NO) - -#define UIVIEW_HW_SDLVIEW [[[[UIApplication sharedApplication] keyWindow] subviews] objectAtIndex:0] - -void print_free_memory (void); -NSInteger randomPort (void); - -NSString *getModelType (void); -NSArray *getAvailableColors (void); - -UILabel *createBlueLabel (NSString *title, CGRect frame); -UILabel *createLabelWithParams (NSString *title, CGRect frame, CGFloat borderWidth, UIColor *borderColor, UIColor *backgroundColor); - -CGSize PSPNGSizeFromMetaData (NSString *aFileName); -BOOL isNetworkReachable (void); - -@interface NSString (extra) - --(NSString *) MD5hash; - -@end - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/CommodityFunctions.m --- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2010 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * File created on 08/04/2010. - */ - - -#import "CommodityFunctions.h" -#import -#import -#import -#import -#import -#import -#import -#import -#import "PascalImports.h" -#import "hwconsts.h" - - -NSInteger inline randomPort () { - srandom(time(NULL)); - NSInteger res = (random() % 64511) + 1024; - return (res == NETGAME_DEFAULT_PORT) ? randomPort() : res; -} - -// by http://landonf.bikemonkey.org/code/iphone/Determining_Available_Memory.20081203.html -void print_free_memory () { -#ifdef DEBUG - mach_port_t host_port; - mach_msg_type_number_t host_size; - vm_size_t pagesize; - - host_port = mach_host_self(); - host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); - host_page_size(host_port, &pagesize); - - vm_statistics_data_t vm_stat; - - if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) - DLog(@"Failed to fetch vm statistics"); - - /* Stats in bytes */ - natural_t mem_used = (vm_stat.active_count + vm_stat.inactive_count + vm_stat.wire_count) * pagesize; - natural_t mem_free = vm_stat.free_count * pagesize; - natural_t mem_total = mem_used + mem_free; - DLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total); -#endif -} - -NSString *getModelType () { - size_t size; - // set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *name = (char *)malloc(sizeof(char) * size); - // get the platform name - sysctlbyname("hw.machine", name, &size, NULL, 0); - NSString *modelId = [NSString stringWithUTF8String:name]; - free(name); - - return modelId; -} - -NSArray *getAvailableColors (void) { - // by default colors are ARGB but we do computation over RGB, hence we have to "& 0x00FFFFFF" before processing - unsigned int colors[] = HW_TEAMCOLOR_ARRAY; - NSMutableArray *array = [[NSMutableArray alloc] init]; - - int i = 0; - while(colors[i] != 0) - [array addObject:[NSNumber numberWithUnsignedInt:(colors[i++] & 0x00FFFFFF)]]; - - NSArray *final = [NSArray arrayWithArray:array]; - [array release]; - return final; -} - -UILabel *createBlueLabel (NSString *title, CGRect frame) { - return createLabelWithParams(title, frame, 1.5f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_DARKBLUE); -} - -UILabel *createLabelWithParams (NSString *title, CGRect frame, CGFloat borderWidth, UIColor *borderColor, UIColor *backgroundColor) { - UILabel *theLabel = [[UILabel alloc] initWithFrame:frame]; - theLabel.backgroundColor = backgroundColor; - - if (title != nil) { - theLabel.text = title; - theLabel.textColor = UICOLOR_HW_YELLOW_TEXT; - theLabel.textAlignment = UITextAlignmentCenter; - theLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]*80/100]; - } - - [theLabel.layer setBorderWidth:borderWidth]; - [theLabel.layer setBorderColor:borderColor.CGColor]; - [theLabel.layer setCornerRadius:8.0f]; - [theLabel.layer setMasksToBounds:YES]; - - return theLabel; -} - -BOOL isNetworkReachable (void) { - // Create zero addy - struct sockaddr_in zeroAddress; - bzero(&zeroAddress, sizeof(zeroAddress)); - zeroAddress.sin_len = sizeof(zeroAddress); - zeroAddress.sin_family = AF_INET; - - // Recover reachability flags - SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress); - SCNetworkReachabilityFlags flags; - - BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags); - CFRelease(defaultRouteReachability); - - if (!didRetrieveFlags) { - NSLog(@"Error. Could not recover network reachability flags"); - return NO; - } - - BOOL isReachable = flags & kSCNetworkFlagsReachable; - BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired; - BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection; - - NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"]; - NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL - cachePolicy:NSURLRequestReloadIgnoringLocalCacheData - timeoutInterval:20.0]; - NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:nil]; - BOOL testResult = testConnection ? YES : NO; - [testConnection release]; - - return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO; -} - -// this routine checks for the PNG size without loading it in memory -// https://github.com/steipete/PSFramework/blob/master/PSFramework%20Version%200.3/PhotoshopFramework/PSMetaDataFunctions.m -CGSize PSPNGSizeFromMetaData (NSString *aFileName) { - // File Name to C String. - const char *fileName = [aFileName UTF8String]; - // source file - FILE *infile = fopen(fileName, "rb"); - if (infile == NULL) { - DLog(@"Can't open the file: %@", aFileName); - return CGSizeZero; - } - - // Bytes Buffer. - unsigned char buffer[30]; - // Grab Only First Bytes. - fread(buffer, 1, 30, infile); - // Close File. - fclose(infile); - - // PNG Signature. - unsigned char png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; - - // Compare File signature. - if ((int)(memcmp(&buffer[0], &png_signature[0], 8))) { - DLog(@"The file (%@) is not a PNG file", aFileName); - return CGSizeZero; - } - - // Calc Sizes. Isolate only four bytes of each size (width, height). - int width[4]; - int height[4]; - for (int d = 16; d < (16 + 4); d++) { - width[d-16] = buffer[d]; - height[d-16] = buffer[d+4]; - } - - // Convert bytes to Long (Integer) - long resultWidth = (width[0] << (int)24) | (width[1] << (int)16) | (width[2] << (int)8) | width[3]; - long resultHeight = (height[0] << (int)24) | (height[1] << (int)16) | (height[2] << (int)8) | height[3]; - - // Return Size. - return CGSizeMake(resultWidth,resultHeight); -} - -@implementation NSString (extra) - --(NSString *)MD5hash { - const char *cStr = [self UTF8String]; - unsigned char result[16]; - CC_MD5( cStr, strlen(cStr), result ); - return [NSString stringWithFormat: - @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - result[0], result[1], result[2], result[3], result[4], result[5], - result[6], result[7], result[8], result[9], result[10], result[11], - result[12], result[13], result[14], result[15]]; -} - - -@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/CreationChamber.h --- a/project_files/HedgewarsMobile/Classes/CreationChamber.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/CreationChamber.h Fri Oct 28 18:33:38 2011 +0200 @@ -21,7 +21,21 @@ #import -void createSettings (void); -void createTeamNamed (NSString *nameWithoutExt); -void createWeaponNamed (NSString *nameWithoutExt, int type); -void createSchemeNamed (NSString *nameWithoutExt, int type); +@interface CreationChamber : NSObject { + +} + ++(void) createSettings; + ++(void) createTeamNamed:(NSString *)nameWithoutExt; ++(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type; ++(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type controlledByAI:(BOOL) shouldAITakeOver; + ++(void) createWeaponNamed:(NSString *)nameWithoutExt; ++(void) createWeaponNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type; + ++(void) createSchemeNamed:(NSString *)nameWithoutExt; ++(void) createSchemeNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type; + +@end + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/CreationChamber.m --- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Fri Oct 28 18:33:38 2011 +0200 @@ -22,7 +22,11 @@ #import "CreationChamber.h" #import "hwconsts.h" -void createSettings () { + +@implementation CreationChamber + +#pragma mark Settings ++(void) createSettings { NSUserDefaults *settings = [NSUserDefaults standardUserDefaults]; [settings setObject:[NSNumber numberWithBool:NO] forKey:@"alternate"]; [settings setObject:[NSNumber numberWithBool:YES] forKey:@"music"]; @@ -39,7 +43,16 @@ [settings synchronize]; } -void createTeamNamed (NSString *nameWithoutExt) { +#pragma mark Teams ++(void) createTeamNamed:(NSString *)nameWithoutExt { + [CreationChamber createTeamNamed:nameWithoutExt ofType:0 controlledByAI:NO]; +} + ++(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type { + [CreationChamber createTeamNamed:nameWithoutExt ofType:type controlledByAI:NO]; +} + ++(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type controlledByAI:(BOOL) shouldAITakeOver { NSString *teamsDirectory = TEAMS_DIRECTORY(); if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) { @@ -49,26 +62,68 @@ error:NULL]; } - NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity: HW_getMaxNumberOfHogs()]; + NSArray *customNames; + NSArray *customHats; + NSString *flag, *grave, *voicepack, *fort; + switch (type) { + default: // default + customNames = [[NSArray alloc] initWithObjects:@"No Name",@"Unnamed",@"Anonymous",@"Nameless",@"Incognito",@"Unidentified", + @"Uknown",@"Secret",nil]; + customHats = [[NSArray alloc] initWithObjects:@"NoHat",@"NoHat",@"NoHat",@"NoHat",@"NoHat",@"NoHat",@"NoHat",@"NoHat",nil]; + flag = @"hedgewars"; + grave = @"Statue"; + voicepack = @"Default"; + fort = @"Plane"; + break; + case 1: // ninjas + customNames = [[NSArray alloc] initWithObjects:@"Shinobi",@"Ukemi",@"Godai",@"Ninpo",@"Tatsujin",@"Arashi",@"Bushi",@"Itami",nil]; + customHats = [[NSArray alloc] initWithObjects:@"NinjaFull",@"NinjaStraight",@"NinjaTriangle",@"NinjaFull",@"NinjaStraight", + @"NinjaTriangle",@"NinjaFull",@"NinjaTriangle",nil]; + flag = @"japan"; + grave = @"bp2"; + voicepack = @"Singer"; + fort = @"Wood"; + break; + case 2: // pirates + customNames = [[NSArray alloc] initWithObjects:@"Toothless Wayne",@"Long-nose Kidd",@"Eye-patch Jim",@"Rackham Blood",@"One-eyed Ayee", + @"Dirty Ben",@"Morris",@"Cruise Seymour",nil]; + customHats = [[NSArray alloc] initWithObjects:@"pirate_jack_bandana",@"pirate_jack",@"dwarf",@"pirate_jack_bandana",@"pirate_jack", + @"dwarf",@"pirate_jack_bandana",@"pirate_jack",nil]; + flag = @"cm_pirate"; + grave = @"chest"; + voicepack = @"Pirate"; + fort = @"Hydrant"; + break; + case 3: // robots + customNames = [[NSArray alloc] initWithObjects:@"HAL",@"R2-D2",@"Wall-E",@"Robocop",@"Optimus Prime",@"Terminator",@"C-3PO",@"KITT",nil]; + customHats = [[NSArray alloc] initWithObjects:@"cyborg1",@"cyborg2",@"cyborg1",@"cyborg2",@"cyborg1",@"cyborg2",@"cyborg1", + @"cyborg2",nil]; + flag = @"cm_binary"; + grave = @"Rip"; + voicepack = @"Robot"; + fort = @"UFO"; + break; + } + NSMutableArray *hedgehogs = [[NSMutableArray alloc] initWithCapacity:HW_getMaxNumberOfHogs()]; for (int i = 0; i < HW_getMaxNumberOfHogs(); i++) { - NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i]; NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSNumber numberWithInt:0],@"level", - hogName,@"hogname", - @"NoHat",@"hat", + [NSNumber numberWithInt:(shouldAITakeOver ? 4 : 0)],@"level", + [customNames objectAtIndex:i],@"hogname", + [customHats objectAtIndex:i],@"hat", nil]; - [hogName release]; [hedgehogs addObject:hog]; [hog release]; } + [customHats release]; + [customNames release]; NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys: @"0",@"hash", - @"Statue",@"grave", - @"Plane",@"fort", - @"Default",@"voicepack", - @"hedgewars",@"flag", + grave,@"grave", + fort,@"fort", + voicepack,@"voicepack", + flag,@"flag", hedgehogs,@"hedgehogs", nil]; [hedgehogs release]; @@ -80,7 +135,12 @@ [theTeam release]; } -void createWeaponNamed (NSString *nameWithoutExt, int type) { +#pragma mark Weapons ++(void) createWeaponNamed:(NSString *)nameWithoutExt { + [CreationChamber createWeaponNamed:nameWithoutExt ofType:0]; +} + ++(void) createWeaponNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type { NSString *weaponsDirectory = WEAPONS_DIRECTORY(); if (![[NSFileManager defaultManager] fileExistsAtPath: weaponsDirectory]) { @@ -99,37 +159,37 @@ delay = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; crate = [[NSString alloc] initWithBytes:AMMOLINE_DEFAULT_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; break; - case 1: //crazy + case 1: //crazy qt = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_QT length:ammolineSize encoding:NSUTF8StringEncoding]; prob = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; delay = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; crate = [[NSString alloc] initWithBytes:AMMOLINE_CRAZY_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; break; - case 2: //pro mode + case 2: //pro mode qt = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_QT length:ammolineSize encoding:NSUTF8StringEncoding]; prob = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; delay = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; crate = [[NSString alloc] initWithBytes:AMMOLINE_PROMODE_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; break; - case 3: //shoppa + case 3: //shoppa qt = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_QT length:ammolineSize encoding:NSUTF8StringEncoding]; prob = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; delay = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; crate = [[NSString alloc] initWithBytes:AMMOLINE_SHOPPA_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; break; - case 4: //clean slate + case 4: //clean slate qt = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_QT length:ammolineSize encoding:NSUTF8StringEncoding]; prob = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; delay = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; crate = [[NSString alloc] initWithBytes:AMMOLINE_CLEAN_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; break; - case 5: //minefield + case 5: //minefield qt = [[NSString alloc] initWithBytes:AMMOLINE_MINES_QT length:ammolineSize encoding:NSUTF8StringEncoding]; prob = [[NSString alloc] initWithBytes:AMMOLINE_MINES_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; delay = [[NSString alloc] initWithBytes:AMMOLINE_MINES_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; crate = [[NSString alloc] initWithBytes:AMMOLINE_MINES_CRATE length:ammolineSize encoding:NSUTF8StringEncoding]; break; - case 6: //thinking with portals + case 6: //thinking with portals qt = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_QT length:ammolineSize encoding:NSUTF8StringEncoding]; prob = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_PROB length:ammolineSize encoding:NSUTF8StringEncoding]; delay = [[NSString alloc] initWithBytes:AMMOLINE_PORTALS_DELAY length:ammolineSize encoding:NSUTF8StringEncoding]; @@ -150,7 +210,12 @@ [theWeapon release]; } -void createSchemeNamed (NSString *nameWithoutExt, int type) { +#pragma mark Schemes ++(void) createSchemeNamed:(NSString *)nameWithoutExt { + [CreationChamber createSchemeNamed:nameWithoutExt ofType:0]; +} + ++(void) createSchemeNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type { NSString *schemesDirectory = SCHEMES_DIRECTORY(); if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) { @@ -174,17 +239,17 @@ [mods release]; switch (type) { - case 0: // default + default: // default [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; break; - case 1: // pro mode + case 1: // pro mode [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:15]]; [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; break; - case 2: // shoppa + case 2: // shoppa [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; [basicArray replaceObjectAtIndex:3 withObject:[NSNumber numberWithInt:50]]; [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:1]]; @@ -199,13 +264,13 @@ [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:19 withObject:[NSNumber numberWithBool:YES]]; break; - case 3: // clean slate + case 3: // clean slate [gamemodArray replaceObjectAtIndex:6 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:18 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:19 withObject:[NSNumber numberWithBool:YES]]; break; - case 4: // minefield + case 4: // minefield [basicArray replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:50]]; [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; @@ -216,7 +281,7 @@ [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; break; - case 5: // barrel mayhem + case 5: // barrel mayhem [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:0]]; @@ -225,7 +290,7 @@ [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; break; - case 6: // tunnel hogs + case 6: // tunnel hogs [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; [basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:3]]; [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:10]]; @@ -237,7 +302,7 @@ [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:16 withObject:[NSNumber numberWithBool:YES]]; break; - case 7: // fort mode + case 7: // fort mode [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; [gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; @@ -245,7 +310,7 @@ [gamemodArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; break; - case 8: // timeless + case 8: // timeless [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:100]]; [basicArray replaceObjectAtIndex:4 withObject:[NSNumber numberWithInt:0]]; [basicArray replaceObjectAtIndex:5 withObject:[NSNumber numberWithInt:0]]; @@ -256,7 +321,7 @@ [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:20 withObject:[NSNumber numberWithBool:YES]]; break; - case 9: // thinking with portals + case 9: // thinking with portals [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:2]]; [basicArray replaceObjectAtIndex:8 withObject:[NSNumber numberWithInt:25]]; [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:4]]; @@ -265,13 +330,10 @@ [gamemodArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; break; - case 10:// king mode + case 10: // king mode [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; [gamemodArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithBool:YES]]; break; - default: - DLog(@"Impossible"); - break; } NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys: @@ -287,3 +349,5 @@ [schemeFile release]; [theScheme release]; } + +@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/DefinesAndMacros.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,83 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 01/10/2011. + */ + + +// some macros by http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ +// and http://blog.coriolis.ch/2009/01/05/macros-for-xcode/ + + +#ifdef DEBUG + #define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) + #define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__] + #define releaseAndNil(x) [x release] +#else + #define DLog(...) do { } while (0) + #ifndef NS_BLOCK_ASSERTIONS + #define NS_BLOCK_ASSERTIONS + #endif + #define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) + #define releaseAndNil(x) [x release], x = nil +#endif + + +#define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0) +#define rotationManager(x) (x == UIInterfaceOrientationLandscapeRight) || (x == UIInterfaceOrientationLandscapeLeft) + +#define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; +#define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); + + +#define DOCUMENTS_FOLDER() [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] + +#define DEBUG_FILE() [DOCUMENTS_FOLDER() stringByAppendingString:@"/hw-game.log"] +#define BASICFLAGS_FILE() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/basicFlags.plist"] +#define GAMEMODS_FILE() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/gameMods.plist"] +#define CREDITS_FILE() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/credits.plist"] + +#define TEAMS_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Teams/"] +#define WEAPONS_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Weapons/"] +#define SCHEMES_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Schemes/"] +#define SAVES_DIRECTORY() [DOCUMENTS_FOLDER() stringByAppendingString:@"/Saves/"] + +#define GRAPHICS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/"] +#define ICONS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Icons/"] +#define HATS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Hats/"] +#define GRAVES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Graves/"] +#define FLAGS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Flags/"] +#define FORTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Forts/"] +#define VOICES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Sounds/voices/"] +#define THEMES_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Themes/"] +#define MAPS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Maps/"] +#define MISSIONS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Maps/"] +#define TRAININGS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Training/"] +#define LOCALE_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Locale/"] +#define SCRIPTS_DIRECTORY() [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Scripts/plist/"] + +#define MSG_MEMCLEAN() DLog(@"has cleaned up some memory"); +#define MSG_DIDUNLOAD() DLog(@"unloaded"); + +#define IS_DUALHEAD() ([[UIScreen class] respondsToSelector:@selector(screens)] && [[UIScreen screens] count] > 1) +#define IS_IPAD() (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) +#define IS_NOT_POWERFUL(x) ([x hasPrefix:@"iPhone1"] || [x hasPrefix:@"iPod1,1"] || [x hasPrefix:@"iPod2,1"]) +#define IS_NOT_VERY_POWERFUL(x) ([x hasPrefix:@"iPad1"] || [x hasPrefix:@"iPhone2"] || [x hasPrefix:@"iPod3"] || [x hasPrefix:@"iPod4"]) +#define IS_VERY_POWERFUL(x) (IS_NOT_POWERFUL(x) == NO && IS_NOT_VERY_POWERFUL(x) == NO) + +#define UIVIEW_HW_SDLVIEW [[[[UIApplication sharedApplication] keyWindow] subviews] objectAtIndex:0] + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/EditableCellView.m --- a/project_files/HedgewarsMobile/Classes/EditableCellView.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/EditableCellView.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,7 @@ #import "EditableCellView.h" -#import "CommodityFunctions.h" + @implementation EditableCellView @synthesize delegate, textField, titleLabel, minimumCharacters, maximumCharacters, respectEditing, oldValue; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m --- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,10 +20,9 @@ #import "EngineProtocolNetwork.h" -#import "PascalImports.h" -#import "CommodityFunctions.h" #import "OverlayViewController.h" + #define BUFFER_SIZE 255 // like in original frontend @implementation EngineProtocolNetwork @@ -62,7 +61,7 @@ #pragma mark - #pragma mark Spawner functions -(void) spawnThread:(NSString *)onSaveFile withOptions:(NSDictionary *)dictionary { - self.stream = [[NSOutputStream alloc] initToFileAtPath:onSaveFile append:YES]; + self.stream = (onSaveFile) ? [[NSOutputStream alloc] initToFileAtPath:onSaveFile append:YES] : nil; [self.stream open]; [NSThread detachNewThreadSelector:@selector(engineProtocol:) @@ -289,6 +288,9 @@ NSString *script = [gameConfig objectForKey:@"mission_command"]; if ([script length] != 0) [self sendToEngine:script]; + // missions/tranings only need the script configuration set + if ([gameConfig count] == 1) + break; // seed info [self sendToEngine:[gameConfig objectForKey:@"seed_command"]]; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/FlagsViewController.m --- a/project_files/HedgewarsMobile/Classes/FlagsViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/FlagsViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -21,7 +21,7 @@ #import "FlagsViewController.h" #import -#import "CommodityFunctions.h" + @implementation FlagsViewController @synthesize teamDictionary, flagArray, communityArray, lastIndexPath; @@ -100,8 +100,9 @@ UIImage *flagSprite = [[UIImage alloc] initWithContentsOfFile:flagFile]; [flagFile release]; cell.imageView.image = flagSprite; - cell.imageView.layer.borderWidth = 0.3; [flagSprite release]; + cell.imageView.layer.borderWidth = 1; + cell.imageView.layer.borderColor = [[UIColor blackColor] CGColor]; cell.textLabel.text = [[source objectAtIndex:row] stringByDeletingPathExtension]; if ([[flagName stringByDeletingPathExtension] isEqualToString:[self.teamDictionary objectForKey:@"flag"]]) { diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/FortsViewController.m --- a/project_files/HedgewarsMobile/Classes/FortsViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/FortsViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,8 +20,7 @@ #import "FortsViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" + #define IMGNUM_PER_FORT 6 diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/GameConfigViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController-iPad.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1114 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 292 + {1024, 768} + + + NO + YES + NO + IBIPadFramework + + NSImage + background.png + + + + + 292 + {{357, 17}, {309, 165}} + + + NO + NO + IBIPadFramework + + NSImage + title~iphone.png + + + + + 292 + {{441, 702}, {142, 64}} + + + NO + 1 + IBIPadFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + NSImage + startGameButton.png + + + + + 292 + {{20, 693}, {64, 64}} + + + NO + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + backButton.png + + + + + 292 + {{940, 693}, {64, 64}} + + + NO + 2 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + helpButton.png + + + + + 278 + {{0, 60}, {320, 620}} + + + + 3 + MCAwAA + + NO + YES + IBIPadFramework + + + + 277 + {{337, 187}, {350, 505}} + + + + NO + YES + IBIPadFramework + + + + 292 + {{269, 724}, {150, 23}} + + + NO + IBIPadFramework + 0 + 0 + 0.05000000074505806 + 0.05000000074505806 + + + + 292 + {{121, 720}, {148, 30}} + + + NO + YES + 7 + NO + IBIPadFramework + Label + + Helvetica-Oblique + 18 + 16 + + + 3 + MQA + + 2 + + + + 1 + 10 + 1 + + + {1024, 768} + + + + YES + + 3 + + IBIPadFramework + + + NO + + 3 + + IBIPadFramework + YES + + + NO + + IBIPadFramework + YES + + + NO + MapConfigViewController-iPad + + IBIPadFramework + YES + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + 7 + + 35 + + + + buttonPressed: + + + 7 + + 36 + + + + buttonPressed: + + + 7 + + 37 + + + + teamConfigViewController + + + + 45 + + + + view + + + + 47 + + + + view + + + + 50 + + + + schemeWeaponConfigViewController + + + + 51 + + + + mapConfigViewController + + + + 57 + + + + slider + + + + 61 + + + + sizeLabel + + + + 65 + + + + sliderChanged: + + + 13 + + 66 + + + + sliderEndedChanging: + + + 7 + + 67 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + + + + + + + + + 30 + + + Background + + + 31 + + + Title + + + 32 + + + Start Button + + + 33 + + + Back Button + + + 34 + + + Help Button + + + 44 + + + YES + + + + + 46 + + + YES + + + TeamConfigViewController View + + + 48 + + + + + 49 + + + SchemeWeaponConfigViewController View + + + 55 + + + + + 60 + + + Filter Slider + + + 64 + + + Filter Label + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 30.IBPluginDependency + 30.IBViewBoundsToFrameTransform + 31.IBPluginDependency + 31.IBViewBoundsToFrameTransform + 32.IBPluginDependency + 32.IBViewBoundsToFrameTransform + 33.IBPluginDependency + 33.IBViewBoundsToFrameTransform + 34.IBPluginDependency + 34.IBViewBoundsToFrameTransform + 44.CustomClassName + 44.IBEditorWindowLastContentRect + 44.IBPluginDependency + 46.IBPluginDependency + 46.IBViewBoundsToFrameTransform + 48.CustomClassName + 48.IBEditorWindowLastContentRect + 48.IBPluginDependency + 49.IBPluginDependency + 49.IBViewBoundsToFrameTransform + 55.CustomClassName + 55.IBEditorWindowLastContentRect + 55.IBPluginDependency + 60.IBPluginDependency + 60.IBViewBoundsToFrameTransform + 64.IBPluginDependency + 64.IBViewBoundsToFrameTransform + + + YES + GameConfigViewController + UIResponder + {{289, 287}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABAoAAAxLrgAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDtQAAxGNAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABD3wAAxLqgAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABByAAAxLmAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABEbEAAxLmAAA + + TeamConfigViewController + {{63, 355}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUOogABDOwAAA + + SchemeWeaponConfigViewController + {{84, 388}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAxHqAAA + + MapConfigViewController + {{126, 377}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUNRAABEMoAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAADCtgAAxDoAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 67 + + + + YES + + GameConfigViewController + UIViewController + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + id + id + + + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + + buttonPressed: + id + + + segmentPressed: + id + + + + + YES + + YES + mapConfigViewController + schemeWeaponConfigViewController + teamConfigViewController + + + YES + MapConfigViewController + SchemeWeaponConfigViewController + TeamConfigViewController + + + + YES + + YES + mapConfigViewController + schemeWeaponConfigViewController + teamConfigViewController + + + YES + + mapConfigViewController + MapConfigViewController + + + schemeWeaponConfigViewController + SchemeWeaponConfigViewController + + + teamConfigViewController + TeamConfigViewController + + + + + IBProjectSource + Classes/GameConfigViewController.h + + + + MapConfigViewController + UIViewController + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + id + id + id + id + + + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + + mapButtonPressed: + id + + + segmentedControlChanged: + id + + + sliderChanged: + id + + + sliderEndedChanging: + id + + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + UILabel + MapPreviewButtonView + UISegmentedControl + UILabel + UISlider + UITableView + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + + maxLabel + UILabel + + + previewButton + MapPreviewButtonView + + + segmentedControl + UISegmentedControl + + + sizeLabel + UILabel + + + slider + UISlider + + + tableView + UITableView + + + + + IBProjectSource + Classes/MapConfigViewController.h + + + + MapPreviewButtonView + UIButton + + delegate + id + + + delegate + + delegate + id + + + + IBProjectSource + Classes/MapPreviewButtonView.h + + + + SchemeWeaponConfigViewController + UIViewController + + IBProjectSource + Classes/SchemeWeaponConfigViewController.h + + + + TeamConfigViewController + UIViewController + + IBProjectSource + Classes/TeamConfigViewController.h + + + + UILabel + + IBProjectSource + ExtraCategories.h + + + + UITableView + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UISlider + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISlider.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + backButton.png + background.png + helpButton.png + startGameButton.png + title~iphone.png + + + YES + {64, 64} + {1024, 768} + {64, 64} + {142, 64} + {270, 150} + + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/GameConfigViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController-iPhone.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,998 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 292 + + YES + + + 266 + + YES + + + 292 + {{96, 8}, {270, 30}} + + NO + 12345 + IBCocoaTouchFramework + 2 + 4 + 0 + + YES + Map + Teams + Details + Help + + + YES + + + + + + + YES + + + + + + + YES + {0, 0} + {0, 0} + {0, 0} + {0, 0} + + + YES + + + + + + + 1 + MC42IDAuNiAwLjYAA + + + + {{0, 276}, {480, 44}} + + NO + NO + IBCocoaTouchFramework + 1 + + YES + + Back + IBCocoaTouchFramework + 1 + + + + IBCocoaTouchFramework + + 5 + + + IBCocoaTouchFramework + + + + + IBCocoaTouchFramework + + 5 + + + 1 + Start + IBCocoaTouchFramework + 68 + 2 + + + + + + + 274 + {480, 276} + + + 3 + MQA + + 2 + + + YES + IBCocoaTouchFramework + + + + 274 + {480, 276} + + + 3 + MQA + + + YES + IBCocoaTouchFramework + + + {480, 320} + + + 3 + MQA + + NO + + 3 + + IBCocoaTouchFramework + + + MapConfigViewController-iPhone + + + 3 + + IBCocoaTouchFramework + YES + + + + 1 + + + IBCocoaTouchFramework + YES + + + + + IBCocoaTouchFramework + YES + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + + 17 + + + + buttonPressed: + + + + 23 + + + + segmentPressed: + + + 13 + + 29 + + + + mapConfigViewController + + + + 33 + + + + teamConfigViewController + + + + 34 + + + + schemeWeaponConfigViewController + + + + 35 + + + + view + + + + 42 + + + + view + + + + 43 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + + + 15 + + + YES + + + + + + + + + + 16 + + + + + 18 + + + + + 19 + + + + + 21 + + + YES + + + + + + 20 + + + + + 22 + + + + + 30 + + + + + 31 + + + + + 32 + + + + + 40 + + + TeamConfigViewController View + + + 41 + + + SchemeWeaponConfigViewController View + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 15.IBPluginDependency + 15.IBViewBoundsToFrameTransform + 16.IBPluginDependency + 18.IBPluginDependency + 19.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 20.IBPluginDependency + 22.IBPluginDependency + 30.CustomClassName + 30.IBEditorWindowLastContentRect + 30.IBPluginDependency + 31.CustomClassName + 31.IBEditorWindowLastContentRect + 31.IBPluginDependency + 32.CustomClassName + 32.IBEditorWindowLastContentRect + 32.IBPluginDependency + 40.IBPluginDependency + 40.IBViewBoundsToFrameTransform + 41.IBPluginDependency + 41.IBViewBoundsToFrameTransform + + + YES + GameConfigViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAw58AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{40, 217}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + MapConfigViewController + {{0, 825}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + TeamConfigViewController + {{21, 802}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + SchemeWeaponConfigViewController + {{42, 779}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAw5QAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAw5QAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 45 + + + + YES + + GameConfigViewController + UIViewController + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + id + id + + + + YES + + YES + buttonPressed: + segmentPressed: + + + YES + + buttonPressed: + id + + + segmentPressed: + id + + + + + YES + + YES + mapConfigViewController + schemeWeaponConfigViewController + teamConfigViewController + + + YES + MapConfigViewController + SchemeWeaponConfigViewController + TeamConfigViewController + + + + YES + + YES + mapConfigViewController + schemeWeaponConfigViewController + teamConfigViewController + + + YES + + mapConfigViewController + MapConfigViewController + + + schemeWeaponConfigViewController + SchemeWeaponConfigViewController + + + teamConfigViewController + TeamConfigViewController + + + + + IBProjectSource + Classes/GameConfigViewController.h + + + + MapConfigViewController + UIViewController + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + id + id + id + id + + + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + + mapButtonPressed: + id + + + segmentedControlChanged: + id + + + sliderChanged: + id + + + sliderEndedChanging: + id + + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + UILabel + MapPreviewButtonView + UISegmentedControl + UILabel + UISlider + UITableView + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + + maxLabel + UILabel + + + previewButton + MapPreviewButtonView + + + segmentedControl + UISegmentedControl + + + sizeLabel + UILabel + + + slider + UISlider + + + tableView + UITableView + + + + + IBProjectSource + Classes/MapConfigViewController.h + + + + MapPreviewButtonView + UIButton + + delegate + id + + + delegate + + delegate + id + + + + IBProjectSource + Classes/MapPreviewButtonView.h + + + + SchemeWeaponConfigViewController + UIViewController + + IBProjectSource + Classes/SchemeWeaponConfigViewController.h + + + + TeamConfigViewController + UIViewController + + IBProjectSource + Classes/TeamConfigViewController.h + + + + UILabel + + IBProjectSource + ExtraCategories.h + + + + UITableView + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UISlider + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISlider.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIToolbar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIToolbar.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/GameConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -21,31 +21,29 @@ #import -@class HelpPageViewController; -@class MapConfigViewController; +@class SchemeWeaponConfigViewController; @class TeamConfigViewController; -@class SchemeWeaponConfigViewController; -@class GameInterfaceBridge; +@class MapConfigViewController; +@class HelpPageViewController; @interface GameConfigViewController : UIViewController { UIView *imgContainer; - HelpPageViewController *helpPage; - + + SchemeWeaponConfigViewController *schemeWeaponConfigViewController; + TeamConfigViewController *teamConfigViewController; MapConfigViewController *mapConfigViewController; - TeamConfigViewController *teamConfigViewController; - SchemeWeaponConfigViewController *schemeWeaponConfigViewController; - GameInterfaceBridge *interfaceBridge; + HelpPageViewController *helpPage; } @property (retain) UIView *imgContainer; +@property (nonatomic,retain) IBOutlet SchemeWeaponConfigViewController *schemeWeaponConfigViewController; +@property (nonatomic,retain) IBOutlet TeamConfigViewController *teamConfigViewController; +@property (nonatomic,retain) IBOutlet MapConfigViewController *mapConfigViewController; @property (nonatomic,retain) HelpPageViewController *helpPage; -@property (nonatomic,retain) MapConfigViewController *mapConfigViewController; -@property (nonatomic,retain) TeamConfigViewController *teamConfigViewController; -@property (nonatomic,retain) SchemeWeaponConfigViewController *schemeWeaponConfigViewController; -@property (nonatomic,retain) GameInterfaceBridge *interfaceBridge; -(IBAction) buttonPressed:(id) sender; -(IBAction) segmentPressed:(id) sender; -(void) startGame:(UIButton *)button; +-(BOOL) isEverythingSet; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -25,12 +25,10 @@ #import "SchemeWeaponConfigViewController.h" #import "HelpPageViewController.h" #import "GameInterfaceBridge.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" -#import "PascalImports.h" + @implementation GameConfigViewController -@synthesize imgContainer, helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController, interfaceBridge; +@synthesize imgContainer, helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @@ -57,15 +55,24 @@ break; case 1: [AudioManagerController playClickSound]; + if ([self isEverythingSet] == NO) + return; theButton.enabled = NO; + for (UIView *oneView in self.imgContainer.subviews) { + if ([oneView isMemberOfClass:[UIImageView class]]) { + UIImageView *anImageView = (UIImageView *)oneView; + [anImageView removeFromSuperview]; + } + } [self startGame:theButton]; + break; case 2: [AudioManagerController playClickSound]; if (self.helpPage == nil) self.helpPage = [[HelpPageViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPad" bundle:nil]; self.helpPage.view.alpha = 0; - [self.view addSubview:helpPage.view]; + [self.view addSubview:self.helpPage.view]; [UIView beginAnimations:@"helplobby" context:NULL]; self.helpPage.view.alpha = 1; [UIView commitAnimations]; @@ -77,34 +84,22 @@ } -(IBAction) segmentPressed:(id) sender { + UISegmentedControl *theSegment = (UISegmentedControl *)sender; [AudioManagerController playSelectSound]; switch (theSegment.selectedSegmentIndex) { case 0: - // this init here is just aestetic as this controller was already set up in viewDidLoad - if (mapConfigViewController == nil) { - mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; - [self.view addSubview:mapConfigViewController.view]; - } // this message is compulsory otherwise the table won't be loaded at all - [mapConfigViewController viewWillAppear:NO]; - [self.view bringSubviewToFront:mapConfigViewController.view]; + [self.mapConfigViewController viewWillAppear:NO]; + [self.view bringSubviewToFront:self.mapConfigViewController.view]; break; case 1: - if (teamConfigViewController == nil) { - teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.view addSubview:teamConfigViewController.view]; - } // this message is compulsory otherwise the table won't be loaded at all - [teamConfigViewController viewWillAppear:NO]; - [self.view bringSubviewToFront:teamConfigViewController.view]; + [self.teamConfigViewController viewWillAppear:NO]; + [self.view bringSubviewToFront:self.teamConfigViewController.view]; break; case 2: - if (schemeWeaponConfigViewController == nil) { - schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.view addSubview:schemeWeaponConfigViewController.view]; - } // this message is compulsory otherwise the table won't be loaded at all [schemeWeaponConfigViewController viewWillAppear:NO]; [self.view bringSubviewToFront:schemeWeaponConfigViewController.view]; @@ -122,6 +117,7 @@ DLog(@"Nope"); break; } + } -(BOOL) isEverythingSet { @@ -208,9 +204,6 @@ -(void) startGame:(UIButton *)button { button.enabled = YES; - - if ([self isEverythingSet] == NO) - return; NSString *script = self.mapConfigViewController.missionCommand; if ([script isEqualToString:@""]) @@ -230,45 +223,59 @@ script,@"mission_command", nil]; - if (self.interfaceBridge == nil) { - GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; - self.interfaceBridge = bridge; - [bridge release]; - } - [self.interfaceBridge startLocalGame:gameDictionary]; + GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; + [bridge startLocalGame:gameDictionary]; + [bridge release]; } -(void) loadNiceHogs { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSString *filePath = [NSString stringWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()]; - UIImage *sprite = [[UIImage alloc] initWithContentsOfFile:filePath andCutAt:CGRectMake(96, 0, 32, 32)]; - + srand(time(NULL)); + NSString *filePath = [[NSString alloc] initWithFormat:@"%@/Hedgehog/Idle.png",GRAPHICS_DIRECTORY()]; + UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:filePath]; + [filePath release]; + NSArray *hatArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:HATS_DIRECTORY() error:NULL]; int numberOfHats = [hatArray count]; + int animationFrames = IS_VERY_POWERFUL([HWUtils modelType]) ? 18 : 1; if (self.imgContainer != nil) [self.imgContainer removeFromSuperview]; - + self.imgContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)]; for (int i = 0; i < 1 + random()%20; i++) { NSString *hat = [hatArray objectAtIndex:random()%numberOfHats]; - + NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@", HATS_DIRECTORY(), hat]; - UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile: hatFile andCutAt:CGRectMake(0, 0, 32, 32)]; - [hatFile release]; - UIImage *hogWithHat = [sprite mergeWith:hatSprite atPoint:CGPointMake(0, 5)]; + UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile:hatFile]; + NSMutableArray *animation = [[NSMutableArray alloc] initWithCapacity:animationFrames]; + for (int j = 0; j < animationFrames; j++) { + int x = ((j*32)/(int)hatSprite.size.height)*32; + int y = (j*32)%(int)hatSprite.size.height; + UIImage *hatSpriteFrame = [hatSprite cutAt:CGRectMake(x, y, 32, 32)]; + UIImage *hogSpriteFrame = [hogSprite cutAt:CGRectMake(x, y, 32, 32)]; + UIImage *hogWithHat = [hogSpriteFrame mergeWith:hatSpriteFrame atPoint:CGPointMake(0, 5)]; + [animation addObject:hogWithHat]; + } [hatSprite release]; - - UIImageView *hog = [[UIImageView alloc] initWithImage:hogWithHat]; - int x = 15*(i+1)+random()%40; - if (x + 32 > 300) - x = i*10; - hog.frame = CGRectMake(x, 30, 32, 32); + [hatFile release]; + + UIImageView *hog = [[UIImageView alloc] initWithImage:[animation objectAtIndex:0]]; + hog.animationImages = animation; + hog.animationDuration = 3; + [animation release]; + + int x = 20*i+random()%128; + if (x > 320 - 32) + x = i*random()%32; + hog.frame = CGRectMake(x, 25, hog.frame.size.width, hog.frame.size.height); [self.imgContainer addSubview:hog]; + [hog startAnimating]; [hog release]; } + [self.view addSubview:self.imgContainer]; - [sprite release]; + [hogSprite release]; [pool drain]; } @@ -279,57 +286,30 @@ self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); if (IS_IPAD()) { - // load other controllers - if (self.mapConfigViewController == nil) - self.mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPad" bundle:nil]; + // the label for the filter slider + UILabel *filterLabel = [[UILabel alloc] initWithFrame:CGRectMake(116, 714, 310, 40) + andTitle:nil + withBorderWidth:2.0f]; + [self.view insertSubview:filterLabel belowSubview:self.mapConfigViewController.slider]; + [filterLabel release]; - UILabel *leftBackground = createLabelWithParams(nil, CGRectMake(0, 60, 320, 620), 2.7f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); - [self.mapConfigViewController.view addSubview:leftBackground]; - [leftBackground release]; - UILabel *middleBackground = createLabelWithParams(nil, CGRectMake(337, 187, 350, 505), 2.7f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); - [self.mapConfigViewController.view addSubview:middleBackground]; - [middleBackground release]; - UILabel *rightBackground = createLabelWithParams(nil, CGRectMake(704, 214, 320, 464), 2.7f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); - [self.mapConfigViewController.view addSubview:rightBackground]; - [rightBackground release]; - UILabel *topBackground = createLabelWithParams(nil, CGRectMake(714, 14, 300, 190), 2.3f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); - [self.mapConfigViewController.view addSubview:topBackground]; - [topBackground release]; - UILabel *bottomLeftBackground = createLabelWithParams(nil, CGRectMake(106, 714, 320, 40), 2.0f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); - [self.mapConfigViewController.view addSubview:bottomLeftBackground]; - [bottomLeftBackground release]; - UILabel *bottomRightBackground = createLabelWithParams(NSLocalizedString(@"Max Hogs: ",@""), CGRectMake(594, 714, 320, 40), 2.0f, UICOLOR_HW_YELLOW_BODER, UICOLOR_HW_ALPHABLUE); - bottomRightBackground.font = [UIFont italicSystemFontOfSize:[UIFont labelFontSize]]; - [self.mapConfigViewController.view addSubview:bottomRightBackground]; - [bottomRightBackground release]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.maxLabel]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.sizeLabel]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.segmentedControl]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.previewButton]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.slider]; - [self.mapConfigViewController.view bringSubviewToFront:self.mapConfigViewController.tableView]; + // the label for max hogs + UILabel *maxLabel = [[UILabel alloc] initWithFrame:CGRectMake(598, 714, 310, 40) + andTitle:NSLocalizedString(@"Loading...",@"") + withBorderWidth:2.0f]; + maxLabel.font = [UIFont italicSystemFontOfSize:[UIFont labelFontSize]]; + maxLabel.textColor = [UIColor whiteColor]; + maxLabel.textAlignment = UITextAlignmentCenter; + [self.view addSubview:maxLabel]; + self.mapConfigViewController.maxLabel = maxLabel; + [maxLabel release]; - if (self.teamConfigViewController == nil) - self.teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.mapConfigViewController.view addSubview:self.teamConfigViewController.view]; - if (self.schemeWeaponConfigViewController == nil) - self.schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.mapConfigViewController.view addSubview:schemeWeaponConfigViewController.view]; - self.mapConfigViewController.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); - self.teamConfigViewController.view.frame = CGRectMake(348, 200, 328, 480); - self.schemeWeaponConfigViewController.view.frame = CGRectMake(10, 70, 300, 600); - - self.mapConfigViewController.parentController = self; + // as this is loaded from a NIB we need to set its size and position + self.mapConfigViewController.view.frame = CGRectMake(704, 0, 320, 680); } else { - // this is the visible controller - if (self.mapConfigViewController == nil) - self.mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil]; - // this must be loaded & added in order to auto set default scheme and ammo - self.schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; - [self.view addSubview:self.schemeWeaponConfigViewController.view]; + self.mapConfigViewController.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width-44); } [self.view addSubview:self.mapConfigViewController.view]; - self.mapConfigViewController.externalController = schemeWeaponConfigViewController; [super viewDidLoad]; } @@ -368,28 +348,25 @@ } -(void) didReceiveMemoryWarning { + self.imgContainer = nil; + + if (self.mapConfigViewController.view.superview == nil) + self.mapConfigViewController = nil; if (self.teamConfigViewController.view.superview == nil) self.teamConfigViewController = nil; if (self.schemeWeaponConfigViewController.view.superview == nil) self.schemeWeaponConfigViewController = nil; if (self.helpPage.view.superview == nil) self.helpPage = nil; - if (self.mapConfigViewController.view.superview == nil) - self.mapConfigViewController = nil; - - self.imgContainer = nil; - // don't nil this one or it won't be able to send messages - //self.interfaceBridge = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } -(void) viewDidUnload { self.imgContainer = nil; - self.interfaceBridge = nil; + self.schemeWeaponConfigViewController = nil; + self.teamConfigViewController = nil; self.mapConfigViewController = nil; - self.teamConfigViewController = nil; - self.schemeWeaponConfigViewController = nil; self.helpPage = nil; MSG_DIDUNLOAD(); [super viewDidUnload]; @@ -397,10 +374,9 @@ -(void) dealloc { releaseAndNil(imgContainer); - releaseAndNil(interfaceBridge); + releaseAndNil(schemeWeaponConfigViewController); + releaseAndNil(teamConfigViewController); releaseAndNil(mapConfigViewController); - releaseAndNil(teamConfigViewController); - releaseAndNil(schemeWeaponConfigViewController); releaseAndNil(helpPage); [super dealloc]; } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h --- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h Fri Oct 28 18:33:38 2011 +0200 @@ -22,7 +22,7 @@ #import #import "EngineProtocolNetwork.h" -typedef enum {gtNone, gtLocal, gtSave, gtNet} TGameType; +typedef enum {gtNone, gtLocal, gtSave, gtMission, gtNet} TGameType; typedef enum {gsNone, gsInGame, gsEnded, gsInterrupted} TGameStatus; @class OverlayViewController; @@ -49,10 +49,12 @@ -(id) initWithController:(id) viewController; --(void) startLocalGame:(NSDictionary *)withDictionary; +-(void) startLocalGame:(NSDictionary *)withOptions; -(void) startSaveGame:(NSString *)atPath; +-(void) startMissionGame:(NSString *)withScript; + -(void) prepareEngineLaunch; --(void) startGameEngine; +-(void) engineLaunch; -(void) gameHasEndedWithStats:(NSArray *)stats; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m --- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,7 @@ #import "GameInterfaceBridge.h" -#import "PascalImports.h" +#import "ServerSetup.h" #import "EngineProtocolNetwork.h" #import "OverlayViewController.h" #import "StatsPageViewController.h" @@ -32,7 +32,7 @@ -(id) initWithController:(id) viewController { if (self = [super init]) { - self.ipcPort = randomPort(); + self.ipcPort = [ServerSetup randomPort]; self.gameType = gtNone; self.savePath = nil; @@ -62,27 +62,28 @@ } // main routine for calling the actual game engine --(void) startGameEngine { +-(void) engineLaunch { const char *gameArgs[11]; - NSInteger width, height; + CGFloat width, height; + CGFloat screenScale = [[UIScreen mainScreen] safeScale]; NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", self.ipcPort]; NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; NSUserDefaults *settings = [NSUserDefaults standardUserDefaults]; if (IS_DUALHEAD()) { CGRect screenBounds = [[[UIScreen screens] objectAtIndex:1] bounds]; - width = (int) screenBounds.size.width; - height = (int) screenBounds.size.height; + width = screenBounds.size.width; + height = screenBounds.size.height; } else { CGRect screenBounds = [[UIScreen mainScreen] bounds]; - width = (int) screenBounds.size.height; - height = (int) screenBounds.size.width; + width = screenBounds.size.height; + height = screenBounds.size.width; } - NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", width * (int)getScreenScale()]; - NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", height * (int)getScreenScale()]; + NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", (int)(width * screenScale)]; + NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", (int)(height * screenScale)]; - NSString *modelId = getModelType(); + NSString *modelId = [HWUtils modelType]; NSInteger tmpQuality; if ([modelId hasPrefix:@"iPhone1"] || [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"]) // = iPhone and iPhone 3G or iPod Touch or iPod Touch 2G tmpQuality = 0x00000001 | 0x00000002 | 0x00000008 | 0x00000040; // rqLowRes | rqBlurryLand | rqSimpleRope | rqKillFlakes @@ -119,7 +120,7 @@ [localeString release]; [ipcString release]; - objcExportsInit(); + [ObjcExports initialize]; // this is the pascal fuction that starts the game, wrapped around isInGame [HedgewarsAppDelegate sharedAppDelegate].isInGame = YES; @@ -156,7 +157,7 @@ [AudioManagerController pauseBackgroundMusic]; // SYSTEMS ARE GO!! - [self startGameEngine]; + [self engineLaunch]; // remove completed games notification [userDefaults setObject:@"" forKey:@"savedGamePath"]; @@ -182,7 +183,7 @@ } // set up variables for a local game --(void) startLocalGame:(NSDictionary *)withDictionary { +-(void) startLocalGame:(NSDictionary *)withOptions { self.gameType = gtLocal; NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init]; @@ -196,7 +197,7 @@ if ([[NSFileManager defaultManager] fileExistsAtPath:self.savePath]) [[NSFileManager defaultManager] removeItemAtPath:self.savePath error:nil]; - [self.engineProtocol spawnThread:self.savePath withOptions:withDictionary]; + [self.engineProtocol spawnThread:self.savePath withOptions:withOptions]; [self prepareEngineLaunch]; } @@ -209,6 +210,17 @@ [self prepareEngineLaunch]; } +-(void) startMissionGame:(NSString *)withScript { + self.gameType = gtMission; + self.savePath = nil; + + NSString *missionPath = [[NSString alloc] initWithFormat:@"escript Missions/Training/%@.lua",withScript]; + NSDictionary *config = [NSDictionary dictionaryWithObject:missionPath forKey:@"mission_command"]; + [missionPath release]; + [self.engineProtocol spawnThread:nil withOptions:config]; + [self prepareEngineLaunch]; +} + -(void) gameHasEndedWithStats:(NSArray *)stats { // wrap this around a retain/realse to prevent being deallocated too soon [self retain]; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m --- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,6 @@ #import "GeneralSettingsViewController.h" -#import "CommodityFunctions.h" @implementation GeneralSettingsViewController @@ -33,6 +32,7 @@ #pragma mark - #pragma mark View Lifecycle -(void) viewDidLoad { + self.navigationItem.title = @"Edit game options"; [super viewDidLoad]; } @@ -64,8 +64,9 @@ theOtherSwitch = (UISwitch *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:1]].accessoryView; [theOtherSwitch setOn:NO animated:YES]; - if (theOtherSwitch.on) - [AudioManagerController pauseBackgroundMusic]; + // since switching sound on won't turn music on anyways, we can always turn off music + [AudioManagerController pauseBackgroundMusic]; + [settings setObject:[NSNumber numberWithBool:NO] forKey:@"music"]; break; case 20: //musicSwitch // if switch above (sound) is off, never turn on @@ -80,7 +81,6 @@ [AudioManagerController playBackgroundMusic]; else [AudioManagerController pauseBackgroundMusic]; - break; case 30: //alternateSwitch [settings setObject:[NSNumber numberWithBool:theSwitch.on] forKey:@"alternate"]; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/GravesViewController.m --- a/project_files/HedgewarsMobile/Classes/GravesViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GravesViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,8 +20,7 @@ #import "GravesViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" + @implementation GravesViewController @synthesize teamDictionary, graveArray, lastIndexPath; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HWUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HWUtils.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,33 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 01/10/2011. + */ + + +#import + +@interface HWUtils : NSObject { + +} + ++(NSString *)modelType; ++(NSArray *)teamColors; ++(void) releaseCache; + +@end + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HWUtils.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HWUtils.m Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,68 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 01/10/2011. + */ + + +#import "HWUtils.h" +#import +#import +#import "hwconsts.h" + +static NSString *cachedModel = nil; +static NSArray *cachedColors = nil; + +@implementation HWUtils + ++(NSString *)modelType { + if (cachedModel == nil) { + size_t size; + // set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space + sysctlbyname("hw.machine", NULL, &size, NULL, 0); + char *name = (char *)malloc(sizeof(char) * size); + // get the platform name + sysctlbyname("hw.machine", name, &size, NULL, 0); + + cachedModel = [[NSString stringWithUTF8String:name] retain]; + free(name); + } + return cachedModel; +} + ++(NSArray *)teamColors { + if (cachedColors == nil) { + // by default colors are ARGB but we do computation over RGB, hence we have to "& 0x00FFFFFF" before processing + unsigned int colors[] = HW_TEAMCOLOR_ARRAY; + NSMutableArray *array = [[NSMutableArray alloc] init]; + + int i = 0; + while(colors[i] != 0) + [array addObject:[NSNumber numberWithUnsignedInt:(colors[i++] & 0x00FFFFFF)]]; + + cachedColors = [[NSArray arrayWithArray:array] retain]; + [array release]; + } + return cachedColors; +} + ++(void) releaseCache { + releaseAndNil(cachedModel); + releaseAndNil(cachedColors); +} + +@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m --- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,10 +20,8 @@ #import "HedgewarsAppDelegate.h" -#import "PascalImports.h" +#import "MainMenuViewController.h" #import "ObjcExports.h" -#import "CommodityFunctions.h" -#import "MainMenuViewController.h" #include @@ -92,12 +90,12 @@ } -(void) applicationDidReceiveMemoryWarning:(UIApplication *)application { - // don't stop music when it is playing + [HWUtils releaseCache]; + // don't stop music if it is playing if (self.isInGame) { - [AudioManagerController cleanupMemory]; - MSG_MEMCLEAN(); + [AudioManagerController releaseCache]; } - print_free_memory(); + MSG_MEMCLEAN(); // don't clean mainMenuViewController here!!! } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HelpPageInGameViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HelpPageInGameViewController-iPad.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,889 @@ + + + + 1024 + 10F569 + 788 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 117 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 292 + {{0, -1}, {1024, 768}} + + NO + NO + IBIPadFramework + + NSImage + helpingame.png + + + + + 292 + {{79, 473}, {150, 22}} + + NO + YES + 7 + NO + IBIPadFramework + Direction buttons + + Helvetica-Bold + 18 + 16 + + + 1 + MCAwIDAAA + + + 1 + 10 + + + + 292 + {{79, 491}, {203, 85}} + + NO + YES + 7 + NO + IBIPadFramework + With these buttons you can move your hog, aim and control certain weapons. + + Helvetica + 16 + 16 + + + + 1 + 10 + 0 + + + + 292 + {{53, 97}, {186, 22}} + + NO + YES + 7 + NO + IBIPadFramework + Timer + + + + 1 + 10 + + + + 292 + {{53, 118}, {187, 43}} + + NO + YES + 7 + NO + IBIPadFramework + Don't let your turn time run out! + + + + 1 + 10 + 0 + + + + 292 + {{780, 248}, {240, 128}} + + NO + NO + IBIPadFramework + + NSImage + helpright.png + + + + + 292 + {{790, 256}, {109, 22}} + + NO + YES + 7 + NO + IBIPadFramework + Ammo Menu + + + + 1 + 10 + + + + 292 + {{790, 282}, {214, 84}} + + NO + YES + 7 + NO + IBIPadFramework + This menu contains all the weapons you can use. Drag your finger on a weapon for more details on what it does! + + + + 1 + 10 + 0 + + + + 292 + {{780, 97}, {186, 22}} + + NO + YES + 7 + NO + IBIPadFramework + Pause / Open ammos + + + + 1 + 10 + + + + 292 + {{782, 118}, {187, 43}} + + NO + YES + 7 + NO + IBIPadFramework + Tap to pause or open the ammo menu. + + + + 1 + 10 + 0 + + + + 292 + {{418, 73}, {186, 22}} + + NO + YES + 7 + NO + IBIPadFramework + Wind bar + + + + 1 + 10 + + + + 292 + {{418, 89}, {191, 63}} + + NO + YES + 7 + NO + IBIPadFramework + Some weapons are affected by the wind and their direction may shift. + + + + 1 + 10 + 0 + + + + 292 + {{447, 573}, {203, 22}} + + NO + YES + 7 + NO + IBIPadFramework + Teams flags and health + + + + 1 + 10 + + + + 292 + {{447, 592}, {203, 85}} + + NO + YES + 7 + NO + IBIPadFramework + These bars report the team name, the team flags and the global health status of every hog. + + + + 1 + 10 + 4 + + + + 292 + {{741, 501}, {135, 22}} + + NO + YES + 7 + NO + IBIPadFramework + Joypad buttons + + + + 1 + 10 + + + + 292 + {{741, 520}, {211, 85}} + + NO + YES + 7 + NO + IBIPadFramework + Press X to jump forward, Y to jump backwards (double tap to jump twice) and Missile to attack or use items. + + + + 1 + 10 + 0 + + + + 292 + {{67, 238}, {240, 128}} + + NO + NO + IBIPadFramework + + NSImage + helpplain.png + + + + + 292 + {{72, 246}, {229, 22}} + + NO + YES + 7 + NO + IBIPadFramework + Tap to return to game + + + + 1 + 10 + 1 + + + + 292 + {{72, 268}, {229, 87}} + + NO + YES + 7 + NO + IBIPadFramework + Pan to move camera, pinch to zoom, double tap to center hog, and a single touch to interact with weapons and much more! + + + + 1 + 10 + 0 + + + {1024, 768} + + + 3 + MCAwLjQAA + + NO + NO + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + dismiss + + + 7 + + 16 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + + + + + + + + + + + + + + + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 17 + + + + + 18 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 2.CustomClassName + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 21.IBPluginDependency + 22.IBPluginDependency + 23.IBPluginDependency + 24.IBPluginDependency + 25.IBPluginDependency + 26.IBPluginDependency + 27.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + HelpPageViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIControl + {{288, 355}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 27 + + + + YES + + HelpPageViewController + UIViewController + + dismiss + id + + + dismiss + + dismiss + id + + + + IBProjectSource + Classes/HelpPageViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + helpingame.png + helpplain.png + helpright.png + + + YES + {1024, 768} + {296, 138} + {308, 144} + + + 117 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HelpPageInGameViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HelpPageInGameViewController-iPhone.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1014 @@ + + + + 1056 + 10H574 + 823 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 292 + + YES + + + 274 + + YES + + + 292 + {{20, 283}, {150, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Direction buttons + + Helvetica-Bold + 18 + 16 + + + 1 + MCAwIDAAA + + + 1 + 10 + + + + 292 + {{20, 292}, {203, 85}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + With these buttons you can move your hog, aim and control certain weapons. + + Helvetica + 16 + 16 + + + + 1 + 10 + 0 + + + + 292 + {{20, 13}, {186, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Timer + + + + 1 + 10 + + + + 292 + {{20, 34}, {187, 43}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Don't let your turn time run out! + + + + 1 + 10 + 0 + + + + 292 + {{217, 308}, {243, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Touch interface + + + + 1 + 10 + 2 + + + + 292 + {{231, 328}, {229, 87}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Pan to move camera, pinch to zoom, double tap to center hog, and a single touch to interact with weapons and much more! + + + + 1 + 10 + 0 + 2 + + + + 292 + {{20, 85}, {186, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Wind bar + + + + 1 + 10 + + + + 292 + {{20, 101}, {191, 63}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Some weapons are affected by the wind and their direction may shift. + + + + 1 + 10 + 0 + + + + 292 + {{20, 172}, {203, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Teams flags and health + + + + 1 + 10 + + + + 292 + {{20, 191}, {203, 85}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + These bars report the team name, the team flags and the global health status of every hog. + + + + 1 + 10 + 4 + + + + 292 + {{274, 13}, {186, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Pause / Open ammos + + + + 1 + 10 + 2 + + + + 292 + {{273, 35}, {187, 43}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Tap to pause or open the ammo menu. + + + + 1 + 10 + 0 + 2 + + + + 292 + {{351, 82}, {109, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Ammo Menu + + + + 1 + 10 + 2 + + + + 292 + {{246, 105}, {214, 84}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + This menu contains all the weapons you can use. Drag your finger on a weapon for more details on what it does! + + + + 1 + 10 + 0 + 2 + + + + 292 + {{325, 197}, {135, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Joypad buttons + + + + 1 + 10 + 2 + + + + 292 + {{249, 217}, {211, 85}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Press X to jump forward, Y to jump backwards (double tap to jump twice) and Missile to attack or use items. + + + + 1 + 10 + 0 + 2 + + + {{-5, 44}, {489, 332}} + + YES + YES + 1 + IBCocoaTouchFramework + + + + 290 + {{-1, 0}, {481, 44}} + + IBCocoaTouchFramework + + YES + + + Help page + + Back + IBCocoaTouchFramework + 1 + + + IBCocoaTouchFramework + + + + + {480, 320} + + + 2 + MC45OTYwNzg0OTEyIDAuOTg4MjM1MzU0NCAxAA + + NO + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + dismiss + + + + 141 + + + + scrollView + + + + 142 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + + 118 + + + YES + + + + + + 121 + + + YES + + + + + + + + + + + + + + + + + + + + + 122 + + + + + 124 + + + + + 125 + + + + + 126 + + + + + 127 + + + + + 128 + + + + + 129 + + + + + 130 + + + + + 131 + + + + + 132 + + + + + 133 + + + + + 134 + + + + + 135 + + + + + 136 + + + + + 137 + + + + + 138 + + + + + 119 + + + YES + + + + + + 140 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 118.IBPluginDependency + 118.IBViewBoundsToFrameTransform + 119.IBPluginDependency + 121.IBEditorWindowLastContentRect + 121.IBPluginDependency + 121.IBViewBoundsToFrameTransform + 122.IBPluginDependency + 122.IBViewBoundsToFrameTransform + 124.IBPluginDependency + 124.IBViewBoundsToFrameTransform + 125.IBPluginDependency + 125.IBViewBoundsToFrameTransform + 126.IBPluginDependency + 126.IBViewBoundsToFrameTransform + 127.IBPluginDependency + 127.IBViewBoundsToFrameTransform + 128.IBPluginDependency + 128.IBViewBoundsToFrameTransform + 129.IBPluginDependency + 129.IBViewBoundsToFrameTransform + 130.IBPluginDependency + 130.IBViewBoundsToFrameTransform + 131.IBPluginDependency + 131.IBViewBoundsToFrameTransform + 132.IBPluginDependency + 132.IBViewBoundsToFrameTransform + 133.IBPluginDependency + 133.IBViewBoundsToFrameTransform + 134.IBPluginDependency + 134.IBViewBoundsToFrameTransform + 135.IBPluginDependency + 135.IBViewBoundsToFrameTransform + 136.IBPluginDependency + 136.IBViewBoundsToFrameTransform + 137.IBPluginDependency + 137.IBViewBoundsToFrameTransform + 138.IBPluginDependency + 138.IBViewBoundsToFrameTransform + 140.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 2.IBViewBoundsToFrameTransform + + + YES + HelpPageViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AQAAAADAQAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{589, 578}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AcCgAABCMAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDZwAAw7aAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCVAAAwx8AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAwnQAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCxgAAwtYAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCxgAAwyQAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw+SAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAxARAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw6aAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw8+AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDZwAAw+EAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDiQAAwmwAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDiIAAwswAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDr4AAwwUAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDdgAAw1oAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDooAAw3gAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDeQAAw6aAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{165, 514}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAw4kAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 142 + + + + YES + + HelpPageViewController + UIViewController + + dismiss + id + + + dismiss + + dismiss + id + + + + scrollView + UIScrollView + + + scrollView + + scrollView + UIScrollView + + + + IBProjectSource + Classes/HelpPageViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UINavigationBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UINavigationBar.h + + + + UINavigationItem + NSObject + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController-iPad.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1135 @@ + + + + 1024 + 10F569 + 804 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 123 + + + YES + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 292 + {{742, 389}, {240, 102}} + + + NO + NO + IBIPadFramework + + NSImage + helpabove.png + + + + + 292 + {{753, 408}, {109, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Map theme + + Helvetica-Bold + 18 + 16 + + + 1 + MCAwIDAAA + + + 1 + 10 + + + + 292 + {{753, 425}, {218, 66}} + + + NO + YES + 7 + NO + IBIPadFramework + Here you can choose how your map will appear in game. + + Helvetica + 16 + 16 + + + + 1 + 10 + 0 + + + + 292 + {{653, 202}, {240, 146}} + + + NO + NO + IBIPadFramework + + + + + 292 + {{664, 223}, {109, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Map type + + + + 1 + 10 + + + + 292 + {{664, 244}, {218, 99}} + + + NO + YES + 7 + NO + IBIPadFramework + Choose between a static map or a randomly generated one (might require more time). In a mission you need to perfom some action to win. + + + + 1 + 10 + 0 + + + + 292 + {{494, 20}, {240, 101}} + + + NO + NO + IBIPadFramework + + NSImage + helpright.png + + + + + 292 + {{502, 25}, {109, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Map preview + + + + 1 + 10 + + + + 292 + {{502, 46}, {218, 65}} + + + NO + YES + 7 + NO + IBIPadFramework + This is a small preview of your next map. Tap to select / generate a new map. + + + + 1 + 10 + 0 + + + + 292 + {{391, 389}, {242, 171}} + + + NO + NO + IBIPadFramework + + + + + 292 + {{401, 413}, {109, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Teams + + + + 1 + 10 + + + + 292 + {{400, 434}, {232, 120}} + + + NO + YES + 7 + NO + IBIPadFramework + Select which teams are playing! Add hogs by tapping on them and set their color to figure friend and foe teams out. AI teams will appear with a small robot badge next their name. + + + + 1 + 10 + 0 + + + + 292 + {{142, 125}, {240, 104}} + + + NO + NO + IBIPadFramework + + NSImage + helpleft.png + + + + + 292 + {{162, 133}, {204, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Schemes and Weapons + + + + 1 + 10 + + + + 292 + {{162, 152}, {210, 71}} + + + NO + YES + 7 + NO + IBIPadFramework + Here you can choose which rules and which weapon set will be applied in game. + + + + 1 + 10 + 0 + + + + 292 + {{155, 8}, {278, 50}} + + + NO + NO + IBIPadFramework + + + + + 292 + {{177, 6}, {248, 54}} + + + NO + YES + 7 + NO + IBIPadFramework + Did you know you can customize almost everything in the settings page? + + Helvetica-Oblique + 14 + 16 + + + + 1 + 10 + 0 + + + + 292 + {{686, 583}, {240, 117}} + + + NO + NO + IBIPadFramework + + NSImage + helpbottom.png + + + + + 292 + {{697, 592}, {138, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Max hedgehogs + + + + 1 + 10 + + + + 292 + {{697, 609}, {218, 73}} + + + NO + YES + 7 + NO + IBIPadFramework + This number is the maximum size for all the hogs playing (in every team). + + + + 1 + 10 + 0 + + + + 292 + {{20, 587}, {240, 109}} + + + NO + NO + IBIPadFramework + + + + + 292 + {{30, 592}, {138, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Size slider + + + + 1 + 10 + + + + 292 + {{30, 608}, {218, 73}} + + + NO + YES + 7 + NO + IBIPadFramework + For Random and Maze maps you can decide to generate only maps of a certain size. + + + + 1 + 10 + 0 + + + + 292 + {{45, 318}, {240, 128}} + + + NO + NO + IBIPadFramework + + NSImage + helpplain.png + + + + + 292 + {{50, 326}, {229, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Tap anywhere to dismiss + + + + 1 + 10 + 1 + + + + 292 + {{52, 348}, {224, 87}} + + + NO + YES + 7 + NO + IBIPadFramework + Still confused? Don't worry, it's really simple! Try a couple of games and everything will become clear to you. + + + + 1 + 10 + 0 + + + + 292 + {{344, 635}, {240, 61}} + + + NO + NO + IBIPadFramework + + + + + 292 + {{353, 637}, {138, 22}} + + + NO + YES + 7 + NO + IBIPadFramework + Start button + + + + 1 + 10 + + + + 292 + {{354, 650}, {218, 46}} + + + NO + YES + 7 + NO + IBIPadFramework + This button starts the game. + + + + 1 + 10 + 0 + + + {1024, 768} + + + + 3 + MCAwLjQAA + + NO + NO + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + dismiss + + + 7 + + 16 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + 28 + + + + + 29 + + + + + 30 + + + + + 34 + + + + + 35 + + + + + 36 + + + + + 37 + + + + + 38 + + + + + 39 + + + + + 40 + + + + + 41 + + + + + 42 + + + + + 43 + + + + + 44 + + + + + 45 + + + + + 49 + + + + + 50 + + + + + 51 + + + + + 52 + + + + + 53 + + + + + 54 + + + + + 58 + + + + + 59 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 2.CustomClassName + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 25.IBPluginDependency + 26.IBPluginDependency + 27.IBPluginDependency + 28.IBPluginDependency + 29.IBPluginDependency + 30.IBPluginDependency + 34.IBPluginDependency + 35.IBPluginDependency + 36.IBPluginDependency + 37.IBPluginDependency + 38.IBPluginDependency + 39.IBPluginDependency + 40.IBPluginDependency + 41.IBPluginDependency + 42.IBPluginDependency + 43.IBPluginDependency + 44.IBPluginDependency + 45.IBPluginDependency + 49.IBPluginDependency + 50.IBPluginDependency + 51.IBPluginDependency + 52.IBPluginDependency + 53.IBPluginDependency + 54.IBPluginDependency + 58.IBPluginDependency + 59.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + + + YES + HelpPageViewController + UIResponder + UIControl + {{273, 125}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 59 + + + + YES + + HelpPageViewController + UIViewController + + dismiss + id + + + dismiss + + dismiss + id + + + + IBProjectSource + Classes/HelpPageViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + helpabove.png + helpbottom.png + helpleft.png + helpplain.png + helpright.png + + + YES + {295, 156} + {295, 156} + {308, 144} + {296, 138} + {308, 144} + + + 123 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController-iPhone.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,907 @@ + + + + 1024 + 10F569 + 804 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 123 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 292 + + YES + + + 268 + + YES + + + 292 + {{20, 587}, {440, 52}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Still confused? Don't worry, it's really simple! Try a couple of games and everything will become clear to you. + + Helvetica + 16 + 16 + + + 1 + MCAwIDAAA + + + 1 + 10 + 0 + 1 + + + + 292 + {{20, 279}, {138, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Size slider + + Helvetica-Bold + 18 + 16 + + + + 1 + 10 + + + + 292 + {{20, 298}, {440, 44}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + For Random and Maze maps you can decide to generate only maps of a certain size. + + + + 1 + 10 + 0 + + + + 292 + {{20, 511}, {204, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Schemes and Weapons + + + + 1 + 10 + + + + 292 + {{20, 530}, {433, 45}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Here you can choose which rules and which weapon set will be applied in game. + + + + 1 + 10 + 0 + + + + 292 + {{20, 68}, {109, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Map preview + + + + 1 + 10 + + + + 292 + {{20, 88}, {440, 44}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + This is a small preview of your next map. Tap to select / generate a new map. + + + + 1 + 10 + 0 + + + + 292 + {{20, 140}, {109, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Map type + + + + 1 + 10 + + + + 292 + {{20, 164}, {440, 58}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Choose between a static map or a randomly generated one (might require more time). In a mission you need to perfom some action to win. + + + + 1 + 10 + 0 + + + + 292 + {{20, 229}, {109, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Map theme + + + + 1 + 10 + + + + 292 + {{20, 244}, {440, 33}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Here you can choose how your map will appear in game. + + + + 1 + 10 + 0 + + + + 292 + {{20, 347}, {138, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Max hedgehogs + + + + 1 + 10 + + + + 292 + {{20, 367}, {440, 41}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + This number is the maximum size for all the hogs playing (in every team). + + + + 1 + 10 + 0 + + + + 292 + {{20, 418}, {109, 22}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Teams + + + + 1 + 10 + + + + 292 + {{20, 436}, {433, 66}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Select which teams are playing! Add hogs by tapping on them and set their color to figure friend and foe teams out. AI teams will appear with a small robot badge next their name. + + + + 1 + 10 + 0 + + + + 292 + {{13, 3}, {440, 60}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Here you can find help for the game configuration options. You can customize almost everything in the settings page. + + Helvetica-Oblique + 16 + 16 + + + + 1 + 10 + 0 + 1 + + + {480, 276} + + YES + YES + IBCocoaTouchFramework + + + {480, 276} + + + 2 + MC45OTYwNzg0OTEyIDAuOTg4MjM1MzU0NCAxAA + + NO + NO + + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + scrollView + + + + 95 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + 60 + + + YES + + + + + + + + + + + + + + + + + + + + + 61 + + + + + 62 + + + + + 63 + + + + + 64 + + + + + 65 + + + + + 66 + + + + + 67 + + + + + 68 + + + + + 69 + + + + + 70 + + + + + 71 + + + + + 72 + + + + + 73 + + + + + 74 + + + + + 75 + + + + + 76 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 60.IBPluginDependency + 60.IBViewBoundsToFrameTransform + 61.IBPluginDependency + 61.IBViewBoundsToFrameTransform + 62.IBPluginDependency + 62.IBViewBoundsToFrameTransform + 63.IBPluginDependency + 63.IBViewBoundsToFrameTransform + 64.IBPluginDependency + 64.IBViewBoundsToFrameTransform + 65.IBPluginDependency + 65.IBViewBoundsToFrameTransform + 66.IBPluginDependency + 66.IBViewBoundsToFrameTransform + 67.IBPluginDependency + 67.IBViewBoundsToFrameTransform + 68.IBPluginDependency + 68.IBViewBoundsToFrameTransform + 69.IBPluginDependency + 69.IBViewBoundsToFrameTransform + 70.IBPluginDependency + 70.IBViewBoundsToFrameTransform + 71.IBPluginDependency + 71.IBViewBoundsToFrameTransform + 72.IBPluginDependency + 72.IBViewBoundsToFrameTransform + 73.IBPluginDependency + 73.IBViewBoundsToFrameTransform + 74.IBPluginDependency + 74.IBViewBoundsToFrameTransform + 75.IBPluginDependency + 75.IBViewBoundsToFrameTransform + 76.IBPluginDependency + 76.IBViewBoundsToFrameTransform + + + YES + HelpPageViewController + UIResponder + {{16, 775}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUGgAABEDIAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABC+AAAw0kAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw14AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw9mAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw+6AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABByAAAwqYAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAwxMAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAADCQAAAwqYAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAADCQAAAwzcAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDAAAAw3AAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDAAAAw5aAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDOwAAw6OAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDOwAAw8WAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDDgAAw7UAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDDQAAw/CAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAADBAAAAwlQAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 95 + + + + YES + + HelpPageViewController + UIViewController + + dismiss + id + + + dismiss + + dismiss + id + + + + scrollView + UIScrollView + + + scrollView + + scrollView + UIScrollView + + + + IBProjectSource + Classes/HelpPageViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + 123 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HelpPageViewController.m --- a/project_files/HedgewarsMobile/Classes/HelpPageViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/HelpPageViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,7 @@ #import "HelpPageViewController.h" -#import "CommodityFunctions.h" + @implementation HelpPageViewController @synthesize scrollView; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HogHatViewController.m --- a/project_files/HedgewarsMobile/Classes/HogHatViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/HogHatViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,8 +20,7 @@ #import "HogHatViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" + @implementation HogHatViewController @synthesize teamDictionary, hatArray, normalHogSprite, lastIndexPath, selectedHog; @@ -48,7 +47,7 @@ self.normalHogSprite = hogSprite; [hogSprite release]; - self.title = NSLocalizedString(@"Change hedgehog's hat",@""); + self.title = NSLocalizedString(@"Change hedgehogs' hat",@""); } -(void) viewWillAppear:(BOOL)animated { diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HoldTableViewCell.h --- a/project_files/HedgewarsMobile/Classes/HoldTableViewCell.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/HoldTableViewCell.h Fri Oct 28 18:33:38 2011 +0200 @@ -23,7 +23,7 @@ @protocol HoldTableViewCellDelegate --(void) holdAction:(NSString *)content; +-(void) holdAction:(NSString *)content onTable:(UITableView *)aTableView; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/HoldTableViewCell.m --- a/project_files/HedgewarsMobile/Classes/HoldTableViewCell.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/HoldTableViewCell.m Fri Oct 28 18:33:38 2011 +0200 @@ -58,8 +58,8 @@ } -(void) holdAction { - if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:)]) - [self.delegate holdAction:self.textLabel.text]; + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:onTable:)]) + [self.delegate holdAction:self.textLabel.text onTable:(UITableView *)self.superview]; } -(void) dealloc { diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/InGameMenuViewController.h --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -31,6 +31,6 @@ -(void) present; -(void) dismiss; --(void) saveCurrentScreenToPhotoAlbum:(UIAlertView *)alert; +//-(void) saveCurrentScreenToPhotoAlbum:(UIAlertView *)alert; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/InGameMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,11 +20,9 @@ #import "InGameMenuViewController.h" -#import "PascalImports.h" -#import "CommodityFunctions.h" #import "SDL_sysvideo.h" #import "SDL_uikitkeyboard.h" -#import "OpenGLES/ES1/gl.h" + #define VIEW_HEIGHT 200 @@ -90,6 +88,7 @@ SDL_iPhoneKeyboardHide((SDL_Window *)HW_getSDLWindow()); + /* if (shouldTakeScreenshot) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please wait" message:nil @@ -107,6 +106,7 @@ // all these hacks because of the PAUSE caption on top of everything... [self performSelector:@selector(saveCurrentScreenToPhotoAlbum:) withObject:alert afterDelay:0.3]; } + */ shouldTakeScreenshot = NO; } @@ -192,6 +192,7 @@ } //TODO: check this is still needed since we switched to SDL_GL_CreateContext() +/* #pragma mark - #pragma mark save screenshot //by http://www.bit-101.com/blog/?p=1861 @@ -247,6 +248,6 @@ // add callback for cleaning memory and removing alert UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), (void *)alert); } - +*/ @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/LevelViewController.m --- a/project_files/HedgewarsMobile/Classes/LevelViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/LevelViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,6 @@ #import "LevelViewController.h" -#import "CommodityFunctions.h" @implementation LevelViewController diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MainMenuViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController-iPad.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,670 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 274 + {1024, 768} + + NO + IBIPadFramework + + NSImage + background.png + + + + + 292 + {{383, 389}, {263, 244}} + + NO + IBIPadFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + 215 + 0.0 + 0.0 + 0.0 + + 3 + MQA + + + 2 + MC45OTYwNzg0OTEyIDAuODAwMDAwMDcxNSAwLjAzOTIxNTY4NzY2AA + + + 3 + MC41AA + + + NSImage + localplayButton~ipad.png + + + + + 292 + {{795, 317}, {18, 19}} + + NO + 0.31690141558647156 + 3 + IBIPadFramework + 0 + 0 + + 3 + YES + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + 292 + {{940, 686}, {64, 64}} + + NO + 2 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + settingsButton.png + + + + + 292 + {{20, 686}, {64, 64}} + + NO + 4 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + savesButton.png + + + + + 292 + {{242, 43}, {540, 300}} + + NO + IBIPadFramework + + NSImage + title~ipad.png + + + + + 292 + {{468, 686}, {89, 37}} + + NO + 5 + IBIPadFramework + 0 + 0 + + 1 + Missions + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + {1024, 768} + + + 1 + MCAwIDAAA + + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + switchViews: + + + 7 + + 47 + + + + switchViews: + + + 7 + + 48 + + + + switchViews: + + + 7 + + 54 + + + + switchViews: + + + 7 + + 89 + + + + switchViews: + + + 7 + + 92 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 39 + + + local + + + 45 + + + + + 52 + + + + + 37 + + + + + 88 + + + + + 90 + + + + + 91 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 37.IBPluginDependency + 39.IBPluginDependency + 45.IBPluginDependency + 45.IBViewBoundsToFrameTransform + 52.IBPluginDependency + 52.IBViewBoundsToFrameTransform + 88.IBPluginDependency + 88.IBViewBoundsToFrameTransform + 90.IBPluginDependency + 90.IBViewBoundsToFrameTransform + 91.IBPluginDependency + 91.IBViewBoundsToFrameTransform + + + YES + MainMenuViewController + UIResponder + {{267, 388}, {1024, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABERQAAw56AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABEaQAAxDsAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAxDsAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDbQAAw6qAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUPqAABEK4AAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 92 + + + + YES + + MainMenuViewController + UIViewController + + switchViews: + id + + + switchViews: + + switchViews: + id + + + + IBProjectSource + Classes/MainMenuViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + background.png + localplayButton~ipad.png + savesButton.png + settingsButton.png + title~ipad.png + + + YES + {1024, 768} + {263, 244} + {64, 64} + {64, 64} + {540, 300} + + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MainMenuViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController-iPhone.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,687 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 293 + + YES + + + 274 + {480, 320} + + + 3 + MCAwAA + + 4 + NO + IBCocoaTouchFramework + + NSImage + background~iphone.png + + + + + 293 + {{105, 20}, {270, 150}} + + NO + NO + 4 + NO + IBCocoaTouchFramework + + NSImage + title~iphone.png + + + + + 289 + {{190, 200}, {100, 100}} + + + 1 + MCAwIDAgMAA + + NO + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + NSImage + localplayButton~iphone.png + + + + + 269 + {{396, 236}, {64, 64}} + + NO + NO + 2 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + settingsButton.png + + + + + 269 + {{20, 236}, {64, 64}} + + NO + NO + 4 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + savesButton.png + + + + + 292 + {{20, 19}, {18, 19}} + + NO + 0.5 + 3 + IBCocoaTouchFramework + 0 + 0 + + 3 + YES + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + 292 + {{439, 13}, {29, 31}} + + NO + 5 + IBCocoaTouchFramework + 0 + 0 + + 2 + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + {480, 320} + + + 1 + MCAwIDAAA + + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + switchViews: + + + 7 + + 30 + + + + switchViews: + + + 7 + + 40 + + + + switchViews: + + + 7 + + 42 + + + + switchViews: + + + 7 + + 44 + + + + switchViews: + + + 7 + + 47 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 23 + + + + + 22 + + + + + 41 + + + + + 43 + + + + + 24 + + + + + 28 + + + + + 46 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 22.IBPluginDependency + 22.IBViewBoundsToFrameTransform + 23.IBPluginDependency + 23.IBViewBoundsToFrameTransform + 24.IBPluginDependency + 24.IBViewBoundsToFrameTransform + 28.IBPluginDependency + 28.IBViewBoundsToFrameTransform + 41.IBPluginDependency + 41.IBViewBoundsToFrameTransform + 43.IBPluginDependency + 43.IBViewBoundsToFrameTransform + 46.IBPluginDependency + 46.IBViewBoundsToFrameTransform + + + YES + MainMenuViewController + UIResponder + {{517, 519}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAw5UAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCygAAwzcAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDPgAAw5UAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDxgAAw5iAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBcAAAwhAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw5iAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABD0YAAwmgAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 47 + + + + YES + + MainMenuViewController + UIViewController + + switchViews: + id + + + switchViews: + + switchViews: + id + + + + IBProjectSource + Classes/MainMenuViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + background~iphone.png + localplayButton~iphone.png + savesButton.png + settingsButton.png + title~iphone.png + + + YES + {480, 320} + {100, 100} + {64, 64} + {64, 64} + {270, 150} + + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MainMenuViewController.h --- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -22,24 +22,27 @@ #import @class GameConfigViewController; -@class SplitViewRootController; +@class SettingsContainerViewController; @class AboutViewController; @class SavedGamesViewController; @class RestoreViewController; +@class MissionTrainingViewController; @interface MainMenuViewController : UIViewController { GameConfigViewController *gameConfigViewController; - SplitViewRootController *settingsViewController; + SettingsContainerViewController *settingsViewController; AboutViewController *aboutViewController; SavedGamesViewController *savedGamesViewController; - RestoreViewController *restoreViewCOntroller; + RestoreViewController *restoreViewController; + MissionTrainingViewController *missionsViewController; } @property (nonatomic,retain) GameConfigViewController *gameConfigViewController; -@property (nonatomic,retain) SplitViewRootController *settingsViewController; +@property (nonatomic,retain) SettingsContainerViewController *settingsViewController; @property (nonatomic,retain) AboutViewController *aboutViewController; @property (nonatomic,retain) SavedGamesViewController *savedGamesViewController; @property (nonatomic,retain) RestoreViewController *restoreViewController; +@property (nonatomic,retain) MissionTrainingViewController *missionsViewController; -(IBAction) switchViews:(id)sender; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MainMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -21,19 +21,20 @@ #import "MainMenuViewController.h" #import "CreationChamber.h" -#import "PascalImports.h" #import "GameConfigViewController.h" -#import "SplitViewRootController.h" +#import "SettingsContainerViewController.h" #import "AboutViewController.h" #import "SavedGamesViewController.h" #import "RestoreViewController.h" +#import "MissionTrainingViewController.h" #import "GameInterfaceBridge.h" #import "Appirater.h" #import "ServerSetup.h" @implementation MainMenuViewController -@synthesize gameConfigViewController, settingsViewController, aboutViewController, savedGamesViewController, restoreViewController; +@synthesize gameConfigViewController, settingsViewController, aboutViewController, savedGamesViewController, + restoreViewController, missionsViewController; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { return rotationManager(interfaceOrientation); @@ -41,59 +42,45 @@ // check if some configuration files are already set; if they are present it means that the current copy must be updated -(void) createNecessaryFiles { - NSString *resourcesDir = [[NSBundle mainBundle] resourcePath]; DLog(@"Creating necessary files"); + NSInteger index; // SAVES - just delete and overwrite if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()]) [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL]; - [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL]; + [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() + withIntermediateDirectories:NO + attributes:nil + error:NULL]; // SETTINGS - nsuserdefaults ftw - createSettings(); + [CreationChamber createSettings]; // TEAMS - update exisiting teams with new format - if ([[NSFileManager defaultManager] fileExistsAtPath:TEAMS_DIRECTORY()] == NO) { - [[NSFileManager defaultManager] createDirectoryAtPath:TEAMS_DIRECTORY() - withIntermediateDirectories:YES - attributes:nil - error:NULL]; - // we copy teams only the first time because it's unlikely that newer ones are going to be added - NSString *baseTeamsDir = [[NSString alloc] initWithFormat:@"%@/Settings/Teams/",resourcesDir]; - for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:baseTeamsDir error:NULL]) { - NSString *sourceFile = [baseTeamsDir stringByAppendingString:str]; - NSString *destinationFile = [TEAMS_DIRECTORY() stringByAppendingString:str]; - [[NSFileManager defaultManager] removeItemAtPath:destinationFile error:NULL]; - [[NSFileManager defaultManager] copyItemAtPath:sourceFile toPath:destinationFile error:NULL]; - } - [baseTeamsDir release]; - } - // merge not needed as format rarely changes + NSArray *teamNames = [[NSArray alloc] initWithObjects:@"Edit Me!",@"Ninjas",@"Pirates",@"Robots",nil]; + index = 0; + for (NSString *name in teamNames) + [CreationChamber createTeamNamed:name ofType:index++ controlledByAI:[name isEqualToString:@"Robots"]]; + [teamNames release]; // SCHEMES - always overwrite and delete custom ones if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()] == YES) [[NSFileManager defaultManager] removeItemAtPath:SCHEMES_DIRECTORY() error:NULL]; - createSchemeNamed(@"Default", 0); - createSchemeNamed(@"Pro Mode", 1); - createSchemeNamed(@"Shoppa", 2); - createSchemeNamed(@"Clean Slate", 3); - createSchemeNamed(@"Minefield", 4); - createSchemeNamed(@"Barrel Mayhem", 5); - createSchemeNamed(@"Tunnel Hogs", 6); - createSchemeNamed(@"Fort Mode", 7); - createSchemeNamed(@"Timeless", 8); - createSchemeNamed(@"Thinking with Portals", 9); - createSchemeNamed(@"King Mode", 10); + NSArray *schemeNames = [[NSArray alloc] initWithObjects:@"Default",@"Pro Mode",@"Shoppa",@"Clean Slate", + @"Minefield",@"Barrel Mayhem",@"Tunnel Hogs",@"Fort Mode",@"Timeless", + @"Thinking with Portals",@"King Mode",nil]; + index = 0; + for (NSString *name in schemeNames) + [CreationChamber createSchemeNamed:name ofType:index++]; + [schemeNames release]; - // WEAPONS - always overwrite - createWeaponNamed(@"Default", 0); - createWeaponNamed(@"Crazy", 1); - createWeaponNamed(@"Pro Mode", 2); - createWeaponNamed(@"Shoppa", 3); - createWeaponNamed(@"Clean Slate", 4); - createWeaponNamed(@"Minefield", 5); - createWeaponNamed(@"Thinking with Portals", 6); - // merge not needed because weapons not present in the set are 0ed by GameSetup + // WEAPONS - always overwrite as merge is not needed (missing weaps are 0ed automatically) + NSArray *weaponNames = [[NSArray alloc] initWithObjects:@"Default",@"Crazy",@"Pro Mode",@"Shoppa",@"Clean Slate", + @"Minefield",@"Thinking with Portals",nil]; + index = 0; + for (NSString *name in weaponNames) + [CreationChamber createWeaponNamed:name ofType:index++]; + [weaponNames release]; } #pragma mark - @@ -164,24 +151,22 @@ switch (button.tag) { case 0: if (nil == self.gameConfigViewController) { - xib = IS_IPAD() ? nil : @"GameConfigViewController"; + xib = IS_IPAD() ? @"GameConfigViewController-iPad" : @"GameConfigViewController-iPhone"; GameConfigViewController *gcvc = [[GameConfigViewController alloc] initWithNibName:xib bundle:nil]; gcvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; self.gameConfigViewController = gcvc; [gcvc release]; } - [self presentModalViewController:self.gameConfigViewController animated:YES]; break; case 2: if (nil == self.settingsViewController) { - SplitViewRootController *svrc = [[SplitViewRootController alloc] initWithNibName:nil bundle:nil]; + SettingsContainerViewController *svrc = [[SettingsContainerViewController alloc] initWithNibName:nil bundle:nil]; svrc.modalTransitionStyle = UIModalTransitionStyleCoverVertical; self.settingsViewController = svrc; [svrc release]; } - [self presentModalViewController:self.settingsViewController animated:YES]; break; case 3: @@ -224,9 +209,20 @@ self.savedGamesViewController = savedgames; [savedgames release]; } - [self presentModalViewController:self.savedGamesViewController animated:YES]; break; + case 5: + if (nil == self.missionsViewController) { + xib = IS_IPAD() ? @"MissionTrainingViewController-iPad" : @"MissionTrainingViewController-iPhone"; + MissionTrainingViewController *missions = [[MissionTrainingViewController alloc] initWithNibName:xib bundle:nil]; + missions.modalTransitionStyle = IS_IPAD() ? UIModalTransitionStyleCoverVertical : UIModalTransitionStyleCrossDissolve; + if ([missions respondsToSelector:@selector(setModalPresentationStyle:)]) + missions.modalPresentationStyle = UIModalPresentationPageSheet; + self.missionsViewController = missions; + [missions release]; + } + [self presentModalViewController:self.missionsViewController animated:YES]; + break; default: alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented" message:@"Sorry, this feature is not yet implemented" @@ -254,6 +250,7 @@ self.aboutViewController = nil; self.savedGamesViewController = nil; self.restoreViewController = nil; + self.missionsViewController = nil; MSG_DIDUNLOAD(); [super viewDidUnload]; } @@ -269,6 +266,8 @@ self.savedGamesViewController = nil; if (self.restoreViewController.view.superview == nil) self.restoreViewController = nil; + if (self.missionsViewController.view.superview == nil) + self.missionsViewController = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } @@ -279,6 +278,7 @@ releaseAndNil(aboutViewController); releaseAndNil(savedGamesViewController); releaseAndNil(restoreViewController); + releaseAndNil(missionsViewController); [super dealloc]; } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,677 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 274 + + YES + + + 289 + {{20, 166}, {280, 30}} + + NO + IBIPadFramework + 2 + 4 + 1 + + YES + Random + Map + Maze + Mission + + + YES + + + + + + + YES + + + + + + + YES + {0, 0} + {0, 0} + {0, 0} + {0, 0} + + + YES + + + + + + + 3 + MC42NjY2NjY2NjY3AA + + + + + 274 + {{0, 214}, {320, 554}} + + + 3 + MCAwAA + + YES + YES + IBIPadFramework + YES + NO + 2 + 1 + 2 + 0 + YES + 44 + + + {320, 768} + + + NO + YES + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + segmentedControl + + + + 21 + + + + segmentedControlChanged: + + + 13 + + 22 + + + + dataSource + + + + 67 + + + + delegate + + + + 68 + + + + tableView + + + + 69 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 1 + + + YES + + + + + + + 66 + + + + + 7 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 66.IBPluginDependency + 66.IBViewBoundsToFrameTransform + 7.IBPluginDependency + 7.IBViewBoundsToFrameTransform + + + YES + MapConfigViewController + UIResponder + {{289, 181}, {320, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABEMAAAxCmAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAw0IAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 126 + + + + YES + + MapConfigViewController + UIViewController + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + id + id + id + id + + + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + + mapButtonPressed: + id + + + segmentedControlChanged: + id + + + sliderChanged: + id + + + sliderEndedChanging: + id + + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + UILabel + MapPreviewButtonView + UISegmentedControl + UILabel + UISlider + UITableView + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + + maxLabel + UILabel + + + previewButton + MapPreviewButtonView + + + segmentedControl + UISegmentedControl + + + sizeLabel + UILabel + + + slider + UISlider + + + tableView + UITableView + + + + + IBProjectSource + Classes/MapConfigViewController.h + + + + MapPreviewButtonView + UIButton + + delegate + id + + + delegate + + delegate + id + + + + IBProjectSource + Classes/MapPreviewButtonView.h + + + + UILabel + + IBProjectSource + Classes/HWUtils.h + + + + UITableView + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UISlider + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISlider.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MapConfigViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPhone.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,916 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 292 + {480, 276} + + NO + IBCocoaTouchFramework + + NSImage + background~iphone.png + + + + + 292 + {{9, 14}, {270, 30}} + + NO + IBCocoaTouchFramework + 2 + 4 + 1 + + YES + Random + Map + Maze + Mission + + + YES + + + + + + + YES + + + + + + + YES + {0, 0} + {0, 0} + {0, 0} + {0, 0} + + + YES + + + + + + + 3 + MC42NjY2NjY2NjY3AA + + + + + 292 + {{119, 207}, {149, 23}} + + NO + IBCocoaTouchFramework + 0 + 0 + 0.05000000074505806 + 0.05000000074505806 + + + + 292 + {{16, 58}, {256, 128}} + + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + + + 292 + {{9, 221}, {97, 35}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Loading... + + Helvetica-Bold + 17 + 16 + + + 2 + MC45NDExNzY1MzM3IDAuODE1Njg2MzQ1MSAwAA + + + 1 + 10 + 1 + + + + 292 + {{109, 237}, {169, 29}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Label + + Helvetica-Oblique + 22 + 16 + + + 2 + MC45NDExNzY1MzM3IDAuODE1Njg2MzQ1MSAwAA + + + 1 + 10 + 1 + + + + 274 + {{284, 0}, {196, 276}} + + + 3 + MCAwAA + + NO + YES + NO + IBCocoaTouchFramework + NO + 1 + 2 + 0 + YES + 44 + 10 + 10 + + + {480, 276} + + + + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + previewButton + + + + 13 + + + + maxLabel + + + + 16 + + + + sizeLabel + + + + 18 + + + + sliderChanged: + + + 13 + + 19 + + + + sliderEndedChanging: + + + 7 + + 20 + + + + segmentedControl + + + + 21 + + + + segmentedControlChanged: + + + 13 + + 22 + + + + slider + + + + 23 + + + + dataSource + + + + 26 + + + + delegate + + + + 27 + + + + tableView + + + + 32 + + + + delegate + + + + 34 + + + + mapButtonPressed: + + + 7 + + 37 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 17 + + + + + 25 + + + Table View (Themes) + + + 35 + + + + + 11 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 11.IBPluginDependency + 11.IBViewBoundsToFrameTransform + 17.IBPluginDependency + 17.IBViewBoundsToFrameTransform + 25.IBPluginDependency + 25.IBViewBoundsToFrameTransform + 35.IBPluginDependency + 35.IBViewBoundsToFrameTransform + 7.IBPluginDependency + 7.IBViewBoundsToFrameTransform + 8.IBPluginDependency + 9.CustomClassName + 9.IBPluginDependency + 9.IBViewBoundsToFrameTransform + + + YES + MapConfigViewController + UIResponder + {{790, 298}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABB+AAAw4QAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCyAAAw2YAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDjgAAw4kAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAw4kAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBUAAAwigAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + MapPreviewButtonView + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBgAAAwzgAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 37 + + + + YES + + MapConfigViewController + UIViewController + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + id + id + id + id + + + + YES + + YES + mapButtonPressed: + segmentedControlChanged: + sliderChanged: + sliderEndedChanging: + + + YES + + mapButtonPressed: + id + + + segmentedControlChanged: + id + + + sliderChanged: + id + + + sliderEndedChanging: + id + + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + UILabel + MapPreviewButtonView + UISegmentedControl + UILabel + UISlider + UITableView + + + + YES + + YES + maxLabel + previewButton + segmentedControl + sizeLabel + slider + tableView + + + YES + + maxLabel + UILabel + + + previewButton + MapPreviewButtonView + + + segmentedControl + UISegmentedControl + + + sizeLabel + UILabel + + + slider + UISlider + + + tableView + UITableView + + + + + IBProjectSource + Classes/MapConfigViewController.h + + + + MapPreviewButtonView + UIButton + + delegate + id + + + delegate + + delegate + id + + + + IBProjectSource + Classes/MapPreviewButtonView.h + + + + UILabel + + IBProjectSource + ExtraCategories.h + + + + UITableView + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UISegmentedControl + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISegmentedControl.h + + + + UISlider + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UISlider.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + background~iphone.png + {480, 320} + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MapConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -22,8 +22,6 @@ #import #import "MapPreviewButtonView.h" -@class SchemeWeaponConfigViewController; -@class GameConfigViewController; @interface MapConfigViewController : UIViewController { NSInteger oldValue; // for the slider @@ -51,15 +49,13 @@ // internal objects NSIndexPath *lastIndexPath; NSArray *dataSourceArray; - - // controller for mission state - SchemeWeaponConfigViewController *externalController; - GameConfigViewController *parentController; } +@property (nonatomic,assign) NSInteger oldValue; +@property (nonatomic,assign) NSInteger oldPage; +@property (nonatomic,assign) BOOL busy; @property (nonatomic,assign) NSInteger maxHogs; -@property (nonatomic,assign) BOOL busy; @property (nonatomic,retain) NSString *seedCommand; @property (nonatomic,retain) NSString *templateFilterCommand; @property (nonatomic,retain) NSString *mapGenCommand; @@ -78,21 +74,15 @@ @property (nonatomic,retain) NSIndexPath *lastIndexPath; @property (nonatomic,retain) NSArray *dataSourceArray; -@property (nonatomic,assign) SchemeWeaponConfigViewController *externalController; -@property (nonatomic,assign) GameConfigViewController *parentController; - --(IBAction) buttonPressed:(id) sender; - --(IBAction) mapButtonPressed; +-(IBAction) mapButtonPressed:(id) sender; -(IBAction) sliderChanged:(id) sender; -(IBAction) sliderEndedChanging:(id) sender; -(IBAction) segmentedControlChanged:(id) sender; -(void) turnOnWidgets; -(void) turnOffWidgets; --(void) setLabelText:(NSString *)str; +-(void) setMaxLabelText:(NSString *)str; -(void) updatePreview; --(void) loadDataSourceArray; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MapConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,33 +20,32 @@ #import "MapConfigViewController.h" -#import "PascalImports.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" +#import #import "SchemeWeaponConfigViewController.h" #import "GameConfigViewController.h" + #define scIndex self.segmentedControl.selectedSegmentIndex #define isRandomness() (segmentedControl.selectedSegmentIndex == 0 || segmentedControl.selectedSegmentIndex == 2) @implementation MapConfigViewController @synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand, missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy, - externalController, parentController; + oldPage, oldValue; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return rotationManager(interfaceOrientation); } --(IBAction) mapButtonPressed { +-(IBAction) mapButtonPressed:(id) sender { [AudioManagerController playClickSound]; [self updatePreview]; } -(void) updatePreview { // don't generate a new preview while it's already generating one - if (busy) + if (self.busy) return; // generate a seed @@ -57,24 +56,19 @@ self.seedCommand = seedCmd; [seedCmd release]; - if (self.dataSourceArray == nil) - [self loadDataSourceArray]; NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; - NSIndexPath *theIndex; if (isRandomness()) { // prevent other events and add an activity while the preview is beign generated [self turnOffWidgets]; [self.previewButton updatePreviewWithSeed:seed]; - theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0]; - } else { - theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0]; // the preview for static maps is loaded in didSelectRowAtIndexPath } [seed release]; // perform as if user clicked on an entry + NSIndexPath *theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0]; [self tableView:self.tableView didSelectRowAtIndexPath:theIndex]; - if (IS_NOT_POWERFUL(getModelType()) == NO) + if (IS_NOT_POWERFUL([HWUtils modelType]) == NO) [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES]; } @@ -82,22 +76,24 @@ busy = YES; self.previewButton.alpha = 0.5f; self.previewButton.enabled = NO; - self.maxLabel.text = @"..."; + self.maxLabel.text = NSLocalizedString(@"Loading...",@"");; self.segmentedControl.enabled = NO; self.slider.enabled = NO; } +#pragma mark - +#pragma mark MapPreviewButtonView delegate methods -(void) turnOnWidgets { self.previewButton.alpha = 1.0f; self.previewButton.enabled = YES; self.segmentedControl.enabled = YES; self.slider.enabled = YES; - busy = NO; + self.busy = NO; } --(void) setLabelText:(NSString *)str { +-(void) setMaxLabelText:(NSString *)str { self.maxHogs = [str intValue]; - self.maxLabel.text = str; + self.maxLabel.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Max Hogs:",@""),str]; } -(NSDictionary *)getDataForEngine { @@ -117,8 +113,6 @@ } -(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section { - if (self.dataSourceArray == nil) - [self loadDataSourceArray]; return [[self.dataSourceArray objectAtIndex:scIndex] count]; } @@ -130,15 +124,13 @@ if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - if (self.dataSourceArray == nil) - [self loadDataSourceArray]; NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; NSString *labelString = [source objectAtIndex:row]; cell.textLabel.text = labelString; cell.textLabel.adjustsFontSizeToFitWidth = YES; cell.textLabel.minimumFontSize = 7; - cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; + cell.textLabel.textColor = [UIColor lightYellowColor]; cell.textLabel.backgroundColor = [UIColor clearColor]; if (isRandomness()) { @@ -155,14 +147,12 @@ } else cell.accessoryView = nil; - cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK; + cell.backgroundColor = [UIColor blackColorTransparent]; return cell; } // this set details for a static map (called by didSelectRowAtIndexPath) -(void) setDetailsForStaticMap:(NSInteger) index { - if (self.dataSourceArray == nil) - [self loadDataSourceArray]; NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", @@ -174,13 +164,12 @@ // if the number is not set we keep 18 standard; // sometimes it's not set but there are trailing characters, we get around them with the second equation + NSString *max; if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0) - maxHogs = [[split objectAtIndex:1] intValue]; + max = [split objectAtIndex:1]; else - maxHogs = 18; - NSString *max = [[NSString alloc] initWithFormat:@"%d",maxHogs]; - self.maxLabel.text = max; - [max release]; + max = @"18"; + [self setMaxLabelText:max]; self.themeCommand = [NSString stringWithFormat:@"etheme %@", [split objectAtIndex:0]]; self.staticMapCommand = [NSString stringWithFormat:@"emap %@", [source objectAtIndex:index]]; @@ -198,8 +187,6 @@ int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; if (newRow != oldRow) { - if (self.dataSourceArray == nil) - [self loadDataSourceArray]; NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; if (isRandomness()) { // just change the theme, don't update preview @@ -324,7 +311,7 @@ mission = @""; [self sliderChanged:nil]; self.slider.enabled = YES; - [externalController fillSections]; + [SchemeWeaponConfigViewController fillInstanceSections]; break; case 1: // Map @@ -334,7 +321,7 @@ mission = @""; self.slider.enabled = NO; self.sizeLabel.text = NSLocalizedString(@"No filter",@""); - [externalController fillSections]; + [SchemeWeaponConfigViewController fillInstanceSections]; break; case 2: // Maze @@ -343,7 +330,7 @@ mission = @""; [self sliderChanged:nil]; self.slider.enabled = YES; - [externalController fillSections]; + [SchemeWeaponConfigViewController fillInstanceSections]; break; case 3: // Mission @@ -353,7 +340,7 @@ mission = @""; self.slider.enabled = NO; self.sizeLabel.text = NSLocalizedString(@"No filter",@""); - [externalController emptySections]; + [SchemeWeaponConfigViewController emptyInstanceSections]; break; default: @@ -371,54 +358,65 @@ oldPage = newPage; } --(IBAction) buttonPressed:(id) sender { - [self.parentController buttonPressed:sender]; -} - #pragma mark - #pragma mark view management --(void) loadDataSourceArray { - NSString *model = getModelType(); - - // only folders containing icon.png are a valid theme - NSArray *themeArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:THEMES_DIRECTORY() error:NULL]; - NSMutableArray *themeArray = [[NSMutableArray alloc] init]; - for (NSString *themeName in themeArrayFull) { - NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]; - if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath]) - [themeArray addObject:themeName]; - [checkPath release]; +-(NSArray *) dataSourceArray { + if (dataSourceArray == nil) { + NSString *model = [HWUtils modelType]; + + // only folders containing icon.png are a valid theme + NSArray *themeArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:THEMES_DIRECTORY() error:NULL]; + NSMutableArray *themeArray = [[NSMutableArray alloc] init]; + for (NSString *themeName in themeArrayFull) { + NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]; + if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath]) + [themeArray addObject:themeName]; + [checkPath release]; + } + + // remove images that are too big for certain devices without loading the whole image + NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; + NSMutableArray *mapArray = [[NSMutableArray alloc] init]; + for (NSString *str in mapArrayFull) { + CGSize imgSize = [UIImage imageSizeFromMetadataOf:[MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]]; + if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) + continue; + if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) + continue; + [mapArray addObject:str]; + } + + NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; + NSMutableArray *missionArray = [[NSMutableArray alloc] init]; + for (NSString *str in missionArrayFull) { + CGSize imgSize = [UIImage imageSizeFromMetadataOf:[MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]]; + if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) + continue; + if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) + continue; + [missionArray addObject:str]; + } + NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; + [missionArray release]; + [themeArray release]; + [mapArray release]; + + self.dataSourceArray = array; + [array release]; } + return dataSourceArray; +} - // remove images that are too big for certain devices without loading the whole image - NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; - NSMutableArray *mapArray = [[NSMutableArray alloc] init]; - for (NSString *str in mapArrayFull) { - CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); - if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) - continue; - if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) - continue; - [mapArray addObject:str]; +-(MapPreviewButtonView *)previewButton { + if (previewButton == nil) { + MapPreviewButtonView *preview = [[MapPreviewButtonView alloc] initWithFrame:CGRectMake(32, 26, 256, 128)]; + preview.delegate = self; + [preview addTarget:self action:@selector(mapButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:preview]; + self.previewButton = preview; + [preview release]; } - - NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; - NSMutableArray *missionArray = [[NSMutableArray alloc] init]; - for (NSString *str in missionArrayFull) { - CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); - if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) - continue; - if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) - continue; - [missionArray addObject:str]; - } - NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; - [missionArray release]; - [themeArray release]; - [mapArray release]; - - self.dataSourceArray = array; - [array release]; + return previewButton; } -(void) viewDidLoad { @@ -426,24 +424,18 @@ srandom(time(NULL)); + /* CGSize screenSize = [[UIScreen mainScreen] bounds].size; self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); + */ // initialize some "default" values - self.sizeLabel.text = NSLocalizedString(@"All",@""); self.slider.value = 0.05f; - oldValue = 5; - - busy = NO; - [self loadDataSourceArray]; - self.lastIndexPath = [NSIndexPath indexPathForRow:-1 inSection:0]; - - // select a map at first because it's faster - done in IB - oldPage = 1; - if (self.segmentedControl.selectedSegmentIndex == 1) { - self.slider.enabled = NO; - self.sizeLabel.text = NSLocalizedString(@"No filter",@""); - } + self.slider.enabled = NO; + self.sizeLabel.text = NSLocalizedString(@"No filter",@""); + self.oldValue = 5; + self.busy = NO; + self.oldPage = self.segmentedControl.selectedSegmentIndex; self.templateFilterCommand = @"e$template_filter 0"; self.mazeSizeCommand = @"e$maze_size 0"; @@ -451,16 +443,22 @@ self.staticMapCommand = @""; self.missionCommand = @""; - if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) - [self.tableView setBackgroundView:nil]; - self.tableView.backgroundColor = [UIColor clearColor]; - self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER; + if (IS_IPAD()) { + [self.tableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; + self.tableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; + self.tableView.layer.borderWidth = 2.7f; + self.tableView.layer.cornerRadius = 8; + self.tableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0); + + UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 14, 300, 190) andTitle:nil withBorderWidth:2.3f]; + [self.view insertSubview:backLabel belowSubview:self.segmentedControl]; + [backLabel release]; + } + self.tableView.separatorColor = [UIColor whiteColor]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; } -(void) viewWillAppear:(BOOL)animated { - if (self.dataSourceArray == nil) - [self loadDataSourceArray]; [super viewWillAppear:animated]; } @@ -495,6 +493,7 @@ -(void) didReceiveMemoryWarning { self.dataSourceArray = nil; + self.previewButton = nil; [super didReceiveMemoryWarning]; if (self.view.superview == nil) { diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h --- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h Fri Oct 28 18:33:38 2011 +0200 @@ -25,7 +25,7 @@ @protocol MapPreviewViewDelegate -(void) turnOnWidgets; --(void) setLabelText:(NSString *)string; +-(void) setMaxLabelText:(NSString *)string; -(NSDictionary *)getDataForEngine; @end @@ -38,9 +38,8 @@ @property (nonatomic,assign) id delegate; --(void) setBackgroundImageRounded:(UIImage *)image forState:(UIControlState)state; --(void) setImageRounded:(UIImage *)image forState:(UIControlState)state; --(void) setImageRoundedForNormalState:(UIImage *)image; +-(void) setImageRounded:(UIImage *)image forState:(UIControlState) controlState; +-(void) setImageRounded:(UIImage *)image; -(void) updatePreviewWithSeed:(NSString *)seed; -(void) updatePreviewWithFile:(NSString *)filePath; -(void) turnOnWidgets; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m --- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m Fri Oct 28 18:33:38 2011 +0200 @@ -22,7 +22,10 @@ #import "MapPreviewButtonView.h" #import "MapConfigViewController.h" #import "UIImageExtra.h" +#import "ServerSetup.h" #import +#import + #define INDICATOR_TAG 7654 @@ -32,15 +35,8 @@ -(id) initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { delegate = nil; - [self setBackgroundImageRounded:[UIImage whiteImage:frame.size] forState:UIControlStateNormal]; - } - return self; -} - --(id) initWithCoder:(NSCoder *)aDecoder { - if ((self = [super initWithCoder:aDecoder])) { - delegate = nil; - [self setBackgroundImageRounded:[UIImage whiteImage:self.frame.size] forState:UIControlStateNormal]; + self.backgroundColor = [UIColor whiteColor]; + self.layer.cornerRadius = 12; } return self; } @@ -52,16 +48,11 @@ #pragma mark - #pragma mark image wrappers --(void) setBackgroundImageRounded:(UIImage *)image forState:(UIControlState)state { - // TODO:http://stackoverflow.com/questions/4272476/setbackgroundimage-behaviour-changed-on-ipad-4-2 - [self setBackgroundImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:state]; +-(void) setImageRounded:(UIImage *)image forState:(UIControlState)controlState { + [self setImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:controlState]; } --(void) setImageRounded:(UIImage *)image forState:(UIControlState)state { - [self setImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:state]; -} - --(void) setImageRoundedForNormalState:(UIImage *)image { +-(void) setImageRounded:(UIImage *)image { [self setImageRounded:image forState:UIControlStateNormal]; } @@ -78,7 +69,7 @@ IPaddress ip; BOOL serverQuit = NO; static uint8_t map[128*32]; - int port = randomPort(); + int port = [ServerSetup randomPort]; if (SDLNet_Init() < 0) { DLog(@"SDLNet_Init: %s", SDLNet_GetError()); @@ -162,7 +153,7 @@ previewCGImage = nil; // all these are performed on the main thread to prevent a leak - [self performSelectorOnMainThread:@selector(setImageRoundedForNormalState:) + [self performSelectorOnMainThread:@selector(setImageRounded:) withObject:previewImage waitUntilDone:NO]; [previewImage release]; @@ -197,7 +188,7 @@ [self setTitle:nil forState:UIControlStateNormal]; // don't display preview on slower device, too slow and memory hog - if (IS_NOT_POWERFUL(getModelType())) { + if (IS_NOT_POWERFUL([HWUtils modelType])) { [self setTitle:NSLocalizedString(@"Preview not available",@"") forState:UIControlStateNormal]; [self turnOnWidgets]; } else { @@ -218,6 +209,8 @@ -(void) updatePreviewWithFile:(NSString *)filePath { UIImage *image = [[UIImage alloc] initWithContentsOfFile:filePath]; [self setImageRounded:image forState:UIControlStateNormal]; + self.backgroundColor = [UIColor whiteColor]; + self.layer.cornerRadius = 12; [image release]; } @@ -232,15 +225,19 @@ #pragma mark - #pragma mark delegate -(void) turnOnWidgets { - [self.delegate turnOnWidgets]; + if ([self.delegate respondsToSelector:@selector(turnOnWidgets)]) + [self.delegate turnOnWidgets]; } -(void) setLabelText:(NSString *)string { - [self.delegate setLabelText:string]; + if ([self.delegate respondsToSelector:@selector(setMaxLabelText:)]) + [self.delegate setMaxLabelText:string]; } -(NSDictionary *)getDataForEngine { - return [self.delegate getDataForEngine]; + if ([self.delegate respondsToSelector:@selector(getDataForEngine)]) + return [self.delegate getDataForEngine]; + return nil; } @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MasterViewController.h --- a/project_files/HedgewarsMobile/Classes/MasterViewController.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2011 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * File created on 27/03/2010. - */ - - -#import - - -@class SplitViewRootController; -@class GeneralSettingsViewController; -@class TeamSettingsViewController; -@class WeaponSettingsViewController; -@class SchemeSettingsViewController; -@class SupportViewController; - -@interface MasterViewController : UITableViewController { - SplitViewRootController *rootController; - MasterViewController *targetController; - NSArray *controllerNames; - NSIndexPath *lastIndexPath; - GeneralSettingsViewController *generalSettingsViewController; - TeamSettingsViewController *teamSettingsViewController; - WeaponSettingsViewController *weaponSettingsViewController; - SchemeSettingsViewController *schemeSettingsViewController; - SupportViewController *supportViewController; -} - -@property (nonatomic, retain) MasterViewController *targetController; -@property (nonatomic, retain) SplitViewRootController *rootController; -@property (nonatomic, retain) NSArray *controllerNames; -@property (nonatomic, retain) NSIndexPath *lastIndexPath; - --(IBAction) dismissSplitView; - -@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MasterViewController.m --- a/project_files/HedgewarsMobile/Classes/MasterViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2011 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * File created on 27/03/2010. - */ - - -#import "MasterViewController.h" -#import "CommodityFunctions.h" -#import "GeneralSettingsViewController.h" -#import "TeamSettingsViewController.h" -#import "WeaponSettingsViewController.h" -#import "SchemeSettingsViewController.h" -#import "SupportViewController.h" - -@implementation MasterViewController -@synthesize rootController, targetController, controllerNames, lastIndexPath; - - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { - return rotationManager(interfaceOrientation); -} - - -#pragma mark - -#pragma mark View lifecycle --(void) viewDidLoad { - [super viewDidLoad]; - - // the list of selectable controllers - NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""), - NSLocalizedString(@"Teams",@""), - NSLocalizedString(@"Weapons",@""), - NSLocalizedString(@"Schemes",@""), - NSLocalizedString(@"Support",@""), - nil]; - self.controllerNames = array; - [array release]; - - // targetControllers tells whether we're on the right or left side of the splitview -- on iphone we only use the right side - if (targetController == nil && IS_IPAD()) { - if (nil == generalSettingsViewController) - generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - generalSettingsViewController.navigationItem.hidesBackButton = YES; - [generalSettingsViewController viewWillAppear:YES]; - [self.navigationController pushViewController:generalSettingsViewController animated:NO]; - } else { - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self - action:@selector(dismissSplitView)]; - } -} - -#pragma mark - -#pragma mark Table view data source --(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - --(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [controllerNames count]; -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; - - NSString *iconStr = nil; - switch ([indexPath row]) { - case 0: - iconStr = [NSString stringWithFormat:@"%@/TargetBee.png",GRAPHICS_DIRECTORY()]; - break; - case 1: - iconStr = [NSString stringWithFormat:@"%@/Egg.png",GRAPHICS_DIRECTORY()]; - break; - case 2: - iconStr = [NSString stringWithFormat:@"%@/cheese.png",GRAPHICS_DIRECTORY()]; - break; - case 3: - iconStr = [NSString stringWithFormat:@"%@/Target.png",GRAPHICS_DIRECTORY()]; - break; - case 4: - iconStr = [NSString stringWithFormat:@"%@/Seduction.png",GRAPHICS_DIRECTORY()]; - break; - default: - //seduction.png for support page - DLog(@"Nope"); - break; - } - - if (nil == targetController) - cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - else - cell.accessoryType = UITableViewCellAccessoryNone; - - cell.textLabel.text = [controllerNames objectAtIndex:[indexPath row]]; - UIImage *icon = [[UIImage alloc] initWithContentsOfFile:iconStr]; - cell.imageView.image = icon; - [icon release]; - - return cell; -} - -#pragma mark - -#pragma mark Table view delegate --(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - int newRow = [indexPath row]; - int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; - UIViewController *nextController = nil; - - if (newRow != oldRow) { - [self.tableView deselectRowAtIndexPath:lastIndexPath animated:YES]; - [targetController.navigationController popToRootViewControllerAnimated:NO]; - - switch (newRow) { - case 0: - if (nil == generalSettingsViewController) - generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = generalSettingsViewController; - break; - case 1: - if (nil == teamSettingsViewController) - teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = teamSettingsViewController; - break; - case 2: - if (nil == weaponSettingsViewController) - weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = weaponSettingsViewController; - break; - case 3: - if (nil == schemeSettingsViewController) - schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = schemeSettingsViewController; - break; - case 4: - if (nil == supportViewController) - supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped]; - nextController = supportViewController; - break; - } - - nextController.title = [controllerNames objectAtIndex:newRow]; - self.lastIndexPath = indexPath; - [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; - - if (nil == targetController) { - nextController.navigationItem.hidesBackButton = NO; - [self.navigationController pushViewController:nextController animated:YES]; - } else { - [AudioManagerController playClickSound]; - nextController.navigationItem.hidesBackButton = YES; - [targetController.navigationController pushViewController:nextController animated:NO]; - } - } -} - - -#pragma mark - -#pragma mark Memory management --(void) didReceiveMemoryWarning { - if (generalSettingsViewController.view.superview == nil) - generalSettingsViewController = nil; - if (teamSettingsViewController.view.superview == nil) - teamSettingsViewController = nil; - if (weaponSettingsViewController.view.superview == nil) - weaponSettingsViewController = nil; - if (schemeSettingsViewController.view.superview == nil) - schemeSettingsViewController = nil; - if (supportViewController.view.superview == nil) - supportViewController = nil; - MSG_MEMCLEAN(); - [super didReceiveMemoryWarning]; -} - --(void) viewDidUnload { - //self.rootController = nil; - //self.targetController = nil; - self.controllerNames = nil; - self.lastIndexPath = nil; - generalSettingsViewController = nil; - teamSettingsViewController = nil; - weaponSettingsViewController = nil; - schemeSettingsViewController = nil; - supportViewController = nil; - MSG_DIDUNLOAD(); - [super viewDidUnload]; -} - --(void) dealloc { - releaseAndNil(rootController); - releaseAndNil(targetController); - releaseAndNil(controllerNames); - releaseAndNil(lastIndexPath); - releaseAndNil(generalSettingsViewController); - releaseAndNil(teamSettingsViewController); - releaseAndNil(weaponSettingsViewController); - releaseAndNil(schemeSettingsViewController); - releaseAndNil(supportViewController); - [super dealloc]; -} - --(IBAction) dismissSplitView { - [self.rootController dismissModalViewControllerAnimated:YES]; -} - -@end - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPad.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,702 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 274 + + YES + + + 274 + {{91, 86}, {585, 391}} + + + 1 + MCAwIDAgMAA + + NO + YES + IBIPadFramework + YES + 2 + 1 + 2 + 0 + YES + 44 + 10 + 10 + + + + 292 + {{227, 496}, {314, 260}} + + YES + NO + IBIPadFramework + + + + 292 + {{20, 684}, {64, 64}} + + NO + IBIPadFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + NSImage + backButton.png + + + + + 292 + {{606, 684}, {142, 64}} + + NO + 1 + IBIPadFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + startGameButton.png + + + + + 292 + {{5, 6}, {757, 72}} + + NO + YES + 7 + NO + IBIPadFramework + Description here + + Helvetica-BoldOblique + 21 + 16 + + + 1 + MCAwIDAAA + + + 1 + 10 + 2 + 1 + + + {768, 768} + + + 3 + MQA + + 2 + + + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + dataSource + + + + 11 + + + + delegate + + + + 12 + + + + previewImage + + + + 13 + + + + tableView + + + + 14 + + + + buttonPressed: + + + 7 + + 19 + + + + buttonPressed: + + + 7 + + 20 + + + + descriptionLabel + + + + 22 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 9 + + + YES + + + + + 10 + + + + + 17 + + + + + 18 + + + + + 21 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 10.IBPluginDependency + 10.IBViewBoundsToFrameTransform + 17.IBPluginDependency + 17.IBViewBoundsToFrameTransform + 18.IBPluginDependency + 18.IBViewBoundsToFrameTransform + 21.IBPluginDependency + 21.IBViewBoundsToFrameTransform + 9.IBPluginDependency + 9.IBViewBoundsToFrameTransform + + + YES + MissionTrainingViewController + UIResponder + {{139, 166}, {768, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDYwAAxD2AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABBoAAAxC1AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABEF4AAxC1AAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCDAAAwowAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCtgAAw+2AAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 22 + + + + YES + + MissionTrainingViewController + UIViewController + + buttonPressed: + id + + + buttonPressed: + + buttonPressed: + id + + + + YES + + YES + descriptionLabel + previewImage + tableView + + + YES + UILabel + UIImageView + UITableView + + + + YES + + YES + descriptionLabel + previewImage + tableView + + + YES + + descriptionLabel + UILabel + + + previewImage + UIImageView + + + tableView + UITableView + + + + + IBProjectSource + Classes/MissionTrainingViewController.h + + + + UILabel + + IBProjectSource + Classes/HWUtils.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + backButton.png + startGameButton.png + + + YES + {64, 64} + {142, 64} + + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController-iPhone.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,652 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 274 + {{180, 0}, {300, 320}} + + + 3 + MQA + + NO + YES + IBCocoaTouchFramework + YES + 2 + 1 + 0 + YES + 44 + 22 + 22 + + + + 292 + {{11, 19}, {157, 130}} + + YES + NO + IBCocoaTouchFramework + + + + 292 + {{57, 245}, {64, 64}} + + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + NSImage + backButton.png + + + + + 292 + {{18, 164}, {142, 64}} + + NO + 1 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + startGameButton.png + + + + {480, 320} + + + 3 + MQA + + 2 + + + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + dataSource + + + + 11 + + + + delegate + + + + 12 + + + + previewImage + + + + 13 + + + + tableView + + + + 14 + + + + buttonPressed: + + + 7 + + 19 + + + + buttonPressed: + + + 7 + + 20 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 9 + + + YES + + + + + 10 + + + + + 17 + + + + + 18 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 10.IBPluginDependency + 10.IBViewBoundsToFrameTransform + 17.IBPluginDependency + 17.IBViewBoundsToFrameTransform + 18.IBPluginDependency + 18.IBViewBoundsToFrameTransform + 9.IBPluginDependency + 9.IBViewBoundsToFrameTransform + + + YES + MissionTrainingViewController + UIResponder + {{492, 751}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABAoAAAwwYAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABChAAAw5eAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABB2AAAw2cAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDUAAAw5UAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 22 + + + + YES + + MissionTrainingViewController + UIViewController + + buttonPressed: + id + + + buttonPressed: + + buttonPressed: + id + + + + YES + + YES + descriptionLabel + previewImage + tableView + + + YES + UILabel + UIImageView + UITableView + + + + YES + + YES + descriptionLabel + previewImage + tableView + + + YES + + descriptionLabel + UILabel + + + previewImage + UIImageView + + + tableView + UITableView + + + + + IBProjectSource + Classes/MissionTrainingViewController.h + + + + UILabel + + IBProjectSource + Classes/HWUtils.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + backButton.png + startGameButton.png + + + YES + {64, 64} + {142, 64} + + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MissionTrainingViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,42 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2011 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 03/10/2011. + */ + +#import + + +@interface MissionTrainingViewController : UIViewController { + NSArray *listOfMissions; + NSArray *listOfDescriptions; + NSString *missionName; + UIImageView *previewImage; + UITableView *tableView; + UILabel *descriptionLabel; +} + +@property (nonatomic, retain) NSArray *listOfMissions; +@property (nonatomic, retain) NSArray *listOfDescriptions; +@property (nonatomic, retain) NSString *missionName; +@property (nonatomic, retain) IBOutlet UIImageView *previewImage; +@property (nonatomic, retain) IBOutlet UITableView *tableView; +@property (nonatomic, retain) IBOutlet UILabel *descriptionLabel; + +-(IBAction) buttonPressed:(id) sender; + +@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,207 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2011 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 03/10/2011. + */ + + +#import "MissionTrainingViewController.h" +#import +#import "GameInterfaceBridge.h" + + +@implementation MissionTrainingViewController +@synthesize listOfMissions, listOfDescriptions, previewImage, tableView, descriptionLabel, missionName; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +#pragma mark - +#pragma mark View management +-(void) viewDidLoad { + NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png"; + UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName]; + self.view.backgroundColor = [UIColor colorWithPatternImage:img]; + [img release]; + + self.previewImage.layer.borderColor = [[UIColor darkYellowColor] CGColor]; + self.previewImage.layer.borderWidth = 3.8f; + self.previewImage.layer.cornerRadius = 14; + + if (IS_IPAD()) { + [self.tableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; + self.tableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + } else { + [self.tableView setBackgroundColorForAnyTable:[UIColor blackColorTransparent]]; + self.tableView.layer.borderColor = [[UIColor whiteColor] CGColor]; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; + } + self.tableView.layer.borderWidth = 2.4f; + self.tableView.layer.cornerRadius = 8; + self.tableView.separatorColor = [UIColor whiteColor]; + + self.descriptionLabel.textColor = [UIColor lightYellowColor]; + [super viewDidLoad]; +} + +-(void) viewWillAppear:(BOOL)animated { + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:random()%[self.listOfMissions count] inSection:0]; + [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + [self tableView:self.tableView didSelectRowAtIndexPath:indexPath]; + [super viewWillAppear:animated]; +} + +-(IBAction) buttonPressed:(id) sender { + UIButton *button = (UIButton *)sender; + + if (button.tag == 0) { + [AudioManagerController playBackSound]; + [[self parentViewController] dismissModalViewControllerAnimated:YES]; + } else { + GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; + [bridge startMissionGame:self.missionName]; + [bridge release]; + } +} + +#pragma mark - +#pragma mark override setters/getters for better memory handling +-(NSArray *)listOfMissions { + if (listOfMissions == nil) + self.listOfMissions = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TRAININGS_DIRECTORY() error:NULL]; + return listOfMissions; +} + +-(NSArray *)listOfDescriptions { + if (listOfDescriptions == nil) { + NSString *descLocation = [[NSString alloc] initWithFormat:@"%@/missions_en.txt",LOCALE_DIRECTORY()]; + NSString *descComplete = [[NSString alloc] initWithContentsOfFile:descLocation encoding:NSUTF8StringEncoding error:NULL]; + [descLocation release]; + NSArray *descArray = [descComplete componentsSeparatedByString:@"\n"]; + NSMutableArray *filteredArray = [[NSMutableArray alloc] initWithCapacity:[descArray count]]; + [descComplete release]; + // sanity check to avoid having missions and descriptions conflicts + for (int i = 0; i < [self.listOfMissions count]; i++) { + NSString *desc = [[self.listOfMissions objectAtIndex:i] stringByDeletingPathExtension]; + for (NSString *str in descArray) + if ([str hasPrefix:desc]) { + NSArray *descriptionText = [str componentsSeparatedByString:@"\""]; + [filteredArray insertObject:[descriptionText objectAtIndex:1] atIndex:i]; + break; + } + } + self.listOfDescriptions = filteredArray; + [filteredArray release]; + } + return listOfDescriptions; +} + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.listOfMissions count]; +} + +-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return (IS_IPAD()) ? self.tableView.rowHeight : 80; +} + +-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"CellTr"; + NSInteger row = [indexPath row]; + + UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) + cell = [[[UITableViewCell alloc] initWithStyle:(IS_IPAD()) ? UITableViewCellStyleDefault : UITableViewCellStyleSubtitle + reuseIdentifier:CellIdentifier] autorelease]; + + cell.textLabel.text = [[[self.listOfMissions objectAtIndex:row] stringByDeletingPathExtension] + stringByReplacingOccurrencesOfString:@"_" withString:@" "]; + cell.textLabel.textColor = [UIColor lightYellowColor]; + //cell.textLabel.font = [UIFont fontWithName:@"Bradley Hand Bold" size:[UIFont labelFontSize]]; + cell.textLabel.textAlignment = (IS_IPAD()) ? UITextAlignmentCenter : UITextAlignmentLeft; + cell.textLabel.backgroundColor = [UIColor clearColor]; + cell.textLabel.adjustsFontSizeToFitWidth = YES; + cell.detailTextLabel.text = (IS_IPAD()) ? nil : [self.listOfDescriptions objectAtIndex:row]; + cell.detailTextLabel.textColor = [UIColor whiteColor]; + cell.detailTextLabel.backgroundColor = [UIColor clearColor]; + cell.detailTextLabel.adjustsFontSizeToFitWidth = YES; + cell.detailTextLabel.numberOfLines = ([cell.detailTextLabel.text length] % 40); + cell.detailTextLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters; + + cell.backgroundColor = [UIColor blackColorTransparent]; + return cell; +} + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSInteger row = [indexPath row]; + + self.missionName = [[self.listOfMissions objectAtIndex:row] stringByDeletingPathExtension]; + NSString *size = IS_IPAD() ? @"@2x" : @""; + NSString *filePath = [[NSString alloc] initWithFormat:@"%@/Missions/Training/%@%@.png",GRAPHICS_DIRECTORY(),self.missionName,size]; + UIImage *img = [[UIImage alloc] initWithContentsOfFile:filePath]; + [filePath release]; + [self.previewImage setImage:img]; + [img release]; + + self.descriptionLabel.text = [self.listOfDescriptions objectAtIndex:row]; +} + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + self.previewImage = nil; + self.missionName = nil; + self.listOfMissions = nil; + self.listOfDescriptions = nil; + // if you nil this one it won't get updated anymore + //self.previewImage = nil; + [super didReceiveMemoryWarning]; +} + +-(void) viewDidUnload { + self.listOfMissions = nil; + self.listOfDescriptions = nil; + self.previewImage = nil; + self.tableView = nil; + self.descriptionLabel = nil; + self.missionName = nil; + MSG_DIDUNLOAD(); + [super viewDidUnload]; +} + + +-(void) dealloc { + releaseAndNil(listOfMissions); + releaseAndNil(listOfDescriptions); + releaseAndNil(previewImage); + releaseAndNil(tableView); + releaseAndNil(descriptionLabel); + releaseAndNil(missionName); + [super dealloc]; +} + + +@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/ObjcExports.h --- a/project_files/HedgewarsMobile/Classes/ObjcExports.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/ObjcExports.h Fri Oct 28 18:33:38 2011 +0200 @@ -19,7 +19,15 @@ */ -void objcExportsInit(void); +@interface ObjcExports : NSObject { + +} + ++(void) initialize; + +@end + + BOOL isGameRunning(void); void setGameRunning(BOOL value); NSInteger cachedGrenadeTime(void); diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/ObjcExports.m --- a/project_files/HedgewarsMobile/Classes/ObjcExports.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m Fri Oct 28 18:33:38 2011 +0200 @@ -23,27 +23,29 @@ #import "OverlayViewController.h" #import "AmmoMenuViewController.h" -#pragma mark - -#pragma mark internal variables + // actual game started (controls should be enabled) -BOOL gameRunning; +static BOOL gameRunning; // black screen present -BOOL savedGame; +static BOOL savedGame; // cache the grenade time -NSInteger grenadeTime; +static NSInteger grenadeTime; // the reference to the newMenu instance -OverlayViewController *overlay_instance; +static OverlayViewController *overlay_instance; +@implementation ObjcExports -#pragma mark - -#pragma mark functions called like oop -void objcExportsInit() { ++(void) initialize { overlay_instance = [OverlayViewController mainOverlay]; gameRunning = NO; savedGame = NO; grenadeTime = 2; } +@end + +#pragma mark - +#pragma mark functions called by objc code BOOL inline isGameRunning() { return gameRunning; } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/OverlayViewController.m --- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -23,11 +23,10 @@ #import "InGameMenuViewController.h" #import "HelpPageViewController.h" #import "AmmoMenuViewController.h" -#import "PascalImports.h" -#import "CommodityFunctions.h" #import "CGPointUtils.h" #import "ObjcExports.h" + #define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7] #define HIDING_TIME_NEVER [NSDate dateWithTimeIntervalSinceNow:10000] #define doDim() [dimTimer setFireDate: (IS_DUALHEAD()) ? HIDING_TIME_NEVER : HIDING_TIME_DEFAULT] diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/OverlayViewController.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1014 @@ + + + + 1056 + 10H574 + 823 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 268 + {{0, 229}, {50, 50}} + + NO + NO + YES + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + NSImage + arrowLeft.png + + + + + 268 + {{87, 229}, {50, 50}} + + NO + NO + YES + 1 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowRight.png + + + + + 265 + {{412, 236}, {64, 64}} + + NO + NO + YES + 5 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + joyButtonBackJump.png + + + + + 265 + {{365, 203}, {64, 64}} + + NO + NO + YES + 6 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + joyButtonForwardJump.png + + + + + 265 + {{354, 256}, {64, 64}} + + NO + NO + YES + 4 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + joyButtonAttack.png + + + + + 268 + {{44, 187}, {50, 50}} + + NO + NO + YES + 2 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowUp.png + + + + + 268 + {{44, 270}, {50, 50}} + + NO + NO + YES + 3 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + arrowDown.png + + + + + 289 + {{341, 0}, {64, 50}} + + NO + YES + 10 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + cornerButton.png + + + + + 289 + {{402, 0}, {78, 50}} + + NO + YES + 11 + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + ammoButton.png + + + + {480, 320} + + + 3 + MSAwAA + + NO + YES + NO + YES + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + 1 + + 8 + + + + buttonReleased: + + + 9 + + 9 + + + + buttonReleased: + + + 7 + + 10 + + + + buttonReleased: + + + 8 + + 11 + + + + buttonReleased: + + + 8 + + 13 + + + + buttonReleased: + + + 9 + + 14 + + + + buttonPressed: + + + 1 + + 15 + + + + buttonReleased: + + + 7 + + 16 + + + + buttonReleased: + + + 9 + + 18 + + + + buttonPressed: + + + 1 + + 19 + + + + buttonReleased: + + + 8 + + 20 + + + + buttonReleased: + + + 7 + + 21 + + + + buttonReleased: + + + 8 + + 23 + + + + buttonReleased: + + + 9 + + 24 + + + + buttonPressed: + + + 1 + + 25 + + + + buttonReleased: + + + 7 + + 26 + + + + buttonReleased: + + + 9 + + 44 + + + + buttonPressed: + + + 1 + + 45 + + + + buttonReleased: + + + 8 + + 46 + + + + buttonReleased: + + + 7 + + 47 + + + + buttonReleased: + + + 8 + + 49 + + + + buttonReleased: + + + 7 + + 50 + + + + buttonReleased: + + + 9 + + 51 + + + + buttonPressed: + + + 1 + + 52 + + + + buttonReleased: + + + 9 + + 54 + + + + buttonReleased: + + + 7 + + 55 + + + + buttonPressed: + + + 1 + + 56 + + + + buttonReleased: + + + 8 + + 57 + + + + buttonPressed: + + + 7 + + 60 + + + + buttonPressed: + + + 7 + + 68 + + + + buttonReleased: + + + 9 + + 69 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 4 + + + left + + + 12 + + + right + + + 17 + + + up + + + 22 + + + down + + + 43 + + + push2 + + + 48 + + + push1 + + + 53 + + + push3 + + + 58 + + + + + 67 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 12.IBPluginDependency + 12.IBViewBoundsToFrameTransform + 17.IBPluginDependency + 22.IBPluginDependency + 4.IBPluginDependency + 43.IBPluginDependency + 48.IBPluginDependency + 53.IBPluginDependency + 58.IBPluginDependency + 67.IBPluginDependency + + + YES + OverlayViewController + UIResponder + {{690, 375}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCkAAAw5SAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 72 + + + + YES + + OverlayViewController + UIViewController + + YES + + YES + buttonPressed: + buttonReleased: + + + YES + id + id + + + + YES + + YES + buttonPressed: + buttonReleased: + + + YES + + buttonPressed: + id + + + buttonReleased: + id + + + + + IBProjectSource + Classes/OverlayViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + YES + + YES + ammoButton.png + arrowDown.png + arrowLeft.png + arrowRight.png + arrowUp.png + cornerButton.png + joyButtonAttack.png + joyButtonBackJump.png + joyButtonForwardJump.png + + + YES + {78, 50} + {50, 50} + {50, 50} + {50, 50} + {50, 50} + {60, 50} + {64, 64} + {64, 64} + {64, 64} + + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/RestoreViewController-iPad.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/RestoreViewController-iPad.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,616 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 274 + + YES + + + 302 + {{84, 517}, {151, 37}} + + NO + IBIPadFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + 1 + Dismiss + + 3 + MQA + + + 1 + MCAwIDAuNTAxOTYwODE0AA + + + 3 + MC41AA + + + + + 299 + {{308, 517}, {151, 37}} + + NO + 1 + IBIPadFramework + 0 + 0 + + 1 + Restore + + + + + + + 315 + {{216, 35}, {108, 29}} + + NO + YES + 7 + NO + IBIPadFramework + Hmm... + + Helvetica-Bold + 24 + 16 + + + 2 + MSAwLjc4MDM5MjIyOTYgMAA + + + 1 + 10 + 1 + + + + 307 + {{80, 375}, {380, 96}} + + NO + YES + 7 + NO + IBIPadFramework + Would you like to restore it? + + Helvetica + 18 + 16 + + + 1 + MC45MDE5NjA3OTAyIDAuOTAxOTYwNzkwMiAwLjkwMTk2MDc5MDIAA + + + 1 + 10 + 4 + 1 + + + + 307 + {{80, 87}, {380, 96}} + + NO + YES + 7 + NO + IBIPadFramework + It appears you didn't complete your last game! + + + 1 + MC45MDE5NjA3OTAyIDAuOTAxOTYwNzkwMiAwLjkwMTk2MDc5MDIAA + + + 1 + 10 + 4 + 1 + + + + 300 + {{150, 191}, {240, 160}} + + NO + IBIPadFramework + + NSImage + denied.png + + + + {540, 640} + + + 4 + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + buttonReleased: + + + 7 + + 21 + + + + buttonReleased: + + + 7 + + 22 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 15 + + + + + 16 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 23 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 15.IBPluginDependency + 15.IBViewBoundsToFrameTransform + 16.IBPluginDependency + 16.IBViewBoundsToFrameTransform + 18.IBPluginDependency + 18.IBViewBoundsToFrameTransform + 19.IBPluginDependency + 19.IBViewBoundsToFrameTransform + 20.IBPluginDependency + 20.IBViewBoundsToFrameTransform + 23.IBPluginDependency + 23.IBViewBoundsToFrameTransform + + + YES + RestoreViewController + UIResponder + {{566, 244}, {540, 640}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDlIAAw2gAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABEAkAAw2gAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDXAAAw3UAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUKgAABDmYAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDFgAAw8cAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCoAAAw9uAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 23 + + + + YES + + RestoreViewController + UIViewController + + buttonReleased: + id + + + buttonReleased: + + buttonReleased: + id + + + + IBProjectSource + Classes/RestoreViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + denied.png + {240, 160} + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/RestoreViewController-iPhone.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/RestoreViewController-iPhone.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,582 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + YES + + + 300 + {{20, 20}, {240, 160}} + + NO + IBCocoaTouchFramework + + NSImage + denied.png + + + + + 315 + {{310, 32}, {108, 29}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + Hmm... + + Helvetica-Bold + 24 + 16 + + + 2 + MSAwLjgyNzQ1MTA1MDMgMAA + + + 3 + MQA + + 1 + 10 + 1 + + + + 307 + {{268, 74}, {192, 96}} + + NO + YES + 7 + NO + IBCocoaTouchFramework + It appears you didn't complete your last game! Would you like to restore it? + + Helvetica + 18 + 16 + + + 1 + MC45MDE5NjA3OTAyIDAuOTAxOTYwNzkwMiAwLjkwMTk2MDc5MDIAA + + + 1 + 10 + 4 + 1 + + + + 302 + {{53, 229}, {151, 37}} + + NO + IBCocoaTouchFramework + 0 + 0 + + Helvetica-Bold + 15 + 16 + + 1 + Dismiss + + + 1 + MCAwIDAuNTAxOTYwODE0AA + + + 3 + MC41AA + + + + + 299 + {{277, 229}, {151, 37}} + + NO + 1 + IBCocoaTouchFramework + 0 + 0 + + 1 + Restore + + + + + + {480, 320} + + + 4 + + 3 + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 3 + + + + buttonReleased: + + + 7 + + 11 + + + + buttonReleased: + + + 7 + + 12 + + + + + YES + + 0 + + + + + + 1 + + + YES + + + + + + + + + + -1 + + + File's Owner + + + -2 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 10 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 10.IBPluginDependency + 10.IBViewBoundsToFrameTransform + 5.IBPluginDependency + 5.IBViewBoundsToFrameTransform + 6.IBPluginDependency + 6.IBViewBoundsToFrameTransform + 7.IBPluginDependency + 7.IBViewBoundsToFrameTransform + 8.IBPluginDependency + 8.IBViewBoundsToFrameTransform + + + YES + RestoreViewController + UIResponder + {{206, 423}, {480, 320}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUOKgABDZQAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUGgAABBoAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUObAABCAAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUOGAABClAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUJUAABDZQAAA + + + + + YES + + + YES + + + + + YES + + + YES + + + + 14 + + + + YES + + RestoreViewController + UIViewController + + buttonReleased: + id + + + buttonReleased: + + buttonReleased: + id + + + + IBProjectSource + Classes/RestoreViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIButton + UIControl + + IBFrameworkSource + UIKit.framework/Headers/UIButton.h + + + + UIControl + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIControl.h + + + + UIImageView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIImageView.h + + + + UILabel + UIView + + IBFrameworkSource + UIKit.framework/Headers/UILabel.h + + + + UIResponder + NSObject + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + + denied.png + {240, 160} + + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SavedGamesViewController.m --- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -21,7 +21,7 @@ #import "SavedGamesViewController.h" #import "GameInterfaceBridge.h" -#import "CommodityFunctions.h" + @implementation SavedGamesViewController @synthesize tableView, listOfSavegames, interfaceBridge, numberOfItems; @@ -44,11 +44,7 @@ if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) self.tableView.backgroundView = nil; - NSString *imgName; - if (IS_IPAD()) - imgName = @"mediumBackground~ipad.png"; - else - imgName = @"smallerBackground~iphone.png"; + NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png"; UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName]; self.view.backgroundColor = [UIColor colorWithPatternImage:img]; [img release]; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,574 @@ + + + + 1056 + 10K549 + 823 + 1038.36 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 132 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + YES + + + 290 + {768, 44} + + NO + 458912 + IBIPadFramework + + YES + + IBIPadFramework + 1 + + 0 + + + IBIPadFramework + + 5 + + + 1 + Clear All + IBIPadFramework + 1 + + + + + + + 274 + {{0, 44}, {768, 724}} + + + 1 + MCAwIDAgMAA + + YES + IBIPadFramework + YES + 1 + 2 + 0 + YES + 44 + 10 + 10 + + + {768, 768} + + + 3 + MQA + + NO + + 3 + + IBIPadFramework + + + + + YES + + + view + + + + 3 + + + + buttonPressed: + + + + 6 + + + + dataSource + + + + 8 + + + + delegate + + + + 9 + + + + tableView + + + + 10 + + + + buttonPressed: + + + + 17 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + YES + + + + + + + 4 + + + YES + + + + + + + + 5 + + + + + 7 + + + + + 13 + + + + + 15 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 13.IBPluginDependency + 15.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 4.IBPluginDependency + 5.IBPluginDependency + 7.IBPluginDependency + + + YES + SavedGamesViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{467, 276}, {768, 768}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 17 + + + + YES + + SavedGamesViewController + UIViewController + + YES + + YES + buttonPressed: + clearAll: + toggleEdit: + + + YES + id + id + id + + + + YES + + YES + buttonPressed: + clearAll: + toggleEdit: + + + YES + + buttonPressed: + id + + + clearAll: + id + + + toggleEdit: + id + + + + + tableView + UITableView + + + tableView + + tableView + UITableView + + + + IBProjectSource + Classes/SavedGamesViewController.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIBarButtonItem + UIBarItem + + IBFrameworkSource + UIKit.framework/Headers/UIBarButtonItem.h + + + + UIBarItem + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIBarItem.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UISearchBar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UISearchBar.h + + + + UISearchDisplayController + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UISearchDisplayController.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIToolbar + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIToolbar.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIPrintFormatter.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UINavigationController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UIPopoverController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UISplitViewController.h + + + + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + + + UIViewController + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIViewController.h + + + + + 0 + IBIPadFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../Hedgewars.xcodeproj + 3 + 132 + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m --- a/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -41,6 +41,8 @@ action:@selector(toggleEdit:)]; self.navigationItem.rightBarButtonItem = editButton; [editButton release]; + + self.navigationItem.title = @"List of schemes"; } -(void) viewWillAppear:(BOOL) animated { @@ -78,7 +80,7 @@ -(void) addScheme:(id) sender { NSString *fileName = [[NSString alloc] initWithFormat:@"Scheme %u.plist", [self.listOfSchemes count]]; - createSchemeNamed([fileName stringByDeletingPathExtension], 0); + [CreationChamber createSchemeNamed:[fileName stringByDeletingPathExtension]]; [self.listOfSchemes addObject:fileName]; @@ -126,7 +128,7 @@ [schemeFile release]; [self.listOfSchemes removeObjectAtIndex:row]; - [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } #pragma mark - @@ -144,6 +146,7 @@ [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; [self.navigationController pushViewController:childController animated:YES]; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -22,7 +22,9 @@ #import -@interface SchemeWeaponConfigViewController : UITableViewController { +@interface SchemeWeaponConfigViewController : UIViewController { + UITableView *tableView; + NSArray *listOfSchemes; NSArray *listOfWeapons; NSArray *listOfScripts; @@ -37,9 +39,10 @@ NSString *scriptCommand; UISegmentedControl *topControl; - BOOL hideSections; + BOOL sectionsHidden; } +@property (nonatomic,retain) UITableView *tableView; @property (nonatomic,retain) NSArray *listOfSchemes; @property (nonatomic,retain) NSArray *listOfWeapons; @property (nonatomic,retain) NSArray *listOfScripts; @@ -51,9 +54,9 @@ @property (nonatomic,retain) NSString *selectedScript; @property (nonatomic,retain) NSString *scriptCommand; @property (nonatomic,retain) UISegmentedControl *topControl; -@property (assign) BOOL hideSections; +@property (nonatomic,assign) BOOL sectionsHidden; --(void) fillSections; --(void) emptySections; ++(void) fillInstanceSections; ++(void) emptyInstanceSections; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,80 +20,122 @@ #import "SchemeWeaponConfigViewController.h" -#import "CommodityFunctions.h" +#import + #define LABEL_TAG 57423 +static SchemeWeaponConfigViewController *controllerInstance; + @implementation SchemeWeaponConfigViewController -@synthesize listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu, - selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, hideSections; +@synthesize tableView, listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu, + selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, sectionsHidden; -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return rotationManager(interfaceOrientation); } #pragma mark - +#pragma mark custom setters/getters +-(NSString *)selectedScheme { + if (selectedScheme == nil) + self.selectedScheme = @"Default.plist"; + return selectedScheme; +} + +-(NSString *)selectedWeapon { + if (selectedWeapon == nil) + self.selectedWeapon = @"Default.plist"; + return selectedWeapon; +} + +-(NSString *)selectedScript { + if (selectedScript == nil) + self.selectedScript = @"Normal.plist"; + return selectedScript; +} + +-(NSString *)scriptCommand { + if (scriptCommand == nil) + self.scriptCommand = @""; + return scriptCommand; +} + +-(NSArray *)listOfSchemes { + if (listOfSchemes == nil) + self.listOfSchemes = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL]; + return listOfSchemes; +} + +-(NSArray *)listOfWeapons { + if (listOfWeapons == nil) + self.listOfWeapons = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL]; + return listOfWeapons; +} + +-(NSArray *)listOfScripts { + if (listOfScripts == nil) + self.listOfScripts = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL]; + return listOfScripts; +} + +-(UISegmentedControl *)topControl { + if (topControl == nil) { + NSArray *array = [[NSArray alloc] initWithObjects: + NSLocalizedString(@"Scheme",@""), + NSLocalizedString(@"Weapon",@""), + NSLocalizedString(@"Style",@""),nil]; + UISegmentedControl *controller = [[UISegmentedControl alloc] initWithItems:array]; + [array release]; + controller.segmentedControlStyle = UISegmentedControlStyleBar; + controller.tintColor = [UIColor lightGrayColor]; + controller.selectedSegmentIndex = 0; + self.topControl = controller; + [controller addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged]; + [controller release]; + } + return topControl; +} + +#pragma mark - #pragma mark View lifecycle -(void) viewDidLoad { - [super viewDidLoad]; - - CGSize screenSize = [[UIScreen mainScreen] bounds].size; - self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); - - self.selectedScheme = nil; - self.selectedWeapon = nil; - self.selectedScript = nil; - self.scriptCommand = nil; + self.sectionsHidden = NO; - if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) { - if (IS_IPAD()) - [self.tableView setBackgroundView:nil]; - else { - UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"]; - UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage]; - [backgroundImage release]; - [self.tableView setBackgroundView:background]; - [background release]; - } + UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) + style:UITableViewStyleGrouped]; + aTableView.delegate = self; + aTableView.dataSource = self; + if (IS_IPAD()) { + [aTableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; + aTableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; + aTableView.layer.borderWidth = 2.7f; + aTableView.layer.cornerRadius = 8; + aTableView.contentInset = UIEdgeInsetsMake(5, 0, 5, 0); } else { - self.view.backgroundColor = [UIColor blackColor]; + UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"]; + UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage]; + [backgroundImage release]; + [self.view addSubview:background]; + [background release]; + [aTableView setBackgroundColorForAnyTable:[UIColor clearColor]]; } - self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER; - self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; -} - --(void) viewWillAppear:(BOOL) animated { - [super viewWillAppear:animated]; - - NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL]; - self.listOfSchemes = contentsOfDir; + aTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; + aTableView.separatorColor = [UIColor whiteColor]; + aTableView.separatorStyle = UITableViewCellSeparatorStyleNone; + self.tableView = aTableView; + [aTableView release]; + [self.view addSubview:self.tableView]; - if (self.selectedScheme == nil && [listOfSchemes containsObject:@"Default.plist"]) - self.selectedScheme = @"Default.plist"; - - contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL]; - self.listOfWeapons = contentsOfDir; - - if (self.selectedWeapon == nil && [listOfWeapons containsObject:@"Default.plist"]) - self.selectedWeapon = @"Default.plist"; - - contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL]; - self.listOfScripts = contentsOfDir; - self.selectedScript = @"Normal.plist"; - self.scriptCommand = @""; - - [self.tableView reloadData]; + [super viewDidLoad]; + controllerInstance = self; } - #pragma mark - #pragma mark Table view data source -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { - if (hideSections) - return 0; - else - return 1; + return (self.sectionsHidden ? 0 : 1); } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { @@ -106,12 +148,12 @@ } // Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { +-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; NSInteger index = self.topControl.selectedSegmentIndex; NSInteger row = [indexPath row]; - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; @@ -154,8 +196,8 @@ } } - cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK; - cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; + cell.backgroundColor = [UIColor blackColorTransparent]; + cell.textLabel.textColor = [UIColor lightYellowColor]; cell.detailTextLabel.textColor = [UIColor whiteColor]; cell.textLabel.adjustsFontSizeToFitWidth = YES; cell.detailTextLabel.adjustsFontSizeToFitWidth = YES; @@ -167,20 +209,9 @@ } -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { - if (self.topControl == nil) { - NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"Scheme",@""),NSLocalizedString(@"Weapon",@""), - NSLocalizedString(@"Style",@""),nil]; - self.topControl = [[UISegmentedControl alloc] initWithItems:array]; - [array release]; - [self.topControl addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged]; - self.topControl.segmentedControlStyle = UISegmentedControlStyleBar; - self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30); - self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24); - self.topControl.tintColor = [UIColor lightGrayColor]; - self.topControl.selectedSegmentIndex = 0; - } - UIView *theView = [[[UIView alloc] init] autorelease]; + self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30); + self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24); [theView addSubview:self.topControl]; return theView; } @@ -213,6 +244,7 @@ self.lastIndexPath_sc = indexPath; self.selectedScheme = [self.listOfSchemes objectAtIndex:newRow]; + // also set weaponset when selecting scheme, if set NSUserDefaults *settings = [NSUserDefaults standardUserDefaults]; if ([[settings objectForKey:@"sync_ws"] boolValue]) { for (NSString *str in self.listOfWeapons) { @@ -220,7 +252,6 @@ int index = [self.listOfSchemes indexOfObject:str]; self.selectedWeapon = str; self.lastIndexPath_we = [NSIndexPath indexPathForRow:index inSection:1]; - [self.tableView reloadData]; break; } } @@ -232,7 +263,8 @@ self.lastIndexPath_lu = indexPath; self.selectedScript = [self.listOfScripts objectAtIndex:newRow]; - NSString *path = [[NSString alloc] initWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),selectedScript]; + // some styles disable or force the choice of a particular scheme/weaponset + NSString *path = [[NSString alloc] initWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),self.selectedScript]; NSDictionary *scriptDict = [[NSDictionary alloc] initWithContentsOfFile:path]; [path release]; self.scriptCommand = [scriptDict objectForKey:@"command"]; @@ -262,64 +294,61 @@ [aTableView deselectRowAtIndexPath:indexPath animated:YES]; } --(void) fillSections { - if (hideSections == YES) { - hideSections = NO; - NSRange range; - range.location = 0; - range.length = 1; - NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; - [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade]; - self.selectedScheme = @"Default.plist"; - self.selectedWeapon = @"Default.plist"; - self.selectedScript = @"Normal.plist"; +#pragma mark - +#pragma mark called externally to empty or fill the sections completely ++(void) fillInstanceSections { + if (controllerInstance.sectionsHidden == YES) { + controllerInstance.sectionsHidden = NO; + NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)]; + [controllerInstance.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade]; + controllerInstance.tableView.scrollEnabled = YES; - self.tableView.scrollEnabled = YES; - - [[self.view viewWithTag:LABEL_TAG] removeFromSuperview]; + [[controllerInstance.view viewWithTag:LABEL_TAG] removeFromSuperview]; } } --(void) emptySections { - hideSections = YES; - NSRange range; - range.location = 0; - range.length = 1; - NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:range]; - [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade]; - self.selectedScheme = @"Default.plist"; - self.selectedWeapon = @"Default.plist"; - self.selectedScript = @"Normal.plist"; ++(void) emptyInstanceSections { + if (controllerInstance.sectionsHidden == NO) { + controllerInstance.sectionsHidden = YES; + NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)]; + [controllerInstance.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade]; + controllerInstance.tableView.scrollEnabled = NO; - self.tableView.scrollEnabled = NO; + CGRect frame = CGRectMake(0, 0, controllerInstance.view.frame.size.width * 80/100, 60); + UILabel *theLabel = [[UILabel alloc] initWithFrame:frame + andTitle:NSLocalizedString(@"Missions don't need further configuration",@"")]; + theLabel.center = CGPointMake(controllerInstance.view.frame.size.width/2, controllerInstance.view.frame.size.height/2); + theLabel.numberOfLines = 2; + theLabel.tag = LABEL_TAG; - CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 60); - UILabel *theLabel = createBlueLabel(NSLocalizedString(@"Missions don't need further configuration",@""), frame); - theLabel.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2); - theLabel.numberOfLines = 2; - theLabel.tag = LABEL_TAG; - - [self.view addSubview:theLabel]; - [theLabel release]; + [controllerInstance.view addSubview:theLabel]; + [theLabel release]; + } } #pragma mark - #pragma mark Memory management -(void) didReceiveMemoryWarning { if ([[HedgewarsAppDelegate sharedAppDelegate] isInGame]) { + self.tableView = nil; self.lastIndexPath_sc = nil; self.lastIndexPath_we = nil; self.lastIndexPath_lu = nil; - self.listOfSchemes = nil; - self.listOfWeapons = nil; - self.listOfScripts = nil; + self.selectedScheme = nil; + self.selectedWeapon = nil; + self.selectedScript = nil; + self.scriptCommand = nil; self.topControl = nil; - MSG_MEMCLEAN(); } + self.listOfSchemes = nil; + self.listOfWeapons = nil; + self.listOfScripts = nil; + MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } -(void) viewDidUnload { + self.tableView = nil; self.listOfSchemes = nil; self.listOfWeapons = nil; self.listOfScripts = nil; @@ -335,8 +364,8 @@ [super viewDidUnload]; } - -(void) dealloc { + releaseAndNil(tableView); releaseAndNil(listOfSchemes); releaseAndNil(listOfWeapons); releaseAndNil(listOfScripts); diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/ServerSetup.h --- a/project_files/HedgewarsMobile/Classes/ServerSetup.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/ServerSetup.h Fri Oct 28 18:33:38 2011 +0200 @@ -28,6 +28,9 @@ TCPsocket sd; // External socket descriptor } ++(NSInteger) randomPort; ++(BOOL) isNetworkReachable; + @property (nonatomic, retain) NSDictionary *systemSettings; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/ServerSetup.m --- a/project_files/HedgewarsMobile/Classes/ServerSetup.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/ServerSetup.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,8 +20,9 @@ #import "ServerSetup.h" -#import "PascalImports.h" -#import "CommodityFunctions.h" +#import +#import + #import "hwconsts.h" #define BUFFER_SIZE 256 @@ -29,6 +30,47 @@ @implementation ServerSetup @synthesize systemSettings; + ++(NSInteger) randomPort { + srandom(time(NULL)); + NSInteger res = (random() % 64511) + 1024; + return (res == NETGAME_DEFAULT_PORT) ? [ServerSetup randomPort] : res; +} + ++(BOOL) isNetworkReachable { + // Create zero addy + struct sockaddr_in zeroAddress; + bzero(&zeroAddress, sizeof(zeroAddress)); + zeroAddress.sin_len = sizeof(zeroAddress); + zeroAddress.sin_family = AF_INET; + + // Recover reachability flags + SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress); + SCNetworkReachabilityFlags flags; + + BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags); + CFRelease(defaultRouteReachability); + + if (!didRetrieveFlags) { + NSLog(@"Error. Could not recover network reachability flags"); + return NO; + } + + BOOL isReachable = flags & kSCNetworkFlagsReachable; + BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired; + BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection; + + NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"]; + NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL + cachePolicy:NSURLRequestReloadIgnoringLocalCacheData + timeoutInterval:20.0]; + NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:nil]; + BOOL testResult = testConnection ? YES : NO; + [testConnection release]; + + return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO; +} + -(id) init { if (self = [super init]) { self.systemSettings = nil; //nsuserdefault diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SettingsBaseViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,50 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2011 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 27/03/2010. + */ + + +#import + + +@class GeneralSettingsViewController; +@class TeamSettingsViewController; +@class WeaponSettingsViewController; +@class SchemeSettingsViewController; +@class SupportViewController; + +@interface SettingsBaseViewController : UIViewController { + UIViewController *targetController; + NSArray *controllerNames; + NSIndexPath *lastIndexPath; + UITabBarController *tabController; + GeneralSettingsViewController *generalSettingsViewController; + TeamSettingsViewController *teamSettingsViewController; + WeaponSettingsViewController *weaponSettingsViewController; + SchemeSettingsViewController *schemeSettingsViewController; + SupportViewController *supportViewController; +} + +@property (nonatomic, retain) UIViewController *targetController; +@property (nonatomic, retain) NSArray *controllerNames; +@property (nonatomic, retain) NSIndexPath *lastIndexPath; +@property (nonatomic, retain) UITabBarController *tabController; + +-(void) dismissSplitView; + +@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,288 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2011 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 27/03/2010. + */ + + +#import "SettingsBaseViewController.h" +#import "GeneralSettingsViewController.h" +#import "TeamSettingsViewController.h" +#import "WeaponSettingsViewController.h" +#import "SchemeSettingsViewController.h" +#import "SupportViewController.h" + +@implementation SettingsBaseViewController +@synthesize tabController, targetController, controllerNames, lastIndexPath; + + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +#pragma mark - +#pragma mark View lifecycle +-(void) viewDidLoad { + // the list of available controllers + NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""), + NSLocalizedString(@"Teams",@""), + NSLocalizedString(@"Weapons",@""), + NSLocalizedString(@"Schemes",@""), + NSLocalizedString(@"Support",@""), + nil]; + self.controllerNames = array; + [array release]; + + UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone + target:self + action:@selector(dismissSplitView)]; + if (IS_IPAD()) { + // this class gets loaded twice, we tell the difference by looking at targetController + if (self.targetController != nil) { + UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain]; + tableView.delegate = self; + tableView.dataSource = self; + [tableView reloadData]; + [self.view addSubview:tableView]; + [self tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; + [tableView release]; + self.navigationItem.leftBarButtonItem = doneButton; + } + } else { + // this class just loads all controllers and set up tabbar and navigation controllers + NSMutableArray *tabBarNavigationControllers = [[NSMutableArray alloc] initWithCapacity:5]; + UINavigationController *navController = nil; + + if (nil == generalSettingsViewController) { + generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + generalSettingsViewController.tabBarItem.title = [self.controllerNames objectAtIndex:0]; + generalSettingsViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/TargetBee.png",GRAPHICS_DIRECTORY()]]; + navController = [[UINavigationController alloc] initWithRootViewController:generalSettingsViewController]; + generalSettingsViewController.navigationItem.backBarButtonItem = doneButton; + generalSettingsViewController.navigationItem.leftBarButtonItem = doneButton; + [generalSettingsViewController release]; + [tabBarNavigationControllers addObject:navController]; + releaseAndNil(navController); + } + if (nil == teamSettingsViewController) { + teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + teamSettingsViewController.tabBarItem.title = [self.controllerNames objectAtIndex:1]; + teamSettingsViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/Egg.png",GRAPHICS_DIRECTORY()]]; + navController = [[UINavigationController alloc] initWithRootViewController:teamSettingsViewController]; + teamSettingsViewController.navigationItem.backBarButtonItem = doneButton; + teamSettingsViewController.navigationItem.leftBarButtonItem = doneButton; + [tabBarNavigationControllers addObject:navController]; + releaseAndNil(navController); + } + if (nil == weaponSettingsViewController) { + weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + weaponSettingsViewController.tabBarItem.title = [self.controllerNames objectAtIndex:2]; + weaponSettingsViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/cheese.png",GRAPHICS_DIRECTORY()]]; + navController = [[UINavigationController alloc] initWithRootViewController:weaponSettingsViewController]; + weaponSettingsViewController.navigationItem.backBarButtonItem = doneButton; + weaponSettingsViewController.navigationItem.leftBarButtonItem = doneButton; + [tabBarNavigationControllers addObject:navController]; + releaseAndNil(navController); + } + if (nil == schemeSettingsViewController) { + schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + schemeSettingsViewController.tabBarItem.title = [self.controllerNames objectAtIndex:3]; + schemeSettingsViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/Targetp.png",GRAPHICS_DIRECTORY()]]; + navController = [[UINavigationController alloc] initWithRootViewController:schemeSettingsViewController]; + schemeSettingsViewController.navigationItem.backBarButtonItem = doneButton; + schemeSettingsViewController.navigationItem.leftBarButtonItem = doneButton; + [tabBarNavigationControllers addObject:navController]; + releaseAndNil(navController); + } + if (nil == supportViewController) { + supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped]; + supportViewController.tabBarItem.title = [self.controllerNames objectAtIndex:4]; + supportViewController.tabBarItem.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/Seduction.png",GRAPHICS_DIRECTORY()]]; + navController = [[UINavigationController alloc] initWithRootViewController:supportViewController]; + supportViewController.navigationItem.backBarButtonItem = doneButton; + supportViewController.navigationItem.leftBarButtonItem = doneButton; + [tabBarNavigationControllers addObject:navController]; + releaseAndNil(navController); + } + + self.tabController = [[UITabBarController alloc] init]; + self.tabController.viewControllers = tabBarNavigationControllers; + self.tabController.delegate = self; + + [self.view addSubview:self.tabController.view]; + } + [doneButton release]; + [super viewDidLoad]; +} + +-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { + [viewController viewWillAppear:NO]; +} + +-(void) dismissSplitView { + [AudioManagerController playBackSound]; + [[[HedgewarsAppDelegate sharedAppDelegate] mainViewController] dismissModalViewControllerAnimated:YES]; +} + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.controllerNames count]; +} + +// Customize the appearance of table view cells. +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + + NSString *iconStr = nil; + switch ([indexPath row]) { + case 0: + iconStr = [NSString stringWithFormat:@"%@/TargetBee.png",GRAPHICS_DIRECTORY()]; + break; + case 1: + iconStr = [NSString stringWithFormat:@"%@/Egg.png",GRAPHICS_DIRECTORY()]; + break; + case 2: + iconStr = [NSString stringWithFormat:@"%@/cheese.png",GRAPHICS_DIRECTORY()]; + break; + case 3: + iconStr = [NSString stringWithFormat:@"%@/Target.png",GRAPHICS_DIRECTORY()]; + break; + case 4: + iconStr = [NSString stringWithFormat:@"%@/Seduction.png",GRAPHICS_DIRECTORY()]; + break; + default: + DLog(@"Nope"); + break; + } + + cell.accessoryType = UITableViewCellAccessoryNone; + cell.textLabel.text = [controllerNames objectAtIndex:[indexPath row]]; + UIImage *icon = [[UIImage alloc] initWithContentsOfFile:iconStr]; + cell.imageView.image = icon; + [icon release]; + + return cell; +} + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + int newRow = [indexPath row]; + int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; + UIViewController *nextController = nil; + + if (newRow != oldRow) { + [tableView deselectRowAtIndexPath:lastIndexPath animated:YES]; + [targetController.navigationController popToRootViewControllerAnimated:NO]; + + switch (newRow) { + case 0: + if (nil == generalSettingsViewController) + generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = generalSettingsViewController; + break; + case 1: + if (nil == teamSettingsViewController) + teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = teamSettingsViewController; + break; + case 2: + if (nil == weaponSettingsViewController) + weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = weaponSettingsViewController; + break; + case 3: + if (nil == schemeSettingsViewController) + schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = schemeSettingsViewController; + break; + case 4: + if (nil == supportViewController) + supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped]; + nextController = supportViewController; + break; + } + + self.lastIndexPath = indexPath; + [tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; + + nextController.navigationItem.hidesBackButton = YES; + [nextController viewWillAppear:NO]; + [targetController.navigationController pushViewController:nextController animated:NO]; + [AudioManagerController playClickSound]; + } +} + + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + if (generalSettingsViewController.view.superview == nil) + generalSettingsViewController = nil; + if (teamSettingsViewController.view.superview == nil) + teamSettingsViewController = nil; + if (weaponSettingsViewController.view.superview == nil) + weaponSettingsViewController = nil; + if (schemeSettingsViewController.view.superview == nil) + schemeSettingsViewController = nil; + if (supportViewController.view.superview == nil) + supportViewController = nil; + if (tabController.view.superview == nil) + tabController = nil; + MSG_MEMCLEAN(); + [super didReceiveMemoryWarning]; +} + +-(void) viewDidUnload { + self.controllerNames = nil; + self.lastIndexPath = nil; + self.targetController = nil; + self.tabController = nil; + generalSettingsViewController = nil; + teamSettingsViewController = nil; + weaponSettingsViewController = nil; + schemeSettingsViewController = nil; + supportViewController = nil; + MSG_DIDUNLOAD(); + [super viewDidUnload]; +} + +-(void) dealloc { + releaseAndNil(targetController); + releaseAndNil(controllerNames); + releaseAndNil(lastIndexPath); + releaseAndNil(tabController); + releaseAndNil(generalSettingsViewController); + releaseAndNil(teamSettingsViewController); + releaseAndNil(weaponSettingsViewController); + releaseAndNil(schemeSettingsViewController); + releaseAndNil(supportViewController); + [super dealloc]; +} + +@end + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SettingsContainerViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SettingsContainerViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,36 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2011 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 27/03/2010. + */ + + +#import + +@class SettingsBaseViewController; + +@interface SettingsContainerViewController : UIViewController { + SettingsBaseViewController *baseController; + UINavigationController *activeController; + UISplitViewController *splitViewRootController; +} + +@property (nonatomic,retain) SettingsBaseViewController *baseController; +@property (nonatomic,retain) UINavigationController *activeController; +@property (nonatomic,retain) UISplitViewController *splitViewRootController; + +@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/SettingsContainerViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,130 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2011 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 27/03/2010. + */ + + +#import "SettingsContainerViewController.h" +#import "SettingsBaseViewController.h" + + +@implementation SettingsContainerViewController +@synthesize baseController, activeController, splitViewRootController; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} + + +-(void) viewDidLoad { + CGRect rect = [[UIScreen mainScreen] bounds]; + self.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); + + if (IS_IPAD()) { + // the contents on the right of the splitview, setting targetController to nil to avoid creating the table + SettingsBaseViewController *rightController = [[SettingsBaseViewController alloc] init]; + rightController.targetController = nil; + UINavigationController *rightNavController = [[UINavigationController alloc] initWithRootViewController:rightController]; + [rightController release]; + + // the contens on the left of the splitview, setting targetController that will receive push/pop actions + SettingsBaseViewController *leftController = [[SettingsBaseViewController alloc] init]; + leftController.targetController = rightNavController.topViewController; + UINavigationController *leftNavController = [[UINavigationController alloc] initWithRootViewController:leftController]; + [leftController release]; + + self.activeController = rightNavController; + self.splitViewRootController = [[UISplitViewController alloc] init]; + self.splitViewRootController.delegate = nil; + self.splitViewRootController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); + self.splitViewRootController.viewControllers = [NSArray arrayWithObjects: leftNavController, rightNavController, nil]; + [leftNavController release]; + [rightNavController release]; + + // add view to main controller + [self.view addSubview:self.splitViewRootController.view]; + } else { + if (nil == self.baseController) { + SettingsBaseViewController *sbvc = [[SettingsBaseViewController alloc] init]; + self.baseController = sbvc; + [sbvc release]; + } + self.baseController.targetController = nil; + self.baseController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); + + [self.view addSubview:self.baseController.view]; + // here setting activeController is not needed as the event is kept active by the uitabbarcontroller + } + + [super viewDidLoad]; +} + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + if (self.baseController.view.superview == nil) + self.baseController = nil; + if (self.activeController.view.superview == nil) + self.activeController = nil; + if (self.splitViewRootController.view.superview == nil) + self.splitViewRootController = nil; + MSG_MEMCLEAN(); + [super didReceiveMemoryWarning]; +} + +-(void) viewDidUnload { + self.baseController = nil; + self.activeController = nil; + self.splitViewRootController = nil; + MSG_DIDUNLOAD(); + [super viewDidUnload]; +} + +-(void) dealloc { + releaseAndNil(baseController); + releaseAndNil(activeController); + releaseAndNil(splitViewRootController); + [super dealloc]; +} + + +#pragma mark - +#pragma mark additional methods as we're using a UINavigationController programmatically +// see http://davidebenini.it/2009/01/03/viewwillappear-not-being-called-inside-a-uinavigationcontroller/ +-(void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.activeController viewWillAppear:animated]; +} + +-(void) viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + [self.activeController viewWillDisappear:animated]; +} + +-(void) viewDidAppear:(BOOL)animated { + [super viewDidLoad]; + [self.activeController viewDidAppear:animated]; +} + +-(void) viewDidDisappear:(BOOL)animated { + [super viewDidUnload]; + [self.activeController viewDidDisappear:animated]; +} + + +@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m --- a/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -21,8 +21,7 @@ #import "SingleSchemeViewController.h" #import -#import "CommodityFunctions.h" -#import "UIImageExtra.h" + #define LABEL_TAG 12345 #define SLIDER_TAG 54321 @@ -235,8 +234,8 @@ [[self.gameModifierArray objectAtIndex:row] objectForKey:@"image"]]]; cell.imageView.image = image; [image release]; - [cell.imageView.layer setCornerRadius:7.0f]; - [cell.imageView.layer setMasksToBounds:YES]; + cell.imageView.layer.cornerRadius = 6.0f; + cell.imageView.layer.masksToBounds = YES; cell.textLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"title"]; cell.detailTextLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"description"]; cell.detailTextLabel.adjustsFontSizeToFitWidth = YES; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SingleTeamViewController.m --- a/project_files/HedgewarsMobile/Classes/SingleTeamViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SingleTeamViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -27,9 +27,7 @@ #import "FortsViewController.h" #import "FlagsViewController.h" #import "LevelViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" -#import "PascalImports.h" + #define TEAMNAME_TAG 78789 @@ -264,8 +262,9 @@ accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]]; cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(26, 18)]; - cell.imageView.layer.borderWidth = 0.3; [accessoryImage release]; + cell.imageView.layer.borderWidth = 1; + cell.imageView.layer.borderColor = [[UIColor blackColor] CGColor]; break; case 4: // level accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/bot%d.png", diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m --- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,9 +20,7 @@ #import "SingleWeaponViewController.h" -#import "CommodityFunctions.h" -#import "UIImageExtra.h" -#import "PascalImports.h" + @implementation SingleWeaponViewController @synthesize weaponName, description, ammoStoreImage; @@ -165,10 +163,11 @@ weaponCell.delegate = self; } - int size = 32 * getScreenScale(); - int corners = 8 * getScreenScale(); - int x = ((row*size)/(int)(self.ammoStoreImage.size.height*getScreenScale()))*size; - int y = (row*size)%(int)(self.ammoStoreImage.size.height*getScreenScale()); + CGFloat theScale = [[UIScreen mainScreen] safeScale]; + int size = 32 * theScale; + int corners = 8 * theScale; + int x = ((row*size)/(int)(self.ammoStoreImage.size.height * theScale))*size; + int y = (row*size)%(int)(self.ammoStoreImage.size.height * theScale); UIImage *img = [[self.ammoStoreImage cutAt:CGRectMake(x, y, size, size)] makeRoundCornersOfSize:CGSizeMake(corners, corners)]; weaponCell.weaponIcon.image = img; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SplitViewRootController.h --- a/project_files/HedgewarsMobile/Classes/SplitViewRootController.h Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2011 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * File created on 27/03/2010. - */ - - -#import - -@class MasterViewController; - -@interface SplitViewRootController: UIViewController { - MasterViewController *activeController; - UINavigationController *rightNavController; - UISplitViewController *splitViewRootController; -} - -@property (nonatomic,retain) MasterViewController *activeController; -@property (nonatomic,retain) UINavigationController *rightNavController; -@property (nonatomic,retain) UISplitViewController *splitViewRootController; - -@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SplitViewRootController.m --- a/project_files/HedgewarsMobile/Classes/SplitViewRootController.m Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* - * Hedgewars-iOS, a Hedgewars port for iOS devices - * Copyright (c) 2009-2011 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * File created on 27/03/2010. - */ - - -#import "SplitViewRootController.h" -#import "MasterViewController.h" -#import "CommodityFunctions.h" - -@implementation SplitViewRootController -@synthesize activeController, rightNavController, splitViewRootController; - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); -} - --(void) didReceiveMemoryWarning { - if (self.activeController.view.superview == nil) - self.activeController = nil; - MSG_MEMCLEAN(); - [super didReceiveMemoryWarning]; -} - -// load the view programmatically; we need a splitViewController that handles a MasterViewController -// (which is just a UITableViewController) and a DetailViewController where we present options --(void) viewDidLoad { - CGRect rect = [[UIScreen mainScreen] bounds]; - self.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); - - if (self.activeController == nil) { - MasterViewController *rightController = [[MasterViewController alloc] initWithStyle:UITableViewStyleGrouped]; - rightController.rootController = self; - rightController.targetController = nil; - self.activeController = rightController; - [rightController release]; - } - self.rightNavController = [[UINavigationController alloc] initWithRootViewController:self.activeController]; - - if (IS_IPAD()) { - MasterViewController *leftController = [[MasterViewController alloc] initWithStyle:UITableViewStylePlain]; - leftController.rootController = self; - leftController.targetController = self.activeController; - UINavigationController *leftNavController = [[UINavigationController alloc] initWithRootViewController:leftController]; - [leftController release]; - - self.splitViewRootController = [[UISplitViewController alloc] init]; - self.splitViewRootController.delegate = nil; - self.splitViewRootController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); - self.splitViewRootController.viewControllers = [NSArray arrayWithObjects: leftNavController, self.rightNavController, nil]; - [leftNavController release]; - [self.rightNavController release]; - - // add view to main controller - [self.view addSubview:self.splitViewRootController.view]; - } else { - self.rightNavController.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width); - [self.view addSubview:self.rightNavController.view]; - } - - [super viewDidLoad]; -} - --(void) dismissModalViewControllerAnimated:(BOOL)animated { - [AudioManagerController playBackSound]; - [self.parentViewController dismissModalViewControllerAnimated:YES]; -} - --(void) viewDidUnload { - self.activeController = nil; - self.rightNavController = nil; - self.splitViewRootController = nil; - MSG_DIDUNLOAD(); - [super viewDidUnload]; -} - --(void) dealloc { - releaseAndNil(activeController); - releaseAndNil(rightNavController); - releaseAndNil(splitViewRootController); - [super dealloc]; -} - -#pragma mark - -#pragma mark additional methods as we're using a UINavigationController programmatically -// see http://davidebenini.it/2009/01/03/viewwillappear-not-being-called-inside-a-uinavigationcontroller/ --(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - [self.activeController.navigationController viewWillAppear:animated]; -} - --(void) viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; - [self.activeController.navigationController viewWillDisappear:animated]; -} - --(void) viewDidAppear:(BOOL)animated { - [super viewDidLoad]; - [self.activeController.navigationController viewDidAppear:animated]; -} - --(void) viewDidDisappear:(BOOL)animated { - [super viewDidUnload]; - [self.activeController.navigationController viewDidDisappear:animated]; -} - - -@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SquareButtonView.m --- a/project_files/HedgewarsMobile/Classes/SquareButtonView.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SquareButtonView.m Fri Oct 28 18:33:38 2011 +0200 @@ -21,8 +21,7 @@ #import "SquareButtonView.h" #import -#import "CommodityFunctions.h" -#import "UIImageExtra.h" + @implementation SquareButtonView @synthesize colorArray, selectedColor, ownerDictionary; @@ -32,7 +31,7 @@ colorIndex = -1; selectedColor = 0; - self.colorArray = getAvailableColors(); + self.colorArray = [HWUtils teamColors]; // set the color to the first available one [self nextColor]; @@ -41,7 +40,7 @@ [self.layer setCornerRadius:7.0f]; [self.layer setMasksToBounds:YES]; [self.layer setBorderWidth:2]; - [self.layer setBorderColor:[UICOLOR_HW_YELLOW_BODER CGColor]]; + [self.layer setBorderColor:[[UIColor darkYellowColor] CGColor]]; // this changes the color at button press [self addTarget:self action:@selector(nextColor) forControlEvents:UIControlEventTouchUpInside]; @@ -67,7 +66,7 @@ -(void) selectColor:(NSUInteger) color { if (color != selectedColor) { selectedColor = color; - colorIndex = [colorArray indexOfObject:[NSNumber numberWithUnsignedInt:color]]; + colorIndex = [self.colorArray indexOfObject:[NSNumber numberWithUnsignedInt:color]]; self.backgroundColor = [UIColor colorWithRed:((color & 0x00FF0000) >> 16)/255.0f green:((color & 0x0000FF00) >> 8)/255.0f diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/StatsPageViewController.m --- a/project_files/HedgewarsMobile/Classes/StatsPageViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,6 @@ #import "StatsPageViewController.h" -#import "CommodityFunctions.h" #import @implementation StatsPageViewController @@ -49,7 +48,7 @@ } else self.view.backgroundColor = [UIColor blackColor]; - self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER; + self.tableView.separatorColor = [UIColor darkYellowColor]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; [super viewDidLoad]; @@ -85,7 +84,7 @@ imgName = @"star"; imgPath = [[NSBundle mainBundle] resourcePath]; cell.textLabel.text = [self.statsArray objectAtIndex:1]; - cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; + cell.textLabel.textColor = [UIColor lightYellowColor]; } else if (section == 1) { // teams ranking // color, # kills, teamname NSArray *info = [[[self.statsArray objectAtIndex:0] objectAtIndex:row] componentsSeparatedByString:@" "]; @@ -99,7 +98,7 @@ } else if (section == 2) { // general info imgName = @"iconDamage"; cell.textLabel.text = [self.statsArray objectAtIndex:row + 2]; - cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; + cell.textLabel.textColor = [UIColor lightYellowColor]; } NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",imgPath,imgName]; @@ -155,9 +154,9 @@ [button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; - button.backgroundColor = UICOLOR_HW_ALMOSTBLACK; + button.backgroundColor = [UIColor blackColorTransparent]; [button.layer setBorderWidth:1]; - [button.layer setBorderColor:UICOLOR_HW_YELLOW_BODER.CGColor]; + [button.layer setBorderColor:[[UIColor darkYellowColor] CGColor]]; [button.layer setCornerRadius:9.0f]; [button.layer setMasksToBounds:YES]; [button addTarget:self action:@selector(dismissView) forControlEvents:UIControlEventTouchUpInside]; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/SupportViewController.m --- a/project_files/HedgewarsMobile/Classes/SupportViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SupportViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,7 @@ #import "SupportViewController.h" -#import "CommodityFunctions.h" + @implementation SupportViewController @synthesize waysToSupport; @@ -44,6 +44,7 @@ self.waysToSupport = array; [array release]; + self.navigationItem.title = @"♥"; self.tableView.rowHeight = 50; } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/TeamConfigViewController.h --- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Fri Oct 28 18:33:38 2011 +0200 @@ -22,17 +22,23 @@ #import #import "HoldTableViewCell.h" -@interface TeamConfigViewController : UITableViewController { + +@interface TeamConfigViewController : UIViewController { + UITableView *tableView; + NSInteger selectedTeamsCount; NSInteger allTeamsCount; NSMutableArray *listOfSelectedTeams; - NSMutableArray *listOfTeams; + NSMutableArray *listOfAllTeams; NSArray *cachedContentsOfDir; } -@property (nonatomic, retain) NSMutableArray *listOfTeams; -@property (nonatomic, retain) NSMutableArray *listOfSelectedTeams; -@property (nonatomic, retain) NSArray *cachedContentsOfDir; +@property (nonatomic,retain) UITableView *tableView; +@property (nonatomic,assign) NSInteger selectedTeamsCount; +@property (nonatomic,assign) NSInteger allTeamsCount; +@property (nonatomic,retain) NSMutableArray *listOfAllTeams; +@property (nonatomic,retain) NSMutableArray *listOfSelectedTeams; +@property (nonatomic,retain) NSArray *cachedContentsOfDir; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/TeamConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,44 +20,54 @@ #import "TeamConfigViewController.h" -#import "CommodityFunctions.h" +#import #import "SquareButtonView.h" + @implementation TeamConfigViewController -@synthesize listOfTeams, listOfSelectedTeams, cachedContentsOfDir; +@synthesize tableView, selectedTeamsCount, allTeamsCount, listOfAllTeams, listOfSelectedTeams, cachedContentsOfDir; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return rotationManager(interfaceOrientation); +} #pragma mark - #pragma mark View lifecycle -(void) viewDidLoad { - [super viewDidLoad]; - - CGSize screenSize = [[UIScreen mainScreen] bounds].size; - self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44); + UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) + style:UITableViewStyleGrouped]; + aTableView.delegate = self; + aTableView.dataSource = self; + if (IS_IPAD()) { + [aTableView setBackgroundColorForAnyTable:[UIColor darkBlueColorTransparent]]; + aTableView.layer.borderColor = [[UIColor darkYellowColor] CGColor]; + aTableView.layer.borderWidth = 2.7f; + aTableView.layer.cornerRadius = 8; + aTableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0); + } else { + UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"]; + UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage]; + [backgroundImage release]; + [self.view addSubview:background]; + [background release]; + [aTableView setBackgroundColorForAnyTable:[UIColor clearColor]]; + } - if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) { - if (IS_IPAD()) - [self.tableView setBackgroundView:nil]; - else { - UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:@"background~iphone.png"]; - UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage]; - [backgroundImage release]; - [self.tableView setBackgroundView:background]; - [background release]; - } - } else - self.view.backgroundColor = [UIColor blackColor]; + aTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite; + aTableView.separatorColor = [UIColor whiteColor]; + aTableView.separatorStyle = UITableViewCellSeparatorStyleNone; + self.tableView = aTableView; + [aTableView release]; - self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER; - self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + [self.view addSubview:self.tableView]; + [super viewDidLoad]; } -(void) viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL]; - // avoid overwriting selected teams when returning on this view if ([self.cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) { - NSArray *colors = getAvailableColors(); + self.cachedContentsOfDir = contentsOfDir; + NSArray *colors = [HWUtils teamColors]; NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]]; for (int i = 0; i < [contentsOfDir count]; i++) { NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys: @@ -67,25 +77,19 @@ [array addObject:dict]; [dict release]; } - self.listOfTeams = array; + self.listOfAllTeams = array; [array release]; NSMutableArray *emptyArray = [[NSMutableArray alloc] initWithObjects:nil]; self.listOfSelectedTeams = emptyArray; [emptyArray release]; - selectedTeamsCount = [self.listOfSelectedTeams count]; - allTeamsCount = [self.listOfTeams count]; + self.selectedTeamsCount = [self.listOfSelectedTeams count]; + self.allTeamsCount = [self.listOfAllTeams count]; + [self.tableView reloadData]; + } - NSArray *contents = [[NSArray alloc] initWithArray:contentsOfDir copyItems:YES]; - self.cachedContentsOfDir = contents; - [contents release]; - } - [self.tableView reloadData]; -} - --(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return rotationManager(interfaceOrientation); + [super viewWillAppear:animated]; } -(NSInteger) filterNumberOfHogs:(NSInteger) hogs { @@ -101,39 +105,6 @@ return numberOfHogs; } --(UIImage *)drawHogsRepeated:(NSInteger) manyTimes { - NSString *imgString = [[NSString alloc] initWithFormat:@"%@/hedgehog.png",[[NSBundle mainBundle] resourcePath]]; - UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:imgString]; - [imgString release]; - CGFloat screenScale = getScreenScale(); - int w = hogSprite.size.width * screenScale; - int h = hogSprite.size.height * screenScale; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(NULL, w * 3, h, 8, 4 * w * 3, colorSpace, kCGImageAlphaPremultipliedFirst); - - // draw the two images in the current context - for (int i = 0; i < manyTimes; i++) - CGContextDrawImage(context, CGRectMake(i*8*screenScale, 0, w, h), [hogSprite CGImage]); - [hogSprite release]; - - // Create bitmap image info from pixel data in current context - CGImageRef imageRef = CGBitmapContextCreateImage(context); - - // Create a new UIImage object - UIImage *resultImage; - if ([self respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) - resultImage = [UIImage imageWithCGImage:imageRef scale:screenScale orientation:UIImageOrientationUp]; - else - resultImage = [UIImage imageWithCGImage:imageRef]; - - // Release colorspace, context and bitmap information - CGColorSpaceRelease(colorSpace); - CGContextRelease(context); - CFRelease(imageRef); - - return resultImage; -} - #pragma mark - #pragma mark Table view data source -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { @@ -141,10 +112,7 @@ } -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - if (section == 0) - return selectedTeamsCount; - else - return allTeamsCount; + return (section == 0 ? self.selectedTeamsCount : self.allTeamsCount); } // Customize the appearance of table view cells. @@ -174,14 +142,14 @@ [squareButton setTitle:[hogNumber stringValue] forState:UIControlStateNormal]; squareButton.ownerDictionary = selectedRow; - cell.imageView.image = [self drawHogsRepeated:[hogNumber intValue]]; + cell.imageView.image = [UIImage drawHogsRepeated:[hogNumber intValue]]; ((HoldTableViewCell *)cell).delegate = self; } else { cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; - cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; + cell.textLabel.text = [[[self.listOfAllTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; cell.textLabel.backgroundColor = [UIColor clearColor]; NSString *teamPath = [NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),cell.textLabel.text]; @@ -199,25 +167,21 @@ cell.accessoryView = nil; } - cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; - cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK; + cell.textLabel.textColor = [UIColor lightYellowColor]; + cell.backgroundColor = [UIColor blackColorTransparent]; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - return 40.0; + return 45.0; } -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { CGRect frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30); - NSString *text; - if (section == 0) - text = NSLocalizedString(@"Playing Teams",@""); - else - text = NSLocalizedString(@"Available Teams",@""); - UILabel *theLabel = createBlueLabel(text, frame); + NSString *text = (section == 0) ? NSLocalizedString(@"Playing Teams",@"") : NSLocalizedString(@"Available Teams",@""); + UILabel *theLabel = [[UILabel alloc] initWithFrame:frame andTitle:text]; theLabel.center = CGPointMake(self.view.frame.size.width/2, 20); UIView *theView = [[[UIView alloc] init] autorelease]; @@ -230,13 +194,13 @@ return IS_IPAD() ? 40 : 20; } --(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section { +-(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger) section { NSInteger height = IS_IPAD() ? 40 : 20; - UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, height)]; + UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)]; footer.backgroundColor = [UIColor clearColor]; - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width*80/100, height)]; - label.center = CGPointMake(self.tableView.frame.size.width/2, height/2); + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width*80/100, height)]; + label.center = CGPointMake(aTableView.frame.size.width/2, height/2); label.textAlignment = UITextAlignmentCenter; label.font = [UIFont italicSystemFontOfSize:12]; label.textColor = [UIColor whiteColor]; @@ -259,9 +223,9 @@ NSInteger row = [indexPath row]; NSInteger section = [indexPath section]; - if (section == 1 && [self.listOfTeams count] > row) { - [self.listOfSelectedTeams addObject:[self.listOfTeams objectAtIndex:row]]; - [self.listOfTeams removeObjectAtIndex:row]; + if (section == 1 && [self.listOfAllTeams count] > row) { + [self.listOfSelectedTeams addObject:[self.listOfAllTeams objectAtIndex:row]]; + [self.listOfAllTeams removeObjectAtIndex:row]; NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:selectedTeamsCount inSection:0]; allTeamsCount--; @@ -281,11 +245,11 @@ [squareButton setTitle:[newNumber stringValue] forState:UIControlStateNormal]; [selectedRow setObject:newNumber forKey:@"number"]; - cell.imageView.image = [self drawHogsRepeated:[newNumber intValue]]; + cell.imageView.image = [UIImage drawHogsRepeated:[newNumber intValue]]; } } --(void) holdAction:(NSString *)content { +-(void) holdAction:(NSString *)content onTable:(UITableView *)aTableView { NSInteger row; for (row = 0; row < [self.listOfSelectedTeams count]; row++) { NSDictionary *dict = [self.listOfSelectedTeams objectAtIndex:row]; @@ -293,28 +257,33 @@ break; } - [self.listOfTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]]; + [self.listOfAllTeams addObject:[self.listOfSelectedTeams objectAtIndex:row]]; [self.listOfSelectedTeams removeObjectAtIndex:row]; - [self.tableView beginUpdates]; - [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationLeft]; - [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:allTeamsCount inSection:1]] withRowAnimation:UITableViewRowAnimationLeft]; - allTeamsCount++; - selectedTeamsCount--; - [self.tableView endUpdates]; + [aTableView beginUpdates]; + [aTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:row inSection:0]] withRowAnimation:UITableViewRowAnimationLeft]; + [aTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:allTeamsCount inSection:1]] withRowAnimation:UITableViewRowAnimationLeft]; + self.allTeamsCount++; + self.selectedTeamsCount--; + [aTableView endUpdates]; } #pragma mark - #pragma mark Memory management -(void) didReceiveMemoryWarning { - // Relinquish ownership any cached data, images, etc that aren't in use. + if ([[HedgewarsAppDelegate sharedAppDelegate] isInGame]) { + self.listOfSelectedTeams = nil; + self.listOfAllTeams = nil; + self.tableView = nil; + } self.cachedContentsOfDir = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } -(void) viewDidUnload { - self.listOfTeams = nil; + self.tableView = nil; + self.listOfAllTeams = nil; self.listOfSelectedTeams = nil; self.cachedContentsOfDir = nil; MSG_DIDUNLOAD(); @@ -323,7 +292,8 @@ -(void) dealloc { - releaseAndNil(listOfTeams); + releaseAndNil(tableView); + releaseAndNil(listOfAllTeams); releaseAndNil(listOfSelectedTeams); releaseAndNil(cachedContentsOfDir); [super dealloc]; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m --- a/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -43,6 +43,8 @@ action:@selector(toggleEdit:)]; self.navigationItem.rightBarButtonItem = editButton; [editButton release]; + + self.navigationItem.title = @"List of teams"; } // load the list of teams in the teams directory @@ -82,7 +84,7 @@ -(void) addTeam:(id) sender { NSString *fileName = [[NSString alloc] initWithFormat:@"Default Team %u.plist", [self.listOfTeams count]]; - createTeamNamed([fileName stringByDeletingPathExtension]); + [CreationChamber createTeamNamed:[fileName stringByDeletingPathExtension]]; [self.listOfTeams addObject:fileName]; @@ -131,7 +133,7 @@ [teamFile release]; [self.listOfTeams removeObjectAtIndex:row]; - [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } @@ -150,6 +152,7 @@ [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; [self.navigationController pushViewController:childController animated:YES]; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/UIImageExtra.h --- a/project_files/HedgewarsMobile/Classes/UIImageExtra.h Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.h Fri Oct 28 18:33:38 2011 +0200 @@ -24,7 +24,9 @@ @interface UIImage (extra) -CGFloat getScreenScale(void); ++(UIImage *)whiteImage:(CGSize) ofSize; ++(UIImage *)drawHogsRepeated:(NSInteger) manyTimes; ++(CGSize) imageSizeFromMetadataOf:(NSString *)aFileName; -(UIImage *)scaleToSize:(CGSize) size; -(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint; @@ -34,6 +36,5 @@ -(UIImage *)convertToNegative; -(UIImage *)maskImageWith:(UIImage *)maskImage; -(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh; -+(UIImage *)whiteImage:(CGSize) ofSize; @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/UIImageExtra.m --- a/project_files/HedgewarsMobile/Classes/UIImageExtra.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.m Fri Oct 28 18:33:38 2011 +0200 @@ -24,63 +24,21 @@ @implementation UIImage (extra) -CGFloat getScreenScale(void) { - float scale = 1.0f; - if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) - scale = [[UIScreen mainScreen] scale]; - return scale; -} - -(UIImage *)scaleToSize:(CGSize) size { - DLog(@"warning - this is a very expensive operation, you should avoid using it"); - - // Create a bitmap graphics context; this will also set it as the current context - if (UIGraphicsBeginImageContextWithOptions != NULL) - UIGraphicsBeginImageContextWithOptions(size, NO, getScreenScale()); - else - UIGraphicsBeginImageContext(size); - - // Draw the scaled image in the current context - [self drawInRect:CGRectMake(0, 0, size.width, size.height)]; - - // Create a new image from current context - UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext(); - - // Pop the current context from the stack - UIGraphicsEndImageContext(); - - // Return our new scaled image (autoreleased) - return scaledImage; -} - --(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint { - if (secondImage == nil) { - DLog(@"Warning, secondImage == nil"); - return self; - } - CGFloat screenScale = getScreenScale(); - int w = self.size.width * screenScale; - int h = self.size.height * screenScale; - - if (w == 0 || h == 0) { - DLog(@"Can have 0 dimesions"); - return self; - } - // Create a bitmap graphics context; this will also set it as the current context CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); - - // draw the two images in the current context - CGContextDrawImage(context, CGRectMake(0, 0, self.size.width*screenScale, self.size.height*screenScale), [self CGImage]); - CGContextDrawImage(context, CGRectMake(secondImagePoint.x*screenScale, secondImagePoint.y*screenScale, secondImage.size.width*screenScale, secondImage.size.height*screenScale), [secondImage CGImage]); - + CGContextRef context = CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, colorSpace, kCGImageAlphaPremultipliedFirst); + + // draw the image inside the context + CGFloat screenScale = [[UIScreen mainScreen] safeScale]; + CGContextDrawImage(context, CGRectMake(0, 0, size.width*screenScale, size.height*screenScale), self.CGImage); + // Create bitmap image info from pixel data in current context CGImageRef imageRef = CGBitmapContextCreateImage(context); - + // Create a new UIImage object UIImage *resultImage; - if ([self respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) + if ([UIImage respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) resultImage = [UIImage imageWithCGImage:imageRef scale:screenScale orientation:UIImageOrientationUp]; else resultImage = [UIImage imageWithCGImage:imageRef]; @@ -89,7 +47,48 @@ CGColorSpaceRelease(colorSpace); CGContextRelease(context); CFRelease(imageRef); - + + return resultImage; +} + +-(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint { + if (secondImage == nil) { + DLog(@"Warning, secondImage == nil"); + return self; + } + CGFloat screenScale = [[UIScreen mainScreen] safeScale]; + int w = self.size.width * screenScale; + int h = self.size.height * screenScale; + int yOffset = self.size.height - secondImage.size.height + secondImagePoint.y; + + if (w == 0 || h == 0) { + DLog(@"Cannot have 0 dimesions"); + return self; + } + + // Create a bitmap graphics context; this will also set it as the current context + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, w, h+yOffset, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); + + // draw the two images in the current context + CGContextDrawImage(context, CGRectMake(0, 0, self.size.width*screenScale, self.size.height*screenScale), [self CGImage]); + CGContextDrawImage(context, CGRectMake(secondImagePoint.x*screenScale, secondImagePoint.y*screenScale, secondImage.size.width*screenScale, secondImage.size.height*screenScale), [secondImage CGImage]); + + // Create bitmap image info from pixel data in current context + CGImageRef imageRef = CGBitmapContextCreateImage(context); + + // Create a new UIImage object + UIImage *resultImage; + if ([UIImage respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) + resultImage = [UIImage imageWithCGImage:imageRef scale:screenScale orientation:UIImageOrientationUp]; + else + resultImage = [UIImage imageWithCGImage:imageRef]; + + // Release colorspace, context and bitmap information + CGColorSpaceRelease(colorSpace); + CGContextRelease(context); + CFRelease(imageRef); + return resultImage; } @@ -203,7 +202,7 @@ -(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh { CGFloat cornerWidth = sizewh.width; CGFloat cornerHeight = sizewh.height; - CGFloat screenScale = getScreenScale(); + CGFloat screenScale = [[UIScreen mainScreen] safeScale]; CGFloat w = self.size.width * screenScale; CGFloat h = self.size.height * screenScale; @@ -222,15 +221,14 @@ CGContextRelease(context); CGColorSpaceRelease(colorSpace); - UIImage *newImage; - if ([self respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) - newImage = [UIImage imageWithCGImage:imageMasked scale:screenScale orientation:UIImageOrientationUp]; + UIImage *resultImage; + if ([UIImage respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) + resultImage = [UIImage imageWithCGImage:imageMasked scale:screenScale orientation:UIImageOrientationUp]; else - newImage = [UIImage imageWithCGImage:imageMasked]; - + resultImage = [UIImage imageWithCGImage:imageMasked]; CGImageRelease(imageMasked); - return newImage; + return resultImage; } // by http://www.sixtemia.com/journal/2010/06/23/uiimage-negative-color-effect/ @@ -268,4 +266,81 @@ return bkgImg; } ++(UIImage *)drawHogsRepeated:(NSInteger) manyTimes { + NSString *imgString = [[NSString alloc] initWithFormat:@"%@/hedgehog.png",[[NSBundle mainBundle] resourcePath]]; + UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:imgString]; + [imgString release]; + CGFloat screenScale = [[UIScreen mainScreen] safeScale]; + int w = hogSprite.size.width * screenScale; + int h = hogSprite.size.height * screenScale; + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, w * 3, h, 8, 4 * w * 3, colorSpace, kCGImageAlphaPremultipliedFirst); + + // draw the two images in the current context + for (int i = 0; i < manyTimes; i++) + CGContextDrawImage(context, CGRectMake(i*8*screenScale, 0, w, h), [hogSprite CGImage]); + [hogSprite release]; + + // Create bitmap image info from pixel data in current context + CGImageRef imageRef = CGBitmapContextCreateImage(context); + + // Create a new UIImage object + UIImage *resultImage; + if ([UIImage respondsToSelector:@selector(imageWithCGImage:scale:orientation:)]) + resultImage = [UIImage imageWithCGImage:imageRef scale:screenScale orientation:UIImageOrientationUp]; + else + resultImage = [UIImage imageWithCGImage:imageRef]; + + // Release colorspace, context and bitmap information + CGColorSpaceRelease(colorSpace); + CGContextRelease(context); + CFRelease(imageRef); + + return resultImage; +} + +// this routine checks for the PNG size without loading it in memory +// https://github.com/steipete/PSFramework/blob/master/PSFramework%20Version%200.3/PhotoshopFramework/PSMetaDataFunctions.m ++(CGSize) imageSizeFromMetadataOf:(NSString *)aFileName { + // File Name to C String. + const char *fileName = [aFileName UTF8String]; + // source file + FILE *infile = fopen(fileName, "rb"); + if (infile == NULL) { + DLog(@"Can't open the file: %@", aFileName); + return CGSizeZero; + } + + // Bytes Buffer. + unsigned char buffer[30]; + // Grab Only First Bytes. + fread(buffer, 1, 30, infile); + // Close File. + fclose(infile); + + // PNG Signature. + unsigned char png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; + + // Compare File signature. + if ((int)(memcmp(&buffer[0], &png_signature[0], 8))) { + DLog(@"The file (%@) is not a PNG file", aFileName); + return CGSizeZero; + } + + // Calc Sizes. Isolate only four bytes of each size (width, height). + int width[4]; + int height[4]; + for (int d = 16; d < (16 + 4); d++) { + width[d-16] = buffer[d]; + height[d-16] = buffer[d+4]; + } + + // Convert bytes to Long (Integer) + long resultWidth = (width[0] << (int)24) | (width[1] << (int)16) | (width[2] << (int)8) | width[3]; + long resultHeight = (height[0] << (int)24) | (height[1] << (int)16) | (height[2] << (int)8) | height[3]; + + // Return Size. + return CGSizeMake(resultWidth,resultHeight); +} + @end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/VoicesViewController.m --- a/project_files/HedgewarsMobile/Classes/VoicesViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,7 @@ #import "VoicesViewController.h" -#import "CommodityFunctions.h" + @implementation VoicesViewController @synthesize teamDictionary, voiceArray, lastIndexPath; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/WeaponCellView.m --- a/project_files/HedgewarsMobile/Classes/WeaponCellView.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/WeaponCellView.m Fri Oct 28 18:33:38 2011 +0200 @@ -20,7 +20,7 @@ #import "WeaponCellView.h" -#import "CommodityFunctions.h" + @implementation WeaponCellView @synthesize delegate, weaponName, weaponIcon, initialSli, probabilitySli, delaySli, crateSli, helpLabel, @@ -102,9 +102,9 @@ helpLabel = [[UILabel alloc] init]; helpLabel.backgroundColor = [UIColor clearColor]; - helpLabel.textColor = [UIColor grayColor]; + helpLabel.textColor = [UIColor darkGrayColor]; helpLabel.textAlignment = UITextAlignmentRight; - helpLabel.font = [UIFont italicSystemFontOfSize:[UIFont smallSystemFontSize]]; + helpLabel.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]]; [self.contentView addSubview:weaponName]; [self.contentView addSubview:weaponIcon]; diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m --- a/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m Fri Oct 28 18:33:38 2011 +0200 @@ -42,6 +42,7 @@ self.navigationItem.rightBarButtonItem = editButton; [editButton release]; + self.navigationItem.title = @"List of weapons"; } -(void) viewWillAppear:(BOOL) animated { @@ -79,7 +80,7 @@ -(void) addWeapon:(id) sender { NSString *fileName = [[NSString alloc] initWithFormat:@"Weapon %u.plist", [self.listOfWeapons count]]; - createWeaponNamed([fileName stringByDeletingPathExtension], 0); + [CreationChamber createWeaponNamed:[fileName stringByDeletingPathExtension]]; [self.listOfWeapons addObject:fileName]; @@ -127,7 +128,7 @@ [schemeFile release]; [self.listOfWeapons removeObjectAtIndex:row]; - [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } #pragma mark - @@ -145,6 +146,7 @@ [childController.tableView setContentOffset:CGPointMake(0,0) animated:NO]; [self.navigationController pushViewController:childController animated:YES]; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/ExtraCategories.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/ExtraCategories.h Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,64 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 25/10/2011. + */ + + +#import + + +@interface UIScreen (safe) + +-(CGFloat) safeScale; + +@end + + +@interface UITableView (backgroundColor) + +-(void) setBackgroundColorForAnyTable:(UIColor *)color; + +@end + + +@interface UIColor (HWColors) + ++(UIColor *)darkYellowColor; ++(UIColor *)lightYellowColor; ++(UIColor *)darkBlueColor; ++(UIColor *)darkBlueColorTransparent; ++(UIColor *)blackColorTransparent; + +@end + + +@interface UILabel (quickStyle) + +-(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title; +-(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth; +-(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth + withBorderColor:(UIColor *)borderColor withBackgroundColor:(UIColor *)backColor; + +@end + + +@interface NSString (MD5) + +-(NSString *)MD5hash; + +@end \ No newline at end of file diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/ExtraCategories.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/ExtraCategories.m Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,141 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 25/10/2011. + */ + + +#import "ExtraCategories.h" +#import +#import + + +@implementation UIScreen (safe) + +-(CGFloat) safeScale { + CGFloat theScale = 1.0f; + if ([self respondsToSelector:@selector(scale)]) + theScale = [self scale]; + return theScale; +} + +@end + + +@implementation UITableView (backgroundColor) + +-(void) setBackgroundColorForAnyTable:(UIColor *) color { + if ([self respondsToSelector:@selector(backgroundView)]) { + UIView *backView = [[UIView alloc] initWithFrame:self.frame]; + backView.backgroundColor = color; + self.backgroundView = backView; + [backView release]; + self.backgroundColor = [UIColor clearColor]; + } else + self.backgroundColor = color; +} + +@end + + +@implementation UIColor (HWColors) + ++(UIColor *)darkYellowColor { + return [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xC0/255 blue:0 alpha:1]; +} + ++(UIColor *)lightYellowColor { + return [UIColor colorWithRed:(CGFloat)0xF0/255 green:(CGFloat)0xD0/255 blue:0 alpha:1]; +} + ++(UIColor *)darkBlueColor { + return [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:1]; +} + +// older devices don't get any transparency for performance reasons ++(UIColor *)darkBlueColorTransparent { + return [UIColor colorWithRed:(CGFloat)0x0F/255 + green:0 + blue:(CGFloat)0x55/255 + alpha:IS_NOT_POWERFUL([HWUtils modelType]) ? 1 : 0.6f]; +} + ++(UIColor *)blackColorTransparent { + return [UIColor colorWithRed:0 + green:0 + blue:0 + alpha:IS_NOT_POWERFUL([HWUtils modelType]) ? 1 : 0.65f]; +} + +@end + + +@implementation UILabel (quickStyle) + +-(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title { + return [self initWithFrame:frame + andTitle:title + withBorderWidth:1.5f + withBorderColor:[UIColor darkYellowColor] + withBackgroundColor:[UIColor darkBlueColor]]; +} + +-(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth { + return [self initWithFrame:frame + andTitle:title + withBorderWidth:borderWidth + withBorderColor:[UIColor darkYellowColor] + withBackgroundColor:[UIColor darkBlueColorTransparent]]; +} + +-(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth + withBorderColor:(UIColor *)borderColor withBackgroundColor:(UIColor *)backColor{ + UILabel *theLabel = [self initWithFrame:frame]; + theLabel.backgroundColor = backColor; + + if (title != nil) { + theLabel.text = title; + theLabel.textColor = [UIColor lightYellowColor]; + theLabel.textAlignment = UITextAlignmentCenter; + theLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]*80/100]; + } + + [theLabel.layer setBorderWidth:borderWidth]; + [theLabel.layer setBorderColor:borderColor.CGColor]; + [theLabel.layer setCornerRadius:8.0f]; + [theLabel.layer setMasksToBounds:YES]; + + return theLabel; +} + +@end + + +@implementation NSString (MD5) + +-(NSString *)MD5hash { + const char *cStr = [self UTF8String]; + unsigned char result[16]; + CC_MD5( cStr, strlen(cStr), result ); + return [NSString stringWithFormat: + @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + result[0], result[1], result[2], result[3], result[4], result[5], + result[6], result[7], result[8], result[9], result[10], result[11], + result[12], result[13], result[14], result[15]]; +} + +@end diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Fri Oct 28 18:33:38 2011 +0200 @@ -26,6 +26,11 @@ 28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD14FF0DC6FC520079059D /* OpenGLES.framework */; }; 28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD15070DC6FC5B0079059D /* QuartzCore.framework */; settings = {ATTRIBUTES = (Required, ); }; }; 61006F95128DE31F00EBA7F7 /* CreationChamber.m in Sources */ = {isa = PBXBuildFile; fileRef = 61006F94128DE31F00EBA7F7 /* CreationChamber.m */; }; + 61077E87143FB09800645B29 /* MissionTrainingViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61077E86143FB09800645B29 /* MissionTrainingViewController-iPad.xib */; }; + 6107802A143FCCC800645B29 /* startGameButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61078029143FCCC800645B29 /* startGameButton@2x.png */; }; + 610782961440EE5C00645B29 /* basicFlags.plist in Resources */ = {isa = PBXBuildFile; fileRef = 610782931440EE5C00645B29 /* basicFlags.plist */; }; + 610782971440EE5C00645B29 /* credits.plist in Resources */ = {isa = PBXBuildFile; fileRef = 610782941440EE5C00645B29 /* credits.plist */; }; + 610782981440EE5C00645B29 /* gameMods.plist in Resources */ = {isa = PBXBuildFile; fileRef = 610782951440EE5C00645B29 /* gameMods.plist */; }; 610D5FB21270E2660033333A /* Icon-Small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43411E290650040BA66 /* Icon-Small@2x.png */; }; 610D5FB31270E26C0033333A /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43611E290650040BA66 /* Icon@2x.png */; }; 61188BF212A6FE530026C5DA /* ammoButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D399129B350700911D8D /* ammoButton@2x.png */; }; @@ -74,7 +79,7 @@ 61370653117B1D50004EE44A /* Entitlements-Distribution.plist in Resources */ = {isa = PBXBuildFile; fileRef = 61370652117B1D50004EE44A /* Entitlements-Distribution.plist */; }; 61399013125D19C0003C2DC0 /* uMobile.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61399012125D19C0003C2DC0 /* uMobile.pas */; }; 6147DAD31253DCDE0010357E /* savesButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 6147DAD21253DCDE0010357E /* savesButton.png */; }; - 61536DF411CEAE7100D87A7E /* GameConfigViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924A11CA9CB400D6E256 /* GameConfigViewController.xib */; }; + 61536DF411CEAE7100D87A7E /* GameConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */; }; 615AD96212073B4D00F2FF04 /* startGameButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD96112073B4D00F2FF04 /* startGameButton.png */; }; 615AD9E9120764CA00F2FF04 /* backButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9E8120764CA00F2FF04 /* backButton.png */; }; 615AD9EB1207654E00F2FF04 /* helpButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9EA1207654E00F2FF04 /* helpButton.png */; }; @@ -91,20 +96,20 @@ 6165921411CA9BA200D6E256 /* LevelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591EF11CA9BA200D6E256 /* LevelViewController.m */; }; 6165921511CA9BA200D6E256 /* MainMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F111CA9BA200D6E256 /* MainMenuViewController.m */; }; 6165921611CA9BA200D6E256 /* MapConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F311CA9BA200D6E256 /* MapConfigViewController.m */; }; - 6165921711CA9BA200D6E256 /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F511CA9BA200D6E256 /* MasterViewController.m */; }; + 6165921711CA9BA200D6E256 /* SettingsBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F511CA9BA200D6E256 /* SettingsBaseViewController.m */; }; 6165921811CA9BA200D6E256 /* OverlayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F711CA9BA200D6E256 /* OverlayViewController.m */; }; 6165921911CA9BA200D6E256 /* InGameMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591F911CA9BA200D6E256 /* InGameMenuViewController.m */; }; 6165921A11CA9BA200D6E256 /* SchemeSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FB11CA9BA200D6E256 /* SchemeSettingsViewController.m */; }; 6165921B11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FD11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m */; }; 6165921C11CA9BA200D6E256 /* SingleSchemeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */; }; 6165921D11CA9BA200D6E256 /* SingleTeamViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920111CA9BA200D6E256 /* SingleTeamViewController.m */; }; - 6165921E11CA9BA200D6E256 /* SplitViewRootController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920311CA9BA200D6E256 /* SplitViewRootController.m */; }; + 6165921E11CA9BA200D6E256 /* SettingsContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920311CA9BA200D6E256 /* SettingsContainerViewController.m */; }; 6165921F11CA9BA200D6E256 /* TeamConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920511CA9BA200D6E256 /* TeamConfigViewController.m */; }; 6165922011CA9BA200D6E256 /* TeamSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920711CA9BA200D6E256 /* TeamSettingsViewController.m */; }; 6165922111CA9BA200D6E256 /* VoicesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920911CA9BA200D6E256 /* VoicesViewController.m */; }; 6165922211CA9BA200D6E256 /* WeaponSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165920B11CA9BA200D6E256 /* WeaponSettingsViewController.m */; }; 6165922E11CA9BD500D6E256 /* CGPointUtils.c in Sources */ = {isa = PBXBuildFile; fileRef = 6165922311CA9BD500D6E256 /* CGPointUtils.c */; }; - 6165922F11CA9BD500D6E256 /* CommodityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922611CA9BD500D6E256 /* CommodityFunctions.m */; }; + 6165922F11CA9BD500D6E256 /* HWUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922611CA9BD500D6E256 /* HWUtils.m */; }; 6165923111CA9BD500D6E256 /* SquareButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922B11CA9BD500D6E256 /* SquareButtonView.m */; }; 6165923211CA9BD500D6E256 /* UIImageExtra.m in Sources */ = {isa = PBXBuildFile; fileRef = 6165922D11CA9BD500D6E256 /* UIImageExtra.m */; }; 6165925311CA9CB400D6E256 /* MainMenuViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */; }; @@ -178,8 +183,9 @@ 61842B24122B619D0096E335 /* HelpPageInGameViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61842B23122B619D0096E335 /* HelpPageInGameViewController-iPad.xib */; }; 61842B3E122B65BD0096E335 /* helpabove.png in Resources */ = {isa = PBXBuildFile; fileRef = 61842B3D122B65BD0096E335 /* helpabove.png */; }; 61842B40122B66280096E335 /* helpleft.png in Resources */ = {isa = PBXBuildFile; fileRef = 61842B3F122B66280096E335 /* helpleft.png */; }; - 6187AEBD120781B900B31A27 /* Settings in Resources */ = {isa = PBXBuildFile; fileRef = 6187AEA5120781B900B31A27 /* Settings */; }; 61889985129995B500D55FD6 /* title~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 61889984129995B500D55FD6 /* title~ipad.png */; }; + 61915D5B143A4E2C00299991 /* MissionTrainingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61915D59143A4E2C00299991 /* MissionTrainingViewController.m */; }; + 61915D5C143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib */; }; 6195981F1364BCEF00B429B6 /* libTremor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6195981D1364BCD200B429B6 /* libTremor.a */; }; 619599451364C83D00B429B6 /* libLua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 619599441364C82B00B429B6 /* libLua.a */; }; 619599C01364E66B00B429B6 /* libFreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 619599BF1364E65900B429B6 /* libFreetype.a */; }; @@ -214,9 +220,11 @@ 61B7A61712FA13B00051E14E /* libSDL_mixer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7A56012FA12BF0051E14E /* libSDL_mixer.a */; }; 61B7A61812FA13B00051E14E /* libSDL_net.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7A56812FA12D00051E14E /* libSDL_net.a */; }; 61B7A61912FA13B00051E14E /* libSDL_ttf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B7A59012FA13330051E14E /* libSDL_ttf.a */; }; + 61B9A86814423A9D001541C1 /* GameConfigViewController-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61B9A86714423A9D001541C1 /* GameConfigViewController-iPad.xib */; }; 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C079E311F35A300072BF46 /* EditableCellView.m */; }; 61C28D3F142D380400DA16C2 /* AudioManagerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C28D3E142D380400DA16C2 /* AudioManagerController.m */; }; - 61CADE331402EE290030C3EB /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61CADE321402EE290030C3EB /* ImageIO.framework */; }; + 61CADE331402EE290030C3EB /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61CADE321402EE290030C3EB /* ImageIO.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 61D0BDF91457508C0011A899 /* ExtraCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 61D0BDF81457508C0011A899 /* ExtraCategories.m */; }; 61D205A1127CDD1100ABD83E /* ObjcExports.m in Sources */ = {isa = PBXBuildFile; fileRef = 61D205A0127CDD1100ABD83E /* ObjcExports.m */; }; 61D3D2A51290E03A003CE7C3 /* irc.png in Resources */ = {isa = PBXBuildFile; fileRef = 61D3D2A41290E03A003CE7C3 /* irc.png */; }; 61DE8F221257EB1100B80214 /* AmmoMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61DE8F211257EB1100B80214 /* AmmoMenuViewController.m */; }; @@ -359,9 +367,14 @@ 6103D39D129B350700911D8D /* arrowUp@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowUp@2x.png"; path = "Resources/Overlay/arrowUp@2x.png"; sourceTree = ""; }; 6103D39E129B350700911D8D /* cornerButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cornerButton@2x.png"; path = "Resources/Overlay/cornerButton@2x.png"; sourceTree = ""; }; 611D7A4F142FDCD3006E0798 /* uTouch.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uTouch.pas; path = ../../hedgewars/uTouch.pas; sourceTree = SOURCE_ROOT; }; + 61077E86143FB09800645B29 /* MissionTrainingViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MissionTrainingViewController-iPad.xib"; sourceTree = ""; }; + 61078029143FCCC800645B29 /* startGameButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "startGameButton@2x.png"; path = "Resources/Frontend/startGameButton@2x.png"; sourceTree = ""; }; + 610782931440EE5C00645B29 /* basicFlags.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = basicFlags.plist; path = Resources/basicFlags.plist; sourceTree = ""; }; + 610782941440EE5C00645B29 /* credits.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = credits.plist; path = Resources/credits.plist; sourceTree = ""; }; + 610782951440EE5C00645B29 /* gameMods.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = gameMods.plist; path = Resources/gameMods.plist; sourceTree = ""; }; 611D9BF812497E9800008271 /* SavedGamesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedGamesViewController.h; sourceTree = ""; }; 611D9BF912497E9800008271 /* SavedGamesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedGamesViewController.m; sourceTree = ""; }; - 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SavedGamesViewController.xib; path = ../Resources/SavedGamesViewController.xib; sourceTree = ""; }; + 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SavedGamesViewController.xib; sourceTree = ""; }; 611E0EE511FB20610077A41E /* ammoButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ammoButton.png; path = Resources/Overlay/ammoButton.png; sourceTree = ""; }; 611E0EE611FB20610077A41E /* cornerButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = cornerButton.png; path = Resources/Overlay/cornerButton.png; sourceTree = ""; }; 611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Entitlements-Development.plist"; sourceTree = ""; }; @@ -370,7 +383,7 @@ 611EE9D8122AA10A00DF6938 /* selSound.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = selSound.wav; path = Resources/selSound.wav; sourceTree = ""; }; 611EEAEB122B2A4D00DF6938 /* HelpPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelpPageViewController.h; sourceTree = ""; }; 611EEAEC122B2A4D00DF6938 /* HelpPageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HelpPageViewController.m; sourceTree = ""; }; - 611EEAED122B2A4D00DF6938 /* HelpPageLobbyViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "HelpPageLobbyViewController-iPad.xib"; path = "../Resources/HelpPageLobbyViewController-iPad.xib"; sourceTree = ""; }; + 611EEAED122B2A4D00DF6938 /* HelpPageLobbyViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageLobbyViewController-iPad.xib"; sourceTree = ""; }; 611EEBC0122B34A800DF6938 /* helpingame.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpingame.png; path = Resources/Overlay/helpingame.png; sourceTree = ""; }; 611EEBC2122B355700DF6938 /* helpbottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpbottom.png; path = Resources/Overlay/helpbottom.png; sourceTree = ""; }; 611EEBC3122B355700DF6938 /* helpright.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpright.png; path = Resources/Overlay/helpright.png; sourceTree = ""; }; @@ -385,6 +398,7 @@ 61399012125D19C0003C2DC0 /* uMobile.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uMobile.pas; path = ../../hedgewars/uMobile.pas; sourceTree = SOURCE_ROOT; }; 6147DAD21253DCDE0010357E /* savesButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = savesButton.png; path = Resources/Frontend/savesButton.png; sourceTree = ""; }; 614E333D11DE9A93009DBA4E /* VGSHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = VGSHandlers.inc; path = ../../hedgewars/VGSHandlers.inc; sourceTree = SOURCE_ROOT; }; + 61589C5A144B4322007BFAA4 /* config.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = config.inc; sourceTree = ""; }; 615AD96112073B4D00F2FF04 /* startGameButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = startGameButton.png; path = Resources/Frontend/startGameButton.png; sourceTree = ""; }; 615AD9E8120764CA00F2FF04 /* backButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backButton.png; path = Resources/Frontend/backButton.png; sourceTree = ""; }; 615AD9EA1207654E00F2FF04 /* helpButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpButton.png; path = Resources/Frontend/helpButton.png; sourceTree = ""; }; @@ -394,6 +408,7 @@ 615FEAE012A2A6640098EE92 /* localplayButton~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "localplayButton~iphone.png"; path = "Resources/Frontend/localplayButton~iphone.png"; sourceTree = ""; }; 6163EE7C11CC2600001C0453 /* SingleWeaponViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleWeaponViewController.h; sourceTree = ""; }; 6163EE7D11CC2600001C0453 /* SingleWeaponViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleWeaponViewController.m; sourceTree = ""; }; + 61641FE31437CDAA006E049C /* DefinesAndMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefinesAndMacros.h; path = Classes/DefinesAndMacros.h; sourceTree = ""; }; 616591E011CA9BA200D6E256 /* FlagsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlagsViewController.h; sourceTree = ""; }; 616591E111CA9BA200D6E256 /* FlagsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlagsViewController.m; sourceTree = ""; }; 616591E211CA9BA200D6E256 /* FortsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FortsViewController.h; sourceTree = ""; }; @@ -414,8 +429,8 @@ 616591F111CA9BA200D6E256 /* MainMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainMenuViewController.m; sourceTree = ""; }; 616591F211CA9BA200D6E256 /* MapConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapConfigViewController.h; sourceTree = ""; }; 616591F311CA9BA200D6E256 /* MapConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapConfigViewController.m; sourceTree = ""; }; - 616591F411CA9BA200D6E256 /* MasterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = ""; }; - 616591F511CA9BA200D6E256 /* MasterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = ""; }; + 616591F411CA9BA200D6E256 /* SettingsBaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsBaseViewController.h; sourceTree = ""; }; + 616591F511CA9BA200D6E256 /* SettingsBaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsBaseViewController.m; sourceTree = ""; }; 616591F611CA9BA200D6E256 /* OverlayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlayViewController.h; sourceTree = ""; }; 616591F711CA9BA200D6E256 /* OverlayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OverlayViewController.m; sourceTree = ""; }; 616591F811CA9BA200D6E256 /* InGameMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InGameMenuViewController.h; sourceTree = ""; }; @@ -428,8 +443,8 @@ 616591FF11CA9BA200D6E256 /* SingleSchemeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleSchemeViewController.m; sourceTree = ""; }; 6165920011CA9BA200D6E256 /* SingleTeamViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleTeamViewController.h; sourceTree = ""; }; 6165920111CA9BA200D6E256 /* SingleTeamViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleTeamViewController.m; sourceTree = ""; }; - 6165920211CA9BA200D6E256 /* SplitViewRootController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SplitViewRootController.h; sourceTree = ""; }; - 6165920311CA9BA200D6E256 /* SplitViewRootController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SplitViewRootController.m; sourceTree = ""; }; + 6165920211CA9BA200D6E256 /* SettingsContainerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsContainerViewController.h; sourceTree = ""; }; + 6165920311CA9BA200D6E256 /* SettingsContainerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsContainerViewController.m; sourceTree = ""; }; 6165920411CA9BA200D6E256 /* TeamConfigViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TeamConfigViewController.h; sourceTree = ""; }; 6165920511CA9BA200D6E256 /* TeamConfigViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TeamConfigViewController.m; sourceTree = ""; }; 6165920611CA9BA200D6E256 /* TeamSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TeamSettingsViewController.h; sourceTree = ""; }; @@ -440,25 +455,25 @@ 6165920B11CA9BA200D6E256 /* WeaponSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WeaponSettingsViewController.m; sourceTree = ""; }; 6165922311CA9BD500D6E256 /* CGPointUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = CGPointUtils.c; path = Classes/CGPointUtils.c; sourceTree = ""; }; 6165922411CA9BD500D6E256 /* CGPointUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CGPointUtils.h; path = Classes/CGPointUtils.h; sourceTree = ""; }; - 6165922511CA9BD500D6E256 /* CommodityFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommodityFunctions.h; path = Classes/CommodityFunctions.h; sourceTree = ""; }; - 6165922611CA9BD500D6E256 /* CommodityFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommodityFunctions.m; path = Classes/CommodityFunctions.m; sourceTree = ""; }; + 6165922511CA9BD500D6E256 /* HWUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HWUtils.h; path = Classes/HWUtils.h; sourceTree = ""; }; + 6165922611CA9BD500D6E256 /* HWUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HWUtils.m; path = Classes/HWUtils.m; sourceTree = ""; }; 6165922911CA9BD500D6E256 /* PascalImports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PascalImports.h; path = Classes/PascalImports.h; sourceTree = ""; }; 6165922A11CA9BD500D6E256 /* SquareButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SquareButtonView.h; path = Classes/SquareButtonView.h; sourceTree = ""; }; 6165922B11CA9BD500D6E256 /* SquareButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SquareButtonView.m; path = Classes/SquareButtonView.m; sourceTree = ""; }; 6165922C11CA9BD500D6E256 /* UIImageExtra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIImageExtra.h; path = Classes/UIImageExtra.h; sourceTree = ""; }; 6165922D11CA9BD500D6E256 /* UIImageExtra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIImageExtra.m; path = Classes/UIImageExtra.m; sourceTree = ""; }; - 6165924A11CA9CB400D6E256 /* GameConfigViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = GameConfigViewController.xib; path = Resources/GameConfigViewController.xib; sourceTree = SOURCE_ROOT; }; - 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainMenuViewController-iPad.xib"; path = "Resources/MainMenuViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; - 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainMenuViewController-iPhone.xib"; path = "Resources/MainMenuViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; - 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MapConfigViewController-iPad.xib"; path = "Resources/MapConfigViewController-iPad.xib"; sourceTree = SOURCE_ROOT; }; - 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MapConfigViewController-iPhone.xib"; path = "Resources/MapConfigViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; - 6165925011CA9CB400D6E256 /* OverlayViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = OverlayViewController.xib; path = Resources/OverlayViewController.xib; sourceTree = SOURCE_ROOT; }; + 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "GameConfigViewController-iPhone.xib"; sourceTree = ""; }; + 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MainMenuViewController-iPad.xib"; sourceTree = ""; }; + 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MainMenuViewController-iPhone.xib"; sourceTree = ""; }; + 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MapConfigViewController-iPad.xib"; sourceTree = ""; }; + 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MapConfigViewController-iPhone.xib"; sourceTree = ""; }; + 6165925011CA9CB400D6E256 /* OverlayViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OverlayViewController.xib; sourceTree = ""; }; 6165929C11CA9E2F00D6E256 /* HedgewarsAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HedgewarsAppDelegate.h; path = Classes/HedgewarsAppDelegate.h; sourceTree = ""; }; 6165929D11CA9E2F00D6E256 /* HedgewarsAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HedgewarsAppDelegate.m; path = Classes/HedgewarsAppDelegate.m; sourceTree = ""; }; 6167A6731391514600AA6D07 /* RestoreViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RestoreViewController.h; sourceTree = ""; }; 6167A6741391514600AA6D07 /* RestoreViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RestoreViewController.m; sourceTree = ""; }; - 6167A6751391514600AA6D07 /* RestoreViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "RestoreViewController-iPhone.xib"; path = "../Resources/RestoreViewController-iPhone.xib"; sourceTree = ""; }; - 6167A72C13919E6800AA6D07 /* RestoreViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "RestoreViewController-iPad.xib"; path = "../Resources/RestoreViewController-iPad.xib"; sourceTree = ""; }; + 6167A6751391514600AA6D07 /* RestoreViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "RestoreViewController-iPhone.xib"; sourceTree = ""; }; + 6167A72C13919E6800AA6D07 /* RestoreViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "RestoreViewController-iPad.xib"; sourceTree = ""; }; 6167C87314294727003DD50F /* surprise@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "surprise@2x.png"; path = "Resources/surprise@2x.png"; sourceTree = ""; }; 6167C88B14294738003DD50F /* denied@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "denied@2x.png"; path = "Resources/denied@2x.png"; sourceTree = ""; }; 6167C8EF1429502C003DD50F /* hedgehog.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = hedgehog.png; path = Resources/Icons/hedgehog.png; sourceTree = ""; }; @@ -528,7 +543,6 @@ 6179880C114AA34C00BA94A9 /* uTeams.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uTeams.pas; path = ../../hedgewars/uTeams.pas; sourceTree = SOURCE_ROOT; }; 6179880E114AA34C00BA94A9 /* uVisualGears.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uVisualGears.pas; path = ../../hedgewars/uVisualGears.pas; sourceTree = SOURCE_ROOT; }; 6179880F114AA34C00BA94A9 /* uWorld.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uWorld.pas; path = ../../hedgewars/uWorld.pas; sourceTree = SOURCE_ROOT; }; - 61798852114AA44900BA94A9 /* config.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = config.inc; path = ../../hedgewars/config.inc; sourceTree = SOURCE_ROOT; }; 617988D3114AAA3900BA94A9 /* SDLiPhoneOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDLiPhoneOS.xcodeproj; path = "../../../Library/SDL/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj"; sourceTree = SOURCE_ROOT; }; 61798934114AB25F00BA94A9 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 6179898B114AB3FA00BA94A9 /* SDL_mixer.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_mixer.xcodeproj; path = "../../../Library/SDL_mixer/Xcode-iPhoneOS/SDL_mixer.xcodeproj"; sourceTree = SOURCE_ROOT; }; @@ -536,13 +550,15 @@ 61798A5E114AE08600BA94A9 /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Data; path = ../../../trunk/project_files/HedgewarsMobile/Data; sourceTree = ""; }; 6183D83C11E2BCE200A88903 /* Default-ipad-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-ipad-Landscape.png"; path = "Resources/Icons/Default-ipad-Landscape.png"; sourceTree = ""; }; 6183D83D11E2BCE200A88903 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = Resources/Icons/Default.png; sourceTree = ""; }; - 61842B23122B619D0096E335 /* HelpPageInGameViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "HelpPageInGameViewController-iPad.xib"; path = "../Resources/HelpPageInGameViewController-iPad.xib"; sourceTree = ""; }; + 61842B23122B619D0096E335 /* HelpPageInGameViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageInGameViewController-iPad.xib"; sourceTree = ""; }; 61842B3D122B65BD0096E335 /* helpabove.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpabove.png; path = Resources/Overlay/helpabove.png; sourceTree = ""; }; 61842B3F122B66280096E335 /* helpleft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = helpleft.png; path = Resources/Overlay/helpleft.png; sourceTree = ""; }; - 6187AEA5120781B900B31A27 /* Settings */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Settings; path = Resources/Settings; sourceTree = ""; }; 618899811299516000D55FD6 /* title@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "title@2x~iphone.png"; path = "Resources/Frontend/title@2x~iphone.png"; sourceTree = ""; }; 61889984129995B500D55FD6 /* title~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "title~ipad.png"; path = "Resources/Frontend/title~ipad.png"; sourceTree = ""; }; 618E27B612A2C30700C20EF0 /* SDL_net.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL_net.xcodeproj; path = "../../../Library/SDL_net/Xcode-iPhoneOS/SDL_net.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 61915D58143A4E2C00299991 /* MissionTrainingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MissionTrainingViewController.h; sourceTree = ""; }; + 61915D59143A4E2C00299991 /* MissionTrainingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MissionTrainingViewController.m; sourceTree = ""; }; + 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MissionTrainingViewController-iPhone.xib"; sourceTree = ""; }; 619598181364BCD200B429B6 /* Tremor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Tremor.xcodeproj; path = ../../misc/libtremor/Xcode/Tremor.xcodeproj; sourceTree = SOURCE_ROOT; }; 6195993F1364C82B00B429B6 /* Lua.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Lua.xcodeproj; path = ../../misc/liblua/Xcode/Lua.xcodeproj; sourceTree = SOURCE_ROOT; }; 619599BA1364E65900B429B6 /* Freetype.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Freetype.xcodeproj; path = "../../misc/libfreetype/Xcode-iPhoneOS/Freetype.xcodeproj"; sourceTree = SOURCE_ROOT; }; @@ -573,18 +589,21 @@ 61AC067312B2E32D000B52A2 /* Appirater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Appirater.m; path = Classes/Appirater.m; sourceTree = ""; }; 61B7A33612CC21080086B604 /* StatsPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatsPageViewController.h; sourceTree = ""; }; 61B7A33712CC21080086B604 /* StatsPageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatsPageViewController.m; sourceTree = ""; }; + 61B9A86714423A9D001541C1 /* GameConfigViewController-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "GameConfigViewController-iPad.xib"; sourceTree = ""; }; 61C079E211F35A300072BF46 /* EditableCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditableCellView.h; path = Classes/EditableCellView.h; sourceTree = ""; }; 61C079E311F35A300072BF46 /* EditableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EditableCellView.m; path = Classes/EditableCellView.m; sourceTree = ""; }; 61C28D3D142D380400DA16C2 /* AudioManagerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioManagerController.h; path = Classes/AudioManagerController.h; sourceTree = ""; }; 61C28D3E142D380400DA16C2 /* AudioManagerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AudioManagerController.m; path = Classes/AudioManagerController.m; sourceTree = ""; }; 61CADE321402EE290030C3EB /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; + 61D0BDF71457508C0011A899 /* ExtraCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtraCategories.h; sourceTree = ""; }; + 61D0BDF81457508C0011A899 /* ExtraCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtraCategories.m; sourceTree = ""; }; 61D2059F127CDD1100ABD83E /* ObjcExports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjcExports.h; path = Classes/ObjcExports.h; sourceTree = ""; }; 61D205A0127CDD1100ABD83E /* ObjcExports.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ObjcExports.m; path = Classes/ObjcExports.m; sourceTree = ""; }; 61D3D2A41290E03A003CE7C3 /* irc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = irc.png; path = Resources/Icons/irc.png; sourceTree = ""; }; 61DE8F201257EB1100B80214 /* AmmoMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AmmoMenuViewController.h; sourceTree = ""; }; 61DE8F211257EB1100B80214 /* AmmoMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AmmoMenuViewController.m; sourceTree = ""; }; - 61DF0EDB1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "HelpPageLobbyViewController-iPhone.xib"; path = "../Resources/HelpPageLobbyViewController-iPhone.xib"; sourceTree = ""; }; - 61DF0F201284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "HelpPageInGameViewController-iPhone.xib"; path = "Resources/HelpPageInGameViewController-iPhone.xib"; sourceTree = SOURCE_ROOT; }; + 61DF0EDB1284DF2300F3F10B /* HelpPageLobbyViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageLobbyViewController-iPhone.xib"; sourceTree = ""; }; + 61DF0F201284F72A00F3F10B /* HelpPageInGameViewController-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "HelpPageInGameViewController-iPhone.xib"; sourceTree = ""; }; 61E1F4F711D004240016A5AA /* adler32.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = adler32.pas; path = ../../hedgewars/adler32.pas; sourceTree = SOURCE_ROOT; }; 61E2E12C12BAAEE30051B659 /* ServerSetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServerSetup.h; sourceTree = ""; }; 61E2E12D12BAAEE30051B659 /* ServerSetup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ServerSetup.m; sourceTree = ""; }; @@ -603,7 +622,7 @@ 61EF920B11DF57AC003441C4 /* joyButtonForwardJump.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = joyButtonForwardJump.png; path = Resources/Overlay/joyButtonForwardJump.png; sourceTree = ""; }; 61F2E7CB1205EDE0005734F7 /* AboutViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutViewController.h; sourceTree = ""; }; 61F2E7CC1205EDE0005734F7 /* AboutViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutViewController.m; sourceTree = ""; }; - 61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = AboutViewController.xib; path = ../Resources/AboutViewController.xib; sourceTree = ""; }; + 61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AboutViewController.xib; sourceTree = ""; }; 61F2E7EB12060E31005734F7 /* checkbox.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = checkbox.png; path = Resources/Icons/checkbox.png; sourceTree = ""; }; 61F544C512AF1748007FD913 /* HoldTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HoldTableViewCell.h; path = Classes/HoldTableViewCell.h; sourceTree = ""; }; 61F544C612AF1748007FD913 /* HoldTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HoldTableViewCell.m; path = Classes/HoldTableViewCell.m; sourceTree = ""; }; @@ -657,14 +676,14 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - 6163EE4D11CC247D001C0453 /* Game Config */, - 6163EE4C11CC2478001C0453 /* Settings Pages */, - 611D9BF312497B7700008271 /* Other Controllers */, + 6163EE4D11CC247D001C0453 /* Game Configuration */, + 6163EE4C11CC2478001C0453 /* Settings Page */, + 611D9BF312497B7700008271 /* Satellite Controllers */, 6163EE6C11CC253F001C0453 /* Overlay */, 616591F011CA9BA200D6E256 /* MainMenuViewController.h */, 616591F111CA9BA200D6E256 /* MainMenuViewController.m */, + 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */, 6165924B11CA9CB400D6E256 /* MainMenuViewController-iPad.xib */, - 6165924C11CA9CB400D6E256 /* MainMenuViewController-iPhone.xib */, 61EDB5AE135B3F97009B29A6 /* GameInterfaceBridge.h */, 61EDB5AF135B3F97009B29A6 /* GameInterfaceBridge.m */, 616591E611CA9BA200D6E256 /* EngineProtocolNetwork.h */, @@ -702,26 +721,19 @@ 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( + 61F8535314578999002CA294 /* Helpers */, + 61641FE21437CD8F006E049C /* Headers */, 61DE91561258B76800B80214 /* Custom UIs */, 61AC067212B2E32D000B52A2 /* Appirater.h */, 61AC067312B2E32D000B52A2 /* Appirater.m */, - 61C28D3D142D380400DA16C2 /* AudioManagerController.h */, - 61C28D3E142D380400DA16C2 /* AudioManagerController.m */, 6165929C11CA9E2F00D6E256 /* HedgewarsAppDelegate.h */, 6165929D11CA9E2F00D6E256 /* HedgewarsAppDelegate.m */, - 32CA4F630368D1EE00C91783 /* Hedgewars_Prefix.pch */, - 61A97F0E136F675A00DD9878 /* hwconsts.h */, - 6165922911CA9BD500D6E256 /* PascalImports.h */, 61D2059F127CDD1100ABD83E /* ObjcExports.h */, 61D205A0127CDD1100ABD83E /* ObjcExports.m */, - 6165922511CA9BD500D6E256 /* CommodityFunctions.h */, - 6165922611CA9BD500D6E256 /* CommodityFunctions.m */, 61006F93128DE31F00EBA7F7 /* CreationChamber.h */, 61006F94128DE31F00EBA7F7 /* CreationChamber.m */, 6165922411CA9BD500D6E256 /* CGPointUtils.h */, 6165922311CA9BD500D6E256 /* CGPointUtils.c */, - 6165922C11CA9BD500D6E256 /* UIImageExtra.h */, - 6165922D11CA9BD500D6E256 /* UIImageExtra.m */, ); name = "Other Sources"; sourceTree = ""; @@ -744,8 +756,10 @@ 61F903FA11DF58680068B24D /* Frontend */, 6179936611501D1E00BA94A9 /* Overlay */, 61798A5E114AE08600BA94A9 /* Data */, - 6187AEA5120781B900B31A27 /* Settings */, 8D1107310486CEB800E47090 /* Info.plist */, + 610782931440EE5C00645B29 /* basicFlags.plist */, + 610782941440EE5C00645B29 /* credits.plist */, + 610782951440EE5C00645B29 /* gameMods.plist */, ); name = Resources; sourceTree = ""; @@ -776,7 +790,7 @@ name = Frameworks; sourceTree = ""; }; - 611D9BF312497B7700008271 /* Other Controllers */ = { + 611D9BF312497B7700008271 /* Satellite Controllers */ = { isa = PBXGroup; children = ( 61F2E7CB1205EDE0005734F7 /* AboutViewController.h */, @@ -791,8 +805,12 @@ 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */, 61B7A33612CC21080086B604 /* StatsPageViewController.h */, 61B7A33712CC21080086B604 /* StatsPageViewController.m */, + 61915D58143A4E2C00299991 /* MissionTrainingViewController.h */, + 61915D59143A4E2C00299991 /* MissionTrainingViewController.m */, + 61915D5A143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib */, + 61077E86143FB09800645B29 /* MissionTrainingViewController-iPad.xib */, ); - name = "Other Controllers"; + name = "Satellite Controllers"; sourceTree = ""; }; 612CABCA1391D3D1005E9596 /* Sounds */ = { @@ -806,26 +824,27 @@ name = Sounds; sourceTree = ""; }; - 6163EE4C11CC2478001C0453 /* Settings Pages */ = { + 6163EE4C11CC2478001C0453 /* Settings Page */ = { isa = PBXGroup; children = ( - 6165920211CA9BA200D6E256 /* SplitViewRootController.h */, - 6165920311CA9BA200D6E256 /* SplitViewRootController.m */, - 616591F411CA9BA200D6E256 /* MasterViewController.h */, - 616591F511CA9BA200D6E256 /* MasterViewController.m */, + 6165920211CA9BA200D6E256 /* SettingsContainerViewController.h */, + 6165920311CA9BA200D6E256 /* SettingsContainerViewController.m */, + 616591F411CA9BA200D6E256 /* SettingsBaseViewController.h */, + 616591F511CA9BA200D6E256 /* SettingsBaseViewController.m */, 6163EE4E11CC248D001C0453 /* First Level */, 6163EE4F11CC2497001C0453 /* Second Level */, 6163EE5011CC24A1001C0453 /* Third Level */, ); - name = "Settings Pages"; + name = "Settings Page"; sourceTree = ""; }; - 6163EE4D11CC247D001C0453 /* Game Config */ = { + 6163EE4D11CC247D001C0453 /* Game Configuration */ = { isa = PBXGroup; children = ( 616591E411CA9BA200D6E256 /* GameConfigViewController.h */, 616591E511CA9BA200D6E256 /* GameConfigViewController.m */, - 6165924A11CA9CB400D6E256 /* GameConfigViewController.xib */, + 61B9A86714423A9D001541C1 /* GameConfigViewController-iPad.xib */, + 6165924A11CA9CB400D6E256 /* GameConfigViewController-iPhone.xib */, 6165920411CA9BA200D6E256 /* TeamConfigViewController.h */, 6165920511CA9BA200D6E256 /* TeamConfigViewController.m */, 616591FC11CA9BA200D6E256 /* SchemeWeaponConfigViewController.h */, @@ -835,7 +854,7 @@ 6165924D11CA9CB400D6E256 /* MapConfigViewController-iPad.xib */, 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */, ); - name = "Game Config"; + name = "Game Configuration"; sourceTree = ""; }; 6163EE4E11CC248D001C0453 /* First Level */ = { @@ -907,10 +926,21 @@ name = Overlay; sourceTree = ""; }; + 61641FE21437CD8F006E049C /* Headers */ = { + isa = PBXGroup; + children = ( + 61641FE31437CDAA006E049C /* DefinesAndMacros.h */, + 32CA4F630368D1EE00C91783 /* Hedgewars_Prefix.pch */, + 61A97F0E136F675A00DD9878 /* hwconsts.h */, + 6165922911CA9BD500D6E256 /* PascalImports.h */, + ); + name = Headers; + sourceTree = ""; + }; 61798892114AA56300BA94A9 /* inc */ = { isa = PBXGroup; children = ( - 61798852114AA44900BA94A9 /* config.inc */, + 61589C5A144B4322007BFAA4 /* config.inc */, 617987EB114AA34C00BA94A9 /* options.inc */, 617987E4114AA34C00BA94A9 /* GSHandlers.inc */, 617987E5114AA34C00BA94A9 /* HHHandlers.inc */, @@ -1071,6 +1101,21 @@ name = Icons; sourceTree = ""; }; + 61F8535314578999002CA294 /* Helpers */ = { + isa = PBXGroup; + children = ( + 61C28D3D142D380400DA16C2 /* AudioManagerController.h */, + 61C28D3E142D380400DA16C2 /* AudioManagerController.m */, + 61D0BDF71457508C0011A899 /* ExtraCategories.h */, + 61D0BDF81457508C0011A899 /* ExtraCategories.m */, + 6165922511CA9BD500D6E256 /* HWUtils.h */, + 6165922611CA9BD500D6E256 /* HWUtils.m */, + 6165922C11CA9BD500D6E256 /* UIImageExtra.h */, + 6165922D11CA9BD500D6E256 /* UIImageExtra.m */, + ); + name = Helpers; + sourceTree = ""; + }; 61F903FA11DF58680068B24D /* Frontend */ = { isa = PBXGroup; children = ( @@ -1082,6 +1127,7 @@ 615AD9E8120764CA00F2FF04 /* backButton.png */, 6172FED31298CE6600D73365 /* backButton@2x.png */, 615AD96112073B4D00F2FF04 /* startGameButton.png */, + 61078029143FCCC800645B29 /* startGameButton@2x.png */, 615FEADE12A2A6640098EE92 /* localplayButton@2x~iphone.png */, 615FEAE012A2A6640098EE92 /* localplayButton~iphone.png */, 615FEADF12A2A6640098EE92 /* localplayButton~ipad.png */, @@ -1333,7 +1379,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 61536DF411CEAE7100D87A7E /* GameConfigViewController.xib in Resources */, + 61536DF411CEAE7100D87A7E /* GameConfigViewController-iPhone.xib in Resources */, 61370653117B1D50004EE44A /* Entitlements-Distribution.plist in Resources */, 611E12FF117BBBDA0044B62F /* Entitlements-Development.plist in Resources */, 6165925311CA9CB400D6E256 /* MainMenuViewController-iPad.xib in Resources */, @@ -1362,7 +1408,6 @@ 615AD96212073B4D00F2FF04 /* startGameButton.png in Resources */, 615AD9E9120764CA00F2FF04 /* backButton.png in Resources */, 615AD9EB1207654E00F2FF04 /* helpButton.png in Resources */, - 6187AEBD120781B900B31A27 /* Settings in Resources */, 611EE974122A9C4100DF6938 /* clickSound.wav in Resources */, 611EE9DA122AA10A00DF6938 /* selSound.wav in Resources */, 611EEAEF122B2A4D00DF6938 /* HelpPageLobbyViewController-iPad.xib in Resources */, @@ -1445,6 +1490,13 @@ 6167CA42142A6ED7003DD50F /* bot5@2x.png in Resources */, 6167CB48142A8769003DD50F /* basehat-hedgehog.png in Resources */, 6167CB49142A8769003DD50F /* basehat-hedgehog@2x.png in Resources */, + 61915D5C143A4E2C00299991 /* MissionTrainingViewController-iPhone.xib in Resources */, + 61077E87143FB09800645B29 /* MissionTrainingViewController-iPad.xib in Resources */, + 6107802A143FCCC800645B29 /* startGameButton@2x.png in Resources */, + 610782961440EE5C00645B29 /* basicFlags.plist in Resources */, + 610782971440EE5C00645B29 /* credits.plist in Resources */, + 610782981440EE5C00645B29 /* gameMods.plist in Resources */, + 61B9A86814423A9D001541C1 /* GameConfigViewController-iPad.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1462,7 +1514,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/../../hedgewars/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Icons\ncp ${PROJECT_DIR}/../../QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png ${PROJECT_DIR}/Data/Graphics/Icons/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n#copy mono audio\ncp -R ${PROJECT_DIR}/Audio/* ${PROJECT_DIR}/Data/\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`; do if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]]; then mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/; fi; done;\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n#remove cfg files since we have plists\nfind ${PROJECT_DIR}/Data/Scripts -name *.cfg -delete\nif ((`ls ${PROJECT_DIR}/Data/Scripts/Multiplayer/*.lua|wc -l` >= `ls ${PROJECT_DIR}/Data/Scripts/plist/*.plist|wc -l` ))\nthen\necho \"${PROJECT_DIR}/Data/Scripts/Multiplayer/Normal.plist:0: warning, missing plist implementation of a Multiplayer script file\"\nfi\n\n#reduce the number of flakes for City\nsed -ie 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\""; + shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Icons\ncp ${PROJECT_DIR}/../../QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png ${PROJECT_DIR}/Data/Graphics/Icons/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n#copy mono audio\ncp -R ${PROJECT_DIR}/Audio/* ${PROJECT_DIR}/Data/\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`; do if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]]; then mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/; fi; done;\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n#remove cfg files since we have plists\nfind ${PROJECT_DIR}/Data/Scripts -name *.cfg -delete\nif ((`ls ${PROJECT_DIR}/Data/Scripts/Multiplayer/*.lua|wc -l` >= `ls ${PROJECT_DIR}/Data/Scripts/plist/*.plist|wc -l` ))\nthen\necho \"${PROJECT_DIR}/Data/Scripts/Multiplayer/Normal.plist:0: warning, missing plist implementation of a Multiplayer script file\"\nfi\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n#cleanup missions/trainings info\nsed -i -e -n '/\"/p' ${PROJECT_DIR}/Data/Locale/missions_en.txt\n\necho \"Done\""; showEnvVarsInLog = 0; }; 9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = { @@ -1545,20 +1597,20 @@ 6165921411CA9BA200D6E256 /* LevelViewController.m in Sources */, 6165921511CA9BA200D6E256 /* MainMenuViewController.m in Sources */, 6165921611CA9BA200D6E256 /* MapConfigViewController.m in Sources */, - 6165921711CA9BA200D6E256 /* MasterViewController.m in Sources */, + 6165921711CA9BA200D6E256 /* SettingsBaseViewController.m in Sources */, 6165921811CA9BA200D6E256 /* OverlayViewController.m in Sources */, 6165921911CA9BA200D6E256 /* InGameMenuViewController.m in Sources */, 6165921A11CA9BA200D6E256 /* SchemeSettingsViewController.m in Sources */, 6165921B11CA9BA200D6E256 /* SchemeWeaponConfigViewController.m in Sources */, 6165921C11CA9BA200D6E256 /* SingleSchemeViewController.m in Sources */, 6165921D11CA9BA200D6E256 /* SingleTeamViewController.m in Sources */, - 6165921E11CA9BA200D6E256 /* SplitViewRootController.m in Sources */, + 6165921E11CA9BA200D6E256 /* SettingsContainerViewController.m in Sources */, 6165921F11CA9BA200D6E256 /* TeamConfigViewController.m in Sources */, 6165922011CA9BA200D6E256 /* TeamSettingsViewController.m in Sources */, 6165922111CA9BA200D6E256 /* VoicesViewController.m in Sources */, 6165922211CA9BA200D6E256 /* WeaponSettingsViewController.m in Sources */, 6165922E11CA9BD500D6E256 /* CGPointUtils.c in Sources */, - 6165922F11CA9BD500D6E256 /* CommodityFunctions.m in Sources */, + 6165922F11CA9BD500D6E256 /* HWUtils.m in Sources */, 6165923111CA9BD500D6E256 /* SquareButtonView.m in Sources */, 6165923211CA9BD500D6E256 /* UIImageExtra.m in Sources */, 6165929E11CA9E2F00D6E256 /* HedgewarsAppDelegate.m in Sources */, @@ -1599,6 +1651,8 @@ 6167A6761391514600AA6D07 /* RestoreViewController.m in Sources */, 61C28D3F142D380400DA16C2 /* AudioManagerController.m in Sources */, 611D7A50142FDCD3006E0798 /* uTouch.pas in Sources */, + 61915D5B143A4E2C00299991 /* MissionTrainingViewController.m in Sources */, + 61D0BDF91457508C0011A899 /* ExtraCategories.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1644,7 +1698,7 @@ ARCHS = "$(ARCHS_STANDARD_32_BIT)"; CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix"; + FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix -Fi${PROJECT_DIR}"; FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.7.1; FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas"; FPC_RTL_UNITS_BASE = /usr/local/lib/fpc; @@ -1667,7 +1721,7 @@ "\"$(SRCROOT)/../../../Library/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL_mixer/\"", ); - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; LLVM_LTO = NO; ONLY_ACTIVE_ARCH = NO; OTHER_CODE_SIGN_FLAGS = ""; @@ -1727,7 +1781,7 @@ CODE_SIGN_ENTITLEMENTS = "Entitlements-Distribution.plist"; CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix"; + FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix -Fi${PROJECT_DIR}"; FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.7.1; FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas"; FPC_RTL_UNITS_BASE = /usr/local/lib/fpc; @@ -1750,7 +1804,7 @@ "\"$(SRCROOT)/../../../Library/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL_mixer/\"", ); - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "-lz", @@ -1852,7 +1906,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix"; + FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix -Fi${PROJECT_DIR}"; FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.5.1; FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas"; FPC_RTL_UNITS_BASE = /usr/local/lib/fpc; @@ -1875,7 +1929,7 @@ "\"$(SRCROOT)/../../../Library/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL_mixer/\"", ); - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "-lz", @@ -1899,7 +1953,7 @@ CODE_SIGN_ENTITLEMENTS = "Entitlements-Development.plist"; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix"; + FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix -Fi${PROJECT_DIR}"; FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.7.1; FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas"; FPC_RTL_UNITS_BASE = /usr/local/lib/fpc; @@ -1922,7 +1976,7 @@ "\"$(SRCROOT)/../../../Library/SDL_net/\"", "\"$(SRCROOT)/../../../Library/SDL_mixer/\"", ); - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; LLVM_LTO = NO; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Hedgewars_Prefix.pch --- a/project_files/HedgewarsMobile/Hedgewars_Prefix.pch Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/HedgewarsMobile/Hedgewars_Prefix.pch Fri Oct 28 18:33:38 2011 +0200 @@ -14,50 +14,21 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * File created on 25/04/2010. */ -// some macros by http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ -// and http://blog.coriolis.ch/2009/01/05/macros-for-xcode/ - #ifdef __OBJC__ #import #import #import #import "PascalImports.h" #import "UIImageExtra.h" -#import "CommodityFunctions.h" +#import "DefinesAndMacros.h" #import "HedgewarsAppDelegate.h" #import "AudioManagerController.h" +#import "HWUtils.h" +#import "ExtraCategories.h" #endif - -#ifdef DEBUG - #define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) - #define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__] - #define releaseAndNil(x) [x release] -#else - #define DLog(...) do { } while (0) - #ifndef NS_BLOCK_ASSERTIONS - #define NS_BLOCK_ASSERTIONS - #endif - #define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) - #define releaseAndNil(x) [x release], x = nil -#endif - - -#define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0) -#define rotationManager(x) (x == UIInterfaceOrientationLandscapeRight) || (x == UIInterfaceOrientationLandscapeLeft) - -#define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; -#define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); - - -#if !__IPHONE_3_2 -typedef enum { - UIUserInterfaceIdiomPhone, // iPhone and iPod touch style UI - UIUserInterfaceIdiomPad, // iPad style UI -} UIUserInterfaceIdiom; -#define UI_USER_INTERFACE_IDIOM() UIUserInterfaceIdiomPhone -#define UIPopoverController id -#endif // ifndef __IPHONE_3_2 diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/AboutViewController.xib --- a/project_files/HedgewarsMobile/Resources/AboutViewController.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,658 +0,0 @@ - - - - 1024 - 10F569 - 804 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 123 - - - YES - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 290 - - YES - - - 292 - {{127, 7}, {289, 30}} - - NO - IBIPadFramework - 2 - 5 - 0 - - YES - Code - Art - Sound - Locale - Special - - - YES - - - - - - - - YES - - - - - - - - YES - {0, 0} - {0, 0} - {0, 0} - {0, 0} - {0, 0} - - - YES - - - - - - - - - {543, 44} - - IBIPadFramework - - YES - - - - IBIPadFramework - 1 - - 0 - - - IBIPadFramework - - - - - - 274 - {{0, 44}, {543, 577}} - - - 1 - MCAwIDAgMAA - - YES - IBIPadFramework - YES - 1 - 2 - 0 - YES - 44 - 10 - 10 - - - {543, 621} - - 3 - MQA - - NO - NO - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - - 8 - - - - dataSource - - - - 12 - - - - delegate - - - - 13 - - - - tableView - - - - 14 - - - - segmentedControlChanged: - - - 13 - - 15 - - - - segmentedControl - - - - 16 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - - 5 - - - YES - - - - - - 6 - - - YES - - - - - - - 7 - - - - - 10 - - - - - 11 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 10.IBPluginDependency - 11.IBPluginDependency - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 5.IBPluginDependency - 6.IBPluginDependency - 7.IBPluginDependency - - - YES - AboutViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{376, 170}, {543, 621}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 16 - - - - YES - - AboutViewController - UIViewController - - YES - - YES - buttonPressed: - segmentedControlChanged: - - - YES - id - id - - - - YES - - YES - buttonPressed: - segmentedControlChanged: - - - YES - - buttonPressed: - id - - - segmentedControlChanged: - id - - - - - YES - - YES - segmentedControl - tableView - - - YES - UISegmentedControl - UITableView - - - - YES - - YES - segmentedControl - tableView - - - YES - - segmentedControl - UISegmentedControl - - - tableView - UITableView - - - - - IBProjectSource - Classes/AboutViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UINavigationBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UINavigationBar.h - - - - UINavigationItem - NSObject - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISegmentedControl - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISegmentedControl.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - 123 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/Frontend/helpButton.png Binary file project_files/HedgewarsMobile/Resources/Frontend/helpButton.png has changed diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/Frontend/startGameButton@2x.png Binary file project_files/HedgewarsMobile/Resources/Frontend/startGameButton@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/GameConfigViewController.xib --- a/project_files/HedgewarsMobile/Resources/GameConfigViewController.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,608 +0,0 @@ - - - - 1056 - 10K540 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 266 - - YES - - - 292 - {{96, 8}, {270, 30}} - - NO - 12345 - IBCocoaTouchFramework - 2 - 4 - 0 - - YES - Map - Teams - Details - Help - - - YES - - - - - - - YES - - - - - - - YES - {0, 0} - {0, 0} - {0, 0} - {0, 0} - - - YES - - - - - - - 1 - MC42IDAuNiAwLjYAA - - - - {{0, 276}, {480, 44}} - - NO - NO - IBCocoaTouchFramework - 1 - - YES - - Back - IBCocoaTouchFramework - 1 - - - - IBCocoaTouchFramework - - 5 - - - IBCocoaTouchFramework - - - - - IBCocoaTouchFramework - - 5 - - - 1 - Start - IBCocoaTouchFramework - 68 - 2 - - - - - - {480, 320} - - - 3 - MQA - - NO - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - - 17 - - - - buttonPressed: - - - - 23 - - - - segmentPressed: - - - 13 - - 29 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - 15 - - - YES - - - - - - - - - - 16 - - - - - 18 - - - - - 19 - - - - - 21 - - - YES - - - - - - 20 - - - - - 22 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 15.IBPluginDependency - 15.IBViewBoundsToFrameTransform - 16.IBPluginDependency - 18.IBPluginDependency - 19.IBPluginDependency - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 20.IBPluginDependency - 22.IBPluginDependency - - - YES - GameConfigViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAw58AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{131, 321}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 29 - - - - YES - - GameConfigViewController - UIViewController - - YES - - YES - buttonPressed: - segmentPressed: - - - YES - id - id - - - - YES - - YES - buttonPressed: - segmentPressed: - - - YES - - buttonPressed: - id - - - segmentPressed: - id - - - - - IBProjectSource - Classes/GameConfigViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISegmentedControl - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISegmentedControl.h - - - - UIToolbar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIToolbar.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/HelpPageInGameViewController-iPad.xib --- a/project_files/HedgewarsMobile/Resources/HelpPageInGameViewController-iPad.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,889 +0,0 @@ - - - - 1024 - 10F569 - 788 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 117 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 292 - {{0, -1}, {1024, 768}} - - NO - NO - IBIPadFramework - - NSImage - helpingame.png - - - - - 292 - {{79, 473}, {150, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Direction buttons - - Helvetica-Bold - 18 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - - - - 292 - {{79, 491}, {203, 85}} - - NO - YES - 7 - NO - IBIPadFramework - With these buttons you can move your hog, aim and control certain weapons. - - Helvetica - 16 - 16 - - - - 1 - 10 - 0 - - - - 292 - {{53, 97}, {186, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Timer - - - - 1 - 10 - - - - 292 - {{53, 118}, {187, 43}} - - NO - YES - 7 - NO - IBIPadFramework - Don't let your turn time run out! - - - - 1 - 10 - 0 - - - - 292 - {{780, 248}, {240, 128}} - - NO - NO - IBIPadFramework - - NSImage - helpright.png - - - - - 292 - {{790, 256}, {109, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Ammo Menu - - - - 1 - 10 - - - - 292 - {{790, 282}, {214, 84}} - - NO - YES - 7 - NO - IBIPadFramework - This menu contains all the weapons you can use. Drag your finger on a weapon for more details on what it does! - - - - 1 - 10 - 0 - - - - 292 - {{780, 97}, {186, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Pause / Open ammos - - - - 1 - 10 - - - - 292 - {{782, 118}, {187, 43}} - - NO - YES - 7 - NO - IBIPadFramework - Tap to pause or open the ammo menu. - - - - 1 - 10 - 0 - - - - 292 - {{418, 73}, {186, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Wind bar - - - - 1 - 10 - - - - 292 - {{418, 89}, {191, 63}} - - NO - YES - 7 - NO - IBIPadFramework - Some weapons are affected by the wind and their direction may shift. - - - - 1 - 10 - 0 - - - - 292 - {{447, 573}, {203, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Teams flags and health - - - - 1 - 10 - - - - 292 - {{447, 592}, {203, 85}} - - NO - YES - 7 - NO - IBIPadFramework - These bars report the team name, the team flags and the global health status of every hog. - - - - 1 - 10 - 4 - - - - 292 - {{741, 501}, {135, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Joypad buttons - - - - 1 - 10 - - - - 292 - {{741, 520}, {211, 85}} - - NO - YES - 7 - NO - IBIPadFramework - Press X to jump forward, Y to jump backwards (double tap to jump twice) and Missile to attack or use items. - - - - 1 - 10 - 0 - - - - 292 - {{67, 238}, {240, 128}} - - NO - NO - IBIPadFramework - - NSImage - helpplain.png - - - - - 292 - {{72, 246}, {229, 22}} - - NO - YES - 7 - NO - IBIPadFramework - Tap to return to game - - - - 1 - 10 - 1 - - - - 292 - {{72, 268}, {229, 87}} - - NO - YES - 7 - NO - IBIPadFramework - Pan to move camera, pinch to zoom, double tap to center hog, and a single touch to interact with weapons and much more! - - - - 1 - 10 - 0 - - - {1024, 768} - - - 3 - MCAwLjQAA - - NO - NO - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - dismiss - - - 7 - - 16 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - - - - - - - - - - - - - - - - - - - 5 - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 9 - - - - - 10 - - - - - 11 - - - - - 12 - - - - - 13 - - - - - 14 - - - - - 17 - - - - - 18 - - - - - 21 - - - - - 22 - - - - - 23 - - - - - 24 - - - - - 25 - - - - - 26 - - - - - 27 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 10.IBPluginDependency - 11.IBPluginDependency - 12.IBPluginDependency - 13.IBPluginDependency - 14.IBPluginDependency - 17.IBPluginDependency - 18.IBPluginDependency - 2.CustomClassName - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 21.IBPluginDependency - 22.IBPluginDependency - 23.IBPluginDependency - 24.IBPluginDependency - 25.IBPluginDependency - 26.IBPluginDependency - 27.IBPluginDependency - 5.IBPluginDependency - 6.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - 9.IBPluginDependency - - - YES - HelpPageViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIControl - {{288, 355}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 27 - - - - YES - - HelpPageViewController - UIViewController - - dismiss - id - - - dismiss - - dismiss - id - - - - IBProjectSource - Classes/HelpPageViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - helpingame.png - helpplain.png - helpright.png - - - YES - {1024, 768} - {296, 138} - {308, 144} - - - 117 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/HelpPageInGameViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Resources/HelpPageInGameViewController-iPhone.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1014 +0,0 @@ - - - - 1056 - 10H574 - 823 - 1038.35 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 274 - - YES - - - 292 - {{20, 283}, {150, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Direction buttons - - Helvetica-Bold - 18 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - - - - 292 - {{20, 292}, {203, 85}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - With these buttons you can move your hog, aim and control certain weapons. - - Helvetica - 16 - 16 - - - - 1 - 10 - 0 - - - - 292 - {{20, 13}, {186, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Timer - - - - 1 - 10 - - - - 292 - {{20, 34}, {187, 43}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Don't let your turn time run out! - - - - 1 - 10 - 0 - - - - 292 - {{217, 308}, {243, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Touch interface - - - - 1 - 10 - 2 - - - - 292 - {{231, 328}, {229, 87}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Pan to move camera, pinch to zoom, double tap to center hog, and a single touch to interact with weapons and much more! - - - - 1 - 10 - 0 - 2 - - - - 292 - {{20, 85}, {186, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Wind bar - - - - 1 - 10 - - - - 292 - {{20, 101}, {191, 63}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Some weapons are affected by the wind and their direction may shift. - - - - 1 - 10 - 0 - - - - 292 - {{20, 172}, {203, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Teams flags and health - - - - 1 - 10 - - - - 292 - {{20, 191}, {203, 85}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - These bars report the team name, the team flags and the global health status of every hog. - - - - 1 - 10 - 4 - - - - 292 - {{274, 13}, {186, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Pause / Open ammos - - - - 1 - 10 - 2 - - - - 292 - {{273, 35}, {187, 43}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Tap to pause or open the ammo menu. - - - - 1 - 10 - 0 - 2 - - - - 292 - {{351, 82}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Ammo Menu - - - - 1 - 10 - 2 - - - - 292 - {{246, 105}, {214, 84}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - This menu contains all the weapons you can use. Drag your finger on a weapon for more details on what it does! - - - - 1 - 10 - 0 - 2 - - - - 292 - {{325, 197}, {135, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Joypad buttons - - - - 1 - 10 - 2 - - - - 292 - {{249, 217}, {211, 85}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Press X to jump forward, Y to jump backwards (double tap to jump twice) and Missile to attack or use items. - - - - 1 - 10 - 0 - 2 - - - {{-5, 44}, {489, 332}} - - YES - YES - 1 - IBCocoaTouchFramework - - - - 290 - {{-1, 0}, {481, 44}} - - IBCocoaTouchFramework - - YES - - - Help page - - Back - IBCocoaTouchFramework - 1 - - - IBCocoaTouchFramework - - - - - {480, 320} - - - 2 - MC45OTYwNzg0OTEyIDAuOTg4MjM1MzU0NCAxAA - - NO - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - dismiss - - - - 141 - - - - scrollView - - - - 142 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - - 118 - - - YES - - - - - - 121 - - - YES - - - - - - - - - - - - - - - - - - - - - 122 - - - - - 124 - - - - - 125 - - - - - 126 - - - - - 127 - - - - - 128 - - - - - 129 - - - - - 130 - - - - - 131 - - - - - 132 - - - - - 133 - - - - - 134 - - - - - 135 - - - - - 136 - - - - - 137 - - - - - 138 - - - - - 119 - - - YES - - - - - - 140 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 118.IBPluginDependency - 118.IBViewBoundsToFrameTransform - 119.IBPluginDependency - 121.IBEditorWindowLastContentRect - 121.IBPluginDependency - 121.IBViewBoundsToFrameTransform - 122.IBPluginDependency - 122.IBViewBoundsToFrameTransform - 124.IBPluginDependency - 124.IBViewBoundsToFrameTransform - 125.IBPluginDependency - 125.IBViewBoundsToFrameTransform - 126.IBPluginDependency - 126.IBViewBoundsToFrameTransform - 127.IBPluginDependency - 127.IBViewBoundsToFrameTransform - 128.IBPluginDependency - 128.IBViewBoundsToFrameTransform - 129.IBPluginDependency - 129.IBViewBoundsToFrameTransform - 130.IBPluginDependency - 130.IBViewBoundsToFrameTransform - 131.IBPluginDependency - 131.IBViewBoundsToFrameTransform - 132.IBPluginDependency - 132.IBViewBoundsToFrameTransform - 133.IBPluginDependency - 133.IBViewBoundsToFrameTransform - 134.IBPluginDependency - 134.IBViewBoundsToFrameTransform - 135.IBPluginDependency - 135.IBViewBoundsToFrameTransform - 136.IBPluginDependency - 136.IBViewBoundsToFrameTransform - 137.IBPluginDependency - 137.IBViewBoundsToFrameTransform - 138.IBPluginDependency - 138.IBViewBoundsToFrameTransform - 140.IBPluginDependency - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 2.IBViewBoundsToFrameTransform - - - YES - HelpPageViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AQAAAADAQAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{589, 578}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AcCgAABCMAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDZwAAw7aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCVAAAwx8AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAwnQAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCxgAAwtYAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCxgAAwyQAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw+SAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAxARAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw6aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw8+AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDZwAAw+EAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDiQAAwmwAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDiIAAwswAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDr4AAwwUAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDdgAAw1oAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDooAAw3gAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDeQAAw6aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{165, 514}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAw4kAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 142 - - - - YES - - HelpPageViewController - UIViewController - - dismiss - id - - - dismiss - - dismiss - id - - - - scrollView - UIScrollView - - - scrollView - - scrollView - UIScrollView - - - - IBProjectSource - Classes/HelpPageViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UINavigationBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UINavigationBar.h - - - - UINavigationItem - NSObject - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/HelpPageLobbyViewController-iPad.xib --- a/project_files/HedgewarsMobile/Resources/HelpPageLobbyViewController-iPad.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1135 +0,0 @@ - - - - 1024 - 10F569 - 804 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 123 - - - YES - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 292 - {{742, 389}, {240, 102}} - - - NO - NO - IBIPadFramework - - NSImage - helpabove.png - - - - - 292 - {{753, 408}, {109, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Map theme - - Helvetica-Bold - 18 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - - - - 292 - {{753, 425}, {218, 66}} - - - NO - YES - 7 - NO - IBIPadFramework - Here you can choose how your map will appear in game. - - Helvetica - 16 - 16 - - - - 1 - 10 - 0 - - - - 292 - {{653, 202}, {240, 146}} - - - NO - NO - IBIPadFramework - - - - - 292 - {{664, 223}, {109, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Map type - - - - 1 - 10 - - - - 292 - {{664, 244}, {218, 99}} - - - NO - YES - 7 - NO - IBIPadFramework - Choose between a static map or a randomly generated one (might require more time). In a mission you need to perfom some action to win. - - - - 1 - 10 - 0 - - - - 292 - {{494, 20}, {240, 101}} - - - NO - NO - IBIPadFramework - - NSImage - helpright.png - - - - - 292 - {{502, 25}, {109, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Map preview - - - - 1 - 10 - - - - 292 - {{502, 46}, {218, 65}} - - - NO - YES - 7 - NO - IBIPadFramework - This is a small preview of your next map. Tap to select / generate a new map. - - - - 1 - 10 - 0 - - - - 292 - {{391, 389}, {242, 171}} - - - NO - NO - IBIPadFramework - - - - - 292 - {{401, 413}, {109, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Teams - - - - 1 - 10 - - - - 292 - {{400, 434}, {232, 120}} - - - NO - YES - 7 - NO - IBIPadFramework - Select which teams are playing! Add hogs by tapping on them and set their color to figure friend and foe teams out. AI teams will appear with a small robot badge next their name. - - - - 1 - 10 - 0 - - - - 292 - {{142, 125}, {240, 104}} - - - NO - NO - IBIPadFramework - - NSImage - helpleft.png - - - - - 292 - {{162, 133}, {204, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Schemes and Weapons - - - - 1 - 10 - - - - 292 - {{162, 152}, {210, 71}} - - - NO - YES - 7 - NO - IBIPadFramework - Here you can choose which rules and which weapon set will be applied in game. - - - - 1 - 10 - 0 - - - - 292 - {{155, 8}, {278, 50}} - - - NO - NO - IBIPadFramework - - - - - 292 - {{177, 6}, {248, 54}} - - - NO - YES - 7 - NO - IBIPadFramework - Did you know you can customize almost everything in the settings page? - - Helvetica-Oblique - 14 - 16 - - - - 1 - 10 - 0 - - - - 292 - {{686, 583}, {240, 117}} - - - NO - NO - IBIPadFramework - - NSImage - helpbottom.png - - - - - 292 - {{697, 592}, {138, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Max hedgehogs - - - - 1 - 10 - - - - 292 - {{697, 609}, {218, 73}} - - - NO - YES - 7 - NO - IBIPadFramework - This number is the maximum size for all the hogs playing (in every team). - - - - 1 - 10 - 0 - - - - 292 - {{20, 587}, {240, 109}} - - - NO - NO - IBIPadFramework - - - - - 292 - {{30, 592}, {138, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Size slider - - - - 1 - 10 - - - - 292 - {{30, 608}, {218, 73}} - - - NO - YES - 7 - NO - IBIPadFramework - For Random and Maze maps you can decide to generate only maps of a certain size. - - - - 1 - 10 - 0 - - - - 292 - {{45, 318}, {240, 128}} - - - NO - NO - IBIPadFramework - - NSImage - helpplain.png - - - - - 292 - {{50, 326}, {229, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Tap anywhere to dismiss - - - - 1 - 10 - 1 - - - - 292 - {{52, 348}, {224, 87}} - - - NO - YES - 7 - NO - IBIPadFramework - Still confused? Don't worry, it's really simple! Try a couple of games and everything will become clear to you. - - - - 1 - 10 - 0 - - - - 292 - {{344, 635}, {240, 61}} - - - NO - NO - IBIPadFramework - - - - - 292 - {{353, 637}, {138, 22}} - - - NO - YES - 7 - NO - IBIPadFramework - Start button - - - - 1 - 10 - - - - 292 - {{354, 650}, {218, 46}} - - - NO - YES - 7 - NO - IBIPadFramework - This button starts the game. - - - - 1 - 10 - 0 - - - {1024, 768} - - - - 3 - MCAwLjQAA - - NO - NO - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - dismiss - - - 7 - - 16 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 25 - - - - - 26 - - - - - 27 - - - - - 28 - - - - - 29 - - - - - 30 - - - - - 34 - - - - - 35 - - - - - 36 - - - - - 37 - - - - - 38 - - - - - 39 - - - - - 40 - - - - - 41 - - - - - 42 - - - - - 43 - - - - - 44 - - - - - 45 - - - - - 49 - - - - - 50 - - - - - 51 - - - - - 52 - - - - - 53 - - - - - 54 - - - - - 58 - - - - - 59 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 2.CustomClassName - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 25.IBPluginDependency - 26.IBPluginDependency - 27.IBPluginDependency - 28.IBPluginDependency - 29.IBPluginDependency - 30.IBPluginDependency - 34.IBPluginDependency - 35.IBPluginDependency - 36.IBPluginDependency - 37.IBPluginDependency - 38.IBPluginDependency - 39.IBPluginDependency - 40.IBPluginDependency - 41.IBPluginDependency - 42.IBPluginDependency - 43.IBPluginDependency - 44.IBPluginDependency - 45.IBPluginDependency - 49.IBPluginDependency - 50.IBPluginDependency - 51.IBPluginDependency - 52.IBPluginDependency - 53.IBPluginDependency - 54.IBPluginDependency - 58.IBPluginDependency - 59.IBPluginDependency - 6.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - - - YES - HelpPageViewController - UIResponder - UIControl - {{273, 125}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 59 - - - - YES - - HelpPageViewController - UIViewController - - dismiss - id - - - dismiss - - dismiss - id - - - - IBProjectSource - Classes/HelpPageViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - helpabove.png - helpbottom.png - helpleft.png - helpplain.png - helpright.png - - - YES - {295, 156} - {295, 156} - {308, 144} - {296, 138} - {308, 144} - - - 123 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/HelpPageLobbyViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Resources/HelpPageLobbyViewController-iPhone.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,907 +0,0 @@ - - - - 1024 - 10F569 - 804 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 123 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 292 - - YES - - - 268 - - YES - - - 292 - {{20, 587}, {440, 52}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Still confused? Don't worry, it's really simple! Try a couple of games and everything will become clear to you. - - Helvetica - 16 - 16 - - - 1 - MCAwIDAAA - - - 1 - 10 - 0 - 1 - - - - 292 - {{20, 279}, {138, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Size slider - - Helvetica-Bold - 18 - 16 - - - - 1 - 10 - - - - 292 - {{20, 298}, {440, 44}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - For Random and Maze maps you can decide to generate only maps of a certain size. - - - - 1 - 10 - 0 - - - - 292 - {{20, 511}, {204, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Schemes and Weapons - - - - 1 - 10 - - - - 292 - {{20, 530}, {433, 45}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Here you can choose which rules and which weapon set will be applied in game. - - - - 1 - 10 - 0 - - - - 292 - {{20, 68}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Map preview - - - - 1 - 10 - - - - 292 - {{20, 88}, {440, 44}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - This is a small preview of your next map. Tap to select / generate a new map. - - - - 1 - 10 - 0 - - - - 292 - {{20, 140}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Map type - - - - 1 - 10 - - - - 292 - {{20, 164}, {440, 58}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Choose between a static map or a randomly generated one (might require more time). In a mission you need to perfom some action to win. - - - - 1 - 10 - 0 - - - - 292 - {{20, 229}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Map theme - - - - 1 - 10 - - - - 292 - {{20, 244}, {440, 33}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Here you can choose how your map will appear in game. - - - - 1 - 10 - 0 - - - - 292 - {{20, 347}, {138, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Max hedgehogs - - - - 1 - 10 - - - - 292 - {{20, 367}, {440, 41}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - This number is the maximum size for all the hogs playing (in every team). - - - - 1 - 10 - 0 - - - - 292 - {{20, 418}, {109, 22}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Teams - - - - 1 - 10 - - - - 292 - {{20, 436}, {433, 66}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Select which teams are playing! Add hogs by tapping on them and set their color to figure friend and foe teams out. AI teams will appear with a small robot badge next their name. - - - - 1 - 10 - 0 - - - - 292 - {{13, 3}, {440, 60}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Here you can find help for the game configuration options. You can customize almost everything in the settings page. - - Helvetica-Oblique - 16 - 16 - - - - 1 - 10 - 0 - 1 - - - {480, 276} - - YES - YES - IBCocoaTouchFramework - - - {480, 276} - - - 2 - MC45OTYwNzg0OTEyIDAuOTg4MjM1MzU0NCAxAA - - NO - NO - - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - scrollView - - - - 95 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - 60 - - - YES - - - - - - - - - - - - - - - - - - - - - 61 - - - - - 62 - - - - - 63 - - - - - 64 - - - - - 65 - - - - - 66 - - - - - 67 - - - - - 68 - - - - - 69 - - - - - 70 - - - - - 71 - - - - - 72 - - - - - 73 - - - - - 74 - - - - - 75 - - - - - 76 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 60.IBPluginDependency - 60.IBViewBoundsToFrameTransform - 61.IBPluginDependency - 61.IBViewBoundsToFrameTransform - 62.IBPluginDependency - 62.IBViewBoundsToFrameTransform - 63.IBPluginDependency - 63.IBViewBoundsToFrameTransform - 64.IBPluginDependency - 64.IBViewBoundsToFrameTransform - 65.IBPluginDependency - 65.IBViewBoundsToFrameTransform - 66.IBPluginDependency - 66.IBViewBoundsToFrameTransform - 67.IBPluginDependency - 67.IBViewBoundsToFrameTransform - 68.IBPluginDependency - 68.IBViewBoundsToFrameTransform - 69.IBPluginDependency - 69.IBViewBoundsToFrameTransform - 70.IBPluginDependency - 70.IBViewBoundsToFrameTransform - 71.IBPluginDependency - 71.IBViewBoundsToFrameTransform - 72.IBPluginDependency - 72.IBViewBoundsToFrameTransform - 73.IBPluginDependency - 73.IBViewBoundsToFrameTransform - 74.IBPluginDependency - 74.IBViewBoundsToFrameTransform - 75.IBPluginDependency - 75.IBViewBoundsToFrameTransform - 76.IBPluginDependency - 76.IBViewBoundsToFrameTransform - - - YES - HelpPageViewController - UIResponder - {{16, 775}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AUGgAABEDIAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABC+AAAw0kAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw14AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw9mAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw+6AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABByAAAwqYAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAwxMAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAADCQAAAwqYAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAADCQAAAwzcAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDAAAAw3AAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDAAAAw5aAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDOwAAw6OAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDOwAAw8WAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDDgAAw7UAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDDQAAw/CAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAADBAAAAwlQAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 95 - - - - YES - - HelpPageViewController - UIViewController - - dismiss - id - - - dismiss - - dismiss - id - - - - scrollView - UIScrollView - - - scrollView - - scrollView - UIScrollView - - - - IBProjectSource - Classes/HelpPageViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - 123 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib --- a/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,629 +0,0 @@ - - - - 1056 - 10H574 - 823 - 1038.35 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 274 - {1024, 768} - - NO - IBIPadFramework - - NSImage - background.png - - - - - 292 - {{383, 427}, {263, 244}} - - NO - IBIPadFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - 215 - 0.0 - 0.0 - 0.0 - - 3 - MQA - - - 2 - MC45OTYwNzg0OTEyIDAuODAwMDAwMDcxNSAwLjAzOTIxNTY4NzY2AA - - - 3 - MC41AA - - - NSImage - localplayButton~ipad.png - - - - - 292 - {{795, 317}, {18, 19}} - - NO - 0.31690141558647156 - 3 - IBIPadFramework - 0 - 0 - - 3 - YES - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - 292 - {{940, 686}, {64, 64}} - - NO - 2 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - settingsButton.png - - - - - 292 - {{20, 686}, {64, 64}} - - NO - 4 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - savesButton.png - - - - - 292 - {{242, 43}, {540, 300}} - - NO - IBIPadFramework - - NSImage - title~ipad.png - - - - {1024, 768} - - - 1 - MCAwIDAAA - - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - switchViews: - - - 7 - - 47 - - - - switchViews: - - - 7 - - 48 - - - - switchViews: - - - 7 - - 54 - - - - switchViews: - - - 7 - - 89 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 39 - - - local - - - 45 - - - - - 52 - - - - - 37 - - - - - 88 - - - - - 90 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 37.IBPluginDependency - 39.IBPluginDependency - 45.IBPluginDependency - 45.IBViewBoundsToFrameTransform - 52.IBPluginDependency - 52.IBViewBoundsToFrameTransform - 88.IBPluginDependency - 88.IBViewBoundsToFrameTransform - 90.IBPluginDependency - 90.IBViewBoundsToFrameTransform - - - YES - MainMenuViewController - UIResponder - {{267, 388}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABERQAAw56AAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABEaQAAxDsAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAxDsAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDbQAAw6qAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 90 - - - - YES - - MainMenuViewController - UIViewController - - switchViews: - id - - - switchViews: - - switchViews: - id - - - - IBProjectSource - Classes/MainMenuViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - background.png - localplayButton~ipad.png - savesButton.png - settingsButton.png - title~ipad.png - - - YES - {1024, 768} - {263, 244} - {64, 64} - {64, 64} - {540, 300} - - - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPhone.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,647 +0,0 @@ - - - - 1056 - 10K549 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 293 - - YES - - - 274 - {480, 320} - - - 3 - MCAwAA - - 4 - NO - IBCocoaTouchFramework - - NSImage - background~iphone.png - - - - - 293 - {{105, 20}, {270, 150}} - - NO - NO - 4 - NO - IBCocoaTouchFramework - - NSImage - title~iphone.png - - - - - 289 - {{190, 200}, {100, 100}} - - - 1 - MCAwIDAgMAA - - NO - NO - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - 3 - MC41AA - - - NSImage - localplayButton~iphone.png - - - - - 269 - {{396, 236}, {64, 64}} - - NO - NO - 2 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - settingsButton.png - - - - - 269 - {{20, 236}, {64, 64}} - - NO - NO - 4 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - savesButton.png - - - - - 292 - {{20, 19}, {18, 19}} - - NO - 0.5 - 3 - IBCocoaTouchFramework - 0 - 0 - - 3 - YES - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - {480, 320} - - - 1 - MCAwIDAAA - - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - switchViews: - - - 7 - - 30 - - - - switchViews: - - - 7 - - 40 - - - - switchViews: - - - 7 - - 42 - - - - switchViews: - - - 7 - - 44 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 23 - - - - - 22 - - - - - 41 - - - - - 43 - - - - - 24 - - - - - 28 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 22.IBPluginDependency - 22.IBViewBoundsToFrameTransform - 23.IBPluginDependency - 23.IBViewBoundsToFrameTransform - 24.IBPluginDependency - 24.IBViewBoundsToFrameTransform - 28.IBPluginDependency - 28.IBViewBoundsToFrameTransform - 41.IBPluginDependency - 41.IBViewBoundsToFrameTransform - 43.IBPluginDependency - 43.IBViewBoundsToFrameTransform - - - YES - MainMenuViewController - UIResponder - {{517, 519}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAw5UAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCygAAwzcAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDPgAAw5UAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDxgAAw5iAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBcAAAwhAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBoAAAw5iAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 45 - - - - YES - - MainMenuViewController - UIViewController - - switchViews: - id - - - switchViews: - - switchViews: - id - - - - IBProjectSource - Classes/MainMenuViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - background~iphone.png - localplayButton~iphone.png - savesButton.png - settingsButton.png - title~iphone.png - - - YES - {480, 320} - {100, 100} - {64, 64} - {64, 64} - {270, 150} - - - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib --- a/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1048 +0,0 @@ - - - - 1056 - 10K540 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 274 - - YES - - - 292 - {1024, 768} - - NO - NO - IBIPadFramework - - NSImage - background.png - - - - - 289 - {{724, 166}, {280, 30}} - - NO - IBIPadFramework - 2 - 4 - 1 - - YES - Random - Map - Maze - Mission - - - YES - - - - - - - YES - - - - - - - YES - {0, 0} - {0, 0} - {0, 0} - {0, 0} - - - YES - - - - - - - 3 - MC42NjY2NjY2NjY3AA - - - - - 292 - {{263, 723}, {149, 23}} - - NO - IBIPadFramework - 0 - 0 - 0.05000000074505806 - 0.05000000074505806 - - - - 289 - {{736, 26}, {256, 128}} - - NO - YES - IBIPadFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - 4 - 4 - 4 - 4 - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - - - 292 - {{778, 724}, {42, 21}} - - NO - YES - 7 - NO - IBIPadFramework - ... - - Helvetica-Bold - 17 - 16 - - - 2 - MC45MTc2NDcxMjMzIDAuNjc0NTA5ODIzMyAwAA - - - 1 - 10 - 1 - - - - 292 - {{112, 720}, {145, 29}} - - NO - YES - 7 - NO - IBIPadFramework - Label - - Helvetica-Oblique - 18 - 16 - - - 2 - MC45MTM3MjU1NTQ5IDAuNzMzMzMzMzQ5MiAwLjAxMTc2NDcwNzA0AA - - - 1 - 10 - 1 - - - - 292 - {{357, 28}, {309, 165}} - - NO - NO - IBIPadFramework - - NSImage - title.png - - - - - 274 - {{714, 225}, {300, 445}} - - - 3 - MCAwAA - - YES - YES - IBIPadFramework - YES - 1 - 2 - 0 - YES - 45 - - - - 292 - {{441, 702}, {142, 64}} - - NO - 1 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - startGameButton.png - - - - - 292 - {{10, 693}, {64, 64}} - - NO - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - backButton.png - - - - - 292 - {{950, 693}, {64, 64}} - - NO - 2 - IBIPadFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - helpButton.png - - - - {1024, 768} - - - 2 - MC44MzkyMTU3NTU1IDAuODQ3MDU4ODkyMyAwLjg3MDU4ODMwMjYAA - - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - previewButton - - - - 13 - - - - maxLabel - - - - 16 - - - - sizeLabel - - - - 18 - - - - sliderChanged: - - - 13 - - 19 - - - - sliderEndedChanging: - - - 7 - - 20 - - - - segmentedControl - - - - 21 - - - - segmentedControlChanged: - - - 13 - - 22 - - - - slider - - - - 23 - - - - dataSource - - - - 67 - - - - delegate - - - - 68 - - - - tableView - - - - 69 - - - - buttonPressed: - - - 7 - - 73 - - - - buttonPressed: - - - 7 - - 74 - - - - buttonPressed: - - - 7 - - 77 - - - - mapButtonPressed - - - 7 - - 113 - - - - delegate - - - - 114 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 1 - - - YES - - - - - - - - - - - - - - - - 75 - - - - - 72 - - - - - 70 - - - - - 66 - - - - - 57 - - - - - 17 - - - - - 11 - - - - - 9 - - - - - 8 - - - - - 7 - - - - - 50 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 11.IBPluginDependency - 17.IBPluginDependency - 50.IBPluginDependency - 57.IBPluginDependency - 66.IBPluginDependency - 7.IBPluginDependency - 7.IBViewBoundsToFrameTransform - 70.IBPluginDependency - 72.IBPluginDependency - 75.IBPluginDependency - 8.IBPluginDependency - 9.CustomClassName - 9.IBPluginDependency - - - YES - MapConfigViewController - UIResponder - {{288, 236}, {1024, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABENUAAw0IAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - MapPreviewButtonView - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 119 - - - - YES - - MapConfigViewController - UIViewController - - YES - - YES - buttonPressed: - mapButtonPressed - segmentedControlChanged: - sliderChanged: - sliderEndedChanging: - - - YES - id - id - id - id - id - - - - YES - - YES - buttonPressed: - mapButtonPressed - segmentedControlChanged: - sliderChanged: - sliderEndedChanging: - - - YES - - buttonPressed: - id - - - mapButtonPressed - id - - - segmentedControlChanged: - id - - - sliderChanged: - id - - - sliderEndedChanging: - id - - - - - YES - - YES - maxLabel - previewButton - segmentedControl - sizeLabel - slider - tableView - - - YES - UILabel - MapPreviewButtonView - UISegmentedControl - UILabel - UISlider - UITableView - - - - YES - - YES - maxLabel - previewButton - segmentedControl - sizeLabel - slider - tableView - - - YES - - maxLabel - UILabel - - - previewButton - MapPreviewButtonView - - - segmentedControl - UISegmentedControl - - - sizeLabel - UILabel - - - slider - UISlider - - - tableView - UITableView - - - - - IBProjectSource - Classes/MapConfigViewController.h - - - - MapPreviewButtonView - UIButton - - delegate - id - - - delegate - - delegate - id - - - - IBProjectSource - Classes/MapPreviewButtonView.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISegmentedControl - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISegmentedControl.h - - - - UISlider - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISlider.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - backButton.png - background.png - helpButton.png - startGameButton.png - title.png - - - YES - {64, 64} - {1024, 768} - {64, 64} - {142, 64} - {270, 150} - - - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,949 +0,0 @@ - - - - 1056 - 10K540 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 292 - {480, 276} - - NO - IBCocoaTouchFramework - - NSImage - background~iphone.png - - - - - 292 - {{9, 14}, {270, 30}} - - NO - IBCocoaTouchFramework - 2 - 4 - 1 - - YES - Random - Map - Maze - Mission - - - YES - - - - - - - YES - - - - - - - YES - {0, 0} - {0, 0} - {0, 0} - {0, 0} - - - YES - - - - - - - 3 - MC42NjY2NjY2NjY3AA - - - - - 292 - {{119, 207}, {149, 23}} - - NO - IBCocoaTouchFramework - 0 - 0 - 0.05000000074505806 - 0.05000000074505806 - - - - 292 - {{16, 58}, {256, 128}} - - NO - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - - - 292 - {{58, 221}, {48, 35}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - ... - - Helvetica-Bold - 17 - 16 - - - 2 - MC45NDkwMTk2NzA1IDAuNzY4NjI3NTI0NCAwAA - - - 1 - 10 - 1 - - - - 292 - {{109, 237}, {169, 29}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Label - - Helvetica-Oblique - 22 - 16 - - - 2 - MC45NDExNzY1MzM3IDAuODE1Njg2MzQ1MSAwAA - - - 1 - 10 - 1 - - - - 274 - {{284, 0}, {196, 276}} - - - 3 - MCAwAA - - NO - YES - NO - IBCocoaTouchFramework - NO - 1 - 2 - 0 - YES - 44 - 10 - 10 - - - - 292 - {{-9, 225}, {92, 27}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Max - - Helvetica-BoldOblique - 18 - 16 - - - 2 - MC45NDkwMTk2NzA1IDAuNzY4NjI3NTI0NCAwAA - - - 1 - 10 - 1 - - - {480, 276} - - - - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - previewButton - - - - 13 - - - - maxLabel - - - - 16 - - - - sizeLabel - - - - 18 - - - - sliderChanged: - - - 13 - - 19 - - - - sliderEndedChanging: - - - 7 - - 20 - - - - segmentedControl - - - - 21 - - - - segmentedControlChanged: - - - 13 - - 22 - - - - slider - - - - 23 - - - - dataSource - - - - 26 - - - - delegate - - - - 27 - - - - tableView - - - - 32 - - - - mapButtonPressed - - - 7 - - 33 - - - - delegate - - - - 34 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 7 - - - - - 8 - - - - - 9 - - - - - 11 - - - - - 17 - - - - - 25 - - - Table View (Themes) - - - 35 - - - - - 36 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 11.IBPluginDependency - 11.IBViewBoundsToFrameTransform - 17.IBPluginDependency - 17.IBViewBoundsToFrameTransform - 25.IBPluginDependency - 25.IBViewBoundsToFrameTransform - 35.IBPluginDependency - 35.IBViewBoundsToFrameTransform - 36.IBPluginDependency - 36.IBViewBoundsToFrameTransform - 7.IBPluginDependency - 7.IBViewBoundsToFrameTransform - 8.IBPluginDependency - 9.CustomClassName - 9.IBPluginDependency - 9.IBViewBoundsToFrameTransform - - - YES - MapConfigViewController - UIResponder - {{790, 298}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABB+AAAw4QAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCyAAAw2YAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDjgAAw4kAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAw4kAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBMAAAw2gAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBUAAAwigAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - MapPreviewButtonView - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABBUAAAwxIAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 36 - - - - YES - - MapConfigViewController - UIViewController - - YES - - YES - buttonPressed: - mapButtonPressed - segmentedControlChanged: - sliderChanged: - sliderEndedChanging: - - - YES - id - id - id - id - id - - - - YES - - YES - buttonPressed: - mapButtonPressed - segmentedControlChanged: - sliderChanged: - sliderEndedChanging: - - - YES - - buttonPressed: - id - - - mapButtonPressed - id - - - segmentedControlChanged: - id - - - sliderChanged: - id - - - sliderEndedChanging: - id - - - - - YES - - YES - maxLabel - previewButton - segmentedControl - sizeLabel - slider - tableView - - - YES - UILabel - MapPreviewButtonView - UISegmentedControl - UILabel - UISlider - UITableView - - - - YES - - YES - maxLabel - previewButton - segmentedControl - sizeLabel - slider - tableView - - - YES - - maxLabel - UILabel - - - previewButton - MapPreviewButtonView - - - segmentedControl - UISegmentedControl - - - sizeLabel - UILabel - - - slider - UISlider - - - tableView - UITableView - - - - - IBProjectSource - Classes/MapConfigViewController.h - - - - MapPreviewButtonView - UIButton - - delegate - id - - - delegate - - delegate - id - - - - IBProjectSource - Classes/MapPreviewButtonView.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UISegmentedControl - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISegmentedControl.h - - - - UISlider - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UISlider.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - background~iphone.png - {480, 320} - - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/OverlayViewController.xib --- a/project_files/HedgewarsMobile/Resources/OverlayViewController.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1014 +0,0 @@ - - - - 1056 - 10H574 - 823 - 1038.35 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 268 - {{0, 229}, {50, 50}} - - NO - NO - YES - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - - 3 - MQA - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - 3 - MC41AA - - - NSImage - arrowLeft.png - - - - - 268 - {{87, 229}, {50, 50}} - - NO - NO - YES - 1 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowRight.png - - - - - 265 - {{412, 236}, {64, 64}} - - NO - NO - YES - 5 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - joyButtonBackJump.png - - - - - 265 - {{365, 203}, {64, 64}} - - NO - NO - YES - 6 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - joyButtonForwardJump.png - - - - - 265 - {{354, 256}, {64, 64}} - - NO - NO - YES - 4 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - joyButtonAttack.png - - - - - 268 - {{44, 187}, {50, 50}} - - NO - NO - YES - 2 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowUp.png - - - - - 268 - {{44, 270}, {50, 50}} - - NO - NO - YES - 3 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - arrowDown.png - - - - - 289 - {{341, 0}, {64, 50}} - - NO - YES - 10 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - cornerButton.png - - - - - 289 - {{402, 0}, {78, 50}} - - NO - YES - 11 - IBCocoaTouchFramework - 0 - 0 - - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - NSImage - ammoButton.png - - - - {480, 320} - - - 3 - MSAwAA - - NO - YES - NO - YES - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - 1 - - 8 - - - - buttonReleased: - - - 9 - - 9 - - - - buttonReleased: - - - 7 - - 10 - - - - buttonReleased: - - - 8 - - 11 - - - - buttonReleased: - - - 8 - - 13 - - - - buttonReleased: - - - 9 - - 14 - - - - buttonPressed: - - - 1 - - 15 - - - - buttonReleased: - - - 7 - - 16 - - - - buttonReleased: - - - 9 - - 18 - - - - buttonPressed: - - - 1 - - 19 - - - - buttonReleased: - - - 8 - - 20 - - - - buttonReleased: - - - 7 - - 21 - - - - buttonReleased: - - - 8 - - 23 - - - - buttonReleased: - - - 9 - - 24 - - - - buttonPressed: - - - 1 - - 25 - - - - buttonReleased: - - - 7 - - 26 - - - - buttonReleased: - - - 9 - - 44 - - - - buttonPressed: - - - 1 - - 45 - - - - buttonReleased: - - - 8 - - 46 - - - - buttonReleased: - - - 7 - - 47 - - - - buttonReleased: - - - 8 - - 49 - - - - buttonReleased: - - - 7 - - 50 - - - - buttonReleased: - - - 9 - - 51 - - - - buttonPressed: - - - 1 - - 52 - - - - buttonReleased: - - - 9 - - 54 - - - - buttonReleased: - - - 7 - - 55 - - - - buttonPressed: - - - 1 - - 56 - - - - buttonReleased: - - - 8 - - 57 - - - - buttonPressed: - - - 7 - - 60 - - - - buttonPressed: - - - 7 - - 68 - - - - buttonReleased: - - - 9 - - 69 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - left - - - 12 - - - right - - - 17 - - - up - - - 22 - - - down - - - 43 - - - push2 - - - 48 - - - push1 - - - 53 - - - push3 - - - 58 - - - - - 67 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 12.IBPluginDependency - 12.IBViewBoundsToFrameTransform - 17.IBPluginDependency - 22.IBPluginDependency - 4.IBPluginDependency - 43.IBPluginDependency - 48.IBPluginDependency - 53.IBPluginDependency - 58.IBPluginDependency - 67.IBPluginDependency - - - YES - OverlayViewController - UIResponder - {{690, 375}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCkAAAw5SAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 72 - - - - YES - - OverlayViewController - UIViewController - - YES - - YES - buttonPressed: - buttonReleased: - - - YES - id - id - - - - YES - - YES - buttonPressed: - buttonReleased: - - - YES - - buttonPressed: - id - - - buttonReleased: - id - - - - - IBProjectSource - Classes/OverlayViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - YES - - YES - ammoButton.png - arrowDown.png - arrowLeft.png - arrowRight.png - arrowUp.png - cornerButton.png - joyButtonAttack.png - joyButtonBackJump.png - joyButtonForwardJump.png - - - YES - {78, 50} - {50, 50} - {50, 50} - {50, 50} - {50, 50} - {60, 50} - {64, 64} - {64, 64} - {64, 64} - - - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/RestoreViewController-iPad.xib --- a/project_files/HedgewarsMobile/Resources/RestoreViewController-iPad.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,616 +0,0 @@ - - - - 1056 - 10K549 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 274 - - YES - - - 302 - {{84, 517}, {151, 37}} - - NO - IBIPadFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - 1 - Dismiss - - 3 - MQA - - - 1 - MCAwIDAuNTAxOTYwODE0AA - - - 3 - MC41AA - - - - - 299 - {{308, 517}, {151, 37}} - - NO - 1 - IBIPadFramework - 0 - 0 - - 1 - Restore - - - - - - - 315 - {{216, 35}, {108, 29}} - - NO - YES - 7 - NO - IBIPadFramework - Hmm... - - Helvetica-Bold - 24 - 16 - - - 2 - MSAwLjc4MDM5MjIyOTYgMAA - - - 1 - 10 - 1 - - - - 307 - {{80, 375}, {380, 96}} - - NO - YES - 7 - NO - IBIPadFramework - Would you like to restore it? - - Helvetica - 18 - 16 - - - 1 - MC45MDE5NjA3OTAyIDAuOTAxOTYwNzkwMiAwLjkwMTk2MDc5MDIAA - - - 1 - 10 - 4 - 1 - - - - 307 - {{80, 87}, {380, 96}} - - NO - YES - 7 - NO - IBIPadFramework - It appears you didn't complete your last game! - - - 1 - MC45MDE5NjA3OTAyIDAuOTAxOTYwNzkwMiAwLjkwMTk2MDc5MDIAA - - - 1 - 10 - 4 - 1 - - - - 300 - {{150, 191}, {240, 160}} - - NO - IBIPadFramework - - NSImage - denied.png - - - - {540, 640} - - - 4 - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - buttonReleased: - - - 7 - - 21 - - - - buttonReleased: - - - 7 - - 22 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 15 - - - - - 16 - - - - - 18 - - - - - 19 - - - - - 20 - - - - - 23 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 15.IBPluginDependency - 15.IBViewBoundsToFrameTransform - 16.IBPluginDependency - 16.IBViewBoundsToFrameTransform - 18.IBPluginDependency - 18.IBViewBoundsToFrameTransform - 19.IBPluginDependency - 19.IBViewBoundsToFrameTransform - 20.IBPluginDependency - 20.IBViewBoundsToFrameTransform - 23.IBPluginDependency - 23.IBViewBoundsToFrameTransform - - - YES - RestoreViewController - UIResponder - {{566, 244}, {540, 640}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDlIAAw2gAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABEAkAAw2gAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDXAAAw3UAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AUKgAABDmYAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABDFgAAw8cAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAABCoAAAw9uAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 23 - - - - YES - - RestoreViewController - UIViewController - - buttonReleased: - id - - - buttonReleased: - - buttonReleased: - id - - - - IBProjectSource - Classes/RestoreViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - denied.png - {240, 160} - - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/RestoreViewController-iPhone.xib --- a/project_files/HedgewarsMobile/Resources/RestoreViewController-iPhone.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,582 +0,0 @@ - - - - 1056 - 10K549 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 300 - {{20, 20}, {240, 160}} - - NO - IBCocoaTouchFramework - - NSImage - denied.png - - - - - 315 - {{310, 32}, {108, 29}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - Hmm... - - Helvetica-Bold - 24 - 16 - - - 2 - MSAwLjgyNzQ1MTA1MDMgMAA - - - 3 - MQA - - 1 - 10 - 1 - - - - 307 - {{268, 74}, {192, 96}} - - NO - YES - 7 - NO - IBCocoaTouchFramework - It appears you didn't complete your last game! Would you like to restore it? - - Helvetica - 18 - 16 - - - 1 - MC45MDE5NjA3OTAyIDAuOTAxOTYwNzkwMiAwLjkwMTk2MDc5MDIAA - - - 1 - 10 - 4 - 1 - - - - 302 - {{53, 229}, {151, 37}} - - NO - IBCocoaTouchFramework - 0 - 0 - - Helvetica-Bold - 15 - 16 - - 1 - Dismiss - - - 1 - MCAwIDAuNTAxOTYwODE0AA - - - 3 - MC41AA - - - - - 299 - {{277, 229}, {151, 37}} - - NO - 1 - IBCocoaTouchFramework - 0 - 0 - - 1 - Restore - - - - - - {480, 320} - - - 4 - - 3 - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - buttonReleased: - - - 7 - - 11 - - - - buttonReleased: - - - 7 - - 12 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 5 - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 10 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 10.IBPluginDependency - 10.IBViewBoundsToFrameTransform - 5.IBPluginDependency - 5.IBViewBoundsToFrameTransform - 6.IBPluginDependency - 6.IBViewBoundsToFrameTransform - 7.IBPluginDependency - 7.IBViewBoundsToFrameTransform - 8.IBPluginDependency - 8.IBViewBoundsToFrameTransform - - - YES - RestoreViewController - UIResponder - {{206, 423}, {480, 320}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AUOKgABDZQAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AUGgAABBoAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AUObAABCAAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AUOGAABClAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - AUJUAABDZQAAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 14 - - - - YES - - RestoreViewController - UIViewController - - buttonReleased: - id - - - buttonReleased: - - buttonReleased: - id - - - - IBProjectSource - Classes/RestoreViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIButton - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UIButton.h - - - - UIControl - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIControl.h - - - - UIImageView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIImageView.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - - denied.png - {240, 160} - - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/SavedGamesViewController.xib --- a/project_files/HedgewarsMobile/Resources/SavedGamesViewController.xib Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,574 +0,0 @@ - - - - 1056 - 10K549 - 823 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 132 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBIPadFramework - - - IBFirstResponder - IBIPadFramework - - - - 292 - - YES - - - 290 - {768, 44} - - NO - 458912 - IBIPadFramework - - YES - - IBIPadFramework - 1 - - 0 - - - IBIPadFramework - - 5 - - - 1 - Clear All - IBIPadFramework - 1 - - - - - - - 274 - {{0, 44}, {768, 724}} - - - 1 - MCAwIDAgMAA - - YES - IBIPadFramework - YES - 1 - 2 - 0 - YES - 44 - 10 - 10 - - - {768, 768} - - - 3 - MQA - - NO - - 3 - - IBIPadFramework - - - - - YES - - - view - - - - 3 - - - - buttonPressed: - - - - 6 - - - - dataSource - - - - 8 - - - - delegate - - - - 9 - - - - tableView - - - - 10 - - - - buttonPressed: - - - - 17 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - YES - - - - - - - 4 - - - YES - - - - - - - - 5 - - - - - 7 - - - - - 13 - - - - - 15 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 13.IBPluginDependency - 15.IBPluginDependency - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 4.IBPluginDependency - 5.IBPluginDependency - 7.IBPluginDependency - - - YES - SavedGamesViewController - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{467, 276}, {768, 768}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 17 - - - - YES - - SavedGamesViewController - UIViewController - - YES - - YES - buttonPressed: - clearAll: - toggleEdit: - - - YES - id - id - id - - - - YES - - YES - buttonPressed: - clearAll: - toggleEdit: - - - YES - - buttonPressed: - id - - - clearAll: - id - - - toggleEdit: - id - - - - - tableView - UITableView - - - tableView - - tableView - UITableView - - - - IBProjectSource - Classes/SavedGamesViewController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CAAnimation.h - - - - NSObject - - IBFrameworkSource - QuartzCore.framework/Headers/CALayer.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UIToolbar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIToolbar.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIPrintFormatter.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBIPadFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../Hedgewars.xcodeproj - 3 - 132 - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/Settings/Teams/Ninjas.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Teams/Ninjas.plist Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ - - - - - flag - japan - fort - Plane - grave - bp2 - hash - 0 - hedgehogs - - - hat - NinjaFull - hogname - Ukemi - level - 0 - - - hat - NinjaStraight - hogname - Godai - level - 0 - - - hat - NinjaTriangle - hogname - Ninpo - level - 0 - - - hat - NinjaStraight - hogname - Shinobi - level - 0 - - - hat - NinjaFull - hogname - Tatsujin - level - 0 - - - hat - NinjaTriangle - hogname - Arashi - level - 0 - - - hat - NinjaStraight - hogname - Bushi - level - 0 - - - hat - NinjaFull - hogname - Itami - level - 0 - - - voicepack - Default - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/Settings/Teams/Pirates.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Teams/Pirates.plist Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ - - - - - flag - cm_pirate - fort - Plane - grave - chest - hash - 0 - hedgehogs - - - hat - pirate_jack_bandana - hogname - Toothless Wayne - level - 0 - - - hat - pirate_jack - hogname - Long-nose Kidd - level - 0 - - - hat - dwarf - hogname - Eye-patch Jim - level - 0 - - - hat - pirate_jack - hogname - Rackham Blood - level - 0 - - - hat - dwarf - hogname - One-eyed Ayee - level - 0 - - - hat - pirate_jack_bandana - hogname - Dirty Ben - level - 0 - - - hat - pirate_jack - hogname - Morris - level - 0 - - - hat - dwarf - hogname - Cruise Seymour - level - 0 - - - voicepack - Pirate - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/Settings/Teams/Robots.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Teams/Robots.plist Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ - - - - - flag - cm_binary - fort - UFO - grave - Rip - hash - 0 - hedgehogs - - - hat - cyborg - hogname - HAL - level - 4 - - - hat - cyborg - hogname - R2-D2 - level - 4 - - - hat - cyborg - hogname - Wall-E - level - 4 - - - hat - cyborg - hogname - Robocob - level - 4 - - - hat - cyborg - hogname - Optimus Prime - level - 4 - - - hat - cyborg - hogname - C-3PO - level - 4 - - - hat - cyborg - hogname - Terminator - level - 4 - - - hat - cyborg - hogname - KITT - level - 4 - - - voicepack - Robot - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/Settings/basicFlags.plist --- a/project_files/HedgewarsMobile/Resources/Settings/basicFlags.plist Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,270 +0,0 @@ - - - - - - default - 100 - image - Health - max - 200 - min - 50 - title - Initial Health - - - checkOverMax - - times1000 - - command - e$damagepct - default - 100 - image - Damage - max - 300 - min - 10 - title - Damage Modifier - - - checkOverMax - - times1000 - - command - e$turntime - default - 45 - image - Time - max - 100 - min - 1 - title - Turn Time - - - checkOverMax - - times1000 - - command - e$sd_turns - default - 15 - image - SuddenDeath - max - 50 - min - 0 - title - Sudden Death Timeout - - - checkOverMax - - times1000 - - command - e$waterrise - default - 47 - image - SuddenDeath - max - 100 - min - 0 - title - Water Rise Amount - - - checkOverMax - - times1000 - - command - e$healthdec - default - 5 - image - SuddenDeath - max - 100 - min - 0 - title - Health Decrease - - - checkOverMax - - times1000 - - command - e$ropepct - default - 100 - image - Rope - max - 999 - min - 25 - title - Rope Length (%) - - - checkOverMax - - times1000 - - command - e$casefreq - default - 5 - image - Box - max - 9 - min - 0 - title - Crate Drop Turns - - - checkOverMax - - times1000 - - command - e$healthprob - default - 35 - image - Health - max - 100 - min - 0 - title - Health Kit Probability (%) - - - checkOverMax - - times1000 - - command - e$hcaseamount - default - 25 - image - Health - max - 200 - min - 0 - title - Health Amount in Kit - - - checkOverMax - - times1000 - - command - e$minestime - default - 3 - image - Time - max - 5 - min - -1 - title - Mines Time - - - checkOverMax - - times1000 - - command - e$minesnum - default - 4 - image - Mine - max - 80 - min - 0 - title - Mines Number - - - checkOverMax - - times1000 - - command - e$minedudpct - default - 0 - image - Dud - max - 100 - min - 0 - title - Dud Mines Probability (%) - - - checkOverMax - - times1000 - - command - e$explosives - default - 2 - image - Damage - max - 40 - min - 0 - title - Explosives - - - checkOverMax - - times1000 - - command - e$getawaytime - default - 100 - image - Time - max - 999 - min - 0 - title - Get Away Time (%) - - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/Settings/credits.plist --- a/project_files/HedgewarsMobile/Resources/Settings/credits.plist Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ - - - - - - Andrey "UnC0Rr" Korotaev - Igor "Displacer" Ulyanov - Derek "Nemo" Pomery - Martin "Affect" Boze - David "Krawek" Cuadrado - Martin "Ttsmj" Minarik - Kristian "TheXception" Lehmann - Vittorio "Koda" Giovara - Mario "Smaxx" Liebisch - Carlos "Palewolf" Vives - Richard "Sheepluva" Korlyi - Henning "Prg" Kühn - Henrik "Henek" Rostedt - John "Mikade" Lambert - Mayur "Zorg" Pawashe - Richard "Xeli" Deurwaarder - - - John "Fizzy" Dum - Joshua Frese - Stanko Tadić - Julien Koesten - Joshua O'Sullivan - Nils Luck - Trey Perry - - - Stephen "Armagon" Alexander - John "Fizzy" Dum - Jonatan Nilsson - Daniel Martin - - - Romulo Fernandes Machado - Svetoslav Stefanov - Petr ŘezáÄek - Jie Luo - Andrey Korotaev - Nina Kuisma - Antoine Turmel - Peter Hüwe, Mario Liebisch, Richard Karolyi - Talos Kriti - Luca Bonora, Marco Bresciani - Adam Etienne - Anthony Bellew - Lukas Urbonas - Maciej MroziÅ„ski, Wojciech Latkowski, Piotr Mitana, Maciej Górny - Fábio Canário - Andrey Korotaev - Jose Riha - Carlos Vives - Niklas Grahn, Henrik Rostedt - Eugene V. Lyubimkin, Igor Paliychuk, Eugene Sakara - - - Aleksey Andreev - Aleksander Rudalev - Natasha Korotaeva - Adam Higerd - - - Engine, frontend, net server - Many desktop frontend improvements - Many engine and desktop frontend improvements - Drillrocket, Ballgun, RC Plane weapons - Mine number and time game settings - Desktop frontend improvements - Desktop frontend improvements - Mac OS X and iPhone version - Many engine and desktop frontend improvements - Gamepad and Lua integration - Many engine improvements and graphics - Maze maps - Engine and desktop frontend improvements - Lua game modes and missions - Desktop frontend improvements - Android port - - - Main graphics - - - - - - Some hats - - - Hedgehogs voice - - - - - - Brazilian Portuguese - Bulgarian - Czech - Chinese - English - Finnish - French - German - Greek - Italian - Japanese - Korean - Lithuanian - Polish - Portuguese - Russian - Slovak - Spanish - Swedish - Ukrainian - - - - - - - - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/Settings/gameMods.plist --- a/project_files/HedgewarsMobile/Resources/Settings/gameMods.plist Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +0,0 @@ - - - - - - description - Land can not be destroyed - image - Solid - title - Solid Land - - - description - Add an indestructable border around the terrain - image - Border - title - Add Border - - - description - Teams will start on opposite sides of the terrain - image - TeamsDivide - title - Divide Team (max 2 teams) - - - description - Lower gravity - image - LowGravity - title - Low Gravity - - - description - Assisted aiming with laser sight - image - LaserSight - title - Laser Sight - - - description - All hogs have a personal forcefield - image - Invulnerable - title - Invulnerable - - - description - All (living) hedgehogs are fully restored at the end of turn - image - ResetHealth - title - Reset Health - - - description - Gain 80% of the damage you do back in health - image - Vampiric - title - Vampirism Mode - - - description - Share your opponents pain, share their damage - image - Karma - title - Karma Mode - - - description - Your hogs are unable to move, test your aim - image - Artillery - title - Artillery Mode - - - description - Defend your fort and destroy the opponents - image - Forts - title - Fort Mode - - - description - Order of play is random instead of in room order - image - RandomOrder - title - Random Order - - - description - Play with a King; when he dies, your side loses - image - King - title - King Mode - - - description - Take turns placing your hedgehogs pre-game - image - PlaceHog - title - Place Hedgehogs - - - description - Ammo is shared between all clan teams - image - SharedAmmo - title - Clan Shares Ammo - - - description - Disable girders when generating random maps - image - DisableGirders - title - Disable Girders - - - description - Disable land objects when generating maps - image - DisableLandObjects - title - Disable Land Objects - - - description - AI-controlled hogs respawn on death - image - AISurvival - title - AI Survival Mode - - - description - Attacking does not end your turn - image - InfAttack - title - Unlimited Attacks - - - description - Weapons are reset to starting values each turn - image - ResetWeps - title - Reset Weapons - - - description - Each hedgehog has its own ammo - image - PerHogAmmo - title - Per Hedgehog Ammo - - - description - You will not have to worry about wind any more - image - NoWind - title - Disable Wind - - - description - Wind will affect almost everything - image - MoreWind - title - More Wind - - - description - Clan teams take turns sharing their time - image - TagTeam - title - Tag Team - - - description - Add an indestructible border along the bottom - image - BottomBorder - title - Bottom Border - - - diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/basicFlags.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/basicFlags.plist Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,270 @@ + + + + + + default + 100 + image + Health + max + 200 + min + 50 + title + Initial Health + + + checkOverMax + + times1000 + + command + e$damagepct + default + 100 + image + Damage + max + 300 + min + 10 + title + Damage Modifier + + + checkOverMax + + times1000 + + command + e$turntime + default + 45 + image + Time + max + 100 + min + 1 + title + Turn Time + + + checkOverMax + + times1000 + + command + e$sd_turns + default + 15 + image + SuddenDeath + max + 50 + min + 0 + title + Sudden Death Timeout + + + checkOverMax + + times1000 + + command + e$waterrise + default + 47 + image + SuddenDeath + max + 100 + min + 0 + title + Water Rise Amount + + + checkOverMax + + times1000 + + command + e$healthdec + default + 5 + image + SuddenDeath + max + 100 + min + 0 + title + Health Decrease + + + checkOverMax + + times1000 + + command + e$ropepct + default + 100 + image + Rope + max + 999 + min + 25 + title + Rope Length (%) + + + checkOverMax + + times1000 + + command + e$casefreq + default + 5 + image + Box + max + 9 + min + 0 + title + Crate Drop Turns + + + checkOverMax + + times1000 + + command + e$healthprob + default + 35 + image + Health + max + 100 + min + 0 + title + Health Kit Probability (%) + + + checkOverMax + + times1000 + + command + e$hcaseamount + default + 25 + image + Health + max + 200 + min + 0 + title + Health Amount in Kit + + + checkOverMax + + times1000 + + command + e$minestime + default + 3 + image + Time + max + 5 + min + -1 + title + Mines Time + + + checkOverMax + + times1000 + + command + e$minesnum + default + 4 + image + Mine + max + 80 + min + 0 + title + Mines Number + + + checkOverMax + + times1000 + + command + e$minedudpct + default + 0 + image + Dud + max + 100 + min + 0 + title + Dud Mines Probability (%) + + + checkOverMax + + times1000 + + command + e$explosives + default + 2 + image + Damage + max + 40 + min + 0 + title + Explosives + + + checkOverMax + + times1000 + + command + e$getawaytime + default + 100 + image + Time + max + 999 + min + 0 + title + Get Away Time (%) + + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/credits.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/credits.plist Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,128 @@ + + + + + + Andrey "UnC0Rr" Korotaev + Igor "Displacer" Ulyanov + Derek "Nemo" Pomery + Martin "Affect" Boze + David "Krawek" Cuadrado + Martin "Ttsmj" Minarik + Kristian "TheXception" Lehmann + Vittorio "Koda" Giovara + Mario "Smaxx" Liebisch + Carlos "Palewolf" Vives + Richard "Sheepluva" Korlyi + Henning "Prg" Kühn + Henrik "Henek" Rostedt + John "Mikade" Lambert + Mayur "Zorg" Pawashe + Richard "Xeli" Deurwaarder + + + John "Fizzy" Dum + Joshua Frese + Stanko Tadić + Julien Koesten + Joshua O'Sullivan + Nils Luck + Trey Perry + + + Stephen "Armagon" Alexander + John "Fizzy" Dum + Jonatan Nilsson + Daniel Martin + + + Romulo Fernandes Machado + Svetoslav Stefanov + Petr ŘezáÄek + Jie Luo + Andrey Korotaev + Nina Kuisma + Antoine Turmel + Peter Hüwe, Mario Liebisch, Richard Karolyi + Talos Kriti + Luca Bonora, Marco Bresciani + Adam Etienne + Anthony Bellew + Lukas Urbonas + Maciej MroziÅ„ski, Wojciech Latkowski, Piotr Mitana, Maciej Górny + Fábio Canário + Andrey Korotaev + Jose Riha + Carlos Vives + Niklas Grahn, Henrik Rostedt + Eugene V. Lyubimkin, Igor Paliychuk, Eugene Sakara + + + Aleksey Andreev + Aleksander Rudalev + Natasha Korotaeva + Adam Higerd + + + Engine, frontend, net server + Many desktop frontend improvements + Many engine and desktop frontend improvements + Drillrocket, Ballgun, RC Plane weapons + Mine number and time game settings + Desktop frontend improvements + Desktop frontend improvements + Mac OS X and iPhone version + Many engine and desktop frontend improvements + Gamepad and Lua integration + Many engine improvements and graphics + Maze maps + Engine and desktop frontend improvements + Lua game modes and missions + Desktop frontend improvements + Android port + + + Main graphics + + + + + + Some hats + + + Hedgehogs voice + + + + + + Brazilian Portuguese + Bulgarian + Czech + Chinese + English + Finnish + French + German + Greek + Italian + Japanese + Korean + Lithuanian + Polish + Portuguese + Russian + Slovak + Spanish + Swedish + Ukrainian + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/Resources/gameMods.plist --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Resources/gameMods.plist Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,206 @@ + + + + + + description + Land can not be destroyed + image + Solid + title + Solid Land + + + description + Add an indestructable border around the terrain + image + Border + title + Add Border + + + description + Teams will start on opposite sides of the terrain + image + TeamsDivide + title + Divide Team (max 2 teams) + + + description + Lower gravity + image + LowGravity + title + Low Gravity + + + description + Assisted aiming with laser sight + image + LaserSight + title + Laser Sight + + + description + All hogs have a personal forcefield + image + Invulnerable + title + Invulnerable + + + description + All (living) hedgehogs are fully restored at the end of turn + image + ResetHealth + title + Reset Health + + + description + Gain 80% of the damage you do back in health + image + Vampiric + title + Vampirism Mode + + + description + Share your opponents pain, share their damage + image + Karma + title + Karma Mode + + + description + Your hogs are unable to move, test your aim + image + Artillery + title + Artillery Mode + + + description + Defend your fort and destroy the opponents + image + Forts + title + Fort Mode + + + description + Order of play is random instead of in room order + image + RandomOrder + title + Random Order + + + description + Play with a King; when he dies, your side loses + image + King + title + King Mode + + + description + Take turns placing your hedgehogs pre-game + image + PlaceHog + title + Place Hedgehogs + + + description + Ammo is shared between all clan teams + image + SharedAmmo + title + Clan Shares Ammo + + + description + Disable girders when generating random maps + image + DisableGirders + title + Disable Girders + + + description + Disable land objects when generating maps + image + DisableLandObjects + title + Disable Land Objects + + + description + AI-controlled hogs respawn on death + image + AISurvival + title + AI Survival Mode + + + description + Attacking does not end your turn + image + InfAttack + title + Unlimited Attacks + + + description + Weapons are reset to starting values each turn + image + ResetWeps + title + Reset Weapons + + + description + Each hedgehog has its own ammo + image + PerHogAmmo + title + Per Hedgehog Ammo + + + description + You will not have to worry about wind any more + image + NoWind + title + Disable Wind + + + description + Wind will affect almost everything + image + MoreWind + title + More Wind + + + description + Clan teams take turns sharing their time + image + TagTeam + title + Tag Team + + + description + Add an indestructible border along the bottom + image + BottomBorder + title + Bottom Border + + + diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/SDL-50560ca58f80.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/SDL-50560ca58f80.patch Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,100 @@ +diff -r 50560ca58f80 Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj +--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Mon Oct 24 23:18:53 2011 -0400 ++++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Tue Oct 25 22:13:19 2011 +0200 +@@ -1596,9 +1596,12 @@ + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DEBUGGING_SYMBOLS = full; ++ GCC_OPTIMIZATION_LEVEL = 0; ++ GCC_THUMB_SUPPORT = NO; ++ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = NO; +- IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; ++ IPHONEOS_DEPLOYMENT_TARGET = 3.0; + ONLY_ACTIVE_ARCH = NO; + PREBINDING = NO; + SDKROOT = iphoneos; +@@ -1613,9 +1616,12 @@ + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; ++ GCC_FAST_MATH = YES; ++ GCC_THUMB_SUPPORT = NO; ++ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = NO; +- IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; ++ IPHONEOS_DEPLOYMENT_TARGET = 3.0; + PREBINDING = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; +diff -r 50560ca58f80 include/SDL_config_iphoneos.h +--- a/include/SDL_config_iphoneos.h Mon Oct 24 23:18:53 2011 -0400 ++++ b/include/SDL_config_iphoneos.h Tue Oct 25 22:13:19 2011 +0200 +@@ -106,7 +106,7 @@ + /* enable iPhone version of Core Audio driver */ + #define SDL_AUDIO_DRIVER_COREAUDIO 1 + /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ +-#define SDL_AUDIO_DRIVER_DUMMY 1 ++#define SDL_AUDIO_DRIVER_DUMMY 0 + + /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ + #define SDL_HAPTIC_DISABLED 1 +@@ -132,16 +132,16 @@ + /* enable OpenGL ES */ + #define SDL_VIDEO_OPENGL_ES 1 + #define SDL_VIDEO_RENDER_OGL_ES 1 +-#define SDL_VIDEO_RENDER_OGL_ES2 1 ++#define SDL_VIDEO_RENDER_OGL_ES2 0 + + /* Enable system power support */ +-#define SDL_POWER_UIKIT 1 ++#define SDL_POWER_UIKIT 0 + + /* enable iPhone keyboard support */ + #define SDL_IPHONE_KEYBOARD 1 + + /* enable joystick subsystem */ +-#define SDL_JOYSTICK_DISABLED 0 ++#define SDL_JOYSTICK_DISABLED 1 + + /* Set max recognized G-force from accelerometer + See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed +diff -r 50560ca58f80 src/video/uikit/SDL_uikitopenglview.m +--- a/src/video/uikit/SDL_uikitopenglview.m Mon Oct 24 23:18:53 2011 -0400 ++++ b/src/video/uikit/SDL_uikitopenglview.m Tue Oct 25 22:13:19 2011 +0200 +@@ -114,8 +114,8 @@ + + // !!! FIXME: use the screen this is on! + /* Use the main screen scale (for retina display support) */ +- if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) +- self.contentScaleFactor = [UIScreen mainScreen].scale; ++ if ([self respondsToSelector:@selector(contentScaleFactor)]) ++ self.contentScaleFactor = [[UIScreen mainScreen] scale]; + + self.autoresizingMask = 0; // don't allow autoresize, since we need to do some magic in -(void)updateFrame. + } +@@ -144,8 +144,8 @@ + + // !!! FIXME: use the screen this is on! + /* Use the main screen scale (for retina display support) */ +- if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) +- self.contentScaleFactor = [UIScreen mainScreen].scale; ++ if ([self respondsToSelector:@selector(contentScaleFactor)]) ++ self.contentScaleFactor = [[UIScreen mainScreen] scale]; + } + + - (void)setCurrentContext +diff -r 50560ca58f80 src/video/uikit/SDL_uikitviewcontroller.m +--- a/src/video/uikit/SDL_uikitviewcontroller.m Mon Oct 24 23:18:53 2011 -0400 ++++ b/src/video/uikit/SDL_uikitviewcontroller.m Tue Oct 25 22:13:19 2011 +0200 +@@ -145,7 +145,7 @@ + frame.origin.x = 0; + frame.origin.y = 0; + +- [uiwindow setFrame:frame]; ++ [uiwindow setFrame:[[UIScreen mainScreen] bounds]]; + [data->view updateFrame]; + SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h); + } diff -r 3f8ba061775e -r 3106add9a5bf project_files/HedgewarsMobile/SDL-91c9a69dd2ad.patch --- a/project_files/HedgewarsMobile/SDL-91c9a69dd2ad.patch Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -diff -r 91c9a69dd2ad Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj ---- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Mon Aug 29 00:27:43 2011 -0400 -+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Mon Aug 29 23:56:04 2011 +0200 -@@ -1596,9 +1596,12 @@ - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_DEBUGGING_SYMBOLS = full; -+ GCC_OPTIMIZATION_LEVEL = 0; -+ GCC_THUMB_SUPPORT = NO; -+ GCC_VERSION = com.apple.compilers.llvmgcc42; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = NO; -- IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; -+ IPHONEOS_DEPLOYMENT_TARGET = 4.0; - ONLY_ACTIVE_ARCH = NO; - PREBINDING = NO; - SDKROOT = iphoneos; -@@ -1613,9 +1616,12 @@ - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = c99; -+ GCC_FAST_MATH = YES; -+ GCC_THUMB_SUPPORT = NO; -+ GCC_VERSION = com.apple.compilers.llvmgcc42; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = NO; -- IPHONEOS_DEPLOYMENT_TARGET = 3.1.3; -+ IPHONEOS_DEPLOYMENT_TARGET = 4.0; - PREBINDING = NO; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; -diff -r 91c9a69dd2ad include/SDL_config_iphoneos.h ---- a/include/SDL_config_iphoneos.h Mon Aug 29 00:27:43 2011 -0400 -+++ b/include/SDL_config_iphoneos.h Mon Aug 29 23:56:04 2011 +0200 -@@ -106,7 +106,7 @@ - /* enable iPhone version of Core Audio driver */ - #define SDL_AUDIO_DRIVER_COREAUDIO 1 - /* Enable the dummy audio driver (src/audio/dummy/\*.c) */ --#define SDL_AUDIO_DRIVER_DUMMY 1 -+#define SDL_AUDIO_DRIVER_DUMMY 0 - - /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ - #define SDL_HAPTIC_DISABLED 1 -@@ -132,14 +132,17 @@ - /* enable OpenGL ES */ - #define SDL_VIDEO_OPENGL_ES 1 - #define SDL_VIDEO_RENDER_OGL_ES 1 --#define SDL_VIDEO_RENDER_OGL_ES2 1 -+#define SDL_VIDEO_RENDER_OGL_ES2 0 - - /* Enable system power support */ --#define SDL_POWER_UIKIT 1 -+#define SDL_POWER_UIKIT 0 - - /* enable iPhone keyboard support */ - #define SDL_IPHONE_KEYBOARD 1 - -+/* enable joystick subsystem */ -+#define SDL_JOYSTICK_DISABLED 1 -+ - /* Set max recognized G-force from accelerometer - See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed - */ -diff -r 91c9a69dd2ad src/video/uikit/SDL_uikitopenglview.m ---- a/src/video/uikit/SDL_uikitopenglview.m Mon Aug 29 00:27:43 2011 -0400 -+++ b/src/video/uikit/SDL_uikitopenglview.m Mon Aug 29 23:56:04 2011 +0200 -@@ -123,8 +123,8 @@ - - // !!! FIXME: use the screen this is on! - /* Use the main screen scale (for retina display support) */ -- if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) -- self.contentScaleFactor = [UIScreen mainScreen].scale; -+ if ([self respondsToSelector:@selector(contentScaleFactor)]) -+ self.contentScaleFactor = [[UIScreen mainScreen] scale]; - - self.autoresizingMask = 0; // don't allow autoresize, since we need to do some magic in -(void)updateFrame. - } -@@ -152,8 +152,8 @@ - - // !!! FIXME: use the screen this is on! - /* Use the main screen scale (for retina display support) */ -- if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) -- self.contentScaleFactor = [UIScreen mainScreen].scale; -+ if ([self respondsToSelector:@selector(contentScaleFactor)]) -+ self.contentScaleFactor = [[UIScreen mainScreen] scale]; - } - - - (void)setCurrentContext { -diff -r 91c9a69dd2ad src/video/uikit/SDL_uikitvideo.m ---- a/src/video/uikit/SDL_uikitvideo.m Mon Aug 29 00:27:43 2011 -0400 -+++ b/src/video/uikit/SDL_uikitvideo.m Mon Aug 29 23:56:04 2011 +0200 -@@ -245,12 +245,8 @@ - const CGRect rect = [uiscreen bounds]; - UIKit_AddDisplay(uiscreen, uiscreenmode, (int)rect.size.width, (int)rect.size.height); - } else { -- const NSArray *screens = [UIScreen screens]; -- const NSUInteger screen_count = [screens count]; -- NSUInteger i; -- for (i = 0; i < screen_count; i++) { -+ for (UIScreen *uiscreen in [UIScreen screens]) { - // the main screen is the first element in the array. -- UIScreen *uiscreen = (UIScreen *) [screens objectAtIndex:i]; - UIScreenMode *uiscreenmode = [uiscreen currentMode]; - const CGSize size = [[uiscreen currentMode] size]; - UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height); -@@ -286,6 +282,9 @@ - UIScreen *uiscreen = (UIScreen *) display->driverdata; - [uiscreen release]; - display->driverdata = NULL; -+ UIScreenMode *desktopmode = (UIScreenMode *) display->desktop_mode.driverdata; -+ [desktopmode release]; -+ display->desktop_mode.driverdata = NULL; - for (j = 0; j < display->num_display_modes; j++) { - SDL_DisplayMode *mode = &display->display_modes[j]; - UIScreenMode *uimode = (UIScreenMode *) mode->driverdata; -diff -r 91c9a69dd2ad src/video/uikit/SDL_uikitviewcontroller.m ---- a/src/video/uikit/SDL_uikitviewcontroller.m Mon Aug 29 00:27:43 2011 -0400 -+++ b/src/video/uikit/SDL_uikitviewcontroller.m Mon Aug 29 23:56:04 2011 +0200 -@@ -138,7 +138,7 @@ - frame.origin.x = 0; - frame.origin.y = 0; - -- [uiwindow setFrame:frame]; -+ [uiwindow setFrame:[[UIScreen mainScreen] bounds]]; - [data->view updateFrame]; - SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h); - } diff -r 3f8ba061775e -r 3106add9a5bf project_files/hedgewars.pro --- a/project_files/hedgewars.pro Fri Oct 28 18:27:55 2011 +0200 +++ b/project_files/hedgewars.pro Fri Oct 28 18:33:38 2011 +0200 @@ -2,6 +2,13 @@ TARGET = hedgewars DEPENDPATH += ../QTfrontend/ INCLUDEPATH += ../QTfrontend/ +INCLUDEPATH += ../QTfrontend/model +INCLUDEPATH += ../QTfrontend/ui +INCLUDEPATH += ../QTfrontend/ui/widget +INCLUDEPATH += ../QTfrontend/ui/page +INCLUDEPATH += ../QTfrontend/ui/dialog +INCLUDEPATH += ../QTfrontend/net +INCLUDEPATH += ../QTfrontend/util INCLUDEPATH += /usr/local/include/SDL INCLUDEPATH += /usr/include/SDL INCLUDEPATH += ../misc/quazip/ @@ -15,110 +22,154 @@ QT += network QT += webkit -HEADERS += ../QTfrontend/KB.h ../QTfrontend/SDLs.h \ - ../QTfrontend/SquareLabel.h ../QTfrontend/about.h \ - ../QTfrontend/ammoSchemeModel.h ../QTfrontend/bgwidget.h \ - ../QTfrontend/binds.h ../QTfrontend/chatwidget.h \ - ../QTfrontend/fpsedit.h ../QTfrontend/frameTeam.h \ - ../QTfrontend/game.h ../QTfrontend/gamecfgwidget.h \ - ../QTfrontend/gameuiconfig.h ../QTfrontend/hats.h \ - ../QTfrontend/hedgehogerWidget.h ../QTfrontend/hwconsts.h \ - ../QTfrontend/hwform.h ../QTfrontend/hwmap.h \ - ../QTfrontend/igbox.h ../QTfrontend/input_ip.h \ - ../QTfrontend/itemNum.h ../QTfrontend/mapContainer.h \ - ../QTfrontend/misc.h ../QTfrontend/namegen.h \ - ../QTfrontend/netregister.h ../QTfrontend/netserver.h \ - ../QTfrontend/netserverslist.h ../QTfrontend/netudpserver.h \ - ../QTfrontend/netudpwidget.h ../QTfrontend/newnetclient.h \ - ../QTfrontend/proto.h \ - ../QTfrontend/sdlkeys.h ../QTfrontend/selectWeapon.h \ - ../QTfrontend/tcpBase.h \ - ../QTfrontend/team.h ../QTfrontend/teamselect.h \ - ../QTfrontend/teamselhelper.h ../QTfrontend/togglebutton.h \ - ../QTfrontend/ui_hwform.h ../QTfrontend/vertScrollArea.h \ - ../QTfrontend/weaponItem.h ../QTfrontend/xfire.h \ - ../QTfrontend/achievements.h \ - ../QTfrontend/drawmapwidget.h \ +HEADERS += ../QTfrontend/model/themesmodel.h \ + ../QTfrontend/model/ammoSchemeModel.h \ + ../QTfrontend/model/netserverslist.h \ + ../QTfrontend/model/hats.h \ + ../QTfrontend/ui/page/pagedrawmap.h \ + ../QTfrontend/ui/page/pagedata.h \ + ../QTfrontend/ui/page/pagetraining.h \ + ../QTfrontend/ui/page/pageselectweapon.h \ + ../QTfrontend/ui/page/pagesingleplayer.h \ + ../QTfrontend/ui/page/pagenettype.h \ + ../QTfrontend/ui/page/pageingame.h \ + ../QTfrontend/ui/page/pageadmin.h \ + ../QTfrontend/ui/page/pagescheme.h \ + ../QTfrontend/ui/page/pagemultiplayer.h \ + ../QTfrontend/ui/page/pageplayrecord.h \ + ../QTfrontend/ui/page/pagemain.h \ + ../QTfrontend/ui/page/pageoptions.h \ + ../QTfrontend/ui/page/pagenetgame.h \ + ../QTfrontend/ui/page/pageeditteam.h \ + ../QTfrontend/ui/page/pageconnecting.h \ + ../QTfrontend/ui/page/pageroomslist.h \ + ../QTfrontend/ui/page/pagenet.h \ + ../QTfrontend/ui/page/pagecampaign.h \ + ../QTfrontend/ui/page/pageinfo.h \ + ../QTfrontend/ui/page/pagenetserver.h \ + ../QTfrontend/ui/page/pagegamestats.h \ + ../QTfrontend/ui/dialog/input_ip.h \ + ../QTfrontend/ui/qaspectratiolayout.h \ + ../QTfrontend/ui/widget/bgwidget.h \ + ../QTfrontend/ui/widget/fpsedit.h \ + ../QTfrontend/ui/widget/FreqSpinBox.h \ + ../QTfrontend/ui/widget/igbox.h \ + ../QTfrontend/ui/widget/chatwidget.h \ + ../QTfrontend/ui/widget/togglebutton.h \ + ../QTfrontend/ui/widget/SquareLabel.h \ + ../QTfrontend/ui/widget/itemNum.h \ + ../QTfrontend/ui/widget/frameTeam.h \ + ../QTfrontend/ui/widget/teamselect.h \ + ../QTfrontend/ui/widget/vertScrollArea.h \ + ../QTfrontend/ui/widget/about.h \ + ../QTfrontend/ui/widget/teamselhelper.h \ + ../QTfrontend/ui/widget/drawmapwidget.h \ + ../QTfrontend/ui/widget/databrowser.h \ + ../QTfrontend/ui/widget/hedgehogerWidget.h \ + ../QTfrontend/ui/widget/selectWeapon.h \ + ../QTfrontend/ui/widget/weaponItem.h \ + ../QTfrontend/ui/widget/gamecfgwidget.h \ + ../QTfrontend/ui/widget/mapContainer.h \ + ../QTfrontend/ui/widget/HistoryLineEdit.h \ + ../QTfrontend/ui/widget/SmartLineEdit.h \ + ../QTfrontend/util/HWDataManager.h \ + ../QTfrontend/net/netregister.h \ + ../QTfrontend/net/netserver.h \ + ../QTfrontend/net/netudpwidget.h \ + ../QTfrontend/net/tcpBase.h \ + ../QTfrontend/net/proto.h \ + ../QTfrontend/net/newnetclient.h \ + ../QTfrontend/net/netudpserver.h \ + ../QTfrontend/net/hwmap.h \ + ../QTfrontend/util/namegen.h \ + ../QTfrontend/ui/page/AbstractPage.h \ ../QTfrontend/drawmapscene.h \ - ../QTfrontend/qaspectratiolayout.h \ - ../QTfrontend/pagetraining.h \ - ../QTfrontend/pagesingleplayer.h \ - ../QTfrontend/pageselectweapon.h \ - ../QTfrontend/pagescheme.h \ - ../QTfrontend/pageroomslist.h \ - ../QTfrontend/pageoptions.h \ - ../QTfrontend/pagenettype.h \ - ../QTfrontend/pagenetserver.h \ - ../QTfrontend/pagenetgame.h \ - ../QTfrontend/pagenet.h \ - ../QTfrontend/pagemultiplayer.h \ - ../QTfrontend/pagemain.h \ - ../QTfrontend/pageingame.h \ - ../QTfrontend/pageinfo.h \ - ../QTfrontend/pagedata.h \ - ../QTfrontend/pageeditteam.h \ - ../QTfrontend/pagedrawmap.h \ - ../QTfrontend/pageconnecting.h \ - ../QTfrontend/pagecampaign.h \ - ../QTfrontend/pageadmin.h \ - ../QTfrontend/pageplayrecord.h \ - ../QTfrontend/pagegamestats.h \ + ../QTfrontend/game.h \ + ../QTfrontend/gameuiconfig.h \ ../QTfrontend/HWApplication.h \ - ../QTfrontend/AbstractPage.h \ - ../QTfrontend/themesmodel.h \ - ../QTfrontend/databrowser.h + ../QTfrontend/hwform.h \ + ../QTfrontend/util/SDLInteraction.h \ + ../QTfrontend/team.h \ + ../QTfrontend/achievements.h \ + ../QTfrontend/binds.h \ + ../QTfrontend/ui_hwform.h \ + ../QTfrontend/KB.h \ + ../QTfrontend/hwconsts.h \ + ../QTfrontend/sdlkeys.h -SOURCES += ../QTfrontend/SDLs.cpp ../QTfrontend/SquareLabel.cpp \ - ../QTfrontend/about.cpp ../QTfrontend/ammoSchemeModel.cpp \ - ../QTfrontend/bgwidget.cpp ../QTfrontend/binds.cpp \ - ../QTfrontend/chatwidget.cpp ../QTfrontend/fpsedit.cpp \ - ../QTfrontend/frameTeam.cpp ../QTfrontend/game.cpp \ - ../QTfrontend/gamecfgwidget.cpp ../QTfrontend/gameuiconfig.cpp \ - ../QTfrontend/hats.cpp ../QTfrontend/hedgehogerWidget.cpp \ - ../QTfrontend/hwform.cpp ../QTfrontend/hwmap.cpp \ - ../QTfrontend/igbox.cpp ../QTfrontend/input_ip.cpp \ - ../QTfrontend/itemNum.cpp ../QTfrontend/main.cpp \ - ../QTfrontend/mapContainer.cpp ../QTfrontend/misc.cpp \ - ../QTfrontend/namegen.cpp ../QTfrontend/netregister.cpp \ - ../QTfrontend/netserver.cpp ../QTfrontend/netserverslist.cpp \ - ../QTfrontend/netudpserver.cpp ../QTfrontend/netudpwidget.cpp \ - ../QTfrontend/newnetclient.cpp \ - ../QTfrontend/proto.cpp \ - ../QTfrontend/selectWeapon.cpp \ - ../QTfrontend/tcpBase.cpp ../QTfrontend/team.cpp \ - ../QTfrontend/teamselect.cpp ../QTfrontend/teamselhelper.cpp \ - ../QTfrontend/togglebutton.cpp ../QTfrontend/ui_hwform.cpp \ - ../QTfrontend/vertScrollArea.cpp ../QTfrontend/weaponItem.cpp \ - ../QTfrontend/achievements.cpp \ - ../QTfrontend/hwconsts.cpp \ - ../QTfrontend/drawmapwidget.cpp \ +SOURCES += ../QTfrontend/model/ammoSchemeModel.cpp \ + ../QTfrontend/model/themesmodel.cpp \ + ../QTfrontend/model/hats.cpp \ + ../QTfrontend/model/netserverslist.cpp \ + ../QTfrontend/ui/qaspectratiolayout.cpp \ + ../QTfrontend/ui/page/pagemain.cpp \ + ../QTfrontend/ui/page/pagetraining.cpp \ + ../QTfrontend/ui/page/pageroomslist.cpp \ + ../QTfrontend/ui/page/pagemultiplayer.cpp \ + ../QTfrontend/ui/page/pagegamestats.cpp \ + ../QTfrontend/ui/page/pagenettype.cpp \ + ../QTfrontend/ui/page/pageeditteam.cpp \ + ../QTfrontend/ui/page/pagenetgame.cpp \ + ../QTfrontend/ui/page/pagedata.cpp \ + ../QTfrontend/ui/page/pagedrawmap.cpp \ + ../QTfrontend/ui/page/pageplayrecord.cpp \ + ../QTfrontend/ui/page/pageselectweapon.cpp \ + ../QTfrontend/ui/page/pageingame.cpp \ + ../QTfrontend/ui/page/pagenetserver.cpp \ + ../QTfrontend/ui/page/pagecampaign.cpp \ + ../QTfrontend/ui/page/pageadmin.cpp \ + ../QTfrontend/ui/page/pageinfo.cpp \ + ../QTfrontend/ui/page/pageconnecting.cpp \ + ../QTfrontend/ui/page/pagesingleplayer.cpp \ + ../QTfrontend/ui/page/pagenet.cpp \ + ../QTfrontend/ui/page/pagescheme.cpp \ + ../QTfrontend/ui/page/pageoptions.cpp \ + ../QTfrontend/ui/dialog/input_ip.cpp \ + ../QTfrontend/ui/widget/igbox.cpp \ + ../QTfrontend/ui/widget/selectWeapon.cpp \ + ../QTfrontend/ui/widget/FreqSpinBox.cpp \ + ../QTfrontend/ui/widget/SquareLabel.cpp \ + ../QTfrontend/ui/widget/frameTeam.cpp \ + ../QTfrontend/ui/widget/fpsedit.cpp \ + ../QTfrontend/ui/widget/databrowser.cpp \ + ../QTfrontend/ui/widget/teamselect.cpp \ + ../QTfrontend/ui/widget/gamecfgwidget.cpp \ + ../QTfrontend/ui/widget/chatwidget.cpp \ + ../QTfrontend/ui/widget/itemNum.cpp \ + ../QTfrontend/ui/widget/bgwidget.cpp \ + ../QTfrontend/ui/widget/about.cpp \ + ../QTfrontend/ui/widget/togglebutton.cpp \ + ../QTfrontend/ui/widget/vertScrollArea.cpp \ + ../QTfrontend/ui/widget/hedgehogerWidget.cpp \ + ../QTfrontend/ui/widget/teamselhelper.cpp \ + ../QTfrontend/ui/widget/drawmapwidget.cpp \ + ../QTfrontend/ui/widget/weaponItem.cpp \ + ../QTfrontend/ui/widget/mapContainer.cpp \ + ../QTfrontend/ui/widget/HistoryLineEdit.cpp \ + ../QTfrontend/ui/widget/SmartLineEdit.cpp \ + ../QTfrontend/util/HWDataManager.cpp \ + ../QTfrontend/net/tcpBase.cpp \ + ../QTfrontend/net/netregister.cpp \ + ../QTfrontend/net/proto.cpp \ + ../QTfrontend/net/hwmap.cpp \ + ../QTfrontend/net/netudpserver.cpp \ + ../QTfrontend/net/newnetclient.cpp \ + ../QTfrontend/net/netudpwidget.cpp \ + ../QTfrontend/net/netserver.cpp \ + ../QTfrontend/util/namegen.cpp \ + ../QTfrontend/ui/page/AbstractPage.cpp \ + ../QTfrontend/achievements.cpp \ + ../QTfrontend/binds.cpp \ ../QTfrontend/drawmapscene.cpp \ - ../QTfrontend/qaspectratiolayout.cpp \ - ../QTfrontend/pagetraining.cpp \ - ../QTfrontend/pagesingleplayer.cpp \ - ../QTfrontend/pageselectweapon.cpp \ - ../QTfrontend/pagescheme.cpp \ - ../QTfrontend/pageroomslist.cpp \ - ../QTfrontend/pageoptions.cpp \ - ../QTfrontend/pagenettype.cpp \ - ../QTfrontend/pagenetserver.cpp \ - ../QTfrontend/pagenetgame.cpp \ - ../QTfrontend/pagenet.cpp \ - ../QTfrontend/pagemultiplayer.cpp \ - ../QTfrontend/pagemain.cpp \ - ../QTfrontend/pageingame.cpp \ - ../QTfrontend/pageinfo.cpp \ - ../QTfrontend/pagedata.cpp \ - ../QTfrontend/pageeditteam.cpp \ - ../QTfrontend/pagedrawmap.cpp \ - ../QTfrontend/pageconnecting.cpp \ - ../QTfrontend/pagecampaign.cpp \ - ../QTfrontend/pageadmin.cpp \ - ../QTfrontend/pagegamestats.cpp \ - ../QTfrontend/pageplayrecord.cpp \ + ../QTfrontend/game.cpp \ + ../QTfrontend/gameuiconfig.cpp \ ../QTfrontend/HWApplication.cpp \ - ../QTfrontend/themesmodel.cpp \ - ../QTfrontend/databrowser.cpp + ../QTfrontend/hwform.cpp \ + ../QTfrontend/main.cpp \ + ../QTfrontend/util/SDLInteraction.cpp \ + ../QTfrontend/team.cpp \ + ../QTfrontend/ui_hwform.cpp \ + ../QTfrontend/hwconsts.cpp win32 { SOURCES += ../QTfrontend/xfire.cpp diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/CMakeLists.txt --- a/share/hedgewars/Data/Graphics/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Graphics/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -4,6 +4,7 @@ add_subdirectory(Hats) add_subdirectory(Hedgehog) add_subdirectory(SuddenDeath) +add_subdirectory(Missions) file(GLOB BaseSprites *.png) list(REMOVE_ITEM BaseSprites *@2x.png) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Hats/scif_swStormtrooper.png Binary file share/hedgewars/Data/Graphics/Hats/scif_swStormtrooper.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Hats/tiara.png Binary file share/hedgewars/Data/Graphics/Hats/tiara.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Graphics/Missions/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +add_subdirectory(Training) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Bazooka.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Bazooka.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Bazooka@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Bazooka@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Shotgun.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Shotgun.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Shotgun@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Shotgun@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Sniper_Rifle.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Sniper_Rifle.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Sniper_Rifle@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/Basic_Training_-_Sniper_Rifle@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Graphics/Missions/Training/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,5 @@ +file(GLOB MissionPics *@2x.png) + +install(FILES + ${MissionPics} + DESTINATION ${SHAREPATH}Data/Graphics/Missions/Training) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Bamboo_Thicket.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Bamboo_Thicket.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Bamboo_Thicket@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Bamboo_Thicket@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Dangerous_Ducklings.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Dangerous_Ducklings.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Dangerous_Ducklings@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Dangerous_Ducklings@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Diver.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Diver.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Diver@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Diver@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Newton_and_the_Hammock.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Newton_and_the_Hammock.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Newton_and_the_Hammock@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Newton_and_the_Hammock@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Spooky_Tree.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Spooky_Tree.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Spooky_Tree@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Spooky_Tree@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Teamwork.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Teamwork.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Teamwork@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_Teamwork@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_That_Sinking_Feeling.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_That_Sinking_Feeling.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_That_Sinking_Feeling@2x.png Binary file share/hedgewars/Data/Graphics/Missions/Training/User_Mission_-_That_Sinking_Feeling@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/RCPlane.png Binary file share/hedgewars/Data/Graphics/RCPlane.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/TARDIS.png Binary file share/hedgewars/Data/Graphics/TARDIS.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Target@2x.png Binary file share/hedgewars/Data/Graphics/Target@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Graphics/Targetp@2x.png Binary file share/hedgewars/Data/Graphics/Targetp@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Locale/CMakeLists.txt --- a/share/hedgewars/Data/Locale/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Locale/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -2,6 +2,7 @@ file(GLOB txttrans5 ?????.txt) file(GLOB tsfiles *.ts) file(GLOB luafiles *.lua) +file(GLOB missionfiles missions_*.txt) QT4_ADD_TRANSLATION(QM ${tsfiles}) @@ -15,6 +16,7 @@ ${txttrans5} ${QM} ${luafiles} + ${missionfiles} DESTINATION ${SHAREPATH}Data/Locale ) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Locale/hedgewars_en.ts --- a/share/hedgewars/Data/Locale/hedgewars_en.ts Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Locale/hedgewars_en.ts Fri Oct 28 18:33:38 2011 +0200 @@ -1170,8 +1170,8 @@ Multiplayer (play a hotseat game against your friends, or AI teams) - Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT - Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT + Training Mode (Practice your skills in a range of training missions) + Training Mode (Practice your skills in a range of training missions) Demos (Watch recorded demos) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Locale/hedgewars_sk.ts --- a/share/hedgewars/Data/Locale/hedgewars_sk.ts Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Locale/hedgewars_sk.ts Fri Oct 28 18:33:38 2011 +0200 @@ -2136,11 +2136,11 @@ Tag Team - OznaÄit tím + Tag Team Add Bottom Border - + PridaÅ¥ spodný okraj diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Locale/missions_de.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Locale/missions_de.txt Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,32 @@ +Basic_Training_-_Bazooka.name=Training: Bazooka - Grundlagen +Basic_Training_-_Bazooka.desc="Nutze den Wind zu deinem Vorteil aus!" + +Basic_Training_-_Grenade.name=Training: Granate - Grundlagen +Basic_Training_-_Grenade.desc="Vergiss nicht: Stift ziehen UND werfen!" + +Basic_Training_-_Shotgun.name=Training: Schrotflinte - Grundlagen +Basic_Training_-_Shotgun.desc="Zuerst schießen, dann fragen!" + +Basic_Training_-_Sniper_Rifle.name=Training: Scharfschützengewehr - Grundlagen +Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!" + +User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings +User_Mission_-_Dangerous_Ducklings.desc="Nun gut, Rekrut! Es ist Zeit, dass du das im Grundlagentraining gelernte in die Tag umsetzt!" + +User_Mission_-_Diver.name=Mission: Taucher +User_Mission_-_Diver.desc="Diese amphibische Angriffstrategie ist schwieriger als sie aussieht." + +User_Mission_-_Teamwork.name=Mission: Teamwork +User_Mission_-_Teamwork.desc="Ab und zu... tut Liebe weh." + +User_Mission_-_Spooky_Tree.name=Mission: Spukiger Baum +User_Mission_-_Spooky_Tree.desc="Viele Kisten hier draußen. Ich hoffe jedenfalls, dass dieser Vogel hier nicht hungrig wird." + +User_Mission_-_Bamboo_Thicket.name=Mission: Bambusdickicht +User_Mission_-_Bamboo_Thicket.desc="Tod von oben." + +User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling +User_Mission_-_That_Sinking_Feeling.desc="Hier steht einen das Wasser ganz schön schnell bis zu Hals. Viele sind hieran gescheitert. Kannst du alle Igel retten?" + +User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton und die Hängematte +User_Mission_-_Newton_and_the_Hammock.desc="Nicht vergessen Igelinge: Die Geschwindigkeit eines Körpers bleibt konstant, es sei denn es wirkt eine äußere Kraft wird auf ihn ein! diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Locale/missions_en.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Locale/missions_en.txt Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,32 @@ +Basic_Training_-_Bazooka.name=Basic Bazooka Training +Basic_Training_-_Bazooka.desc="Using the wind to your advantage is key!" + +Basic_Training_-_Grenade.name=Basic Grenade Training +Basic_Training_-_Grenade.desc="Remember, you pull the pin out AND throw!" + +Basic_Training_-_Shotgun.name=Basic Shotgun Training +Basic_Training_-_Shotgun.desc="Shoot first, ask questions later!" + +Basic_Training_-_Sniper_Rifle.name=Basic Sniper Rifle Training +Basic_Training_-_Sniper_Rifle.desc="Boom, headshot!" + +User_Mission_-_Dangerous_Ducklings.name=Mission: Dangerous Ducklings +User_Mission_-_Dangerous_Ducklings.desc="Alright, rookie! Time to put what we learned in Basic Training into practice!" + +User_Mission_-_Diver.name=Mission: Diver +User_Mission_-_Diver.desc="This 'amphibious assault' thing is harder than it looks..." + +User_Mission_-_Teamwork.name=Mission: Teamwork +User_Mission_-_Teamwork.desc="Sometimes, love hurts." + +User_Mission_-_Spooky_Tree.name=Mission: Spooky Tree +User_Mission_-_Spooky_Tree.desc="Lots of crates out here. I sure hope that bird ain't feeling hungry." + +User_Mission_-_Bamboo_Thicket.name=Mission: Bamboo Thicket +User_Mission_-_Bamboo_Thicket.desc="Death comes from above." + +User_Mission_-_That_Sinking_Feeling.name=Mission: That Sinking Feeling +User_Mission_-_That_Sinking_Feeling.desc="The water is rising rapidly and time is limited. Many have tried and failed. Can you save them all?" + +User_Mission_-_Newton_and_the_Hammock.name=Mission: Newton and the Hammock +User_Mission_-_Newton_and_the_Hammock.desc="Remember hoglets: The velocity of a body remains constant unless the body is acted upon by an external force!" diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Locale/sk.lua --- a/share/hedgewars/Data/Locale/sk.lua Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Locale/sk.lua Fri Oct 28 18:33:38 2011 +0200 @@ -5,54 +5,54 @@ ["Accuracy Bonus!"] = "Bonus za presnosÅ¥!", ["a Hedgewars mini-game"] = "minihra Hedgewars", -- Space_Invasion, The_Specialists ["Aiming Practice"] = "Tréning presnosti", --Bazooka, Shotgun, SniperRifle - ["Ammo"] = "Munícia", - ["Ammo Depleted!"] = "Munícia vyÄerpaná!", - ["Ammo Maniac!"] = "MuniÄný maniak!", + ["Ammo"] = "Výzbroj", + ["Ammo Depleted!"] = "Výzbroj vyÄerpaná!", +-- ["Ammo Maniac!"] = "", ["Available points remaining: "] = "Zostávajúci poÄet bodov: ", ["Bat balls at your enemies and|push them into the sea!"] = "Loptami triafajte vaÅ¡ich nepriateľov|a zhoÄte ich tak do mora!", - ["Bat your opponents through the|baskets and out of the map!"] = "Odpálkujte vaÅ¡ich súperov cez kôš|von z mapy!", + ["Bat your opponents through the|baskets and out of the map!"] = "Odpálkujte vaÅ¡ich súperov do koÅ¡a|a von z mapy!", ["Bazooka Training"] = "Tréning s bazukou", ["Best laps per team: "] = "NajrýchlejÅ¡ie kolá podľa tímov: ", - ["Best Team Times: "] = "NajlepÅ¡ie tímové Äasy: ", + ["Best Team Times: "] = "NajrýchlejÅ¡ie tímové Äasy: ", ["Bloody Rookies"] = "Mizerní zelenáÄi", -- 01#Boot_Camp, User_Mission_-_Dangerous_Ducklings, User_Mission_-_Diver, User_Mission_-_Spooky_Tree ["BOOM!"] = "BUM!", ["Boom!"] = "Bum!", ["Boss defeated!"] = "Vodca bol porazený!", - ["Boss Slayer!"] = "Vodca zabitý!", +-- ["Boss Slayer!"] = "", ["CAPTURE THE FLAG"] = "ZMOCNITE SA VLAJKY", - ["Careless"] = "Neopatrný", + ["Careless"] = "Bezstarostný", ["Clumsy"] = "NeÅ¡ikovný", - ["Codename: Teamwork"] = "Krycie meno: Tímová práca", - ["Complete the track as fast as you can!"] = "DokonÄite trasu tak rýchlo, ako len viete! ", + ["Codename: Teamwork"] = "Kódové meno: Tímová práca", +-- ["Complete the track as fast as you can!"] = "", ["Congratulations!"] = "Gratulujem!", ["Congratulations! You've eliminated all targets|within the allowed time frame."] = "Gratulujem! ZneÅ¡kodnili ste vÅ¡etky ciele|v stanovenom Äase.", --Bazooka, Shotgun, SniperRifle - ["Control pillars to score points."] = "ObsaÄte piliere, aby ste skórovali", + ["Control pillars to score points."] = "Ovládnite piliere, aby ste skórovali", ["Cybernetic Empire"] = "Kybertnetické impérium", ["DAMMIT, ROOKIE! GET OFF MY HEAD!"] = "Do kelu s tebou, zelenáÄ! Okamžite mi zlez z hlavy!", ["DAMMIT, ROOKIE!"] = "Prekliaty zelenáÄ!", ["Dangerous Ducklings"] = "NebezpeÄné kaÄiatka", - ["Deadweight"] = "MÅ•tva váha", - ["Depleted Kamikaze!"] = "VyÄerpaný samovrah!", - ["Destroy invaders to score points."] = "ZniÄte votrelcov a získajte tak body.", - ["Drone Hunter!"] = "Lovec vÄeliakov!", - ["Drowner"] = "Utopenec", - ["Each turn you get 1-3 random weapons"] = "Každé kolo získate 1-3 náhodných zbraní", - ["Each turn you get one random weapon"] = "Každé kolo získate jednu náhodnú zbraň", +-- ["Deadweight"] = "", +-- ["Depleted Kamikaze!"] = "", +-- ["Destroy invaders to score points."] = "", +-- ["Drone Hunter!"] = "", +-- ["Drowner"] = "", +-- ["Each turn you get 1-3 random weapons"] = "", + ["Each turn you get one random weapon"] = "Každé koho dostanete jednu náhodnú zbraň", ["Eliminate all enemies"] = "ZneÅ¡kodnite vÅ¡etkých nepriateľov", ["Eliminate all targets before your time runs out.|You have unlimited ammo for this mission."] = "ZneÅ¡kodnite vÅ¡etky ciele pred vyprÅ¡aním Äasu.|Na túto misiu máte neobmedzené množstvo streliva.", --Bazooka, Shotgun, SniperRifle ["Eliminate Poison before the time runs out"] = "ZneÅ¡kodnite Poisona pred tým, ako vyprší Äas", ["Eliminate the Blue Team"] = "ZneÅ¡kodnite modrý tím", - ["Eliminate the enemy specialists."] = "ZneÅ¡kodnite nepriateľských Å¡pecialistov.", +-- ["Eliminate the enemy specialists."] = "", ["- Eliminate Unit 3378 |- Feeble Resistance must survive"] = "- ZneÅ¡kodnite Jednotku 3378|- Slabý odpor musí prežiÅ¥", ["Enjoy the swim..."] = "Užite si plávanie...", - ["[Enter]"] = "[Enter]", +-- ["[Enter]"] = "", ["Fastest lap: "] = "NajrýchlejÅ¡ie kolo: ", ["Feeble Resistance"] = "Slabý odpor", - ["Fire"] = "Oheň", +-- ["Fire"] = "", ["Flag captured!"] = "Získaná vlajka!", ["Flag respawned!"] = "Vlajka obnovená!", ["Flag returned!"] = "Vlajka vrátená!", - ["Flags, and their home base will be placed where each team ends their first turn."] = "Vlajky a domovské základne budú umiestnené tam, kde každý tím skonÄí svoj prvý Å¥ah.", +-- ["Flags, and their home base will be placed where each team ends their first turn."] = "", ["GAME BEGUN!!!"] = "HRA ZAÄŒALA!!!", ["Game Modifiers: "] = "Modifikátory hry: ", ["GAME OVER!"] = "KONIEC HRY!", @@ -64,41 +64,41 @@ ["Good luck out there!"] = "Veľa Å¡Å¥astia!", ["GOTCHA!"] = "A MÃM ŤA!", ["Hahahaha!"] = "Hehehehe!", - ["Haha, now THAT would be something!"] = "Haha, tak TOTO bude nieÄo!", - ["Hapless Hogs"] = "NeÅ¡Å¥astný ježko", - [" Hapless Hogs left!"] = " NeÅ¡Å¥astný ježko odiÅ¡iel!", + ["Haha, now THAT would be something!"] = "Haha, tak TO by bolo nieÄo!", +-- ["Hapless Hogs"] = "", +-- [" Hapless Hogs left!"] = "", ["Heavy"] = "Ťažký", ["Hedgewars-Basketball"] = "Hedgewars-Basketbal", - ["Hedgewars-Knockball"] = "Hedgewars-Vybíjaná", + ["Hedgewars-Knockball"] = "Hedgewars-Knockball", ["Heh, it's not that bad."] = "Heh, to nie je také zlé.", - ["Hit Combo!"] = "Opakovaný zásah!", +-- ["Hit Combo!"] = "", ["Hmmm..."] = "Hmm..", ["Hooray!"] = "Hurá!", ["Hunter"] = "Lovec", --Bazooka, Shotgun, SniperRifle ["Instructor"] = "InÅ¡truktor", -- 01#Boot_Camp, User_Mission_-_Dangerous_Ducklings - ["invaders destroyed"] = "votrelci zniÄení", - ["It's a good thing SUDDEN DEATH is 99 turns away..."] = "Je dobré, že NÃHLA SMRŤ je tu až za 99 Å¥ahov...", - ["Jumping is disabled"] = "Skákanie je vypnuté", - ["Kamikaze Expert!"] = "Expert na samovraždy!", +-- ["invaders destroyed"] = "", +-- ["It's a good thing SUDDEN DEATH is 99 turns away..."] = "", +-- ["Jumping is disabled"] = "", +-- ["Kamikaze Expert!"] = "", ["KILLS"] = "ZABITÃ:", ["[Left Shift]"] = "[Ľavý Shift]", ["Listen up, maggot!!"] = "PoÄúvaj, ty biedny Äerv!", ["|- Mines Time:"] = "|- ÄŒasovaÄ pre míny:", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork ["MISSION FAILED"] = "MISIA NEÚSPEÅ NÃ", -- User_Mission_-_Dangerous_Ducklings, User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork - ["MISSION SUCCESS"] = "MISIA ÚSPEÅ NÃ", +-- ["MISSION SUCCESS"] = "", ["MISSION SUCCESSFUL"] = "MISIA ÚSPEÅ NÃ", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork ["Movement: [Up], [Down], [Left], [Right]"] = "Pohyb: [Hore], [Dole], [Vľavo], [Vpravo]", - ["Multi-shot!"] = "Opakovaná rana!", +-- ["Multi-shot!"] = "", ["Nameless Heroes"] = "Hrdinovia bez mena", ["NEW CLAN RECORD: "] = "NOVà KLANOVà REKORD: ", ["NEW fastest lap: "] = "NOVÉ najrýchlejÅ¡ie kolo: ", - ["NEW RACE RECORD: "] = "NOVà TRAŤOVà REKORD: ", - ["NOT ENOUGH WAYPOINTS"] = "NEDOSTATOK NAVIGAÄŒNÃCH BODOV", +-- ["NEW RACE RECORD: "] = "", +-- ["NOT ENOUGH WAYPOINTS"] = "", ["Not So Friendly Match"] = "Nie tak celkom priateľský zápas", -- Basketball, Knockball ["Oh no! Just try again!"] = "Ãále nie! Tak to skúste znovu!", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork ["Oh no! Time's up! Just try again."] = "Ãále nie! ÄŒas vyprÅ¡al! Tak to skúste znovu.", --Bazooka, Shotgun, SniperRifle ["Operation Diver"] = "Operácia PotápaÄ", - ["Opposing Team: "] = "Nepriateľský tím: ", + ["Opposing Team: "] = "Nepriateľský tím", ["Pathetic Hog #%d"] = "Žalostný ježko #%d", ["Per-Hog Ammo"] = "Samostatná munícia pre ježkov", ["Place more waypoints using [ENTER]"] = "Umiesnite viac bodov pomocou [ENTER]u", @@ -106,13 +106,13 @@ ["Poison"] = "Poison", ["Power Remaining"] = "Zostáva energie", ["Press [Precise] to skip intro"] = "StlaÄte [PresnejÅ¡ie mierenie] pre preskoÄenie intra", - ["Race complexity limit reached."] = "Dosiahnutý limit zložitosti pretekov.", - [" - Return the enemy flag to your base to score | - First team to 3 captures wins | - You may only score when your flag is in your base | - Hogs will drop the flag if killed, or drowned | - Dropped flags may be returned or recaptured | - Hogs respawn when killed"] = " - Skórujete prinesením nepriateľskej vlajky do vaÅ¡ej základne | - Prvý tím, ktorý dosiahne 3 body, vyhráva | - Skórujete len vtedy, keÄ je máte svoju vlajku v základni | - Spadnuté vlajky môžu byÅ¥ vrátené na základňu alebo sa ich môže zmocniÅ¥ súper | - Ježkovia po smrti ožijú", - ["Round Limit"] = "Limit kôl", +-- ["Race complexity limit reached."] = "", + [" - Return the enemy flag to your base to score | - First team to 3 captures wins | - You may only score when your flag is in your base | - Hogs will drop the flag if killed, or drowned | - Dropped flags may be returned or recaptured | - Hogs respawn when killed"] = " - Skórujete prinesením nepriateľskej vlajky do vaÅ¡ej základne | - Prvý tím, ktorý dosiahne 3 body, vyhráva | - Skórujete len vtedy, keÄ je máte svoju vlajku v základni | - Spadnuté vlajky môžu byÅ¥ vrátené na základňu alebo sa ich môže zmocniÅ¥ súpere | - Ježkovia po smrti ožiujú", + ["Round Limit"] = "Limit na kolo", ["Rounds Complete"] = "DokonÄených kôl", ["RULES OF THE GAME [Press ESC to view]"] = "PRAVIDLà HRY [StlaÄte Esc pre ich zobrazenie]", - ["s|"] = "s|", - ["Save as many hapless hogs as possible!"] = "Zachráňte toľko neÅ¡Å¥astných ježkov, koľko len môžete!", +-- ["s|"] = "", +-- ["Save as many hapless hogs as possible!"] = "", ["SCORE"] = "SKÓRE", ["sec"] = "sek", -- CTF_Blizzard, TrophyRace, Basic_Training_-_Bazooka, Basic_Training_-_Shotgun, Basic_Training_-_Sniper_Rifle, User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork, Capture_the_Flag ["See ya!"] = "Tak zatiaľ!", @@ -120,56 +120,56 @@ ["Shield boosted! +30 power"] = "Å tít posilnený! Energia +30", ["Shield Depleted"] = "Å tít vyÄerpaný", ["Shield is fully recharged!"] = "Å tít je plne nabitý!", - ["Shield Master!"] = "Å títový odborník", - ["Shield Miser!"] = "Å títový žgrloÅ¡", +-- ["Shield Master!"] = "", +-- ["Shield Miser!"] = "", ["Shield OFF:"] = "Å tít VYPNUTÃ:", ["Shield ON:"] = "Å tít ZAPNUTÃ:", ["Shield Seeker!"] = "HľadaÄ Å¡títov!", - ["Shotgun Team"] = "Tím s brokovnicou", + ["Shotgun Team"] = "Shotgun tím", ["Shotgun Training"] = "Tréning s brokovnicou", ["Shots Left: "] = "Zostáva striel: ", -- GaudyRacer, Tumbler - ["Silly"] = "Hlúpy", - ["Sinky"] = "Prepadnutý", +-- ["Silly"] = "", +-- ["Sinky"] = "", ["%s is out and Team %d|scored a penalty!| |Score:"] = "%s je mimo hru a tím %d|dostal trestný bod!| |Skóre:", -- Basketball, Knockball ["%s is out and Team %d|scored a point!| |Score:"] = "%s je mimo hru a tím %d|získal bod!| |Skóre:", -- Basketball, Knockball ["Sniper Training"] = "Tréning pre ostreľovaÄov", ["Sniperz"] = "OstreľovaÄi", - ["Sponge"] = "Å pongia", +-- ["Sponge"] = "", ["Spooky Tree"] = "StraÅ¡idelný strom", - ["STATUS UPDATE"] = "AKTUALIZÃCIA STAVU", -- GaudyRacer, Space_Invasion - ["Switched to "] = "Prepnutý na ", +-- ["STATUS UPDATE"] = "", -- GaudyRacer, Space_Invasion + ["Switched to "] = "Prepnuté na ", ["Team %d: "] = "Tím %d: ", - ["Team Scores"] = "Tímové skóre", -- Control, Space_Invasion - ["That Sinking Feeling"] = "Potopené pocity", +-- ["Team Scores"] = "", -- Control, Space_Invasion +-- ["That Sinking Feeling"] = "", ["That was pointless."] = "To bolo zbytoÄné.", ["The enemy is hiding out on yonder ducky!"] = "Nepriateľ sa schováva na tamtej kaÄiÄke!", ["The flag will respawn next round."] = "V ÄalÅ¡om kole sa obnoví vlajka.", - ["The Nameless One"] = "Bez mena", +-- ["The Nameless One"] = "", ["THE SPECIALISTS"] = "Å PECIALISTI", ["This rain is really something..."] = "Ten dÃ¡Å¾Ä naozaj stojí za to...", ["TIME: "] = "ÄŒAS: ", - ["Timed Kamikaze!"] = "ÄŒasovaná samovražda!", +-- ["Timed Kamikaze!"] = "", ["Time Extended!"] = "Predĺžený Äas!", ["Time Left: "] = "Zostávajúci Äas: ", ["Toggle Shield"] = "Prepnúť Å¡tít", - ["Toxic Team"] = "Jedovatý tím", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork - ["TRACK COMPLETED"] = "TRASA KOMPLETNÃ", - ["Track Time: "] = "ÄŒas na trati: ", + ["Toxic Team"] = "Toxic tím", -- User_Mission_-_Diver, User_Mission_-_Spooky_Tree, User_Mission_-_Teamwork +-- ["TRACK COMPLETED"] = "", + ["Track Time: "] = "ÄŒas: ", ["TrophyRace"] = "Preteky o trofej", ["T_T"] = "T_T", ["Turn Time"] = "ÄŒas na Å¥ah", ["Unit 3378"] = "Jednotka 3378", ["Unlimited Attacks"] = "Neobmedzené útoky", - ["User Challenge"] = "Výzva", +-- ["User Challenge"] = "", ["Use your rope to get from start to finish as fast as you can!"] = "Použite lano na presun zo Å¡tartovnej pozície do cieľa tak rýchlo, ako to len viete!", ["v.06"] = "v.06", ["Victory for the "] = "Víťazstvo pre", -- CTF_Blizzard, Capture_the_Flag - ["Waypoint placed."] = "NavigaÄný bod umiestnený.", - ["Weapons Reset"] = "Zbrane obnovené", - ["WINNING TIME: "] = "VÃŤAZNà ČAS: ", - ["You'd almost swear the water was rising!"] = "Prisahali by ste, že voda stúpala!", +-- ["Waypoint placed."] = "", +-- ["Weapons Reset"] = "", + ["WINNING TIME: "] = "ÄŒAS PRE VÃŤAZSTVO: ", +-- ["You'd almost swear the water was rising!"] = "", ["You have SCORED!!"] = "SKÓROVALI ste!!", - ["You saved"] = "Uložili ste", + ["You saved"] = "Zachránili ste", ["You've failed. Try again."] = "Neuspeli ste. Skúste to znova.", ["You've reached the goal!| |Time: "] = "Dosiahli ste cieľ!| |ÄŒas: ", ["'Zooka Team"] = "Bazuka tím", diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Basketball/mask.png Binary file share/hedgewars/Data/Maps/Basketball/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Battlefield/CMakeLists.txt --- a/share/hedgewars/Data/Maps/Battlefield/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/Battlefield/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/Battlefield) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Battlefield/mask.png Binary file share/hedgewars/Data/Maps/Battlefield/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Blizzard/mask.png Binary file share/hedgewars/Data/Maps/Blizzard/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Blox/CMakeLists.txt --- a/share/hedgewars/Data/Maps/Blox/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/Blox/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/Blox) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Blox/mask.png Binary file share/hedgewars/Data/Maps/Blox/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Cake/CMakeLists.txt --- a/share/hedgewars/Data/Maps/Cake/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/Cake/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/Cake) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Cake/mask.png Binary file share/hedgewars/Data/Maps/Cake/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Castle/CMakeLists.txt --- a/share/hedgewars/Data/Maps/Castle/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/Castle/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/Castle) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Castle/mask.png Binary file share/hedgewars/Data/Maps/Castle/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Cave/CMakeLists.txt --- a/share/hedgewars/Data/Maps/Cave/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/Cave/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/Cave) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Cave/mask.png Binary file share/hedgewars/Data/Maps/Cave/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Cheese/CMakeLists.txt --- a/share/hedgewars/Data/Maps/Cheese/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/Cheese/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/Cheese) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Cheese/mask.png Binary file share/hedgewars/Data/Maps/Cheese/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/EarthRise/CMakeLists.txt --- a/share/hedgewars/Data/Maps/EarthRise/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/EarthRise/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/EarthRise) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/EarthRise/mask.png Binary file share/hedgewars/Data/Maps/EarthRise/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/HedgeFortress/CMakeLists.txt --- a/share/hedgewars/Data/Maps/HedgeFortress/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/HedgeFortress/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/HedgeFortress) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/HedgeFortress/mask.png Binary file share/hedgewars/Data/Maps/HedgeFortress/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Lonely_Island/CMakeLists.txt --- a/share/hedgewars/Data/Maps/Lonely_Island/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Maps/Lonely_Island/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -1,5 +1,6 @@ install(FILES map.png + mask.png map.cfg preview.png DESTINATION ${SHAREPATH}Data/Maps/Lonely_Island) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/Lonely_Island/mask.png Binary file share/hedgewars/Data/Maps/Lonely_Island/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Maps/TrophyRace/mask.png Binary file share/hedgewars/Data/Maps/TrophyRace/mask.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/BlueCap.cfg --- a/share/hedgewars/Data/Names/BlueCap.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/BlueHair.cfg --- a/share/hedgewars/Data/Names/BlueHair.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/BrainSlug.cfg --- a/share/hedgewars/Data/Names/BrainSlug.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -brainslug diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/BrainSlugMouth.cfg --- a/share/hedgewars/Data/Names/BrainSlugMouth.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -brainslug diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/Bunny.cfg --- a/share/hedgewars/Data/Names/Bunny.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/GreenCap.cfg --- a/share/hedgewars/Data/Names/GreenCap.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/GreenHair.cfg --- a/share/hedgewars/Data/Names/GreenHair.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/GreyHair.cfg --- a/share/hedgewars/Data/Names/GreyHair.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/KirbyMask.cfg --- a/share/hedgewars/Data/Names/KirbyMask.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/OrangeHair.cfg --- a/share/hedgewars/Data/Names/OrangeHair.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/PinkHair.cfg --- a/share/hedgewars/Data/Names/PinkHair.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/PurpleHair.cfg --- a/share/hedgewars/Data/Names/PurpleHair.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/RedCap.cfg --- a/share/hedgewars/Data/Names/RedCap.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/RedHair.cfg --- a/share/hedgewars/Data/Names/RedHair.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/Ryu.cfg --- a/share/hedgewars/Data/Names/Ryu.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/Sonic.cfg --- a/share/hedgewars/Data/Names/Sonic.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/YellowCap.cfg --- a/share/hedgewars/Data/Names/YellowCap.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/YellowHair.cfg --- a/share/hedgewars/Data/Names/YellowHair.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/apple.cfg --- a/share/hedgewars/Data/Names/apple.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -apple -fruit diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/banana.cfg --- a/share/hedgewars/Data/Names/banana.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -banana -fruit diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/cap_blue.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/cap_blue.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/cap_green.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/cap_green.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/cap_red.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/cap_red.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/cap_yellow.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/cap_yellow.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/cyborg.cfg --- a/share/hedgewars/Data/Names/cyborg.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/cyborg1.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/cyborg1.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/darthvader.cfg --- a/share/hedgewars/Data/Names/darthvader.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/fr_apple.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/fr_apple.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,2 @@ +apple +fruit diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/fr_banana.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/fr_banana.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,2 @@ +banana +fruit diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/fr_lemon.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/fr_lemon.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,2 @@ +lemon +fruit diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/fr_orange.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/fr_orange.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,2 @@ +orange +fruit diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/hair_blue.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/hair_blue.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/hair_green.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/hair_green.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/hair_grey.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/hair_grey.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/hair_orange.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/hair_orange.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/hair_pink.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/hair_pink.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/hair_purple.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/hair_purple.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/hair_red.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/hair_red.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/hair_yellow.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/hair_yellow.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/lemon.cfg --- a/share/hedgewars/Data/Names/lemon.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -lemon -fruit diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/mv_Venom.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/mv_Venom.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/ntd_Kirby.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/ntd_Kirby.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/orange.cfg --- a/share/hedgewars/Data/Names/orange.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -orange -fruit diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/poke_slowpoke.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/poke_slowpoke.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/scif_BrainSlug.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/scif_BrainSlug.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +brainslug diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/scif_BrainSlug2.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/scif_BrainSlug2.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +brainslug diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/scif_swDarthvader.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/scif_swDarthvader.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/scif_swStormtrooper.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/scif_swStormtrooper.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/sf_ryu.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/sf_ryu.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/slowpoke.cfg --- a/share/hedgewars/Data/Names/slowpoke.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/sth_Sonic.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/sth_Sonic.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/stormtrooper.cfg --- a/share/hedgewars/Data/Names/stormtrooper.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/venom.cfg --- a/share/hedgewars/Data/Names/venom.cfg Fri Oct 28 18:27:55 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Names/zoo_Bunny.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Names/zoo_Bunny.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1 @@ +generic diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Bamboo/SkyR.png Binary file share/hedgewars/Data/Themes/Bamboo/SkyR.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Blox/LandBackTex.png Binary file share/hedgewars/Data/Themes/Blox/LandBackTex.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/CMakeLists.txt --- a/share/hedgewars/Data/Themes/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/share/hedgewars/Data/Themes/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -5,6 +5,7 @@ Blox Brick Cake + Cave Castle Cheese Christmas diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cake/LandBackTex.png Binary file share/hedgewars/Data/Themes/Cake/LandBackTex.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Border.png Binary file share/hedgewars/Data/Themes/Cave/Border.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Border.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Border.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,89 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,6 @@ +file(GLOB images *.png) + +install(FILES + theme.cfg + ${images} + DESTINATION ${SHAREPATH}Data/Themes/Cave) diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Chunk.png Binary file share/hedgewars/Data/Themes/Cave/Chunk.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Chunk.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Chunk.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,202 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Crystal01.png Binary file share/hedgewars/Data/Themes/Cave/Crystal01.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Crystal01.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Crystal01.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,461 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Crystal02.png Binary file share/hedgewars/Data/Themes/Cave/Crystal02.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Crystal02.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Crystal02.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,411 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/CrystalSpray01.png Binary file share/hedgewars/Data/Themes/Cave/CrystalSpray01.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/CrystalSpray01.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/CrystalSpray01.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,453 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/CrystalSpray02.png Binary file share/hedgewars/Data/Themes/Cave/CrystalSpray02.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/CrystalSpray02.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/CrystalSpray02.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,406 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/CrystalSpray03.png Binary file share/hedgewars/Data/Themes/Cave/CrystalSpray03.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/CrystalSpray03.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/CrystalSpray03.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,358 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Flake.png Binary file share/hedgewars/Data/Themes/Cave/Flake.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Flake.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Flake.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,89 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Girder.png Binary file share/hedgewars/Data/Themes/Cave/Girder.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Girder.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Girder.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,83 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/LandBackTex.png Binary file share/hedgewars/Data/Themes/Cave/LandBackTex.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/LandTex.png Binary file share/hedgewars/Data/Themes/Cave/LandTex.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/LandTex.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/LandTex.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,3146 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/README Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,4 @@ +Theme "Cave" +Copyright 2011 Guillaume Englert +Distributed under the terms of the GNU FDL licence. + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Sky.png Binary file share/hedgewars/Data/Themes/Cave/Sky.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Sky.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Sky.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,1147 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/SkyL.png Binary file share/hedgewars/Data/Themes/Cave/SkyL.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Stalactite.png Binary file share/hedgewars/Data/Themes/Cave/Stalactite.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Stalactite.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Stalactite.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,273 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Stalagmite01.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite01.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Stalagmite01.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Stalagmite01.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,355 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Stalagmite02.png Binary file share/hedgewars/Data/Themes/Cave/Stalagmite02.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/Stalagmite02.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/Stalagmite02.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,269 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/horizont.png Binary file share/hedgewars/Data/Themes/Cave/horizont.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/horizont.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/horizont.svg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,368 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/icon.png Binary file share/hedgewars/Data/Themes/Cave/icon.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/icon.xcf Binary file share/hedgewars/Data/Themes/Cave/icon.xcf has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/icon@2x.png Binary file share/hedgewars/Data/Themes/Cave/icon@2x.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Cave/theme.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/share/hedgewars/Data/Themes/Cave/theme.cfg Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,16 @@ +sky = 17, 18, 24 +border = 129, 135, 173 +water-top = $54, $5C, $9D +water-bottom = $34, $3C, $7D +water-opacity = $60 +music = snow.ogg +clouds = 0 +object = Stalagmite01, 3, 5, 258, 100, 2, 1, 19, 0, 67, 173 +object = Stalagmite02, 3, 1, 159, 62, 3, 1, 11, 0, 45, 119 +object = Stalactite, 3, 0, 0, 55, 2, 1, 12, 61, 32, 79 +object = Crystal01, 3, 21, 258, 113, 2, 1, 0, 0, 165, 245 +object = Crystal02, 3, 16, 129, 57, 3, 1, 0, 0, 84, 124 +spray = CrystalSpray01, 2 +spray = CrystalSpray02, 3 +spray = CrystalSpray03, 4 +flakes = 8, 2, 99999999, 0, 1700 diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Christmas/amGirder.png Binary file share/hedgewars/Data/Themes/Christmas/amGirder.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/CrazyMission/SkyR.png Binary file share/hedgewars/Data/Themes/CrazyMission/SkyR.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/EarthRise/SkyR.png Binary file share/hedgewars/Data/Themes/EarthRise/SkyR.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Golf/SkyR.png Binary file share/hedgewars/Data/Themes/Golf/SkyR.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Halloween/SkyR.png Binary file share/hedgewars/Data/Themes/Halloween/SkyR.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Jungle/SkyR.png Binary file share/hedgewars/Data/Themes/Jungle/SkyR.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Sheep/SkyR.png Binary file share/hedgewars/Data/Themes/Sheep/SkyR.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Snow/amGirder.png Binary file share/hedgewars/Data/Themes/Snow/amGirder.png has changed diff -r 3f8ba061775e -r 3106add9a5bf share/hedgewars/Data/Themes/Stage/SkyR.png Binary file share/hedgewars/Data/Themes/Stage/SkyR.png has changed diff -r 3f8ba061775e -r 3106add9a5bf tools/CMakeLists.txt --- a/tools/CMakeLists.txt Fri Oct 28 18:27:55 2011 +0200 +++ b/tools/CMakeLists.txt Fri Oct 28 18:33:38 2011 +0200 @@ -32,9 +32,11 @@ string(REGEX REPLACE "(.*);-.*" "\\1" sdl_dir "${SDL_LIBRARY}") #this tool is present in qt 4.5 but only if you compile from sources; from qt 4.6 is present also in the binary version - find_program(macdeployqt_EXE NAMES macdeployqt macdeployqt-mac PATHS ${qt_base_dir}/bin NO_DEFAULT_PATH) + find_program(macdeployqt_EXE NAMES macdeployqt macdeployqt-mac PATHS ${qt_base_dir}/bin) if(NOT macdeployqt_EXE) - message(FATAL_ERROR "The utility macdeployqt is required to create the bundle!") + message(FATAL_ERROR "The utility macdeployqt is required to create the bundle (seached: ${qt_base_dir})") + else() + message(STATUS "macdeployqt found in ${macdeployqt_EXE}") endif() #dummy target, we're interested in the postscript file diff -r 3f8ba061775e -r 3106add9a5bf tools/docgen.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/docgen.sh Fri Oct 28 18:33:38 2011 +0200 @@ -0,0 +1,37 @@ +#!/bin/sh + + +if [ -d QTfrontend ]; then + cd QTfrontend +else + if [ -d ../QTfrontend ]; then + cd ../QTfrontend + else + echo 'abort: Directory "QTfrontend" not found!' >&2 + exit 1 + fi +fi + +if [ -z "$1" ]; then + OUTPUT_DIRECTORY="../doc/QTfrontend" +else + OUTPUT_DIRECTORY="$1" +fi + +echo "Creating documentation for Qt-Frontend in $OUTPUT_DIRECTORY ..." + +if [ $(which hg) ]; then + +branch=$(hg identify -b) +rev=$(hg identify -rdefault -i) + +branchurl="${branch}" +revurl="${rev}" + +export PROJECT_NUMBER="${branchurl} as of ${revurl}" +export OUTPUT_DIRECTORY + +fi + +doxygen +exit $?