1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Merge branch 'master' into wip/landscape

This commit is contained in:
Mathieu Schroeter 2018-02-19 18:13:21 +01:00
commit e88e58863b
53 changed files with 2326 additions and 493 deletions

View File

@ -12,8 +12,8 @@ link_directories (${CMAKE_INSTALL_PREFIX}/lib)
project (planetblupi)
set (PB_VERSION_MAJOR 1)
set (PB_VERSION_MINOR 11)
set (PB_VERSION_PATCH 0)
set (PB_VERSION_MINOR 12)
set (PB_VERSION_PATCH 3)
set (PB_VERSION_EXTRA "")
set (PB_PRODUCT_NAME "Planet Blupi")
set (PB_PACKAGE_NAME "planetblupi")
@ -54,7 +54,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${STATIC_BUILD}")
endif ()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -DDEBUG")
endif ()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
@ -141,6 +141,8 @@ if ("${STATIC_BUILD}")
pkg_search_module (AVUTIL REQUIRED libavutil)
pkg_search_module (SWSCALE REQUIRED libswscale)
pkg_search_module (SWRESAMPLE REQUIRED libswresample)
# Statis dependencies for SDL_mixer
pkg_search_module (VORBIS REQUIRED vorbisfile)
if (UNIX AND NOT APPLE)
pkg_search_module (ALSA REQUIRED alsa)
@ -172,6 +174,7 @@ if ("${STATIC_BUILD}")
${AVUTIL_STATIC_LIBRARIES}
${SWSCALE_STATIC_LIBRARIES}
${SWRESAMPLE_STATIC_LIBRARIES}
${VORBIS_STATIC_LIBRARIES}
)
if (${PB_HTTP_VERSION_CHECK})
@ -281,10 +284,10 @@ endif ()
# Copy libwinpthread-1.dll which seems not be linkable statically
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND MINGW)
execute_process (COMMAND cygpath.exe --windows /mingw64 OUTPUT_VARIABLE MINGW64_PATH)
string (REGEX REPLACE "[ \t\n\r]+$" "" MINGW64_PATH "${MINGW64_PATH}")
string (REGEX REPLACE "[\\]" "\\\\\\\\" MINGW64_PATH "${MINGW64_PATH}")
install (FILES "${MINGW64_PATH}\\\\bin\\\\libwinpthread-1.dll" DESTINATION bin)
execute_process (COMMAND cygpath.exe --windows $ENV{MINGW_PREFIX} OUTPUT_VARIABLE MINGW_PATH)
string (REGEX REPLACE "[ \t\n\r]+$" "" MINGW_PATH "${MINGW_PATH}")
string (REGEX REPLACE "[\\]" "\\\\\\\\" MINGW_PATH "${MINGW_PATH}")
install (FILES "${MINGW_PATH}\\\\bin\\\\libwinpthread-1.dll" DESTINATION bin)
endif ()
#########
@ -316,6 +319,10 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND "${STATIC_BUILD}")
set (CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\planetblupi.exe")
set (CPACK_NSIS_URL_INFO_ABOUT "http://www.blupi.org")
set (CPACK_NSIS_MUI_FINISHPAGE_RUN "planetblupi")
if (SIGN_APP)
set (CPACK_NSIS_SIGN_UNINSTALLER "sign -a -fd sha1 -t http://time.certum.pl -v")
endif ()
include (CPack)
find_program (SIGNTOOL_EXECUTABLE signtool)

View File

@ -6,7 +6,10 @@ This game is linked on some static libraries:
GNU/gettext (GPLv3)
libcurl (MIT/X derivate)
GNU/libiconv (GPLv3)
libogg (own license)
libpng (own license)
libsndfile (LGPLv3)
libvorbis (own license)
SDL_kitchensink (MIT)
SDL2 (zlib license)
SDL2_image (zlib license)

View File

@ -7,8 +7,11 @@ List of all licenses, concerns Planet Blupi and dependencies
* libasound -- https://www.alsa-project.org
* libcurl -- https://curl.haxx.se/libcurl/
* GNU/libiconv -- https://www.gnu.org/software/libiconv/
* libogg -- https://xiph.org/downloads/
* libpng -- http://www.libpng.org/pub/png/libpng.html
* libpulse -- https://freedesktop.org/software/pulseaudio/doxygen/
* libsndfile -- http://www.mega-nerd.com/libsndfile/
* libvorbis -- https://xiph.org/downloads/
* SDL_kitchensink -- https://github.com/katajakasa/SDL_kitchensink
* SDL2 -- https://www.libsdl.org
* SDL2_image -- https://www.libsdl.org/projects/SDL_image/
@ -3117,6 +3120,39 @@ the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
######################################################################
# libogg - LICENSE
######################################################################
Copyright (c) 2002, Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
######################################################################
# libpng - LICENSE
######################################################################
@ -3301,6 +3337,209 @@ While we attempt to provide a summary here, it is the ultimate responsibility of
the packager to ensure the components they use in their build of PulseAudio
meets their license requirements.
######################################################################
# libsndfile - LICENSE
######################################################################
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
######################################################################
# libogg - LICENSE
######################################################################
Copyright (c) 2002, Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
######################################################################
# SDL_kitchensink - LICENSE
######################################################################

View File

@ -1,5 +1,5 @@
# Planet Blupi (v1.9.x)
# Planet Blupi
This version contains over 30 missions and a built in editor, which enables you
to construct your own missions.
@ -20,16 +20,28 @@ What ever your screen resolution is, the game "Planet Blupi" always runs in
the game by default in windowed mode. Proceed as follows:
1. Quit the game _Planet Blupi_.
2. Open the file `<INSTALLDIR>/data/config.json` with a text editor.
2. Open the file `share/planetblupi/data/config.json` with a text editor.
3. Replace `fullscreen: true` by `fullscreen: false`.
4. Save and restart the game.
In this mode the screen is no more scrolled if the mouse touches the window
border. Use the Keyboard arrows instead.
> It's possible to start the game with `--fullscreen off` instead of editing
> the `config.json` file.
If the problem persists, maybe you should try to start the game with the software
renderer. Edit the `config.json` file and add `"renderer": "software"` or start
the game with `--renderer software`.
On Windows, an other possibility exists. You can try to change the driver used
by the software renderer. By default it uses `"direct3d"`, you can change by
`"opengl"` with `"driver": "opengl"` with the `config.json` file or
`--driver opengl` by command line argument.
## Mouse
Left button:
Left button:
This button is always used in three steps:
1. Select a Blupi.
@ -41,7 +53,7 @@ step 1) is not necessary.
You may select several Blupis by maintaining the Shift button pressed.
Right button:
Right button:
The right button is a shortcut. It orders the selected Blupi to do the most
useful operation on the selected spot.
@ -61,6 +73,30 @@ useful operation on the selected spot.
When you switch to an other application, the game is automatically paused.
## Music
The music is provided in OGG and MIDI formats. The OGG variant is prefered
because the render is the same for all platforms. For purist fanboys, it's
possible to enforce the MIDI variant by starting the game with the
`--restore-midi` command line argument. Note that in this case, it's possible
to lose some instruments, it depends of your system.
> You can edit the `share/planetblupi/data/config.json` file and add an entry
> `"restoremidi": true`, or simply use the new settings available in the global
> settings screen in the game.
If you want, you can overload all musics with yours by providing OGG or MIDI
music files in your user directory.
On Windows, type `%APPDATA%\Epsitec SA\Planet Blupi` in the file browser,
on macOS, look at `~/Library/Application Support/Epsitec SA/Planet Blupi`, and
on Linux, look at `~/.local/share/Epsitec SA/Planet Blupi`.
You can create a `music` sub-directory with your music. For example:
`%LOCALAPPDATA%\Epsitec SA\Planet Blupi\music\music000.ogg`.
Only 10 musics are supported: `music000` to `music009`.
## Epsitec SA
_Planet Blupi_ is an original creation of [Epsitec SA][1].

View File

@ -375,8 +375,8 @@ każdego Blupiego.
1|Cel:
1|
1|Uchroń jednego lub dwóch Blupich
1|przed zarażeniem i znajdź lekarstwo
1|dla zarażonych.
1|przed zarażeniem i znajdź
1|lekarstwo dla zarażonych.
1|
1|Następnie zaprowadź Blupich
1|do domu.
@ -999,7 +999,8 @@ klikania na każdym Blupim.
2|Cel:
2|
2|Blupi musi dotrzeć do swojego domu.
2|Blupi musi dotrzeć do swojego
2|domu.
@28
1|Solucja:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View File

