Release 0.1.3-alpha

dev-mp colobot-gold-0.1.3-alpha
krzys-h 2014-07-01 12:15:38 +02:00
commit d9fee8b2ad
106 changed files with 3005 additions and 2889 deletions

3
.gitignore vendored
View File

@ -24,3 +24,6 @@ Makefile
# Ignore KDevelop files # Ignore KDevelop files
.kdev4 .kdev4
*.kdev4 *.kdev4
# Ignore gedit temp files
*~

View File

@ -13,7 +13,7 @@ project(colobot C CXX)
set(COLOBOT_VERSION_CODENAME "Gold") set(COLOBOT_VERSION_CODENAME "Gold")
set(COLOBOT_VERSION_MAJOR 0) set(COLOBOT_VERSION_MAJOR 0)
set(COLOBOT_VERSION_MINOR 1) set(COLOBOT_VERSION_MINOR 1)
set(COLOBOT_VERSION_REVISION 2) set(COLOBOT_VERSION_REVISION 3)
# Used on official releases # Used on official releases
set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha") set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha")
@ -21,15 +21,24 @@ set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha")
#set(COLOBOT_VERSION_UNRELEASED "+alpha") #set(COLOBOT_VERSION_UNRELEASED "+alpha")
# Append git characteristics to version # Append git characteristics to version
if(DEFINED COLOBOT_VERSION_UNRELEASED AND EXISTS "${CMAKE_SOURCE_DIR}/.git") if(DEFINED COLOBOT_VERSION_UNRELEASED)
find_package(Git) if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD find_package(Git)
OUTPUT_VARIABLE GIT_BRANCH execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_STRIP_TRAILING_WHITESPACE) WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_VARIABLE GIT_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE)
OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
set(COLOBOT_VERSION_UNRELEASED "${COLOBOT_VERSION_UNRELEASED}-git-${GIT_BRANCH}~r${GIT_REVISION}") WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(COLOBOT_VERSION_UNRELEASED "${COLOBOT_VERSION_UNRELEASED}-git-${GIT_BRANCH}~r${GIT_REVISION}")
set(COLOBOT_VERSION_DISPLAY "git-${GIT_BRANCH}~r${GIT_REVISION}")
else()
set(COLOBOT_VERSION_DISPLAY "${COLOBOT_VERSION_CODENAME}-${COLOBOT_VERSION_UNRELEASED}")
endif()
else()
set(COLOBOT_VERSION_DISPLAY "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_RELEASE_CODENAME}")
endif() endif()
set(COLOBOT_VERSION_FULL "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_UNRELEASED}${COLOBOT_VERSION_RELEASE_CODENAME}") set(COLOBOT_VERSION_FULL "${COLOBOT_VERSION_MAJOR}.${COLOBOT_VERSION_MINOR}.${COLOBOT_VERSION_REVISION}${COLOBOT_VERSION_UNRELEASED}${COLOBOT_VERSION_RELEASE_CODENAME}")
@ -42,6 +51,7 @@ message(STATUS "Building Colobot \"${COLOBOT_VERSION_CODENAME}\" (${COLOBOT_VERS
if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows") if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
message(STATUS "Build for Windows system") message(STATUS "Build for Windows system")
set(PLATFORM_WINDOWS 1) set(PLATFORM_WINDOWS 1)
set(PLATFORM_GNU 0)
set(PLATFORM_LINUX 0) set(PLATFORM_LINUX 0)
set(PLATFORM_MACOSX 0) set(PLATFORM_MACOSX 0)
set(PLATFORM_OTHER 0) set(PLATFORM_OTHER 0)
@ -52,15 +62,27 @@ elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
message(STATUS "Build for Linux system") message(STATUS "Build for Linux system")
set(PLATFORM_WINDOWS 0) set(PLATFORM_WINDOWS 0)
set(PLATFORM_LINUX 1) set(PLATFORM_LINUX 1)
set(PLATFORM_GNU 1)
set(PLATFORM_MACOSX 0) set(PLATFORM_MACOSX 0)
set(PLATFORM_OTHER 0) set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h # Platform-dependent implementation of system.h
set(SYSTEM_CPP_MODULE "system_linux.cpp") set(SYSTEM_CPP_MODULE "system_linux.cpp")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "kFreeBSD" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
message(STATUS "Build for kFreeBSD system")
set(PLATFORM_WINDOWS 0)
set(PLATFORM_LINUX 0)
set(PLATFORM_GNU 1)
set(PLATFORM_MACOSX 0)
set(PLATFORM_OTHER 0)
# Platform-dependent implementation of system.h
set(SYSTEM_CPP_MODULE "system_other.cpp")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
message(STATUS "Build for Mac OSX system") message(STATUS "Build for Mac OSX system")
set(PLATFORM_WINDOWS 0) set(PLATFORM_WINDOWS 0)
set(PLATFORM_LINUX 0) set(PLATFORM_LINUX 0)
set(PLATFORM_GNU 0)
set(PLATFORM_MACOSX 1) set(PLATFORM_MACOSX 1)
set(PLATFORM_OTHER 0) set(PLATFORM_OTHER 0)
@ -72,6 +94,7 @@ else()
message(STATUS "Build for other system") message(STATUS "Build for other system")
set(PLATFORM_WINDOWS 0) set(PLATFORM_WINDOWS 0)
set(PLATFORM_LINUX 0) set(PLATFORM_LINUX 0)
set(PLATFORM_GNU 0)
set(PLATFORM_MACOSX 0) set(PLATFORM_MACOSX 0)
set(PLATFORM_OTHER 1) set(PLATFORM_OTHER 1)
@ -123,6 +146,9 @@ set(COLOBOT_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast ${CXX11_FLAGS}
set(COLOBOT_CXX_FLAGS_RELEASE "-O2") set(COLOBOT_CXX_FLAGS_RELEASE "-O2")
set(COLOBOT_CXX_FLAGS_DEBUG "-g -O0") set(COLOBOT_CXX_FLAGS_DEBUG "-g -O0")
# Flags for gtest
set(COLOBOT_GTEST_CXX_FLAGS "-pthread")
# Asserts can be enabled/disabled regardless of build type # Asserts can be enabled/disabled regardless of build type
option(ASSERTS "Enable assert()s" ON) option(ASSERTS "Enable assert()s" ON)
@ -226,7 +252,7 @@ include("${colobot_SOURCE_DIR}/cmake/msys.cmake")
## ##
# Clipboard support needs X11 libraries # Clipboard support needs X11 libraries
## ##
if(PLATFORM_LINUX OR PLATFORM_MACOSX) if(PLATFORM_GNU OR PLATFORM_MACOSX)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
if(PLATFORM_MACOSX) if(PLATFORM_MACOSX)
# Add the includes for X11 # Add the includes for X11

View File

@ -117,12 +117,23 @@ You will need:
* OpenAL (OpenAL-Soft) >= 1.13 * OpenAL (OpenAL-Soft) >= 1.13
* po4a >= 0.45 (to generate translated data files) * po4a >= 0.45 (to generate translated data files)
On Ubuntu (and probably any other Debian-based system), you can use the following command to install all required packages:
```
$ apt-get install build-essential cmake libsdl1.2debian libsdl1.2-dev libsdl-image1.2 libsdl-image1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsndfile1-dev libvorbis-dev libogg-dev libpng12-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev git
```
Make sure you install the packages along with header files (often distributed in separate *-dev packages). If you miss any requirements, Make sure you install the packages along with header files (often distributed in separate *-dev packages). If you miss any requirements,
CMake should warn you. CMake should warn you.
To compile colobot, run your favorite shell and change the directory to where you downloaded colobot source files: To compile colobot, run your favorite shell and download colobot source files:
``` ```
$ git clone https://github.com/colobot/colobot.git /path/to/colobot/sources
$ cd /path/to/colobot/sources $ cd /path/to/colobot/sources
$ git submodule update --init
```
If you want to compile development branch, change the first command to:
```
$ git clone -b dev https://github.com/colobot/colobot.git /path/to/colobot/sources
``` ```
It is recommended that you create a build directory: It is recommended that you create a build directory:
``` ```

View File

@ -6,7 +6,7 @@ This is official repository for the open-source Colobot project developed by Pol
The source code contained here was released by Epsitec -- the original creator of the game -- on open source (GPLv3) license. The code was given and the rights granted specifically to PPC community in March 2012. Since then, we have been developing the game further. The source code contained here was released by Epsitec -- the original creator of the game -- on open source (GPLv3) license. The code was given and the rights granted specifically to PPC community in March 2012. Since then, we have been developing the game further.
More information for developers (in English) can be found on the [developer wiki](http://colobot.info/w/Dev:Main_Page) or (in Polish) [our forum](http://colobot.info/forum/). However, the freshest source of information is our IRC channels (see below). More information for developers (in English) can be found on the [developer wiki](http://colobot.info/wiki/Dev:Main_Page) or (in Polish) [our forum](http://colobot.info/forum/). However, the freshest source of information is our IRC channels (see below).
This repository contains only the source code of the project. The game requires also data files which are now provided as git submodule and are hosted in [separate repository](https://github.com/colobot/colobot-data). This repository contains only the source code of the project. The game requires also data files which are now provided as git submodule and are hosted in [separate repository](https://github.com/colobot/colobot-data).
@ -54,7 +54,7 @@ To jest oficjalne repozytorium z kodem projektu open-source Colobot rozwijanego
Kod źródłowy zawarty tutaj został wydany przez Epsitec -- oryginalnego twórcę gry -- na otwartej licencji (GPLv3). Kod został wydany i prawa nadane specjalnie dla społeczności PPC w marcu 2012. Od tamtej pory, zajmowaliśmy się dalszym rozwojem gry. Kod źródłowy zawarty tutaj został wydany przez Epsitec -- oryginalnego twórcę gry -- na otwartej licencji (GPLv3). Kod został wydany i prawa nadane specjalnie dla społeczności PPC w marcu 2012. Od tamtej pory, zajmowaliśmy się dalszym rozwojem gry.
Więcej informacji dla developerów projektu (po angielsku) można znaleźć na [wiki dla developerów](htt://colobot.info/w/Dev:Main_Page) lub (po polsku) na [naszym forum](http://colobot.info/forum/). Jednak źródłem najświeższych informacji są nasze kanały IRC (patrz niżej). Więcej informacji dla developerów projektu (po angielsku) można znaleźć na [wiki dla developerów](htt://colobot.info/wiki/Dev:Main_Page) lub (po polsku) na [naszym forum](http://colobot.info/forum/). Jednak źródłem najświeższych informacji są nasze kanały IRC (patrz niżej).
To repozytorium zawiera jedynie kod źródłowy projektu. Gra wymaga jeszcze plików danych, które są teraz udostępniane jako submoduł gita i hostowane w [osobnym repozytorium]((https://github.com/colobot/colobot-data). To repozytorium zawiera jedynie kod źródłowy projektu. Gra wymaga jeszcze plików danych, które są teraz udostępniane jako submoduł gita i hostowane w [osobnym repozytorium]((https://github.com/colobot/colobot-data).

2
data

@ -1 +1 @@
Subproject commit 456ab4d4806ffe9aad93b7046f1b8074501f28f5 Subproject commit beff41878d617640c21035c66ea9ddb2e82e6587

View File

@ -4,7 +4,7 @@ set(COLOBOT_ICON_FILE colobot.svg)
# Render SVG icon in various sizes # Render SVG icon in various sizes
find_program(RSVG_CONVERT rsvg-convert) find_program(RSVG_CONVERT rsvg-convert)
if(RSVG_CONVERT AND (PLATFORM_LINUX OR PLATFORM_MACOSX)) if(RSVG_CONVERT AND (PLATFORM_GNU OR PLATFORM_MACOSX))
add_custom_target(png-icons ALL) add_custom_target(png-icons ALL)
foreach(PNGSIZE 512 256 128 48 32 16) foreach(PNGSIZE 512 256 128 48 32 16)
add_custom_command( add_custom_command(
@ -15,7 +15,7 @@ if(RSVG_CONVERT AND (PLATFORM_LINUX OR PLATFORM_MACOSX))
add_custom_target(png-icon-${PNGSIZE} ALL DEPENDS ${PNGSIZE}/colobot.png) add_custom_target(png-icon-${PNGSIZE} ALL DEPENDS ${PNGSIZE}/colobot.png)
add_dependencies(png-icons png-icon-${PNGSIZE}) add_dependencies(png-icons png-icon-${PNGSIZE})
if(PLATFORM_LINUX) if(PLATFORM_GNU)
install( install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
@ -37,7 +37,7 @@ if(RSVG_CONVERT AND (PLATFORM_LINUX OR PLATFORM_MACOSX))
endif() endif()
if(PLATFORM_LINUX) if(PLATFORM_GNU)
# Install Desktop Entry file # Install Desktop Entry file
set(COLOBOT_DESKTOP_FILE colobot.desktop) set(COLOBOT_DESKTOP_FILE colobot.desktop)
add_custom_command( add_custom_command(
@ -112,7 +112,7 @@ if(PLATFORM_LINUX)
endforeach() endforeach()
endif() endif()
endif() endif()
endif(PLATFORM_LINUX) endif(PLATFORM_GNU)
if(PLATFORM_MACOSX) if(PLATFORM_MACOSX)
configure_file(Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) configure_file(Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

After

Width:  |  Height:  |  Size: 361 KiB

View File

@ -8,232 +8,394 @@
xmlns:svg="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="32"
height="32"
id="svg2"
version="1.1" version="1.1"
width="48" inkscape:version="0.48.4 r9939"
height="48" sodipodi:docname="colobot_gold_icon.svg">
id="colobot-logo" <defs
style="enable-background:new"> id="defs4">
<title <linearGradient
id="title3020">Colobot icon</title> inkscape:collect="always"
id="linearGradient3992">
<stop
style="stop-color:#f5c700;stop-opacity:1;"
offset="0"
id="stop3994" />
<stop
style="stop-color:#000000;stop-opacity:1"
offset="1"
id="stop3996" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3984">
<stop
style="stop-color:#f5c700;stop-opacity:1;"
offset="0"
id="stop3986" />
<stop
style="stop-color:#000000;stop-opacity:1"
offset="1"
id="stop3988" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3971">
<stop
style="stop-color:#f5c700;stop-opacity:1;"
offset="0"
id="stop3973" />
<stop
style="stop-color:#000000;stop-opacity:1"
offset="1"
id="stop3975" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3963">
<stop
style="stop-color:#000000;stop-opacity:1"
offset="0"
id="stop3965" />
<stop
style="stop-color:#7f6400;stop-opacity:0;"
offset="1"
id="stop3967" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3945">
<stop
style="stop-color:#f5c700;stop-opacity:1;"
offset="0"
id="stop3947" />
<stop
style="stop-color:#000000;stop-opacity:1"
offset="1"
id="stop3949" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3929">
<stop
style="stop-color:#1a1500;stop-opacity:1"
offset="0"
id="stop3931" />
<stop
style="stop-color:#d7ae00;stop-opacity:1"
offset="1"
id="stop3933" />
</linearGradient>
<linearGradient
id="linearGradient3900"
inkscape:collect="always">
<stop
id="stop3902"
offset="0"
style="stop-color:#ffd332;stop-opacity:1" />
<stop
id="stop3904"
offset="1"
style="stop-color:#000000;stop-opacity:1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient3875">
<stop
style="stop-color:#ffd438;stop-opacity:1"
offset="0"
id="stop3877" />
<stop
style="stop-color:#000000;stop-opacity:1"
offset="1"
id="stop3879" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3900"
id="radialGradient3881"
cx="17.855946"
cy="25.094042"
fx="17.855946"
fy="25.094042"
r="0.99545348"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.3589521,0,0,2.3589521,-24.265377,-34.101604)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3875"
id="radialGradient3891"
cx="17.855946"
cy="25.094042"
fx="17.855946"
fy="25.094042"
r="0.99545348"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.4704161,0,0,2.4704161,-26.255671,-36.898686)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3929"
id="linearGradient3939"
x1="3.3806913"
y1="1040.2177"
x2="24.976213"
y2="1037.3557"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3929"
id="linearGradient3943"
gradientUnits="userSpaceOnUse"
x1="3.3806913"
y1="1040.2177"
x2="24.976213"
y2="1037.3557"
gradientTransform="matrix(1,0,0,-1,3.746111e-8,2073.851)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3945"
id="linearGradient3951"
x1="21.963614"
y1="1036.9344"
x2="27.312754"
y2="1039.2969"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3963"
id="linearGradient3969"
x1="6.533155"
y1="11.615763"
x2="6.4043641"
y2="17.009403"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3971"
id="linearGradient3977"
x1="-616.87164"
y1="820.93103"
x2="-625.89124"
y2="820.48627"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3984"
id="linearGradient3990"
x1="5.9375"
y1="13.84375"
x2="6.0625"
y2="19.5625"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3992"
id="linearGradient3998"
x1="10.5"
y1="22.125"
x2="7.1875"
y2="29.4375"
gradientUnits="userSpaceOnUse" />
<filter
inkscape:collect="always"
id="filter4138"
x="-0.1131677"
width="1.2263354"
y="-0.096803329"
height="1.1936067">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.1726717"
id="feGaussianBlur4140" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="12"
inkscape:cy="17.760377"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="977"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1" />
<metadata <metadata
id="metadata3061"> id="metadata7">
<rdf:RDF> <rdf:RDF>
<cc:Work <cc:Work
rdf:about=""> rdf:about="">
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Colobot icon</dc:title> <dc:title></dc:title>
<dc:date>2012-12-27</dc:date>
<dc:rights>
<cc:Agent>
<dc:title></dc:title>
</cc:Agent>
</dc:rights>
<dc:creator>
<cc:Agent>
<dc:title>Polish Portal of Colobot</dc:title>
</cc:Agent>
</dc:creator>
<cc:license
rdf:resource="http://www.gnu.org/licenses/gpl-3.0-standalone.html" />
<dc:description>Three spheres symbolizing planets.</dc:description>
<dc:contributor>
<cc:Agent>
<dc:title>Didier Raboud &lt;odyx@debian.org&gt;</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
<defs
id="defs3059">
<linearGradient
id="linearGradient4108">
<stop
id="stop4110"
style="stop-color:#008000;stop-opacity:1"
offset="0" />
<stop
id="stop4112"
style="stop-color:#000000;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient4096">
<stop
id="stop4098"
style="stop-color:#00ff00;stop-opacity:1"
offset="0" />
<stop
id="stop4100"
style="stop-color:#00ff00;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient4108-5">
<stop
id="stop4110-2"
style="stop-color:#000080;stop-opacity:1"
offset="0" />
<stop
id="stop4112-8"
style="stop-color:#000000;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient4096-0">
<stop
id="stop4098-3"
style="stop-color:#0000ff;stop-opacity:1"
offset="0" />
<stop
id="stop4100-0"
style="stop-color:#0000ff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient4108-5-2">
<stop
id="stop4110-2-3"
style="stop-color:#500000;stop-opacity:1"
offset="0" />
<stop
id="stop4112-8-6"
style="stop-color:#000000;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
id="linearGradient4096-0-3">
<stop
id="stop4098-3-7"
style="stop-color:#ff0000;stop-opacity:1"
offset="0" />
<stop
id="stop4100-0-3"
style="stop-color:#ff0000;stop-opacity:0"
offset="1" />
</linearGradient>
<radialGradient
cx="54.8265"
cy="57.607162"
r="56.05489"
fx="54.8265"
fy="57.607162"
id="radialGradient4416"
xlink:href="#linearGradient4108-5-2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.02726606,1.3911392,-1.8797791,0.03684323,176.62558,-41.562143)" />
<radialGradient
cx="63.5"
cy="37.5"
r="32"
fx="63.5"
fy="37.5"
id="radialGradient4418"
xlink:href="#linearGradient4096-0-3"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.796875,6.7936132,3.6927801)" />
<radialGradient
cx="54.8265"
cy="57.607162"
r="56.05489"
fx="54.8265"
fy="57.607162"
id="radialGradient4420"
xlink:href="#linearGradient4108"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.02726606,1.3911392,-1.8797791,0.03684323,176.62558,-41.562143)" />
<radialGradient
cx="63.5"
cy="37.5"
r="32"
fx="63.5"
fy="37.5"
id="radialGradient4422"
xlink:href="#linearGradient4096"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.796875,6.7936132,3.6927801)" />
<radialGradient
cx="54.8265"
cy="57.607162"
r="56.05489"
fx="54.8265"
fy="57.607162"
id="radialGradient4424"
xlink:href="#linearGradient4108-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.02726606,1.3911392,-1.8797791,0.03684323,176.62558,-41.562143)" />
<radialGradient
cx="63.5"
cy="37.5"
r="32"
fx="63.5"
fy="37.5"
id="radialGradient4426"
xlink:href="#linearGradient4096-0"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.796875,6.7936132,3.6927801)" />
</defs>
<path
d="m 35.001373,17.978157 a 17.137194,11.839104 0 1 1 -34.27438587,0 17.137194,11.839104 0 1 1 34.27438587,0 z"
id="path3068"
style="opacity:0;color:#000000;fill:#800000;fill-opacity:1;fill-rule:nonzero;stroke:#ff0000;stroke-width:1.45397186;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:11.63177575, 11.63177575;stroke-dashoffset:11.63177575;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<g <g
transform="matrix(1.4527314,0,0,1.4552231,61.790796,7.2674667)" inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1" id="layer1"
style="display:inline"> transform="translate(0,-1020.3622)">
<g <g
transform="translate(-64.376292,0)" id="g4088"
id="g4403"> style="fill:#000000;fill-opacity:1;stroke:none;filter:url(#filter4138)">
<g <path
transform="matrix(0.1151419,-0.11259991,0.11259991,0.1151419,78.136911,8.9624182)" style="fill:#000000;fill-opacity:1;stroke:none"
id="g4122-3-7" d="M 8.3125 15.125 L 4.3125 15.125 L 4.3125 20.125 L 11.71875 24.03125 L 10.75 19.1875 L 8.3125 17.9375 L 8.3125 15.125 z "
style="stroke-width:6.52155399;stroke-miterlimit:4;stroke-dasharray:none;display:inline"> id="path4090"
<g transform="translate(0,1020.3622)" />
transform="translate(-232.5787,-246.03551)" <path
id="g4259-8"> style="fill:#000000;fill-opacity:1;stroke:none"
<path d="M 3.9375 15.125 L 4.0625 15.125 L 4.3125 15.125 L 8.3125 15.125 L 10.0625 15.125 L 11.5 11.9375 L 4.0625 11.9375 L 3.9375 11.9375 C 3.1182867 12.0035 2.46875 12.69505 2.46875 13.53125 C 2.46875 14.36735 3.1182867 15.0592 3.9375 15.125 z M 4.25 12.46875 C 4.8128073 12.46875 5.28125 12.9372 5.28125 13.5 C 5.28125 14.0628 4.8128073 14.5 4.25 14.5 C 3.6871927 14.5 3.25 14.0628 3.25 13.5 C 3.25 12.9372 3.6871927 12.46875 4.25 12.46875 z "
d="m 128.20539,62.567638 c 0,29.922729 -24.25716,54.179892 -54.179886,54.179892 -29.922729,0 -54.179893,-24.257163 -54.179893,-54.179892 0,-29.922729 24.257164,-54.1798929 54.179893,-54.1798929 29.922726,0 54.179886,24.2571639 54.179886,54.1798929 z" id="path4092"
id="path1873-0-2" transform="translate(0,1020.3622)" />
style="fill:url(#radialGradient4416);fill-opacity:1;fill-rule:nonzero;stroke:#808000;stroke-width:4.65700197;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> <path
<path inkscape:connector-curvature="0"
d="m 102.29361,33.575593 c 0,14.083261 -14.326885,25.5 -31.999997,25.5 -17.673112,0 -32,-11.416739 -32,-25.5 0,-14.083261 14.326888,-25.4999999 32,-25.4999999 17.673112,0 31.999997,11.4167389 31.999997,25.4999999 z" style="fill:#000000;fill-opacity:1;stroke:none"
id="path2814-0-8" d="m 21.222081,1029.5776 0,3.0313 0,0.2187 c 0.05354,0.5299 0.305986,1.0093 0.6875,1.3438 l -1.34375,3.4062 c 0,0 -0.678869,0.2275 -0.8125,0.5313 -0.133631,0.304 -2.5625,5.6875 -2.5625,5.6875 l 3,1.3125 c 0,0 2.236477,-5.6023 2.34375,-6.0313 0.107269,-0.4291 -0.21875,-0.9687 -0.21875,-0.9687 l 1.34375,-3.4688 c 0.855075,-0.1805 1.502987,-0.9233 1.59375,-1.8125 0.007,-0.069 0.03125,-0.148 0.03125,-0.2187 0,-0.1408 -0.0041,-0.2736 -0.03125,-0.4063 l 0,-2.625 -4.03125,0 z m 2.0625,1.7188 c 0.704607,0 1.25,0.5766 1.25,1.2812 0,0.7046 -0.545393,1.25 -1.25,1.25 -0.704607,0 -1.28125,-0.5454 -1.28125,-1.25 0,-0.7046 0.576643,-1.2812 1.28125,-1.2812 z"
style="fill:url(#radialGradient4418);fill-opacity:1;fill-rule:nonzero;stroke:none" /> id="path4094" />
</g> <path
</g> style="fill:#000000;fill-opacity:1;stroke:none;stroke-opacity:1"
<g d="m 16.099107,1038.143 -6.7434222,0 c 0.5910647,7.0352 6.2969722,12.6107 13.4868442,12.6107 1.164025,0 2.196222,-0.3756 3.276465,-0.6478 l 1.219149,-7.8483 c -1.221328,1.0535 -2.756012,1.7525 -4.495614,1.7525 -3.456847,0 -6.192613,-2.5667 -6.743422,-5.8671 z"
transform="matrix(0.1151419,-0.11259991,0.11259991,0.1151419,15.374404,17.677401)" id="path4096"
id="g4122" inkscape:connector-curvature="0" />
style="stroke-width:6.52155399;stroke-miterlimit:4;stroke-dasharray:none"> <rect
<path style="fill:#000000;fill-opacity:1;stroke:none"
d="m 128.20539,62.567638 c 0,29.922729 -24.25716,54.179892 -54.179886,54.179892 -29.922729,0 -54.179893,-24.257163 -54.179893,-54.179892 0,-29.922729 24.257164,-54.1798929 54.179893,-54.1798929 29.922726,0 54.179886,24.2571639 54.179886,54.1798929 z" id="rect4098"
id="path1873" width="7.6608934"
style="fill:url(#radialGradient4420);fill-opacity:1;fill-rule:nonzero;stroke:#808000;stroke-width:4.65700197;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> height="3.4132693"
<path x="-618.29755"
d="m 102.29361,33.575593 c 0,14.083261 -14.326885,25.5 -31.999997,25.5 -17.673112,0 -32,-11.416739 -32,-25.5 0,-14.083261 14.326888,-25.4999999 32,-25.4999999 17.673112,0 31.999997,11.4167389 31.999997,25.4999999 z" y="819.28662"
id="path2814" transform="matrix(0.79194971,-0.61058633,0.61058633,0.79194971,0,0)" />
style="fill:url(#radialGradient4422);fill-opacity:1;fill-rule:nonzero;stroke:none" /> <path
</g> inkscape:connector-curvature="0"
<g id="path4100"
transform="matrix(0.1151419,-0.11259991,0.11259991,0.1151419,57.006572,14.417637)" d="m 16.099107,1035.708 -6.7434222,0 c 0.5910652,-7.0352 6.2969722,-12.6107 13.4868442,-12.6107 1.164025,0 2.196222,0.3756 3.276465,0.6478 l 1.219149,7.8483 c -1.221328,-1.0535 -2.756012,-1.7525 -4.495614,-1.7525 -3.456847,0 -6.192613,2.5667 -6.743422,5.8671 z"
id="g4122-3" style="fill:#000000;fill-opacity:1;stroke:none;stroke-opacity:1" />
style="stroke-width:6.52155399;stroke-miterlimit:4;stroke-dasharray:none;display:inline"> <path
<g sodipodi:type="arc"
transform="translate(-136.63091,-98.230764)" style="fill:#000000;fill-opacity:1;stroke:none"
id="g4259"> id="path4102"
<path sodipodi:cx="17.855946"
d="m 128.20539,62.567638 c 0,29.922729 -24.25716,54.179892 -54.179886,54.179892 -29.922729,0 -54.179893,-24.257163 -54.179893,-54.179892 0,-29.922729 24.257164,-54.1798929 54.179893,-54.1798929 29.922726,0 54.179886,24.2571639 54.179886,54.1798929 z" sodipodi:cy="25.094042"
id="path1873-0" sodipodi:rx="0.99545348"
style="fill:url(#radialGradient4424);fill-opacity:1;fill-rule:nonzero;stroke:#808000;stroke-width:4.65700197;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> sodipodi:ry="0.99545348"
<path d="m 18.851399,25.094042 c 0,0.549774 -0.44568,0.995453 -0.995453,0.995453 -0.549774,0 -0.995454,-0.445679 -0.995454,-0.995453 0,-0.549774 0.44568,-0.995454 0.995454,-0.995454 0.549773,0 0.995453,0.44568 0.995453,0.995454 z"
d="m 102.29361,33.575593 c 0,14.083261 -14.326885,25.5 -31.999997,25.5 -17.673112,0 -32,-11.416739 -32,-25.5 0,-14.083261 14.326888,-25.4999999 32,-25.4999999 17.673112,0 31.999997,11.4167389 31.999997,25.4999999 z" transform="matrix(1.5745242,0,0,1.5745242,-9.9475945,1006.505)" />
id="path2814-0" <path
style="fill:url(#radialGradient4426);fill-opacity:1;fill-rule:nonzero;stroke:none" /> transform="matrix(2.375,0,0,2.375,-28.844818,972.79257)"
</g> d="m 18.851399,25.094042 c 0,0.549774 -0.44568,0.995453 -0.995453,0.995453 -0.549774,0 -0.995454,-0.445679 -0.995454,-0.995453 0,-0.549774 0.44568,-0.995454 0.995454,-0.995454 0.549773,0 0.995453,0.44568 0.995453,0.995454 z"
</g> sodipodi:ry="0.99545348"
sodipodi:rx="0.99545348"
sodipodi:cy="25.094042"
sodipodi:cx="17.855946"
id="path4104"
style="fill:#000000;fill-opacity:1;stroke:none"
sodipodi:type="arc" />
<path
sodipodi:type="arc"
style="fill:#000000;fill-opacity:1;stroke:none"
id="path4106"
sodipodi:cx="17.855946"
sodipodi:cy="25.094042"
sodipodi:rx="0.99545348"
sodipodi:ry="0.99545348"
d="m 18.851399,25.094042 c 0,0.549774 -0.44568,0.995453 -0.995453,0.995453 -0.549774,0 -0.995454,-0.445679 -0.995454,-0.995453 0,-0.549774 0.44568,-0.995454 0.995454,-0.995454 0.549773,0 0.995453,0.44568 0.995453,0.995454 z"
transform="matrix(1.7120874,0,0,1.7120874,-17.007887,989.42773)" />
<rect
style="fill:#000000;fill-opacity:1;stroke:none"
id="rect4108"
width="3.9995728"
height="4.5299025"
x="4.3089318"
y="15.095729"
transform="translate(0,1020.3622)" />
</g>
<g
id="g4000">
<path
transform="translate(0,1020.3622)"
id="path3982"
d="M 8.3125 15.125 L 4.3125 15.125 L 4.3125 20.125 L 11.71875 24.03125 L 10.75 19.1875 L 8.3125 17.9375 L 8.3125 15.125 z "
style="fill:url(#linearGradient3998);fill-opacity:1;stroke:none" />
<path
transform="translate(0,1020.3622)"
id="path3838"
d="M 3.9375 15.125 L 4.0625 15.125 L 4.3125 15.125 L 8.3125 15.125 L 10.0625 15.125 L 11.5 11.9375 L 4.0625 11.9375 L 3.9375 11.9375 C 3.1182867 12.0035 2.46875 12.69505 2.46875 13.53125 C 2.46875 14.36735 3.1182867 15.0592 3.9375 15.125 z M 4.25 12.46875 C 4.8128073 12.46875 5.28125 12.9372 5.28125 13.5 C 5.28125 14.0628 4.8128073 14.5 4.25 14.5 C 3.6871927 14.5 3.25 14.0628 3.25 13.5 C 3.25 12.9372 3.6871927 12.46875 4.25 12.46875 z "
style="fill:url(#linearGradient3990);fill-opacity:1;stroke:none" />
<path
id="path3846"
d="m 21.222081,1029.5776 0,3.0313 0,0.2187 c 0.05354,0.5299 0.305986,1.0093 0.6875,1.3438 l -1.34375,3.4062 c 0,0 -0.678869,0.2275 -0.8125,0.5313 -0.133631,0.304 -2.5625,5.6875 -2.5625,5.6875 l 3,1.3125 c 0,0 2.236477,-5.6023 2.34375,-6.0313 0.107269,-0.4291 -0.21875,-0.9687 -0.21875,-0.9687 l 1.34375,-3.4688 c 0.855075,-0.1805 1.502987,-0.9233 1.59375,-1.8125 0.007,-0.069 0.03125,-0.148 0.03125,-0.2187 0,-0.1408 -0.0041,-0.2736 -0.03125,-0.4063 l 0,-2.625 -4.03125,0 z m 2.0625,1.7188 c 0.704607,0 1.25,0.5766 1.25,1.2812 0,0.7046 -0.545393,1.25 -1.25,1.25 -0.704607,0 -1.28125,-0.5454 -1.28125,-1.25 0,-0.7046 0.576643,-1.2812 1.28125,-1.2812 z"
style="fill:url(#linearGradient3951);fill-opacity:1;stroke:none"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path3836"
d="m 16.099107,1038.143 -6.7434222,0 c 0.5910647,7.0352 6.2969722,12.6107 13.4868442,12.6107 1.164025,0 2.196222,-0.3756 3.276465,-0.6478 l 1.219149,-7.8483 c -1.221328,1.0535 -2.756012,1.7525 -4.495614,1.7525 -3.456847,0 -6.192613,-2.5667 -6.743422,-5.8671 z"
style="fill:#f5c700;fill-opacity:1;stroke:url(#linearGradient3939);stroke-opacity:1" />
<rect
transform="matrix(0.79194971,-0.61058633,0.61058633,0.79194971,0,0)"
y="819.28662"
x="-618.29755"
height="3.4132693"
width="7.6608934"
id="rect3852"
style="fill:url(#linearGradient3977);fill-opacity:1;stroke:none" />
<path
style="fill:#f5c700;fill-opacity:1;stroke:url(#linearGradient3943);stroke-opacity:1"
d="m 16.099107,1035.708 -6.7434222,0 c 0.5910652,-7.0352 6.2969722,-12.6107 13.4868442,-12.6107 1.164025,0 2.196222,0.3756 3.276465,0.6478 l 1.219149,7.8483 c -1.221328,-1.0535 -2.756012,-1.7525 -4.495614,-1.7525 -3.456847,0 -6.192613,2.5667 -6.743422,5.8671 z"
id="path3941"
inkscape:connector-curvature="0" />
<path
transform="matrix(1.5745242,0,0,1.5745242,-9.9475945,1006.505)"
d="m 18.851399,25.094042 c 0,0.549774 -0.44568,0.995453 -0.995453,0.995453 -0.549774,0 -0.995454,-0.445679 -0.995454,-0.995453 0,-0.549774 0.44568,-0.995454 0.995454,-0.995454 0.549773,0 0.995453,0.44568 0.995453,0.995454 z"
sodipodi:ry="0.99545348"
sodipodi:rx="0.99545348"
sodipodi:cy="25.094042"
sodipodi:cx="17.855946"
id="path3860"
style="fill:url(#radialGradient3881);fill-opacity:1;stroke:none"
sodipodi:type="arc" />
<path
sodipodi:type="arc"
style="fill:url(#radialGradient3891);fill-opacity:1;stroke:none"
id="path3862"
sodipodi:cx="17.855946"
sodipodi:cy="25.094042"
sodipodi:rx="0.99545348"
sodipodi:ry="0.99545348"
d="m 18.851399,25.094042 c 0,0.549774 -0.44568,0.995453 -0.995453,0.995453 -0.549774,0 -0.995454,-0.445679 -0.995454,-0.995453 0,-0.549774 0.44568,-0.995454 0.995454,-0.995454 0.549773,0 0.995453,0.44568 0.995453,0.995454 z"
transform="matrix(2.375,0,0,2.375,-28.844818,972.79257)" />
<path
transform="matrix(1.7120874,0,0,1.7120874,-17.007887,989.42773)"
d="m 18.851399,25.094042 c 0,0.549774 -0.44568,0.995453 -0.995453,0.995453 -0.549774,0 -0.995454,-0.445679 -0.995454,-0.995453 0,-0.549774 0.44568,-0.995454 0.995454,-0.995454 0.549773,0 0.995453,0.44568 0.995453,0.995454 z"
sodipodi:ry="0.99545348"
sodipodi:rx="0.99545348"
sodipodi:cy="25.094042"
sodipodi:cx="17.855946"
id="path3883"
style="fill:#f5c700;fill-opacity:1;stroke:none"
sodipodi:type="arc" />
<rect
transform="translate(0,1020.3622)"
y="15.095729"
x="4.3089318"
height="4.5299025"
width="3.9995728"
id="rect3961"
style="fill:url(#linearGradient3969);fill-opacity:1;stroke:none" />
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -7,8 +7,6 @@ add_definitions(-DLIB_COMPILE=1)
if(PLATFORM_WINDOWS) if(PLATFORM_WINDOWS)
set(CLIPBOARD_SRC src/clipboardWin32.c) set(CLIPBOARD_SRC src/clipboardWin32.c)
elseif(PLATFORM_LINUX)
set(CLIPBOARD_SRC src/clipboardX11.c)
else() else()
set(CLIPBOARD_SRC src/clipboardX11.c) set(CLIPBOARD_SRC src/clipboardX11.c)
endif() endif()

View File

@ -53,6 +53,9 @@ msgstr ""
msgid "COLOBOT" msgid "COLOBOT"
msgstr "" msgstr ""
msgid "COLOBOT: Gold Edition"
msgstr ""
msgid "Programming exercises" msgid "Programming exercises"
msgstr "" msgstr ""
@ -68,9 +71,6 @@ msgstr ""
msgid "User levels" msgid "User levels"
msgstr "" msgstr ""
msgid "Prototypes"
msgstr ""
msgid "Options" msgid "Options"
msgstr "" msgstr ""
@ -110,9 +110,6 @@ msgstr ""
msgid " Missions on this level:" msgid " Missions on this level:"
msgstr "" msgstr ""
msgid " Prototypes on this planet:"
msgstr ""
msgid " Free game on this chapter:" msgid " Free game on this chapter:"
msgstr "" msgstr ""
@ -276,10 +273,7 @@ msgstr ""
msgid "User\\User levels" msgid "User\\User levels"
msgstr "" msgstr ""
msgid "Proto\\Prototypes under development" msgid "Change player\\Change player"
msgstr ""
msgid "New player\\Choose player's name"
msgstr "" msgstr ""
msgid "Options\\Preferences" msgid "Options\\Preferences"

View File

@ -39,9 +39,6 @@ msgstr " Liste der Missionen des Planeten:"
msgid " Planets:" msgid " Planets:"
msgstr " Liste der Planeten:" msgstr " Liste der Planeten:"
msgid " Prototypes on this planet:"
msgstr " Liste der Prototypen des Planeten:"
msgid " Resolution:" msgid " Resolution:"
msgstr " Auflösung:" msgstr " Auflösung:"
@ -88,15 +85,12 @@ msgstr "3D-Geräusche\\Orten der Geräusche im Raum"
msgid "<< Back \\Back to the previous screen" msgid "<< Back \\Back to the previous screen"
msgstr "<< Zurück \\Zurück zum Hauptmenü" msgstr "<< Zurück \\Zurück zum Hauptmenü"
#, fuzzy
msgid "<<< Sorry; mission failed >>>" msgid "<<< Sorry; mission failed >>>"
msgstr "<<< Mission gescheitert >>>" msgstr "<<< Mission gescheitert >>>"
#, fuzzy
msgid "<<< Well done; mission accomplished >>>" msgid "<<< Well done; mission accomplished >>>"
msgstr "<<< Bravo, Mission vollendet >>>" msgstr "<<< Bravo, Mission vollendet >>>"
#, fuzzy
msgid "A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\"" msgid "A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\""
msgstr "" msgstr ""
"Ein Label kann nur vor den Anweisungen \"for\", \"while\", \"do\" oder " "Ein Label kann nur vor den Anweisungen \"for\", \"while\", \"do\" oder "
@ -314,6 +308,9 @@ msgstr "Knopf %1"
msgid "COLOBOT" msgid "COLOBOT"
msgstr "COLOBOT" msgstr "COLOBOT"
msgid "COLOBOT: Gold Edition"
msgstr "COLOBOT: Gold Edition"
msgid "Calling an unknown function" msgid "Calling an unknown function"
msgstr "Die aufgerufene Funktion existiert nicht" msgstr "Die aufgerufene Funktion existiert nicht"
@ -338,7 +335,6 @@ msgstr "Kamera links"
msgid "Camera to right" msgid "Camera to right"
msgstr "Kamera rechts" msgstr "Kamera rechts"
#, fuzzy
msgid "Can not create this; there are too many objects" msgid "Can not create this; there are too many objects"
msgstr "Kein neues Objekt kann erstellt werden (zu viele vorhanden)" msgstr "Kein neues Objekt kann erstellt werden (zu viele vorhanden)"
@ -363,6 +359,9 @@ msgstr "Challenges\\Herausforderungen"
msgid "Change camera\\Switches between onboard camera and following camera" msgid "Change camera\\Switches between onboard camera and following camera"
msgstr "Andere Kamera\\Sichtpunkt einstellen" msgstr "Andere Kamera\\Sichtpunkt einstellen"
msgid "Change player\\Change player"
msgstr "Anderer Spieler\\Spielername ändern"
msgid "Checkpoint" msgid "Checkpoint"
msgstr "Checkpoint" msgstr "Checkpoint"
@ -699,7 +698,6 @@ msgstr "Falscher Batterietyp"
msgid "Incorrect index type" msgid "Incorrect index type"
msgstr "Falscher Typ für einen Index" msgstr "Falscher Typ für einen Index"
#, fuzzy
msgid "Infected by a virus; temporarily out of order" msgid "Infected by a virus; temporarily out of order"
msgstr "Von Virus infiziert, zeitweise außer Betrieb" msgstr "Von Virus infiziert, zeitweise außer Betrieb"
@ -847,9 +845,6 @@ msgstr "Neu ..."
msgid "New bot available" msgid "New bot available"
msgstr "Neuer Roboter verfügbar" msgstr "Neuer Roboter verfügbar"
msgid "New player\\Choose player's name"
msgstr "Anderer Spieler\\Spielername ändern"
msgid "Next" msgid "Next"
msgstr "Nächster" msgstr "Nächster"
@ -1114,12 +1109,6 @@ msgstr "Hilfe CBOT-Sprache\\Hilfe über die Programmiersprache CBOT"
msgid "Programs dispatched by Houston" msgid "Programs dispatched by Houston"
msgstr "Von Houston übermittelte Programme" msgstr "Von Houston übermittelte Programme"
msgid "Proto\\Prototypes under development"
msgstr "Proto\\In Entwicklung befindliche Prototypen"
msgid "Prototypes"
msgstr "Prototypen"
msgid "Public required" msgid "Public required"
msgstr "Hier muss das Wort \"public\" stehen" msgstr "Hier muss das Wort \"public\" stehen"
@ -2053,4 +2042,3 @@ msgstr "www.epsitec.com"
#~ msgid "Zoom" #~ msgid "Zoom"
#~ msgstr "Zoom" #~ msgstr "Zoom"

View File

@ -44,9 +44,6 @@ msgstr " Liste des missions du chapitre :"
msgid " Planets:" msgid " Planets:"
msgstr " Liste des planètes :" msgstr " Liste des planètes :"
msgid " Prototypes on this planet:"
msgstr " Liste des prototypes du chapitre :"
msgid " Resolution:" msgid " Resolution:"
msgstr " Résolutions :" msgstr " Résolutions :"
@ -315,6 +312,9 @@ msgstr "Bouton %1"
msgid "COLOBOT" msgid "COLOBOT"
msgstr "COLOBOT" msgstr "COLOBOT"
msgid "COLOBOT: Gold Edition"
msgstr "COLOBOT: Gold Edition"
msgid "Calling an unknown function" msgid "Calling an unknown function"
msgstr "Appel d'une fonction inexistante" msgstr "Appel d'une fonction inexistante"
@ -363,6 +363,9 @@ msgstr "Défis\\Défis de programmation"
msgid "Change camera\\Switches between onboard camera and following camera" msgid "Change camera\\Switches between onboard camera and following camera"
msgstr "Changement de caméra\\Autre de point de vue" msgstr "Changement de caméra\\Autre de point de vue"
msgid "Change player\\Change player"
msgstr "Autre joueur\\Choix du nom du joueur"
msgid "Checkpoint" msgid "Checkpoint"
msgstr "Indicateur" msgstr "Indicateur"
@ -848,9 +851,6 @@ msgstr "Nouveau ..."
msgid "New bot available" msgid "New bot available"
msgstr "Nouveau robot disponible" msgstr "Nouveau robot disponible"
msgid "New player\\Choose player's name"
msgstr "Autre joueur\\Choix du nom du joueur"
msgid "Next" msgid "Next"
msgstr "Suivant" msgstr "Suivant"
@ -1115,12 +1115,6 @@ msgstr "Instructions programmation\\Explication sur la programmation"
msgid "Programs dispatched by Houston" msgid "Programs dispatched by Houston"
msgstr "Programmes envoyés par Houston" msgstr "Programmes envoyés par Houston"
msgid "Proto\\Prototypes under development"
msgstr "Proto\\Prototypes en cours d'élaboration"
msgid "Prototypes"
msgstr "Prototypes"
msgid "Public required" msgid "Public required"
msgstr "Public requis" msgstr "Public requis"
@ -2055,4 +2049,3 @@ msgstr "www.epsitec.com"
#~ msgid "Zoom" #~ msgid "Zoom"
#~ msgstr "Zoom" #~ msgstr "Zoom"

View File

@ -26,7 +26,7 @@ msgid " Exercises in the chapter:"
msgstr " Ćwiczenia w tym rozdziale:" msgstr " Ćwiczenia w tym rozdziale:"
msgid " Free game on this chapter:" msgid " Free game on this chapter:"
msgstr " Prototypy na tej planecie:" msgstr " Swobodna gra na tej planecie:"
msgid " Free game on this planet:" msgid " Free game on this planet:"
msgstr " Swobodna gra na tej planecie:" msgstr " Swobodna gra na tej planecie:"
@ -40,9 +40,6 @@ msgstr " Misje na tej planecie:"
msgid " Planets:" msgid " Planets:"
msgstr " Planety:" msgstr " Planety:"
msgid " Prototypes on this planet:"
msgstr " Prototypy na tej planecie:"
msgid " Resolution:" msgid " Resolution:"
msgstr " Rozdzielczość:" msgstr " Rozdzielczość:"
@ -89,15 +86,12 @@ msgstr "Dźwięk 3D\\Przestrzenne pozycjonowanie dźwięków"
msgid "<< Back \\Back to the previous screen" msgid "<< Back \\Back to the previous screen"
msgstr "<< Wstecz \\Wraca do poprzedniego ekranu" msgstr "<< Wstecz \\Wraca do poprzedniego ekranu"
#, fuzzy
msgid "<<< Sorry; mission failed >>>" msgid "<<< Sorry; mission failed >>>"
msgstr "<<< Niestety, misja nie powiodła się >>>" msgstr "<<< Niestety, misja nie powiodła się >>>"
#, fuzzy
msgid "<<< Well done; mission accomplished >>>" msgid "<<< Well done; mission accomplished >>>"
msgstr "<<< Dobra robota, misja wypełniona >>>" msgstr "<<< Dobra robota, misja wypełniona >>>"
#, fuzzy
msgid "A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\"" msgid "A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\""
msgstr "Po etykiecie musi wystąpić \"for\", \"while\", \"do\" lub \"switch\"" msgstr "Po etykiecie musi wystąpić \"for\", \"while\", \"do\" lub \"switch\""
@ -316,6 +310,9 @@ msgstr "Przycisk %1"
msgid "COLOBOT" msgid "COLOBOT"
msgstr "COLOBOT" msgstr "COLOBOT"
msgid "COLOBOT: Gold Edition"
msgstr "COLOBOT: Gold Edition"
msgid "Calling an unknown function" msgid "Calling an unknown function"
msgstr "Odwołanie do nieznanej funkcji" msgstr "Odwołanie do nieznanej funkcji"
@ -340,7 +337,6 @@ msgstr "Camera to left"
msgid "Camera to right" msgid "Camera to right"
msgstr "Camera to right" msgstr "Camera to right"
#, fuzzy
msgid "Can not create this; there are too many objects" msgid "Can not create this; there are too many objects"
msgstr "Nie można tego utworzyć, za dużo obiektów" msgstr "Nie można tego utworzyć, za dużo obiektów"
@ -365,6 +361,9 @@ msgstr "Wyzwania\\Wyzwania programistyczne"
msgid "Change camera\\Switches between onboard camera and following camera" msgid "Change camera\\Switches between onboard camera and following camera"
msgstr "Zmień kamerę\\Przełącza pomiędzy kamerą pokładową i śledzącą" msgstr "Zmień kamerę\\Przełącza pomiędzy kamerą pokładową i śledzącą"
msgid "Change player\\Change player"
msgstr "Zmień gracza\\Zmień gracza"
msgid "Checkpoint" msgid "Checkpoint"
msgstr "Punkt kontrolny" msgstr "Punkt kontrolny"
@ -702,7 +701,6 @@ msgstr "Nieodpowiedni rodzaj ogniw"
msgid "Incorrect index type" msgid "Incorrect index type"
msgstr "Nieprawidłowy typ indeksu" msgstr "Nieprawidłowy typ indeksu"
#, fuzzy
msgid "Infected by a virus; temporarily out of order" msgid "Infected by a virus; temporarily out of order"
msgstr "Zainfekowane wirusem, chwilowo niesprawne" msgstr "Zainfekowane wirusem, chwilowo niesprawne"
@ -852,9 +850,6 @@ msgstr "Nowy ..."
msgid "New bot available" msgid "New bot available"
msgstr "Dostępny nowy robot" msgstr "Dostępny nowy robot"
msgid "New player\\Choose player's name"
msgstr "Nowy gracz\\Wybierz imię gracza"
msgid "Next" msgid "Next"
msgstr "Następny" msgstr "Następny"
@ -1121,12 +1116,6 @@ msgstr "Podręcznik programowania\\Dostarcza szczegółową pomoc w programowani
msgid "Programs dispatched by Houston" msgid "Programs dispatched by Houston"
msgstr "Program dostarczony z Houston" msgstr "Program dostarczony z Houston"
msgid "Proto\\Prototypes under development"
msgstr "Prototypy\\Prototypy w trakcie rozwijania"
msgid "Prototypes"
msgstr "Prototypy"
msgid "Public required" msgid "Public required"
msgstr "Wymagany publiczny" msgstr "Wymagany publiczny"
@ -2063,4 +2052,3 @@ msgstr "www.epsitec.com"
#~ msgid "Zoom" #~ msgid "Zoom"
#~ msgstr "Powiększenie" #~ msgstr "Powiększenie"

View File

@ -49,9 +49,6 @@ msgstr "Миссии на этой планете:"
msgid " Planets:" msgid " Planets:"
msgstr " Планеты:" msgstr " Планеты:"
msgid " Prototypes on this planet:"
msgstr "Прототипы на этой планете:"
msgid " Resolution:" msgid " Resolution:"
msgstr " Разрешение:" msgstr " Разрешение:"
@ -318,6 +315,9 @@ msgstr "Кнопка %1"
msgid "COLOBOT" msgid "COLOBOT"
msgstr "КОЛОБОТ" msgstr "КОЛОБОТ"
msgid "COLOBOT: Gold Edition"
msgstr ""
msgid "Calling an unknown function" msgid "Calling an unknown function"
msgstr "Вызов неизвестной функции" msgstr "Вызов неизвестной функции"
@ -366,6 +366,9 @@ msgstr "Задания\\Практика программирования"
msgid "Change camera\\Switches between onboard camera and following camera" msgid "Change camera\\Switches between onboard camera and following camera"
msgstr "Изменить вид\\Переключение между бортовой камерой и следящей камерой" msgstr "Изменить вид\\Переключение между бортовой камерой и следящей камерой"
msgid "Change player\\Change player"
msgstr "Новый игрок\\Выберите имя для игрока"
msgid "Checkpoint" msgid "Checkpoint"
msgstr "Контрольная точка" msgstr "Контрольная точка"
@ -849,9 +852,6 @@ msgstr "Новый ..."
msgid "New bot available" msgid "New bot available"
msgstr "Доступен новый бот" msgstr "Доступен новый бот"
msgid "New player\\Choose player's name"
msgstr "Новый игрок\\Выберите имя для игрока"
msgid "Next" msgid "Next"
msgstr "Следующий" msgstr "Следующий"
@ -1119,12 +1119,6 @@ msgstr ""
msgid "Programs dispatched by Houston" msgid "Programs dispatched by Houston"
msgstr "Программы переданные с Хьюстона" msgstr "Программы переданные с Хьюстона"
msgid "Proto\\Prototypes under development"
msgstr "Прототипы\\Прототипы в стадии разработки"
msgid "Prototypes"
msgstr "Прототипы"
msgid "Public required" msgid "Public required"
msgstr "Требуется общественное" msgstr "Требуется общественное"

View File

@ -28,6 +28,8 @@ if(MXE) # MXE requires special treatment
elseif(PLATFORM_WINDOWS) elseif(PLATFORM_WINDOWS)
# because it isn't included in standard linking libraries # because it isn't included in standard linking libraries
set(PLATFORM_LIBS "-lintl") set(PLATFORM_LIBS "-lintl")
elseif(PLATFORM_GNU)
set(PLATFORM_LIBS "-lX11")
elseif(PLATFORM_LINUX) elseif(PLATFORM_LINUX)
# for clock_gettime # for clock_gettime
set(PLATFORM_LIBS "-lrt -lX11") set(PLATFORM_LIBS "-lrt -lX11")
@ -59,7 +61,9 @@ endif()
# Source files # Source files
set(SOURCES set(SOURCES
app/app.cpp app/app.cpp
app/gamedata.cpp
app/main.cpp app/main.cpp
app/pausemanager.cpp
app/system.cpp app/system.cpp
app/${SYSTEM_CPP_MODULE} app/${SYSTEM_CPP_MODULE}
app/system_other.cpp app/system_other.cpp

View File

@ -19,6 +19,7 @@
#include "app/app.h" #include "app/app.h"
#include "app/gamedata.h"
#include "app/system.h" #include "app/system.h"
#include "common/logger.h" #include "common/logger.h"
@ -100,6 +101,7 @@ CApplication::CApplication()
m_objMan = new CObjectManager(); m_objMan = new CObjectManager();
m_eventQueue = new CEventQueue(); m_eventQueue = new CEventQueue();
m_profile = new CProfile(); m_profile = new CProfile();
m_gameData = new CGameData();
m_engine = nullptr; m_engine = nullptr;
m_device = nullptr; m_device = nullptr;
@ -112,7 +114,7 @@ CApplication::CApplication()
m_debugModes = 0; m_debugModes = 0;
m_customDataPath = false; m_customDataPath = false;
m_windowTitle = "COLOBOT"; m_windowTitle = "COLOBOT GOLD";
m_simulationSuspended = false; m_simulationSuspended = false;
@ -149,29 +151,17 @@ CApplication::CApplication()
m_dataPath = GetSystemUtils()->GetDataPath(); m_dataPath = GetSystemUtils()->GetDataPath();
m_langPath = GetSystemUtils()->GetLangPath(); m_langPath = GetSystemUtils()->GetLangPath();
m_texPackPath = "";
m_runSceneName = ""; m_runSceneName = "";
m_runSceneRank = 0; m_runSceneRank = 0;
m_sceneTest = false;
m_language = LANGUAGE_ENV; m_language = LANGUAGE_ENV;
m_lowCPU = true; m_lowCPU = true;
m_protoMode = false; m_protoMode = false;
for (int i = 0; i < DIR_MAX; ++i)
m_standardDataDirs[i] = nullptr;
m_standardDataDirs[DIR_AI] = "ai";
m_standardDataDirs[DIR_FONT] = "fonts";
m_standardDataDirs[DIR_HELP] = "help";
m_standardDataDirs[DIR_ICON] = "icons";
m_standardDataDirs[DIR_LEVEL] = "levels";
m_standardDataDirs[DIR_MODEL] = "models";
m_standardDataDirs[DIR_MUSIC] = "music";
m_standardDataDirs[DIR_SOUND] = "sounds";
m_standardDataDirs[DIR_TEXTURE] = "textures";
} }
CApplication::~CApplication() CApplication::~CApplication()
@ -190,6 +180,9 @@ CApplication::~CApplication()
delete m_iMan; delete m_iMan;
m_iMan = nullptr; m_iMan = nullptr;
delete m_gameData;
m_gameData = nullptr;
GetSystemUtils()->DestroyTimeStamp(m_baseTimeStamp); GetSystemUtils()->DestroyTimeStamp(m_baseTimeStamp);
GetSystemUtils()->DestroyTimeStamp(m_curTimeStamp); GetSystemUtils()->DestroyTimeStamp(m_curTimeStamp);
@ -210,12 +203,6 @@ CEventQueue* CApplication::GetEventQueue()
CSoundInterface* CApplication::GetSound() CSoundInterface* CApplication::GetSound()
{ {
return m_sound; return m_sound;
for (int i = 0; i < PCNT_MAX; ++i)
{
GetSystemUtils()->DestroyTimeStamp(m_performanceCounters[i][0]);
GetSystemUtils()->DestroyTimeStamp(m_performanceCounters[i][1]);
}
} }
ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
@ -225,13 +212,13 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
OPT_HELP = 1, OPT_HELP = 1,
OPT_DEBUG, OPT_DEBUG,
OPT_RUNSCENE, OPT_RUNSCENE,
OPT_SCENETEST,
OPT_LOGLEVEL, OPT_LOGLEVEL,
OPT_LANGUAGE, OPT_LANGUAGE,
OPT_DATADIR, OPT_DATADIR,
OPT_MOD,
OPT_LANGDIR, OPT_LANGDIR,
OPT_TEXPACK, OPT_VBO
OPT_VBO,
OPT_PROTO
}; };
option options[] = option options[] =
@ -239,13 +226,13 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
{ "help", no_argument, nullptr, OPT_HELP }, { "help", no_argument, nullptr, OPT_HELP },
{ "debug", required_argument, nullptr, OPT_DEBUG }, { "debug", required_argument, nullptr, OPT_DEBUG },
{ "runscene", required_argument, nullptr, OPT_RUNSCENE }, { "runscene", required_argument, nullptr, OPT_RUNSCENE },
{ "scenetest", no_argument, nullptr, OPT_SCENETEST },
{ "loglevel", required_argument, nullptr, OPT_LOGLEVEL }, { "loglevel", required_argument, nullptr, OPT_LOGLEVEL },
{ "language", required_argument, nullptr, OPT_LANGUAGE }, { "language", required_argument, nullptr, OPT_LANGUAGE },
{ "datadir", required_argument, nullptr, OPT_DATADIR }, { "datadir", required_argument, nullptr, OPT_DATADIR },
{ "mod", required_argument, nullptr, OPT_MOD },
{ "langdir", required_argument, nullptr, OPT_LANGDIR }, { "langdir", required_argument, nullptr, OPT_LANGDIR },
{ "texpack", required_argument, nullptr, OPT_TEXPACK },
{ "vbo", required_argument, nullptr, OPT_VBO }, { "vbo", required_argument, nullptr, OPT_VBO },
{ "proto", no_argument, nullptr, OPT_PROTO },
{ nullptr, 0, nullptr, 0} { nullptr, 0, nullptr, 0}
}; };
@ -279,13 +266,13 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
GetLogger()->Message(" -help this help\n"); GetLogger()->Message(" -help this help\n");
GetLogger()->Message(" -debug modes enable debug modes (more info printed in logs; see code for reference of modes)\n"); GetLogger()->Message(" -debug modes enable debug modes (more info printed in logs; see code for reference of modes)\n");
GetLogger()->Message(" -runscene sceneNNN run given scene on start\n"); GetLogger()->Message(" -runscene sceneNNN run given scene on start\n");
GetLogger()->Message(" -scenetest win every mission right after it's loaded\n");
GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n"); GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n");
GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl, ru)\n"); GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl, ru)\n");
GetLogger()->Message(" -datadir path set custom data directory path\n"); GetLogger()->Message(" -datadir path set custom data directory path\n");
GetLogger()->Message(" -mod path run mod\n");
GetLogger()->Message(" -langdir path set custom language directory path\n"); GetLogger()->Message(" -langdir path set custom language directory path\n");
GetLogger()->Message(" -texpack path set path to custom texture pack\n");
GetLogger()->Message(" -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n"); GetLogger()->Message(" -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n");
GetLogger()->Message(" -proto show prototype levels\n");
return PARSE_ARGS_HELP; return PARSE_ARGS_HELP;
} }
case OPT_DEBUG: case OPT_DEBUG:
@ -316,6 +303,11 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
GetLogger()->Info("Running scene '%s%d' on start\n", m_runSceneName.c_str(), m_runSceneRank); GetLogger()->Info("Running scene '%s%d' on start\n", m_runSceneName.c_str(), m_runSceneRank);
break; break;
} }
case OPT_SCENETEST:
{
m_sceneTest = true;
break;
}
case OPT_LOGLEVEL: case OPT_LOGLEVEL:
{ {
LogLevel logLevel; LogLevel logLevel;
@ -346,19 +338,19 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
{ {
m_dataPath = optarg; m_dataPath = optarg;
m_customDataPath = true; m_customDataPath = true;
GetLogger()->Info("Using custom datadir or running mod: '%s'\n", m_dataPath.c_str()); GetLogger()->Info("Using datadir: '%s'\n", optarg);
break;
}
case OPT_MOD:
{
m_gameData->AddMod(std::string(optarg));
GetLogger()->Info("Running mod from path: '%s'\n", optarg);
break; break;
} }
case OPT_LANGDIR: case OPT_LANGDIR:
{ {
m_langPath = optarg; m_langPath = optarg;
GetLogger()->Info("Using custom language dir: '%s'\n", m_langPath.c_str()); GetLogger()->Info("Using language dir: '%s'\n", m_langPath.c_str());
break;
}
case OPT_TEXPACK:
{
m_texPackPath = optarg;
GetLogger()->Info("Using texturepack: '%s'\n", m_texPackPath.c_str());
break; break;
} }
case OPT_VBO: case OPT_VBO:
@ -379,11 +371,6 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
break; break;
} }
case OPT_PROTO:
{
m_protoMode = true;
break;
}
default: default:
assert(false); // should never get here assert(false); // should never get here
} }
@ -420,11 +407,19 @@ bool CApplication::Create()
m_exitCode = 1; m_exitCode = 1;
return false; return false;
} }
m_gameData->SetDataDir(std::string(m_dataPath));
m_gameData->Init();
#if !defined(PLATFORM_MACOSX) if (GetProfile().GetLocalProfileString("Language", "Lang", path)) {
// On Mac OSX, the bundle can potentially change place, it doesn't make sense to cache it to the configuration file Language language;
GetProfile().SetLocalProfileString("Resources", "Data", m_dataPath); if (ParseLanguage(path, language)) {
#endif m_language = language;
GetLogger()->Info("Setting language '%s' from ini file\n", path.c_str());
} else {
GetLogger()->Error("Invalid language '%s' in ini file\n", path.c_str());
}
}
SetLanguage(m_language); SetLanguage(m_language);
@ -436,36 +431,9 @@ bool CApplication::Create()
m_sound = new CSoundInterface(); m_sound = new CSoundInterface();
#endif #endif
m_sound->Create(true); m_sound->Create();
m_sound->CacheAll();
#if !defined(PLATFORM_MACOSX) m_sound->AddMusicFiles();
// On Mac OSX, the bundle can potentially change place, it doesn't make sense to cache it to the configuration file
// Cache sound files
if (defaultValues)
{
GetProfile().SetLocalProfileString("Resources", "Sound", GetDataSubdirPath(DIR_SOUND));
GetProfile().SetLocalProfileString("Resources", "Music", GetDataSubdirPath(DIR_MUSIC));
}
#endif
if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Sound", path))
{
m_sound->CacheAll(path);
}
else
{
m_sound->CacheAll(GetDataSubdirPath(DIR_SOUND));
}
if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Music", path))
{
m_sound->AddMusicFiles(path);
}
else
{
m_sound->AddMusicFiles(GetDataSubdirPath(DIR_MUSIC));
}
GetLogger()->Info("CApplication created successfully\n"); GetLogger()->Info("CApplication created successfully\n");
@ -962,15 +930,15 @@ int CApplication::Run()
{ {
LogEvent(event); LogEvent(event);
StartPerformanceCounter(PCNT_UPDATE_ENGINE);
m_engine->FrameUpdate();
StopPerformanceCounter(PCNT_UPDATE_ENGINE);
m_sound->FrameMove(m_relTime); m_sound->FrameMove(m_relTime);
StartPerformanceCounter(PCNT_UPDATE_GAME); StartPerformanceCounter(PCNT_UPDATE_GAME);
m_robotMain->ProcessEvent(event); m_robotMain->ProcessEvent(event);
StopPerformanceCounter(PCNT_UPDATE_GAME); StopPerformanceCounter(PCNT_UPDATE_GAME);
StartPerformanceCounter(PCNT_UPDATE_ENGINE);
m_engine->FrameUpdate();
StopPerformanceCounter(PCNT_UPDATE_ENGINE);
} }
StopPerformanceCounter(PCNT_UPDATE_ALL); StopPerformanceCounter(PCNT_UPDATE_ALL);
@ -1608,59 +1576,6 @@ bool CApplication::GetJoystickEnabled() const
return m_joystickEnabled; return m_joystickEnabled;
} }
std::string CApplication::GetDataDirPath() const
{
return m_dataPath;
}
std::string CApplication::GetDataSubdirPath(DataDir stdDir) const
{
int index = static_cast<int>(stdDir);
assert(index >= 0 && index < DIR_MAX);
std::stringstream str;
str << m_dataPath;
str << "/";
str << m_standardDataDirs[index];
return str.str();
}
std::string CApplication::GetDataFilePath(DataDir stdDir, const std::string& subpath) const
{
int index = static_cast<int>(stdDir);
assert(index >= 0 && index < DIR_MAX);
std::stringstream str;
str << m_dataPath;
str << "/";
str << m_standardDataDirs[index];
if (stdDir == DIR_HELP)
{
str << "/";
str << GetLanguageChar();
}
str << "/";
str << subpath;
return str.str();
}
std::string CApplication::GetTexPackFilePath(const std::string& textureName) const
{
std::stringstream str;
if (! m_texPackPath.empty())
{
str << m_texPackPath;
str << "/";
str << textureName;
if (! boost::filesystem::exists(str.str()))
{
GetLogger()->Trace("Texture '%s' not in texpack\n", textureName.c_str());
str.str("");
}
}
return str.str();
}
Language CApplication::GetLanguage() const Language CApplication::GetLanguage() const
{ {
return m_language; return m_language;
@ -1868,8 +1783,7 @@ void CApplication::UpdatePerformanceCountersData()
} }
} }
bool CApplication::GetProtoMode() const bool CApplication::GetSceneTestMode()
{ {
return m_protoMode; return m_sceneTest;
} }

View File

@ -42,6 +42,7 @@ class CInstanceManager;
class CEventQueue; class CEventQueue;
class CRobotMain; class CRobotMain;
class CSoundInterface; class CSoundInterface;
class CGameData;
namespace Gfx { namespace Gfx {
class CModelManager; class CModelManager;
@ -328,18 +329,6 @@ public:
static bool ParseDebugModes(const std::string& str, int& debugModes); static bool ParseDebugModes(const std::string& str, int& debugModes);
//@} //@}
//! Returns the full path to data directory
std::string GetDataDirPath() const;
//! Returns the full path to a standard dir in data directory
std::string GetDataSubdirPath(DataDir stdDir) const;
//! Returns the full path to a file in data directory given standard dir and subpath
std::string GetDataFilePath(DataDir stdDir, const std::string &subpath) const;
//! Returns the full path to a file in texture pack directory
std::string GetTexPackFilePath(const std::string& textureName) const;
//! Management of language //! Management of language
//@{ //@{
Language GetLanguage() const; Language GetLanguage() const;
@ -360,8 +349,8 @@ public:
void StopPerformanceCounter(PerformanceCounter counter); void StopPerformanceCounter(PerformanceCounter counter);
float GetPerformanceCounterData(PerformanceCounter counter) const; float GetPerformanceCounterData(PerformanceCounter counter) const;
//@} //@}
bool GetProtoMode() const; bool GetSceneTestMode();
protected: protected:
//! Creates the window's SDL_Surface //! Creates the window's SDL_Surface
@ -413,6 +402,8 @@ protected:
CRobotMain* m_robotMain; CRobotMain* m_robotMain;
//! Profile (INI) reader/writer //! Profile (INI) reader/writer
CProfile* m_profile; CProfile* m_profile;
//! Game data
CGameData* m_gameData;
//! Code to return at exit //! Code to return at exit
int m_exitCode; int m_exitCode;
@ -485,17 +476,15 @@ protected:
//! Path to directory with language files //! Path to directory with language files
std::string m_langPath; std::string m_langPath;
//! Path to directory with user texture pack
std::string m_texPackPath;
//@{ //@{
//! Scene to run on startup //! Scene to run on startup
std::string m_runSceneName; std::string m_runSceneName;
int m_runSceneRank; int m_runSceneRank;
//@} //@}
const char* m_standardDataDirs[DIR_MAX]; //! Scene test mode
bool m_sceneTest;
//! Application language //! Application language
Language m_language; Language m_language;

136
src/app/gamedata.cpp Normal file
View File

@ -0,0 +1,136 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014, Polish Portal of Colobot (PPC)
// *
// * 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, either version 3 of the License, or
// * (at your option) any later version.
// *
// * 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, see http://www.gnu.org/licenses/.
#include "app/gamedata.h"
#include "app/app.h"
#include <boost/filesystem.hpp>
template<> CGameData* CSingleton<CGameData>::m_instance = nullptr;
CGameData::CGameData()
{
m_dataDirSet = false;
for (int i = 0; i < DIR_MAX; ++i)
m_standardDataDirs[i] = nullptr;
m_standardDataDirs[DIR_AI] = "ai";
m_standardDataDirs[DIR_FONT] = "fonts";
m_standardDataDirs[DIR_HELP] = "help";
m_standardDataDirs[DIR_ICON] = "icons";
m_standardDataDirs[DIR_LEVEL] = "levels";
m_standardDataDirs[DIR_MODEL] = "models";
m_standardDataDirs[DIR_MUSIC] = "music";
m_standardDataDirs[DIR_SOUND] = "sounds";
m_standardDataDirs[DIR_TEXTURE] = "textures";
}
CGameData::~CGameData()
{
}
void CGameData::SetDataDir(std::string path)
{
assert(!m_dataDirSet);
m_dataDirSet = true;
m_dataDirs.insert(m_dataDirs.begin(), path);
}
void CGameData::AddMod(std::string path)
{
m_dataDirs.push_back(path);
}
void CGameData::Init()
{
std::string out = "Using datadirs: ";
bool first = true;
for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
if(!first) out += ", ";
first = false;
out += *rit;
}
out += "\n";
CLogger::GetInstancePointer()->Info(out.c_str());
}
std::string CGameData::GetFilePath(DataDir dir, const std::string& subpath)
{
int index = static_cast<int>(dir);
assert(index >= 0 && index < DIR_MAX);
for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
std::stringstream str;
if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot
str << *rit;
str << "/";
str << m_standardDataDirs[index];
if (dir == DIR_HELP)
{
str << "/";
str << CApplication::GetInstancePointer()->GetLanguageChar();
}
str << "/";
}
str << subpath;
boost::filesystem::path path(str.str());
if(boost::filesystem::exists(path))
{
return str.str();
}
}
if(m_dataDirs.size() > 0) {
std::stringstream str;
if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot
str << m_dataDirs[0];
str << "/";
str << m_standardDataDirs[index];
if (dir == DIR_HELP)
{
str << "/";
str << CApplication::GetInstancePointer()->GetLanguageChar();
}
str << "/";
}
str << subpath;
return str.str();
}
return subpath;
}
std::string CGameData::GetDataPath(const std::string &subpath)
{
for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) {
std::string path = *rit + "/" + subpath;
boost::filesystem::path boostPath(path);
if(boost::filesystem::exists(boostPath))
{
return path;
}
}
return m_dataDirs[0] + "/" + subpath;
}

66
src/app/gamedata.h Normal file
View File

@ -0,0 +1,66 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2014, Polish Portal of Colobot (PPC)
// *
// * 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, either version 3 of the License, or
// * (at your option) any later version.
// *
// * 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, see http://www.gnu.org/licenses/.
/**
* \file app/gamedata.h
* \brief Game data
*/
#pragma once
#include "common/singleton.h"
#include <string>
#include <vector>
/**
* \enum DataDir
* \brief Directories in data directory
*/
enum DataDir
{
DIR_AI, //! < ai scripts
DIR_FONT, //! < fonts
DIR_HELP, //! < help files
DIR_ICON, //! < icons & images
DIR_LEVEL, //! < levels
DIR_MODEL, //! < models
DIR_MUSIC, //! < music
DIR_SOUND, //! < sounds
DIR_TEXTURE, //! < textures
DIR_MAX //! < number of dirs
};
class CGameData : public CSingleton<CGameData>
{
public:
CGameData();
~CGameData();
void Init();
void SetDataDir(std::string path);
void AddMod(std::string path);
std::string GetFilePath(DataDir dir, const std::string &subpath);
std::string GetDataPath(const std::string &subpath);
private:
bool m_dataDirSet;
std::vector<std::string> m_dataDirs;
const char* m_standardDataDirs[DIR_MAX];
};

94
src/app/pausemanager.cpp Normal file
View File

@ -0,0 +1,94 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * 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, either version 3 of the License, or
// * (at your option) any later version.
// *
// * 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, see http://www.gnu.org/licenses/.
#include "app/app.h"
#include "app/pausemanager.h"
#include "common/logger.h"
#include "object/robotmain.h"
template<> CPauseManager* CSingleton<CPauseManager>::m_instance = nullptr;
CPauseManager::CPauseManager()
{
m_sound = CApplication::GetInstancePointer()->GetSound();
m_pause = PAUSE_NONE;
}
CPauseManager::~CPauseManager()
{
m_sound = nullptr;
}
void CPauseManager::SetPause(PauseType pause)
{
if(pause != PAUSE_NONE) {
if(m_pause != pause) {
CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str());
CRobotMain::GetInstancePointer()->StartPauseMusic(pause);
}
m_pause = pause;
} else
ClearPause();
}
void CPauseManager::ClearPause()
{
if(m_pause != PAUSE_NONE) {
CLogger::GetInstancePointer()->Info("Game resumed\n");
m_sound->StopPauseMusic();
}
m_pause = PAUSE_NONE;
}
bool CPauseManager::GetPause()
{
return m_pause != PAUSE_NONE;
}
bool CPauseManager::GetPause(PauseType pause)
{
return m_pause == pause;
}
PauseType CPauseManager::GetPauseType()
{
return m_pause;
}
std::string CPauseManager::GetPauseName(PauseType pause)
{
switch(pause)
{
case PAUSE_NONE: return "None";
case PAUSE_USER: return "User";
case PAUSE_SATCOM: return "SatCom";
case PAUSE_SATCOMMOVIE: return "SatCom opening animation";
case PAUSE_DIALOG: return "Dialog";
case PAUSE_EDITOR: return "CBot editor";
case PAUSE_VISIT: return "Visit";
case PAUSE_CHEAT: return "Cheat console";
case PAUSE_PHOTO: return "Photo mode";
default: assert(false); // Should never happen
}
}

62
src/app/pausemanager.h Normal file
View File

@ -0,0 +1,62 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * 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, either version 3 of the License, or
// * (at your option) any later version.
// *
// * 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, see http://www.gnu.org/licenses/.
/**
* \file app/pausemanager.h
* \brief Management of pause modes
*/
#pragma once
#include "common/singleton.h"
#include "sound/sound.h"
#include <string>
enum PauseType {
PAUSE_NONE = 0,
PAUSE_USER,
PAUSE_SATCOM,
PAUSE_SATCOMMOVIE,
PAUSE_DIALOG,
PAUSE_EDITOR,
PAUSE_VISIT,
PAUSE_CHEAT,
PAUSE_PHOTO
};
class CPauseManager : public CSingleton<CPauseManager>
{
public:
CPauseManager();
~CPauseManager();
void SetPause(PauseType pause);
void ClearPause();
bool GetPause();
bool GetPause(PauseType pause);
PauseType GetPauseType();
private:
std::string GetPauseName(PauseType pause);
private:
CSoundInterface* m_sound;
PauseType m_pause;
};

View File

@ -3,6 +3,7 @@
// Macros set by CMake // Macros set by CMake
#cmakedefine PLATFORM_WINDOWS @PLATFORM_WINDOWS@ #cmakedefine PLATFORM_WINDOWS @PLATFORM_WINDOWS@
#cmakedefine PLATFORM_LINUX @PLATFORM_LINUX@ #cmakedefine PLATFORM_LINUX @PLATFORM_LINUX@
#cmakedefine PLATFORM_GNU @PLATFORM_GNU@
#cmakedefine PLATFORM_MACOSX @PLATFORM_MACOSX@ #cmakedefine PLATFORM_MACOSX @PLATFORM_MACOSX@
#cmakedefine PLATFORM_OTHER @PLATFORM_OTHER@ #cmakedefine PLATFORM_OTHER @PLATFORM_OTHER@
@ -26,6 +27,7 @@
#define COLOBOT_VERSION "@COLOBOT_VERSION_FULL@" #define COLOBOT_VERSION "@COLOBOT_VERSION_FULL@"
#define COLOBOT_CODENAME "@COLOBOT_VERSION_CODENAME@" #define COLOBOT_CODENAME "@COLOBOT_VERSION_CODENAME@"
#define COLOBOT_FULLNAME "Colobot @COLOBOT_VERSION_CODENAME@" #define COLOBOT_FULLNAME "Colobot @COLOBOT_VERSION_CODENAME@"
#define COLOBOT_VERSION_DISPLAY "@COLOBOT_VERSION_DISPLAY@"
#define COLOBOT_DEFAULT_DATADIR "@COLOBOT_INSTALL_DATA_DIR@" #define COLOBOT_DEFAULT_DATADIR "@COLOBOT_INSTALL_DATA_DIR@"
#define COLOBOT_I18N_DIR "@COLOBOT_INSTALL_I18N_DIR@" #define COLOBOT_I18N_DIR "@COLOBOT_INSTALL_I18N_DIR@"

View File

@ -161,7 +161,6 @@ void InitializeEventTypeTexts()
EVENT_TYPE_TEXT[EVENT_INTERFACE_DEFI] = "EVENT_INTERFACE_DEFI"; EVENT_TYPE_TEXT[EVENT_INTERFACE_DEFI] = "EVENT_INTERFACE_DEFI";
EVENT_TYPE_TEXT[EVENT_INTERFACE_MISSION] = "EVENT_INTERFACE_MISSION"; EVENT_TYPE_TEXT[EVENT_INTERFACE_MISSION] = "EVENT_INTERFACE_MISSION";
EVENT_TYPE_TEXT[EVENT_INTERFACE_FREE] = "EVENT_INTERFACE_FREE"; EVENT_TYPE_TEXT[EVENT_INTERFACE_FREE] = "EVENT_INTERFACE_FREE";
EVENT_TYPE_TEXT[EVENT_INTERFACE_PROTO] = "EVENT_INTERFACE_PROTO";
EVENT_TYPE_TEXT[EVENT_INTERFACE_NAME] = "EVENT_INTERFACE_NAME"; EVENT_TYPE_TEXT[EVENT_INTERFACE_NAME] = "EVENT_INTERFACE_NAME";
EVENT_TYPE_TEXT[EVENT_INTERFACE_SETUP] = "EVENT_INTERFACE_SETUP"; EVENT_TYPE_TEXT[EVENT_INTERFACE_SETUP] = "EVENT_INTERFACE_SETUP";
EVENT_TYPE_TEXT[EVENT_INTERFACE_QUIT] = "EVENT_INTERFACE_QUIT"; EVENT_TYPE_TEXT[EVENT_INTERFACE_QUIT] = "EVENT_INTERFACE_QUIT";

View File

@ -184,7 +184,6 @@ enum EventType
EVENT_INTERFACE_DEFI = 401, EVENT_INTERFACE_DEFI = 401,
EVENT_INTERFACE_MISSION = 402, EVENT_INTERFACE_MISSION = 402,
EVENT_INTERFACE_FREE = 403, EVENT_INTERFACE_FREE = 403,
EVENT_INTERFACE_PROTO = 404,
EVENT_INTERFACE_NAME = 405, EVENT_INTERFACE_NAME = 405,
EVENT_INTERFACE_SETUP = 406, EVENT_INTERFACE_SETUP = 406,
EVENT_INTERFACE_QUIT = 407, EVENT_INTERFACE_QUIT = 407,

View File

@ -28,137 +28,138 @@
*/ */
enum Error enum Error
{ {
ERR_OK = 0, //! < ok ERR_OK = 0, //! < ok
ERR_GENERIC = 1, //! < any error ERR_GENERIC = 1, //! < any error
ERR_CONTINUE = 2, //! < continues ERR_CONTINUE = 2, //! < continues
ERR_STOP = 3, //! < stops ERR_STOP = 3, //! < stops
ERR_CMD = 4, //! < unknown command ERR_CMD = 4, //! < unknown command
ERR_MANIP_VEH = 100, //! < inappropriate vehicle ERR_MANIP_VEH = 100, //! < inappropriate vehicle
ERR_MANIP_FLY = 101, //! < impossible in flight ERR_MANIP_FLY = 101, //! < impossible in flight
ERR_MANIP_BUSY = 102, //! < taking: hands already occupied ERR_MANIP_BUSY = 102, //! < taking: hands already occupied
ERR_MANIP_NIL = 103, //! < taking: nothing has to take ERR_MANIP_NIL = 103, //! < taking: nothing has to take
ERR_MANIP_MOTOR = 105, //! < busy: impossible to move ERR_MANIP_MOTOR = 105, //! < busy: impossible to move
ERR_MANIP_OCC = 106, //! < busy: location already occupied ERR_MANIP_OCC = 106, //! < busy: location already occupied
ERR_MANIP_FRIEND = 107, //! < no other vehicle ERR_MANIP_FRIEND = 107, //! < no other vehicle
ERR_MANIP_RADIO = 108, //! < impossible because radioactive ERR_MANIP_RADIO = 108, //! < impossible because radioactive
ERR_MANIP_WATER = 109, //! < not possible under water ERR_MANIP_WATER = 109, //! < not possible under water
ERR_MANIP_EMPTY = 110, //! < nothing to deposit ERR_MANIP_EMPTY = 110, //! < nothing to deposit
ERR_BUILD_FLY = 120, //! < not possible in flight ERR_BUILD_FLY = 120, //! < not possible in flight
ERR_BUILD_WATER = 121, //! < not possible under water ERR_BUILD_WATER = 121, //! < not possible under water
ERR_BUILD_ENERGY = 122, //! < not enough energy ERR_BUILD_ENERGY = 122, //! < not enough energy
ERR_BUILD_METALAWAY = 123, //! < lack of metal (too far) ERR_BUILD_METALAWAY = 123, //! < lack of metal (too far)
ERR_BUILD_METALNEAR = 124, //! < lack of metal (too close) ERR_BUILD_METALNEAR = 124, //! < lack of metal (too close)
ERR_BUILD_METALINEX = 125, //! < lack of metal ERR_BUILD_METALINEX = 125, //! < lack of metal
ERR_BUILD_FLAT = 126, //! < not enough flat ground ERR_BUILD_FLAT = 126, //! < not enough flat ground
ERR_BUILD_FLATLIT = 127, //! < not enough flat ground space ERR_BUILD_FLATLIT = 127, //! < not enough flat ground space
ERR_BUILD_BUSY = 128, //! < location occupied ERR_BUILD_BUSY = 128, //! < location occupied
ERR_BUILD_BASE = 129, //! < too close to the rocket ERR_BUILD_BASE = 129, //! < too close to the rocket
ERR_BUILD_NARROW = 130, //! < buildings too close ERR_BUILD_NARROW = 130, //! < buildings too close
ERR_BUILD_MOTOR = 131, //! < built: not possible in movement ERR_BUILD_MOTOR = 131, //! < built: not possible in movement
ERR_BUILD_DISABLED = 132, //! < built: can not produce this object in this mission ERR_BUILD_DISABLED = 132, //! < built: can not produce this object in this mission
ERR_BUILD_RESEARCH = 133, //! < built: can not produce not researched object ERR_BUILD_RESEARCH = 133, //! < built: can not produce not researched object
ERR_SEARCH_FLY = 140, //! < not possible in flight ERR_SEARCH_FLY = 140, //! < not possible in flight
ERR_SEARCH_VEH = 141, //! < inappropriate vehicle ERR_SEARCH_VEH = 141, //! < inappropriate vehicle
ERR_SEARCH_MOTOR = 142, //! < impossible in movement ERR_SEARCH_MOTOR = 142, //! < impossible in movement
ERR_TERRA_VEH = 150, //! < inappropriate vehicle ERR_TERRA_VEH = 150, //! < inappropriate vehicle
ERR_TERRA_ENERGY = 151, //! < not enough energy ERR_TERRA_ENERGY = 151, //! < not enough energy
ERR_TERRA_FLOOR = 152, //! < inappropriate ground ERR_TERRA_FLOOR = 152, //! < inappropriate ground
ERR_TERRA_BUILDING = 153, //! < building too close ERR_TERRA_BUILDING = 153, //! < building too close
ERR_TERRA_OBJECT = 154, //! < object too close ERR_TERRA_OBJECT = 154, //! < object too close
ERR_FIRE_VEH = 160, //! < inappropriate vehicle ERR_FIRE_VEH = 160, //! < inappropriate vehicle
ERR_FIRE_ENERGY = 161, //! < not enough energy ERR_FIRE_ENERGY = 161, //! < not enough energy
ERR_FIRE_FLY = 162, //! < not possible in flight ERR_FIRE_FLY = 162, //! < not possible in flight
ERR_RECOVER_VEH = 170, //! < inappropriate vehicle ERR_RECOVER_VEH = 170, //! < inappropriate vehicle
ERR_RECOVER_ENERGY = 171, //! < not enough energy ERR_RECOVER_ENERGY = 171, //! < not enough energy
ERR_RECOVER_NULL = 172, //! < lack of ruin ERR_RECOVER_NULL = 172, //! < lack of ruin
ERR_CONVERT_EMPTY = 180, //! < no stone was transformed ERR_CONVERT_EMPTY = 180, //! < no stone was transformed
ERR_SHIELD_VEH = 190, //! < inappropriate vehicle ERR_SHIELD_VEH = 190, //! < inappropriate vehicle
ERR_SHIELD_ENERGY = 191, //! < not enough energy ERR_SHIELD_ENERGY = 191, //! < not enough energy
ERR_MOVE_IMPOSSIBLE = 200, //! < move impossible ERR_MOVE_IMPOSSIBLE = 200, //! < move impossible
ERR_FIND_IMPOSSIBLE = 201, //! < find impossible ERR_FIND_IMPOSSIBLE = 201, //! < find impossible
ERR_GOTO_IMPOSSIBLE = 210, //! < goto impossible ERR_GOTO_IMPOSSIBLE = 210, //! < goto impossible
ERR_GOTO_ITER = 211, //! < goto too complicated ERR_GOTO_ITER = 211, //! < goto too complicated
ERR_GOTO_BUSY = 212, //! < goto destination occupied ERR_GOTO_BUSY = 212, //! < goto destination occupied
ERR_DERRICK_NULL = 300, //! < no ore underground ERR_DERRICK_NULL = 300, //! < no ore underground
ERR_STATION_NULL = 301, //! < no energy underground ERR_STATION_NULL = 301, //! < no energy underground
ERR_TOWER_POWER = 310, //! < no battery ERR_TOWER_POWER = 310, //! < no battery
ERR_TOWER_ENERGY = 311, //! < more energy ERR_TOWER_ENERGY = 311, //! < more energy
ERR_RESEARCH_POWER = 320, //! < no battery ERR_RESEARCH_POWER = 320, //! < no battery
ERR_RESEARCH_ENERGY = 321, //! < more energy ERR_RESEARCH_ENERGY = 321, //! < more energy
ERR_RESEARCH_TYPE = 322, //! < the wrong type of battery ERR_RESEARCH_TYPE = 322, //! < the wrong type of battery
ERR_RESEARCH_ALREADY = 323, //! < research already done ERR_RESEARCH_ALREADY = 323, //! < research already done
ERR_ENERGY_NULL = 330, //! < no energy underground ERR_ENERGY_NULL = 330, //! < no energy underground
ERR_ENERGY_LOW = 331, //! < not enough energy ERR_ENERGY_LOW = 331, //! < not enough energy
ERR_ENERGY_EMPTY = 332, //! < lack of metal ERR_ENERGY_EMPTY = 332, //! < lack of metal
ERR_ENERGY_BAD = 333, //! < transforms only the metal ERR_ENERGY_BAD = 333, //! < transforms only the metal
ERR_BASE_DLOCK = 340, //! < doors locked ERR_BASE_DLOCK = 340, //! < doors locked
ERR_BASE_DHUMAN = 341, //! < you must be on spaceship ERR_BASE_DHUMAN = 341, //! < you must be on spaceship
ERR_LABO_NULL = 350, //! < nothing to analyze ERR_LABO_NULL = 350, //! < nothing to analyze
ERR_LABO_BAD = 351, //! < analyzes only organic ball ERR_LABO_BAD = 351, //! < analyzes only organic ball
ERR_LABO_ALREADY = 352, //! < analysis already made ERR_LABO_ALREADY = 352, //! < analysis already made
ERR_NUCLEAR_NULL = 360, //! < no energy underground ERR_NUCLEAR_NULL = 360, //! < no energy underground
ERR_NUCLEAR_LOW = 361, //! < not enough energy ERR_NUCLEAR_LOW = 361, //! < not enough energy
ERR_NUCLEAR_EMPTY = 362, //! < lack of uranium ERR_NUCLEAR_EMPTY = 362, //! < lack of uranium
ERR_NUCLEAR_BAD = 363, //! < transforms only uranium ERR_NUCLEAR_BAD = 363, //! < transforms only uranium
ERR_FACTORY_NULL = 370, //! < no metal ERR_FACTORY_NULL = 370, //! < no metal
ERR_FACTORY_NEAR = 371, //! < vehicle too close ERR_FACTORY_NEAR = 371, //! < vehicle too close
ERR_RESET_NEAR = 380, //! < vehicle too close ERR_RESET_NEAR = 380, //! < vehicle too close
ERR_INFO_NULL = 390, //! < no information terminal ERR_INFO_NULL = 390, //! < no information terminal
ERR_VEH_VIRUS = 400, //! < vehicle infected by a virus ERR_VEH_VIRUS = 400, //! < vehicle infected by a virus
ERR_BAT_VIRUS = 401, //! < building infected by a virus ERR_BAT_VIRUS = 401, //! < building infected by a virus
ERR_DESTROY_NOTFOUND = 410, //! < not found anything to destroy ERR_DESTROY_NOTFOUND = 410, //! < not found anything to destroy
ERR_WRONG_OBJ = 420, //! < inappropriate vehicle ERR_WRONG_OBJ = 420, //! < inappropriate vehicle
ERR_VEH_POWER = 500, //! < no battery ERR_VEH_POWER = 500, //! < no battery
ERR_VEH_ENERGY = 501, //! < more energy ERR_VEH_ENERGY = 501, //! < more energy
ERR_FLAG_FLY = 510, //! < impossible in flight ERR_FLAG_FLY = 510, //! < impossible in flight
ERR_FLAG_WATER = 511, //! < impossible during swimming ERR_FLAG_WATER = 511, //! < impossible during swimming
ERR_FLAG_MOTOR = 512, //! < impossible in movement ERR_FLAG_MOTOR = 512, //! < impossible in movement
ERR_FLAG_BUSY = 513, //! < taking: already creating flag ERR_FLAG_BUSY = 513, //! < taking: already creating flag
ERR_FLAG_CREATE = 514, //! < too many flags ERR_FLAG_CREATE = 514, //! < too many flags
ERR_FLAG_PROXY = 515, //! < too close ERR_FLAG_PROXY = 515, //! < too close
ERR_FLAG_DELETE = 516, //! < nothing to remove ERR_FLAG_DELETE = 516, //! < nothing to remove
ERR_MISSION_NOTERM = 600, //! < Mission not completed ERR_MISSION_NOTERM = 600, //! < Mission not completed
ERR_DELETEMOBILE = 700, //! < vehicle destroyed ERR_DELETEMOBILE = 700, //! < vehicle destroyed
ERR_DELETEBUILDING = 701, //! < building destroyed ERR_DELETEBUILDING = 701, //! < building destroyed
ERR_TOOMANY = 702, //! < too many objects ERR_TOOMANY = 702, //! < too many objects
ERR_OBLIGATORYTOKEN = 800, //! < compulsory instruction missing ERR_OBLIGATORYTOKEN = 800, //! < compulsory instruction missing
ERR_PROHIBITEDTOKEN = 801, //! < instruction prohibited ERR_PROHIBITEDTOKEN = 801, //! < instruction prohibited
ERR_AIM_IMPOSSIBLE = 900, //! < cannot aim at specified angle(s)
INFO_FIRST = 10000, //! < first information INFO_FIRST = 10000, //! < first information
INFO_BUILD = 10001, //! < construction builded INFO_BUILD = 10001, //! < construction builded
INFO_CONVERT = 10002, //! < metal available INFO_CONVERT = 10002, //! < metal available
INFO_RESEARCH = 10003, //! < search ended INFO_RESEARCH = 10003, //! < search ended
INFO_FACTORY = 10004, //! < vehicle manufactured INFO_FACTORY = 10004, //! < vehicle manufactured
INFO_LABO = 10005, //! < analysis ended INFO_LABO = 10005, //! < analysis ended
INFO_ENERGY = 10006, //! < battery available INFO_ENERGY = 10006, //! < battery available
INFO_NUCLEAR = 10007, //! < nuclear battery available INFO_NUCLEAR = 10007, //! < nuclear battery available
INFO_FINDING = 10008, //! < nuclear battery available INFO_FINDING = 10008, //! < nuclear battery available
INFO_MARKPOWER = 10020, //! < location for station found INFO_MARKPOWER = 10020, //! < location for station found
INFO_MARKURANIUM = 10021, //! < location for derrick found INFO_MARKURANIUM = 10021, //! < location for derrick found
INFO_MARKSTONE = 10022, //! < location for derrick found INFO_MARKSTONE = 10022, //! < location for derrick found
INFO_MARKKEYa = 10023, //! < location for derrick found INFO_MARKKEYa = 10023, //! < location for derrick found
INFO_MARKKEYb = 10024, //! < location for derrick found INFO_MARKKEYb = 10024, //! < location for derrick found
INFO_MARKKEYc = 10025, //! < location for derrick found INFO_MARKKEYc = 10025, //! < location for derrick found
INFO_MARKKEYd = 10026, //! < location for derrick found INFO_MARKKEYd = 10026, //! < location for derrick found
INFO_RESEARCHTANK = 10030, //! < research ended INFO_RESEARCHTANK = 10030, //! < research ended
INFO_RESEARCHFLY = 10031, //! < research ended INFO_RESEARCHFLY = 10031, //! < research ended
INFO_RESEARCHTHUMP = 10032, //! < research ended INFO_RESEARCHTHUMP = 10032, //! < research ended
INFO_RESEARCHCANON = 10033, //! < research ended INFO_RESEARCHCANON = 10033, //! < research ended
INFO_RESEARCHTOWER = 10034, //! < research ended INFO_RESEARCHTOWER = 10034, //! < research ended
INFO_RESEARCHPHAZER = 10035, //! < research ended INFO_RESEARCHPHAZER = 10035, //! < research ended
INFO_RESEARCHSHIELD = 10036, //! < research ended INFO_RESEARCHSHIELD = 10036, //! < research ended
INFO_RESEARCHATOMIC = 10037, //! < research ended INFO_RESEARCHATOMIC = 10037, //! < research ended
INFO_WIN = 10040, //! < win INFO_WIN = 10040, //! < win
INFO_LOST = 10041, //! < lost INFO_LOST = 10041, //! < lost
INFO_LOSTq = 10042, //! < lost immediately INFO_LOSTq = 10042, //! < lost immediately
INFO_WRITEOK = 10043, //! < record done INFO_WRITEOK = 10043, //! < record done
INFO_DELETEPATH = 10050, //! < way mark deleted INFO_DELETEPATH = 10050, //! < way mark deleted
INFO_DELETEMOTHER = 10100, //! < insect killed INFO_DELETEMOTHER = 10100, //! < insect killed
INFO_DELETEANT = 10101, //! < insect killed INFO_DELETEANT = 10101, //! < insect killed
INFO_DELETEBEE = 10102, //! < insect killed INFO_DELETEBEE = 10102, //! < insect killed
INFO_DELETEWORM = 10103, //! < insect killed INFO_DELETEWORM = 10103, //! < insect killed
INFO_DELETESPIDER = 10104, //! < insect killed INFO_DELETESPIDER = 10104, //! < insect killed
INFO_BEGINSATCOM = 10105, //! < use your SatCom INFO_BEGINSATCOM = 10105, //! < use your SatCom
ERR_MAX //! < number of values ERR_MAX //! < number of values
}; };
@ -177,25 +178,6 @@ enum Language
LANGUAGE_RUSSIAN = 4 LANGUAGE_RUSSIAN = 4
}; };
/**
* \enum DataDir
* \brief Directories in data directory
*/
enum DataDir
{
DIR_AI, //! < ai scripts
DIR_FONT, //! < fonts
DIR_HELP, //! < help files
DIR_ICON, //! < icons & images
DIR_LEVEL, //! < levels
DIR_MODEL, //! < models
DIR_MUSIC, //! < music
DIR_SOUND, //! < sounds
DIR_TEXTURE, //! < textures
DIR_MAX //! < number of dirs
};
/** /**
* \enum BuildType * \enum BuildType

View File

@ -418,3 +418,44 @@ bool CImage::SavePNG(const std::string& fileName)
return true; return true;
} }
void CImage::SetDataPixels(void *pixels){
Uint8* srcPixels = static_cast<Uint8*> (pixels);
Uint8* resultPixels = static_cast<Uint8*> (m_data->surface->pixels);
Uint32 pitch = m_data->surface->pitch;
for(int line = 0; line < m_data->surface->h; ++line) {
Uint32 pos = line * pitch;
memcpy(&resultPixels[pos], &srcPixels[pos], pitch);
}
}
void CImage::flipVertically(){
SDL_Surface* result = SDL_CreateRGBSurface( m_data->surface->flags,
m_data->surface->w,
m_data->surface->h,
m_data->surface->format->BytesPerPixel * 8,
m_data->surface->format->Rmask,
m_data->surface->format->Gmask,
m_data->surface->format->Bmask,
m_data->surface->format->Amask);
assert(result != nullptr);
Uint8* srcPixels = static_cast<Uint8*> (m_data->surface->pixels);
Uint8* resultPixels = static_cast<Uint8*> (result->pixels);
Uint32 pitch = m_data->surface->pitch;
Uint32 pxLength = pitch*m_data->surface->h;
for(int line = 0; line < m_data->surface->h; ++line) {
Uint32 pos = line * pitch;
memcpy(&resultPixels[pos], &srcPixels[(pxLength-pos)-pitch], pitch);
}
SDL_FreeSurface(m_data->surface);
m_data->surface = result;
}

View File

@ -109,6 +109,12 @@ public:
//! Returns the last error //! Returns the last error
std::string GetError(); std::string GetError();
//! Flips the image vertically
void flipVertically();
//! sets/replaces the pixels from the surface
void SetDataPixels(void *pixels);
private: private:
//! Blit to new RGBA surface with given size //! Blit to new RGBA surface with given size
void BlitToNewRGBASurface(int width, int height); void BlitToNewRGBASurface(int width, int height);

View File

@ -26,7 +26,11 @@ template<> CLogger* CSingleton<CLogger>::m_instance = nullptr;
CLogger::CLogger() CLogger::CLogger()
{ {
m_file = NULL; m_file = NULL;
#if DEV_BUILD
m_logLevel = LOG_DEBUG;
#else
m_logLevel = LOG_INFO; m_logLevel = LOG_INFO;
#endif
} }

View File

@ -192,18 +192,6 @@ void TimeToAscii(time_t time, char *buffer)
year = when.tm_year+1900; year = when.tm_year+1900;
if ( year < 2000 ) year -= 1900; if ( year < 2000 ) year -= 1900;
else year -= 2000; else year -= 2000;
/* TODO
#if _FRENCH
sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d",
when.tm_mday, when.tm_mon+1, year,
when.tm_hour, when.tm_min);
#endif
#if _GERMAN | _WG
sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d",
when.tm_mday, when.tm_mon+1, year,
when.tm_hour, when.tm_min);
#endif
#if _ENGLISH*/
char format[10]; char format[10];
int hour; int hour;
@ -222,12 +210,23 @@ void TimeToAscii(time_t time, char *buffer)
sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d %s", sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d %s",
when.tm_mon+1, when.tm_mday, year, when.tm_mon+1, when.tm_mday, year,
hour, when.tm_min, format); hour, when.tm_min, format);
/*#endif }
#if _POLISH
sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d", // Converting time to string.
when.tm_mday, when.tm_mon+1, year,
void TimeToAsciiClean(time_t time, char *buffer)
{
struct tm when;
int year;
when = *localtime(&time);
year = when.tm_year+1900;
if ( year < 2000 ) year -= 1900;
else year -= 2000;
sprintf(buffer, "%.2d%.2d%.2d%.2d%.2d",
year, when.tm_mon+1, when.tm_mday,
when.tm_hour, when.tm_min); when.tm_hour, when.tm_min);
#endif*/
} }
// Copy a list of numbered files into the temporary folder. // Copy a list of numbered files into the temporary folder.

View File

@ -28,6 +28,7 @@ extern char GetToUpper(char letter);
extern char GetToLower(char letter); extern char GetToLower(char letter);
extern void TimeToAscii(time_t time, char *buffer); extern void TimeToAscii(time_t time, char *buffer);
extern void TimeToAsciiClean(time_t time, char *buffer);
extern bool CopyFileListToTemp(char* filename, int* list, int total); extern bool CopyFileListToTemp(char* filename, int* list, int total);
extern void AddExt(char* filename, const char* ext); extern void AddExt(char* filename, const char* ext);

View File

@ -91,7 +91,7 @@ bool CProfile::SetLocalProfileString(std::string section, std::string key, std::
} }
catch (std::exception & e) catch (std::exception & e)
{ {
GetLogger()->Error("Error on parsing profile: %s\n", e.what()); GetLogger()->Info("Error on parsing profile: %s\n", e.what());
return false; return false;
} }
return true; return true;
@ -106,7 +106,7 @@ bool CProfile::GetLocalProfileString(std::string section, std::string key, std::
} }
catch (std::exception & e) catch (std::exception & e)
{ {
GetLogger()->Error("Error on parsing profile: %s\n", e.what()); GetLogger()->Info("Error on parsing profile: %s\n", e.what());
return false; return false;
} }
return true; return true;
@ -122,7 +122,7 @@ bool CProfile::SetLocalProfileInt(std::string section, std::string key, int valu
} }
catch (std::exception & e) catch (std::exception & e)
{ {
GetLogger()->Error("Error on parsing profile: %s\n", e.what()); GetLogger()->Info("Error on parsing profile: %s\n", e.what());
return false; return false;
} }
return true; return true;
@ -137,7 +137,7 @@ bool CProfile::GetLocalProfileInt(std::string section, std::string key, int &val
} }
catch (std::exception & e) catch (std::exception & e)
{ {
GetLogger()->Error("Error on parsing profile: %s\n", e.what()); GetLogger()->Info("Error on parsing profile: %s\n", e.what());
return false; return false;
} }
return true; return true;
@ -153,7 +153,7 @@ bool CProfile::SetLocalProfileFloat(std::string section, std::string key, float
} }
catch (std::exception & e) catch (std::exception & e)
{ {
GetLogger()->Error("Error on parsing profile: %s\n", e.what()); GetLogger()->Info("Error on parsing profile: %s\n", e.what());
return false; return false;
} }
return true; return true;
@ -168,7 +168,7 @@ bool CProfile::GetLocalProfileFloat(std::string section, std::string key, float
} }
catch (std::exception & e) catch (std::exception & e)
{ {
GetLogger()->Error("Error on parsing profile: %s\n", e.what()); GetLogger()->Info("Error on parsing profile: %s\n", e.what());
return false; return false;
} }
return true; return true;
@ -178,7 +178,7 @@ bool CProfile::GetLocalProfileFloat(std::string section, std::string key, float
std::vector< std::string > CProfile::GetLocalProfileSection(std::string section, std::string key) std::vector< std::string > CProfile::GetLocalProfileSection(std::string section, std::string key)
{ {
std::vector< std::string > ret_list; std::vector< std::string > ret_list;
boost::regex re(key + "[0-9]*"); //we want to match all key followed my any number boost::regex re(key + "[0-9]*"); //we want to match all key followed by any number
try try
{ {
@ -192,7 +192,7 @@ std::vector< std::string > CProfile::GetLocalProfileSection(std::string section,
} }
catch (std::exception & e) catch (std::exception & e)
{ {
GetLogger()->Error("Error on parsing profile: %s\n", e.what()); GetLogger()->Info("Error on parsing profile: %s\n", e.what());
} }
return ret_list; return ret_list;

View File

@ -56,14 +56,13 @@ void InitializeRestext()
stringsText[RT_KEY_OR] = " or "; stringsText[RT_KEY_OR] = " or ";
stringsText[RT_TITLE_BASE] = "COLOBOT"; stringsText[RT_TITLE_BASE] = "COLOBOT";
stringsText[RT_TITLE_INIT] = "COLOBOT"; stringsText[RT_TITLE_INIT] = "COLOBOT: Gold Edition";
stringsText[RT_TITLE_TRAINER] = "Programming exercises"; stringsText[RT_TITLE_TRAINER] = "Programming exercises";
stringsText[RT_TITLE_DEFI] = "Challenges"; stringsText[RT_TITLE_DEFI] = "Challenges";
stringsText[RT_TITLE_MISSION] = "Missions"; stringsText[RT_TITLE_MISSION] = "Missions";
stringsText[RT_TITLE_FREE] = "Free game"; stringsText[RT_TITLE_FREE] = "Free game";
stringsText[RT_TITLE_TEEN] = "Free game"; stringsText[RT_TITLE_TEEN] = "Free game";
stringsText[RT_TITLE_USER] = "User levels"; stringsText[RT_TITLE_USER] = "User levels";
stringsText[RT_TITLE_PROTO] = "Prototypes";
stringsText[RT_TITLE_SETUP] = "Options"; stringsText[RT_TITLE_SETUP] = "Options";
stringsText[RT_TITLE_NAME] = "Player's name"; stringsText[RT_TITLE_NAME] = "Player's name";
stringsText[RT_TITLE_PERSO] = "Customize your appearance"; stringsText[RT_TITLE_PERSO] = "Customize your appearance";
@ -75,14 +74,12 @@ void InitializeRestext()
stringsText[RT_PLAY_CHAPm] = " Planets:"; stringsText[RT_PLAY_CHAPm] = " Planets:";
stringsText[RT_PLAY_CHAPf] = " Planets:"; stringsText[RT_PLAY_CHAPf] = " Planets:";
stringsText[RT_PLAY_CHAPu] = " User levels:"; stringsText[RT_PLAY_CHAPu] = " User levels:";
stringsText[RT_PLAY_CHAPp] = " Planets:";
stringsText[RT_PLAY_CHAPte] = " Chapters:"; stringsText[RT_PLAY_CHAPte] = " Chapters:";
stringsText[RT_PLAY_LISTt] = " Exercises in the chapter:"; stringsText[RT_PLAY_LISTt] = " Exercises in the chapter:";
stringsText[RT_PLAY_LISTd] = " Challenges in the chapter:"; stringsText[RT_PLAY_LISTd] = " Challenges in the chapter:";
stringsText[RT_PLAY_LISTm] = " Missions on this planet:"; stringsText[RT_PLAY_LISTm] = " Missions on this planet:";
stringsText[RT_PLAY_LISTf] = " Free game on this planet:"; stringsText[RT_PLAY_LISTf] = " Free game on this planet:";
stringsText[RT_PLAY_LISTu] = " Missions on this level:"; stringsText[RT_PLAY_LISTu] = " Missions on this level:";
stringsText[RT_PLAY_LISTp] = " Prototypes on this planet:";
stringsText[RT_PLAY_LISTk] = " Free game on this chapter:"; stringsText[RT_PLAY_LISTk] = " Free game on this chapter:";
stringsText[RT_PLAY_RESUME] = " Summary:"; stringsText[RT_PLAY_RESUME] = " Summary:";
@ -155,8 +152,7 @@ void InitializeRestext()
stringsEvent[EVENT_INTERFACE_FREE] = "Free game\\Free game without a specific goal"; stringsEvent[EVENT_INTERFACE_FREE] = "Free game\\Free game without a specific goal";
stringsEvent[EVENT_INTERFACE_TEEN] = "Free game\\Free game without a specific goal"; stringsEvent[EVENT_INTERFACE_TEEN] = "Free game\\Free game without a specific goal";
stringsEvent[EVENT_INTERFACE_USER] = "User\\User levels"; stringsEvent[EVENT_INTERFACE_USER] = "User\\User levels";
stringsEvent[EVENT_INTERFACE_PROTO] = "Proto\\Prototypes under development"; stringsEvent[EVENT_INTERFACE_NAME] = "Change player\\Change player";
stringsEvent[EVENT_INTERFACE_NAME] = "New player\\Choose player's name";
stringsEvent[EVENT_INTERFACE_SETUP] = "Options\\Preferences"; stringsEvent[EVENT_INTERFACE_SETUP] = "Options\\Preferences";
stringsEvent[EVENT_INTERFACE_AGAIN] = "Restart\\Restart the mission from the beginning"; stringsEvent[EVENT_INTERFACE_AGAIN] = "Restart\\Restart the mission from the beginning";
stringsEvent[EVENT_INTERFACE_WRITE] = "Save\\Save the current mission "; stringsEvent[EVENT_INTERFACE_WRITE] = "Save\\Save the current mission ";
@ -776,9 +772,7 @@ static KeyDesc keyTable[22] =
bool SearchKey(const char *cmd, InputSlot &key) bool SearchKey(const char *cmd, InputSlot &key)
{ {
int i; for (int i = 0; i < 22 ;i++)
for ( i=0 ; i<22 ; i++ )
{ {
if ( strstr(cmd, keyTable[i].name) == cmd ) if ( strstr(cmd, keyTable[i].name) == cmd )
{ {
@ -791,14 +785,11 @@ bool SearchKey(const char *cmd, InputSlot &key)
// Replaces the commands "\key name;" in a text. // Replaces the commands "\key name;" in a text.
static void PutKeyName(char* dst, const char* src) static void PutKeyName(std::string& dst, const char* src)
{ {
InputSlot key; dst.clear();
char name[50];
int s, d, n;
unsigned int res;
s = d = 0; int s = 0;
while ( src[s] != 0 ) while ( src[s] != 0 )
{ {
if ( src[s+0] == '\\' && if ( src[s+0] == '\\' &&
@ -807,18 +798,16 @@ static void PutKeyName(char* dst, const char* src)
src[s+3] == 'y' && src[s+3] == 'y' &&
src[s+4] == ' ' ) src[s+4] == ' ' )
{ {
InputSlot key;
if ( SearchKey(src+s+5, key) ) if ( SearchKey(src+s+5, key) )
{ {
res = CRobotMain::GetInstancePointer()->GetInputBinding(key).primary; unsigned int res = CRobotMain::GetInstancePointer()->GetInputBinding(key).primary;
if (res != KEY_INVALID) if (res != KEY_INVALID)
{ {
if ( GetResource(RES_KEY, res, name) ) std::string keyName;
if ( GetResource(RES_KEY, res, keyName) )
{ {
n = 0; dst.append(keyName);
while ( name[n] != 0 )
{
dst[d++] = name[n++];
}
while ( src[s++] != ';' ); while ( src[s++] != ';' );
continue; continue;
} }
@ -826,9 +815,8 @@ static void PutKeyName(char* dst, const char* src)
} }
} }
dst[d++] = src[s++]; dst.append(1, src[s++]);
} }
dst[d++] = 0;
} }
// Returns the translated text of a resource that needs key substitution // Returns the translated text of a resource that needs key substitution
@ -905,13 +893,13 @@ static const char* GetResourceBase(ResType type, int num)
// Returns the text of a resource. // Returns the text of a resource.
bool GetResource(ResType type, int num, char* text) bool GetResource(ResType type, int num, std::string& text)
{ {
const char *tmpl = GetResourceBase(type, num); const char *tmpl = GetResourceBase(type, num);
if (!tmpl) if (!tmpl)
{ {
text[0] = 0; text.clear();
return false; return false;
} }

View File

@ -66,7 +66,6 @@ enum ResTextType
RT_TITLE_DEFI = 43, RT_TITLE_DEFI = 43,
RT_TITLE_MISSION = 44, RT_TITLE_MISSION = 44,
RT_TITLE_FREE = 45, RT_TITLE_FREE = 45,
RT_TITLE_PROTO = 46,
RT_TITLE_SETUP = 47, RT_TITLE_SETUP = 47,
RT_TITLE_NAME = 48, RT_TITLE_NAME = 48,
RT_TITLE_PERSO = 49, RT_TITLE_PERSO = 49,
@ -79,12 +78,10 @@ enum ResTextType
RT_PLAY_CHAPd = 61, RT_PLAY_CHAPd = 61,
RT_PLAY_CHAPm = 62, RT_PLAY_CHAPm = 62,
RT_PLAY_CHAPf = 63, RT_PLAY_CHAPf = 63,
RT_PLAY_CHAPp = 64,
RT_PLAY_LISTt = 65, RT_PLAY_LISTt = 65,
RT_PLAY_LISTd = 66, RT_PLAY_LISTd = 66,
RT_PLAY_LISTm = 67, RT_PLAY_LISTm = 67,
RT_PLAY_LISTf = 68, RT_PLAY_LISTf = 68,
RT_PLAY_LISTp = 69,
RT_PLAY_RESUME = 70, RT_PLAY_RESUME = 70,
RT_PLAY_CHAPu = 71, RT_PLAY_CHAPu = 71,
RT_PLAY_LISTu = 72, RT_PLAY_LISTu = 72,
@ -157,5 +154,5 @@ void InitializeRestext();
void SetGlobalGamerName(std::string name); void SetGlobalGamerName(std::string name);
bool SearchKey(const char *cmd, InputSlot& slot); bool SearchKey(const char *cmd, InputSlot& slot);
bool GetResource(ResType type, int num, char* text); bool GetResource(ResType type, int num, std::string& text);

View File

@ -17,6 +17,41 @@
#include "common/stringutils.h" #include "common/stringutils.h"
#include <cstdarg>
#include <cstdio>
#include <vector>
static std::string VFormat(const char *fmt, va_list ap)
{
size_t size = 1024;
char stackbuf[1024];
std::vector<char> dynamicbuf;
char *buf = &stackbuf[0];
while (1)
{
int needed = vsnprintf (buf, size, fmt, ap);
if (needed <= static_cast<int>(size) && needed >= 0)
{
return std::string(buf, static_cast<size_t>(needed));
}
size = (needed > 0) ? (needed+1) : (size*2);
dynamicbuf.resize(size);
buf = &dynamicbuf[0];
}
}
std::string StrUtils::Format(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
std::string buf = VFormat(fmt, ap);
va_end(ap);
return buf;
}
std::string StrUtils::Replace(const std::string &str, const std::string &oldStr, const std::string &newStr) std::string StrUtils::Replace(const std::string &str, const std::string &oldStr, const std::string &newStr)
{ {

View File

@ -31,11 +31,11 @@ namespace StrUtils {
/** If given, \a ok is set to true/false on success/failure. /** If given, \a ok is set to true/false on success/failure.
Warning: To avoid unnecessary problems, *always* give full template qualifier e.g. ToString\<int\> */ Warning: To avoid unnecessary problems, *always* give full template qualifier e.g. ToString\<int\> */
template<class T> template<class T>
std::string ToString(T value, bool *ok = NULL) std::string ToString(T value, bool *ok = nullptr)
{ {
std::ostringstream s; std::ostringstream s;
s << value; s << value;
if (ok != NULL) if (ok != nullptr)
*ok = !s.fail(); *ok = !s.fail();
return s.str(); return s.str();
} }
@ -44,17 +44,20 @@ std::string ToString(T value, bool *ok = NULL)
/** If given, \a ok is set to true/false on success/failure. /** If given, \a ok is set to true/false on success/failure.
Warning: To avoid unnecessary problems, *always* give full template qualifier e.g. FromString\<int\> */ Warning: To avoid unnecessary problems, *always* give full template qualifier e.g. FromString\<int\> */
template<class T> template<class T>
T FromString(const std::string &str, bool *ok = NULL) T FromString(const std::string &str, bool *ok = nullptr)
{ {
std::istringstream s; std::istringstream s;
s.str(str); s.str(str);
T value; T value;
s >> value; s >> value;
if (ok != NULL) if (ok != nullptr)
*ok = !s.fail(); *ok = !s.fail();
return value; return value;
} }
//! Replacement for sprintf()
std::string Format(const char *fmt, ...);
//! Returns a string with every occurence of \a oldStr in \a str replaced to \a newStr //! Returns a string with every occurence of \a oldStr in \a str replaced to \a newStr
std::string Replace(const std::string &str, const std::string &oldStr, const std::string &newStr); std::string Replace(const std::string &str, const std::string &oldStr, const std::string &newStr);

View File

@ -400,6 +400,9 @@ public:
virtual void SetFillMode(FillMode mode) = 0; virtual void SetFillMode(FillMode mode) = 0;
//! Returns the current fill mode //! Returns the current fill mode
virtual FillMode GetFillMode() = 0; virtual FillMode GetFillMode() = 0;
//! Returns the pixels of the entire screen
virtual void* GetFrameBufferPixels()const = 0;
}; };

View File

@ -82,7 +82,9 @@ struct VertexCol
Math::Vector coord; Math::Vector coord;
Color color; Color color;
explicit VertexCol(Math::Vector aCoord = Math::Vector(), VertexCol() = default;
explicit VertexCol(Math::Vector aCoord,
Color aColor = Color()) Color aColor = Color())
: coord(aCoord), color(aColor) {} : coord(aCoord), color(aColor) {}

View File

@ -593,9 +593,6 @@ void CCamera::EffectFrame(const Event &event)
dist = Math::Norm((dist - 100.f) / 100.0f); dist = Math::Norm((dist - 100.f) / 100.0f);
force *= 1.0f-dist; force *= 1.0f-dist;
#if _TEEN
force *= 2.0f;
#endif
m_effectOffset *= force; m_effectOffset *= force;
if (m_effectProgress >= 1.0f) if (m_effectProgress >= 1.0f)

View File

@ -19,6 +19,7 @@
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
#include "app/app.h" #include "app/app.h"
#include "app/gamedata.h"
#include "common/image.h" #include "common/image.h"
#include "common/key.h" #include "common/key.h"
@ -63,6 +64,7 @@ CEngine::CEngine(CApplication *app)
m_planet = nullptr; m_planet = nullptr;
m_sound = nullptr; m_sound = nullptr;
m_terrain = nullptr; m_terrain = nullptr;
m_pause = nullptr;
m_showStats = false; m_showStats = false;
@ -80,7 +82,6 @@ CEngine::CEngine(CApplication *app)
m_fogStart[1] = 0.75f; m_fogStart[1] = 0.75f;
m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f); m_waterAddColor = Color(0.0f, 0.0f, 0.0f, 0.0f);
m_pause = false;
m_render = true; m_render = true;
m_movieLock = false; m_movieLock = false;
m_shadowVisible = true; m_shadowVisible = true;
@ -179,6 +180,7 @@ CEngine::~CEngine()
m_lightning = nullptr; m_lightning = nullptr;
m_planet = nullptr; m_planet = nullptr;
m_terrain = nullptr; m_terrain = nullptr;
m_pause = nullptr;
GetSystemUtils()->DestroyTimeStamp(m_lastFrameTime); GetSystemUtils()->DestroyTimeStamp(m_lastFrameTime);
m_lastFrameTime = nullptr; m_lastFrameTime = nullptr;
@ -252,6 +254,7 @@ bool CEngine::Create()
m_cloud = new CCloud(this); m_cloud = new CCloud(this);
m_lightning = new CLightning(this); m_lightning = new CLightning(this);
m_planet = new CPlanet(this); m_planet = new CPlanet(this);
m_pause = new CPauseManager();
m_lightMan->SetDevice(m_device); m_lightMan->SetDevice(m_device);
m_particle->SetDevice(m_device); m_particle->SetDevice(m_device);
@ -421,19 +424,25 @@ void CEngine::FrameUpdate()
bool CEngine::WriteScreenShot(const std::string& fileName, int width, int height) bool CEngine::WriteScreenShot(const std::string& fileName, int width, int height)
{ {
// TODO write screenshot: not very important for now void *pixels = m_device->GetFrameBufferPixels();
GetLogger()->Trace("CEngine::WriteSceenShot(): stub!\n"); CImage img({width,height});
return true;
}
void CEngine::SetPause(bool pause) img.SetDataPixels(pixels);
{ img.flipVertically();
m_pause = pause;
if ( img.SavePNG(fileName.c_str()) ){
GetLogger()->Info("Save SceenShot Saved Successfully!\n");
return true;
}
else{
GetLogger()->Error("%s!\n",img.GetError().c_str());
return false;
}
} }
bool CEngine::GetPause() bool CEngine::GetPause()
{ {
return m_pause; return m_pause->GetPause();
} }
void CEngine::SetMovieLock(bool lock) void CEngine::SetMovieLock(bool lock)
@ -2249,33 +2258,12 @@ Texture CEngine::CreateTexture(const std::string& texName, const TextureCreatePa
if (image == nullptr) if (image == nullptr)
{ {
bool loadedFromTexPack = false; if (! img.Load(CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, texName)))
std::string texPackName = m_app->GetTexPackFilePath(texName);
if (! texPackName.empty())
{ {
if (img.Load(texPackName)) std::string error = img.GetError();
{ GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str());
loadedFromTexPack = true; m_texBlacklist.insert(texName);
} return Texture(); // invalid texture
else
{
std::string error = img.GetError();
GetLogger()->Error("Couldn't load texture '%s' from texpack: %s, blacklisting the texpack path\n",
texName.c_str(), error.c_str());
m_texBlacklist.insert(texPackName);
}
}
if (!loadedFromTexPack)
{
if (! img.Load(m_app->GetDataFilePath(DIR_TEXTURE, texName)))
{
std::string error = img.GetError();
GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str());
m_texBlacklist.insert(texName);
return Texture(); // invalid texture
}
} }
image = &img; image = &img;
@ -2438,7 +2426,7 @@ bool CEngine::ChangeTextureColor(const std::string& texName,
CImage img; CImage img;
if (! img.Load(m_app->GetDataFilePath(DIR_TEXTURE, texName))) if (! img.Load(CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, texName)))
{ {
std::string error = img.GetError(); std::string error = img.GetError();
GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str()); GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str());

View File

@ -24,6 +24,7 @@
#include "app/system.h" #include "app/system.h"
#include "app/pausemanager.h"
#include "common/event.h" #include "common/event.h"
#include "common/singleton.h" #include "common/singleton.h"
@ -734,11 +735,8 @@ public:
bool WriteScreenShot(const std::string& fileName, int width, int height); bool WriteScreenShot(const std::string& fileName, int width, int height);
//@{ //! Get pause mode
//! Management of game pause mode
void SetPause(bool pause);
TEST_VIRTUAL bool GetPause(); TEST_VIRTUAL bool GetPause();
//@}
//@{ //@{
//! Management of lock for the duration of movie sequence //! Management of lock for the duration of movie sequence
@ -1288,6 +1286,7 @@ protected:
CLightning* m_lightning; CLightning* m_lightning;
CPlanet* m_planet; CPlanet* m_planet;
CTerrain* m_terrain; CTerrain* m_terrain;
CPauseManager* m_pause;
//! Last encountered error //! Last encountered error
std::string m_error; std::string m_error;
@ -1300,9 +1299,6 @@ protected:
//! Whether to show stats (FPS, etc) //! Whether to show stats (FPS, etc)
bool m_showStats; bool m_showStats;
std::string m_fpsText; std::string m_fpsText;
//! Pause mode
bool m_pause;
//! Rendering enabled? //! Rendering enabled?
bool m_render; bool m_render;
//! Lock for duration of movie? //! Lock for duration of movie?

View File

@ -1,6 +1,24 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
// * Copyright (C) 2012-2014, Polish Portal of Colobot (PPC)
// *
// * 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, either version 3 of the License, or
// * (at your option) any later version.
// *
// * 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, see http://www.gnu.org/licenses/.
#include "graphics/engine/modelmanager.h" #include "graphics/engine/modelmanager.h"
#include "app/app.h" #include "app/app.h"
#include "app/gamedata.h"
#include "common/logger.h" #include "common/logger.h"
@ -30,7 +48,7 @@ bool CModelManager::LoadModel(const std::string& fileName, bool mirrored)
if (CApplication::GetInstance().IsDebugModeActive(DEBUG_MODELS)) if (CApplication::GetInstance().IsDebugModeActive(DEBUG_MODELS))
modelFile.SetPrintDebugInfo(true); modelFile.SetPrintDebugInfo(true);
std::string filePath = CApplication::GetInstance().GetDataFilePath(DIR_MODEL, fileName); std::string filePath = CGameData::GetInstancePointer()->GetFilePath(DIR_MODEL, fileName);
if (!modelFile.ReadModel(filePath)) if (!modelFile.ReadModel(filePath))
{ {

View File

@ -1,3 +1,20 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
// * Copyright (C) 2012-2014, Polish Portal of Colobot (PPC)
// *
// * 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, either version 3 of the License, or
// * (at your option) any later version.
// *
// * 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, see http://www.gnu.org/licenses/.
#pragma once #pragma once
#include "common/singleton.h" #include "common/singleton.h"

View File

@ -19,6 +19,7 @@
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
#include "app/app.h" #include "app/app.h"
#include "app/gamedata.h"
#include "common/image.h" #include "common/image.h"
#include "common/logger.h" #include "common/logger.h"
@ -189,7 +190,7 @@ void CTerrain::AddMaterial(int id, const std::string& texName, const Math::Point
bool CTerrain::LoadResources(const std::string& fileName) bool CTerrain::LoadResources(const std::string& fileName)
{ {
CImage img; CImage img;
std::string path = CApplication::GetInstance().GetDataFilePath(DIR_TEXTURE, fileName); std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, fileName);
if (! img.Load(path)) if (! img.Load(path))
{ {
GetLogger()->Error("Cannot load resource file: '%s'\n", path.c_str()); GetLogger()->Error("Cannot load resource file: '%s'\n", path.c_str());
@ -286,7 +287,7 @@ bool CTerrain::LoadRelief(const std::string &fileName, float scaleRelief,
m_scaleRelief = scaleRelief; m_scaleRelief = scaleRelief;
CImage img; CImage img;
std::string path = CApplication::GetInstance().GetDataFilePath(DIR_TEXTURE, fileName); std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, fileName);
if (! img.Load(path)) if (! img.Load(path))
{ {
GetLogger()->Error("Could not load relief file: '%s'!\n", path.c_str()); GetLogger()->Error("Could not load relief file: '%s'!\n", path.c_str());
@ -331,6 +332,66 @@ bool CTerrain::LoadRelief(const std::string &fileName, float scaleRelief,
return true; return true;
} }
bool CTerrain::RandomizeRelief()
{
// Perlin noise
// Based on Python implementation by Marek Rogalski (mafik)
// http://amt2014.pl/archiwum/perlin.py
int size = (m_mosaicCount*m_brickCount)+1;
const int ilosc_oktaw = 6;
float* oktawy[ilosc_oktaw];
for(int i=0; i<ilosc_oktaw; i++)
{
int pxCount = static_cast<int>(pow(2, (i+1)*2));
oktawy[i] = new float[pxCount];
for(int j=0; j<pxCount; j++)
{
oktawy[i][j] = Math::Rand();
}
}
for(int y2=0; y2 < size; y2++)
{
float y = static_cast<float>(y2) / size;
for(int x2=0; x2 < size; x2++)
{
float x = static_cast<float>(x2) / size;
float wart = 0;
for(int i=0; i<ilosc_oktaw; i++)
{
int rozmiar_oktawy = sqrt(static_cast<int>(pow(2, (i+1)*2)));
double xi, yi, a, b;
a = modf(x * (rozmiar_oktawy-1), &xi);
b = modf(y * (rozmiar_oktawy-1), &yi);
/*int xi = floor(x * (rozmiar_oktawy-1));
int yi = floor(y * (rozmiar_oktawy-1));
float a = (x * (rozmiar_oktawy-1)) - xi;
float b = (y * (rozmiar_oktawy-1)) - yi;*/
//CLogger::GetInstancePointer()->Error("%f %f %f %f\n", xi, yi, a, b);
float lg = oktawy[i][static_cast<int>(yi * rozmiar_oktawy + xi)];
float pg = oktawy[i][static_cast<int>(yi * rozmiar_oktawy + xi + 1)];
float ld = oktawy[i][static_cast<int>((yi+1) * rozmiar_oktawy + xi)];
float pd = oktawy[i][static_cast<int>((yi+1) * rozmiar_oktawy + xi + 1)];
//CLogger::GetInstancePointer()->Error("%f %f %f %f\n", lg, pg, ld, pd);
float g = pg * a + lg * (1-a);
float d = pd * a + ld * (1-a);
float res = d * b + g * (1-b);
wart += res;
}
wart /= ilosc_oktaw;
m_relief[x2+y2*size] = wart * 255.0f;
}
}
return true;
}
bool CTerrain::AddReliefPoint(Math::Vector pos, float scaleRelief) bool CTerrain::AddReliefPoint(Math::Vector pos, float scaleRelief)
{ {
float dim = (m_mosaicCount*m_brickCount*m_brickSize)/2.0f; float dim = (m_mosaicCount*m_brickCount*m_brickSize)/2.0f;

View File

@ -212,7 +212,7 @@ struct FlyingLimit
* where relief data is specifically adjusted to level space to allow * where relief data is specifically adjusted to level space to allow
* construction of buildings. * construction of buildings.
* *
* Undergound resources can be supplied by loading them from image like relief data. * Underground resources can be supplied by loading them from image like relief data.
* *
* Terrain also specifies flying limits for player: one global level and possible * Terrain also specifies flying limits for player: one global level and possible
* additional spherical restrictions. * additional spherical restrictions.
@ -243,6 +243,8 @@ public:
void FlushRelief(); void FlushRelief();
//! Load relief from image //! Load relief from image
bool LoadRelief(const std::string& fileName, float scaleRelief, bool adjustBorder); bool LoadRelief(const std::string& fileName, float scaleRelief, bool adjustBorder);
//! Load ramdomized relief
bool RandomizeRelief();
//! Load resources from image //! Load resources from image
bool LoadResources(const std::string& fileName); bool LoadResources(const std::string& fileName);

View File

@ -19,6 +19,7 @@
#include "graphics/engine/text.h" #include "graphics/engine/text.h"
#include "app/app.h" #include "app/app.h"
#include "app/gamedata.h"
#include "common/image.h" #include "common/image.h"
#include "common/logger.h" #include "common/logger.h"
@ -333,7 +334,7 @@ float CText::GetStringWidth(std::string text, FontType font, float size)
// Skip special chars // Skip special chars
for (char& c : text) for (char& c : text)
{ {
if (c < 32) if (c < 32 && c >= 0)
c = ':'; c = ':';
} }
@ -351,7 +352,7 @@ float CText::GetCharWidth(UTF8Char ch, FontType font, float size, float offset)
if (font == FONT_BUTTON) return 0.0f; if (font == FONT_BUTTON) return 0.0f;
int width = 1; int width = 1;
if (ch.c1 < 32) if (ch.c1 < 32 && ch.c1 >= 0)
{ {
if (ch.c1 == '\t') if (ch.c1 == '\t')
width = m_tabSize; width = m_tabSize;
@ -646,7 +647,13 @@ void CText::DrawString(const std::string &text, std::vector<FontMetaChar>::itera
DrawCharAndAdjustPos(ch, font, size, pos, color); DrawCharAndAdjustPos(ch, font, size, pos, color);
fmtIndex++; // increment fmtIndex for each byte in multibyte character
if ( ch.c1 != 0 )
fmtIndex++;
if ( ch.c2 != 0 )
fmtIndex++;
if ( ch.c3 != 0 )
fmtIndex++;
} }
if (eol != 0) if (eol != 0)
@ -859,7 +866,7 @@ CachedFont* CText::GetOrOpenFont(FontType font, float size)
return m_lastCachedFont; return m_lastCachedFont;
} }
std::string path = CApplication::GetInstance().GetDataFilePath(DIR_FONT, mf->fileName); std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_FONT, mf->fileName);
m_lastCachedFont = new CachedFont(); m_lastCachedFont = new CachedFont();
m_lastCachedFont->font = TTF_OpenFont(path.c_str(), pointSize); m_lastCachedFont->font = TTF_OpenFont(path.c_str(), pointSize);

View File

@ -1791,6 +1791,19 @@ FillMode CGLDevice::GetFillMode()
return FILL_POINT; return FILL_POINT;
} }
void* CGLDevice::GetFrameBufferPixels()const{
GLubyte* pixels = new GLubyte [4 * m_config.size.x * m_config.size.y];
glReadPixels(0, 0, m_config.size.x, m_config.size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
unsigned int* p = static_cast<unsigned int*> ( static_cast<void*>(pixels) );
for (int i = 0; i < m_config.size.x * m_config.size.y; ++i)
p[i] |= 0xFF000000;
return static_cast<void*>(p);
}
} // namespace Gfx } // namespace Gfx

View File

@ -188,6 +188,8 @@ public:
virtual void SetFillMode(FillMode mode) ; virtual void SetFillMode(FillMode mode) ;
virtual FillMode GetFillMode(); virtual FillMode GetFillMode();
virtual void* GetFrameBufferPixels()const;
private: private:
//! Updates internal modelview matrix //! Updates internal modelview matrix
void UpdateModelviewMatrix(); void UpdateModelviewMatrix();

View File

@ -175,7 +175,6 @@ bool CAuto::CreateInterface(bool bSelect)
Ui::CWindow* pw; Ui::CWindow* pw;
Math::Point pos, dim, ddim; Math::Point pos, dim, ddim;
float ox, oy, sx, sy; float ox, oy, sx, sy;
char name[100];
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0)); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != nullptr ) if ( pw != nullptr )
@ -195,6 +194,7 @@ bool CAuto::CreateInterface(bool bSelect)
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0)); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false; if ( pw == 0 ) return false;
std::string name;
m_object->GetTooltipName(name); m_object->GetTooltipName(name);
pos.x = 0.0f; pos.x = 0.0f;
pos.y = 64.0f/480.0f; pos.y = 64.0f/480.0f;

View File

@ -121,7 +121,6 @@ bool CAutoBase::EventProcess(const Event &event)
CObject* pObj; CObject* pObj;
Math::Vector pos, speed, vibCir, iPos; Math::Vector pos, speed, vibCir, iPos;
Math::Point dim, p; Math::Point dim, p;
Error err;
float angle, dist, time, h, len, vSpeed; float angle, dist, time, h, len, vSpeed;
int i, max; int i, max;
@ -313,50 +312,7 @@ begin:
if ( event.type == EVENT_OBJECT_BTAKEOFF ) if ( event.type == EVENT_OBJECT_BTAKEOFF )
{ {
err = CheckCloseDoor(); return TakeOff(true);
if ( err != ERR_OK )
{
m_main->DisplayError(err, m_object);
return false;
}
err = m_main->CheckEndMission(false);
if ( err != ERR_OK )
{
m_main->DisplayError(err, m_object);
return false;
}
FreezeCargo(true); // freeze whole cargo
m_main->SetMovieLock(true); // blocks everything until the end
m_main->DeselectAll();
newEvent.type = EVENT_UPDINTERFACE;
m_eventQueue->AddEvent(newEvent);
m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
pos = m_pos;
pos.x -= 110.0f;
m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
m_camera->SetScriptEye(pos);
m_posSound = pos;
pos = m_object->GetPosition(0);
pos.y += 50.0f;
m_camera->SetScriptLookat(pos);
m_engine->SetFocus(1.0f);
m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 1.5f, BASE_DOOR_TIME2, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 1.5f, 0.5f, SOPER_STOP);
m_phase = ABP_CLOSE2;
m_progress = 0.0f;
m_speed = 1.0f/BASE_DOOR_TIME2;
return true;
} }
if ( event.type != EVENT_FRAME ) return true; if ( event.type != EVENT_FRAME ) return true;
@ -1400,11 +1356,7 @@ void CAutoBase::BeginTransit()
} }
else else
{ {
#if _DEMO
m_bgBack = "back46b.png"; // paintings
#else
m_bgBack = "back46.png"; // paintings m_bgBack = "back46.png"; // paintings
#endif
} }
m_engine->SetFogStart(0.9f); // hardly any fog m_engine->SetFogStart(0.9f); // hardly any fog
@ -1444,3 +1396,56 @@ void CAutoBase::EndTransit()
m_main->StartMusic(); m_main->StartMusic();
} }
Error CAutoBase::TakeOff(bool printMsg)
{
Event newEvent;
Math::Vector pos;
Error err;
err = CheckCloseDoor();
if ( err != ERR_OK )
{
if(printMsg) m_main->DisplayError(err, m_object);
return err;
}
err = m_main->CheckEndMission(false);
if ( err != ERR_OK )
{
if(printMsg) m_main->DisplayError(err, m_object);
return err;
}
FreezeCargo(true); // freeze whole cargo
m_main->SetMovieLock(true); // blocks everything until the end
m_main->DeselectAll();
newEvent.type = EVENT_UPDINTERFACE;
m_eventQueue->AddEvent(newEvent);
m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
pos = m_pos;
pos.x -= 110.0f;
m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
m_camera->SetScriptEye(pos);
m_posSound = pos;
pos = m_object->GetPosition(0);
pos.y += 50.0f;
m_camera->SetScriptLookat(pos);
m_engine->SetFocus(1.0f);
m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 1.5f, BASE_DOOR_TIME2, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 1.5f, 0.5f, SOPER_STOP);
m_phase = ABP_CLOSE2;
m_progress = 0.0f;
m_speed = 1.0f/BASE_DOOR_TIME2;
return ERR_OK;
}

View File

@ -77,6 +77,8 @@ public:
Error GetError(); Error GetError();
bool CreateInterface(bool bSelect); bool CreateInterface(bool bSelect);
Error TakeOff(bool printMsg);
protected: protected:
void UpdateInterface(); void UpdateInterface();

View File

@ -1238,7 +1238,6 @@ bool CBrain::CreateInterface(bool bSelect)
Ui::CLabel* pl; Ui::CLabel* pl;
Math::Point pos, dim, ddim; Math::Point pos, dim, ddim;
float ox, oy, sx, sy; float ox, oy, sx, sy;
char name[100];
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 ) if ( pw != 0 )
@ -1259,13 +1258,14 @@ bool CBrain::CreateInterface(bool bSelect)
pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false; if ( pw == 0 ) return false;
m_object->GetTooltipName(name); std::string tooltipLabel;
m_object->GetTooltipName(tooltipLabel);
pos.x = 0.0f; pos.x = 0.0f;
pos.y = 64.0f/480.0f; pos.y = 64.0f/480.0f;
ddim.x = 540.0f/640.0f; ddim.x = 540.0f/640.0f;
if ( !m_main->GetShowMap() ) ddim.x = 640.0f/640.0f; if ( !m_main->GetShowMap() ) ddim.x = 640.0f/640.0f;
ddim.y = 16.0f/480.0f; ddim.y = 16.0f/480.0f;
pw->CreateLabel(pos, ddim, 0, EVENT_LABEL0, name); pw->CreateLabel(pos, ddim, 0, EVENT_LABEL0, tooltipLabel);
dim.x = 33.0f/640.0f; dim.x = 33.0f/640.0f;
dim.y = 33.0f/480.0f; dim.y = 33.0f/480.0f;
@ -1674,8 +1674,10 @@ bool CBrain::CreateInterface(bool bSelect)
pos.y = oy+sy*1.2f; pos.y = oy+sy*1.2f;
ddim.x = dim.x*2.2f; ddim.x = dim.x*2.2f;
ddim.y = dim.y*0.4f; ddim.y = dim.y*0.4f;
GetResource(RES_TEXT, RT_INTERFACE_REC, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name); std::string recordLabel;
GetResource(RES_TEXT, RT_INTERFACE_REC, recordLabel);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, recordLabel);
pl->SetFontSize(9.0f); pl->SetFontSize(9.0f);
pos.x = ox+sx*7.0f; pos.x = ox+sx*7.0f;
@ -1787,9 +1789,6 @@ bool CBrain::CreateInterface(bool bSelect)
pos.x = ox+sx*13.4f; pos.x = ox+sx*13.4f;
pos.y = oy+sy*0; pos.y = oy+sy*0;
#if _TEEN
pw->CreateButton(pos, dim, 9, EVENT_OBJECT_RESET);
#else
if ( m_object->GetTrainer() ) // Training? if ( m_object->GetTrainer() ) // Training?
{ {
pw->CreateButton(pos, dim, 9, EVENT_OBJECT_RESET); pw->CreateButton(pos, dim, 9, EVENT_OBJECT_RESET);
@ -1798,7 +1797,6 @@ bool CBrain::CreateInterface(bool bSelect)
{ {
pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT); pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT);
} }
#endif
if ( type == OBJECT_MOBILEfa || if ( type == OBJECT_MOBILEfa ||
type == OBJECT_MOBILEta || type == OBJECT_MOBILEta ||
@ -2457,17 +2455,10 @@ void CBrain::UpdateScript(Ui::CWindow *pw)
char name[100]; char name[100];
char title[100]; char title[100];
int i; int i;
bool bSoluce;
pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_PROGLIST)); pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_PROGLIST));
if ( pl == 0 ) return; if ( pl == 0 ) return;
#if _SCHOOL
bSoluce = m_main->GetSoluce4();
#else
bSoluce = true;
#endif
for ( i=0 ; i<BRAINMAXSCRIPT ; i++ ) for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
{ {
sprintf(name, "%d", i+1); sprintf(name, "%d", i+1);
@ -2475,10 +2466,6 @@ void CBrain::UpdateScript(Ui::CWindow *pw)
if ( m_script[i] != 0 ) if ( m_script[i] != 0 )
{ {
m_script[i]->GetTitle(title); m_script[i]->GetTitle(title);
if ( !bSoluce && i == 3 )
{
title[0] = 0;
}
if ( title[0] != 0 ) if ( title[0] != 0 )
{ {
sprintf(name, "%d: %s", i+1, title); sprintf(name, "%d: %s", i+1, title);
@ -2488,11 +2475,6 @@ void CBrain::UpdateScript(Ui::CWindow *pw)
pl->SetItemName(i, name); pl->SetItemName(i, name);
} }
if ( !bSoluce )
{
pl->SetEnable(3, false);
}
pl->SetSelect(m_selScript); pl->SetSelect(m_selScript);
pl->ShowSelect(true); pl->ShowSelect(true);
} }

View File

@ -276,6 +276,7 @@ CObject::CObject()
m_lastVirusParticle = 0.0f; m_lastVirusParticle = 0.0f;
m_totalDesectList = 0; m_totalDesectList = 0;
m_bLock = false; m_bLock = false;
m_bIgnoreBuildCheck = false;
m_bExplo = false; m_bExplo = false;
m_bCargo = false; m_bCargo = false;
m_bBurn = false; m_bBurn = false;
@ -6781,7 +6782,7 @@ float CObject::GetParam()
// Management of the mode "blocked" of an object. // Management of the mode "blocked" of an object.
// For example, a cube of titanium is blocked while it is used to make something, // For example, a cube of titanium is blocked while it is used to make something,
//or a vehicle is blocked as its construction is not finished. // or a vehicle is blocked as its construction is not finished.
void CObject::SetLock(bool bLock) void CObject::SetLock(bool bLock)
{ {
@ -6793,6 +6794,18 @@ bool CObject::GetLock()
return m_bLock; return m_bLock;
} }
// Ignore checks in build() function
void CObject::SetIgnoreBuildCheck(bool bIgnoreBuildCheck)
{
m_bIgnoreBuildCheck = bIgnoreBuildCheck;
}
bool CObject::GetIgnoreBuildCheck()
{
return m_bIgnoreBuildCheck;
}
// Management of the mode "current explosion" of an object. // Management of the mode "current explosion" of an object.
// An object in this mode is not saving. // An object in this mode is not saving.
@ -7263,10 +7276,10 @@ int CObject::GetDefRank()
// Getes the object name for the tooltip. // Getes the object name for the tooltip.
bool CObject::GetTooltipName(char* name) bool CObject::GetTooltipName(std::string& name)
{ {
GetResource(RES_OBJECT, m_type, name); GetResource(RES_OBJECT, m_type, name);
return ( name[0] != 0 ); return !name.empty();
} }
@ -7390,3 +7403,70 @@ void CObject::SetTraceWidth(float width)
mv->SetTraceWidth(width); mv->SetTraceWidth(width);
} }
DriveType CObject::GetDriveFromObject(ObjectType type)
{
switch(type) {
case OBJECT_MOBILEwt:
case OBJECT_MOBILEwa:
case OBJECT_MOBILEwc:
case OBJECT_MOBILEwi:
case OBJECT_MOBILEws:
return DRIVE_WHEELED;
case OBJECT_MOBILEtt:
case OBJECT_MOBILEta:
case OBJECT_MOBILEtc:
case OBJECT_MOBILEti:
case OBJECT_MOBILEts:
return DRIVE_TRACKED;
case OBJECT_MOBILEft:
case OBJECT_MOBILEfa:
case OBJECT_MOBILEfc:
case OBJECT_MOBILEfi:
case OBJECT_MOBILEfs:
return DRIVE_WINGED;
case OBJECT_MOBILEit:
case OBJECT_MOBILEia:
case OBJECT_MOBILEic:
case OBJECT_MOBILEii:
case OBJECT_MOBILEis:
return DRIVE_LEGGED;
default:
return DRIVE_OTHER;
}
}
ToolType CObject::GetToolFromObject(ObjectType type)
{
switch(type) {
case OBJECT_MOBILEwa:
case OBJECT_MOBILEta:
case OBJECT_MOBILEfa:
case OBJECT_MOBILEia:
return TOOL_GRABBER;
case OBJECT_MOBILEws:
case OBJECT_MOBILEts:
case OBJECT_MOBILEfs:
case OBJECT_MOBILEis:
return TOOL_SNIFFER;
case OBJECT_MOBILEwc:
case OBJECT_MOBILEtc:
case OBJECT_MOBILEfc:
case OBJECT_MOBILEic:
return TOOL_SHOOTER;
case OBJECT_MOBILEwi:
case OBJECT_MOBILEti:
case OBJECT_MOBILEfi:
case OBJECT_MOBILEii:
return TOOL_ORGASHOOTER;
default:
return TOOL_OTHER;
}
}

View File

@ -47,245 +47,207 @@ enum ObjectType
{ {
OBJECT_NULL = 0, //! < object destroyed OBJECT_NULL = 0, //! < object destroyed
OBJECT_FIX = 1, //! < stationary scenery OBJECT_FIX = 1, //! < stationary scenery
OBJECT_PORTICO = 2, //! < gantry OBJECT_PORTICO = 2, //! < Portico
OBJECT_BASE = 3, //! < great main base OBJECT_BASE = 3, //! < SpaceShip
OBJECT_DERRICK = 4, //! < derrick set OBJECT_DERRICK = 4, //! < Derrick
OBJECT_FACTORY = 5, //! < factory set OBJECT_FACTORY = 5, //! < BotFactory
OBJECT_STATION = 6, //! < recharging station OBJECT_STATION = 6, //! < PowerStation
OBJECT_CONVERT = 7, //! < converter station OBJECT_CONVERT = 7, //! < Converter
OBJECT_REPAIR = 8, //! < reparation OBJECT_REPAIR = 8, //! < RepairStation
OBJECT_TOWER = 9, //! < defense tower OBJECT_TOWER = 9, //! < DefenseTower
OBJECT_NEST = 10, //! < nest OBJECT_NEST = 10, //! < AlienNest
OBJECT_RESEARCH = 11, //! < research center OBJECT_RESEARCH = 11, //! < ResearchCenter
OBJECT_RADAR = 12, //! < radar OBJECT_RADAR = 12, //! < RadarStation
OBJECT_ENERGY = 13, //! < energy factory OBJECT_ENERGY = 13, //! < PowerPlant
OBJECT_LABO = 14, //! < analytical laboratory for insect OBJECT_LABO = 14, //! < AutoLab
OBJECT_NUCLEAR = 15, //! < nuclear power plant OBJECT_NUCLEAR = 15, //! < NuclearPlant
OBJECT_START = 16, //! < starting OBJECT_START = 16, //! < StartArea
OBJECT_END = 17, //! < finish OBJECT_END = 17, //! < EndArea
OBJECT_INFO = 18, //! < information terminal OBJECT_INFO = 18, //! < ExchangePost
OBJECT_PARA = 19, //! < lightning conductor OBJECT_PARA = 19, //! < PowerCaptor
OBJECT_TARGET1 = 20, //! < gate target OBJECT_TARGET1 = 20, //! < Target1 (gate)
OBJECT_TARGET2 = 21, //! < center target OBJECT_TARGET2 = 21, //! < Target2 (center)
OBJECT_SAFE = 22, //! < safe OBJECT_SAFE = 22, //! < Vault
OBJECT_HUSTON = 23, //! < control centre OBJECT_HUSTON = 23, //! < Houston
OBJECT_DESTROYER = 24, //! < destroyer OBJECT_DESTROYER = 24, //! < Destroyer
OBJECT_FRET = 30, //! < transportable OBJECT_FRET = 30, //! < transportable (unused)
OBJECT_STONE = 31, //! < stone OBJECT_STONE = 31, //! < TitaniumOre
OBJECT_URANIUM = 32, //! < uranium OBJECT_URANIUM = 32, //! < UraniumOre
OBJECT_METAL = 33, //! < metal OBJECT_METAL = 33, //! < Titanium
OBJECT_POWER = 34, //! < normal battery OBJECT_POWER = 34, //! < PowerCell
OBJECT_ATOMIC = 35, //! < atomic battery OBJECT_ATOMIC = 35, //! < NuclearCell
OBJECT_BULLET = 36, //! < bullet OBJECT_BULLET = 36, //! < OrgaMatter
OBJECT_BBOX = 37, //! < black-box OBJECT_BBOX = 37, //! < BlackBox
OBJECT_TNT = 38, //! < box of TNT OBJECT_TNT = 38, //! < TNT
OBJECT_SCRAP1 = 40, //! < metal waste OBJECT_SCRAP1 = 40, //! < Scrap1 (metal)
OBJECT_SCRAP2 = 41, //! < metal waste OBJECT_SCRAP2 = 41, //! < Scrap2 (metal)
OBJECT_SCRAP3 = 42, //! < metal waste OBJECT_SCRAP3 = 42, //! < Scrap3 (metal)
OBJECT_SCRAP4 = 43, //! < plastic waste OBJECT_SCRAP4 = 43, //! < Scrap4 (plastic)
OBJECT_SCRAP5 = 44, //! < plastic waste OBJECT_SCRAP5 = 44, //! < Scrap5 (plastic)
OBJECT_MARKPOWER = 50, //! < mark underground energy source OBJECT_MARKPOWER = 50, //! < PowerSpot
OBJECT_MARKSTONE = 51, //! < mark underground ore OBJECT_MARKSTONE = 51, //! < TitaniumSpot
OBJECT_MARKURANIUM = 52, //! < mark underground uranium OBJECT_MARKURANIUM = 52, //! < UraniumSpot
OBJECT_MARKKEYa = 53, //! < mark underground key OBJECT_MARKKEYa = 53, //! < KeyASpot
OBJECT_MARKKEYb = 54, //! < mark underground key OBJECT_MARKKEYb = 54, //! < KeyBSpot
OBJECT_MARKKEYc = 55, //! < mark underground key OBJECT_MARKKEYc = 55, //! < KeyCSpot
OBJECT_MARKKEYd = 56, //! < mark underground key OBJECT_MARKKEYd = 56, //! < KeyDSpot
OBJECT_BOMB = 60, //! < bomb OBJECT_BOMB = 60, //! < Mine
OBJECT_WINFIRE = 61, //! < fireworks OBJECT_WINFIRE = 61, //! < Firework
OBJECT_SHOW = 62, //! < shows a place OBJECT_SHOW = 62, //! < arrow above object (Visit)
OBJECT_BAG = 63, //! < survival bag OBJECT_BAG = 63, //! < Bag
OBJECT_PLANT0 = 70, //! < plant 0 OBJECT_PLANT0 = 70, //! < Greenery0
OBJECT_PLANT1 = 71, //! < plant 1 OBJECT_PLANT1 = 71, //! < Greenery1
OBJECT_PLANT2 = 72, //! < plant 2 OBJECT_PLANT2 = 72, //! < Greenery2
OBJECT_PLANT3 = 73, //! < plant 3 OBJECT_PLANT3 = 73, //! < Greenery3
OBJECT_PLANT4 = 74, //! < plant 4 OBJECT_PLANT4 = 74, //! < Greenery4
OBJECT_PLANT5 = 75, //! < plant 5 OBJECT_PLANT5 = 75, //! < Greenery5
OBJECT_PLANT6 = 76, //! < plant 6 OBJECT_PLANT6 = 76, //! < Greenery6
OBJECT_PLANT7 = 77, //! < plant 7 OBJECT_PLANT7 = 77, //! < Greenery7
OBJECT_PLANT8 = 78, //! < plant 8 OBJECT_PLANT8 = 78, //! < Greenery8
OBJECT_PLANT9 = 79, //! < plant 9 OBJECT_PLANT9 = 79, //! < Greenery9
OBJECT_PLANT10 = 80, //! < plant 10 OBJECT_PLANT10 = 80, //! < Greenery10
OBJECT_PLANT11 = 81, //! < plant 11 OBJECT_PLANT11 = 81, //! < Greenery11
OBJECT_PLANT12 = 82, //! < plant 12 OBJECT_PLANT12 = 82, //! < Greenery12
OBJECT_PLANT13 = 83, //! < plant 13 OBJECT_PLANT13 = 83, //! < Greenery13
OBJECT_PLANT14 = 84, //! < plant 14 OBJECT_PLANT14 = 84, //! < Greenery14
OBJECT_PLANT15 = 85, //! < plant 15 OBJECT_PLANT15 = 85, //! < Greenery15
OBJECT_PLANT16 = 86, //! < plant 16 OBJECT_PLANT16 = 86, //! < Greenery16
OBJECT_PLANT17 = 87, //! < plant 17 OBJECT_PLANT17 = 87, //! < Greenery17
OBJECT_PLANT18 = 88, //! < plant 18 OBJECT_PLANT18 = 88, //! < Greenery18
OBJECT_PLANT19 = 89, //! < plant 19 OBJECT_PLANT19 = 89, //! < Greenery19
OBJECT_TREE0 = 90, //! < tree 0 OBJECT_TREE0 = 90, //! < Tree0
OBJECT_TREE1 = 91, //! < tree 1 OBJECT_TREE1 = 91, //! < Tree1
OBJECT_TREE2 = 92, //! < tree 2 OBJECT_TREE2 = 92, //! < Tree2
OBJECT_TREE3 = 93, //! < tree 3 OBJECT_TREE3 = 93, //! < Tree3
OBJECT_TREE4 = 94, //! < tree 4 OBJECT_TREE4 = 94, //! < Tree4
OBJECT_TREE5 = 95, //! < tree 5 OBJECT_TREE5 = 95, //! < Tree5
OBJECT_TREE6 = 96, //! < tree 6 OBJECT_MOBILEwt = 100, //! < PracticeBot
OBJECT_TREE7 = 97, //! < tree 7 OBJECT_MOBILEtt = 101, //! < track-trainer (unused)
OBJECT_TREE8 = 98, //! < tree 8 OBJECT_MOBILEft = 102, //! < fly-trainer (unused)
OBJECT_TREE9 = 99, //! < tree 9 OBJECT_MOBILEit = 103, //! < insect-trainer (unused)
OBJECT_MOBILEwt = 100, //! < wheel-trainer OBJECT_MOBILEwa = 110, //! < WheeledGrabber
OBJECT_MOBILEtt = 101, //! < track-trainer OBJECT_MOBILEta = 111, //! < TrackedGrabber
OBJECT_MOBILEft = 102, //! < fly-trainer OBJECT_MOBILEfa = 112, //! < WingedGrabber
OBJECT_MOBILEit = 103, //! < insect-trainer OBJECT_MOBILEia = 113, //! < LeggedGrabber
OBJECT_MOBILEwa = 110, //! < wheel-arm OBJECT_MOBILEwc = 120, //! < WheeledShooter
OBJECT_MOBILEta = 111, //! < track-arm OBJECT_MOBILEtc = 121, //! < TrackedShooter
OBJECT_MOBILEfa = 112, //! < fly-arm OBJECT_MOBILEfc = 122, //! < WingedShooter
OBJECT_MOBILEia = 113, //! < insect-arm OBJECT_MOBILEic = 123, //! < LeggedShooter
OBJECT_MOBILEwc = 120, //! < wheel-cannon OBJECT_MOBILEwi = 130, //! < WheeledOrgaShooter
OBJECT_MOBILEtc = 121, //! < track-cannon OBJECT_MOBILEti = 131, //! < TrackedOrgaShooter
OBJECT_MOBILEfc = 122, //! < fly-cannon OBJECT_MOBILEfi = 132, //! < WingedOrgaShooter
OBJECT_MOBILEic = 123, //! < insect-cannon OBJECT_MOBILEii = 133, //! < LeggedOrgaShooter
OBJECT_MOBILEwi = 130, //! < wheel-insect-cannon OBJECT_MOBILEws = 140, //! < WheeledSniffer
OBJECT_MOBILEti = 131, //! < track-insect-cannon OBJECT_MOBILEts = 141, //! < TrackedSniffer
OBJECT_MOBILEfi = 132, //! < fly-insect-cannon OBJECT_MOBILEfs = 142, //! < WingedSniffer
OBJECT_MOBILEii = 133, //! < insect-insect-cannon OBJECT_MOBILEis = 143, //! < LeggedSniffer
OBJECT_MOBILEws = 140, //! < wheel-search OBJECT_MOBILErt = 200, //! < Thumper
OBJECT_MOBILEts = 141, //! < track-search OBJECT_MOBILErc = 201, //! < PhazerShooter
OBJECT_MOBILEfs = 142, //! < fly-search OBJECT_MOBILErr = 202, //! < Recycler
OBJECT_MOBILEis = 143, //! < insect-search OBJECT_MOBILErs = 203, //! < Shielder
OBJECT_MOBILErt = 200, //! < roller-terraform OBJECT_MOBILEsa = 210, //! < Subber
OBJECT_MOBILErc = 201, //! < roller-canon OBJECT_MOBILEtg = 211, //! < TargetBot
OBJECT_MOBILErr = 202, //! < roller-recover OBJECT_MOBILEdr = 212, //! < Scribbler
OBJECT_MOBILErs = 203, //! < roller-shield OBJECT_CONTROLLER = 213, //! < MissionController
OBJECT_MOBILEsa = 210, //! < submarine OBJECT_WAYPOINT = 250, //! < WayPoint
OBJECT_MOBILEtg = 211, //! < training target OBJECT_FLAGb = 260, //! < BlueFlag
OBJECT_MOBILEdr = 212, //! < robot drawing OBJECT_FLAGr = 261, //! < RedFlag
OBJECT_CONTROLLER = 213, //! < mission controller OBJECT_FLAGg = 262, //! < GreenFlag
OBJECT_WAYPOINT = 250, //! < waypoint OBJECT_FLAGy = 263, //! < YellowFlag
OBJECT_FLAGb = 260, //! < blue flag OBJECT_FLAGv = 264, //! < VioletFlag
OBJECT_FLAGr = 261, //! < red flag OBJECT_KEYa = 270, //! < KeyA
OBJECT_FLAGg = 262, //! < green flag OBJECT_KEYb = 271, //! < KeyB
OBJECT_FLAGy = 263, //! < yellow flag OBJECT_KEYc = 272, //! < KeyC
OBJECT_FLAGv = 264, //! < violet flag OBJECT_KEYd = 273, //! < KeyD
OBJECT_KEYa = 270, //! < key a OBJECT_HUMAN = 300, //! < Me
OBJECT_KEYb = 271, //! < key b OBJECT_TOTO = 301, //! < Robby (toto)
OBJECT_KEYc = 272, //! < key c OBJECT_TECH = 302, //! < Tech
OBJECT_KEYd = 273, //! < key d OBJECT_BARRIER0 = 400, //! < Barrier0
OBJECT_HUMAN = 300, //! < human OBJECT_BARRIER1 = 401, //! < Barrier1
OBJECT_TOTO = 301, //! < toto OBJECT_BARRIER2 = 402, //! < Barrier2
OBJECT_TECH = 302, //! < technician OBJECT_BARRIER3 = 403, //! < Barrier3
OBJECT_BARRIER0 = 400, //! < barrier OBJECT_MOTHER = 500, //! < AlienQueen
OBJECT_BARRIER1 = 401, //! < barrier OBJECT_EGG = 501, //! < AlienEgg
OBJECT_BARRIER2 = 402, //! < barrier OBJECT_ANT = 502, //! < AlienAnt
OBJECT_BARRIER3 = 403, //! < barrier OBJECT_SPIDER = 503, //! < AlienSpider
OBJECT_BARRIER4 = 404, //! < barrier OBJECT_BEE = 504, //! < AlienWasp
OBJECT_MOTHER = 500, //! < insect queen OBJECT_WORM = 505, //! < AlienWorm
OBJECT_EGG = 501, //! < egg OBJECT_RUINmobilew1 = 600, //! < WreckBotw1
OBJECT_ANT = 502, //! < ant OBJECT_RUINmobilew2 = 601, //! < WreckBotw2
OBJECT_SPIDER = 503, //! < spider OBJECT_RUINmobilet1 = 602, //! < WreckBott1
OBJECT_BEE = 504, //! < bee OBJECT_RUINmobilet2 = 603, //! < WreckBott2
OBJECT_WORM = 505, //! < worm OBJECT_RUINmobiler1 = 604, //! < WreckBotr1
OBJECT_RUINmobilew1 = 600, //! < ruin 1 OBJECT_RUINmobiler2 = 605, //! < WreckBotr2
OBJECT_RUINmobilew2 = 601, //! < ruin 1 OBJECT_RUINfactory = 606, //! < RuinBotFactory
OBJECT_RUINmobilet1 = 602, //! < ruin 2 OBJECT_RUINdoor = 607, //! < RuinDoor
OBJECT_RUINmobilet2 = 603, //! < ruin 2 OBJECT_RUINsupport = 608, //! < RuinSupport
OBJECT_RUINmobiler1 = 604, //! < ruin 3 OBJECT_RUINradar = 609, //! < RuinRadar
OBJECT_RUINmobiler2 = 605, //! < ruin 3 OBJECT_RUINconvert = 610, //! < RuinConvert
OBJECT_RUINfactory = 606, //! < ruin 4 OBJECT_RUINbase = 611, //! < RuinBaseCamp
OBJECT_RUINdoor = 607, //! < ruin 5 OBJECT_RUINhead = 612, //! < RuinHeadCamp
OBJECT_RUINsupport = 608, //! < ruin 6 OBJECT_TEEN0 = 620, //! < Teen0
OBJECT_RUINradar = 609, //! < ruin 7 OBJECT_TEEN1 = 621, //! < Teen1
OBJECT_RUINconvert = 610, //! < ruin 8 OBJECT_TEEN2 = 622, //! < Teen2
OBJECT_RUINbase = 611, //! < ruin 9 OBJECT_TEEN3 = 623, //! < Teen3
OBJECT_RUINhead = 612, //! < ruin 10 OBJECT_TEEN4 = 624, //! < Teen4
OBJECT_TEEN0 = 620, //! < toy OBJECT_TEEN5 = 625, //! < Teen5
OBJECT_TEEN1 = 621, //! < toy OBJECT_TEEN6 = 626, //! < Teen6
OBJECT_TEEN2 = 622, //! < toy OBJECT_TEEN7 = 627, //! < Teen7
OBJECT_TEEN3 = 623, //! < toy OBJECT_TEEN8 = 628, //! < Teen8
OBJECT_TEEN4 = 624, //! < toy OBJECT_TEEN9 = 629, //! < Teen9
OBJECT_TEEN5 = 625, //! < toy OBJECT_TEEN10 = 630, //! < Teen10
OBJECT_TEEN6 = 626, //! < toy OBJECT_TEEN11 = 631, //! < Teen11
OBJECT_TEEN7 = 627, //! < toy OBJECT_TEEN12 = 632, //! < Teen12
OBJECT_TEEN8 = 628, //! < toy OBJECT_TEEN13 = 633, //! < Teen13
OBJECT_TEEN9 = 629, //! < toy OBJECT_TEEN14 = 634, //! < Teen14
OBJECT_TEEN10 = 630, //! < toy OBJECT_TEEN15 = 635, //! < Teen15
OBJECT_TEEN11 = 631, //! < toy OBJECT_TEEN16 = 636, //! < Teen16
OBJECT_TEEN12 = 632, //! < toy OBJECT_TEEN17 = 637, //! < Teen17
OBJECT_TEEN13 = 633, //! < toy OBJECT_TEEN18 = 638, //! < Teen18
OBJECT_TEEN14 = 634, //! < toy OBJECT_TEEN19 = 639, //! < Teen19
OBJECT_TEEN15 = 635, //! < toy OBJECT_TEEN20 = 640, //! < Teen20
OBJECT_TEEN16 = 636, //! < toy OBJECT_TEEN21 = 641, //! < Teen21
OBJECT_TEEN17 = 637, //! < toy OBJECT_TEEN22 = 642, //! < Teen22
OBJECT_TEEN18 = 638, //! < toy OBJECT_TEEN23 = 643, //! < Teen23
OBJECT_TEEN19 = 639, //! < toy OBJECT_TEEN24 = 644, //! < Teen24
OBJECT_TEEN20 = 640, //! < toy OBJECT_TEEN25 = 645, //! < Teen25
OBJECT_TEEN21 = 641, //! < toy OBJECT_TEEN26 = 646, //! < Teen26
OBJECT_TEEN22 = 642, //! < toy OBJECT_TEEN27 = 647, //! < Teen27
OBJECT_TEEN23 = 643, //! < toy OBJECT_TEEN28 = 648, //! < Teen28
OBJECT_TEEN24 = 644, //! < toy OBJECT_TEEN29 = 649, //! < Teen29
OBJECT_TEEN25 = 645, //! < toy OBJECT_TEEN30 = 650, //! < Teen30
OBJECT_TEEN26 = 646, //! < toy OBJECT_TEEN31 = 651, //! < Teen31
OBJECT_TEEN27 = 647, //! < toy OBJECT_TEEN32 = 652, //! < Teen32
OBJECT_TEEN28 = 648, //! < toy OBJECT_TEEN33 = 653, //! < Teen33
OBJECT_TEEN29 = 649, //! < toy OBJECT_TEEN34 = 654, //! < Stone (Teen34)
OBJECT_TEEN30 = 650, //! < toy OBJECT_TEEN35 = 655, //! < Teen35
OBJECT_TEEN31 = 651, //! < toy OBJECT_TEEN36 = 656, //! < Teen36
OBJECT_TEEN32 = 652, //! < toy OBJECT_TEEN37 = 657, //! < Teen37
OBJECT_TEEN33 = 653, //! < toy OBJECT_TEEN38 = 658, //! < Teen38
OBJECT_TEEN34 = 654, //! < toy OBJECT_TEEN39 = 659, //! < Teen39
OBJECT_TEEN35 = 655, //! < toy OBJECT_TEEN40 = 660, //! < Teen40
OBJECT_TEEN36 = 656, //! < toy OBJECT_TEEN41 = 661, //! < Teen41
OBJECT_TEEN37 = 657, //! < toy OBJECT_TEEN42 = 662, //! < Teen42
OBJECT_TEEN38 = 658, //! < toy OBJECT_TEEN43 = 663, //! < Teen43
OBJECT_TEEN39 = 659, //! < toy OBJECT_TEEN44 = 664, //! < Teen44
OBJECT_TEEN40 = 660, //! < toy OBJECT_QUARTZ0 = 700, //! < Quartz0
OBJECT_TEEN41 = 661, //! < toy OBJECT_QUARTZ1 = 701, //! < Quartz1
OBJECT_TEEN42 = 662, //! < toy OBJECT_QUARTZ2 = 702, //! < Quartz2
OBJECT_TEEN43 = 663, //! < toy OBJECT_QUARTZ3 = 703, //! < Quartz3
OBJECT_TEEN44 = 664, //! < toy OBJECT_ROOT0 = 710, //! < MegaStalk0
OBJECT_TEEN45 = 665, //! < toy OBJECT_ROOT1 = 711, //! < MegaStalk1
OBJECT_TEEN46 = 666, //! < toy OBJECT_ROOT2 = 712, //! < MegaStalk2
OBJECT_TEEN47 = 667, //! < toy OBJECT_ROOT3 = 713, //! < MegaStalk3
OBJECT_TEEN48 = 668, //! < toy OBJECT_ROOT4 = 714, //! < MegaStalk4
OBJECT_TEEN49 = 669, //! < toy OBJECT_ROOT5 = 715, //! < MegaStalk5
OBJECT_QUARTZ0 = 700, //! < crystal 0 OBJECT_MUSHROOM1 = 731, //! < Mushroom1
OBJECT_QUARTZ1 = 701, //! < crystal 1 OBJECT_MUSHROOM2 = 732, //! < Mushroom2
OBJECT_QUARTZ2 = 702, //! < crystal 2 OBJECT_APOLLO1 = 900, //! < ApolloLEM
OBJECT_QUARTZ3 = 703, //! < crystal 3 OBJECT_APOLLO2 = 901, //! < ApolloJeep
OBJECT_QUARTZ4 = 704, //! < crystal 4 OBJECT_APOLLO3 = 902, //! < ApolloFlag
OBJECT_QUARTZ5 = 705, //! < crystal 5 OBJECT_APOLLO4 = 903, //! < ApolloModule
OBJECT_QUARTZ6 = 706, //! < crystal 6 OBJECT_APOLLO5 = 904, //! < ApolloAntenna
OBJECT_QUARTZ7 = 707, //! < crystal 7 OBJECT_HOME1 = 910, //! < Home
OBJECT_QUARTZ8 = 708, //! < crystal 8
OBJECT_QUARTZ9 = 709, //! < crystal 9
OBJECT_ROOT0 = 710, //! < root 0
OBJECT_ROOT1 = 711, //! < root 1
OBJECT_ROOT2 = 712, //! < root 2
OBJECT_ROOT3 = 713, //! < root 3
OBJECT_ROOT4 = 714, //! < root 4
OBJECT_ROOT5 = 715, //! < root 5
OBJECT_ROOT6 = 716, //! < root 6
OBJECT_ROOT7 = 717, //! < root 7
OBJECT_ROOT8 = 718, //! < root 8
OBJECT_ROOT9 = 719, //! < root 9
OBJECT_SEAWEED0 = 720, //! < seaweed 0
OBJECT_SEAWEED1 = 721, //! < seaweed 1
OBJECT_SEAWEED2 = 722, //! < seaweed 2
OBJECT_SEAWEED3 = 723, //! < seaweed 3
OBJECT_SEAWEED4 = 724, //! < seaweed 4
OBJECT_SEAWEED5 = 725, //! < seaweed 5
OBJECT_SEAWEED6 = 726, //! < seaweed 6
OBJECT_SEAWEED7 = 727, //! < seaweed 7
OBJECT_SEAWEED8 = 728, //! < seaweed 8
OBJECT_SEAWEED9 = 729, //! < seaweed 9
OBJECT_MUSHROOM0 = 730, //! < mushroom 0
OBJECT_MUSHROOM1 = 731, //! < mushroom 1
OBJECT_MUSHROOM2 = 732, //! < mushroom 2
OBJECT_MUSHROOM3 = 733, //! < mushroom 3
OBJECT_MUSHROOM4 = 734, //! < mushroom 4
OBJECT_MUSHROOM5 = 735, //! < mushroom 5
OBJECT_MUSHROOM6 = 736, //! < mushroom 6
OBJECT_MUSHROOM7 = 737, //! < mushroom 7
OBJECT_MUSHROOM8 = 738, //! < mushroom 8
OBJECT_MUSHROOM9 = 739, //! < mushroom 9
OBJECT_APOLLO1 = 900, //! < apollo lem
OBJECT_APOLLO2 = 901, //! < apollo jeep
OBJECT_APOLLO3 = 902, //! < apollo flag
OBJECT_APOLLO4 = 903, //! < apollo module
OBJECT_APOLLO5 = 904, //! < apollo antenna
OBJECT_HOME1 = 910, //! < home 1
OBJECT_MAX = 1000 //! < number of values OBJECT_MAX = 1000 //! < number of values
}; };
@ -311,6 +273,24 @@ enum ObjectMaterial
OM_MINERAL = 5, // stone OM_MINERAL = 5, // stone
}; };
enum DriveType
{
DRIVE_OTHER = 0,
DRIVE_WHEELED,
DRIVE_TRACKED,
DRIVE_WINGED,
DRIVE_LEGGED,
};
enum ToolType
{
TOOL_OTHER = 0,
TOOL_GRABBER,
TOOL_SNIFFER,
TOOL_SHOOTER,
TOOL_ORGASHOOTER,
};
struct ObjectPart struct ObjectPart
{ {
char bUsed; char bUsed;
@ -602,6 +582,9 @@ public:
void SetParam(float value); void SetParam(float value);
float GetParam(); float GetParam();
void SetIgnoreBuildCheck(bool bIgnoreBuildCheck);
bool GetIgnoreBuildCheck();
void SetExplo(bool bExplo); void SetExplo(bool bExplo);
bool GetExplo(); bool GetExplo();
@ -639,7 +622,7 @@ public:
void SetDefRank(int rank); void SetDefRank(int rank);
int GetDefRank(); int GetDefRank();
bool GetTooltipName(char* name); bool GetTooltipName(std::string& name);
void AddDeselList(CObject* pObj); void AddDeselList(CObject* pObj);
CObject* SubDeselList(); CObject* SubDeselList();
@ -659,6 +642,9 @@ public:
void SetTraceWidth(float width); void SetTraceWidth(float width);
std::string GetModelDirName(); std::string GetModelDirName();
static DriveType GetDriveFromObject(ObjectType type);
static ToolType GetToolFromObject(ObjectType type);
protected: protected:
bool EventFrame(const Event &event); bool EventFrame(const Event &event);
@ -737,6 +723,7 @@ protected:
bool m_bTrainer; // drive vehicle (without remote) bool m_bTrainer; // drive vehicle (without remote)
bool m_bToy; // toy key bool m_bToy; // toy key
bool m_bManual; // manual control (Scribbler) bool m_bManual; // manual control (Scribbler)
bool m_bIgnoreBuildCheck;
bool m_bFixed; bool m_bFixed;
bool m_bClip; bool m_bClip;
bool m_bShowLimit; bool m_bShowLimit;

View File

@ -30,7 +30,7 @@ CObjectManager::CObjectManager()
{ {
m_table[i] = nullptr; m_table[i] = nullptr;
} }
usedCount = 0; m_usedCount = 0;
} }
CObjectManager::~CObjectManager() CObjectManager::~CObjectManager()
@ -39,16 +39,16 @@ CObjectManager::~CObjectManager()
bool CObjectManager::AddInstance(CObject* instance) bool CObjectManager::AddInstance(CObject* instance)
{ {
if (usedCount >= MAX_OBJECTS) return false; if (m_usedCount >= MAX_OBJECTS) return false;
m_table[instance->GetID()] = instance; m_table[instance->GetID()] = instance;
usedCount++; m_usedCount++;
return true; return true;
} }
bool CObjectManager::DeleteInstance(CObject* instance) bool CObjectManager::DeleteInstance(CObject* instance)
{ {
for (int i = 0; i < usedCount; i++) for (int i = 0; i < m_usedCount; i++)
{ {
if (m_table[i] == instance) if (m_table[i] == instance)
m_table[i] = nullptr; m_table[i] = nullptr;
@ -63,10 +63,9 @@ CObject* CObjectManager::SearchInstance(int id)
return m_table[id]; return m_table[id];
} }
CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom, float height, CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType type,
ObjectType type, float power, float power, float zoom, float height,
bool trainer, bool toy, bool trainer, bool toy, int option)
int option)
{ {
CObject* object = nullptr; CObject* object = nullptr;
@ -161,8 +160,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
if ( type == OBJECT_BARRIER0 || if ( type == OBJECT_BARRIER0 ||
type == OBJECT_BARRIER1 || type == OBJECT_BARRIER1 ||
type == OBJECT_BARRIER2 || type == OBJECT_BARRIER2 ||
type == OBJECT_BARRIER3 || type == OBJECT_BARRIER3 )
type == OBJECT_BARRIER4 )
{ {
object = new CObject(); object = new CObject();
object->CreateBarrier(pos, angle, height, type); object->CreateBarrier(pos, angle, height, type);
@ -193,26 +191,14 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
type == OBJECT_TREE2 || type == OBJECT_TREE2 ||
type == OBJECT_TREE3 || type == OBJECT_TREE3 ||
type == OBJECT_TREE4 || type == OBJECT_TREE4 ||
type == OBJECT_TREE5 || type == OBJECT_TREE5 )
type == OBJECT_TREE6 ||
type == OBJECT_TREE7 ||
type == OBJECT_TREE8 ||
type == OBJECT_TREE9 )
{ {
object = new CObject(); object = new CObject();
object->CreatePlant(pos, angle, height, type); object->CreatePlant(pos, angle, height, type);
} }
else else
if ( type == OBJECT_MUSHROOM0 || if ( type == OBJECT_MUSHROOM1 ||
type == OBJECT_MUSHROOM1 || type == OBJECT_MUSHROOM2 )
type == OBJECT_MUSHROOM2 ||
type == OBJECT_MUSHROOM3 ||
type == OBJECT_MUSHROOM4 ||
type == OBJECT_MUSHROOM5 ||
type == OBJECT_MUSHROOM6 ||
type == OBJECT_MUSHROOM7 ||
type == OBJECT_MUSHROOM8 ||
type == OBJECT_MUSHROOM9 )
{ {
object = new CObject(); object = new CObject();
object->CreateMushroom(pos, angle, height, type); object->CreateMushroom(pos, angle, height, type);
@ -262,12 +248,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
type == OBJECT_TEEN41 || type == OBJECT_TEEN41 ||
type == OBJECT_TEEN42 || type == OBJECT_TEEN42 ||
type == OBJECT_TEEN43 || type == OBJECT_TEEN43 ||
type == OBJECT_TEEN44 || type == OBJECT_TEEN44 )
type == OBJECT_TEEN45 ||
type == OBJECT_TEEN46 ||
type == OBJECT_TEEN47 ||
type == OBJECT_TEEN48 ||
type == OBJECT_TEEN49 )
{ {
object = new CObject(); object = new CObject();
object->SetOption(option); object->SetOption(option);
@ -277,13 +258,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
if ( type == OBJECT_QUARTZ0 || if ( type == OBJECT_QUARTZ0 ||
type == OBJECT_QUARTZ1 || type == OBJECT_QUARTZ1 ||
type == OBJECT_QUARTZ2 || type == OBJECT_QUARTZ2 ||
type == OBJECT_QUARTZ3 || type == OBJECT_QUARTZ3 )
type == OBJECT_QUARTZ4 ||
type == OBJECT_QUARTZ5 ||
type == OBJECT_QUARTZ6 ||
type == OBJECT_QUARTZ7 ||
type == OBJECT_QUARTZ8 ||
type == OBJECT_QUARTZ9 )
{ {
object = new CObject(); object = new CObject();
object->CreateQuartz(pos, angle, height, type); object->CreateQuartz(pos, angle, height, type);
@ -294,11 +269,7 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
type == OBJECT_ROOT2 || type == OBJECT_ROOT2 ||
type == OBJECT_ROOT3 || type == OBJECT_ROOT3 ||
type == OBJECT_ROOT4 || type == OBJECT_ROOT4 ||
type == OBJECT_ROOT5 || type == OBJECT_ROOT5 )
type == OBJECT_ROOT6 ||
type == OBJECT_ROOT7 ||
type == OBJECT_ROOT8 ||
type == OBJECT_ROOT9 )
{ {
object = new CObject(); object = new CObject();
object->CreateRoot(pos, angle, height, type); object->CreateRoot(pos, angle, height, type);
@ -387,3 +358,11 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, float zoom,
return object; return object;
} }
void CObjectManager::Flush()
{
for (int i = 0; i < MAX_OBJECTS; i++)
{
m_table[i] = nullptr;
}
m_usedCount = 0;
}

View File

@ -44,10 +44,12 @@ public:
//! Seeks for an object //! Seeks for an object
CObject* SearchInstance(int id); CObject* SearchInstance(int id);
//! Creates an object //! Creates an object
CObject* CreateObject(Math::Vector pos, float angle, float zoom, float height, ObjectType type, float power, bool trainer, bool toy, int option); CObject* CreateObject(Math::Vector pos, float angle, ObjectType type, float power = -1.f, float zoom = 1.f, float height = 0.f, bool trainer = false, bool toy = false, int option = 0);
//! Removes all objects
void Flush();
protected: protected:
CObject* m_table[MAX_OBJECTS]; CObject* m_table[MAX_OBJECTS];
int usedCount; int m_usedCount;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,8 @@
#include "object/object.h" #include "object/object.h"
#include "object/mainmovie.h" #include "object/mainmovie.h"
#include "app/pausemanager.h"
#include <stdio.h> #include <stdio.h>
enum Phase enum Phase
@ -44,7 +46,6 @@ enum Phase
PHASE_FREE, PHASE_FREE,
PHASE_TEEN, PHASE_TEEN,
PHASE_USER, PHASE_USER,
PHASE_PROTO,
PHASE_LOADING, PHASE_LOADING,
PHASE_SIMUL, PHASE_SIMUL,
PHASE_MODEL, PHASE_MODEL,
@ -104,6 +105,8 @@ struct EndTake
int lost; // lost if <= int lost; // lost if <=
float powermin; // wins if energy cell >= float powermin; // wins if energy cell >=
float powermax; // wins if energy cell <= float powermax; // wins if energy cell <=
ToolType tool;
DriveType drive;
bool immediat; bool immediat;
char message[100]; char message[100];
}; };
@ -117,6 +120,8 @@ struct AudioChange
int max; // change if < int max; // change if <
float powermin; // change if energy cell >= float powermin; // change if energy cell >=
float powermax; // change if energy cell <= float powermax; // change if energy cell <=
ToolType tool;
DriveType drive;
char music[100]; char music[100];
bool repeat; bool repeat;
bool changed; bool changed;
@ -250,7 +255,7 @@ public:
void SetTracePrecision(float factor); void SetTracePrecision(float factor);
float GetTracePrecision(); float GetTracePrecision();
void ChangePause(bool pause); void ChangePause(PauseType pause);
void SetSpeed(float speed); void SetSpeed(float speed);
float GetSpeed(); float GetSpeed();
@ -335,6 +340,7 @@ public:
float GetPersoAngle(); float GetPersoAngle();
void StartMusic(); void StartMusic();
void StartPauseMusic(PauseType pause);
void ClearInterface(); void ClearInterface();
void ChangeColor(); void ChangeColor();
@ -391,14 +397,11 @@ protected:
void CreateScene(bool soluce, bool fixScene, bool resetObject); void CreateScene(bool soluce, bool fixScene, bool resetObject);
Math::Vector LookatPoint(Math::Vector eye, float angleH, float angleV, float length); Math::Vector LookatPoint(Math::Vector eye, float angleH, float angleV, float length);
CObject* CreateObject(Math::Vector pos, float angle, float zoom,
float height, ObjectType type, float power=1.0f,
bool trainer=false, bool toy=false, int option=0);
int CreateLight(Math::Vector direction, Gfx::Color color); int CreateLight(Math::Vector direction, Gfx::Color color);
void HiliteClear(); void HiliteClear();
void HiliteObject(Math::Point pos); void HiliteObject(Math::Point pos);
void HiliteFrame(float rTime); void HiliteFrame(float rTime);
void CreateTooltip(Math::Point pos, const char* text); void CreateTooltip(Math::Point pos, const std::string& text);
void ClearTooltip(); void ClearTooltip();
CObject* DetectObject(Math::Point pos); CObject* DetectObject(Math::Point pos);
void ChangeCamera(); void ChangeCamera();
@ -440,6 +443,7 @@ protected:
Ui::CDisplayText* m_displayText; Ui::CDisplayText* m_displayText;
Ui::CDisplayInfo* m_displayInfo; Ui::CDisplayInfo* m_displayInfo;
CSoundInterface* m_sound; CSoundInterface* m_sound;
CPauseManager* m_pause;
//! Bindings for user inputs //! Bindings for user inputs
InputBinding m_inputBindings[INPUT_SLOT_MAX]; InputBinding m_inputBindings[INPUT_SLOT_MAX];
@ -471,15 +475,19 @@ protected:
bool m_showSoluce; bool m_showSoluce;
bool m_showAll; bool m_showAll;
bool m_cheatRadar; bool m_cheatRadar;
bool m_audioRepeat;
bool m_shortCut; bool m_shortCut;
std::string m_audioTrack; std::string m_audioTrack;
bool m_audioRepeat;
std::string m_satcomTrack;
bool m_satcomRepeat;
std::string m_editorTrack;
bool m_editorRepeat;
int m_delayWriteMessage; int m_delayWriteMessage;
int m_movieInfoIndex; int m_movieInfoIndex;
CObject* m_controller; CObject* m_controller;
//Level Checker flags // Level Checker flags
bool m_beginObject; bool m_beginObject;
bool m_terrainGenerate; bool m_terrainGenerate;
bool m_terrainInitTextures; bool m_terrainInitTextures;
@ -495,7 +503,6 @@ protected:
bool m_satComLock; // call of SatCom is possible? bool m_satComLock; // call of SatCom is possible?
bool m_editLock; // edition in progress? bool m_editLock; // edition in progress?
bool m_editFull; // edition in full screen? bool m_editFull; // edition in full screen?
bool m_pause; // simulation paused
bool m_hilite; bool m_hilite;
bool m_trainerPilot; // remote trainer? bool m_trainerPilot; // remote trainer?
bool m_suspend; bool m_suspend;
@ -506,7 +513,7 @@ protected:
char m_mapFilename[100]; char m_mapFilename[100];
Math::Point m_tooltipPos; Math::Point m_tooltipPos;
char m_tooltipName[100]; std::string m_tooltipName;
float m_tooltipTime; float m_tooltipTime;
char m_infoFilename[SATCOM_MAX][100]; // names of text files char m_infoFilename[SATCOM_MAX][100]; // names of text files
@ -522,6 +529,8 @@ protected:
int m_endingWinRank; int m_endingWinRank;
int m_endingLostRank; int m_endingLostRank;
bool m_winTerminate; bool m_winTerminate;
bool m_exitAfterMission;
float m_fontSize; float m_fontSize;
Math::Point m_windowPos; Math::Point m_windowPos;

View File

@ -100,6 +100,7 @@ bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle)
if ( m_type == OBJECT_PARA ) m_buildingHeight = 68.0f; if ( m_type == OBJECT_PARA ) m_buildingHeight = 68.0f;
if ( m_type == OBJECT_INFO ) m_buildingHeight = 19.0f; if ( m_type == OBJECT_INFO ) m_buildingHeight = 19.0f;
if ( m_type == OBJECT_DESTROYER) m_buildingHeight = 35.0f; if ( m_type == OBJECT_DESTROYER) m_buildingHeight = 35.0f;
if ( m_type == OBJECT_HUSTON ) m_buildingHeight = 45.0f;
m_buildingHeight *= 0.25f; m_buildingHeight *= 0.25f;
m_buildingPos = m_building->GetPosition(0); m_buildingPos = m_building->GetPosition(0);
@ -574,7 +575,7 @@ Error CTaskBuild::FlatFloor()
if ( m_type == OBJECT_PARA ) radius = 20.0f; if ( m_type == OBJECT_PARA ) radius = 20.0f;
if ( m_type == OBJECT_INFO ) radius = 5.0f; if ( m_type == OBJECT_INFO ) radius = 5.0f;
if ( m_type == OBJECT_DESTROYER) radius = 20.0f; if ( m_type == OBJECT_DESTROYER) radius = 20.0f;
if ( radius == 0.0f ) return ERR_GENERIC; //if ( radius == 0.0f ) return ERR_GENERIC;
center = m_metal->GetPosition(0); center = m_metal->GetPosition(0);
angle = m_terrain->GetFineSlope(center); angle = m_terrain->GetFineSlope(center);

View File

@ -1559,8 +1559,8 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
oType == OBJECT_BOMB || oType == OBJECT_BOMB ||
(oType >= OBJECT_PLANT0 && (oType >= OBJECT_PLANT0 &&
oType <= OBJECT_PLANT19 ) || oType <= OBJECT_PLANT19 ) ||
(oType >= OBJECT_MUSHROOM0 && (oType >= OBJECT_MUSHROOM1 &&
oType <= OBJECT_MUSHROOM9 ) ) continue; oType <= OBJECT_MUSHROOM2 ) ) continue;
} }
addi = add; addi = add;

View File

@ -26,6 +26,7 @@
CTaskGunGoal::CTaskGunGoal(CObject* object) : CTask(object) CTaskGunGoal::CTaskGunGoal(CObject* object) : CTask(object)
{ {
m_aimImpossible = false;
} }
// Object's destructor. // Object's destructor.
@ -116,6 +117,12 @@ Error CTaskGunGoal::Start(float dirV, float dirH)
m_progress = 0.0f; m_progress = 0.0f;
// direction was constrainted, hence resulting in impossible move
if (dirV != m_finalDirV || dirH != m_finalDirH)
{
m_aimImpossible = true;
}
return ERR_OK; return ERR_OK;
} }
@ -126,12 +133,25 @@ Error CTaskGunGoal::IsEnded()
if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_initialDirV == m_finalDirV && if ( m_initialDirV == m_finalDirV &&
m_initialDirH == m_finalDirH ) return ERR_STOP; m_initialDirH == m_finalDirH )
if ( m_progress < 1.0f ) return ERR_CONTINUE; {
if ( m_aimImpossible )
return ERR_AIM_IMPOSSIBLE;
else
return ERR_STOP;
}
if ( m_progress < 1.0f ) return ERR_CONTINUE;
m_object->SetGunGoalV(m_finalDirV); m_object->SetGunGoalV(m_finalDirV);
m_object->SetGunGoalH(m_finalDirH); m_object->SetGunGoalH(m_finalDirH);
Abort(); Abort();
if ( m_aimImpossible )
{
return ERR_AIM_IMPOSSIBLE;
}
return ERR_STOP; return ERR_STOP;
} }

View File

@ -44,5 +44,7 @@ protected:
float m_finalDirV; // direction to reach float m_finalDirV; // direction to reach
float m_initialDirH; // initial direction float m_initialDirH; // initial direction
float m_finalDirH; // direction to reach float m_finalDirH; // direction to reach
bool m_aimImpossible; // set to true if impossible aim was set
}; };

View File

@ -105,9 +105,11 @@ bool CTaskRecover::EventProcess(const Event &event)
if ( power != 0 ) if ( power != 0 )
{ {
energy = power->GetEnergy(); energy = power->GetEnergy();
power->SetEnergy(energy-ENERGY_RECOVER*event.rTime*m_speed); energy -= event.rTime * ENERGY_RECOVER / power->GetCapacity() * m_speed;
power->SetEnergy(energy);
} }
speed.x = (Math::Rand()-0.5f)*0.1f*m_progress; speed.x = (Math::Rand()-0.5f)*0.1f*m_progress;
speed.y = (Math::Rand()-0.5f)*0.1f*m_progress; speed.y = (Math::Rand()-0.5f)*0.1f*m_progress;
speed.z = (Math::Rand()-0.5f)*0.1f*m_progress; speed.z = (Math::Rand()-0.5f)*0.1f*m_progress;

View File

@ -76,15 +76,9 @@ bool CTaskTerraform::EventProcess(const Event &event)
{ {
if ( m_soundChannel == -1 ) if ( m_soundChannel == -1 )
{ {
#if _TEEN
m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 1.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP);
#else
m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true); m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 4.0f, SOPER_CONTINUE); m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 4.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP); m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP);
#endif
} }
dir.x = 0.0f; dir.x = 0.0f;
@ -109,11 +103,7 @@ bool CTaskTerraform::EventProcess(const Event &event)
if ( m_phase == TTP_DOWN ) if ( m_phase == TTP_DOWN )
{ {
pos.x = 9.0f; pos.x = 9.0f;
#if _TEEN
pos.y = 4.0f-m_progress*4.0f;
#else
pos.y = 4.0f-m_progress*5.8f; pos.y = 4.0f-m_progress*5.8f;
#endif
pos.z = 0.0f; pos.z = 0.0f;
m_object->SetPosition(2, pos); m_object->SetPosition(2, pos);
} }
@ -121,11 +111,7 @@ bool CTaskTerraform::EventProcess(const Event &event)
if ( m_phase == TTP_UP ) if ( m_phase == TTP_UP )
{ {
pos.x = 9.0f; pos.x = 9.0f;
#if _TEEN
pos.y = 4.0f-(1.0f-m_progress)*4.0f;
#else
pos.y = 4.0f-(1.0f-m_progress)*5.8f; pos.y = 4.0f-(1.0f-m_progress)*5.8f;
#endif
pos.z = 0.0f; pos.z = 0.0f;
m_object->SetPosition(2, pos); m_object->SetPosition(2, pos);
} }
@ -230,11 +216,7 @@ Error CTaskTerraform::Start()
m_phase = TTP_CHARGE; m_phase = TTP_CHARGE;
m_progress = 0.0f; m_progress = 0.0f;
#if _TEEN
m_speed = 1.0f/1.5f;
#else
m_speed = 1.0f/4.0f; m_speed = 1.0f/4.0f;
#endif
m_time = 0.0f; m_time = 0.0f;
m_bError = false; // ok m_bError = false; // ok
@ -261,9 +243,6 @@ Error CTaskTerraform::IsEnded()
if ( m_phase == TTP_CHARGE ) if ( m_phase == TTP_CHARGE )
{ {
#if _TEEN
Terraform(); // changes the terrain.
#endif
m_phase = TTP_DOWN; m_phase = TTP_DOWN;
m_speed = 1.0f/0.2f; m_speed = 1.0f/0.2f;
@ -272,9 +251,7 @@ Error CTaskTerraform::IsEnded()
if ( m_phase == TTP_DOWN ) if ( m_phase == TTP_DOWN )
{ {
#if !_TEEN
Terraform(); // changes the terrain. Terraform(); // changes the terrain.
#endif
m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f));
m_object->SetZoom(0, 1.0f); m_object->SetZoom(0, 1.0f);

View File

@ -107,6 +107,9 @@ CPhysics::CPhysics(CObject* object)
m_bFreeze = false; m_bFreeze = false;
m_bForceUpdate = true; m_bForceUpdate = true;
m_bLowLevel = false; m_bLowLevel = false;
m_fallingHeight = 0.0f;
m_minFallingHeight = 20.0f;
m_fallDamageFraction = 0.007f;
memset(&m_linMotion, 0, sizeof(Motion)); memset(&m_linMotion, 0, sizeof(Motion));
memset(&m_cirMotion, 0,sizeof(Motion)); memset(&m_cirMotion, 0,sizeof(Motion));
@ -786,6 +789,10 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
type = m_object->GetType(); type = m_object->GetType();
if(std::isnan(m_motorSpeed.x)) m_motorSpeed.x = 0.f;
if(std::isnan(m_motorSpeed.y)) m_motorSpeed.y = 0.f;
if(std::isnan(m_motorSpeed.z)) m_motorSpeed.z = 0.f;
motorSpeed = m_motorSpeed; motorSpeed = m_motorSpeed;
if ( type == OBJECT_MOTHER || if ( type == OBJECT_MOTHER ||
@ -847,6 +854,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
else else
{ {
motorSpeed.y = -1.0f; // grave motorSpeed.y = -1.0f; // grave
SetFalling();
} }
SetMotor(false); SetMotor(false);
} }
@ -911,6 +919,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
if ( m_reactorRange == 0.0f ) // reactor tilt? if ( m_reactorRange == 0.0f ) // reactor tilt?
{ {
motorSpeed.y = -1.0f; // grave motorSpeed.y = -1.0f; // grave
SetFalling();
} }
} }
@ -1509,6 +1518,7 @@ bool CPhysics::EventFrame(const Event &event)
if ( pos.y < m_water->GetLevel(m_object) ) // underwater? if ( pos.y < m_water->GetLevel(m_object) ) // underwater?
{ {
h *= 0.5f; h *= 0.5f;
m_fallingHeight = 0.0f; // can't fall underwater
} }
#endif #endif
//? m_linMotion.terrainSpeed.x = -tAngle.z*m_linMotion.terrainForce.x*h; //? m_linMotion.terrainSpeed.x = -tAngle.z*m_linMotion.terrainForce.x*h;
@ -1601,6 +1611,13 @@ bool CPhysics::EventFrame(const Event &event)
MotorParticle(m_time, event.rTime); MotorParticle(m_time, event.rTime);
SoundMotor(event.rTime); SoundMotor(event.rTime);
if ( m_bLand && m_fallingHeight != 0.0f ) // if fell
{
float force = (m_fallingHeight - m_object->GetPosition(0).y) * m_fallDamageFraction;
m_object->ExploObject(EXPLO_BOUM, force);
m_fallingHeight = 0.0f;
}
m_bForceUpdate = false; m_bForceUpdate = false;
return true; return true;
@ -2561,19 +2578,13 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
oType == OBJECT_KEYd || oType == OBJECT_KEYd ||
oType == OBJECT_TNT || oType == OBJECT_TNT ||
(oType >= OBJECT_PLANT0 && oType <= OBJECT_PLANT19 ) || (oType >= OBJECT_PLANT0 && oType <= OBJECT_PLANT19 ) ||
(oType >= OBJECT_MUSHROOM0 && oType <= OBJECT_MUSHROOM9) ) continue; (oType >= OBJECT_MUSHROOM1 && oType <= OBJECT_MUSHROOM2) ) continue;
} }
#if _TEEN
if ( oType == OBJECT_WAYPOINT &&
pObj->GetEnable() &&
!m_object->GetResetBusy() ) // driving vehicle?
#else
if ( oType == OBJECT_WAYPOINT && if ( oType == OBJECT_WAYPOINT &&
pObj->GetEnable() && pObj->GetEnable() &&
!m_object->GetResetBusy() && !m_object->GetResetBusy() &&
m_object->GetTrainer() ) // driving vehicle? m_object->GetTrainer() ) // driving vehicle?
#endif
{ {
oPos = pObj->GetPosition(0); oPos = pObj->GetPosition(0);
distance = Math::DistanceProjected(oPos, iPos); distance = Math::DistanceProjected(oPos, iPos);
@ -2979,15 +2990,15 @@ void CPhysics::FrameParticle(float aTime, float rTime)
{ {
Math::Vector pos; Math::Vector pos;
CObject* power; CObject* power;
float energy, intensity; float energy/*, intensity*/;
int effectLight; int effectLight;
bool bFlash; //bool bFlash;
m_restBreakParticle -= rTime; m_restBreakParticle -= rTime;
if ( aTime-m_lastPowerParticle < m_engine->ParticleAdapt(0.05f) ) return; if ( aTime-m_lastPowerParticle < m_engine->ParticleAdapt(0.05f) ) return;
m_lastPowerParticle = aTime; m_lastPowerParticle = aTime;
bFlash = false; //bFlash = false;
energy = 0.0f; energy = 0.0f;
power = m_object->GetPower(); power = m_object->GetPower();
@ -3001,7 +3012,7 @@ void CPhysics::FrameParticle(float aTime, float rTime)
if ( energy > m_lastEnergy ) // recharge? if ( energy > m_lastEnergy ) // recharge?
{ {
PowerParticle(1.0f, false); PowerParticle(1.0f, false);
bFlash = true; //bFlash = true;
} }
if ( energy == 0.0f || m_lastEnergy == 0.0f ) if ( energy == 0.0f || m_lastEnergy == 0.0f )
@ -3015,7 +3026,7 @@ void CPhysics::FrameParticle(float aTime, float rTime)
if ( m_restBreakParticle > 0.0f ) if ( m_restBreakParticle > 0.0f )
{ {
PowerParticle(m_restBreakParticle/2.5f, (energy == 0)); PowerParticle(m_restBreakParticle/2.5f, (energy == 0));
bFlash = true; //bFlash = true;
} }
effectLight = m_object->GetEffectLight(); effectLight = m_object->GetEffectLight();
@ -3881,3 +3892,36 @@ Error CPhysics::GetError()
return ERR_OK; return ERR_OK;
} }
void CPhysics::SetFalling()
{
if (m_fallingHeight == 0.0f && m_floorHeight >= m_minFallingHeight)
m_fallingHeight = m_object->GetPosition(0).y;
}
float CPhysics::GetFallingHeight()
{
return m_fallingHeight;
}
void CPhysics::SetMinFallingHeight(float value)
{
if (value < 0.0f) return;
m_minFallingHeight = value;
}
float CPhysics::GetMinFallingHeight()
{
return m_minFallingHeight;
}
void CPhysics::SetFallDamageFraction(float value)
{
if (value < 0.0f) return;
m_fallDamageFraction = value;
}
float CPhysics::GetFallDamageFraction()
{
return m_fallDamageFraction;
}

View File

@ -165,6 +165,14 @@ public:
void CreateInterface(bool bSelect); void CreateInterface(bool bSelect);
Error GetError(); Error GetError();
float GetFallingHeight();
void SetMinFallingHeight(float value);
float GetMinFallingHeight();
void SetFallDamageFraction(float value);
float GetFallDamageFraction();
protected: protected:
bool EventFrame(const Event &event); bool EventFrame(const Event &event);
void WaterFrame(float aTime, float rTime); void WaterFrame(float aTime, float rTime);
@ -191,6 +199,7 @@ protected:
void MotorParticle(float aTime, float rTime); void MotorParticle(float aTime, float rTime);
void WaterParticle(float aTime, Math::Vector pos, ObjectType type, float floor, float advance, float turn); void WaterParticle(float aTime, Math::Vector pos, ObjectType type, float floor, float advance, float turn);
void WheelParticle(int color, float width); void WheelParticle(int color, float width);
void SetFalling();
protected: protected:
Gfx::CEngine* m_engine; Gfx::CEngine* m_engine;
@ -240,13 +249,16 @@ protected:
float m_restBreakParticle; float m_restBreakParticle;
float m_floorLevel; // ground level float m_floorLevel; // ground level
float m_floorHeight; // height above the ground float m_floorHeight; // height above the ground
int m_soundChannel; int m_soundChannel;
int m_soundChannelSlide; int m_soundChannelSlide;
float m_soundTimePshhh; float m_soundTimePshhh;
float m_soundTimeJostle; float m_soundTimeJostle;
float m_soundTimeBoum; float m_soundTimeBoum;
bool m_bSoundSlow; bool m_bSoundSlow;
bool m_bForceUpdate; bool m_bForceUpdate;
bool m_bLowLevel; bool m_bLowLevel;
float m_fallingHeight;
float m_fallDamageFraction;
float m_minFallingHeight;
}; };

View File

@ -253,10 +253,11 @@ std::string GetHelpFilename(const char *token)
if ( strcmp(token, "getresearchenable" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/getresen.txt"); if ( strcmp(token, "getresearchenable" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/getresen.txt");
if ( strcmp(token, "getresearchdone" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/getresdo.txt"); if ( strcmp(token, "getresearchdone" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/getresdo.txt");
if ( strcmp(token, "retobject" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/retobj.txt"); if ( strcmp(token, "retobject" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/retobj.txt");
if ( strcmp(token, "progfunc" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/factory.txt"); if ( strcmp(token, "progfunc" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/factory.txt");
if ( strcmp(token, "busy" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/busy.txt"); if ( strcmp(token, "busy" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/busy.txt");
if ( strcmp(token, "factory" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/factory.txt"); if ( strcmp(token, "takeoff" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/takeoff.txt");
if ( strcmp(token, "research" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/research.txt"); if ( strcmp(token, "research" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/research.txt");
if ( strcmp(token, "factory" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/factory.txt");
if ( strcmp(token, "destroy" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/destroy.txt"); if ( strcmp(token, "destroy" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/destroy.txt");
if ( strcmp(token, "search" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/search.txt"); if ( strcmp(token, "search" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/search.txt");
if ( strcmp(token, "radar" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/radar.txt"); if ( strcmp(token, "radar" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/radar.txt");
@ -333,6 +334,7 @@ std::string GetHelpFilename(const char *token)
if ( strcmp(token, "penup" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/penup.txt"); if ( strcmp(token, "penup" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/penup.txt");
if ( strcmp(token, "pencolor" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/pencolor.txt"); if ( strcmp(token, "pencolor" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/pencolor.txt");
if ( strcmp(token, "penwidth" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/penwidth.txt"); if ( strcmp(token, "penwidth" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/penwidth.txt");
if ( strcmp(token, "camerafocus" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/camerafocus.txt");
if ( strcmp(token, "extern" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/extern.txt"); if ( strcmp(token, "extern" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/extern.txt");
if ( strcmp(token, "class" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/class.txt"); if ( strcmp(token, "class" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/class.txt");
if ( strcmp(token, "static" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/static.txt"); if ( strcmp(token, "static" ) == 0 ) return std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("/cbot/static.txt");
@ -384,6 +386,7 @@ bool IsFunction(const char *token)
if ( strcmp(token, "busy" ) == 0 ) return true; if ( strcmp(token, "busy" ) == 0 ) return true;
if ( strcmp(token, "factory" ) == 0 ) return true; if ( strcmp(token, "factory" ) == 0 ) return true;
if ( strcmp(token, "research" ) == 0 ) return true; if ( strcmp(token, "research" ) == 0 ) return true;
if ( strcmp(token, "takeoff" ) == 0 ) return true;
if ( strcmp(token, "destroy" ) == 0 ) return true; if ( strcmp(token, "destroy" ) == 0 ) return true;
if ( strcmp(token, "search" ) == 0 ) return true; if ( strcmp(token, "search" ) == 0 ) return true;
if ( strcmp(token, "radar" ) == 0 ) return true; if ( strcmp(token, "radar" ) == 0 ) return true;
@ -439,6 +442,7 @@ bool IsFunction(const char *token)
if ( strcmp(token, "penup" ) == 0 ) return true; if ( strcmp(token, "penup" ) == 0 ) return true;
if ( strcmp(token, "pencolor" ) == 0 ) return true; if ( strcmp(token, "pencolor" ) == 0 ) return true;
if ( strcmp(token, "penwidth" ) == 0 ) return true; if ( strcmp(token, "penwidth" ) == 0 ) return true;
if ( strcmp(token, "camerafocus" ) == 0 ) return true;
if ( strcmp(token, "sizeof" ) == 0 ) return true; if ( strcmp(token, "sizeof" ) == 0 ) return true;
return false; return false;
} }
@ -477,6 +481,7 @@ const char* GetHelpText(const char *token)
if ( strcmp(token, "busy" ) == 0 ) return "object.busy ( );"; if ( strcmp(token, "busy" ) == 0 ) return "object.busy ( );";
if ( strcmp(token, "factory" ) == 0 ) return "object.factory ( cat, program );"; if ( strcmp(token, "factory" ) == 0 ) return "object.factory ( cat, program );";
if ( strcmp(token, "research" ) == 0 ) return "object.research ( type );"; if ( strcmp(token, "research" ) == 0 ) return "object.research ( type );";
if ( strcmp(token, "takeoff" ) == 0 ) return "object.takeoff ( );";
if ( strcmp(token, "destroy" ) == 0 ) return "object.destroy ( );"; if ( strcmp(token, "destroy" ) == 0 ) return "object.destroy ( );";
if ( strcmp(token, "search" ) == 0 ) return "search ( );"; if ( strcmp(token, "search" ) == 0 ) return "search ( );";
if ( strcmp(token, "radar" ) == 0 ) return "radar ( cat, angle, focus, min, max, sens );"; if ( strcmp(token, "radar" ) == 0 ) return "radar ( cat, angle, focus, min, max, sens );";
@ -532,6 +537,7 @@ const char* GetHelpText(const char *token)
if ( strcmp(token, "penup" ) == 0 ) return "penup ( );"; if ( strcmp(token, "penup" ) == 0 ) return "penup ( );";
if ( strcmp(token, "pencolor" ) == 0 ) return "pencolor ( color );"; if ( strcmp(token, "pencolor" ) == 0 ) return "pencolor ( color );";
if ( strcmp(token, "penwidth" ) == 0 ) return "penwidth ( width );"; if ( strcmp(token, "penwidth" ) == 0 ) return "penwidth ( width );";
if ( strcmp(token, "camerafocus") == 0 ) return "camerafocus ( object );";
return ""; return "";
} }

View File

@ -35,6 +35,16 @@ char* SkipSpace(char *line)
return line; return line;
} }
std::string GetCmd(char* line)
{
line = SkipSpace(line);
int len = 0;
for(char* x = line; *x != 0 && *x != ' ' && *x != '\t' && *x != '\n'; x++, len++);
return std::string(line, len);
}
// Checks if a line contains a command. // Checks if a line contains a command.
bool Cmd(char *line, const char *token) bool Cmd(char *line, const char *token)
@ -42,8 +52,15 @@ bool Cmd(char *line, const char *token)
char* p; char* p;
line = SkipSpace(line); line = SkipSpace(line);
p = strstr(line, token); p = strstr(line, token);
return ( p == line ); // command at the beginning? if(p != line) return false; // command at the beginning?
unsigned int len = 0;
for(char* x = p; *x != 0 && *x != ' ' && *x != '\t' && *x != '\n'; x++, len++);
if(len != strlen(token)) return false; // ends with space?
return true;
} }
// Seeking an operator. // Seeking an operator.
@ -238,16 +255,6 @@ ObjectType GetTypeObject(char *line, int rank, ObjectType def)
if ( Cmd(p, "Mine" ) ) return OBJECT_BOMB; if ( Cmd(p, "Mine" ) ) return OBJECT_BOMB;
if ( Cmd(p, "Firework" ) ) return OBJECT_WINFIRE; if ( Cmd(p, "Firework" ) ) return OBJECT_WINFIRE;
if ( Cmd(p, "Bag" ) ) return OBJECT_BAG; if ( Cmd(p, "Bag" ) ) return OBJECT_BAG;
if ( Cmd(p, "Greenery10" ) ) return OBJECT_PLANT10;
if ( Cmd(p, "Greenery11" ) ) return OBJECT_PLANT11;
if ( Cmd(p, "Greenery12" ) ) return OBJECT_PLANT12;
if ( Cmd(p, "Greenery13" ) ) return OBJECT_PLANT13;
if ( Cmd(p, "Greenery14" ) ) return OBJECT_PLANT14;
if ( Cmd(p, "Greenery15" ) ) return OBJECT_PLANT15;
if ( Cmd(p, "Greenery16" ) ) return OBJECT_PLANT16;
if ( Cmd(p, "Greenery17" ) ) return OBJECT_PLANT17;
if ( Cmd(p, "Greenery18" ) ) return OBJECT_PLANT18;
if ( Cmd(p, "Greenery19" ) ) return OBJECT_PLANT19;
if ( Cmd(p, "Greenery0" ) ) return OBJECT_PLANT0; if ( Cmd(p, "Greenery0" ) ) return OBJECT_PLANT0;
if ( Cmd(p, "Greenery1" ) ) return OBJECT_PLANT1; if ( Cmd(p, "Greenery1" ) ) return OBJECT_PLANT1;
if ( Cmd(p, "Greenery2" ) ) return OBJECT_PLANT2; if ( Cmd(p, "Greenery2" ) ) return OBJECT_PLANT2;
@ -258,26 +265,24 @@ ObjectType GetTypeObject(char *line, int rank, ObjectType def)
if ( Cmd(p, "Greenery7" ) ) return OBJECT_PLANT7; if ( Cmd(p, "Greenery7" ) ) return OBJECT_PLANT7;
if ( Cmd(p, "Greenery8" ) ) return OBJECT_PLANT8; if ( Cmd(p, "Greenery8" ) ) return OBJECT_PLANT8;
if ( Cmd(p, "Greenery9" ) ) return OBJECT_PLANT9; if ( Cmd(p, "Greenery9" ) ) return OBJECT_PLANT9;
if ( Cmd(p, "Greenery10" ) ) return OBJECT_PLANT10;
if ( Cmd(p, "Greenery11" ) ) return OBJECT_PLANT11;
if ( Cmd(p, "Greenery12" ) ) return OBJECT_PLANT12;
if ( Cmd(p, "Greenery13" ) ) return OBJECT_PLANT13;
if ( Cmd(p, "Greenery14" ) ) return OBJECT_PLANT14;
if ( Cmd(p, "Greenery15" ) ) return OBJECT_PLANT15;
if ( Cmd(p, "Greenery16" ) ) return OBJECT_PLANT16;
if ( Cmd(p, "Greenery17" ) ) return OBJECT_PLANT17;
if ( Cmd(p, "Greenery18" ) ) return OBJECT_PLANT18;
if ( Cmd(p, "Greenery19" ) ) return OBJECT_PLANT19;
if ( Cmd(p, "Tree0" ) ) return OBJECT_TREE0; if ( Cmd(p, "Tree0" ) ) return OBJECT_TREE0;
if ( Cmd(p, "Tree1" ) ) return OBJECT_TREE1; if ( Cmd(p, "Tree1" ) ) return OBJECT_TREE1;
if ( Cmd(p, "Tree2" ) ) return OBJECT_TREE2; if ( Cmd(p, "Tree2" ) ) return OBJECT_TREE2;
if ( Cmd(p, "Tree3" ) ) return OBJECT_TREE3; if ( Cmd(p, "Tree3" ) ) return OBJECT_TREE3;
if ( Cmd(p, "Tree4" ) ) return OBJECT_TREE4; if ( Cmd(p, "Tree4" ) ) return OBJECT_TREE4;
if ( Cmd(p, "Tree5" ) ) return OBJECT_TREE5; if ( Cmd(p, "Tree5" ) ) return OBJECT_TREE5;
if ( Cmd(p, "Tree6" ) ) return OBJECT_TREE6;
if ( Cmd(p, "Tree7" ) ) return OBJECT_TREE7;
if ( Cmd(p, "Tree8" ) ) return OBJECT_TREE8;
if ( Cmd(p, "Tree9" ) ) return OBJECT_TREE9;
if ( Cmd(p, "Mushroom0" ) ) return OBJECT_MUSHROOM0;
if ( Cmd(p, "Mushroom1" ) ) return OBJECT_MUSHROOM1; if ( Cmd(p, "Mushroom1" ) ) return OBJECT_MUSHROOM1;
if ( Cmd(p, "Mushroom2" ) ) return OBJECT_MUSHROOM2; if ( Cmd(p, "Mushroom2" ) ) return OBJECT_MUSHROOM2;
if ( Cmd(p, "Mushroom3" ) ) return OBJECT_MUSHROOM3;
if ( Cmd(p, "Mushroom4" ) ) return OBJECT_MUSHROOM4;
if ( Cmd(p, "Mushroom5" ) ) return OBJECT_MUSHROOM5;
if ( Cmd(p, "Mushroom6" ) ) return OBJECT_MUSHROOM6;
if ( Cmd(p, "Mushroom7" ) ) return OBJECT_MUSHROOM7;
if ( Cmd(p, "Mushroom8" ) ) return OBJECT_MUSHROOM8;
if ( Cmd(p, "Mushroom9" ) ) return OBJECT_MUSHROOM9;
if ( Cmd(p, "Home" ) ) return OBJECT_HOME1; if ( Cmd(p, "Home" ) ) return OBJECT_HOME1;
if ( Cmd(p, "Derrick" ) ) return OBJECT_DERRICK; if ( Cmd(p, "Derrick" ) ) return OBJECT_DERRICK;
if ( Cmd(p, "BotFactory" ) ) return OBJECT_FACTORY; if ( Cmd(p, "BotFactory" ) ) return OBJECT_FACTORY;
@ -323,47 +328,6 @@ ObjectType GetTypeObject(char *line, int rank, ObjectType def)
if ( Cmd(p, "Barrier1" ) ) return OBJECT_BARRIER1; if ( Cmd(p, "Barrier1" ) ) return OBJECT_BARRIER1;
if ( Cmd(p, "Barrier2" ) ) return OBJECT_BARRIER2; if ( Cmd(p, "Barrier2" ) ) return OBJECT_BARRIER2;
if ( Cmd(p, "Barrier3" ) ) return OBJECT_BARRIER3; if ( Cmd(p, "Barrier3" ) ) return OBJECT_BARRIER3;
if ( Cmd(p, "Barrier4" ) ) return OBJECT_BARRIER4;
if ( Cmd(p, "Teen40" ) ) return OBJECT_TEEN40;
if ( Cmd(p, "Teen41" ) ) return OBJECT_TEEN41;
if ( Cmd(p, "Teen42" ) ) return OBJECT_TEEN42;
if ( Cmd(p, "Teen43" ) ) return OBJECT_TEEN43;
if ( Cmd(p, "Teen44" ) ) return OBJECT_TEEN44;
if ( Cmd(p, "Teen45" ) ) return OBJECT_TEEN45;
if ( Cmd(p, "Teen46" ) ) return OBJECT_TEEN46;
if ( Cmd(p, "Teen47" ) ) return OBJECT_TEEN47;
if ( Cmd(p, "Teen48" ) ) return OBJECT_TEEN48;
if ( Cmd(p, "Teen49" ) ) return OBJECT_TEEN49;
if ( Cmd(p, "Teen30" ) ) return OBJECT_TEEN30;
if ( Cmd(p, "Teen31" ) ) return OBJECT_TEEN31;
if ( Cmd(p, "Teen32" ) ) return OBJECT_TEEN32;
if ( Cmd(p, "Teen33" ) ) return OBJECT_TEEN33;
if ( Cmd(p, "Stone" ) ) return OBJECT_TEEN34;
if ( Cmd(p, "Teen35" ) ) return OBJECT_TEEN35;
if ( Cmd(p, "Teen36" ) ) return OBJECT_TEEN36;
if ( Cmd(p, "Teen37" ) ) return OBJECT_TEEN37;
if ( Cmd(p, "Teen38" ) ) return OBJECT_TEEN38;
if ( Cmd(p, "Teen39" ) ) return OBJECT_TEEN39;
if ( Cmd(p, "Teen20" ) ) return OBJECT_TEEN20;
if ( Cmd(p, "Teen21" ) ) return OBJECT_TEEN21;
if ( Cmd(p, "Teen22" ) ) return OBJECT_TEEN22;
if ( Cmd(p, "Teen23" ) ) return OBJECT_TEEN23;
if ( Cmd(p, "Teen24" ) ) return OBJECT_TEEN24;
if ( Cmd(p, "Teen25" ) ) return OBJECT_TEEN25;
if ( Cmd(p, "Teen26" ) ) return OBJECT_TEEN26;
if ( Cmd(p, "Teen27" ) ) return OBJECT_TEEN27;
if ( Cmd(p, "Teen28" ) ) return OBJECT_TEEN28;
if ( Cmd(p, "Teen29" ) ) return OBJECT_TEEN29;
if ( Cmd(p, "Teen10" ) ) return OBJECT_TEEN10;
if ( Cmd(p, "Teen11" ) ) return OBJECT_TEEN11;
if ( Cmd(p, "Teen12" ) ) return OBJECT_TEEN12;
if ( Cmd(p, "Teen13" ) ) return OBJECT_TEEN13;
if ( Cmd(p, "Teen14" ) ) return OBJECT_TEEN14;
if ( Cmd(p, "Teen15" ) ) return OBJECT_TEEN15;
if ( Cmd(p, "Teen16" ) ) return OBJECT_TEEN16;
if ( Cmd(p, "Teen17" ) ) return OBJECT_TEEN17;
if ( Cmd(p, "Teen18" ) ) return OBJECT_TEEN18;
if ( Cmd(p, "Teen19" ) ) return OBJECT_TEEN19;
if ( Cmd(p, "Teen0" ) ) return OBJECT_TEEN0; if ( Cmd(p, "Teen0" ) ) return OBJECT_TEEN0;
if ( Cmd(p, "Teen1" ) ) return OBJECT_TEEN1; if ( Cmd(p, "Teen1" ) ) return OBJECT_TEEN1;
if ( Cmd(p, "Teen2" ) ) return OBJECT_TEEN2; if ( Cmd(p, "Teen2" ) ) return OBJECT_TEEN2;
@ -374,26 +338,51 @@ ObjectType GetTypeObject(char *line, int rank, ObjectType def)
if ( Cmd(p, "Teen7" ) ) return OBJECT_TEEN7; if ( Cmd(p, "Teen7" ) ) return OBJECT_TEEN7;
if ( Cmd(p, "Teen8" ) ) return OBJECT_TEEN8; if ( Cmd(p, "Teen8" ) ) return OBJECT_TEEN8;
if ( Cmd(p, "Teen9" ) ) return OBJECT_TEEN9; if ( Cmd(p, "Teen9" ) ) return OBJECT_TEEN9;
if ( Cmd(p, "Teen10" ) ) return OBJECT_TEEN10;
if ( Cmd(p, "Teen11" ) ) return OBJECT_TEEN11;
if ( Cmd(p, "Teen12" ) ) return OBJECT_TEEN12;
if ( Cmd(p, "Teen13" ) ) return OBJECT_TEEN13;
if ( Cmd(p, "Teen14" ) ) return OBJECT_TEEN14;
if ( Cmd(p, "Teen15" ) ) return OBJECT_TEEN15;
if ( Cmd(p, "Teen16" ) ) return OBJECT_TEEN16;
if ( Cmd(p, "Teen17" ) ) return OBJECT_TEEN17;
if ( Cmd(p, "Teen18" ) ) return OBJECT_TEEN18;
if ( Cmd(p, "Teen19" ) ) return OBJECT_TEEN19;
if ( Cmd(p, "Teen20" ) ) return OBJECT_TEEN20;
if ( Cmd(p, "Teen21" ) ) return OBJECT_TEEN21;
if ( Cmd(p, "Teen22" ) ) return OBJECT_TEEN22;
if ( Cmd(p, "Teen23" ) ) return OBJECT_TEEN23;
if ( Cmd(p, "Teen24" ) ) return OBJECT_TEEN24;
if ( Cmd(p, "Teen25" ) ) return OBJECT_TEEN25;
if ( Cmd(p, "Teen26" ) ) return OBJECT_TEEN26;
if ( Cmd(p, "Teen27" ) ) return OBJECT_TEEN27;
if ( Cmd(p, "Teen28" ) ) return OBJECT_TEEN28;
if ( Cmd(p, "Teen29" ) ) return OBJECT_TEEN29;
if ( Cmd(p, "Teen30" ) ) return OBJECT_TEEN30;
if ( Cmd(p, "Teen31" ) ) return OBJECT_TEEN31;
if ( Cmd(p, "Teen32" ) ) return OBJECT_TEEN32;
if ( Cmd(p, "Teen33" ) ) return OBJECT_TEEN33;
if ( Cmd(p, "Stone" ) ) return OBJECT_TEEN34;
if ( Cmd(p, "Teen35" ) ) return OBJECT_TEEN35;
if ( Cmd(p, "Teen36" ) ) return OBJECT_TEEN36;
if ( Cmd(p, "Teen37" ) ) return OBJECT_TEEN37;
if ( Cmd(p, "Teen38" ) ) return OBJECT_TEEN38;
if ( Cmd(p, "Teen39" ) ) return OBJECT_TEEN39;
if ( Cmd(p, "Teen40" ) ) return OBJECT_TEEN40;
if ( Cmd(p, "Teen41" ) ) return OBJECT_TEEN41;
if ( Cmd(p, "Teen42" ) ) return OBJECT_TEEN42;
if ( Cmd(p, "Teen43" ) ) return OBJECT_TEEN43;
if ( Cmd(p, "Teen44" ) ) return OBJECT_TEEN44;
if ( Cmd(p, "Quartz0" ) ) return OBJECT_QUARTZ0; if ( Cmd(p, "Quartz0" ) ) return OBJECT_QUARTZ0;
if ( Cmd(p, "Quartz1" ) ) return OBJECT_QUARTZ1; if ( Cmd(p, "Quartz1" ) ) return OBJECT_QUARTZ1;
if ( Cmd(p, "Quartz2" ) ) return OBJECT_QUARTZ2; if ( Cmd(p, "Quartz2" ) ) return OBJECT_QUARTZ2;
if ( Cmd(p, "Quartz3" ) ) return OBJECT_QUARTZ3; if ( Cmd(p, "Quartz3" ) ) return OBJECT_QUARTZ3;
if ( Cmd(p, "Quartz4" ) ) return OBJECT_QUARTZ4;
if ( Cmd(p, "Quartz5" ) ) return OBJECT_QUARTZ5;
if ( Cmd(p, "Quartz6" ) ) return OBJECT_QUARTZ6;
if ( Cmd(p, "Quartz7" ) ) return OBJECT_QUARTZ7;
if ( Cmd(p, "Quartz8" ) ) return OBJECT_QUARTZ8;
if ( Cmd(p, "Quartz9" ) ) return OBJECT_QUARTZ9;
if ( Cmd(p, "MegaStalk0" ) ) return OBJECT_ROOT0; if ( Cmd(p, "MegaStalk0" ) ) return OBJECT_ROOT0;
if ( Cmd(p, "MegaStalk1" ) ) return OBJECT_ROOT1; if ( Cmd(p, "MegaStalk1" ) ) return OBJECT_ROOT1;
if ( Cmd(p, "MegaStalk2" ) ) return OBJECT_ROOT2; if ( Cmd(p, "MegaStalk2" ) ) return OBJECT_ROOT2;
if ( Cmd(p, "MegaStalk3" ) ) return OBJECT_ROOT3; if ( Cmd(p, "MegaStalk3" ) ) return OBJECT_ROOT3;
if ( Cmd(p, "MegaStalk4" ) ) return OBJECT_ROOT4; if ( Cmd(p, "MegaStalk4" ) ) return OBJECT_ROOT4;
if ( Cmd(p, "MegaStalk5" ) ) return OBJECT_ROOT5; if ( Cmd(p, "MegaStalk5" ) ) return OBJECT_ROOT5;
if ( Cmd(p, "MegaStalk6" ) ) return OBJECT_ROOT6;
if ( Cmd(p, "MegaStalk7" ) ) return OBJECT_ROOT7;
if ( Cmd(p, "MegaStalk8" ) ) return OBJECT_ROOT8;
if ( Cmd(p, "MegaStalk9" ) ) return OBJECT_ROOT9;
if ( Cmd(p, "ApolloLEM" ) ) return OBJECT_APOLLO1; if ( Cmd(p, "ApolloLEM" ) ) return OBJECT_APOLLO1;
if ( Cmd(p, "ApolloJeep" ) ) return OBJECT_APOLLO2; if ( Cmd(p, "ApolloJeep" ) ) return OBJECT_APOLLO2;
if ( Cmd(p, "ApolloFlag" ) ) return OBJECT_APOLLO3; if ( Cmd(p, "ApolloFlag" ) ) return OBJECT_APOLLO3;
@ -438,11 +427,7 @@ const char* GetTypeObject(ObjectType type)
if ( type == OBJECT_MOBILEdr ) return "Scribbler"; if ( type == OBJECT_MOBILEdr ) return "Scribbler";
if ( type == OBJECT_MARKPOWER ) return "PowerSpot"; if ( type == OBJECT_MARKPOWER ) return "PowerSpot";
if ( type == OBJECT_MARKSTONE ) return "TitaniumSpot"; if ( type == OBJECT_MARKSTONE ) return "TitaniumSpot";
#if _GERMAN | _WG
if ( type == OBJECT_MARKURANIUM ) return "PlatinumSpot";
#else
if ( type == OBJECT_MARKURANIUM ) return "UraniumSpot"; if ( type == OBJECT_MARKURANIUM ) return "UraniumSpot";
#endif
if ( type == OBJECT_MARKKEYa ) return "KeyASpot"; if ( type == OBJECT_MARKKEYa ) return "KeyASpot";
if ( type == OBJECT_MARKKEYb ) return "KeyBSpot"; if ( type == OBJECT_MARKKEYb ) return "KeyBSpot";
if ( type == OBJECT_MARKKEYc ) return "KeyCSpot"; if ( type == OBJECT_MARKKEYc ) return "KeyCSpot";
@ -454,17 +439,9 @@ const char* GetTypeObject(ObjectType type)
if ( type == OBJECT_FLAGy ) return "YellowFlag"; if ( type == OBJECT_FLAGy ) return "YellowFlag";
if ( type == OBJECT_FLAGv ) return "VioletFlag"; if ( type == OBJECT_FLAGv ) return "VioletFlag";
if ( type == OBJECT_POWER ) return "PowerCell"; if ( type == OBJECT_POWER ) return "PowerCell";
#if _GERMAN | _WG
if ( type == OBJECT_ATOMIC ) return "FuelCell";
#else
if ( type == OBJECT_ATOMIC ) return "NuclearCell"; if ( type == OBJECT_ATOMIC ) return "NuclearCell";
#endif
if ( type == OBJECT_STONE ) return "TitaniumOre"; if ( type == OBJECT_STONE ) return "TitaniumOre";
#if _GERMAN | _WG
if ( type == OBJECT_URANIUM ) return "PlatinumOre";
#else
if ( type == OBJECT_URANIUM ) return "UraniumOre"; if ( type == OBJECT_URANIUM ) return "UraniumOre";
#endif
if ( type == OBJECT_METAL ) return "Titanium"; if ( type == OBJECT_METAL ) return "Titanium";
if ( type == OBJECT_BULLET ) return "OrgaMatter"; if ( type == OBJECT_BULLET ) return "OrgaMatter";
if ( type == OBJECT_BBOX ) return "BlackBox"; if ( type == OBJECT_BBOX ) return "BlackBox";
@ -507,20 +484,8 @@ const char* GetTypeObject(ObjectType type)
if ( type == OBJECT_TREE3 ) return "Tree3"; if ( type == OBJECT_TREE3 ) return "Tree3";
if ( type == OBJECT_TREE4 ) return "Tree4"; if ( type == OBJECT_TREE4 ) return "Tree4";
if ( type == OBJECT_TREE5 ) return "Tree5"; if ( type == OBJECT_TREE5 ) return "Tree5";
if ( type == OBJECT_TREE6 ) return "Tree6";
if ( type == OBJECT_TREE7 ) return "Tree7";
if ( type == OBJECT_TREE8 ) return "Tree8";
if ( type == OBJECT_TREE9 ) return "Tree9";
if ( type == OBJECT_MUSHROOM0 ) return "Mushroom0";
if ( type == OBJECT_MUSHROOM1 ) return "Mushroom1"; if ( type == OBJECT_MUSHROOM1 ) return "Mushroom1";
if ( type == OBJECT_MUSHROOM2 ) return "Mushroom2"; if ( type == OBJECT_MUSHROOM2 ) return "Mushroom2";
if ( type == OBJECT_MUSHROOM3 ) return "Mushroom3";
if ( type == OBJECT_MUSHROOM4 ) return "Mushroom4";
if ( type == OBJECT_MUSHROOM5 ) return "Mushroom5";
if ( type == OBJECT_MUSHROOM6 ) return "Mushroom6";
if ( type == OBJECT_MUSHROOM7 ) return "Mushroom7";
if ( type == OBJECT_MUSHROOM8 ) return "Mushroom8";
if ( type == OBJECT_MUSHROOM9 ) return "Mushroom9";
if ( type == OBJECT_HOME1 ) return "Home"; if ( type == OBJECT_HOME1 ) return "Home";
if ( type == OBJECT_DERRICK ) return "Derrick"; if ( type == OBJECT_DERRICK ) return "Derrick";
if ( type == OBJECT_FACTORY ) return "BotFactory"; if ( type == OBJECT_FACTORY ) return "BotFactory";
@ -535,11 +500,7 @@ const char* GetTypeObject(ObjectType type)
if ( type == OBJECT_INFO ) return "ExchangePost"; if ( type == OBJECT_INFO ) return "ExchangePost";
if ( type == OBJECT_ENERGY ) return "PowerPlant"; if ( type == OBJECT_ENERGY ) return "PowerPlant";
if ( type == OBJECT_LABO ) return "AutoLab"; if ( type == OBJECT_LABO ) return "AutoLab";
#if _GERMAN | _WG
if ( type == OBJECT_NUCLEAR ) return "FuelCellPlant";
#else
if ( type == OBJECT_NUCLEAR ) return "NuclearPlant"; if ( type == OBJECT_NUCLEAR ) return "NuclearPlant";
#endif
if ( type == OBJECT_PARA ) return "PowerCaptor"; if ( type == OBJECT_PARA ) return "PowerCaptor";
if ( type == OBJECT_SAFE ) return "Vault"; if ( type == OBJECT_SAFE ) return "Vault";
if ( type == OBJECT_HUSTON ) return "Houston"; if ( type == OBJECT_HUSTON ) return "Houston";
@ -570,7 +531,6 @@ const char* GetTypeObject(ObjectType type)
if ( type == OBJECT_BARRIER1 ) return "Barrier1"; if ( type == OBJECT_BARRIER1 ) return "Barrier1";
if ( type == OBJECT_BARRIER2 ) return "Barrier2"; if ( type == OBJECT_BARRIER2 ) return "Barrier2";
if ( type == OBJECT_BARRIER3 ) return "Barrier3"; if ( type == OBJECT_BARRIER3 ) return "Barrier3";
if ( type == OBJECT_BARRIER4 ) return "Barrier4";
if ( type == OBJECT_TEEN0 ) return "Teen0"; if ( type == OBJECT_TEEN0 ) return "Teen0";
if ( type == OBJECT_TEEN1 ) return "Teen1"; if ( type == OBJECT_TEEN1 ) return "Teen1";
if ( type == OBJECT_TEEN2 ) return "Teen2"; if ( type == OBJECT_TEEN2 ) return "Teen2";
@ -616,31 +576,16 @@ const char* GetTypeObject(ObjectType type)
if ( type == OBJECT_TEEN42 ) return "Teen42"; if ( type == OBJECT_TEEN42 ) return "Teen42";
if ( type == OBJECT_TEEN43 ) return "Teen43"; if ( type == OBJECT_TEEN43 ) return "Teen43";
if ( type == OBJECT_TEEN44 ) return "Teen44"; if ( type == OBJECT_TEEN44 ) return "Teen44";
if ( type == OBJECT_TEEN45 ) return "Teen45";
if ( type == OBJECT_TEEN46 ) return "Teen46";
if ( type == OBJECT_TEEN47 ) return "Teen47";
if ( type == OBJECT_TEEN48 ) return "Teen48";
if ( type == OBJECT_TEEN49 ) return "Teen49";
if ( type == OBJECT_QUARTZ0 ) return "Quartz0"; if ( type == OBJECT_QUARTZ0 ) return "Quartz0";
if ( type == OBJECT_QUARTZ1 ) return "Quartz1"; if ( type == OBJECT_QUARTZ1 ) return "Quartz1";
if ( type == OBJECT_QUARTZ2 ) return "Quartz2"; if ( type == OBJECT_QUARTZ2 ) return "Quartz2";
if ( type == OBJECT_QUARTZ3 ) return "Quartz3"; if ( type == OBJECT_QUARTZ3 ) return "Quartz3";
if ( type == OBJECT_QUARTZ4 ) return "Quartz4";
if ( type == OBJECT_QUARTZ5 ) return "Quartz5";
if ( type == OBJECT_QUARTZ6 ) return "Quartz6";
if ( type == OBJECT_QUARTZ7 ) return "Quartz7";
if ( type == OBJECT_QUARTZ8 ) return "Quartz8";
if ( type == OBJECT_QUARTZ9 ) return "Quartz9";
if ( type == OBJECT_ROOT0 ) return "MegaStalk0"; if ( type == OBJECT_ROOT0 ) return "MegaStalk0";
if ( type == OBJECT_ROOT1 ) return "MegaStalk1"; if ( type == OBJECT_ROOT1 ) return "MegaStalk1";
if ( type == OBJECT_ROOT2 ) return "MegaStalk2"; if ( type == OBJECT_ROOT2 ) return "MegaStalk2";
if ( type == OBJECT_ROOT3 ) return "MegaStalk3"; if ( type == OBJECT_ROOT3 ) return "MegaStalk3";
if ( type == OBJECT_ROOT4 ) return "MegaStalk4"; if ( type == OBJECT_ROOT4 ) return "MegaStalk4";
if ( type == OBJECT_ROOT5 ) return "MegaStalk5"; if ( type == OBJECT_ROOT5 ) return "MegaStalk5";
if ( type == OBJECT_ROOT6 ) return "MegaStalk6";
if ( type == OBJECT_ROOT7 ) return "MegaStalk7";
if ( type == OBJECT_ROOT8 ) return "MegaStalk8";
if ( type == OBJECT_ROOT9 ) return "MegaStalk9";
if ( type == OBJECT_APOLLO1 ) return "ApolloLEM"; if ( type == OBJECT_APOLLO1 ) return "ApolloLEM";
if ( type == OBJECT_APOLLO2 ) return "ApolloJeep"; if ( type == OBJECT_APOLLO2 ) return "ApolloJeep";
if ( type == OBJECT_APOLLO3 ) return "ApolloFlag"; if ( type == OBJECT_APOLLO3 ) return "ApolloFlag";
@ -800,6 +745,62 @@ const char* GetCamera(Gfx::CameraType type)
return "BACK"; return "BACK";
} }
// Returns the type of drive.
DriveType GetDrive(char *line, int rank)
{
char* p;
p = SearchArg(line, rank);
if ( *p == 0 ) return DRIVE_OTHER;
if ( Cmd(p, "Wheeled" ) ) return DRIVE_WHEELED;
if ( Cmd(p, "Tracked" ) ) return DRIVE_TRACKED;
if ( Cmd(p, "Winged" ) ) return DRIVE_WINGED;
if ( Cmd(p, "Legged" ) ) return DRIVE_LEGGED;
return DRIVE_OTHER;
}
// Returns the name of a drive.
const char* GetDrive(DriveType type)
{
if ( type == DRIVE_WHEELED ) return "Wheeled";
if ( type == DRIVE_TRACKED ) return "Tracked";
if ( type == DRIVE_WINGED ) return "Winged";
if ( type == DRIVE_LEGGED ) return "Legged";
return "Other";
}
// Returns the type of tool.
ToolType GetTool(char *line, int rank)
{
char* p;
p = SearchArg(line, rank);
if ( *p == 0 ) return TOOL_OTHER;
if ( Cmd(p, "Grabber" ) ) return TOOL_GRABBER;
if ( Cmd(p, "Sniffer" ) ) return TOOL_SNIFFER;
if ( Cmd(p, "Shooter" ) ) return TOOL_SHOOTER;
if ( Cmd(p, "OrgaShooter" ) ) return TOOL_ORGASHOOTER;
return TOOL_OTHER;
}
// Returns the name of a tool.
const char* GetTool(ToolType type)
{
if ( type == TOOL_GRABBER ) return "Grabber";
if ( type == TOOL_SNIFFER ) return "Sniffer";
if ( type == TOOL_SHOOTER ) return "Shooter";
if ( type == TOOL_ORGASHOOTER ) return "OrgaShooter";
return "Other";
}
// Returns an integer. // Returns an integer.
int OpInt(char *line, const char *op, int def) int OpInt(char *line, const char *op, int def)
@ -887,6 +888,24 @@ Gfx::CameraType OpCamera(char *line, const char *op)
return GetCamera(line, 0); return GetCamera(line, 0);
} }
// Returns the type of drive.
DriveType OpDrive(char *line, const char *op)
{
line = SearchOp(line, op);
if ( *line == 0 ) return DRIVE_OTHER;
return GetDrive(line, 0);
}
// Returns the type of tool.
ToolType OpTool(char *line, const char *op)
{
line = SearchOp(line, op);
if ( *line == 0 ) return TOOL_OTHER;
return GetTool(line, 0);
}
// Returns the type of a building. // Returns the type of a building.
int OpBuild(char *line, const char *op) int OpBuild(char *line, const char *op)

View File

@ -30,6 +30,7 @@
// Procedures. // Procedures.
extern std::string GetCmd(char* line);
extern bool Cmd(char *line, const char *token); extern bool Cmd(char *line, const char *token);
extern char* SearchOp(char *line, const char *op); extern char* SearchOp(char *line, const char *op);
@ -45,6 +46,10 @@ extern int GetResearch(char *line, int rank);
extern Gfx::PyroType GetPyro(char *line, int rank); extern Gfx::PyroType GetPyro(char *line, int rank);
extern Gfx::CameraType GetCamera(char *line, int rank); extern Gfx::CameraType GetCamera(char *line, int rank);
extern const char* GetCamera(Gfx::CameraType type); extern const char* GetCamera(Gfx::CameraType type);
extern DriveType GetDrive(char *line, int rank);
extern const char* GetDrive(DriveType type);
extern ToolType GetTool(char *line, int rank);
extern const char* GetTool(ToolType type);
extern int OpInt(char *line, const char *op, int def); extern int OpInt(char *line, const char *op, int def);
extern float OpFloat(char *line, const char *op, float def); extern float OpFloat(char *line, const char *op, float def);
@ -55,6 +60,8 @@ extern Gfx::EngineObjectType OpTypeTerrain(char *line, const char *op, Gfx::Engi
extern int OpResearch(char *line, const char *op); extern int OpResearch(char *line, const char *op);
extern Gfx::PyroType OpPyro(char *line, const char *op); extern Gfx::PyroType OpPyro(char *line, const char *op);
extern Gfx::CameraType OpCamera(char *line, const char *op); extern Gfx::CameraType OpCamera(char *line, const char *op);
extern DriveType OpDrive(char *line, const char *op);
extern ToolType OpTool(char *line, const char *op);
extern int OpBuild(char *line, const char *op); extern int OpBuild(char *line, const char *op);
extern Math::Vector OpPos(char *line, const char *op); extern Math::Vector OpPos(char *line, const char *op);
extern Math::Vector OpDir(char *line, const char *op); extern Math::Vector OpDir(char *line, const char *op);

View File

@ -18,10 +18,12 @@
#include "script/script.h" #include "script/script.h"
#include "app/app.h" #include "app/app.h"
#include "app/gamedata.h"
#include "common/global.h" #include "common/global.h"
#include "common/iman.h" #include "common/iman.h"
#include "common/restext.h" #include "common/restext.h"
#include "common/stringutils.h"
#include "graphics/engine/terrain.h" #include "graphics/engine/terrain.h"
#include "graphics/engine/water.h" #include "graphics/engine/water.h"
@ -37,6 +39,7 @@
#include "object/auto/auto.h" #include "object/auto/auto.h"
#include "object/auto/autofactory.h" #include "object/auto/autofactory.h"
#include "object/auto/autobase.h"
#include "physics/physics.h" #include "physics/physics.h"
@ -678,10 +681,23 @@ bool CScript::rFactory(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& e
classVars = classVars->GetNext(); // "id" classVars = classVars->GetNext(); // "id"
int rank = classVars->GetValInt(); int rank = classVars->GetValInt();
CObject* factory = CObjectManager::GetInstancePointer()->SearchInstance(rank); CObject* factory = CObjectManager::GetInstancePointer()->SearchInstance(rank);
CAutoFactory* automat = static_cast<CAutoFactory*>(factory->GetAuto()); if (factory == nullptr) {
exception = ERR_GENERIC;
result->SetValInt(ERR_GENERIC);
CLogger::GetInstancePointer()->Error("in object.factory() - factory is nullptr");
return false;
}
if ( thisType == OBJECT_FACTORY ) if ( thisType == OBJECT_FACTORY )
{ {
CAutoFactory* automat = static_cast<CAutoFactory*>(factory->GetAuto());
if(automat == nullptr) {
exception = ERR_GENERIC;
result->SetValInt(ERR_GENERIC);
CLogger::GetInstancePointer()->Error("in object.factory() - automat is nullptr");
return false;
}
bool bEnable = false; bool bEnable = false;
if ( type == OBJECT_MOBILEwa ) if ( type == OBJECT_MOBILEwa )
@ -900,6 +916,54 @@ bool CScript::rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* result, int&
return true; return true;
} }
// Instruction "object.takeoff()"
bool CScript::rTakeOff(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception)
{
Error err;
exception = 0;
CBotVar* classVars = thisclass->GetItemList(); // "category"
ObjectType thisType = static_cast<ObjectType>(classVars->GetValInt());
classVars = classVars->GetNext(); // "position"
classVars = classVars->GetNext(); // "orientation"
classVars = classVars->GetNext(); // "pitch"
classVars = classVars->GetNext(); // "roll"
classVars = classVars->GetNext(); // "energyLevel"
classVars = classVars->GetNext(); // "shieldLevel"
classVars = classVars->GetNext(); // "temperature"
classVars = classVars->GetNext(); // "altitude"
classVars = classVars->GetNext(); // "lifeTime"
classVars = classVars->GetNext(); // "material"
classVars = classVars->GetNext(); // "energyCell"
classVars = classVars->GetNext(); // "load"
classVars = classVars->GetNext(); // "id"
int rank = classVars->GetValInt();
CObject* center = CObjectManager::GetInstancePointer()->SearchInstance(rank);
CAuto* automat = center->GetAuto();
if ( thisType == OBJECT_BASE )
{
err = (static_cast<CAutoBase*>(automat))->TakeOff(false);
} else
err = ERR_WRONG_OBJ;
if ( err != ERR_OK )
{
result->SetValInt(err); // return error
//TODO: if ( script->m_errMode == ERM_STOP )
if( true )
{
exception = err;
return false;
}
return true;
}
return true;
}
// Compilation of the instruction "delete(rank[, exploType[, force]])". // Compilation of the instruction "delete(rank[, exploType[, force]])".
CBotTypResult CScript::cDelete(CBotVar* &var, void* user) CBotTypResult CScript::cDelete(CBotVar* &var, void* user)
@ -1330,7 +1394,7 @@ bool CScript::Process(CScript* script, CBotVar* result, int &exception)
if ( err == ERR_STOP ) err = ERR_OK; if ( err == ERR_STOP ) err = ERR_OK;
result->SetValInt(err); // indicates the error or ok result->SetValInt(err); // indicates the error or ok
if ( err != ERR_OK && script->m_errMode == ERM_STOP ) if ( ShouldProcessStop(err, script->m_errMode) )
{ {
exception = err; exception = err;
return false; return false;
@ -1344,6 +1408,21 @@ bool CScript::Process(CScript* script, CBotVar* result, int &exception)
} }
// Returns true if error code means real error and exception must be thrown
bool CScript::ShouldProcessStop(Error err, int errMode)
{
// aim impossible - not a real error
if ( err == ERR_AIM_IMPOSSIBLE )
return false;
if ( err != ERR_OK && errMode == ERM_STOP )
return true;
return false;
}
// Compilation of the instruction "detect(type)". // Compilation of the instruction "detect(type)".
CBotTypResult CScript::cDetect(CBotVar* &var, void* user) CBotTypResult CScript::cDetect(CBotVar* &var, void* user)
@ -1576,7 +1655,7 @@ CBotTypResult CScript::cCanBuild(CBotVar* &var, void* user)
return CBotTypResult(CBotTypBoolean); return CBotTypResult(CBotTypBoolean);
} }
// Instruction "canbuid ( category );" // Instruction "canbuild ( category );"
// returns true if this building can be built // returns true if this building can be built
bool CScript::rCanBuild(CBotVar* var, CBotVar* result, int& exception, void* user) bool CScript::rCanBuild(CBotVar* var, CBotVar* result, int& exception, void* user)
@ -1602,7 +1681,7 @@ bool CScript::rCanBuild(CBotVar* var, CBotVar* result, int& exception, void* use
(category == OBJECT_DESTROYER && (g_build & BUILD_DESTROYER))) (category == OBJECT_DESTROYER && (g_build & BUILD_DESTROYER)))
{ {
//if we want to build not researched one // if we want to build not researched one
if ( (category == OBJECT_TOWER && !(g_researchDone & RESEARCH_TOWER)) || if ( (category == OBJECT_TOWER && !(g_researchDone & RESEARCH_TOWER)) ||
(category == OBJECT_NUCLEAR && !(g_researchDone & RESEARCH_ATOMIC)) (category == OBJECT_NUCLEAR && !(g_researchDone & RESEARCH_ATOMIC))
) )
@ -1646,7 +1725,7 @@ bool CScript::rBuild(CBotVar* var, CBotVar* result, int& exception, void* user)
} }
else else
{ {
category = static_cast<ObjectType>(var->GetValInt()); //get category parameter category = static_cast<ObjectType>(var->GetValInt()); // get category parameter
if ( (category == OBJECT_DERRICK && (g_build & BUILD_DERRICK)) || if ( (category == OBJECT_DERRICK && (g_build & BUILD_DERRICK)) ||
(category == OBJECT_FACTORY && (g_build & BUILD_FACTORY)) || (category == OBJECT_FACTORY && (g_build & BUILD_FACTORY)) ||
(category == OBJECT_STATION && (g_build & BUILD_STATION)) || (category == OBJECT_STATION && (g_build & BUILD_STATION)) ||
@ -1663,7 +1742,7 @@ bool CScript::rBuild(CBotVar* var, CBotVar* result, int& exception, void* user)
(category == OBJECT_DESTROYER && (g_build & BUILD_DESTROYER))) (category == OBJECT_DESTROYER && (g_build & BUILD_DESTROYER)))
{ {
//if we want to build not researched one // if we want to build not researched one
if ( (category == OBJECT_TOWER && !(g_researchDone & RESEARCH_TOWER)) || if ( (category == OBJECT_TOWER && !(g_researchDone & RESEARCH_TOWER)) ||
(category == OBJECT_NUCLEAR && !(g_researchDone & RESEARCH_ATOMIC)) (category == OBJECT_NUCLEAR && !(g_researchDone & RESEARCH_ATOMIC))
) )
@ -1676,8 +1755,11 @@ bool CScript::rBuild(CBotVar* var, CBotVar* result, int& exception, void* user)
} }
} }
if (pThis->GetIgnoreBuildCheck())
err = ERR_OK;
if (err == ERR_OK && script->m_primaryTask == 0) //if we can build and no task is present if (err == ERR_OK && script->m_primaryTask == 0) // if we can build and no task is present
{ {
script->m_primaryTask = new CTaskManager(script->m_object); script->m_primaryTask = new CTaskManager(script->m_object);
err = script->m_primaryTask->StartTaskBuild(category); err = script->m_primaryTask->StartTaskBuild(category);
@ -1688,9 +1770,9 @@ bool CScript::rBuild(CBotVar* var, CBotVar* result, int& exception, void* user)
script->m_primaryTask = 0; script->m_primaryTask = 0;
} }
} }
//When script is waiting for finishing this task, it sets ERR_OK, and continues executing Process // When script is waiting for finishing this task, it sets ERR_OK, and continues executing Process
//without creating new task. I think, there was a problem with previous version in release configuration // without creating new task. I think, there was a problem with previous version in release configuration
//It did not init error variable in this situation, and code tried to use variable with trash inside // It did not init error variable in this situation, and code tried to use variable with trash inside
} }
if ( err != ERR_OK ) if ( err != ERR_OK )
@ -1820,52 +1902,10 @@ bool CScript::rProduce(CBotVar* var, CBotVar* result, int& exception, void* user
} }
} }
if ( type == OBJECT_FRET || if ( type == OBJECT_ANT ||
type == OBJECT_STONE || type == OBJECT_SPIDER ||
type == OBJECT_URANIUM || type == OBJECT_BEE ||
type == OBJECT_METAL || type == OBJECT_WORM )
type == OBJECT_POWER ||
type == OBJECT_ATOMIC ||
type == OBJECT_BULLET ||
type == OBJECT_BBOX ||
type == OBJECT_KEYa ||
type == OBJECT_KEYb ||
type == OBJECT_KEYc ||
type == OBJECT_KEYd ||
type == OBJECT_TNT ||
type == OBJECT_SCRAP1 ||
type == OBJECT_SCRAP2 ||
type == OBJECT_SCRAP3 ||
type == OBJECT_SCRAP4 ||
type == OBJECT_SCRAP5 ||
type == OBJECT_BOMB ||
type == OBJECT_WAYPOINT ||
type == OBJECT_SHOW ||
type == OBJECT_WINFIRE ||
type == OBJECT_BAG ||
type == OBJECT_MARKPOWER ||
type == OBJECT_MARKSTONE ||
type == OBJECT_MARKURANIUM ||
type == OBJECT_MARKKEYa ||
type == OBJECT_MARKKEYb ||
type == OBJECT_MARKKEYc ||
type == OBJECT_MARKKEYd ||
type == OBJECT_EGG )
{
object = new CObject();
if ( !object->CreateResource(pos, angle, type) )
{
delete object;
result->SetValInt(1); // error
return true;
}
object->SetActivity(false);
}
else if ( type == OBJECT_MOTHER ||
type == OBJECT_ANT ||
type == OBJECT_SPIDER ||
type == OBJECT_BEE ||
type == OBJECT_WORM )
{ {
CObject* egg; CObject* egg;
@ -1883,117 +1923,16 @@ bool CScript::rProduce(CBotVar* var, CBotVar* result, int& exception, void* user
delete egg; delete egg;
} }
object->SetActivity(false); object->SetActivity(false);
} } else {
else if ( type == OBJECT_PORTICO || if ((type == OBJECT_POWER || type == OBJECT_ATOMIC) && power == -1.0f) power = 1.0f;
type == OBJECT_BASE || object = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type, power);
type == OBJECT_DERRICK || if ( object == nullptr )
type == OBJECT_FACTORY ||
type == OBJECT_STATION ||
type == OBJECT_CONVERT ||
type == OBJECT_REPAIR ||
type == OBJECT_DESTROYER||
type == OBJECT_TOWER ||
type == OBJECT_NEST ||
type == OBJECT_RESEARCH ||
type == OBJECT_RADAR ||
type == OBJECT_INFO ||
type == OBJECT_ENERGY ||
type == OBJECT_LABO ||
type == OBJECT_NUCLEAR ||
type == OBJECT_PARA ||
type == OBJECT_SAFE ||
type == OBJECT_HUSTON ||
type == OBJECT_TARGET1 ||
type == OBJECT_TARGET2 ||
type == OBJECT_START ||
type == OBJECT_END )
{
object = new CObject();
if ( !object->CreateBuilding(pos, angle, 0, type) )
{ {
delete object;
result->SetValInt(1); // error result->SetValInt(1); // error
return true; return true;
} }
object->SetActivity(false);
script->m_main->CreateShortcuts(); script->m_main->CreateShortcuts();
} }
else if ( type == OBJECT_FLAGb ||
type == OBJECT_FLAGr ||
type == OBJECT_FLAGg ||
type == OBJECT_FLAGy ||
type == OBJECT_FLAGv )
{
object = new CObject();
if ( !object->CreateFlag(pos, angle, type) )
{
delete object;
result->SetValInt(1); // error
return true;
}
object->SetActivity(false);
}
else if ( type == OBJECT_HUMAN ||
type == OBJECT_TECH ||
type == OBJECT_TOTO ||
type == OBJECT_MOBILEfa ||
type == OBJECT_MOBILEta ||
type == OBJECT_MOBILEwa ||
type == OBJECT_MOBILEia ||
type == OBJECT_MOBILEfc ||
type == OBJECT_MOBILEtc ||
type == OBJECT_MOBILEwc ||
type == OBJECT_MOBILEic ||
type == OBJECT_MOBILEfi ||
type == OBJECT_MOBILEti ||
type == OBJECT_MOBILEwi ||
type == OBJECT_MOBILEii ||
type == OBJECT_MOBILEfs ||
type == OBJECT_MOBILEts ||
type == OBJECT_MOBILEws ||
type == OBJECT_MOBILEis ||
type == OBJECT_MOBILErt ||
type == OBJECT_MOBILErc ||
type == OBJECT_MOBILErr ||
type == OBJECT_MOBILErs ||
type == OBJECT_MOBILEsa ||
type == OBJECT_MOBILEtg ||
type == OBJECT_MOBILEft ||
type == OBJECT_MOBILEtt ||
type == OBJECT_MOBILEwt ||
type == OBJECT_MOBILEit ||
type == OBJECT_MOBILEdr ||
type == OBJECT_APOLLO2 )
{
object = new CObject();
if ( !object->CreateVehicle(pos, angle, type, power, false, false) )
{
delete object;
result->SetValInt(1); // error
return true;
}
object->UpdateMapping();
object->SetRange(30.0f);
object->SetZoom(0, 1.0f);
CPhysics* physics = object->GetPhysics();
if ( physics != 0 )
{
physics->SetFreeze(false); // can move
}
object->SetLock(false); // vehicle useable
// SetManual will affect bot speed
if (type == OBJECT_MOBILEdr)
{
object->SetManual(true);
}
object->SetActivity(true);
script->m_main->CreateShortcuts();
}
else
{
result->SetValInt(1); // impossible
return true;
}
if (name[0] != 0) if (name[0] != 0)
{ {
@ -2923,7 +2862,6 @@ bool CScript::rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
CBotTypResult CScript::cFire(CBotVar* &var, void* user) CBotTypResult CScript::cFire(CBotVar* &var, void* user)
{ {
#if 0
CObject* pThis = static_cast<CObject *>(user); CObject* pThis = static_cast<CObject *>(user);
ObjectType type; ObjectType type;
@ -2931,23 +2869,25 @@ CBotTypResult CScript::cFire(CBotVar* &var, void* user)
if ( type == OBJECT_ANT ) if ( type == OBJECT_ANT )
{ {
return cOnePoint(var, user); if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
CBotTypResult ret = cPoint(var, user);
if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
} }
else if ( type == OBJECT_SPIDER ) else if ( type == OBJECT_SPIDER )
{ {
return cNull(var, user); if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
} }
else else
{ {
if ( var == 0 ) return CBotTypResult(CBotTypFloat); if ( var != 0 )
if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); {
var = var->GetNext(); if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
if ( var != 0 ) return CBotTypResult(CBotErrOverParam); var = var->GetNext();
return CBotTypResult(CBotTypFloat); if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
}
} }
#else
return CBotTypResult(CBotTypFloat); return CBotTypResult(CBotTypFloat);
#endif
} }
// Instruction "fire(delay)". // Instruction "fire(delay)".
@ -2983,6 +2923,7 @@ bool CScript::rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
{ {
if ( var == 0 ) delay = 0.0f; if ( var == 0 ) delay = 0.0f;
else delay = var->GetValFloat(); else delay = var->GetValFloat();
if ( delay < 0.0f ) delay = -delay;
err = script->m_primaryTask->StartTaskFire(delay); err = script->m_primaryTask->StartTaskFire(delay);
} }
@ -3031,7 +2972,11 @@ bool CScript::rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
var = var->GetNext(); var = var->GetNext();
var == 0 ? y=0.0f : y=var->GetValFloat(); var == 0 ? y=0.0f : y=var->GetValFloat();
err = script->m_primaryTask->StartTaskGunGoal(x*Math::PI/180.0f, y*Math::PI/180.0f); err = script->m_primaryTask->StartTaskGunGoal(x*Math::PI/180.0f, y*Math::PI/180.0f);
if ( err != ERR_OK ) if ( err == ERR_AIM_IMPOSSIBLE )
{
result->SetValInt(err); // shows the error
}
else if ( err != ERR_OK )
{ {
delete script->m_primaryTask; delete script->m_primaryTask;
script->m_primaryTask = 0; script->m_primaryTask = 0;
@ -3488,6 +3433,47 @@ bool CScript::rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* use
return true; return true;
} }
// Compilation of the instruction with one object parameter
CBotTypResult CScript::cOneObject(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
}
// Instruction "camerafocus(object)".
bool CScript::rCameraFocus(CBotVar* var, CBotVar* result, int& exception, void* user)
{
CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CBotVar* classVars = var->GetItemList(); // "category"
classVars = classVars->GetNext(); // "position"
classVars = classVars->GetNext(); // "orientation"
classVars = classVars->GetNext(); // "pitch"
classVars = classVars->GetNext(); // "roll"
classVars = classVars->GetNext(); // "energyLevel"
classVars = classVars->GetNext(); // "shieldLevel"
classVars = classVars->GetNext(); // "temperature"
classVars = classVars->GetNext(); // "altitude"
classVars = classVars->GetNext(); // "lifeTime"
classVars = classVars->GetNext(); // "material"
classVars = classVars->GetNext(); // "energyCell"
classVars = classVars->GetNext(); // "load"
classVars = classVars->GetNext(); // "id"
int rank = classVars->GetValInt();
CObject* object = CObjectManager::GetInstancePointer()->SearchInstance(rank);
script->m_main->SelectObject(object, false);
result->SetValInt(ERR_OK);
exception = ERR_OK;
return true;
}
// Object's constructor. // Object's constructor.
@ -3504,6 +3490,7 @@ CScript::CScript(CObject* object, CTaskManager** secondaryTask)
m_secondaryTask = secondaryTask; m_secondaryTask = secondaryTask;
m_interface = m_main->GetInterface(); m_interface = m_main->GetInterface();
m_pause = CPauseManager::GetInstancePointer();
m_ipf = CBOT_IPF; m_ipf = CBOT_IPF;
m_errMode = ERM_STOP; m_errMode = ERM_STOP;
@ -3587,6 +3574,8 @@ void CScript::InitFonctions()
CBotProgram::AddFunction("penup", rPenUp, CScript::cNull); CBotProgram::AddFunction("penup", rPenUp, CScript::cNull);
CBotProgram::AddFunction("pencolor", rPenColor, CScript::cOneFloat); CBotProgram::AddFunction("pencolor", rPenColor, CScript::cOneFloat);
CBotProgram::AddFunction("penwidth", rPenWidth, CScript::cOneFloat); CBotProgram::AddFunction("penwidth", rPenWidth, CScript::cOneFloat);
CBotProgram::AddFunction("camerafocus", rCameraFocus, CScript::cOneObject);
CBotProgram::AddFunction("canbuild", rCanBuild, CScript::cCanBuild); CBotProgram::AddFunction("canbuild", rCanBuild, CScript::cCanBuild);
CBotProgram::AddFunction("build", rBuild, CScript::cOneFloat); CBotProgram::AddFunction("build", rBuild, CScript::cOneFloat);
@ -3898,16 +3887,16 @@ bool CScript::Continue(const Event &event)
if ( m_error != 0 && m_errMode == ERM_STOP ) if ( m_error != 0 && m_errMode == ERM_STOP )
{ {
char s[100]; std::string s;
GetError(s); GetError(s);
m_main->GetDisplayText()->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); m_main->GetDisplayText()->DisplayText(s.c_str(), m_object, 10.0f, Ui::TT_ERROR);
} }
m_engine->SetPause(true); // gives pause m_pause->SetPause(PAUSE_EDITOR); // gives pause
return true; return true;
} }
if ( !m_bContinue ) if ( !m_bContinue )
{ {
m_engine->SetPause(true); // gives pause m_pause->SetPause(PAUSE_EDITOR); // gives pause
} }
} }
@ -3931,9 +3920,9 @@ bool CScript::Continue(const Event &event)
if ( m_error != 0 && m_errMode == ERM_STOP ) if ( m_error != 0 && m_errMode == ERM_STOP )
{ {
char s[100]; std::string s;
GetError(s); GetError(s);
m_main->GetDisplayText()->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); m_main->GetDisplayText()->DisplayText(s.c_str(), m_object, 10.0f, Ui::TT_ERROR);
} }
return true; return true;
} }
@ -3950,9 +3939,9 @@ bool CScript::Step(const Event &event)
if ( !m_bRun ) return true; if ( !m_bRun ) return true;
if ( !m_bStepMode ) return false; if ( !m_bStepMode ) return false;
m_engine->SetPause(false); // ??? m_engine->SetPause(false);
// TODO: m_app StepSimulation??? m_engine->StepSimulation(0.01f); // advance of 10ms // TODO: m_app StepSimulation??? m_engine->StepSimulation(0.01f); // advance of 10ms
m_engine->SetPause(true); // ??? m_engine->SetPause(true);
m_event = event; m_event = event;
@ -3973,16 +3962,16 @@ bool CScript::Step(const Event &event)
if ( m_error != 0 && m_errMode == ERM_STOP ) if ( m_error != 0 && m_errMode == ERM_STOP )
{ {
char s[100]; std::string s;
GetError(s); GetError(s);
m_main->GetDisplayText()->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); m_main->GetDisplayText()->DisplayText(s.c_str(), m_object, 10.0f, Ui::TT_ERROR);
} }
return true; return true;
} }
if ( m_bContinue ) // instuction "move", "goto", etc. ? if ( m_bContinue ) // instuction "move", "goto", etc. ?
{ {
m_engine->SetPause(false); // removes the pause m_pause->ClearPause(); // removes the pause
} }
return false; return false;
} }
@ -4347,27 +4336,27 @@ int CScript::GetError()
// Returns the text of the error. // Returns the text of the error.
void CScript::GetError(char* buffer) void CScript::GetError(std::string& error)
{ {
if ( m_error == 0 ) if ( m_error == 0 )
{ {
buffer[0] = 0; error.clear();
} }
else else
{ {
if ( m_error == ERR_OBLIGATORYTOKEN ) if ( m_error == ERR_OBLIGATORYTOKEN )
{ {
char s[100]; std::string s;
GetResource(RES_ERR, m_error, s); GetResource(RES_ERR, m_error, s);
sprintf(buffer, s, m_token); error = StrUtils::Format(s.c_str(), m_token);
} }
else if ( m_error < 1000 ) else if ( m_error < 1000 )
{ {
GetResource(RES_ERR, m_error, buffer); GetResource(RES_ERR, m_error, error);
} }
else else
{ {
GetResource(RES_CBOT, m_error, buffer); GetResource(RES_CBOT, m_error, error);
} }
} }
} }
@ -4385,7 +4374,9 @@ void CScript::New(Ui::CEdit* edit, const char* name)
char *sf; char *sf;
int cursor1, cursor2, len, i, j; int cursor1, cursor2, len, i, j;
GetResource(RES_TEXT, RT_SCRIPT_NEW, res); std::string resStr;
GetResource(RES_TEXT, RT_SCRIPT_NEW, resStr);
strcpy(res, resStr.c_str());
if ( name[0] == 0 ) strcpy(text, res); if ( name[0] == 0 ) strcpy(text, res);
else strcpy(text, name); else strcpy(text, name);
@ -4418,7 +4409,7 @@ void CScript::New(Ui::CEdit* edit, const char* name)
sf = m_main->GetScriptFile(); sf = m_main->GetScriptFile();
if ( sf[0] != 0 ) // Load an empty program specific? if ( sf[0] != 0 ) // Load an empty program specific?
{ {
std::string filename = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, sf); std::string filename = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, sf);
file = fopen(filename.c_str(), "rb"); file = fopen(filename.c_str(), "rb");
if ( file != NULL ) if ( file != NULL )
{ {
@ -4512,7 +4503,7 @@ bool CScript::ReadScript(const char* filename)
if ( strchr(filename, '/') == 0 ) //we're reading non user script if ( strchr(filename, '/') == 0 ) //we're reading non user script
{ {
name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename); name = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, filename);
} }
else else
{ {
@ -4546,7 +4537,7 @@ bool CScript::WriteScript(const char* filename)
if ( strchr(filename, '/') == 0 ) //we're writing non user script if ( strchr(filename, '/') == 0 ) //we're writing non user script
{ {
name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename); name = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, filename);
} }
else else
{ {

View File

@ -24,6 +24,10 @@
#include "common/event.h" #include "common/event.h"
#include "common/global.h"
#include "app/pausemanager.h"
#include "CBot/CBotDll.h" #include "CBot/CBotDll.h"
#include <stdio.h> #include <stdio.h>
@ -74,7 +78,7 @@ public:
bool IntroduceVirus(); bool IntroduceVirus();
int GetError(); int GetError();
void GetError(char* buffer); void GetError(std::string& error);
void New(Ui::CEdit* edit, const char* name); void New(Ui::CEdit* edit, const char* name);
bool SendScript(const char* text); bool SendScript(const char* text);
@ -126,6 +130,7 @@ private:
static CBotTypResult cPenDown(CBotVar* &var, void* user); static CBotTypResult cPenDown(CBotVar* &var, void* user);
static CBotTypResult cOnePoint(CBotVar* &var, void* user); static CBotTypResult cOnePoint(CBotVar* &var, void* user);
static CBotTypResult cPoint(CBotVar* &var, void* user); static CBotTypResult cPoint(CBotVar* &var, void* user);
static CBotTypResult cOneObject(CBotVar* &var, void* user);
static bool rSin(CBotVar* var, CBotVar* result, int& exception, void* user); static bool rSin(CBotVar* var, CBotVar* result, int& exception, void* user);
@ -190,6 +195,7 @@ private:
static bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user); static bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user);
static bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user); static bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user);
static bool rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user); static bool rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user);
static bool rCameraFocus(CBotVar* var, CBotVar* result, int& exception, void* user);
public: public:
static CBotTypResult cBusy(CBotVar* thisclass, CBotVar* &var); static CBotTypResult cBusy(CBotVar* thisclass, CBotVar* &var);
@ -200,10 +206,12 @@ public:
static bool rBusy(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception); static bool rBusy(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception);
static bool rFactory(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception); static bool rFactory(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception);
static bool rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception); static bool rResearch(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception);
static bool rTakeOff(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception);
static bool rDestroy(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception); static bool rDestroy(CBotVar* thisclass, CBotVar* var, CBotVar* result, int& exception);
private: private:
static bool Process(CScript* script, CBotVar* result, int &exception); static bool Process(CScript* script, CBotVar* result, int &exception);
static bool ShouldProcessStop(Error err, int errMode);
static CObject* SearchInfo(CScript* script, CObject* object, float power); static CObject* SearchInfo(CScript* script, CObject* object, float power);
protected: protected:
@ -216,6 +224,7 @@ protected:
CTaskManager* m_primaryTask; CTaskManager* m_primaryTask;
CTaskManager** m_secondaryTask; CTaskManager** m_secondaryTask;
CObject* m_object; CObject* m_object;
CPauseManager* m_pause;
int m_ipf; // number of instructions/second int m_ipf; // number of instructions/second
int m_errMode; // what to do in case of error int m_errMode; // what to do in case of error

View File

@ -18,6 +18,8 @@
#include "sound/oalsound/alsound.h" #include "sound/oalsound/alsound.h"
#include "app/gamedata.h"
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>
@ -26,12 +28,14 @@
ALSound::ALSound() ALSound::ALSound()
{ {
m_enabled = false; m_enabled = false;
m_3D = false;
m_audioVolume = 1.0f; m_audioVolume = 1.0f;
m_musicVolume = 1.0f; m_musicVolume = 1.0f;
m_currentMusic = nullptr; m_currentMusic = nullptr;
m_eye.LoadZero(); m_eye.LoadZero();
m_lookat.LoadZero(); m_lookat.LoadZero();
m_previousMusic.fadeTime = 0.0f;
m_previousMusic.music = nullptr;
m_channels_limit = 2048;
} }
@ -58,6 +62,16 @@ void ALSound::CleanUp()
{ {
delete m_currentMusic; delete m_currentMusic;
} }
for (auto item : m_oldMusic)
{
delete item.music;
}
if (m_previousMusic.music)
{
delete m_previousMusic.music;
}
for (auto item : m_sounds) for (auto item : m_sounds)
{ {
@ -77,7 +91,7 @@ void ALSound::CleanUp()
} }
bool ALSound::Create(bool b3D) bool ALSound::Create()
{ {
CleanUp(); CleanUp();
@ -102,32 +116,12 @@ bool ALSound::Create(bool b3D)
alListenerf(AL_GAIN, m_audioVolume); alListenerf(AL_GAIN, m_audioVolume);
alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED); alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);
m_currentMusic = new Channel();
GetLogger()->Info("Done.\n"); GetLogger()->Info("Done.\n");
m_enabled = true; m_enabled = true;
return true; return true;
} }
void ALSound::SetSound3D(bool bMode)
{
m_3D = bMode;
}
bool ALSound::GetSound3D()
{
return m_3D;
}
bool ALSound::GetSound3DCap()
{
// TODO stub! need to be implemented
return true;
}
bool ALSound::GetEnable() bool ALSound::GetEnable()
{ {
return m_enabled; return m_enabled;
@ -168,10 +162,10 @@ int ALSound::GetMusicVolume()
} }
bool ALSound::Cache(Sound sound, std::string filename) bool ALSound::Cache(Sound sound, const std::string &filename)
{ {
Buffer *buffer = new Buffer(); Buffer *buffer = new Buffer();
if (buffer->LoadFromFile(filename, sound)) if (buffer->LoadFromFile(CGameData::GetInstancePointer()->GetFilePath(DIR_SOUND, filename), sound))
{ {
m_sounds[sound] = buffer; m_sounds[sound] = buffer;
return true; return true;
@ -179,14 +173,12 @@ bool ALSound::Cache(Sound sound, std::string filename)
return false; return false;
} }
bool ALSound::CacheMusic(std::string filename) bool ALSound::CacheMusic(const std::string &filename)
{ {
if (m_music.find(filename) == m_music.end()) if (m_music.find(filename) == m_music.end())
{ {
Buffer *buffer = new Buffer(); Buffer *buffer = new Buffer();
std::stringstream file; if (buffer->LoadFromFile(CGameData::GetInstancePointer()->GetFilePath(DIR_MUSIC, filename), static_cast<Sound>(-1)))
file << m_soundPath << "/" << filename;
if (buffer->LoadFromFile(file.str(), static_cast<Sound>(-1)))
{ {
m_music[filename] = buffer; m_music[filename] = buffer;
return true; return true;
@ -252,11 +244,16 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
for (auto it : m_channels) for (auto it : m_channels)
{ {
if (it.second->IsPlaying()) if (it.second->IsPlaying())
{
continue; continue;
}
if (it.second->GetSoundType() != sound) if (it.second->GetSoundType() != sound)
{
continue; continue;
}
it.second->SetPriority(priority); it.second->SetPriority(priority);
it.second->Reset();
channel = it.first; channel = it.first;
bAlreadyLoaded = it.second->IsLoaded(); bAlreadyLoaded = it.second->IsLoaded();
return true; return true;
@ -270,6 +267,7 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
if (chn->IsReady()) if (chn->IsReady())
{ {
chn->SetPriority(priority); chn->SetPriority(priority);
chn->Reset();
m_channels[1] = chn; m_channels[1] = chn;
channel = 1; channel = 1;
bAlreadyLoaded = false; bAlreadyLoaded = false;
@ -280,8 +278,8 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
return false; return false;
} }
// Seeks a channel completely free. // Assigns new channel within limit
if (m_channels.size() < 64) if (m_channels.size() < m_channels_limit)
{ {
auto it = m_channels.end(); auto it = m_channels.end();
it--; it--;
@ -295,13 +293,14 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
if (chn->IsReady()) if (chn->IsReady())
{ {
chn->SetPriority(priority); chn->SetPriority(priority);
chn->Reset();
m_channels[++i] = chn; m_channels[++i] = chn;
channel = i; channel = i;
bAlreadyLoaded = false; bAlreadyLoaded = false;
return true; return true;
} }
delete chn; delete chn;
GetLogger()->Warn("Could not open additional channel to play sound!\n"); GetLogger()->Debug("Could not open additional channel to play sound!\n");
} }
} }
} }
@ -313,6 +312,7 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
{ {
GetLogger()->Debug("Sound channel with lower priority will be reused.\n"); GetLogger()->Debug("Sound channel with lower priority will be reused.\n");
channel = it.first; channel = it.first;
it.second->Reset();
return true; return true;
} }
if (it.second->GetPriority() <= priority) if (it.second->GetPriority() <= priority)
@ -322,11 +322,12 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
if (lowerOrEqual != -1) if (lowerOrEqual != -1)
{ {
channel = lowerOrEqual; channel = lowerOrEqual;
m_channels[channel]->Reset();
GetLogger()->Debug("Sound channel with lower or equal priority will be reused.\n"); GetLogger()->Debug("Sound channel with lower or equal priority will be reused.\n");
return true; return true;
} }
GetLogger()->Warn("Could not find free buffer to use.\n"); GetLogger()->Debug("Could not find free buffer to use.\n");
return false; return false;
} }
@ -337,7 +338,7 @@ int ALSound::Play(Sound sound, float amplitude, float frequency, bool bLoop)
} }
int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequency, bool bLoop) int ALSound::Play(Sound sound, const Math::Vector &pos, float amplitude, float frequency, bool bLoop)
{ {
if (!m_enabled) if (!m_enabled)
{ {
@ -345,14 +346,16 @@ int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequenc
} }
if (m_sounds.find(sound) == m_sounds.end()) if (m_sounds.find(sound) == m_sounds.end())
{ {
GetLogger()->Warn("Sound %d was not loaded!\n", sound); GetLogger()->Debug("Sound %d was not loaded!\n", sound);
return -1; return -1;
} }
int channel; int channel;
bool bAlreadyLoaded = false; bool bAlreadyLoaded = false;
if (!SearchFreeBuffer(sound, channel, bAlreadyLoaded)) if (!SearchFreeBuffer(sound, channel, bAlreadyLoaded))
{
return -1; return -1;
}
if (!bAlreadyLoaded) if (!bAlreadyLoaded)
{ {
@ -363,15 +366,8 @@ int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequenc
} }
} }
Position(channel, pos); m_channels[channel]->SetPosition(pos);
if (!m_3D) m_channels[channel]->SetVolumeAtrib(1.0f);
{
ComputeVolumePan2D(channel, pos);
}
else
{
m_channels[channel]->SetVolumeAtrib(1.0f);
}
// setting initial values // setting initial values
m_channels[channel]->SetStartAmplitude(amplitude); m_channels[channel]->SetStartAmplitude(amplitude);
@ -381,15 +377,26 @@ int ALSound::Play(Sound sound, Math::Vector pos, float amplitude, float frequenc
m_channels[channel]->SetFrequency(frequency); m_channels[channel]->SetFrequency(frequency);
m_channels[channel]->SetVolume(powf(amplitude * m_channels[channel]->GetVolumeAtrib(), 0.2f) * m_audioVolume); m_channels[channel]->SetVolume(powf(amplitude * m_channels[channel]->GetVolumeAtrib(), 0.2f) * m_audioVolume);
m_channels[channel]->SetLoop(bLoop); m_channels[channel]->SetLoop(bLoop);
m_channels[channel]->Play();
return channel; if (!m_channels[channel]->Play())
{
m_channels_limit = m_channels.size() - 1;
GetLogger()->Debug("Changing channel limit to %u.\n", m_channels_limit);
auto it = m_channels.find(channel);
Channel *ch = it->second;
m_channels.erase(it);
delete ch;
return -1;
}
return channel | ((m_channels[channel]->GetId() & 0xffff) << 16);
} }
bool ALSound::FlushEnvelope(int channel) bool ALSound::FlushEnvelope(int channel)
{ {
if (m_channels.find(channel) == m_channels.end()) if (!CheckChannel(channel))
{ {
return false; return false;
} }
@ -401,10 +408,7 @@ bool ALSound::FlushEnvelope(int channel)
bool ALSound::AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper) bool ALSound::AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper)
{ {
if (!m_enabled) if (!CheckChannel(channel))
return false;
if (m_channels.find(channel) == m_channels.end())
{ {
return false; return false;
} }
@ -421,40 +425,21 @@ bool ALSound::AddEnvelope(int channel, float amplitude, float frequency, float t
} }
bool ALSound::Position(int channel, Math::Vector pos) bool ALSound::Position(int channel, const Math::Vector &pos)
{ {
if (!m_enabled) if (!CheckChannel(channel))
return false;
if (m_channels.find(channel) == m_channels.end())
{ {
return false; return false;
} }
if (m_3D) m_channels[channel]->SetPosition(pos);
{
m_channels[channel]->SetPan(pos);
}
else
{
ComputeVolumePan2D(channel, pos);
if (!m_channels[channel]->HasEnvelope())
{
float volume = m_channels[channel]->GetStartAmplitude();
m_channels[channel]->SetVolume(powf(volume * m_channels[channel]->GetVolumeAtrib(), 0.2f) * m_audioVolume);
}
}
return true; return true;
} }
bool ALSound::Frequency(int channel, float frequency) bool ALSound::Frequency(int channel, float frequency)
{ {
if (!m_enabled) if (!CheckChannel(channel))
return false;
if (m_channels.find(channel) == m_channels.end())
{ {
return false; return false;
} }
@ -466,10 +451,7 @@ bool ALSound::Frequency(int channel, float frequency)
bool ALSound::Stop(int channel) bool ALSound::Stop(int channel)
{ {
if (!m_enabled) if (!CheckChannel(channel))
return false;
if (m_channels.find(channel) == m_channels.end())
{ {
return false; return false;
} }
@ -484,7 +466,9 @@ bool ALSound::Stop(int channel)
bool ALSound::StopAll() bool ALSound::StopAll()
{ {
if (!m_enabled) if (!m_enabled)
{
return false; return false;
}
for (auto channel : m_channels) for (auto channel : m_channels)
{ {
@ -499,7 +483,9 @@ bool ALSound::StopAll()
bool ALSound::MuteAll(bool bMute) bool ALSound::MuteAll(bool bMute)
{ {
if (!m_enabled) if (!m_enabled)
{
return false; return false;
}
for (auto it : m_channels) for (auto it : m_channels)
{ {
@ -509,14 +495,6 @@ bool ALSound::MuteAll(bool bMute)
} }
} }
if (bMute)
{
m_currentMusic->SetVolume(0.0f);
}
else
{
m_currentMusic->SetVolume(m_musicVolume);
}
return true; return true;
} }
@ -524,7 +502,9 @@ bool ALSound::MuteAll(bool bMute)
void ALSound::FrameMove(float delta) void ALSound::FrameMove(float delta)
{ {
if (!m_enabled) if (!m_enabled)
{
return; return;
}
float progress; float progress;
float volume, frequency; float volume, frequency;
@ -534,7 +514,6 @@ void ALSound::FrameMove(float delta)
{ {
continue; continue;
} }
if (it.second->IsMuted()) if (it.second->IsMuted())
{ {
it.second->SetVolume(0.0f); it.second->SetVolume(0.0f);
@ -582,79 +561,117 @@ void ALSound::FrameMove(float delta)
} }
} }
} }
std::list<OldMusic> toRemove;
for (auto& it : m_oldMusic)
{
if (it.currentTime >= it.fadeTime)
{
delete it.music;
toRemove.push_back(it);
}
else
{
it.currentTime += delta;
it.music->SetVolume(((it.fadeTime-it.currentTime) / it.fadeTime) * m_musicVolume);
}
}
if (m_previousMusic.fadeTime > 0.0f) {
if (m_previousMusic.currentTime >= m_previousMusic.fadeTime)
{
m_previousMusic.music->Pause();
}
else
{
m_previousMusic.currentTime += delta;
m_previousMusic.music->SetVolume(((m_previousMusic.fadeTime-m_previousMusic.currentTime) / m_previousMusic.fadeTime) * m_musicVolume);
}
}
for (auto it : toRemove)
m_oldMusic.remove(it);
} }
void ALSound::SetListener(Math::Vector eye, Math::Vector lookat) void ALSound::SetListener(const Math::Vector &eye, const Math::Vector &lookat)
{ {
m_eye = eye; m_eye = eye;
m_lookat = lookat; m_lookat = lookat;
if (m_3D) Math::Vector forward = lookat - eye;
{ forward.Normalize();
float orientation[] = {lookat.x, lookat.y, lookat.z, 0.f, 1.f, 0.f}; float orientation[] = {forward.x, forward.y, forward.z, 0.f, -1.0f, 0.0f};
alListener3f(AL_POSITION, eye.x, eye.y, eye.z);
alListenerfv(AL_ORIENTATION, orientation);
}
else
{
float orientation[] = {0.0f, 0.0f, 0.0f, 0.f, 1.f, 0.f};
alListener3f(AL_POSITION, 0.0f, 0.0f, 0.0f);
alListenerfv(AL_ORIENTATION, orientation);
// recalculate sound position alListener3f(AL_POSITION, eye.x, eye.y, eye.z);
for (auto it : m_channels) alListenerfv(AL_ORIENTATION, orientation);
{
if (it.second->IsPlaying())
{
Math::Vector pos = it.second->GetPosition();
ComputeVolumePan2D(it.first, pos);
if (!it.second->HasEnvelope())
{
float volume = it.second->GetStartAmplitude();
it.second->SetVolume(powf(volume * it.second->GetVolumeAtrib(), 0.2f) * m_audioVolume);
}
}
}
}
} }
bool ALSound::PlayMusic(int rank, bool bRepeat)
bool ALSound::PlayMusic(int rank, bool bRepeat, float fadeTime)
{ {
std::stringstream filename; std::stringstream filename;
filename << "music" << std::setfill('0') << std::setw(3) << rank << ".ogg"; filename << "music" << std::setfill('0') << std::setw(3) << rank << ".ogg";
return PlayMusic(filename.str(), bRepeat); return PlayMusic(filename.str(), bRepeat, fadeTime);
} }
bool ALSound::PlayMusic(std::string filename, bool bRepeat)
bool operator<(const OldMusic & l, const OldMusic & r)
{
return l.currentTime < r.currentTime;
}
bool operator==(const OldMusic & l, const OldMusic & r)
{
return l.currentTime == r.currentTime;
}
bool ALSound::PlayMusic(const std::string &filename, bool bRepeat, float fadeTime)
{ {
if (!m_enabled) if (!m_enabled)
{ {
return false; return false;
} }
std::stringstream file; std::string file = CGameData::GetInstancePointer()->GetFilePath(DIR_MUSIC, filename);
file << m_soundPath << "/" << filename; Buffer *buffer;
// check if we have music in cache // check if we have music in cache
if (m_music.find(filename) == m_music.end()) if (m_music.find(filename) == m_music.end())
{ {
GetLogger()->Warn("Music %s was not cached!\n", filename.c_str()); GetLogger()->Debug("Music %s was not cached!\n", filename.c_str());
if (!boost::filesystem::exists(file.str())) if (!boost::filesystem::exists(file))
{ {
GetLogger()->Warn("Requested music %s was not found.\n", filename.c_str()); GetLogger()->Debug("Requested music %s was not found.\n", filename.c_str());
return false; return false;
} }
Buffer *buffer = new Buffer();
buffer->LoadFromFile(file.str(), static_cast<Sound>(-1)); buffer = new Buffer();
m_currentMusic->SetBuffer(buffer); if (!buffer->LoadFromFile(file, static_cast<Sound>(-1)))
{
return false;
}
m_music[filename] = buffer;
} }
else else
{ {
GetLogger()->Debug("Music loaded from cache\n"); GetLogger()->Debug("Music loaded from cache\n");
m_currentMusic->SetBuffer(m_music[filename]); buffer = m_music[filename];
} }
if (m_currentMusic)
{
OldMusic old;
old.music = m_currentMusic;
old.fadeTime = fadeTime;
old.currentTime = 0.0f;
m_oldMusic.push_back(old);
}
m_currentMusic = new Channel();
m_currentMusic->SetBuffer(buffer);
m_currentMusic->SetVolume(m_musicVolume); m_currentMusic->SetVolume(m_musicVolume);
m_currentMusic->SetLoop(bRepeat); m_currentMusic->SetLoop(bRepeat);
m_currentMusic->Play(); m_currentMusic->Play();
@ -663,6 +680,55 @@ bool ALSound::PlayMusic(std::string filename, bool bRepeat)
} }
bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat)
{
if (m_previousMusic.fadeTime > 0.0f)
{
if(m_currentMusic)
{
OldMusic old;
old.music = m_currentMusic;
old.fadeTime = 2.0f;
old.currentTime = 0.0f;
m_oldMusic.push_back(old);
m_currentMusic = nullptr;
}
}
else
{
if (m_currentMusic)
{
m_previousMusic.music = m_currentMusic;
m_previousMusic.fadeTime = 2.0f;
m_previousMusic.currentTime = 0.0f;
m_currentMusic = nullptr;
}
}
return PlayMusic(filename, repeat);
}
void ALSound::StopPauseMusic()
{
if (m_previousMusic.fadeTime > 0.0f)
{
StopMusic();
m_currentMusic = m_previousMusic.music;
m_previousMusic.music = nullptr;
if(m_currentMusic != nullptr)
{
m_currentMusic->SetVolume(m_musicVolume);
if(m_previousMusic.currentTime >= m_previousMusic.fadeTime)
{
m_currentMusic->Play();
}
}
m_previousMusic.fadeTime = 0.0f;
}
}
bool ALSound::RestartMusic() bool ALSound::RestartMusic()
{ {
if (!m_enabled || !m_currentMusic) if (!m_enabled || !m_currentMusic)
@ -675,14 +741,21 @@ bool ALSound::RestartMusic()
return true; return true;
} }
void ALSound::StopMusic()
void ALSound::StopMusic(float fadeTime)
{ {
if (!m_enabled || !m_currentMusic) if (!m_enabled || !m_currentMusic)
{ {
return; return;
} }
SuspendMusic(); OldMusic old;
old.music = m_currentMusic;
old.fadeTime = fadeTime;
old.currentTime = 0.0f;
m_oldMusic.push_back(old);
m_currentMusic = nullptr;
} }
@ -708,64 +781,30 @@ void ALSound::SuspendMusic()
} }
void ALSound::ComputeVolumePan2D(int channel, Math::Vector &pos) bool ALSound::CheckChannel(int &channel)
{ {
float dist, a, g; int id = (channel >> 16) & 0xffff;
m_channels[channel]->SetPosition(pos); channel &= 0xffff;
if (VectorsEqual(pos, m_eye)) if (!m_enabled)
{ {
m_channels[channel]->SetVolumeAtrib(1.0f); // maximum volume return false;
m_channels[channel]->SetPan(Math::Vector()); // at the center
return;
} }
dist = Distance(pos, m_eye); if (m_channels.find(channel) == m_channels.end())
if ( dist >= 110.0f ) // very far?
{ {
m_channels[channel]->SetVolumeAtrib(0.0f); // silence return false;
m_channels[channel]->SetPan(Math::Vector()); // at the center
return;
}
else if ( dist <= 10.0f ) // very close?
{
m_channels[channel]->SetVolumeAtrib(1.0f); // maximum volume
m_channels[channel]->SetPan(Math::Vector()); // at the center
return;
}
m_channels[channel]->SetVolumeAtrib(1.0f - ((dist - 10.0f) / 100.0f));
Math::Vector one = Math::Vector(1.0f, 0.0f, 0.0f);
float angle_a = Angle(Math::Vector(m_lookat.x - m_eye.x, m_lookat.z - m_eye.z, 0.0f), one);
float angle_g = Angle(Math::Vector(pos.x - m_eye.x, pos.z - m_eye.z, 0.0f), one);
a = fmodf(angle_a, Math::PI * 2.0f);
g = fmodf(angle_g, Math::PI * 2.0f);
if ( a < 0.0f )
{
a += Math::PI * 2.0f;
}
if ( g < 0.0f )
{
g += Math::PI * 2.0f;
} }
if ( a < g ) if (m_audioVolume == 0)
{ {
if (a + Math::PI * 2.0f - g < g - a ) return false;
{
a += Math::PI * 2.0f;
}
}
else
{
if ( g + Math::PI * 2.0f - a < a - g )
{
g += Math::PI * 2.0f;
}
} }
m_channels[channel]->SetPan( Math::Vector(0.0f, 0.0f, sinf(g - a)) ); if (m_channels[channel]->GetId() != id)
{
return false;
}
return true;
} }

View File

@ -31,73 +31,75 @@
#include <map> #include <map>
#include <string> #include <string>
#include <list>
#include <al.h> #include <al.h>
struct OldMusic {
Channel* music;
float fadeTime;
float currentTime;
};
class ALSound : public CSoundInterface class ALSound : public CSoundInterface
{ {
public: public:
ALSound(); ALSound();
~ALSound(); ~ALSound();
bool Create(bool b3D); bool Create();
bool Cache(Sound, std::string); bool Cache(Sound, const std::string &);
bool CacheMusic(std::string); bool CacheMusic(const std::string &);
bool GetEnable(); bool GetEnable();
void SetSound3D(bool bMode);
bool GetSound3D();
bool GetSound3DCap();
void SetAudioVolume(int volume); void SetAudioVolume(int volume);
int GetAudioVolume(); int GetAudioVolume();
void SetMusicVolume(int volume); void SetMusicVolume(int volume);
int GetMusicVolume(); int GetMusicVolume();
void SetListener(Math::Vector eye, Math::Vector lookat); void SetListener(const Math::Vector &eye, const Math::Vector &lookat);
void FrameMove(float rTime); void FrameMove(float rTime);
int Play(Sound sound, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false); int Play(Sound sound, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false);
int Play(Sound sound, Math::Vector pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false); int Play(Sound sound, const Math::Vector &pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false);
bool FlushEnvelope(int channel); bool FlushEnvelope(int channel);
bool AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper); bool AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper);
bool Position(int channel, Math::Vector pos); bool Position(int channel, const Math::Vector &pos);
bool Frequency(int channel, float frequency); bool Frequency(int channel, float frequency);
bool Stop(int channel); bool Stop(int channel);
bool StopAll(); bool StopAll();
bool MuteAll(bool bMute); bool MuteAll(bool bMute);
bool PlayMusic(int rank, bool bRepeat); bool PlayMusic(int rank, bool bRepeat, float fadeTime=2.0f);
bool PlayMusic(std::string filename, bool bRepeat); bool PlayMusic(const std::string &filename, bool bRepeat, float fadeTime=2.0f);
bool RestartMusic(); bool RestartMusic();
void SuspendMusic(); void SuspendMusic();
void StopMusic(); void StopMusic(float fadeTime=2.0f);
bool IsPlayingMusic(); bool IsPlayingMusic();
bool PlayPauseMusic(const std::string &filename, bool repeat);
void StopPauseMusic();
// plugin interface bool CheckChannel(int &channel);
std::string PluginName();
int PluginVersion();
void InstallPlugin();
bool UninstallPlugin(std::string &);
private: private:
void CleanUp(); void CleanUp();
int GetPriority(Sound); int GetPriority(Sound);
bool SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded); bool SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded);
void ComputeVolumePan2D(int channel, Math::Vector &pos);
bool m_enabled; bool m_enabled;
bool m_3D;
float m_audioVolume; float m_audioVolume;
float m_musicVolume; float m_musicVolume;
unsigned int m_channels_limit;
ALCdevice* m_device; ALCdevice* m_device;
ALCcontext* m_context; ALCcontext* m_context;
std::map<Sound, Buffer*> m_sounds; std::map<Sound, Buffer*> m_sounds;
std::map<std::string, Buffer*> m_music; std::map<std::string, Buffer*> m_music;
std::map<int, Channel*> m_channels; std::map<int, Channel*> m_channels;
Channel *m_currentMusic; Channel *m_currentMusic;
std::list<OldMusic> m_oldMusic;
OldMusic m_previousMusic;
Math::Vector m_eye; Math::Vector m_eye;
Math::Vector m_lookat; Math::Vector m_lookat;
}; };

View File

@ -32,7 +32,7 @@ Buffer::~Buffer()
{ {
alDeleteBuffers(1, &m_buffer); alDeleteBuffers(1, &m_buffer);
if (alCheck()) if (alCheck())
GetLogger()->Warn("Failed to unload buffer. Code %d\n", alGetCode()); GetLogger()->Debug("Failed to unload buffer. Code %d\n", alGetCode());
} }
} }

View File

@ -23,7 +23,7 @@ Channel::Channel()
if (alCheck()) if (alCheck())
{ {
GetLogger()->Warn("Failed to create sound source. Code: %d\n", alGetCode()); GetLogger()->Debug("Failed to create sound source. Code: %d\n", alGetCode());
m_ready = false; m_ready = false;
} }
else else
@ -40,6 +40,7 @@ Channel::Channel()
m_startFrequency = 0.0f; m_startFrequency = 0.0f;
m_changeFrequency = 0.0f; m_changeFrequency = 0.0f;
m_volume = 0.0f; m_volume = 0.0f;
m_id = 0;
} }
@ -51,7 +52,7 @@ Channel::~Channel()
alSourcei(m_source, AL_BUFFER, 0); alSourcei(m_source, AL_BUFFER, 0);
alDeleteSources(1, &m_source); alDeleteSources(1, &m_source);
if (alCheck()) if (alCheck())
GetLogger()->Warn("Failed to delete sound source. Code: %d\n", alGetCode()); GetLogger()->Debug("Failed to delete sound source. Code: %d\n", alGetCode());
} }
} }
@ -69,13 +70,28 @@ bool Channel::Play()
alSourcePlay(m_source); alSourcePlay(m_source);
if (alCheck()) if (alCheck())
{ {
GetLogger()->Warn("Could not play audio sound source. Code: %d\n", alGetCode()); GetLogger()->Debug("Could not play audio sound source. Code: %d\n", alGetCode());
}
return true;
}
bool Channel::Pause()
{
if(!m_ready || !IsPlaying())
{
return false;
}
alSourcePause(m_source);
if (alCheck())
{
GetLogger()->Debug("Could not pause audio sound source. Code: %d\n", alGetCode());
} }
return true; return true;
} }
bool Channel::SetPan(Math::Vector pos) bool Channel::SetPosition(const Math::Vector &pos)
{ {
if (!m_ready || m_buffer == nullptr) if (!m_ready || m_buffer == nullptr)
{ {
@ -85,25 +101,13 @@ bool Channel::SetPan(Math::Vector pos)
alSource3f(m_source, AL_POSITION, pos.x, pos.y, pos.z); alSource3f(m_source, AL_POSITION, pos.x, pos.y, pos.z);
if (alCheck()) if (alCheck())
{ {
GetLogger()->Warn("Could not set sound position. Code: %d\n", alGetCode()); GetLogger()->Debug("Could not set sound position. Code: %d\n", alGetCode());
return false; return false;
} }
return true; return true;
} }
void Channel::SetPosition(Math::Vector pos)
{
m_position = pos;
}
Math::Vector Channel::GetPosition()
{
return m_position;
}
bool Channel::SetFrequency(float freq) bool Channel::SetFrequency(float freq)
{ {
if (!m_ready || m_buffer == nullptr) if (!m_ready || m_buffer == nullptr)
@ -114,7 +118,7 @@ bool Channel::SetFrequency(float freq)
alSourcef(m_source, AL_PITCH, freq); alSourcef(m_source, AL_PITCH, freq);
if (alCheck()) if (alCheck())
{ {
GetLogger()->Warn("Could not set sound pitch to '%f'. Code: %d\n", freq, alGetCode()); GetLogger()->Debug("Could not set sound pitch to '%f'. Code: %d\n", freq, alGetCode());
return false; return false;
} }
return true; return true;
@ -132,7 +136,7 @@ float Channel::GetFrequency()
alGetSourcef(m_source, AL_PITCH, &freq); alGetSourcef(m_source, AL_PITCH, &freq);
if (alCheck()) if (alCheck())
{ {
GetLogger()->Warn("Could not get sound pitch. Code: %d\n", alGetCode()); GetLogger()->Debug("Could not get sound pitch. Code: %d\n", alGetCode());
return 0; return 0;
} }
@ -150,7 +154,7 @@ bool Channel::SetVolume(float vol)
alSourcef(m_source, AL_GAIN, vol); alSourcef(m_source, AL_GAIN, vol);
if (alCheck()) if (alCheck())
{ {
GetLogger()->Warn("Could not set sound volume to '%f'. Code: %d\n", vol, alGetCode()); GetLogger()->Debug("Could not set sound volume to '%f'. Code: %d\n", vol, alGetCode());
return false; return false;
} }
return true; return true;
@ -168,7 +172,7 @@ float Channel::GetVolume()
alGetSourcef(m_source, AL_GAIN, &vol); alGetSourcef(m_source, AL_GAIN, &vol);
if (alCheck()) if (alCheck())
{ {
GetLogger()->Warn("Could not get sound volume. Code: %d\n", alGetCode()); GetLogger()->Debug("Could not get sound volume. Code: %d\n", alGetCode());
return 0; return 0;
} }
@ -431,3 +435,15 @@ bool Channel::IsMuted()
return m_mute; return m_mute;
} }
void Channel::Reset()
{
m_id++;
}
int Channel::GetId()
{
return m_id;
}

View File

@ -50,11 +50,10 @@ public:
~Channel(); ~Channel();
bool Play(); bool Play();
bool Pause();
bool Stop(); bool Stop();
bool SetPan(Math::Vector); bool SetPosition(const Math::Vector &);
void SetPosition(Math::Vector);
Math::Vector GetPosition();
bool SetFrequency(float); bool SetFrequency(float);
float GetFrequency(); float GetFrequency();
@ -98,11 +97,15 @@ public:
void Mute(bool); void Mute(bool);
bool IsMuted(); bool IsMuted();
void Reset();
int GetId();
private: private:
Buffer *m_buffer; Buffer *m_buffer;
ALuint m_source; ALuint m_source;
int m_priority; int m_priority;
int m_id;
float m_startAmplitude; float m_startAmplitude;
float m_startFrequency; float m_startFrequency;
float m_changeFrequency; float m_changeFrequency;

View File

@ -36,37 +36,36 @@ CSoundInterface::~CSoundInterface()
{ {
} }
bool CSoundInterface::Create(bool b3D) bool CSoundInterface::Create()
{ {
return true; return true;
} }
void CSoundInterface::CacheAll(std::string path) void CSoundInterface::CacheAll()
{ {
for ( int i = 1; i < SOUND_MAX; i++ ) for ( int i = 1; i < SOUND_MAX; i++ )
{ {
std::stringstream filename; std::stringstream filename;
filename << path << "/sound" << std::setfill('0') << std::setw(3) << i << ".wav"; filename << "sound" << std::setfill('0') << std::setw(3) << i << ".wav";
if ( !Cache(static_cast<Sound>(i), filename.str()) ) if ( !Cache(static_cast<Sound>(i), filename.str()) )
GetLogger()->Warn("Unable to load audio: %s\n", filename.str().c_str()); GetLogger()->Warn("Unable to load audio: %s\n", filename.str().c_str());
} }
} }
void CSoundInterface::AddMusicFiles(std::string path) void CSoundInterface::AddMusicFiles()
{ {
m_soundPath = path;
CacheMusic("Intro1.ogg"); CacheMusic("Intro1.ogg");
CacheMusic("Intro2.ogg"); CacheMusic("Intro2.ogg");
CacheMusic("music010.ogg"); CacheMusic("music010.ogg");
CacheMusic("music011.ogg"); CacheMusic("music011.ogg");
} }
bool CSoundInterface::Cache(Sound bSound, std::string bFile) bool CSoundInterface::Cache(Sound bSound, const std::string &bFile)
{ {
return true; return true;
} }
bool CSoundInterface::CacheMusic(std::string bFile) bool CSoundInterface::CacheMusic(const std::string &bFile)
{ {
return true; return true;
} }
@ -76,20 +75,6 @@ bool CSoundInterface::GetEnable()
return true; return true;
} }
void CSoundInterface::SetSound3D(bool bMode)
{
}
bool CSoundInterface::GetSound3D()
{
return true;
}
bool CSoundInterface::GetSound3DCap()
{
return true;
}
void CSoundInterface::SetAudioVolume(int volume) void CSoundInterface::SetAudioVolume(int volume)
{ {
} }
@ -108,7 +93,7 @@ int CSoundInterface::GetMusicVolume()
return 0; return 0;
} }
void CSoundInterface::SetListener(Math::Vector eye, Math::Vector lookat) void CSoundInterface::SetListener(const Math::Vector &eye, const Math::Vector &lookat)
{ {
} }
@ -121,7 +106,7 @@ int CSoundInterface::Play(Sound sound, float amplitude, float frequency, bool bL
return 0; return 0;
} }
int CSoundInterface::Play(Sound sound, Math::Vector pos, float amplitude, float frequency, bool bLoop) int CSoundInterface::Play(Sound sound, const Math::Vector &pos, float amplitude, float frequency, bool bLoop)
{ {
return 0; return 0;
} }
@ -136,7 +121,7 @@ bool CSoundInterface::AddEnvelope(int channel, float amplitude, float frequency,
return true; return true;
} }
bool CSoundInterface::Position(int channel, Math::Vector pos) bool CSoundInterface::Position(int channel, const Math::Vector &pos)
{ {
return true; return true;
} }
@ -161,12 +146,12 @@ bool CSoundInterface::MuteAll(bool bMute)
return true; return true;
} }
bool CSoundInterface::PlayMusic(int rank, bool bRepeat) bool CSoundInterface::PlayMusic(int rank, bool bRepeat, float fadeTime)
{ {
return true; return true;
} }
bool CSoundInterface::PlayMusic(std::string filename, bool bRepeat) bool CSoundInterface::PlayMusic(const std::string &filename, bool bRepeat, float fadeTime)
{ {
return true; return true;
} }
@ -180,7 +165,7 @@ void CSoundInterface::SuspendMusic()
{ {
} }
void CSoundInterface::StopMusic() void CSoundInterface::StopMusic(float fadeTime)
{ {
} }
@ -189,3 +174,11 @@ bool CSoundInterface::IsPlayingMusic()
return true; return true;
} }
bool CSoundInterface::PlayPauseMusic(const std::string &filename, bool repeat)
{
return true;
}
void CSoundInterface::StopPauseMusic()
{
}

View File

@ -153,17 +153,16 @@ public:
virtual ~CSoundInterface(); virtual ~CSoundInterface();
/** Function to initialize sound device /** Function to initialize sound device
* \param b3D - enable support for 3D sound
*/ */
virtual bool Create(bool b3D); virtual bool Create();
/** Function called to cache all sound effect files. /** Function called to cache all sound effect files.
* Function calls \link CSoundInterface::Cache() \endlink for each file * Function calls \link CSoundInterface::Cache() \endlink for each file
*/ */
void CacheAll(std::string path); void CacheAll();
/** Function called to add all music files to list */ /** Function called to add all music files to list */
void AddMusicFiles(std::string path); void AddMusicFiles();
/** Function called to cache sound effect file. /** Function called to cache sound effect file.
* This function is called by plugin interface for each file. * This function is called by plugin interface for each file.
@ -171,35 +170,20 @@ public:
* \param bFile - file to load * \param bFile - file to load
* \return return true on success * \return return true on success
*/ */
virtual bool Cache(Sound bSound, std::string bFile); virtual bool Cache(Sound bSound, const std::string &bFile);
/** Function called to cache music file. /** Function called to cache music file.
* This function is called by CRobotMain for each file used in the mission. * This function is called by CRobotMain for each file used in the mission.
* \param bFile - file to load * \param bFile - file to load
* \return return true on success * \return return true on success
*/ */
virtual bool CacheMusic(std::string bFile); virtual bool CacheMusic(const std::string &bFile);
/** Return if plugin is enabled /** Return if plugin is enabled
* \return return true if plugin is enabled * \return return true if plugin is enabled
*/ */
virtual bool GetEnable(); virtual bool GetEnable();
/** Change sound mode to 2D/3D
* \param bMode - true to enable 3D sound
*/
virtual void SetSound3D(bool bMode);
/** Return if we use 3D sound
* \return true if we have 3D sound enabled
*/
virtual bool GetSound3D();
/** Return if we have 3D sound capable card
* \return true for 3D sound support
*/
virtual bool GetSound3DCap();
/** Change global sound volume /** Change global sound volume
* \param volume - range from 0 to MAXVOLUME * \param volume - range from 0 to MAXVOLUME
*/ */
@ -224,7 +208,7 @@ public:
* \param eye - position of listener * \param eye - position of listener
* \param lookat - direction listener is looking at * \param lookat - direction listener is looking at
*/ */
virtual void SetListener(Math::Vector eye, Math::Vector lookat); virtual void SetListener(const Math::Vector &eye, const Math::Vector &lookat);
/** Update data each frame /** Update data each frame
* \param rTime - time since last update * \param rTime - time since last update
@ -248,7 +232,7 @@ public:
* \param bLoop - loop sound * \param bLoop - loop sound
* \return identifier of channel that sound will be played on * \return identifier of channel that sound will be played on
*/ */
virtual int Play(Sound sound, Math::Vector pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false); virtual int Play(Sound sound, const Math::Vector &pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false);
/** Remove all operations that would be made on sound in channel. /** Remove all operations that would be made on sound in channel.
* \param channel - channel to work on * \param channel - channel to work on
@ -271,7 +255,7 @@ public:
* \param pos - new positino of a sound * \param pos - new positino of a sound
* \return return true on success * \return return true on success
*/ */
virtual bool Position(int channel, Math::Vector pos); virtual bool Position(int channel, const Math::Vector &pos);
/** Set sound frequency /** Set sound frequency
* \param channel - channel to work on * \param channel - channel to work on
@ -300,38 +284,48 @@ public:
/** Start playing music /** Start playing music
* \param rank - track number * \param rank - track number
* \param bRepeat - repeat playing * \param bRepeat - repeat playing
* \param fadeTime - time of transition between music
* \return return true on success * \return return true on success
*/ */
virtual bool PlayMusic(int rank, bool bRepeat); virtual bool PlayMusic(int rank, bool bRepeat, float fadeTime=2.0f);
/** Start playing music /** Start playing music
* \param filename - name of file to play * \param filename - name of file to play
* \param bRepeat - repeat playing * \param bRepeat - repeat playing
* \param fadeTime - time of transition between music
* \return return true on success * \return return true on success
*/ */
virtual bool PlayMusic(std::string filename, bool bRepeat); virtual bool PlayMusic(const std::string &filename, bool bRepeat, float fadeTime=2.0f);
/** Restart music /** Restart music
* @return return true on success * \return return true on success
*/ */
virtual bool RestartMusic(); virtual bool RestartMusic();
/** Susspend paying music /** Susspend playing music
* \return return true on success * \return nothing
*/ */
virtual void SuspendMusic(); virtual void SuspendMusic();
/** Stop playing music /** Stop playing music
* \return return true on success * \return nothing
*/ */
virtual void StopMusic(); virtual void StopMusic(float fadeTime=2.0f);
/** Check if music if playing /** Check if music if playing
* \return return true if music is playing * \return return true if music is playing
*/ */
virtual bool IsPlayingMusic(); virtual bool IsPlayingMusic();
protected: /** Start playing pause music
std::string m_soundPath; * \param filename - name of file to play
* \return return true on success
*/
virtual bool PlayPauseMusic(const std::string &filename, bool repeat);
/** Stop playing pause music and return to the mission music
* \return nothing
*/
virtual void StopPauseMusic();
}; };

View File

@ -60,12 +60,7 @@ bool CButton::Create(Math::Point pos, Math::Point dim, int icon, EventType event
if ( icon == -1 ) if ( icon == -1 )
{ {
char name[100]; std::string name = GetResourceName(eventType);
char* p;
GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name); SetName(name);
} }

View File

@ -47,16 +47,11 @@ CCheck::~CCheck()
bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{ {
char name[100];
char* p;
if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType(); if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventType); CControl::Create(pos, dim, icon, eventType);
GetResource(RES_EVENT, eventType, name); std::string name = GetResourceName(eventType);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name); SetName(name);
return true; return true;

View File

@ -64,12 +64,7 @@ bool CColor::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT
if ( icon == -1 ) if ( icon == -1 )
{ {
char name[100]; std::string name = GetResourceName(eventType);
char* p;
GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name); SetName(name);
} }
@ -146,38 +141,7 @@ void CColor::Draw()
m_engine->SetTexture("button1.png"); m_engine->SetTexture("button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
CControl::Draw(); CControl::Draw();
#if _TEEN
// color = GetColor(m_color);
color = GetColor();
m_engine->SetTexture(""); // no texture
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
device = m_engine->GetDevice();
p1.x = m_pos.x + (4.0f / 640.0f);
p1.y = m_pos.y + (4.0f / 480.0f);
p2.x = m_pos.x + m_dim.x - (4.0f / 640.0f);
p2.y = m_pos.y + m_dim.y - (4.0f / 480.0f);
vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
p1.x = m_pos.x + (5.0f / 640.0f);
p1.y = m_pos.y + (5.0f / 480.0f);
p2.x = m_pos.x + m_dim.x - (5.0f / 640.0f);
p2.y = m_pos.y + m_dim.y - (5.0f / 480.0f);
vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(4);
#else
p1.x = m_pos.x + (3.0f / 640.0f); p1.x = m_pos.x + (3.0f / 640.0f);
p1.y = m_pos.y + (3.0f / 480.0f); p1.y = m_pos.y + (3.0f / 480.0f);
p2.x = m_pos.x + m_dim.x - (3.0f / 640.0f); p2.x = m_pos.x + m_dim.x - (3.0f / 640.0f);
@ -196,7 +160,6 @@ void CColor::Draw()
device = m_engine->GetDevice(); device = m_engine->GetDevice();
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4); device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2); m_engine->AddStatisticTriangle(2);
#endif
} }

View File

@ -57,9 +57,6 @@ CControl::~CControl()
bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{ {
char text[200];
std::string str_text;
if ( eventType == EVENT_NULL ) if ( eventType == EVENT_NULL )
eventType = GetUniqueEventType(); eventType = GetUniqueEventType();
@ -72,17 +69,17 @@ bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType even
pos.y = m_pos.y + m_dim.y; pos.y = m_pos.y + m_dim.y;
GlintCreate(pos); GlintCreate(pos);
std::string text;
GetResource(RES_EVENT, m_eventType, text); GetResource(RES_EVENT, m_eventType, text);
str_text = std::string(text); auto p = text.find("\\");
auto p = str_text.find("\\"); if (p == std::string::npos)
if ( p == std::string::npos )
{ {
if ( icon != -1 ) if ( icon != -1 )
m_tooltip = str_text; m_tooltip = text;
} }
else else
{ {
m_tooltip = str_text.substr(p + 1); m_tooltip = text.substr(p + 1);
} }
return true; return true;
@ -509,11 +506,7 @@ void CControl::Draw()
if ( icon >= 192 ) if ( icon >= 192 )
{ {
icon -= 192; icon -= 192;
#if _POLISH
m_engine->SetTexture("textp.png");
#else
m_engine->SetTexture("text.png"); m_engine->SetTexture("text.png");
#endif
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
} }
else if ( icon >= 128 ) else if ( icon >= 128 )
@ -837,5 +830,18 @@ bool CControl::Detect(Math::Point pos)
pos.y <= m_pos.y + m_dim.y ); pos.y <= m_pos.y + m_dim.y );
} }
std::string CControl::GetResourceName(EventType eventType)
{
std::string name;
GetResource(RES_EVENT, eventType, name);
auto index = name.find('\\');
if (index != std::string::npos)
{
name = name.substr(0, index);
}
return name;
}
} }

View File

@ -112,6 +112,8 @@ protected:
void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f); void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f);
virtual bool Detect(Math::Point pos); virtual bool Detect(Math::Point pos);
std::string GetResourceName(EventType eventType);
protected: protected:
Gfx::CEngine* m_engine; Gfx::CEngine* m_engine;
Gfx::CParticle* m_particle; Gfx::CParticle* m_particle;

View File

@ -23,6 +23,7 @@
#include "common/iman.h" #include "common/iman.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/restext.h" #include "common/restext.h"
#include "common/stringutils.h"
#include "graphics/core/light.h" #include "graphics/core/light.h"
#include "graphics/engine/engine.h" #include "graphics/engine/engine.h"
@ -58,6 +59,7 @@ CDisplayInfo::CDisplayInfo()
m_main = CRobotMain::GetInstancePointer(); m_main = CRobotMain::GetInstancePointer();
m_interface = m_main->GetInterface(); m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera(); m_camera = m_main->GetCamera();
m_pause = CPauseManager::GetInstancePointer();
m_bInfoMaximized = true; m_bInfoMaximized = true;
m_bInfoMinimized = false; m_bInfoMinimized = false;
@ -329,13 +331,13 @@ void CDisplayInfo::HyperUpdate()
void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluce) void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluce)
{ {
Gfx::Light light; Gfx::Light light;
Math::Point pos, dim; Math::Point pos, dim;
Ui::CWindow* pw; Ui::CWindow* pw;
Ui::CEdit* edit; Ui::CEdit* edit;
Ui::CButton* button; Ui::CButton* button;
Ui::CSlider* slider; Ui::CSlider* slider;
CMotionToto* toto; CMotionToto* toto;
m_index = index; m_index = index;
m_bSoluce = bSoluce; m_bSoluce = bSoluce;
@ -354,8 +356,8 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
m_main->SetEditLock(true, false); m_main->SetEditLock(true, false);
m_main->SetEditFull(false); m_main->SetEditFull(false);
m_bInitPause = m_engine->GetPause(); m_bInitPause = m_pause->GetPauseType();
m_engine->SetPause(true); m_pause->SetPause(PAUSE_SATCOM);
m_infoCamera = m_camera->GetType(); m_infoCamera = m_camera->GetType();
m_camera->SetType(Gfx::CAM_TYPE_INFO); m_camera->SetType(Gfx::CAM_TYPE_INFO);
@ -388,13 +390,7 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
button = pw->CreateButton(pos, dim, 128+57, EVENT_SATCOM_HUSTON); button = pw->CreateButton(pos, dim, 128+57, EVENT_SATCOM_HUSTON);
button->SetState(STATE_SHADOW); button->SetState(STATE_SHADOW);
#if _TEEN
#if !_ENGLISH
button = pw->CreateButton(pos, dim, 46, EVENT_SATCOM_SAT);
#endif
#else
button = pw->CreateButton(pos, dim, 128+58, EVENT_SATCOM_SAT); button = pw->CreateButton(pos, dim, 128+58, EVENT_SATCOM_SAT);
#endif
button->SetState(STATE_SHADOW); button->SetState(STATE_SHADOW);
//? button = pw->CreateButton(pos, dim, 128+59, EVENT_SATCOM_OBJECT); //? button = pw->CreateButton(pos, dim, 128+59, EVENT_SATCOM_OBJECT);
//? button->SetState(STATE_SHADOW); //? button->SetState(STATE_SHADOW);
@ -838,7 +834,7 @@ void CDisplayInfo::StopDisplayInfo()
} }
else else
{ {
if ( !m_bInitPause ) m_engine->SetPause(false); m_pause->SetPause(m_bInitPause);
m_main->SetEditLock(false, false); m_main->SetEditLock(false, false);
} }
m_camera->SetType(m_infoCamera); m_camera->SetType(m_infoCamera);
@ -971,31 +967,41 @@ void ObjectAdd(ObjectList list[], ObjectType type)
void ObjectWrite(FILE* file, ObjectList list[], int i) void ObjectWrite(FILE* file, ObjectList list[], int i)
{ {
char line[100]; std::string line;
char res[100];
char* p;
if ( list[i].total < 10 ) if ( list[i].total < 10 )
{ {
sprintf(line, "\\c; %dx \\n;\\l;", list[i].total); line = StrUtils::Format("\\c; %dx \\n;\\l;", list[i].total);
} }
else else
{ {
sprintf(line, "\\c;%dx \\n;\\l;", list[i].total); line = StrUtils::Format("\\c;%dx \\n;\\l;", list[i].total);
} }
std::string res;
GetResource(RES_OBJECT, list[i].type, res); GetResource(RES_OBJECT, list[i].type, res);
if ( res[0] == 0 ) return; if (res.empty())
strcat(line, res); return;
strcat(line, "\\u "); line += res;
p = const_cast<char*>(GetHelpFilename(list[i].type).c_str());
if ( p[0] == 0 ) return; line += "\\u ";
strcat(line, p+7); // skip "help\?\"
p = strstr(line, ".txt"); std::string helpFilename = GetHelpFilename(list[i].type);
if ( p != 0 ) *p = 0; if (helpFilename.empty())
strcat(line, ";\n"); return;
fputs(line, file);
line += helpFilename.substr(7); // skip "help\?\"
auto pos = line.find(".txt");
if (pos != std::string::npos)
{
line = line.substr(0, pos);
}
line += ";\n";
fputs(line.c_str(), file);
} }
// Creates the file containing the list of objects. // Creates the file containing the list of objects.
@ -1006,7 +1012,7 @@ void CDisplayInfo::CreateObjectsFile()
CObject* pObj; CObject* pObj;
ObjectType type; ObjectType type;
ObjectList list[200]; ObjectList list[200];
char line[100]; std::string line;
int i; int i;
bool bRadar, bAtLeast; bool bRadar, bAtLeast;
@ -1038,7 +1044,7 @@ void CDisplayInfo::CreateObjectsFile()
if ( bRadar ) if ( bRadar )
{ {
GetResource(RES_TEXT, RT_SATCOM_LIST, line); GetResource(RES_TEXT, RT_SATCOM_LIST, line);
fputs(line, file); fputs(line.c_str(), file);
bAtLeast = false; bAtLeast = false;
for ( i=0 ; i<200 ; i++ ) for ( i=0 ; i<200 ; i++ )
{ {
@ -1054,13 +1060,12 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast ) if ( !bAtLeast )
{ {
GetResource(RES_TEXT, RT_SATCOM_NULL, line); GetResource(RES_TEXT, RT_SATCOM_NULL, line);
fputs(line, file); fputs(line.c_str(), file);
} }
strcpy(line, "\n"); fputs("\n", file);
fputs(line, file);
GetResource(RES_TEXT, RT_SATCOM_BOT, line); GetResource(RES_TEXT, RT_SATCOM_BOT, line);
fputs(line, file); fputs(line.c_str(), file);
bAtLeast = false; bAtLeast = false;
for ( i=0 ; i<200 ; i++ ) for ( i=0 ; i<200 ; i++ )
{ {
@ -1101,13 +1106,12 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast ) if ( !bAtLeast )
{ {
GetResource(RES_TEXT, RT_SATCOM_NULL, line); GetResource(RES_TEXT, RT_SATCOM_NULL, line);
fputs(line, file); fputs(line.c_str(), file);
} }
strcpy(line, "\n"); fputs("\n", file);
fputs(line, file);
GetResource(RES_TEXT, RT_SATCOM_BUILDING, line); GetResource(RES_TEXT, RT_SATCOM_BUILDING, line);
fputs(line, file); fputs(line.c_str(), file);
bAtLeast = false; bAtLeast = false;
for ( i=0 ; i<200 ; i++ ) for ( i=0 ; i<200 ; i++ )
{ {
@ -1142,13 +1146,12 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast ) if ( !bAtLeast )
{ {
GetResource(RES_TEXT, RT_SATCOM_NULL, line); GetResource(RES_TEXT, RT_SATCOM_NULL, line);
fputs(line, file); fputs(line.c_str(), file);
} }
strcpy(line, "\n"); fputs("\n", file);
fputs(line, file);
GetResource(RES_TEXT, RT_SATCOM_FRET, line); GetResource(RES_TEXT, RT_SATCOM_FRET, line);
fputs(line, file); fputs(line.c_str(), file);
bAtLeast = false; bAtLeast = false;
for ( i=0 ; i<200 ; i++ ) for ( i=0 ; i<200 ; i++ )
{ {
@ -1170,13 +1173,12 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast ) if ( !bAtLeast )
{ {
GetResource(RES_TEXT, RT_SATCOM_NULL, line); GetResource(RES_TEXT, RT_SATCOM_NULL, line);
fputs(line, file); fputs(line.c_str(), file);
} }
strcpy(line, "\n"); fputs("\n", file);
fputs(line, file);
GetResource(RES_TEXT, RT_SATCOM_ALIEN, line); GetResource(RES_TEXT, RT_SATCOM_ALIEN, line);
fputs(line, file); fputs(line.c_str(), file);
bAtLeast = false; bAtLeast = false;
for ( i=0 ; i<200 ; i++ ) for ( i=0 ; i<200 ; i++ )
{ {
@ -1195,19 +1197,18 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast ) if ( !bAtLeast )
{ {
GetResource(RES_TEXT, RT_SATCOM_NULL, line); GetResource(RES_TEXT, RT_SATCOM_NULL, line);
fputs(line, file); fputs(line.c_str(), file);
} }
} }
else else
{ {
GetResource(RES_TEXT, RT_SATCOM_ERROR1, line); GetResource(RES_TEXT, RT_SATCOM_ERROR1, line);
fputs(line, file); fputs(line.c_str(), file);
GetResource(RES_TEXT, RT_SATCOM_ERROR2, line); GetResource(RES_TEXT, RT_SATCOM_ERROR2, line);
fputs(line, file); fputs(line.c_str(), file);
} }
strcpy(line, "\n"); fputs("\n", file);
fputs(line, file);
fclose(file); fclose(file);
} }

View File

@ -25,6 +25,8 @@
#include "graphics/engine/camera.h" #include "graphics/engine/camera.h"
#include "app/pausemanager.h"
class CRobotMain; class CRobotMain;
class CObject; class CObject;
class CEventQueue; class CEventQueue;
@ -67,13 +69,14 @@ protected:
void CreateObjectsFile(); void CreateObjectsFile();
protected: protected:
Gfx::CEngine* m_engine; Gfx::CEngine* m_engine;
CEventQueue* m_event; CEventQueue* m_event;
CRobotMain* m_main; CRobotMain* m_main;
Gfx::CCamera* m_camera; Gfx::CCamera* m_camera;
CInterface* m_interface; CInterface* m_interface;
Gfx::CParticle* m_particle; Gfx::CParticle* m_particle;
Gfx::CLightManager* m_light; Gfx::CLightManager* m_light;
CPauseManager* m_pause;
bool m_bInfoMaximized; bool m_bInfoMaximized;
bool m_bInfoMinimized; bool m_bInfoMinimized;
@ -88,7 +91,7 @@ protected:
Math::Point m_infoFinalDim; Math::Point m_infoFinalDim;
int m_lightSuppl; int m_lightSuppl;
bool m_bEditLock; bool m_bEditLock;
bool m_bInitPause; PauseType m_bInitPause;
bool m_bSoluce; bool m_bSoluce;
CObject* m_toto; CObject* m_toto;
}; };

View File

@ -127,9 +127,6 @@ void CDisplayText::DisplayError(Error err, CObject* pObj, float time)
void CDisplayText::DisplayError(Error err, Math::Vector goal, float height, void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
float dist, float time) float dist, float time)
{ {
TextType type;
char text[100];
if ( err == ERR_OK ) return; if ( err == ERR_OK ) return;
#if 0 #if 0
@ -148,7 +145,7 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
type = TT_WARNING; type = TT_WARNING;
} }
#else #else
type = TT_WARNING; TextType type = TT_WARNING;
if ( err >= INFO_FIRST ) if ( err >= INFO_FIRST )
{ {
type = TT_INFO; type = TT_INFO;
@ -164,8 +161,9 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
} }
#endif #endif
std::string text;
GetResource(RES_ERR, err, text); GetResource(RES_ERR, err, text);
DisplayText(text, goal, height, dist, time, type); DisplayText(text.c_str(), goal, height, dist, time, type);
} }
// Displays text. // Displays text.

View File

@ -19,6 +19,7 @@
#include "ui/edit.h" #include "ui/edit.h"
#include "app/app.h" #include "app/app.h"
#include "app/gamedata.h"
#include "clipboard/clipboard.h" #include "clipboard/clipboard.h"
@ -1224,11 +1225,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon)
Math::Point uv1, uv2; Math::Point uv1, uv2;
float dp; float dp;
#if _POLISH
m_engine->SetTexture("textp.png");
#else
m_engine->SetTexture("text.png"); m_engine->SetTexture("text.png");
#endif
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = (16.0f/256.0f)*(icon%16); uv1.x = (16.0f/256.0f)*(icon%16);
@ -1462,11 +1459,14 @@ bool CEdit::ReadText(std::string filename, int addSize)
std::string path = filename; std::string path = filename;
if (!fs::exists(path)) if (!fs::exists(path))
{ {
path = CApplication::GetInstancePointer()->GetDataDirPath() + "/" + filename; path = CGameData::GetInstancePointer()->GetDataPath(filename);
} }
file = fopen(fs::path(path).make_preferred().string().c_str(), "rb"); file = fopen(fs::path(path).make_preferred().string().c_str(), "rb");
if ( file == NULL ) return false; if ( file == NULL ) {
CLogger::GetInstancePointer()->Error("Unable to read text from file \"%s\"\n", path.c_str());
return false;
}
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
len = ftell(file); len = ftell(file);
@ -1669,12 +1669,14 @@ bool CEdit::ReadText(std::string filename, int addSize)
buffer[i+6] == 'n' && buffer[i+6] == 'n' &&
buffer[i+7] == ' ' ) buffer[i+7] == ' ' )
{ {
/* TODO: \button X; isn't working. Issue #232
if ( m_bSoluce || !bInSoluce ) if ( m_bSoluce || !bInSoluce )
{ {
m_text[j] = GetValueParam(buffer+i+8, 0); m_text[j] = GetValueParam(buffer+i+8, 0);
m_format[j] = font|Gfx::FONT_BUTTON; m_format[j] = font|Gfx::FONT_BUTTON;
j ++; j ++;
} }
*/
i += strchr(buffer+i, ';')-(buffer+i)+1; i += strchr(buffer+i, ';')-(buffer+i)+1;
} }
else if ( //m_format.size() > 0 && else if ( //m_format.size() > 0 &&
@ -1798,8 +1800,10 @@ bool CEdit::ReadText(std::string filename, int addSize)
res = main->GetInputBinding(slot).primary; res = main->GetInputBinding(slot).primary;
if ( res != 0 ) if ( res != 0 )
{ {
if ( GetResource(RES_KEY, res, iName) ) std::string iNameStr;
if ( GetResource(RES_KEY, res, iNameStr) )
{ {
strcpy(iName, iNameStr.c_str());
m_text[j] = ' '; m_text[j] = ' ';
m_format[j] = font; m_format[j] = font;
j ++; j ++;
@ -1817,9 +1821,13 @@ bool CEdit::ReadText(std::string filename, int addSize)
res = main->GetInputBinding(slot).secondary; res = main->GetInputBinding(slot).secondary;
if ( res != 0 ) if ( res != 0 )
{ {
if ( GetResource(RES_KEY, res, iName) ) if ( GetResource(RES_KEY, res, iNameStr) )
{ {
GetResource(RES_TEXT, RT_KEY_OR, text); strcpy(iName, iNameStr.c_str());
std::string textStr;
GetResource(RES_TEXT, RT_KEY_OR, textStr);
strcpy(text, textStr.c_str());
n = 0; n = 0;
while ( text[n] != 0 ) while ( text[n] != 0 )
{ {

View File

@ -52,12 +52,7 @@ bool CGroup::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT
if ( icon == -1 ) if ( icon == -1 )
{ {
char name[100]; std::string name = GetResourceName(eventType);
char* p;
GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name); SetName(name);
} }

View File

@ -58,12 +58,7 @@ bool CImage::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT
if ( icon == -1 ) if ( icon == -1 )
{ {
char name[100]; std::string name = GetResourceName(eventType);
char* p;
GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name); SetName(name);
} }

View File

@ -19,16 +19,19 @@
#include "ui/key.h" #include "ui/key.h"
#include "common/global.h" #include "common/global.h"
#include "common/stringutils.h"
#include <cstring> #include <cstring>
namespace Ui { namespace Ui {
void GetKeyName(char* name, unsigned int key) static void GetKeyName(std::string& name, unsigned int key)
{ {
if (!GetResource(RES_KEY, key, name)) if (!GetResource(RES_KEY, key, name))
sprintf(name, "Code %d", key); {
name = StrUtils::Format("Code %d", key);
}
} }
@ -51,9 +54,9 @@ bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg
CControl::Create(pos, dim, icon, eventMsg); CControl::Create(pos, dim, icon, eventMsg);
char name[100]; std::string name;
GetResource(RES_EVENT, eventMsg, name); GetResource(RES_EVENT, eventMsg, name);
SetName(std::string(name)); SetName(name);
return true; return true;
} }
@ -176,19 +179,24 @@ void CKey::Draw()
float h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f; float h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
char text[100]; std::string keyName;
GetKeyName(text, m_binding.primary); GetKeyName(keyName, m_binding.primary);
if (m_binding.secondary != KEY_INVALID) if (m_binding.secondary != KEY_INVALID)
{ {
GetResource(RES_TEXT, RT_KEY_OR, text+strlen(text)); std::string orText;
GetKeyName(text+strlen(text), m_binding.secondary); GetResource(RES_TEXT, RT_KEY_OR, orText);
keyName.append(orText);
std::string secondaryKeyName;
GetKeyName(secondaryKeyName, m_binding.secondary);
keyName.append(secondaryKeyName);
} }
Math::Point pos; Math::Point pos;
pos.x = m_pos.x + m_dim.x * 0.5f; pos.x = m_pos.x + m_dim.x * 0.5f;
pos.y = m_pos.y + m_dim.y * 0.5f; pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h; pos.y -= h;
m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_CENTER, 0); m_engine->GetText()->DrawText(keyName, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_CENTER, 0);
m_dim = iDim; m_dim = iDim;
@ -199,7 +207,7 @@ void CKey::Draw()
pos.x = m_pos.x + (214.0f / 640.0f); pos.x = m_pos.x + (214.0f / 640.0f);
pos.y = m_pos.y + m_dim.y * 0.5f; pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h; pos.y -= h;
m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0); m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0);
} }
void CKey::SetBinding(InputBinding b) void CKey::SetBinding(InputBinding b)

View File

@ -18,15 +18,17 @@
#include "ui/maindialog.h" #include "ui/maindialog.h"
#include "app/app.h" #include "app/app.h"
#include "app/gamedata.h"
#include "app/system.h" #include "app/system.h"
#include "common/config.h"
#include "common/global.h" #include "common/global.h"
#include "common/event.h" #include "common/event.h"
#include "common/logger.h" #include "common/logger.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/profile.h" #include "common/profile.h"
#include "common/restext.h" #include "common/restext.h"
#include "common/logger.h" #include "common/stringutils.h"
#include "object/robotmain.h" #include "object/robotmain.h"
@ -52,6 +54,7 @@
#include <string.h> #include <string.h>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <vector>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
@ -118,6 +121,7 @@ CMainDialog::CMainDialog()
m_camera = m_main->GetCamera(); m_camera = m_main->GetCamera();
m_engine = Gfx::CEngine::GetInstancePointer(); m_engine = Gfx::CEngine::GetInstancePointer();
m_particle = m_engine->GetParticle(); m_particle = m_engine->GetParticle();
m_pause = CPauseManager::GetInstancePointer();
m_phase = PHASE_NAME; m_phase = PHASE_NAME;
m_phaseSetup = PHASE_SETUPg; m_phaseSetup = PHASE_SETUPg;
@ -153,9 +157,6 @@ CMainDialog::CMainDialog()
m_bMovies = true; m_bMovies = true;
m_bNiceReset = true; m_bNiceReset = true;
m_bHimselfDamage = true; m_bHimselfDamage = true;
/* TODO: #if _TEEN
m_bCameraScroll = false;
#else*/
m_bCameraScroll = true; m_bCameraScroll = true;
m_bCameraInvertX = false; m_bCameraInvertX = false;
@ -215,7 +216,7 @@ void CMainDialog::ChangePhase(Phase phase)
CImage* pi; CImage* pi;
Math::Point pos, dim, ddim; Math::Point pos, dim, ddim;
float ox, oy, sx, sy; float ox, oy, sx, sy;
char name[100]; std::string name;
char* gamer; char* gamer;
int res, i, j; int res, i, j;
@ -243,9 +244,6 @@ void CMainDialog::ChangePhase(Phase phase)
pos.y = 0.10f; pos.y = 0.10f;
ddim.x = 0.30f; ddim.x = 0.30f;
ddim.y = 0.80f; ddim.y = 0.80f;
/* TODO: #if _TEEN
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
#else*/
pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5); pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5);
GetResource(RES_TEXT, RT_TITLE_INIT, name); GetResource(RES_TEXT, RT_TITLE_INIT, name);
@ -261,22 +259,7 @@ void CMainDialog::ChangePhase(Phase phase)
ddim.x = 0.30f; ddim.x = 0.30f;
ddim.y = 0.30f; ddim.y = 0.30f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
/* TODO: #if _SCHOOL
ddim.x = 0.20f;
ddim.y = dim.y*2.4f;
pos.x = 0.40f;
pos.y = oy+sy*7.9f;
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // orange
pg->SetState(STATE_SHADOW);
pos.y = oy+sy*3.9f;
pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // orange
pg->SetState(STATE_SHADOW);
ddim.y = dim.y*1.2f;
pos.y = oy+sy*1.9f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red
pg->SetState(STATE_SHADOW);
#else */
ddim.x = 0.20f; ddim.x = 0.20f;
ddim.y = dim.y*2.4f; ddim.y = dim.y*2.4f;
pos.x = 0.40f; pos.x = 0.40f;
@ -296,26 +279,7 @@ void CMainDialog::ChangePhase(Phase phase)
pos.y = oy+sy*1.9f; pos.y = oy+sy*1.9f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red
pg->SetState(STATE_SHADOW); pg->SetState(STATE_SHADOW);
/* TODO: #if _SCHOOL
ddim.x = 0.18f;
ddim.y = dim.y*1;
pos.x = 0.41f;
pos.y = oy+sy*9.1f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TRAINER);
pb->SetState(STATE_SHADOW);
pos.y = oy+sy*8.0f;
#if _TEEN
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TEEN);
#else
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_DEFI);
#endif
#if _CEEBOTDEMO
pb->ClearState(STATE_ENABLE);
#endif
pb->SetState(STATE_SHADOW);
#else */
ddim.x = 0.18f; ddim.x = 0.18f;
ddim.y = dim.y*1; ddim.y = dim.y*1;
pos.x = 0.41f; pos.x = 0.41f;
@ -351,30 +315,22 @@ pb->SetState(STATE_SHADOW);
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_QUIT); pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_QUIT);
pb->SetState(STATE_SHADOW); pb->SetState(STATE_SHADOW);
// TODO: #if !_DEMO & !_SCHOOL #if DEV_BUILD
if ( m_accessEnable && m_accessUser ) if ( m_accessEnable && m_accessUser )
{ {
pos.x = 447.0f/640.0f; pos.x = 447.0f/640.0f;
pos.y = 313.0f/480.0f; pos.y = 313.0f/480.0f;
ddim.x = 0.09f; ddim.x = 0.09f;
/*#if _POLISH
pos.x -= 5.0f/640.0f;
ddim.x += 10.0f/640.0f;
#endif*/
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER); pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER);
pb->SetState(STATE_SHADOW); pb->SetState(STATE_SHADOW);
} }
// #endif #endif
// TODO: remove? /*pos.x = 139.0f/640.0f;
if (m_app->GetProtoMode()) pos.y = 313.0f/480.0f;
{ ddim.x = 0.09f;
pos.x = 139.0f/640.0f; pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PROTO);
pos.y = 313.0f/480.0f; pb->SetState(STATE_SHADOW);*/
ddim.x = 0.09f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PROTO);
pb->SetState(STATE_SHADOW);
}
pos.x = 0.40f; pos.x = 0.40f;
ddim.x = 0.20f; ddim.x = 0.20f;
@ -406,19 +362,6 @@ pb->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_TITLE_NAME, name); GetResource(RES_TEXT, RT_TITLE_NAME, name);
pw->SetName(name); pw->SetName(name);
/* TODO: #if _NEWLOOK
pos.x = 80.0f/640.0f;
pos.y = 93.0f/480.0f;
ddim.x = 285.0f/640.0f;
ddim.y = 266.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
pg->SetState(STATE_SHADOW);
pos.x = 372.0f/640.0f;
ddim.x = 188.0f/640.0f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
pg->SetState(STATE_SHADOW);
#endif*/
pos.x = 0.10f; pos.x = 0.10f;
pos.y = 0.40f; pos.y = 0.40f;
ddim.x = 0.50f; ddim.x = 0.50f;
@ -458,10 +401,10 @@ pb->SetState(STATE_SHADOW);
} }
else else
{ {
strcpy(name, gamer); name = gamer;
} }
pe->SetText(name); pe->SetText(name.c_str());
pe->SetCursor(strlen(name), 0); pe->SetCursor(name.length(), 0);
pe->SetFocus(true); pe->SetFocus(true);
pos.x = 380.0f/640.0f; pos.x = 380.0f/640.0f;
@ -526,15 +469,6 @@ pb->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_TITLE_PERSO, name); GetResource(RES_TEXT, RT_TITLE_PERSO, name);
pw->SetName(name); pw->SetName(name);
/* TODO: #if _NEWLOOK
pos.x = 95.0f/640.0f;
pos.y = 66.0f/480.0f;
ddim.x = 443.0f/640.0f;
ddim.y = 42.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
pg->SetState(STATE_SHADOW);
#endif*/
pos.x = 0.10f; pos.x = 0.10f;
pos.y = 0.40f; pos.y = 0.40f;
ddim.x = 0.50f; ddim.x = 0.50f;
@ -770,15 +704,13 @@ pb->SetState(STATE_SHADOW);
m_phase == PHASE_MISSION || m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE || m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN || m_phase == PHASE_TEEN ||
m_phase == PHASE_USER || m_phase == PHASE_USER )
m_phase == PHASE_PROTO )
{ {
if ( m_phase == PHASE_TRAINER ) m_index = 0; if ( m_phase == PHASE_TRAINER ) m_index = 0;
if ( m_phase == PHASE_DEFI ) m_index = 1; if ( m_phase == PHASE_DEFI ) m_index = 1;
if ( m_phase == PHASE_MISSION ) m_index = 2; if ( m_phase == PHASE_MISSION ) m_index = 2;
if ( m_phase == PHASE_FREE ) m_index = 3; if ( m_phase == PHASE_FREE ) m_index = 3;
if ( m_phase == PHASE_USER ) m_index = 4; if ( m_phase == PHASE_USER ) m_index = 4;
if ( m_phase == PHASE_PROTO ) m_index = 5;
if ( m_phase == PHASE_TEEN ) m_index = 6; if ( m_phase == PHASE_TEEN ) m_index = 6;
if ( m_phase == PHASE_FREE ) if ( m_phase == PHASE_FREE )
@ -794,7 +726,6 @@ pb->SetState(STATE_SHADOW);
if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "free"); if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "free");
if ( m_phase == PHASE_TEEN ) strcpy(m_sceneName, "teen"); if ( m_phase == PHASE_TEEN ) strcpy(m_sceneName, "teen");
if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "user"); if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "user");
if ( m_phase == PHASE_PROTO ) strcpy(m_sceneName, "proto");
ReadGamerInfo(); ReadGamerInfo();
@ -810,33 +741,9 @@ pb->SetState(STATE_SHADOW);
if ( m_phase == PHASE_FREE ) res = RT_TITLE_FREE; if ( m_phase == PHASE_FREE ) res = RT_TITLE_FREE;
if ( m_phase == PHASE_TEEN ) res = RT_TITLE_TEEN; if ( m_phase == PHASE_TEEN ) res = RT_TITLE_TEEN;
if ( m_phase == PHASE_USER ) res = RT_TITLE_USER; if ( m_phase == PHASE_USER ) res = RT_TITLE_USER;
if ( m_phase == PHASE_PROTO ) res = RT_TITLE_PROTO;
GetResource(RES_TEXT, res, name); GetResource(RES_TEXT, res, name);
pw->SetName(name); pw->SetName(name);
/* TODO: #if _NEWLOOK
pos.x = 100.0f/640.0f;
pos.y = 226.0f/480.0f;
ddim.x = 216.0f/640.0f;
ddim.y = 160.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
pg->SetState(STATE_SHADOW);
pos.x = 322.0f/640.0f;
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
pg->SetState(STATE_SHADOW);
pos.x = 100.0f/640.0f;
pos.y = 122.0f/480.0f;
ddim.x = 438.0f/640.0f;
ddim.y = 98.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // green
pg->SetState(STATE_SHADOW);
pos.y = 66.0f/480.0f;
ddim.y = 42.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
pg->SetState(STATE_SHADOW);
#endif */
pos.x = 0.10f; pos.x = 0.10f;
pos.y = 0.40f; pos.y = 0.40f;
ddim.x = 0.50f; ddim.x = 0.50f;
@ -859,7 +766,6 @@ pb->SetState(STATE_SHADOW);
if ( m_phase == PHASE_FREE ) res = RT_PLAY_CHAPf; if ( m_phase == PHASE_FREE ) res = RT_PLAY_CHAPf;
if ( m_phase == PHASE_TEEN ) res = RT_PLAY_CHAPte; if ( m_phase == PHASE_TEEN ) res = RT_PLAY_CHAPte;
if ( m_phase == PHASE_USER ) res = RT_PLAY_CHAPu; if ( m_phase == PHASE_USER ) res = RT_PLAY_CHAPu;
if ( m_phase == PHASE_PROTO ) res = RT_PLAY_CHAPp;
GetResource(RES_TEXT, res, name); GetResource(RES_TEXT, res, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
@ -883,7 +789,6 @@ pb->SetState(STATE_SHADOW);
if ( m_phase == PHASE_FREE ) res = RT_PLAY_LISTf; if ( m_phase == PHASE_FREE ) res = RT_PLAY_LISTf;
if ( m_phase == PHASE_TEEN ) res = RT_PLAY_LISTk; if ( m_phase == PHASE_TEEN ) res = RT_PLAY_LISTk;
if ( m_phase == PHASE_USER ) res = RT_PLAY_LISTu; if ( m_phase == PHASE_USER ) res = RT_PLAY_LISTu;
if ( m_phase == PHASE_PROTO ) res = RT_PLAY_LISTp;
GetResource(RES_TEXT, res, name); GetResource(RES_TEXT, res, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
@ -1049,80 +954,6 @@ pb->SetState(STATE_SHADOW);
ddim.y = 0.05f; ddim.y = 0.05f;
pw->CreateGroup(pos, ddim, 3, EVENT_NULL); // transparent -> gray pw->CreateGroup(pos, ddim, 3, EVENT_NULL); // transparent -> gray
/* TODO: #if _NEWLOOK
if ( m_phase == PHASE_SETUPd || // setup/display ?
m_phase == PHASE_SETUPds )
{
pos.x = 100.0f/640.0f;
pos.y = 130.0f/480.0f;
ddim.x = 216.0f/640.0f;
ddim.y = 212.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
pg->SetState(STATE_SHADOW);
pos.x = 324.0f/640.0f;
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
pg->SetState(STATE_SHADOW);
}
if ( m_phase == PHASE_SETUPg || // setup/graphic ?
m_phase == PHASE_SETUPgs )
{
pos.x = 100.0f/640.0f;
pos.y = 130.0f/480.0f;
ddim.x = 174.0f/640.0f;
ddim.y = 212.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
pg->SetState(STATE_SHADOW);
pos.x = 282.0f/640.0f;
ddim.x = 258.0f/640.0f;
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
pg->SetState(STATE_SHADOW);
}
if ( m_phase == PHASE_SETUPp || // setup/game ?
m_phase == PHASE_SETUPps )
{
pos.x = 100.0f/640.0f;
pos.y = 130.0f/480.0f;
ddim.x = 226.0f/640.0f;
ddim.y = 212.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
pg->SetState(STATE_SHADOW);
pos.x = 334.0f/640.0f;
ddim.x = 206.0f/640.0f;
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
pg->SetState(STATE_SHADOW);
}
if ( m_phase == PHASE_SETUPc || // setup/command ?
m_phase == PHASE_SETUPcs )
{
pos.x = 100.0f/640.0f;
pos.y = 125.0f/480.0f;
ddim.x = 440.0f/640.0f;
ddim.y = 222.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
pg->SetState(STATE_SHADOW);
}
if ( m_phase == PHASE_SETUPs || // setup/sound ?
m_phase == PHASE_SETUPss )
{
pos.x = 100.0f/640.0f;
pos.y = 130.0f/480.0f;
ddim.x = 216.0f/640.0f;
ddim.y = 212.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
pg->SetState(STATE_SHADOW);
pos.x = 324.0f/640.0f;
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
pg->SetState(STATE_SHADOW);
}
pos.x = 100.0f/640.0f;
pos.y = 66.0f/480.0f;
ddim.x = 440.0f/640.0f;
ddim.y = 42.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
pg->SetState(STATE_SHADOW);
#endif */
ddim.x = 0.78f/5-0.01f; ddim.x = 0.78f/5-0.01f;
ddim.y = 0.06f; ddim.y = 0.06f;
pos.x = 0.115f; pos.x = 0.115f;
@ -1353,10 +1184,7 @@ pb->SetState(STATE_SHADOW);
ddim.y = dim.y*1; ddim.y = dim.y*1;
pos.x = ox+sx*10; pos.x = ox+sx*10;
pos.y = oy+sy*2; pos.y = oy+sy*2;
/* TODO: #if _POLISH
ddim.x += 20.0f/640.0f;
pos.x -= 20.0f/640.0f*3.0f;
#endif*/
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_MIN); pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_MIN);
pb->SetState(STATE_SHADOW); pb->SetState(STATE_SHADOW);
pos.x += ddim.x; pos.x += ddim.x;
@ -1379,13 +1207,7 @@ pb->SetState(STATE_SHADOW);
//? pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOTO); //? pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOTO);
//? pc->SetState(STATE_SHADOW); //? pc->SetState(STATE_SHADOW);
//? pos.y -= 0.048f; //? pos.y -= 0.048f;
/*TODO: #if _SCHOOL
#if _EDU
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOLUCE4);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
#endif
#else*/
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES); pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES);
pc->SetState(STATE_SHADOW); pc->SetState(STATE_SHADOW);
pos.y -= 0.048f; pos.y -= 0.048f;
@ -1507,7 +1329,6 @@ pos.y -= 0.048f;
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
// TODO: #if (_FULL | _NET) & _SOUNDTRACKS
pos.x = ox+sx*3; pos.x = ox+sx*3;
pos.y = 0.40f; pos.y = 0.40f;
ddim.x = dim.x*4.0f; ddim.x = dim.x*4.0f;
@ -1520,14 +1341,6 @@ pos.y -= 0.048f;
GetResource(RES_EVENT, EVENT_INTERFACE_VOLMUSIC, name); GetResource(RES_EVENT, EVENT_INTERFACE_VOLMUSIC, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
// #endif
ddim.x = dim.x*6;
ddim.y = dim.y*0.5f;
pos.x = ox+sx*10;
pos.y = 0.55f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOUND3D);
pc->SetState(STATE_SHADOW);
ddim.x = dim.x*3; ddim.x = dim.x*3;
ddim.y = dim.y*1; ddim.y = dim.y*1;
@ -1565,15 +1378,6 @@ pos.y -= 0.048f;
ddim.y = 0.50f; ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
/* TODO: #if _NEWLOOK
pos.x = 100.0f/640.0f;
pos.y = 66.0f/480.0f;
ddim.x = 438.0f/640.0f;
ddim.y = 42.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
pg->SetState(STATE_SHADOW);
#endif */
pos.x = 290.0f/640.0f; pos.x = 290.0f/640.0f;
ddim.x = 245.0f/640.0f; ddim.x = 245.0f/640.0f;
@ -1649,15 +1453,6 @@ pos.y -= 0.048f;
ddim.y = 0.50f; ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
/* TODO: #if _NEWLOOK
pos.x = 100.0f/640.0f;
pos.y = 66.0f/480.0f;
ddim.x = 438.0f/640.0f;
ddim.y = 42.0f/480.0f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
pg->SetState(STATE_SHADOW);
#endif*/
pos.x = 290.0f/640.0f; pos.x = 290.0f/640.0f;
ddim.x = 245.0f/640.0f; ddim.x = 245.0f/640.0f;
@ -1717,9 +1512,6 @@ pos.y -= 0.048f;
pos.y = 0.10f; pos.y = 0.10f;
ddim.x = 0.30f; ddim.x = 0.30f;
ddim.y = 0.80f; ddim.y = 0.80f;
/*TODO: #if _TEEN
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
#else*/
pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5); pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5);
pw->SetName(" "); pw->SetName(" ");
@ -1828,7 +1620,6 @@ pos.y -= 0.048f;
ddim.y = 0.0f; ddim.y = 0.0f;
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5); pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
// TODO: #if _FULL | _NET
pos.x = 80.0f/640.0f; pos.x = 80.0f/640.0f;
pos.y = 240.0f/480.0f; pos.y = 240.0f/480.0f;
ddim.x = 490.0f/640.0f; ddim.x = 490.0f/640.0f;
@ -1841,54 +1632,6 @@ pos.y -= 0.048f;
pe->SetFontSize(Gfx::FONT_SIZE_SMALL); pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt")); pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt"));
// #endif
/* TODO: #if _SCHOOL
#if _CEEBOTDEMO
pos.x = 80.0f/640.0f;
pos.y = 210.0f/480.0f;
ddim.x = 490.0f/640.0f;
ddim.y = 150.0f/480.0f;
#else
pos.x = 80.0f/640.0f;
pos.y = 200.0f/480.0f;
ddim.x = 490.0f/640.0f;
ddim.y = 150.0f/480.0f;
#endif
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
pe->SetGenericMode(true);
pe->SetEditCap(false);
pe->SetHighlightCap(false);
pe->SetFontType(Gfx::FONT_COURIER);
pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
pe->ReadText("help/authors.txt");*/
/* #if _DEMO
//? pos.x = 80.0f/640.0f;
//? pos.y = 240.0f/480.0f;
//? ddim.x = 490.0f/640.0f;
//? ddim.y = 110.0f/480.0f;
//? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
//? pe->SetGenericMode(true);
//? pe->SetEditCap(false);
//? pe->SetHiliteCap(false);
//? pe->SetFontType(Gfx::FONT_COURIER);
//? pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
//? pe->ReadText("help/demo.txt");
//? pos.x = 80.0f/640.0f;
//? pos.y = 140.0f/480.0f;
//? ddim.x = 490.0f/640.0f;
//? ddim.y = 100.0f/480.0f;
//? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2);
//? pe->SetGenericMode(true);
//? pe->SetEditCap(false);
//? pe->SetHiliteCap(false);
//? pe->SetFontType(Gfx::FONT_COURIER);
//? pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
//? pe->ReadText("help/authors.txt");
#endif */
// TODO: #if !_DEMO
pos.x = 40.0f/640.0f; pos.x = 40.0f/640.0f;
pos.y = 83.0f/480.0f; pos.y = 83.0f/480.0f;
ddim.x = 246.0f/640.0f; ddim.x = 246.0f/640.0f;
@ -1918,23 +1661,13 @@ pos.y -= 0.048f;
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL4, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL4, name);
pl->SetFontType(Gfx::FONT_COURIER); pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL); pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
// #endif
/* TODO: #if _DEMO
pos.x = 481.0f/640.0f;
pos.y = 51.0f/480.0f;
ddim.x = 30.0f/640.0f;
ddim.y = 30.0f/480.0f;
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
pb->SetState(STATE_SHADOW);
#else */
pos.x = 306.0f/640.0f; pos.x = 306.0f/640.0f;
pos.y = 17.0f/480.0f; pos.y = 17.0f/480.0f;
ddim.x = 30.0f/640.0f; ddim.x = 30.0f/640.0f;
ddim.y = 30.0f/480.0f; ddim.y = 30.0f/480.0f;
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT); pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
pb->SetState(STATE_SHADOW); pb->SetState(STATE_SHADOW);
// #endif
m_engine->SetBackground("generico.png", m_engine->SetBackground("generico.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -1953,7 +1686,6 @@ pos.y -= 0.048f;
m_phase == PHASE_FREE || m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN || m_phase == PHASE_TEEN ||
m_phase == PHASE_USER || m_phase == PHASE_USER ||
m_phase == PHASE_PROTO ||
m_phase == PHASE_SETUPd || m_phase == PHASE_SETUPd ||
m_phase == PHASE_SETUPg || m_phase == PHASE_SETUPg ||
m_phase == PHASE_SETUPp || m_phase == PHASE_SETUPp ||
@ -1962,26 +1694,12 @@ pos.y -= 0.048f;
m_phase == PHASE_READ || m_phase == PHASE_READ ||
m_phase == PHASE_LOADING ) m_phase == PHASE_LOADING )
{ {
/*TODO: #if _SCHOOL
#if _TEEN
pos.x = 50.0f/640.0f;
pos.y = 430.0f/480.0f;
ddim.x = 200.0f/640.0f;
ddim.y = 10.0f/480.0f;
#else
pos.x = 450.0f/640.0f;
pos.y = 0.0f/480.0f;
ddim.x = 170.0f/640.0f;
ddim.y = 9.0f/480.0f;
#endif
#else */
pos.x = 540.0f/640.0f; pos.x = 540.0f/640.0f;
pos.y = 9.0f/480.0f; pos.y = 9.0f/480.0f;
ddim.x = 90.0f/640.0f; ddim.x = 90.0f/640.0f;
ddim.y = 10.0f/480.0f; ddim.y = 10.0f/480.0f;
//#endif
//GetResource(RES_TEXT, RT_VERSION_ID, name); //GetResource(RES_TEXT, RT_VERSION_ID, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, __DATE__); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY);
pl->SetFontType(Gfx::FONT_COURIER); pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(9.0f); pl->SetFontSize(9.0f);
} }
@ -2087,9 +1805,10 @@ bool CMainDialog::EventProcess(const Event &event)
{ {
m_shotDelay --; m_shotDelay --;
if ( m_shotDelay == 0 ) if ( m_shotDelay == 0 )
{ {
m_engine->WriteScreenShot(m_shotName, 320, 240); Math::IntPoint windowSize = m_engine->GetWindowSize();
//? m_engine->WriteScreenShot(m_shotName, 160, 120);
m_engine->WriteScreenShot(m_shotName, windowSize.x, windowSize.y);
} }
} }
@ -2237,10 +1956,6 @@ bool CMainDialog::EventProcess(const Event &event)
m_main->ChangePhase(PHASE_USER); m_main->ChangePhase(PHASE_USER);
break; break;
case EVENT_INTERFACE_PROTO:
m_main->ChangePhase(PHASE_PROTO);
break;
case EVENT_INTERFACE_SETUP: case EVENT_INTERFACE_SETUP:
m_main->ChangePhase(m_phaseSetup); m_main->ChangePhase(m_phaseSetup);
break; break;
@ -2444,8 +2159,7 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase == PHASE_MISSION || m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE || m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN || m_phase == PHASE_TEEN ||
m_phase == PHASE_USER || m_phase == PHASE_USER )
m_phase == PHASE_PROTO )
{ {
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return false; if ( pw == 0 ) return false;
@ -2464,8 +2178,7 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase == PHASE_MISSION || m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE || m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN || m_phase == PHASE_TEEN ||
m_phase == PHASE_USER || m_phase == PHASE_USER )
m_phase == PHASE_PROTO )
{ {
switch( event.type ) switch( event.type )
{ {
@ -2492,11 +2205,6 @@ bool CMainDialog::EventProcess(const Event &event)
break; break;
case EVENT_INTERFACE_PLAY: case EVENT_INTERFACE_PLAY:
if ( m_phase == PHASE_PROTO && m_chap[m_index] == 0 && m_sel[m_index] == 0 )
{
m_main->ChangePhase(PHASE_MODEL);
break;
}
m_sceneRank = (m_chap[m_index]+1)*100+(m_sel[m_index]+1); m_sceneRank = (m_chap[m_index]+1)*100+(m_sel[m_index]+1);
m_phaseTerm = m_phase; m_phaseTerm = m_phase;
m_main->ChangePhase(PHASE_LOADING); m_main->ChangePhase(PHASE_LOADING);
@ -2888,7 +2596,7 @@ bool CMainDialog::EventProcess(const Event &event)
break; break;
case EVENT_INTERFACE_KDEF: case EVENT_INTERFACE_KDEF:
m_app->ResetKeyStates(); m_main->SetDefaultInputBindings();
UpdateKey(); UpdateKey();
break; break;
@ -2913,12 +2621,6 @@ bool CMainDialog::EventProcess(const Event &event)
ChangeSetupButtons(); ChangeSetupButtons();
break; break;
case EVENT_INTERFACE_SOUND3D:
m_sound->SetSound3D(!m_sound->GetSound3D());
ChangeSetupButtons();
UpdateSetupButtons();
break;
case EVENT_INTERFACE_SILENT: case EVENT_INTERFACE_SILENT:
m_sound->SetAudioVolume(0); m_sound->SetAudioVolume(0);
m_sound->SetMusicVolume(0); m_sound->SetMusicVolume(0);
@ -3119,8 +2821,7 @@ void CMainDialog::GlintMove()
m_phase == PHASE_MISSION || m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE || m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN || m_phase == PHASE_TEEN ||
m_phase == PHASE_USER || m_phase == PHASE_USER )
m_phase == PHASE_PROTO )
{ {
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl)); pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl));
if ( pg != 0 ) if ( pg != 0 )
@ -3256,8 +2957,6 @@ Math::Vector SoundRand()
void CMainDialog::FrameParticle(float rTime) void CMainDialog::FrameParticle(float rTime)
{ {
/* TODO: #if _NEWLOOK
#else */
Math::Vector pos, speed; Math::Vector pos, speed;
Math::Point dim; Math::Point dim;
float *pParti, *pGlint; float *pParti, *pGlint;
@ -3348,7 +3047,6 @@ void CMainDialog::FrameParticle(float rTime)
m_phase == PHASE_FREE || m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN || m_phase == PHASE_TEEN ||
m_phase == PHASE_USER || m_phase == PHASE_USER ||
m_phase == PHASE_PROTO ||
m_phase == PHASE_SETUPd || m_phase == PHASE_SETUPd ||
m_phase == PHASE_SETUPg || m_phase == PHASE_SETUPg ||
m_phase == PHASE_SETUPp || m_phase == PHASE_SETUPp ||
@ -3620,7 +3318,7 @@ void CMainDialog::BuildSceneName(std::string &filename, char *base, int rank)
{ {
rankStream << std::setfill('0') << std::setw(3) << rank; rankStream << std::setfill('0') << std::setw(3) << rank;
filename = base + rankStream.str() + ".txt"; filename = base + rankStream.str() + ".txt";
filename = CApplication::GetInstance().GetDataFilePath(DIR_LEVEL, filename); filename = CGameData::GetInstancePointer()->GetFilePath(DIR_LEVEL, filename);
} }
} }
@ -4019,7 +3717,7 @@ void CMainDialog::UpdatePerso()
CColor* pc; CColor* pc;
CSlider* ps; CSlider* ps;
Gfx::Color color; Gfx::Color color;
char name[100]; std::string name;
int i; int i;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
@ -4366,8 +4064,8 @@ void CMainDialog::IOReadName()
} }
time(&now); time(&now);
TimeToAscii(now, line); TimeToAsciiClean(now, line);
sprintf(name, "%s %d - %s", resume, m_sel[m_index]+1, line); sprintf(name, "%s - %s %d", line, resume, m_sel[m_index]+1);
pe->SetText(name); pe->SetText(name);
pe->SetCursor(strlen(name), 0); pe->SetCursor(strlen(name), 0);
pe->SetFocus(true); pe->SetFocus(true);
@ -4383,7 +4081,7 @@ void CMainDialog::IOReadList()
char line[500]; char line[500];
char name[100]; char name[100];
int i; int i;
fs::directory_iterator end_iter; std::vector<fs::path> v;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return; if ( pw == 0 ) return;
@ -4397,12 +4095,14 @@ void CMainDialog::IOReadList()
if (fs::exists(saveDir) && fs::is_directory(saveDir)) if (fs::exists(saveDir) && fs::is_directory(saveDir))
{ {
for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter) copy(fs::directory_iterator(saveDir), fs::directory_iterator(), back_inserter(v));
std::sort(v.begin(), v.end());
for( std::vector<fs::path>::iterator iter = v.begin(); iter != v.end(); ++iter)
{ {
if ( fs::is_directory(dir_iter->status()) && fs::exists(dir_iter->path() / "data.sav") ) if ( fs::is_directory(*iter) && fs::exists(*iter / "data.sav") )
{ {
file = fopen((dir_iter->path() / "data.sav").make_preferred().string().c_str(), "r"); file = fopen((*iter / "data.sav").make_preferred().string().c_str(), "r");
if ( file == NULL ) continue; if ( file == NULL ) continue;
while ( fgets(line, 500, file) != NULL ) while ( fgets(line, 500, file) != NULL )
@ -4426,7 +4126,7 @@ void CMainDialog::IOReadList()
fclose(file); fclose(file);
pl->SetItemName(m_saveList.size(), name); pl->SetItemName(m_saveList.size(), name);
m_saveList.push_back(dir_iter->path()); m_saveList.push_back(*iter);
} }
} }
} }
@ -4434,8 +4134,9 @@ void CMainDialog::IOReadList()
// invalid index // invalid index
if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs ) if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs )
{ {
GetResource(RES_TEXT, RT_IO_NEW, name); std::string nameStr;
pl->SetItemName(m_saveList.size(), name); GetResource(RES_TEXT, RT_IO_NEW, nameStr);
pl->SetItemName(m_saveList.size(), nameStr.c_str());
} }
pl->SetSelect(m_saveList.size()); pl->SetSelect(m_saveList.size());
@ -4694,8 +4395,7 @@ void CMainDialog::AllMissionUpdate()
m_phase == PHASE_MISSION || m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE || m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN || m_phase == PHASE_TEEN ||
m_phase == PHASE_USER || m_phase == PHASE_USER )
m_phase == PHASE_PROTO )
{ {
UpdateSceneChap(m_chap[m_index]); UpdateSceneChap(m_chap[m_index]);
UpdateSceneList(m_chap[m_index], m_sel[m_index]); UpdateSceneList(m_chap[m_index], m_sel[m_index]);
@ -4793,17 +4493,6 @@ void CMainDialog::UpdateSceneChap(int &chap)
{ {
for ( j=0 ; j<9 ; j++ ) for ( j=0 ; j<9 ; j++ )
{ {
/* TODO: #if _SCHOOL
if ( m_phase == PHASE_MISSION ) break;
if ( m_phase == PHASE_FREE ) break;
#if _CEEBOTDEMO
if ( m_phase == PHASE_TRAINER && j >= 2 ) break;
#endif
#endif
#if _DEMO
if ( m_phase == PHASE_MISSION && j >= 4 ) break;
if ( m_phase == PHASE_TRAINER && j >= 1 ) break;
#endif */
BuildSceneName(fileName, m_sceneName, (j+1)*100); BuildSceneName(fileName, m_sceneName, (j+1)*100);
file = fopen(fileName.c_str(), "r"); file = fopen(fileName.c_str(), "r");
if ( file == NULL ) break; if ( file == NULL ) break;
@ -4848,14 +4537,6 @@ void CMainDialog::UpdateSceneChap(int &chap)
break; break;
} }
/* TODO: #if _TEEN
if ( m_phase == PHASE_TRAINER && !m_main->GetShowAll() && !bPassed )
{
j ++;
break;
}
#endif*/
if ( m_phase == PHASE_FREE && j == m_accessChap ) if ( m_phase == PHASE_FREE && j == m_accessChap )
{ {
j ++; j ++;
@ -4899,21 +4580,6 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
for ( j=0 ; j<99 ; j++ ) for ( j=0 ; j<99 ; j++ )
{ {
/* TODO: #if _SCHOOL
if ( m_phase == PHASE_MISSION ) break;
if ( m_phase == PHASE_FREE ) break;
#if _CEEBOTDEMO
#if _TEEN
if ( m_phase == PHASE_TRAINER && j >= 5 ) break;
#else
if ( m_phase == PHASE_TRAINER && j >= 3 ) break;
#endif
#endif
#endif
#if _DEMO
if ( m_phase == PHASE_MISSION && j >= 3 ) break;
if ( m_phase == PHASE_TRAINER && j >= 5 ) break;
#endif */
BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1)); BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1));
file = fopen(fileName.c_str(), "r"); file = fopen(fileName.c_str(), "r");
if ( file == NULL ) break; if ( file == NULL ) break;
@ -4957,14 +4623,6 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
j ++; j ++;
break; break;
} }
/* TODO: #if _TEEN
if ( m_phase == PHASE_TRAINER && !m_main->GetShowAll() && !bPassed )
{
j ++;
break;
}
#endif*/
} }
BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1)); BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1));
@ -4998,8 +4656,7 @@ void CMainDialog::ShowSoluceUpdate()
m_phase == PHASE_MISSION || m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE || m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN || m_phase == PHASE_TEEN ||
m_phase == PHASE_USER || m_phase == PHASE_USER )
m_phase == PHASE_PROTO )
{ {
m_bSceneSoluce = false; m_bSceneSoluce = false;
@ -5456,13 +5113,6 @@ void CMainDialog::UpdateSetupButtons()
value = static_cast<float>(m_sound->GetMusicVolume()); value = static_cast<float>(m_sound->GetMusicVolume());
ps->SetVisibleValue(value); ps->SetVisibleValue(value);
} }
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOUND3D));
if ( pc != 0 )
{
pc->SetState(STATE_CHECK, m_sound->GetSound3D());
pc->SetState(STATE_ENABLE, m_sound->GetSound3DCap());
}
} }
// Updates the engine function of the buttons after the setup phase. // Updates the engine function of the buttons after the setup phase.
@ -5564,7 +5214,6 @@ void CMainDialog::SetupMemorize()
GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode()); GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode());
GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume()); GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume());
GetProfile().SetLocalProfileInt("Setup", "MusicVolume", m_sound->GetMusicVolume()); GetProfile().SetLocalProfileInt("Setup", "MusicVolume", m_sound->GetMusicVolume());
GetProfile().SetLocalProfileInt("Setup", "Sound3D", m_sound->GetSound3D());
GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode()); GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue()); GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
@ -5601,21 +5250,7 @@ void CMainDialog::SetupMemorize()
GetProfile().SetLocalProfileString("Setup", "KeyMap", key.str()); GetProfile().SetLocalProfileString("Setup", "KeyMap", key.str());
#if _NET
if ( m_accessEnable )
{
iValue = m_accessMission;
SetLocalProfileInt("Setup", "AccessMission", iValue);
iValue = m_accessUser;
SetLocalProfileInt("Setup", "AccessUser", iValue);
}
#endif
GetProfile().SetLocalProfileInt("Setup", "DeleteGamer", m_bDeleteGamer); GetProfile().SetLocalProfileInt("Setup", "DeleteGamer", m_bDeleteGamer);
// TODO: write graphic engine profile
//m_engine->WriteProfile();
} }
// Remember all the settings. // Remember all the settings.
@ -5802,11 +5437,6 @@ void CMainDialog::SetupRecall()
m_sound->SetMusicVolume(iValue); m_sound->SetMusicVolume(iValue);
} }
if ( GetProfile().GetLocalProfileInt("Setup", "Sound3D", iValue) )
{
m_sound->SetSound3D(iValue == 1);
}
if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) )
{ {
m_engine->SetEditIndentMode(iValue); m_engine->SetEditIndentMode(iValue);
@ -5830,21 +5460,6 @@ void CMainDialog::SetupRecall()
} }
} }
#if _NET
if ( m_accessEnable )
{
if ( GetProfile().GetLocalProfileInt("Setup", "AccessMission", iValue) )
{
m_accessMission = iValue;
}
if ( GetProfile().GetLocalProfileInt("Setup", "AccessUser", iValue) )
{
m_accessUser = iValue;
}
}
#endif
if ( GetProfile().GetLocalProfileInt("Setup", "DeleteGamer", iValue) ) if ( GetProfile().GetLocalProfileInt("Setup", "DeleteGamer", iValue) )
{ {
m_bDeleteGamer = iValue; m_bDeleteGamer = iValue;
@ -6026,7 +5641,7 @@ void CMainDialog::StartAbort()
CWindow* pw; CWindow* pw;
CButton* pb; CButton* pb;
Math::Point pos, dim; Math::Point pos, dim;
char name[100]; std::string name;
StartDialog(Math::Point(0.3f, 0.8f), true, false, false); StartDialog(Math::Point(0.3f, 0.8f), true, false, false);
m_bDialogDelete = false; m_bDialogDelete = false;
@ -6047,10 +5662,6 @@ void CMainDialog::StartAbort()
pos.x = 0.40f; pos.x = 0.40f;
dim.x = 0.20f; dim.x = 0.20f;
/* TODO: #if _POLISH
pos.x -= 7.0f/640.0f;
dim.x += 14.0f/640.0f;
#endif*/
dim.y = 32.0f/480.0f; dim.y = 32.0f/480.0f;
pos.y = 0.74f; pos.y = 0.74f;
@ -6105,7 +5716,7 @@ void CMainDialog::StartDeleteObject()
CWindow* pw; CWindow* pw;
CButton* pb; CButton* pb;
Math::Point pos, dim; Math::Point pos, dim;
char name[100]; std::string name;
StartDialog(Math::Point(0.7f, 0.3f), false, true, true); StartDialog(Math::Point(0.7f, 0.3f), false, true, true);
m_bDialogDelete = true; m_bDialogDelete = true;
@ -6139,21 +5750,22 @@ void CMainDialog::StartDeleteGame(char *gamer)
CWindow* pw; CWindow* pw;
CButton* pb; CButton* pb;
Math::Point pos, dim; Math::Point pos, dim;
char name[100];
char text[100];
StartDialog(Math::Point(0.7f, 0.3f), false, true, true); StartDialog(Math::Point(0.7f, 0.3f), false, true, true);
m_bDialogDelete = true; m_bDialogDelete = true;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9)); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
if ( pw == 0 ) return; if (pw == nullptr)
return;
std::string name;
pos.x = 0.00f; pos.x = 0.00f;
pos.y = 0.50f; pos.y = 0.50f;
dim.x = 1.00f; dim.x = 1.00f;
dim.y = 0.05f; dim.y = 0.05f;
GetResource(RES_TEXT, RT_DIALOG_DELGAME, name); GetResource(RES_TEXT, RT_DIALOG_DELGAME, name);
sprintf(text, name, gamer); std::string text = StrUtils::Format(name.c_str(), gamer);
pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, text); pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, text);
pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_OK)); pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_OK));
@ -6175,12 +5787,14 @@ void CMainDialog::StartQuit()
CWindow* pw; CWindow* pw;
CButton* pb; CButton* pb;
Math::Point pos, dim; Math::Point pos, dim;
char name[100];
StartDialog(Math::Point(0.6f, 0.3f), false, true, true); StartDialog(Math::Point(0.6f, 0.3f), false, true, true);
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9)); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
if ( pw == 0 ) return; if (pw == nullptr)
return;
std::string name;
pos.x = 0.00f; pos.x = 0.00f;
pos.y = 0.50f; pos.y = 0.50f;
@ -6208,7 +5822,6 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance
CWindow* pw; CWindow* pw;
CButton* pb; CButton* pb;
Math::Point pos, ddim; Math::Point pos, ddim;
char name[100];
StartSuspend(); StartSuspend();
@ -6247,6 +5860,8 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance
m_bDialogFire = bFire; m_bDialogFire = bFire;
std::string name;
pos.x = (1.0f-dim.x)/2.0f; pos.x = (1.0f-dim.x)/2.0f;
pos.y = (1.0f-dim.y)/2.0f; pos.y = (1.0f-dim.y)/2.0f;
pw = m_interface->CreateWindows(pos, dim, bFire?12:8, EVENT_WINDOW9); pw = m_interface->CreateWindows(pos, dim, bFire?12:8, EVENT_WINDOW9);
@ -6442,8 +6057,8 @@ void CMainDialog::StartSuspend()
{ {
m_sound->MuteAll(true); m_sound->MuteAll(true);
m_main->ClearInterface(); m_main->ClearInterface();
m_bInitPause = m_engine->GetPause(); m_bInitPause = m_pause->GetPauseType();
m_engine->SetPause(true); m_pause->SetPause(PAUSE_DIALOG);
m_engine->SetOverFront(false); // over flat behind m_engine->SetOverFront(false); // over flat behind
m_main->CreateShortcuts(); m_main->CreateShortcuts();
m_main->StartSuspend(); m_main->StartSuspend();
@ -6457,7 +6072,7 @@ void CMainDialog::StopSuspend()
{ {
m_sound->MuteAll(false); m_sound->MuteAll(false);
m_main->ClearInterface(); m_main->ClearInterface();
if ( !m_bInitPause ) m_engine->SetPause(false); m_pause->SetPause(m_bInitPause);
m_engine->SetOverFront(true); // over flat front m_engine->SetOverFront(true); // over flat front
m_main->CreateShortcuts(); m_main->CreateShortcuts();
m_main->StopSuspend(); m_main->StopSuspend();

View File

@ -23,6 +23,8 @@
#include "object/robotmain.h" #include "object/robotmain.h"
#include "app/pausemanager.h"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
@ -186,6 +188,7 @@ protected:
Gfx::CParticle* m_particle; Gfx::CParticle* m_particle;
Gfx::CCamera* m_camera; Gfx::CCamera* m_camera;
CSoundInterface* m_sound; CSoundInterface* m_sound;
CPauseManager* m_pause;
Phase m_phase; // copy of CRobotMain Phase m_phase; // copy of CRobotMain
Phase m_phaseSetup; // tab selected Phase m_phaseSetup; // tab selected
@ -242,26 +245,26 @@ protected:
bool m_bCameraInvertY; // for CCamera bool m_bCameraInvertY; // for CCamera
bool m_bEffect; // for CCamera bool m_bEffect; // for CCamera
Math::Point m_glintMouse; Math::Point m_glintMouse;
float m_glintTime; float m_glintTime;
int m_loadingCounter; int m_loadingCounter;
bool m_bDialog; // this dialogue? bool m_bDialog; // this dialogue?
bool m_bDialogFire; // setting on fire? bool m_bDialogFire; // setting on fire?
bool m_bDialogDelete; bool m_bDialogDelete;
Math::Point m_dialogPos; Math::Point m_dialogPos;
Math::Point m_dialogDim; Math::Point m_dialogDim;
float m_dialogParti; float m_dialogParti;
float m_dialogTime; float m_dialogTime;
bool m_bInitPause; PauseType m_bInitPause;
Gfx::CameraType m_initCamera; Gfx::CameraType m_initCamera;
int m_partiPhase[10]; int m_partiPhase[10];
float m_partiTime[10]; float m_partiTime[10];
Math::Point m_partiPos[10]; Math::Point m_partiPos[10];
SceneInfo m_sceneInfo[MAXSCENE]; SceneInfo m_sceneInfo[MAXSCENE];
std::vector<fs::path> m_saveList; std::vector<fs::path> m_saveList;
}; };

View File

@ -97,7 +97,6 @@ bool CMainShort::CreateShortcuts()
ObjectType type; ObjectType type;
Math::Point pos, dim; Math::Point pos, dim;
int i, rank, icon; int i, rank, icon;
char name[100];
if ( m_main->GetFixScene() ) return false; if ( m_main->GetFixScene() ) return false;
@ -208,10 +207,11 @@ bool CMainShort::CreateShortcuts()
m_shortcuts[rank] = pObj; m_shortcuts[rank] = pObj;
pc = m_interface->SearchControl(table_sc_em[rank]); pc = m_interface->SearchControl(table_sc_em[rank]);
if ( pc != 0 ) if ( pc != nullptr )
{ {
pObj->GetTooltipName(name); std::string tooltipName;
pc->SetTooltip(name); pObj->GetTooltipName(tooltipName);
pc->SetTooltip(tooltipName);
} }
rank ++; rank ++;

View File

@ -71,6 +71,7 @@ CStudio::CStudio()
m_main = CRobotMain::GetInstancePointer(); m_main = CRobotMain::GetInstancePointer();
m_interface = m_main->GetInterface(); m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera(); m_camera = m_main->GetCamera();
m_pause = CPauseManager::GetInstancePointer();
m_bEditMaximized = false; m_bEditMaximized = false;
m_bEditMinimized = false; m_bEditMinimized = false;
@ -97,7 +98,6 @@ bool CStudio::EventProcess(const Event &event)
CWindow* pw; CWindow* pw;
CEdit* edit; CEdit* edit;
CSlider* slider; CSlider* slider;
char res[100];
if ( m_dialog != SD_NULL ) // dialogue exists? if ( m_dialog != SD_NULL ) // dialogue exists?
{ {
@ -184,17 +184,17 @@ bool CStudio::EventProcess(const Event &event)
if ( event.type == EVENT_STUDIO_COMPILE ) // compile? if ( event.type == EVENT_STUDIO_COMPILE ) // compile?
{ {
char buffer[100];
if ( m_script->GetScript(edit) ) // compile if ( m_script->GetScript(edit) ) // compile
{ {
std::string res;
GetResource(RES_TEXT, RT_STUDIO_COMPOK, res); GetResource(RES_TEXT, RT_STUDIO_COMPOK, res);
SetInfoText(res, false); SetInfoText(res, false);
} }
else else
{ {
m_script->GetError(buffer); std::string error;
SetInfoText(buffer, false); m_script->GetError(error);
SetInfoText(error, false);
} }
} }
@ -218,9 +218,9 @@ bool CStudio::EventProcess(const Event &event)
} }
else else
{ {
char buffer[100]; std::string error;
m_script->GetError(buffer); m_script->GetError(error);
SetInfoText(buffer, false); SetInfoText(error, false);
} }
} }
} }
@ -344,7 +344,6 @@ bool CStudio::EventFrame(const Event &event)
CList* list; CList* list;
float time; float time;
int cursor1, cursor2, iCursor1, iCursor2; int cursor1, cursor2, iCursor1, iCursor2;
char res[100];
m_time += event.rTime; m_time += event.rTime;
m_fixInfoTextTime -= event.rTime; m_fixInfoTextTime -= event.rTime;
@ -363,6 +362,7 @@ bool CStudio::EventFrame(const Event &event)
m_bRunning = false; m_bRunning = false;
UpdateFlux(); // stop UpdateFlux(); // stop
AdjustEditScript(); AdjustEditScript();
std::string res;
GetResource(RES_TEXT, RT_STUDIO_PROGSTOP, res); GetResource(RES_TEXT, RT_STUDIO_PROGSTOP, res);
SetInfoText(res, false); SetInfoText(res, false);
@ -558,14 +558,13 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank)
CButton* button; CButton* button;
CSlider* slider; CSlider* slider;
CList* list; CList* list;
char res[100];
m_script = script; m_script = script;
m_rank = rank; m_rank = rank;
m_main->SetEditLock(true, true); m_main->SetEditLock(true, true);
m_main->SetEditFull(false); m_main->SetEditFull(false);
m_bInitPause = m_engine->GetPause(); m_bInitPause = m_pause->GetPauseType();
m_main->SetSpeed(1.0f); m_main->SetSpeed(1.0f);
m_editCamera = m_camera->GetType(); m_editCamera = m_camera->GetType();
m_camera->SetType(Gfx::CAM_TYPE_EDIT); m_camera->SetType(Gfx::CAM_TYPE_EDIT);
@ -575,28 +574,33 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank)
m_script->SetStepMode(!m_bRealTime); m_script->SetStepMode(!m_bRealTime);
button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT)); button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT));
if ( button != 0 ) if (button != nullptr)
{
button->ClearState(STATE_VISIBLE); button->ClearState(STATE_VISIBLE);
}
pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos(); pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos();
dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim(); dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim();
pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3); pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3);
if ( pw == nullptr ) return; if (pw == nullptr)
return;
pw->SetState(STATE_SHADOW); pw->SetState(STATE_SHADOW);
pw->SetRedim(true); // before SetName! pw->SetRedim(true); // before SetName!
pw->SetMovable(true); pw->SetMovable(true);
pw->SetClosable(true); pw->SetClosable(true);
std::string res;
GetResource(RES_TEXT, RT_STUDIO_TITLE, res); GetResource(RES_TEXT, RT_STUDIO_TITLE, res);
pw->SetName(res); pw->SetName(res);
pw->SetMinDim(Math::Point(0.49f, 0.50f)); pw->SetMinDim(Math::Point(0.49f, 0.50f));
pw->SetMaximized(m_bEditMaximized); pw->SetMaximized(m_bEditMaximized);
pw->SetMinimized(m_bEditMinimized); pw->SetMinimized(m_bEditMinimized);
m_main->SetEditFull(m_bEditMaximized); m_main->SetEditFull(m_bEditMaximized);
edit = pw->CreateEdit(pos, dim, 0, EVENT_STUDIO_EDIT); edit = pw->CreateEdit(pos, dim, 0, EVENT_STUDIO_EDIT);
if ( edit == 0 ) return; if (edit == nullptr)
return;
edit->SetState(STATE_SHADOW); edit->SetState(STATE_SHADOW);
edit->SetInsideScroll(false); edit->SetInsideScroll(false);
//? if ( m_bRunning ) edit->SetEdit(false); //? if ( m_bRunning ) edit->SetEdit(false);
@ -851,7 +855,6 @@ bool CStudio::StopEditScript(bool bCancel)
CWindow* pw; CWindow* pw;
CEdit* edit; CEdit* edit;
CButton* button; CButton* button;
char buffer[100];
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
if ( pw == nullptr ) return false; if ( pw == nullptr ) return false;
@ -863,8 +866,9 @@ bool CStudio::StopEditScript(bool bCancel)
{ {
if ( !m_script->GetScript(edit) ) // compile if ( !m_script->GetScript(edit) ) // compile
{ {
m_script->GetError(buffer); std::string error;
SetInfoText(buffer, false); m_script->GetError(error);
SetInfoText(error, false);
return false; return false;
} }
} }
@ -879,7 +883,7 @@ bool CStudio::StopEditScript(bool bCancel)
button->SetState(STATE_VISIBLE); button->SetState(STATE_VISIBLE);
} }
if ( !m_bInitPause ) m_engine->SetPause(false); m_pause->SetPause(m_bInitPause);
m_sound->MuteAll(false); m_sound->MuteAll(false);
m_main->SetEditLock(false, true); m_main->SetEditLock(false, true);
m_camera->SetType(m_editCamera); m_camera->SetType(m_editCamera);
@ -892,8 +896,6 @@ bool CStudio::StopEditScript(bool bCancel)
void CStudio::SetInfoText(std::string text, bool bClickable) void CStudio::SetInfoText(std::string text, bool bClickable)
{ {
char res[100];
if ( bClickable && m_fixInfoTextTime > 0.0f ) return; if ( bClickable && m_fixInfoTextTime > 0.0f ) return;
if ( !bClickable ) m_fixInfoTextTime = 8.0f; if ( !bClickable ) m_fixInfoTextTime = 8.0f;
@ -911,6 +913,7 @@ void CStudio::SetInfoText(std::string text, bool bClickable)
if ( bClickable ) if ( bClickable )
{ {
std::string res;
GetResource(RES_TEXT, RT_STUDIO_LISTTT, res); GetResource(RES_TEXT, RT_STUDIO_LISTTT, res);
list->SetTooltip(res); list->SetTooltip(res);
list->SetState(STATE_ENABLE); list->SetState(STATE_ENABLE);
@ -952,22 +955,22 @@ void CStudio::UpdateFlux()
#if 1 #if 1
if ( m_bRealTime ) // run? if ( m_bRealTime ) // run?
{ {
m_engine->SetPause(false); m_pause->ClearPause();
m_sound->MuteAll(false); m_sound->MuteAll(false);
} }
else // step by step? else // step by step?
{ {
m_engine->SetPause(true); m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true); m_sound->MuteAll(true);
} }
#else #else
m_engine->SetPause(false); m_pause->ClearPause();
m_sound->MuteAll(false); m_sound->MuteAll(false);
#endif #endif
} }
else // stop? else // stop?
{ {
m_engine->SetPause(true); m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true); m_sound->MuteAll(true);
} }
} }
@ -1029,7 +1032,7 @@ void CStudio::StartDialog(StudioDialog type)
CList* pli; CList* pli;
CEdit* pe; CEdit* pe;
Math::Point pos, dim; Math::Point pos, dim;
char name[100]; std::string name;
m_dialog = type; m_dialog = type;
@ -1108,17 +1111,11 @@ void CStudio::StartDialog(StudioDialog type)
GetResource(RES_TEXT, RT_IO_PRIVATE, name); GetResource(RES_TEXT, RT_IO_PRIVATE, name);
pc->SetName(name); pc->SetName(name);
pc->SetState(STATE_SHADOW); pc->SetState(STATE_SHADOW);
#if _POLISH
pc->SetFontSize(8.0f);
#endif
pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK2); pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK2);
GetResource(RES_TEXT, RT_IO_PUBLIC, name); GetResource(RES_TEXT, RT_IO_PUBLIC, name);
pc->SetName(name); pc->SetName(name);
pc->SetState(STATE_SHADOW); pc->SetState(STATE_SHADOW);
#if _POLISH
pc->SetFontSize(8.0f);
#endif
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK); pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK);
pb->SetState(STATE_SHADOW); pb->SetState(STATE_SHADOW);
@ -1476,8 +1473,6 @@ void CStudio::UpdateDialogPublic()
CWindow* pw; CWindow* pw;
CCheck* pc; CCheck* pc;
CLabel* pl; CLabel* pl;
char name[100];
//char text[MAX_FNAME+100];
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9)); pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9));
if ( pw == nullptr ) return; if ( pw == nullptr ) return;
@ -1497,7 +1492,7 @@ void CStudio::UpdateDialogPublic()
pl = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL1)); pl = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL1));
if ( pl != 0 ) if ( pl != 0 )
{ {
GetResource(RES_TEXT, RT_IO_LIST, name); // GetResource(RES_TEXT, RT_IO_LIST, name); // TODO: unused?
pl->SetName(SearchDirectory(false).c_str(), false); pl->SetName(SearchDirectory(false).c_str(), false);
} }
} }

View File

@ -22,6 +22,8 @@
#include "graphics/engine/camera.h" #include "graphics/engine/camera.h"
#include "app/pausemanager.h"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
@ -96,6 +98,7 @@ protected:
CSoundInterface* m_sound; CSoundInterface* m_sound;
CInterface* m_interface; CInterface* m_interface;
CApplication* m_app; CApplication* m_app;
CPauseManager* m_pause;
int m_rank; int m_rank;
CScript* m_script; CScript* m_script;
@ -109,11 +112,11 @@ protected:
Math::Point m_editFinalPos; Math::Point m_editFinalPos;
Math::Point m_editFinalDim; Math::Point m_editFinalDim;
float m_time; float m_time;
float m_fixInfoTextTime; float m_fixInfoTextTime;
bool m_bRunning; bool m_bRunning;
bool m_bRealTime; bool m_bRealTime;
bool m_bInitPause; PauseType m_bInitPause;
std::string m_helpFilename; std::string m_helpFilename;
StudioDialog m_dialog; StudioDialog m_dialog;

View File

@ -788,7 +788,7 @@ bool CWindow::GetFixed()
void CWindow::AdjustButtons() void CWindow::AdjustButtons()
{ {
char res[100]; std::string res;
if ( m_buttonFull != 0 ) if ( m_buttonFull != 0 )
{ {
@ -796,13 +796,13 @@ void CWindow::AdjustButtons()
{ {
m_buttonFull->SetIcon(54); m_buttonFull->SetIcon(54);
GetResource(RES_TEXT, RT_WINDOW_STANDARD, res); GetResource(RES_TEXT, RT_WINDOW_STANDARD, res);
m_buttonFull->SetTooltip(std::string(res)); m_buttonFull->SetTooltip(res);
} }
else else
{ {
m_buttonFull->SetIcon(52); m_buttonFull->SetIcon(52);
GetResource(RES_TEXT, RT_WINDOW_MAXIMIZED, res); GetResource(RES_TEXT, RT_WINDOW_MAXIMIZED, res);
m_buttonFull->SetTooltip(std::string(res)); m_buttonFull->SetTooltip(res);
} }
} }
@ -812,13 +812,13 @@ void CWindow::AdjustButtons()
{ {
m_buttonReduce->SetIcon(54); m_buttonReduce->SetIcon(54);
GetResource(RES_TEXT, RT_WINDOW_STANDARD, res); GetResource(RES_TEXT, RT_WINDOW_STANDARD, res);
m_buttonReduce->SetTooltip(std::string(res)); m_buttonReduce->SetTooltip(res);
} }
else else
{ {
m_buttonReduce->SetIcon(51); m_buttonReduce->SetIcon(51);
GetResource(RES_TEXT, RT_WINDOW_MINIMIZED, res); GetResource(RES_TEXT, RT_WINDOW_MINIMIZED, res);
m_buttonReduce->SetTooltip(std::string(res)); m_buttonReduce->SetTooltip(res);
} }
} }
@ -826,7 +826,7 @@ void CWindow::AdjustButtons()
{ {
m_buttonClose->SetIcon(11); // x m_buttonClose->SetIcon(11); // x
GetResource(RES_TEXT, RT_WINDOW_CLOSE, res); GetResource(RES_TEXT, RT_WINDOW_CLOSE, res);
m_buttonClose->SetTooltip(std::string(res)); m_buttonClose->SetTooltip(res);
} }
} }
@ -1536,8 +1536,6 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
void CWindow::DrawHach(Math::Point pos, Math::Point dim) void CWindow::DrawHach(Math::Point pos, Math::Point dim)
{ {
#if _NEWLOOK
#else
Math::Point ppos, ddim, uv1, uv2; Math::Point ppos, ddim, uv1, uv2;
float dp, max, ndim; float dp, max, ndim;
bool bStop; bool bStop;
@ -1575,7 +1573,6 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
ppos.x += ddim.x; ppos.x += ddim.x;
} }
while ( !bStop ); while ( !bStop );
#endif
} }
} }

View File

@ -1,5 +1,5 @@
# Compile flags as defined in global CMakeLists # Compile flags as defined in global CMakeLists
set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS} ${MXE_CFLAGS}") set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS} ${MXE_CFLAGS} ${COLOBOT_GTEST_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE}) set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG}) set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})

View File

@ -78,7 +78,7 @@ void Render(Gfx::CGLDevice *device)
worldMat.LoadIdentity(); worldMat.LoadIdentity();
device->SetTransform(Gfx::TRANSFORM_WORLD, worldMat); device->SetTransform(Gfx::TRANSFORM_WORLD, worldMat);
Gfx::VertexCol line[2] = { Gfx::VertexCol() }; Gfx::VertexCol line[2] = {};
for (int x = -40; x <= 40; ++x) for (int x = -40; x <= 40; ++x)
{ {
@ -103,7 +103,7 @@ void Render(Gfx::CGLDevice *device)
} }
Gfx::VertexCol quad[6] = { Gfx::VertexCol() }; Gfx::VertexCol quad[6] = {};
quad[0].coord = Math::Vector(-1.0f, -1.0f, 0.0f); quad[0].coord = Math::Vector(-1.0f, -1.0f, 0.0f);
quad[1].coord = Math::Vector( 1.0f, -1.0f, 0.0f); quad[1].coord = Math::Vector( 1.0f, -1.0f, 0.0f);

View File

@ -73,7 +73,7 @@ void Render(Gfx::CGLDevice *device)
worldMat.LoadIdentity(); worldMat.LoadIdentity();
device->SetTransform(Gfx::TRANSFORM_WORLD, worldMat); device->SetTransform(Gfx::TRANSFORM_WORLD, worldMat);
Gfx::VertexCol line[2] = { Gfx::VertexCol() }; Gfx::VertexCol line[2] = {};
for (int x = -40; x <= 40; ++x) for (int x = -40; x <= 40; ++x)
{ {
@ -98,7 +98,7 @@ void Render(Gfx::CGLDevice *device)
} }
Gfx::VertexCol quad[6] = { Gfx::VertexCol() }; Gfx::VertexCol quad[6] = {};
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
quad[i].color = Gfx::Color(1.0f, 1.0f, 0.0f); quad[i].color = Gfx::Color(1.0f, 1.0f, 0.0f);

View File

@ -6,6 +6,8 @@ if(MXE) # MXE requires special treatment
elseif(PLATFORM_WINDOWS) elseif(PLATFORM_WINDOWS)
# because it isn't included in standard linking libraries # because it isn't included in standard linking libraries
set(PLATFORM_LIBS "-lintl") set(PLATFORM_LIBS "-lintl")
elseif(PLATFORM_GNU)
set(PLATFORM_LIBS "-lX11")
elseif(PLATFORM_LINUX) elseif(PLATFORM_LINUX)
# for clock_gettime # for clock_gettime
set(PLATFORM_LIBS "-lrt -lX11") set(PLATFORM_LIBS "-lrt -lX11")
@ -21,6 +23,8 @@ configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/comm
# Code sources # Code sources
set(COLOBOT_SOURCES set(COLOBOT_SOURCES
${SRC_DIR}/app/app.cpp ${SRC_DIR}/app/app.cpp
${SRC_DIR}/app/gamedata.cpp
${SRC_DIR}/app/pausemanager.cpp
${SRC_DIR}/app/system.cpp ${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE} ${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
${SRC_DIR}/app/system_other.cpp ${SRC_DIR}/app/system_other.cpp

View File

@ -105,4 +105,6 @@ public:
MOCK_METHOD1(SetFillMode, void(Gfx::FillMode mode)); MOCK_METHOD1(SetFillMode, void(Gfx::FillMode mode));
MOCK_METHOD0(GetFillMode, Gfx::FillMode()); MOCK_METHOD0(GetFillMode, Gfx::FillMode());
MOCK_CONST_METHOD0(GetFrameBufferPixels, void*());
}; };

Some files were not shown because too many files have changed in this diff Show More