@ -6,5 +6,5 @@ GenericName=Video Game
Comment=@PB_DESCRIPTION@
Exec=@PB_EXEC@
StartupWMClass=@PB_EXEC@
Icon=@APPIMAGE_ICON_REF@
Icon=@PB_ICON_REF@
Categories=Game;StrategyGame;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

6
resources/nsis/bootstrap.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
mv /C/msys64/mingw64/share/cmake-3.9/Modules/NSIS.template.in /C/msys64/mingw64/share/cmake-3.9/Modules/NSIS.template.in.orig
mv /C/msys64/mingw32/share/cmake-3.9/Modules/NSIS.template.in /C/msys64/mingw32/share/cmake-3.9/Modules/NSIS.template.in.orig
cp $(dirname $0)/NSIS.template.in /C/msys64/mingw64/share/cmake-3.9/Modules/NSIS.template.in
cp $(dirname $0)/NSIS.template.in /C/msys64/mingw32/share/cmake-3.9/Modules/NSIS.template.in

View File

@ -7,15 +7,15 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-15 18:34+0200\n"
"PO-Revision-Date: 2017-10-04 23:30+0200\n"
"POT-Creation-Date: 2017-12-14 23:13+0100\n"
"PO-Revision-Date: 2017-12-14 23:15+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
"X-Generator: Poedit 2.0.5\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid " - FFmpeg (LGPLv2.1)"
@ -39,12 +39,18 @@ msgstr " - libasound (LGPLv2.1)"
msgid " - libcurl (MIT/X derivate)"
msgstr " - libcurl (MIT/X Derivatlizenz)"
msgid " - libogg and libvorbis (own license)"
msgstr " - libogg and libvorbis (Eigene Lizenz)"
msgid " - libpng (own license)"
msgstr " - libpng (Eigene Lizenz)"
msgid " - libpulse (LGPLv2.1)"
msgstr " - libpulse (LGPLv2.1)"
msgid " - libsndfile (LGPLv3)"
msgstr " - libsndfile (LGPLv3)"
msgid " - zlib (own license)"
msgstr " - zlib (Eigene Lizenz)"
@ -283,6 +289,11 @@ msgstr ""
"Fentergrösse\n"
"anpassen"
msgid ""
"Choose the\n"
"music format"
msgstr ""
msgid "Construct this game"
msgstr "Diese Mission konstruieren"
@ -520,6 +531,9 @@ msgstr "Roboterchef"
msgid "Medical potion"
msgstr "Medikament"
msgid "Midi"
msgstr "Midi"
msgid "Mine"
msgstr "Bergwerk"
@ -624,6 +638,9 @@ msgstr "Du kannst jetzt mit den Missionen beginnen."
msgid "Occupied ground"
msgstr "Untergrund schon besetzt"
msgid "Ogg"
msgstr "Ogg"
msgid "Open another game"
msgstr "Gespeicherte Mission öffnen"
@ -839,6 +856,12 @@ msgstr "Bäume"
msgid "Tree trunks"
msgstr "Baumstämme"
msgid "Use Midi music (original)"
msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Version"
msgstr "Version"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-15 18:34+0200\n"
"POT-Creation-Date: 2017-12-14 23:13+0100\n"
"PO-Revision-Date: 2017-02-27 21:28+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -39,12 +39,18 @@ msgstr ""
msgid " - libcurl (MIT/X derivate)"
msgstr ""
msgid " - libogg and libvorbis (own license)"
msgstr ""
msgid " - libpng (own license)"
msgstr ""
msgid " - libpulse (LGPLv2.1)"
msgstr ""
msgid " - libsndfile (LGPLv3)"
msgstr ""
msgid " - zlib (own license)"
msgstr ""
@ -237,6 +243,11 @@ msgid ""
"window size"
msgstr ""
msgid ""
"Choose the\n"
"music format"
msgstr ""
msgid "Construct this game"
msgstr ""
@ -465,6 +476,9 @@ msgstr ""
msgid "Medical potion"
msgstr ""
msgid "Midi"
msgstr ""
msgid "Mine"
msgstr ""
@ -567,6 +581,9 @@ msgstr ""
msgid "Occupied ground"
msgstr ""
msgid "Ogg"
msgstr ""
msgid "Open another game"
msgstr ""
@ -769,6 +786,12 @@ msgstr ""
msgid "Tree trunks"
msgstr ""
msgid "Use Midi music (original)"
msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Version"
msgstr ""

View File

@ -6,15 +6,15 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-15 18:34+0200\n"
"PO-Revision-Date: 2017-10-04 23:29+0200\n"
"POT-Creation-Date: 2017-12-14 23:13+0100\n"
"PO-Revision-Date: 2017-12-14 23:14+0100\n"
"Last-Translator: Mathieu Schroeter <mathieu@schroetersa.ch>\n"
"Language-Team: French <kde-i18n-doc@kde.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
"X-Generator: Poedit 2.0.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid " - FFmpeg (LGPLv2.1)"
@ -38,12 +38,18 @@ msgstr " - libasound (LGPLv2.1)"
msgid " - libcurl (MIT/X derivate)"
msgstr " - libcurl (dérivée de MIT/X)"
msgid " - libogg and libvorbis (own license)"
msgstr " - libogg and libvorbis (propre licence)"
msgid " - libpng (own license)"
msgstr " - libpng (propre licence)"
msgid " - libpulse (LGPLv2.1)"
msgstr " - libpulse (LGPLv2.1)"
msgid " - libsndfile (LGPLv3)"
msgstr " - libsndfile (LGPLv3)"
msgid " - zlib (own license)"
msgstr " - zlib (propre licence)"
@ -281,6 +287,14 @@ msgstr ""
"Modifie la taille\n"
"de la fenêtre"
msgid ""
"Choose the\n"
"music format"
msgstr ""
"Choisi le\n"
"format de\n"
"la musique"
msgid "Construct this game"
msgstr "Construire cette partie"
@ -515,6 +529,9 @@ msgstr "Robot-maître"
msgid "Medical potion"
msgstr "Potion"
msgid "Midi"
msgstr "Midi"
msgid "Mine"
msgstr "Mine de fer"
@ -619,6 +636,9 @@ msgstr "Passe maintenant aux missions."
msgid "Occupied ground"
msgstr "Terrain occupé"
msgid "Ogg"
msgstr "Ogg"
msgid "Open another game"
msgstr "Ouvrir une autre partie"
@ -829,6 +849,12 @@ msgstr "Arbres"
msgid "Tree trunks"
msgstr "Troncs"
msgid "Use Midi music (original)"
msgstr "Utilise la musique Midi (originale)"
msgid "Use Ogg music"
msgstr "Utilise la musique Ogg"
msgid "Version"
msgstr "Version"

View File

@ -7,15 +7,15 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-29 10:21+0200\n"
"PO-Revision-Date: 2017-10-04 17:30+0200\n"
"POT-Creation-Date: 2017-12-14 23:13+0100\n"
"PO-Revision-Date: 2017-12-14 23:15+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.11\n"
"X-Generator: Poedit 2.0.5\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid " - FFmpeg (LGPLv2.1)"
@ -39,12 +39,18 @@ msgstr " - libasound (LGPLv2.1)"
msgid " - libcurl (MIT/X derivate)"
msgstr " - libcurl (MIT/X derivata)"
msgid " - libogg and libvorbis (own license)"
msgstr " - libogg and libvorbis (licensa personale)"
msgid " - libpng (own license)"
msgstr " - libpng (licensa personale)"
msgid " - libpulse (LGPLv2.1)"
msgstr " - libpulse (LGPLv2.1)"
msgid " - libsndfile (LGPLv3)"
msgstr " - libsndfile (LGPLv3)"
msgid " - zlib (own license)"
msgstr " - zlib (licensa personale)"
@ -282,6 +288,11 @@ msgstr ""
"dimensione\n"
"della finestra"
msgid ""
"Choose the\n"
"music format"
msgstr ""
msgid "Construct this game"
msgstr "Costruire questa partita"
@ -518,6 +529,9 @@ msgstr "Robot-capo"
msgid "Medical potion"
msgstr "Pozione"
msgid "Midi"
msgstr "Midi"
msgid "Mine"
msgstr "Miniera"
@ -622,6 +636,9 @@ msgstr "Ora passa alle missioni."
msgid "Occupied ground"
msgstr "Terreno occupato"
msgid "Ogg"
msgstr "Ogg"
msgid "Open another game"
msgstr "Apri un'altra partita"
@ -832,6 +849,12 @@ msgstr "Alberi"
msgid "Tree trunks"
msgstr "Tronchi"
msgid "Use Midi music (original)"
msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Version"
msgstr "Versione"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-04 07:04+0200\n"
"PO-Revision-Date: 2017-09-12 20:10+0200\n"
"POT-Creation-Date: 2017-12-14 23:13+0100\n"
"PO-Revision-Date: 2017-12-14 23:15+0100\n"
"Last-Translator: tomangelo <tomangelo@wp.pl>\n"
"Language-Team: TerranovaTeam <contact@colobot.info>\n"
"Language: pl\n"
@ -17,6 +17,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2);\n"
"X-Generator: Poedit 2.0.5\n"
msgid " - FFmpeg (LGPLv2.1)"
msgstr " - FFmpeg (LGPLv2.1)"
@ -39,12 +40,18 @@ msgstr " - libasound (LGPLv2.1)"
msgid " - libcurl (MIT/X derivate)"
msgstr " - libcurl (MIT/X derivate)"
msgid " - libogg and libvorbis (own license)"
msgstr " - libogg and libvorbis (własna licencja)"
msgid " - libpng (own license)"
msgstr " - libpng (własna licencja)"
msgid " - libpulse (LGPLv2.1)"
msgstr " - libpulse (LGPLv2.1)"
msgid " - libsndfile (LGPLv3)"
msgstr " - libsndfile (LGPLv2.1)"
msgid " - zlib (own license)"
msgstr " - zlib (własna licencja)"
@ -281,6 +288,11 @@ msgstr ""
"Zmień rozmiar\n"
"okna"
msgid ""
"Choose the\n"
"music format"
msgstr ""
msgid "Construct this game"
msgstr "Edytuj poziom"
@ -515,6 +527,9 @@ msgstr "Mistrz robotów"
msgid "Medical potion"
msgstr "Lekarstwo"
msgid "Midi"
msgstr "Midi"
msgid "Mine"
msgstr "Kopalnia"
@ -543,9 +558,8 @@ msgstr "Wybór muzyki"
msgid "Music number 1"
msgstr "Muzyka numer 1"
#, fuzzy
msgid "Music number 10"
msgstr "Muzyka numer 1"
msgstr "Muzyka numer 10"
msgid "Music number 2"
msgstr "Muzyka numer 2"
@ -620,6 +634,9 @@ msgstr "Teraz spróbuj swoich sił w misjach"
msgid "Occupied ground"
msgstr "Teren zajęty"
msgid "Ogg"
msgstr "Ogg"
msgid "Open another game"
msgstr "Otwórz poprzednią grę"
@ -830,6 +847,12 @@ msgstr "Drzewo"
msgid "Tree trunks"
msgstr "Pnie drzew"
msgid "Use Midi music (original)"
msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Version"
msgstr "Wersja"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-04 07:04+0200\n"
"POT-Creation-Date: 2017-12-14 23:13+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -551,6 +551,12 @@ msgstr ""
msgid "Increase window size"
msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Use Midi music (original)"
msgstr ""
msgid "Version"
msgstr ""
@ -705,6 +711,17 @@ msgid ""
"window size"
msgstr ""
msgid ""
"Choose the\n"
"music format"
msgstr ""
msgid "Midi"
msgstr ""
msgid "Ogg"
msgstr ""
msgid "You have played Planet Blupi."
msgstr ""
@ -729,12 +746,18 @@ msgstr ""
msgid " - libcurl (MIT/X derivate)"
msgstr ""
msgid " - libogg and libvorbis (own license)"
msgstr ""
msgid " - libpng (own license)"
msgstr ""
msgid " - libpulse (LGPLv2.1)"
msgstr ""
msgid " - libsndfile (LGPLv3)"
msgstr ""
msgid " - SDL_kitchensink (MIT)"
msgstr ""

View File

@ -1764,7 +1764,7 @@ static const DescAction action_table[] =
{0},
},
{
ACTION_D_PICKAXE,
ACTION_D_SAW,
CHBLUPI,
{
{1, 290}, // e
@ -1839,7 +1839,7 @@ static const DescAction action_table[] =
{0},
},
{
ACTION_D_SAW,
ACTION_D_PICKAXE,
CHBLUPI,
{
{8, 290, 290, 304, 304, 290, 290, 292, 292}, // e

View File

@ -18,9 +18,11 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include <atomic>
#include <fstream>
#include <iostream>
#include <iterator>
#include <regex>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@ -53,31 +55,24 @@
SDL_Window * g_window;
SDL_Renderer * g_renderer;
CEvent * g_pEvent = nullptr;
CPixmap * g_pPixmap = nullptr; // pixmap principal
CSound * g_pSound = nullptr; // sound principal
CMovie * g_pMovie = nullptr; // movie principal
CDecor * g_pDecor = nullptr;
std::thread * g_updateThread = nullptr;
CEvent * g_pEvent = nullptr;
CPixmap * g_pPixmap = nullptr; // pixmap principal
CSound * g_pSound = nullptr; // sound principal
CMovie * g_pMovie = nullptr; // movie principal
CDecor * g_pDecor = nullptr;
std::thread * g_updateThread = nullptr;
std::atomic<bool> g_updateAbort (false);
bool g_bFullScreen = false; // false si mode de test
Uint8 g_windowScale = 1;
Uint8 g_zoom = 1;
Sint32 g_speedRate = 1;
Sint32 g_timerInterval = 50; // inverval = 50ms
int g_rendererType = 0;
bool g_enableRecorder = false;
std::string g_playRecord;
bool g_restoreBugs = false; // restore original < v1.9 bugs
enum Settings {
SETTING_FULLSCREEN = 1 << 0,
SETTING_SPEEDRATE = 1 << 1,
SETTING_TIMERINTERVAL = 1 << 2,
SETTING_RENDERER = 1 << 3,
SETTING_ZOOM = 1 << 4,
};
static int g_settingsOverload = 0;
bool g_restoreMidi = false; // restore music playback based on midi files
int g_settingsOverload = 0;
bool g_bTermInit = false; // initialisation en cours
Uint32 g_lastPhase = 999;
@ -152,17 +147,13 @@ ReadConfig ()
if (
!(g_settingsOverload & SETTING_FULLSCREEN) &&
j.find ("fullscreen") != j.end ())
{
g_bFullScreen = j["fullscreen"].get<bool> ();
if (g_bFullScreen != 0)
g_bFullScreen = 1;
}
if (!(g_settingsOverload & SETTING_ZOOM) && j.find ("zoom") != j.end ())
{
g_windowScale = j["zoom"].get<Uint8> ();
if (g_windowScale != 1 && g_windowScale != 2)
g_windowScale = 1;
g_zoom = j["zoom"].get<Uint8> ();
if (g_zoom != 1 && g_zoom != 2)
g_zoom = 1;
}
if (
@ -174,6 +165,20 @@ ReadConfig ()
g_rendererType = SDL_RENDERER_ACCELERATED;
}
if (
!(g_settingsOverload & SETTING_DRIVER) && j.find ("driver") != j.end () &&
(!g_rendererType || g_rendererType == SDL_RENDERER_ACCELERATED))
{
std::string input = j["driver"];
if (std::regex_match (
input, std::regex ("direct3d|direct3d11|opengl|opengles2|opengles")))
SDL_SetHint (SDL_HINT_RENDER_DRIVER, input.c_str ());
}
if (
!(g_settingsOverload & SETTING_MIDI) && j.find ("restoremidi") != j.end ())
g_restoreMidi = j["restoremidi"].get<bool> ();
return true;
}
@ -212,27 +217,22 @@ UpdateFrame (void)
clip.bottom = POSDRAWY + DIMDRAWY;
if (g_pEvent->IsShift ()) // screen shifting
{
g_pEvent->DecorAutoShift ();
g_pDecor->Build (clip, posMouse); // build the environment
}
else
{
if (!g_pEvent->GetPause ())
{
speed = g_pEvent->GetSpeed () * g_speedRate;
for (i = 0; i < speed; i++)
{
g_pDecor->BlupiStep (i == 0); // move all blupi
g_pDecor->MoveStep (i == 0); // move the environment
g_pEvent->DemoStep (); // forward the recording or demo playing
}
}
g_pEvent->DecorAutoShift ();
g_pDecor->Build (clip, posMouse); // build the environment
g_pDecor->NextPhase (1); // rebuild the map sometimes
if (!g_pEvent->GetPause ())
{
speed = g_pEvent->GetSpeed () * g_speedRate;
for (i = 0; i < speed; i++)
{
g_pDecor->BlupiStep (i == 0); // move all blupi
g_pDecor->MoveStep (i == 0); // move the environment
g_pEvent->DemoStep (); // forward the recording or demo playing
}
}
g_pEvent->DecorAutoShift ();
g_pDecor->Build (clip, posMouse); // build the environment
g_pDecor->NextPhase (1); // rebuild the map sometimes
}
if (phase == EV_PHASE_BUILD)
@ -320,8 +320,6 @@ FinishObjects (void)
static void
HandleEvent (const SDL_Event & event)
{
Point totalDim, iconDim;
if (!g_pause && g_pEvent != nullptr && g_pEvent->TreatEvent (event))
return;
@ -329,6 +327,9 @@ HandleEvent (const SDL_Event & event)
{
case SDL_WINDOWEVENT:
{
#ifndef DEBUG
Point totalDim, iconDim;
switch (event.window.event)
{
case SDL_WINDOWEVENT_FOCUS_GAINED:
@ -362,6 +363,7 @@ HandleEvent (const SDL_Event & event)
g_pMovie->Pause ();
return;
}
#endif /* !DEBUG */
break;
}
@ -485,6 +487,13 @@ updateCallback (void * ptr, size_t size, size_t nmemb, void * data)
return realsize;
}
static int
progressCallback (
void * userData, double dltotal, double dlnow, double ultotal, double ulnow)
{
return g_updateAbort ? 1 : 0;
}
#endif /* USE_CURL */
static void
@ -504,11 +513,18 @@ CheckForUpdates ()
curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt (curl, CURLOPT_FAILONERROR, 1);
curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt (curl, CURLOPT_TIMEOUT, 20);
curl_easy_setopt (curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, updateCallback);
curl_easy_setopt (curl, CURLOPT_URL, "http://blupi.org/update/planet.json");
curl_easy_setopt (curl, CURLOPT_WRITEDATA, (void *) &chunk);
curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt (curl, CURLOPT_PROGRESSDATA, nullptr);
curl_easy_setopt (curl, CURLOPT_PROGRESSFUNCTION, progressCallback);
chunk.status = curl_easy_perform (curl);
if (chunk.status)
@ -556,6 +572,12 @@ parseArgs (int argc, char * argv[], bool & exit)
{"-r", "--renderer"},
"set a renderer [auto;software;accelerated] (default: auto)",
1},
{"driver",
{"-d", "--driver"},
"set a driver [auto;direct3d;direct3d11;opengl;opengles2;opengles] "
"(default: auto, ignored with "
"software renderer)",
1},
{"enablerecorder",
{"-c", "--enable-recorder"},
"enable the recorder feature (F3/F4)",
@ -567,6 +589,10 @@ parseArgs (int argc, char * argv[], bool & exit)
{"restorebugs",
{"-b", "--restore-bugs"},
"restore funny original bugs of older versions < v1.9",
0},
{"restoremidi",
{"-m", "--restore-midi"},
"restore playback based on MIDI music instead of OGG",
0}}};
argagg::parser_results args;
@ -577,6 +603,7 @@ parseArgs (int argc, char * argv[], bool & exit)
catch (const std::exception & e)
{
std::cerr << e.what () << std::endl;
exit = true;
return EXIT_FAILURE;
}
@ -615,7 +642,9 @@ parseArgs (int argc, char * argv[], bool & exit)
if (args["zoom"])
{
g_windowScale = args["zoom"];
g_zoom = args["zoom"];
if (g_zoom != 1 && g_zoom != 2)
g_zoom = 1;
g_settingsOverload |= SETTING_ZOOM;
}
@ -630,6 +659,17 @@ parseArgs (int argc, char * argv[], bool & exit)
g_settingsOverload |= SETTING_RENDERER;
}
if (
args["driver"] &&
(!g_rendererType || g_rendererType == SDL_RENDERER_ACCELERATED))
{
std::string input = args["driver"].as<std::string> ();
if (std::regex_match (
input, std::regex ("direct3d|direct3d11|opengl|opengles2|opengles")))
SDL_SetHint (SDL_HINT_RENDER_DRIVER, input.c_str ());
g_settingsOverload |= SETTING_DRIVER;
}
if (args["enablerecorder"])
g_enableRecorder = true;
@ -639,6 +679,12 @@ parseArgs (int argc, char * argv[], bool & exit)
if (args["restorebugs"])
g_restoreBugs = true;
if (args["restoremidi"])
{
g_restoreMidi = true;
g_settingsOverload |= SETTING_MIDI;
}
return EXIT_SUCCESS;
}
@ -663,9 +709,17 @@ DoInit (int argc, char * argv[], bool & exit)
return EXIT_FAILURE;
}
#ifdef _WIN32
/* Fix laggy sounds on Windows by not using winmm driver. */
SDL_setenv ("SDL_AUDIODRIVER", "directsound", true);
#endif /* _WIN32 */
auto res = SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER);
if (res < 0)
{
SDL_Log ("Unable to initialize SDL: %s", SDL_GetError ());
return EXIT_FAILURE;
}
// Create a window.
g_window = SDL_CreateWindow (
@ -902,10 +956,6 @@ DoInit (int argc, char * argv[], bool & exit)
return EXIT_FAILURE;
}
// Load all cursors
g_pPixmap->LoadCursors (g_windowScale);
g_pPixmap->ChangeSprite (SPRITE_WAIT); // met le sablier maison
// Create the sound manager.
g_pSound = new CSound;
if (g_pSound == nullptr)
@ -947,11 +997,19 @@ DoInit (int argc, char * argv[], bool & exit)
return EXIT_FAILURE;
}
const bool zoom = g_zoom;
g_pEvent->Create (g_pPixmap, g_pDecor, g_pSound, g_pMovie);
// Load all cursors
g_pPixmap->LoadCursors (g_zoom);
g_pPixmap->ChangeSprite (SPRITE_WAIT);
g_updateThread = new std::thread (CheckForUpdates);
g_pEvent->SetFullScreen (g_bFullScreen);
if (!g_bFullScreen)
g_pEvent->SetWindowSize (g_windowScale);
if (g_bFullScreen)
g_pEvent->SetFullScreen (true);
if (!g_bFullScreen && zoom != g_zoom)
g_pEvent->SetWindowSize (g_zoom);
g_pEvent->ChangePhase (EV_PHASE_INTRO1);
g_bTermInit = true;
@ -993,15 +1051,20 @@ main (int argc, char * argv[])
break;
}
SDL_RemoveTimer (updateTimer);
FinishObjects ();
if (g_renderer)
SDL_DestroyRenderer (g_renderer);
if (g_window)
SDL_DestroyWindow (g_window);
SDL_RemoveTimer (updateTimer);
FinishObjects ();
SDL_Quit ();
if (g_updateThread)
{
g_updateAbort = true;
g_updateThread->join ();
delete (g_updateThread);
}

View File

@ -31,11 +31,25 @@ class CEvent;
extern SDL_Window * g_window;
extern SDL_Renderer * g_renderer;
extern bool g_bFullScreen;
extern Uint8 g_zoom;
extern bool g_restoreBugs;
extern bool g_restoreMidi;
extern bool g_enableRecorder;
extern std::string g_playRecord;
extern CEvent * g_pEvent;
enum Settings {
SETTING_FULLSCREEN = 1 << 0,
SETTING_SPEEDRATE = 1 << 1,
SETTING_TIMERINTERVAL = 1 << 2,
SETTING_RENDERER = 1 << 3,
SETTING_ZOOM = 1 << 4,
SETTING_DRIVER = 1 << 5,
SETTING_MIDI = 1 << 6,
};
extern int g_settingsOverload;
struct Point {
Sint32 x;
Sint32 y;
@ -51,11 +65,11 @@ struct Rect {
typedef Uint32 ColorRef;
#if defined(_WIN64)
typedef unsigned __int64 WPARAM;
typedef __int64 LPARAM;
typedef unsigned __int64 WParam;
typedef __int64 LParam;
#else
typedef Uint32 WPARAM;
typedef Sint32 LPARAM;
typedef Uint32 WParam;
typedef Sint32 LParam;
#endif
#undef LOWORD

View File

@ -48,9 +48,7 @@ CButton::CButton ()
m_toolTips = nullptr;
}
CButton::~CButton ()
{
}
CButton::~CButton () {}
// Crée un nouveau bouton.

View File

@ -71,7 +71,7 @@ protected:
bool m_bEnable; // true si bouton actif
bool m_bHide; // true si bouton caché
Uint32 m_message; // message envoyé si bouton actionné
Point m_pos; // coin sup/gauche
Point m_pos; // up/left corner
Point m_dim; // dimensions
Sint32 m_state; // 0=relâché, 1=pressé, +2=survollé
Sint32 m_mouseState; // 0=relâché, 1=pressé, +2=survollé

View File

@ -728,13 +728,19 @@ CDecor::BlupiInitAction (Sint32 rank, Sint32 action, Sint32 direct)
if (m_blupi[rank].action == ACTION_STOP)
m_blupi[rank].action = ACTION_D_STOP;
if (m_blupi[rank].action == ACTION_PICKAXE)
if (
m_blupi[rank].action == ACTION_PICKAXE ||
m_blupi[rank].action == ACTION_BUILDSEC ||
m_blupi[rank].action == ACTION_BUILDBREF)
m_blupi[rank].action = ACTION_D_PICKAXE;
if (m_blupi[rank].action == ACTION_BUILD)
m_blupi[rank].action = ACTION_D_BUILD;
if (m_blupi[rank].action == ACTION_SAW)
if (
m_blupi[rank].action == ACTION_SAW ||
m_blupi[rank].action == ACTION_BUILDSOURD ||
m_blupi[rank].action == ACTION_PIOCHESOURD)
m_blupi[rank].action = ACTION_D_SAW;
if (m_blupi[rank].action == ACTION_TCHAO)
@ -2008,7 +2014,7 @@ CDecor::GoalNextOp (Sint32 rank, Sint16 * pTable)
m_blupi[rank].cel = cel;
BlupiPushFog (rank);
if (m_blupi[rank].bHili)
SetCoin (cel, true);
SetCorner (cel, true);
return true;
}
@ -4617,7 +4623,7 @@ CDecor::IsTerminated ()
m_pSound->PlayImage (SOUND_GOAL, pos);
m_winLastHachBlupi = m_nbStatHachBlupi;
if (m_nbStatHachBlupi < m_nbStatHach * 4)
if (m_nbStatHachBlupi < m_nbStatHach * m_term.nbMinBlupi)
return 0; // continue;
}

View File

@ -136,7 +136,7 @@ CDecor::Write (Sint32 rank, bool bUser, Sint32 world, Sint32 time, Sint32 total)
pBuffer->majRev = 1;
pBuffer->minRev = 5;
pBuffer->celCoin = m_celCoin;
pBuffer->celCoin = m_celCorner;
pBuffer->world = world;
pBuffer->time = time;
pBuffer->totalTime = total;
@ -255,7 +255,7 @@ CDecor::Read (
goto error;
}
SetCoin (pBuffer->celCoin);
SetCorner (pBuffer->celCoin);
if (bUser)
{
world = pBuffer->world;
@ -511,7 +511,7 @@ CDecor::Flush ()
m_celHome.x = 90;
m_celHome.y = 98;
SetCoin (m_celHome);
SetCorner (m_celHome);
InitAfterBuild ();
LoadImages ();
}

View File

@ -114,8 +114,8 @@ CDecor::ConvCelToMap (Point cel)
{
Point pos;
pos.x = (cel.x - m_celCoin.x) - (cel.y - m_celCoin.y);
pos.y = ((cel.x - m_celCoin.x) + (cel.y - m_celCoin.y)) / 2;
pos.x = (cel.x - m_celCorner.x) - (cel.y - m_celCorner.y);
pos.y = ((cel.x - m_celCorner.x) + (cel.y - m_celCorner.y)) / 2;
pos.x += (DIMMAPX - MAPCADREX) / 2;
pos.y += (DIMMAPY - MAPCADREY) / 2;
@ -136,8 +136,8 @@ CDecor::ConvMapToCel (Point pos)
cel.x = pos.y + pos.x / 2;
cel.y = pos.y - pos.x / 2;
cel.x += m_celCoin.x;
cel.y += m_celCoin.y;
cel.x += m_celCorner.x;
cel.y += m_celCorner.y;
return cel;
}
@ -158,7 +158,7 @@ CDecor::MapMove (Point pos)
cel = ConvMapToCel (pos);
cel.x = cel.x - 10;
cel.y = cel.y;
SetCoin (cel);
SetCorner (cel);
NextPhase (0); // faudra refaire la carte tout de suite
return true;
}
@ -406,19 +406,31 @@ static char color_object[] =
// clang-format on
static char color_deffog[4] = {
MAP_FOG, MAP_FOG, MAP_FOG, MAP_FOG,
MAP_FOG,
MAP_FOG,
MAP_FOG,
MAP_FOG,
};
static char color_deftree[4] = {
MAP_TREE, MAP_TREE, MAP_TREE, MAP_TREE,
MAP_TREE,
MAP_TREE,
MAP_TREE,
MAP_TREE,
};
static char color_deffloor[4] = {
MAP_HERB1, MAP_HERB1, MAP_HERB1, MAP_HERB1,
MAP_HERB1,
MAP_HERB1,
MAP_HERB1,
MAP_HERB1,
};
static char color_fire[4] = {
MAP_FIRE, MAP_FIRE, MAP_FIRE, MAP_FIRE,
MAP_FIRE,
MAP_FIRE,
MAP_FIRE,
MAP_FIRE,
};
// Met le contenu d'une cellule dans le bitmap de la carte
@ -560,7 +572,7 @@ CDecor::GenerateMap ()
}
// Dessine le cadre.
cel = m_celCoin;
cel = m_celCorner;
pos = ConvCelToMap (cel);
for (i = pos.x; i < pos.x + MAPCADREX; i++)

View File

@ -1011,6 +1011,51 @@ CDecor::MoveAddIcons (Point cel, Sint32 rankIcons, bool bContinue)
return false;
}
/**
* \brief Test if something can burn at a specified cell.
*
* \param[in] cel - Position.
* \returns true if possible.
*/
bool
CDecor::CanBurn (Point cel)
{
Sint32 channel, icon;
bool canBurn = false;
cel.x = (cel.x / 2) * 2;
cel.y = (cel.y / 2) * 2;
const auto cell = m_decor[cel.x / 2][cel.y / 2];
channel = cell.objectChannel;
icon = cell.objectIcon;
canBurn = channel == CHOBJECT && ((icon >= 6 && icon <= 11) // trees ?
|| (icon >= 65 && icon <= 71) // palissade ?
|| icon == 61 // cabane ?
|| icon == 36 // planches ?
|| icon == 60 // tomatoes ?
|| icon == 63 // eggs ?
|| icon == 113 // house ?
|| icon == 121 // mine de fer ?
|| icon == 122 // mine de fer ?
);
if (canBurn)
return true;
// If there is an other object, then no fire.
if (channel >= 0)
return false;
channel = cell.floorChannel;
icon = cell.floorIcon;
canBurn = channel == CHFLOOR && (icon == 20 || // herbe foncée ?
(icon >= 59 && icon <= 64));
return canBurn;
}
/**
* \brief Start the fire on a cell.
*
@ -1020,45 +1065,11 @@ CDecor::MoveAddIcons (Point cel, Sint32 rankIcons, bool bContinue)
bool
CDecor::MoveStartFire (Point cel)
{
Sint32 channel, icon;
cel.x = (cel.x / 2) * 2;
cel.y = (cel.y / 2) * 2;
channel = m_decor[cel.x / 2][cel.y / 2].objectChannel;
icon = m_decor[cel.x / 2][cel.y / 2].objectIcon;
if (
channel == CHOBJECT && ((icon >= 6 && icon <= 11) // trees ?
|| (icon >= 65 && icon <= 71) // palissade ?
|| icon == 61 // cabane ?
|| icon == 36 // planches ?
|| icon == 60 // tomatoes ?
|| icon == 63 // eggs ?
|| icon == 113 // house ?
|| icon == 121 // mine de fer ?
|| icon == 122 // mine de fer ?
))
if (this->CanBurn (cel))
{
if (!MoveCreate (cel, -1, false, CHOBJECT, -1, -1, -1, 9999, 1, 0, true))
return false;
cel.x = (cel.x / 2) * 2;
cel.y = (cel.y / 2) * 2;
MoveAddIcons (cel, 1, true); // small fire
m_decor[cel.x / 2][cel.y / 2].fire = 2;
return true;
}
// If there is an other object, then no fire.
if (channel >= 0)
return false;
channel = m_decor[cel.x / 2][cel.y / 2].floorChannel;
icon = m_decor[cel.x / 2][cel.y / 2].floorIcon;
if (
channel == CHFLOOR && (icon == 20 || // herbe foncée ?
(icon >= 59 && icon <= 64))) // bridge ?
{
if (!MoveCreate (cel, -1, false, CHOBJECT, -1, -1, -1, 9999, 1, 0, true))
return false;

View File

@ -119,8 +119,8 @@ CDecor::CDecor ()
m_pSound = nullptr;
m_pUndoDecor = nullptr;
m_celCoin.x = 90;
m_celCoin.y = 98;
m_celCorner.x = 90;
m_celCorner.y = 98;
m_celHili.x = -1;
m_celOutline1.x = -1;
@ -382,6 +382,11 @@ CDecor::PutFloor (Point cel, Sint32 channel, Sint32 icon)
m_decor[cel.x / 2][cel.y / 2].floorChannel = channel;
m_decor[cel.x / 2][cel.y / 2].floorIcon = icon;
if (
!g_restoreBugs && m_decor[cel.x / 2][cel.y / 2].fire &&
!this->CanBurn (cel))
m_decor[cel.x / 2][cel.y / 2].fire = 0;
m_bGroundRedraw = true;
//? SubDrapeau(cel); // on pourra de nouveau planter un drapeau
@ -403,6 +408,11 @@ CDecor::PutObject (Point cel, Sint32 channel, Sint32 icon)
m_decor[cel.x / 2][cel.y / 2].objectChannel = channel;
m_decor[cel.x / 2][cel.y / 2].objectIcon = icon;
if (
!g_restoreBugs && m_decor[cel.x / 2][cel.y / 2].fire &&
!this->CanBurn (cel))
m_decor[cel.x / 2][cel.y / 2].fire = 0;
SubDrapeau (cel); // on pourra de nouveau planter un drapeau
return true;
@ -449,6 +459,29 @@ CDecor::SetFire (Point cel, bool bFire)
return true;
}
void
CDecor::FixShifting (Sint32 & nbx, Sint32 & nby, Point & iCel, Point & iPos)
{
if (m_shiftOffset.x < 0) // décalage à droite ?
nbx += 2;
if (m_shiftOffset.y < 0) // décalage en bas ?
nby += 3;
if (m_shiftOffset.x > 0) // décalage à gauche ?
{
nbx += 2;
iCel.x--;
iCel.y++;
iPos = ConvCelToPos (iCel);
}
if (m_shiftOffset.y > 0) // décalage en haut ?
{
nby += 2;
iCel.x--;
iCel.y--;
iPos = ConvCelToPos (iCel);
}
}
// Modifie l'offset pour le shift.
void
@ -465,8 +498,8 @@ CDecor::ConvCelToPos (Point cel)
{
Point pos;
pos.x = ((cel.x - m_celCoin.x) - (cel.y - m_celCoin.y)) * (DIMCELX / 2);
pos.y = ((cel.x - m_celCoin.x) + (cel.y - m_celCoin.y)) * (DIMCELY / 2);
pos.x = ((cel.x - m_celCorner.x) - (cel.y - m_celCorner.y)) * (DIMCELX / 2);
pos.y = ((cel.x - m_celCorner.x) + (cel.y - m_celCorner.y)) * (DIMCELY / 2);
pos.x += POSDRAWX + m_shiftOffset.x;
pos.y += POSDRAWY + m_shiftOffset.y;
@ -500,8 +533,8 @@ CDecor::ConvPosToCel (Point pos, bool bMap)
cel.y -= (DIMCELX * DIMCELY);
cel.y /= (DIMCELX * DIMCELY);
cel.x += m_celCoin.x;
cel.y += m_celCoin.y;
cel.x += m_celCorner.x;
cel.y += m_celCorner.y;
return cel;
}
@ -516,19 +549,19 @@ CDecor::ConvPosToCel2 (Point pos)
pos.x -= POSDRAWX + DIMCELX / 2;
pos.y -= POSDRAWY;
if (m_celCoin.x % 2 != 0 && m_celCoin.y % 2 == 0)
if (m_celCorner.x % 2 != 0 && m_celCorner.y % 2 == 0)
{
pos.x += DIMCELX / 2;
pos.y += DIMCELY / 2;
}
if (m_celCoin.x % 2 == 0 && m_celCoin.y % 2 != 0)
if (m_celCorner.x % 2 == 0 && m_celCorner.y % 2 != 0)
{
pos.x -= DIMCELX / 2;
pos.y += DIMCELY / 2;
}
if (m_celCoin.x % 2 != 0 && m_celCoin.y % 2 != 0)
if (m_celCorner.x % 2 != 0 && m_celCorner.y % 2 != 0)
pos.y += DIMCELY;
cel.x =
@ -539,8 +572,8 @@ CDecor::ConvPosToCel2 (Point pos)
cel.y -= (DIMCELX * 2 * DIMCELY * 2);
cel.y /= (DIMCELX * 2 * DIMCELY * 2);
cel.x = (cel.x * 2 + m_celCoin.x) / 2 * 2;
cel.y = (cel.y * 2 + m_celCoin.y) / 2 * 2;
cel.x = (cel.x * 2 + m_celCorner.x) / 2 * 2;
cel.y = (cel.y * 2 + m_celCorner.y) / 2 * 2;
return cel;
}
@ -972,6 +1005,8 @@ CDecor::BuildGround (Rect clip)
nby += 2;
}
this->FixShifting (nbx, nby, iCel, iPos);
// Construit les sols.
mCel = iCel;
mPos = iPos;
@ -1112,6 +1147,8 @@ CDecor::Build (Rect clip, Point posMouse)
nby += 2;
}
this->FixShifting (nbx, nby, iCel, iPos);
// Construit les sols.
mCel = iCel;
mPos = iPos;
@ -1229,6 +1266,8 @@ CDecor::Build (Rect clip, Point posMouse)
// Construit les objets et les blupi.
BuildPutBlupi (); // m_rankBlupi[x][y] <- rangs des blupi
this->FixShifting (nbx, nby, iCel, iPos);
mCel = iCel;
mPos = iPos;
for (j = 0; j < nby + 3; j++)
@ -1435,24 +1474,7 @@ CDecor::Build (Rect clip, Point posMouse)
if (!m_bFog)
goto term;
if (m_shiftOffset.x < 0) // décalage à droite ?
nbx += 2;
if (m_shiftOffset.y < 0) // décalage en bas ?
nby += 2;
if (m_shiftOffset.x > 0) // décalage à gauche ?
{
nbx += 2;
iCel.x--;
iCel.y++;
iPos = ConvCelToPos (iCel);
}
if (m_shiftOffset.y > 0) // décalage en haut ?
{
nby += 2;
iCel.x--;
iCel.y--;
iPos = ConvCelToPos (iCel);
}
this->FixShifting (nbx, nby, iCel, iPos);
mCel = iCel;
mPos = iPos;
@ -2985,8 +3007,8 @@ CDecor::GetResHili (Point posMouse)
{
Sint32 icon;
// Les valeurs `corner == true` correspondent aux objets placés
// au coin inf/droit de la cellule.
// The `corner == true` values are corresponding to the objects
// positionned at the bottom/right corner of the cell.
struct object_t {
bool corner;
const char * text;
@ -3261,33 +3283,33 @@ CDecor::HideTooltips (bool bHide)
// Modifie l'origine supérieure/gauche du décor.
void
CDecor::SetCoin (Point coin, bool bCenter)
CDecor::SetCorner (Point corner, bool bCenter)
{
if (bCenter)
{
coin.x -= 10;
coin.y -= 2;
corner.x -= 10;
corner.y -= 2;
}
if (coin.x < -8)
coin.x = -8;
if (coin.x > MAXCELX - 12)
coin.x = MAXCELX - 12;
if (coin.y < -2)
coin.y = -2;
if (coin.y > MAXCELY - 4)
coin.y = MAXCELY - 4;
if (corner.x < -8)
corner.x = -8;
if (corner.x > MAXCELX - 12)
corner.x = MAXCELX - 12;
if (corner.y < -2)
corner.y = -2;
if (corner.y > MAXCELY - 4)
corner.y = MAXCELY - 4;
m_celCoin = coin;
m_celCorner = corner;
m_bGroundRedraw = true; // faudra redessiner les sols
m_celHili.x = -1;
m_textLastPos.x = -1; // tooltips plus lavable !
}
Point
CDecor::GetCoin ()
CDecor::GetCorner ()
{
return m_celCoin;
return m_celCorner;
}
Point
@ -3312,7 +3334,7 @@ CDecor::MemoPos (Sint32 rank, bool bRecord)
if (bRecord)
{
m_pSound->PlayImage (SOUND_CLOSE, pos);
m_memoPos[rank] = m_celCoin;
m_memoPos[rank] = m_celCorner;
}
else
{
@ -3321,7 +3343,7 @@ CDecor::MemoPos (Sint32 rank, bool bRecord)
else
{
m_pSound->PlayImage (SOUND_GOAL, pos);
SetCoin (m_memoPos[rank], false);
SetCorner (m_memoPos[rank], false);
}
}
}

View File

@ -322,6 +322,7 @@ public:
Term * GetTerminated ();
// DecMove.cpp
bool CanBurn (Point cel);
void MoveFlush ();
Sint32 MoveMaxFire ();
void MoveFixInit ();
@ -381,6 +382,7 @@ public:
bool IsCheminFree (Sint32 rank, Point dest, Sint32 button);
// Decor.cpp
void FixShifting (Sint32 & nbx, Sint32 & nby, Point & iCel, Point & iPos);
void SetShiftOffset (Point offset);
Point ConvCelToPos (Point cel);
Point ConvPosToCel (Point pos, bool bMap = false);
@ -406,8 +408,8 @@ public:
bool GetObject (Point cel, Sint32 & channel, Sint32 & icon);
bool SetFire (Point cel, bool bFire);
void SetCoin (Point coin, bool bCenter = false);
Point GetCoin ();
void SetCorner (Point corner, bool bCenter = false);
Point GetCorner ();
Point GetHome ();
void MemoPos (Sint32 rank, bool bRecord);
@ -467,8 +469,8 @@ protected:
Sint16 m_rankBlupi[MAXCELX][MAXCELY];
Blupi m_blupi[MAXBLUPI];
Move m_move[MAXMOVE];
Point m_celCoin; // cellule sup/gauche
Point m_celHome; // pour touche Home
Point m_celCorner; // cellule sup/gauche
Point m_celHome; // pour touche Home
Point m_celHili;
Point m_celOutline1;
Point m_celOutline2;

View File

@ -448,7 +448,9 @@ CDecor::StatisticUpdate ()
{
if (m_blupi[rank].bExist)
{
if (m_blupi[rank].perso == 0) // blupi ?
if (
m_blupi[rank].perso == 0 && m_blupi[rank].action != ACTION_TCHAO &&
m_blupi[rank].action != ACTION_BURN) // blupi ?
{
if (m_blupi[rank].bMalade)
table_statistic[STATBLUPIm].nb++;
@ -475,7 +477,7 @@ CDecor::StatisticUpdate ()
// Hide enemies from the stat when hidden by the fog
bool hide = false;
if (this->GetSkill () >= 1)
if (this->GetSkill () >= 1 && this->m_bFog)
{
auto fogCel = m_blupi[rank].cel;
fogCel.x = (fogCel.x / 4) * 4;
@ -974,7 +976,7 @@ CDecor::StatisticDown (Point pos)
return false;
select:
SetCoin (cel, true);
SetCorner (cel, true);
NextPhase (0); // faudra refaire la carte tout de suite
return true;
}

View File

@ -389,6 +389,13 @@ enum MouseSprites {
SPRITE_END = 14,
};
enum ShiftDirection {
DIRECTION_UP = (1 << 0),
DIRECTION_DOWN = (1 << 1),
DIRECTION_LEFT = (1 << 2),
DIRECTION_RIGHT = (1 << 3),
};
// clang-format off
#define EV_OFFSET 0x0400

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
* This file is part of the planetblupi source code
* Copyright (C) 1997, Daniel Roux & EPSITEC SA
* Copyright (C) 2017, Mathieu Schroeter
* Copyright (C) 2017-2018, Mathieu Schroeter
* http://epsitec.ch; http://www.blupi.org; http://github.com/blupi-games
*
* This program is free software: you can redistribute it and/or modify
@ -63,8 +63,8 @@ typedef struct {
typedef struct {
Sint32 time;
Uint32 message;
Uint32 wParam; // WPARAM
Uint32 lParam; // LPARAM
Uint32 wParam; // WParam
Uint32 lParam; // LParam
} DemoEvent;
struct DemoSDLEvent {
@ -96,16 +96,18 @@ public:
Point GetMousePos ();
void
Create (CPixmap * pPixmap, CDecor * pDecor, CSound * pSound, CMovie * pMovie);
void SetFullScreen (bool bFullScreen);
Sint32 GetWorld ();
Sint32 GetPhysicalWorld ();
Sint32 GetImageWorld ();
bool IsHelpHide ();
bool ChangePhase (Uint32 phase);
bool MovieToStart ();
Uint32 GetPhase ();
void TryInsert ();
Create (CPixmap * pPixmap, CDecor * pDecor, CSound * pSound, CMovie * pMovie);
void SetFullScreen (bool bFullScreen);
Sint32 GetWorld ();
Sint32 GetPhysicalWorld ();
Sint32 GetImageWorld ();
bool IsHelpHide ();
bool IsBaseMusicAvailable (Sint32 music, const std::string & format);
std::string GetMusicLocation (Sint32 music);
bool ChangePhase (Uint32 phase);
bool MovieToStart ();
Uint32 GetPhase ();
void TryInsert ();
Sint32 GetButtonIndex (Sint32 button);
Sint32 GetState (Sint32 button);
@ -144,9 +146,8 @@ public:
void IntroStep ();
Uint8 GetWindowScale ();
void SetWindowSize (Uint8 newScale);
void SetUpdateVersion (const std::string & version);
void SetWindowSize (Uint8 newScale);
void SetUpdateVersion (const std::string & version);
static void PushUserEvent (Sint32 code, void * data = nullptr);
@ -171,7 +172,8 @@ protected:
void BuildFloor (Point cel, Sint32 insIcon);
void BuildWater (Point cel, Sint32 insIcon);
bool BuildDown (Point pos, Uint16 mod, bool bMix = true);
bool
BuildDown (Point pos, Uint16 mod, const SDL_Event * event, bool bMix = true);
bool BuildMove (Point pos, Uint16 mod, const SDL_Event & event);
void PrivateLibelle ();
@ -184,7 +186,7 @@ protected:
bool DemoPlayStart (const std::string * demoFile = nullptr);
void DemoPlayStop ();
static void
WinToSDLEvent (Uint32 msg, WPARAM wParam, LPARAM lParam, SDL_Event & event);
WinToSDLEvent (Uint32 msg, WParam wParam, LParam lParam, SDL_Event & event);
void DemoRecEvent (const SDL_Event & event);
protected:
@ -201,8 +203,6 @@ protected:
bool m_bSchool;
bool m_bPrivate;
bool m_bAccessBuild;
bool m_bFullScreen;
Uint8 m_WindowScale;
CPixmap * m_pPixmap;
CDecor * m_pDecor;
CSound * m_pSound;
@ -270,6 +270,7 @@ protected:
Sint32 m_introTime;
Sint32 m_updateBlinking;
std::string m_updateVersion;
Uint32 shiftDirection;
};
/////////////////////////////////////////////////////////////////////////////

View File

@ -39,7 +39,8 @@ CPileTriee::~CPileTriee ()
free (m_data);
}
Sint32 CPileTriee::get ()
Sint32
CPileTriee::get ()
{
if (m_out == m_max)
return -1;
@ -50,7 +51,8 @@ Sint32 CPileTriee::get ()
return val;
}
void CPileTriee::put (Sint32 pos, Sint32 dist)
void
CPileTriee::put (Sint32 pos, Sint32 dist)
{
Sint32 i = m_out;
Sint32 p, d, m;

View File

@ -148,9 +148,7 @@ CMenu::CMenu ()
// Destructeur.
CMenu::~CMenu ()
{
}
CMenu::~CMenu () {}
// Crée un nouveau bouton.
@ -187,9 +185,7 @@ CMenu::Create (
pos = m_pos;
pos.x += DIMBUTTONX / 2;
pos.y += DIMBUTTONY / 2;
SDL_WarpMouseInWindow (
g_window, pos.x * m_pEvent->GetWindowScale (),
pos.y * m_pEvent->GetWindowScale ());
SDL_WarpMouseInWindow (g_window, pos.x * g_zoom, pos.y * g_zoom);
}
m_selRank = Detect (pos);

View File

@ -60,7 +60,7 @@ protected:
CDecor * m_pDecor;
CSound * m_pSound;
CEvent * m_pEvent;
Point m_pos; // coin sup/gauche
Point m_pos; // up/left corner
Point m_dim; // dimensions
Sint32 m_nbButtons;
Point m_nbCel;

View File

@ -48,7 +48,7 @@ OutputDebug (const char * pMessage)
// Conversion de la position de la souris.
Point
ConvLongToPos (LPARAM lParam)
ConvLongToPos (LParam lParam)
{
Point pos;
@ -155,3 +155,33 @@ AddUserPath (std::string & pFilename)
pFilename = path;
SDL_free (temp);
}
bool
FileExists (
const std::string & filename, std::string & absolute, enum Location location)
{
absolute = filename;
FILE * file;
switch (location)
{
case LOCATION_BASE:
absolute = GetBaseDir () + filename;
break;
case LOCATION_USER:
AddUserPath (absolute);
break;
default:
case LOCATION_ABSOLUTE:
break;
}
file = fopen (absolute.c_str (), "rb");
if (file == nullptr)
return false;
fclose (file);
return true;
}

View File

@ -28,7 +28,7 @@
extern void OutputDebug (const char * pMessage);
extern Point ConvLongToPos (LPARAM lParam);
extern Point ConvLongToPos (LParam lParam);
extern void InitRandom ();
extern Sint32 Random (Sint32 min, Sint32 max);
@ -38,6 +38,11 @@ std::string GetShareDir ();
std::string GetLocale ();
extern void AddUserPath (std::string & pFilename);
enum Location { LOCATION_ABSOLUTE, LOCATION_BASE, LOCATION_USER };
bool FileExists (
const std::string & filename, std::string & absolute,
Location location = LOCATION_BASE);
template <typename... Args>
std::string
string_format (const std::string & format, Args... args)

View File

@ -191,22 +191,6 @@ CMovie::GetEnable ()
return m_bEnable;
}
// Indique si un film existe.
bool
CMovie::IsExist (const std::string & pFilename)
{
const auto path = GetBaseDir () + pFilename;
FILE * file;
file = fopen (path.c_str (), "rb");
if (file == nullptr)
return false;
fclose (file);
return true;
}
// Montre un film avi.
bool

View File

@ -170,27 +170,27 @@ CDecor::CheminFillTerrain (Sint32 rank)
if (step < but)
for (dir = 0; dir < 8; dir++)
{
if (CheminTestDirection (rank, pos, dir, next, ampli, cout, action))
{
last = pos + ampli * next;
if (last < 0 || last >= MAXCELX * MAXCELY)
continue;
if (!CheminTestDirection (rank, pos, dir, next, ampli, cout, action))
continue;
if (m_cheminWork[last] == 0 || m_cheminWork[last] > step + cout)
{
// marque les cases sautées
for (Sint32 i = 1; i < ampli; i++)
m_cheminWork[pos + i * next] = step + cout - ampli + i;
last = pos + ampli * next;
if (last < 0 || last >= MAXCELX * MAXCELY)
continue;
m_cheminWork[last] = step + cout;
if (m_cheminWork[last] != 0 && m_cheminWork[last] <= step + cout)
continue;
dx = m_blupi[rank].goalCel.x - last % MAXCELX;
dy = m_blupi[rank].goalCel.y - last / MAXCELX;
// marque les cases sautées
for (Sint32 i = 1; i < ampli; i++)
m_cheminWork[pos + i * next] = step + cout - ampli + i;
dist = (Sint32) (dy * dy) + (Sint32) (dx * dx);
fifo.put (last, dist);
}
}
m_cheminWork[last] = step + cout;
dx = m_blupi[rank].goalCel.x - last % MAXCELX;
dy = m_blupi[rank].goalCel.y - last / MAXCELX;
dist = (Sint32) (dy * dy) + (Sint32) (dx * dx);
fifo.put (last, dist);
}
}
}

View File

@ -275,11 +275,15 @@ CPixmap::Cache (
size_t channel, const std::string & pFilename, Point totalDim, Point iconDim,
Mode mode, size_t chBackWide)
{
std::string file = GetBaseDir () + pFilename;
SDL_Surface * surface = IMG_Load (file.c_str ());
std::string file = GetBaseDir () + pFilename;
SDL_Surface * surface = IMG_Load (file.c_str ());
bool blupiChSet = false;
if (channel == CHBLUPI && !m_lpSDLBlupi)
{
m_lpSDLBlupi = surface;
blupiChSet = true;
}
SDL_Texture * texture = SDL_CreateTextureFromSurface (g_renderer, surface);
Uint32 format;
@ -313,13 +317,11 @@ CPixmap::Cache (
SDL_SetTextureBlendMode (
m_SDLTextureInfo[channel].texture, SDL_BLENDMODE_BLEND);
}
else
{
SDL_SetRenderTarget (g_renderer, m_SDLTextureInfo[channel].texture);
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 0);
SDL_RenderClear (g_renderer);
SDL_SetRenderTarget (g_renderer, nullptr);
}
SDL_SetRenderTarget (g_renderer, m_SDLTextureInfo[channel].texture);
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 0);
SDL_RenderClear (g_renderer);
SDL_SetRenderTarget (g_renderer, nullptr);
m_SDLTextureInfo[channel].texMask = channel == CHMASK2 ? texture : nullptr;
m_SDLTextureInfo[channel].target = true;
@ -385,7 +387,7 @@ CPixmap::Cache (
if (!m_SDLTextureInfo[channel].texMask)
SDL_DestroyTexture (texture);
if (channel != CHBLUPI)
if (!blupiChSet)
SDL_FreeSurface (surface);
return true;

View File

@ -37,9 +37,7 @@ CJauge::CJauge ()
m_pSound = nullptr;
}
CJauge::~CJauge ()
{
}
CJauge::~CJauge () {}
// Crée un nouveau bouton.

View File

@ -48,7 +48,7 @@ protected:
CDecor * m_pDecor;
CSound * m_pSound;
bool m_bHide; // true si bouton caché
Point m_pos; // coin sup/gauche
Point m_pos; // up/left corner
Point m_dim; // dimensions
Sint32 m_type;
Sint32 m_level;

View File

@ -84,6 +84,14 @@ CSound::~CSound ()
Mix_FreeChunk (m_lpSDL[i]);
m_lpSDL[i] = nullptr;
}
if (m_pMusic)
{
Mix_FreeMusic (m_pMusic);
m_pMusic = nullptr;
}
Mix_CloseAudio ();
}
// Initialisation de DirectSound.
@ -318,17 +326,19 @@ CSound::PlayImage (Sounds channel, Point pos, Sint32 rank)
bool
CSound::PlayMusic (const std::string & lpszMIDIFilename)
{
std::string path = GetBaseDir ();
if (m_midiVolume == 0)
return true;
if (lpszMIDIFilename.empty ())
return false;
Mix_VolumeMusic (MIX_MAX_VOLUME * 100 * m_midiVolume / 20 / 100);
m_lastMidiVolume = m_midiVolume;
path += lpszMIDIFilename;
if (m_pMusic)
Mix_FreeMusic (m_pMusic);
m_pMusic = Mix_LoadMUS (path.c_str ());
m_pMusic = Mix_LoadMUS (lpszMIDIFilename.c_str ());
if (!m_pMusic)
{
printf ("%s\n", Mix_GetError ());

View File

@ -120,7 +120,7 @@ GetCharWidth (const char *& c, Sint32 font)
6, 8, 7, 6, 6, 6, 8, 12, 7, 6, 6, 3, 5, 3, 6, 8,
4, 6, 6, 6, 6, 6, 4, 6, 6, 2, 3, 5, 2, 10, 6, 6,
6, 6, 3, 5, 3, 6, 6, 8, 6, 6, 5, 4, 6, 4, 7, 6,
3, 5, 5, 5, 5, 4, 4, 6, 3, 4
3, 6, 6, 6, 5, 5, 5, 7, 4, 5
};
// clang-format on