merging uni's branch and trunk

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13485 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hilnius
2013-08-15 12:35:23 +00:00
165 changed files with 3200 additions and 10445 deletions

View File

@@ -14,6 +14,15 @@ endif()
option(USE_WIIUSE "Support for wiimote input devices" OFF)
option(USE_FRIBIDI "Support for right-to-left languages" ON)
option(USE_CPP2011 "Activate C++ 2011 mode (GCC only)" OFF)
if(MSVC)
# Normally hide the option to build wiiuse on VS, since it depends
# on the installation of the Windows DDK (Driver Developer Kit),
# which also needs an absolute path :(
option(WIIUSE_BUILD "Build wiiuse lib (only for developers)" OFF)
mark_as_advanced(WIIUSE_BUILD)
else()
set(WIIUSE_BUILD ON)
endif()
set(STK_SOURCE_DIR "src")
set(STK_DATA_DIR "${PROJECT_SOURCE_DIR}/data")
@@ -33,17 +42,22 @@ include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet")
include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include")
# Build the Wiiuse library
if(USE_WIIUSE)
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse")
include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse")
endif()
# Build the irrlicht library
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht")
include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/include")
include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/source/Irrlicht")
# Build the Wiiuse library
# Note: wiiuse MUST be declared after irrlicht, since otherwise
# (at least on VS) irrlicht will find wiiuse io.h file because
# of the added include directory.
if(USE_WIIUSE)
if(WIIUSE_BUILD)
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse")
endif()
include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse")
endif()
include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/source/Irrlicht")
# Set include paths
@@ -229,14 +243,24 @@ if(USE_FRIBIDI)
add_definitions(-DENABLE_BIDI)
endif()
# Wiiuse
# ------
if(USE_WIIUSE)
if(APPLE)
find_library(BLUETOOTH_LIBRARY NAMES IOBluetooth PATHS /Developer/Library/Frameworks/IOBluetooth.framework)
target_link_libraries(supertuxkart wiiuse ${BLUETOOTH_LIBRARY})
elseif(MSVC)
add_definitions("/DWIIUSE_STATIC")
if(WIIUSE_BUILD)
target_link_libraries(supertuxkart wiiuse)
else()
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/wiiuse.lib)
endif()
else()
target_link_libraries(supertuxkart wiiuse bluetooth)
endif()
add_definitions(-DENABLE_WIIUSE)
endif()
@@ -269,4 +293,4 @@ install(FILES data/supertuxkart_32.xpm data/supertuxkart_64.xpm DESTINATION shar
set(PREFIX ${CMAKE_INSTALL_PREFIX})
configure_file(data/supertuxkart_desktop.template supertuxkart.desktop)
add_dependencies(supertuxkart supertuxkart.desktop)
add_dependencies(supertuxkart supertuxkart.desktop)

View File

@@ -3,12 +3,12 @@
<div x="5%" y="5%" width="90%" height="90%" layout="vertical-row">
<div x="5%" y="0%" width="90%" proportion="6" layout="horizontal-row" >
<div x="5%" y="0%" width="90%" proportion="5" layout="horizontal-row" >
<div width="40%" height="100%" layout="vertical-row" >
<icon id="icon" align="center" proportion="8" width="100%" icon="gui/loading.png"/>
<spacer proportion="1" />
<spacer proportion="1" width="1"/>
</div>
<spacer proportion="1" />
<spacer proportion="1" width="1" />
<div width="60%" height="50%" layout="vertical-row" >
<label id="name" width="100%" text_align="left"/>
<div width="100%" height="100%" layout="horizontal-row" >
@@ -17,25 +17,28 @@
<label id="revision" width="100%" text=""/>
</div>
<div width="50%" height="32" layout="vertical-row" >
<ratingbar id="rating" height="64" width="100%" />
<ratingbar id="rating" height="32" width="96" align="right"/>
</div>
</div>
<spacer height="10"/>
<spacer height="10" width="1"/>
<label id="flags" width="100%" text="" word_wrap="true"/>
</div>
</div>
<bubble word_wrap="true" id="description" height="100%" width="90%" proportion="5" align="center" />
<bubble word_wrap="true" id="description" height="100%" width="90%" proportion="6" align="center" />
<div width="80%" proportion="5" align="center">
<div width="80%" proportion="3" align="center">
<buttonbar id="actions" x="0" y="0" height="100%" width="100%" align="center">
<icon-button id="install" width="128" height="128"
<icon-button id="install" width="64" height="64"
icon="gui/package-update.png"
I18N="Add-on screen action" text="Install"/>
<icon-button id="uninstall" width="128" height="128"
<icon-button id="uninstall" width="64" height="64"
icon="gui/package-uninstall.png"
I18N="Add-on screen action" text="Uninstall"/>
<icon-button id="back" width="128" height="128"
<icon-button id="vote" width="64" height="64"
icon="gui/banana.png"
I18N="Add-ons screen action" text="Vote"/>
<icon-button id="back" width="64" height="64"
icon="gui/back.png"
I18N="Add-ons screen action" text="Back"/>
</buttonbar>

View File

@@ -4,5 +4,7 @@
<material name="speedback.png" compositing="test" clampU="Y" clampV="Y" light="N" ignore="Y"/>
<material name="speedfore.png" compositing="test" clampU="Y" clampV="Y" light="N" ignore="Y"/>
<material name="notes.png" compositing="test" light="N" ignore="Y"/>
<material name="soccer_player_red.png" compositing="blend" light="N" ignore="Y"/>
<material name="soccer_player_blue.png" compositing="blend" light="N" ignore="Y"/>
</materials>

View File

@@ -1,11 +1,11 @@
<stkgui>
<div x="2%" y="5%" width="96%" height="85%" layout="vertical-row" >
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the login dialog' dialog" text="Sign in"/>
<spacer height="20" width="50">
<spacer height="25" width="50">
<label id="message" proportion="2" width="90%" align="center" text_align="left" word_wrap="true" text=""/>
@@ -13,21 +13,15 @@
<div width="80%" align="center" layout="vertical-row" height="fit" >
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the login dialog" text="Username"/>
<div proportion="2" height="100%" layout="horizontal-row">
<spacer height="1" width="2%">
<textbox proportion="2" id="username" I18N="In the login dialog"/>
</div>
<label proportion="1" height="100%" text_align="left" I18N="In the login dialog" text="Username"/>
<textbox proportion="2" height="fit" id="username" I18N="In the login dialog"/>
</div>
<spacer height="20" width="20">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the login dialog" text="Password"/>
<div proportion="2" height="100%" layout="horizontal-row">
<spacer height="1" width="2%">
<textbox proportion="2" id="password" I18N="In the login dialog"/>
</div>
<label proportion="1" height="100%" text_align="left" I18N="In the login dialog" text="Password"/>
<textbox x="5" proportion="2" height="fit" id="password" I18N="In the login dialog"/>
</div>
<spacer height="20" width="20">
@@ -46,7 +40,7 @@
<spacer height="20" width="50">
<buttonbar id="options" width="90%" proportion="1" align="center">
<buttonbar id="options" width="90%" height="13%" align="center">
<icon-button id="sign_in" width="64" height="64" icon="gui/green_check.png"
I18N="Login dialog" text="Sign In" label_location="bottom"/>
<icon-button id="recovery" width="64" height="64" icon="gui/main_help.png"

View File

@@ -33,11 +33,13 @@
<buttonbar id="menu_bottomrow" x="0" y="0" width="12%" height="100%" align="center">
<icon-button id="sign_in" width="64" height="64" icon="gui/main_about.png" extend_label="50"
I18N="Main menu button" text="Sign In" label_location="hover"/>
I18N="Online menu button" text="Sign In" label_location="hover"/>
<icon-button id="register" width="64" height="64" icon="gui/tutorial.png" extend_label="75"
I18N="Main menu button" text="Register" label_location="hover"/>
I18N="Online menu button" text="Register" label_location="hover"/>
<icon-button id="profile" width="64" height="64" icon="gui/green_check.png" extend_label="50"
I18N="Online menu button" text="Profile" label_location="hover"/>
<icon-button id="sign_out" width="64" height="64" icon="gui/main_quit.png" extend_label="70"
I18N="Main menu button" text="Sign Out" label_location="hover"/>
I18N="Online menu button" text="Sign Out" label_location="hover"/>
</buttonbar>
</bottombar>

View File

@@ -0,0 +1,37 @@
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header id="title" text_align="center" width="80%" align="center" text="..."/>
<spacer height="25" width="10"/>
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.png" />
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" I18N="Section in the profile menu" text="Friends"/>
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<div x="1%" y="2%" width="98%" height="96%" layout="horizontal-row" >
<div proportion="2" height="100%" layout="vertical-row">
<box proportion="2" width="100%" align="center" layout="vertical-row" padding="6">
<list id="friends_list" x="0" y="0" width="100%" height="100%"/>
</box>
<spacer width="10" height="10"/>
<label height="fit" text_align="left" I18N="Profile friends" text="Look for more friends:"/>
<spacer width="10" height="10"/>
<div height="fit" width="100%" layout="horizontal-row" align="center">
<textbox id="search_box" proportion="1" height="100%"/>
<spacer width="10" height="10"/>
<button id="search_button" height="fit" width="fit" text="Search" />
</div>
</div>
<spacer width="2%" height="10"/>
<div proportion="1" height="100%" layout="horizontal-row" > </div>
</div>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
</stkgui>

View File

@@ -0,0 +1,23 @@
<stkgui>
<div x="1%" y="1%" width="98%" height="98%" layout="vertical-row" >
<header id="title" text_align="center" width="80%" align="center" text="..."/>
<spacer height="25" width="10"/>
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.png" I18N="Section in the profile menu" text="Overview"/>
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
</tabs>
<box proportion="1" width="100%" layout="vertical-row">
<div x="1%" y="2%" width="98%" height="96%" layout="vertical-row" >
</div>
</box>
</div>
<icon-button id="back" x="0" y="0" height="8%" icon="gui/back.png"/>
</stkgui>

View File

@@ -1,18 +1,18 @@
<stkgui>
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
<div x="2%" y="4%" width="96%" height="92%" layout="vertical-row" >
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the registration dialog' dialog" text="Registration Complete"/>
<spacer height="20" width="50">
<spacer height="25" width="50">
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" I18N="In the registration dialog"
text="You will receive an email with further instructions regarding account activation. Please be patient and be sure to check your spam folder."/>
<spacer height="20" width="50">
<buttonbar id="options" width="25%" height="15%" align="center">
<buttonbar id="options" width="25%" height="14%" align="center">
<icon-button id="cancel" width="64" height="64" icon="gui/green_check.png"
I18N="Registration dialog" text="Close" label_location="none"/>
</buttonbar>

View File

@@ -1,44 +1,44 @@
<stkgui>
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
<div x="2%" y="4%" width="96%" height="92%" layout="vertical-row" >
<header id="title" width="96%" proportion="1" text_align="center" word_wrap="true"
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the registration dialog' dialog" text="Registration"/>
<spacer height="40" width="50">
<spacer height="25" width="50">
<div width="80%" align="center" layout="vertical-row" height="fit">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the registration dialog" text="Username"/>
<textbox proportion="2" id="username" I18N="In the registration dialog"/>
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Username"/>
<textbox proportion="2" height="fit" id="username" I18N="In the registration dialog"/>
</div>
<spacer height="20" width="20">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the registration dialog" text="Password"/>
<textbox proportion="2" id="password" I18N="In the registration dialog"/>
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Password"/>
<textbox proportion="2" height="fit" id="password" I18N="In the registration dialog"/>
</div>
<spacer height="20" width="20">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the registration dialog" text="Confirm"/>
<textbox proportion="2" id="password_confirm" I18N="In the registration dialog"/>
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Confirm"/>
<textbox proportion="2" height="fit" id="password_confirm" I18N="In the registration dialog"/>
</div>
<spacer height="20" width="20">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the registration dialog" text="Email"/>
<textbox proportion="2" id="email" I18N="In the registration dialog"/>
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Email"/>
<textbox proportion="2" height="fit" id="email" I18N="In the registration dialog"/>
</div>
<spacer height="20" width="20">
<div width="100%" height="fit" layout="horizontal-row" >
<label proportion="1" text_align="left" I18N="In the registration dialog" text="Confirm"/>
<textbox proportion="2" id="email_confirm" I18N="In the registration dialog"/>
<label proportion="1" height="100%" text_align="left" I18N="In the registration dialog" text="Confirm"/>
<textbox proportion="2" height="fit" id="email_confirm" I18N="In the registration dialog"/>
</div>
</div>
@@ -49,7 +49,7 @@
<spacer height="20" width="50">
<buttonbar id="options" width="25%" proportion="1" align="center">
<buttonbar id="options" width="25%" height="14%" align="center">
<icon-button id="next" width="64" height="64" icon="gui/green_check.png"
I18N="Registration dialog" text="Next" label_location="none"/>
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"

View File

@@ -1,14 +1,15 @@
<stkgui>
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
<div x="2%" y="4%" width="96%" height="92%" layout="vertical-row" >
<header id="title" width="96%" proportion="1" text_align="center" word_wrap="true"
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the registration dialog' dialog" text="Terms and Agreement"/>
<spacer height="20" width="50">
<label id="terms" proportion="5" width="90%" align="center" text_align="center" word_wrap="true"
I18N="In the registration dialog' dialog" text="The terms will come here. In a fancy scroll box."/>
<spacer height="25" width="50">
<box proportion="5" width="90%" align="center" layout="vertical-row" padding="8">
<list id="terms" x="0" y="0" width="100%" height="100%"/>
</box>
<div align="center" width="fit" height="fit" layout="horizontal-row" >
<label text_align="center" align="center" I18N="In the registration dialog" word_wrap="true"
@@ -23,7 +24,7 @@
<spacer height="20" width="50">
<buttonbar id="options" width="45%" proportion="1" align="center">
<buttonbar id="options" width="45%" height="14%" align="center">
<icon-button id="previous" width="64" height="64" icon="gui/back.png"
I18N="Registration dialog" text="Previous" label_location="bottom"/>
<icon-button id="next" width="64" height="64" icon="gui/green_check.png"

View File

@@ -0,0 +1,23 @@
<stkgui>
<div x="0%" y="0%" width="100%" height="98%" layout="vertical-row" >
<div x="0" y="0" width="100%" layout="horizontal-row" height="8%">
<icon-button id="back" height="100%" icon="gui/back.png"/>
<header text_align="center" proportion="1" text="Server Selection" align="center"/>
</div>
<div height="fit" width="100%" layout="horizontal-row" align="center">
<textbox id="search_box" proportion="1" height="100%"/>
<spacer width="30" height="10"/>
<button id="search_button" height="fit" width="fit" text="Search" />
<spacer width="10" height="10"/>
</div>
<box proportion="1" width="98%" align="center" layout="vertical-row" padding="6">
<list id="user_list" x="0" y="0" width="100%" height="100%"/>
</box>
</div>
</stkgui>

View File

@@ -0,0 +1,27 @@
<stkgui>
<div x="2%" y="5%" width="96%" height="90%" layout="vertical-row" >
<header id="title" width="96%" height="fit" text_align="center" word_wrap="true"
I18N="In the vote dialog' dialog" text="Vote"/>
<spacer height="20" width="50">
<label id="info" proportion="1" width="90%" align="center" text_align="center" word_wrap="true" text=""/>
<spacer height="20" width="50">
<div width="90%" height="64" align="center" layout="vertical-row" >
<ratingbar id="rating" align="center" height="64" width="192"/>
</div>
<spacer height="40" width="50">
<buttonbar id="options" width="25%" height="20%" align="center">
<icon-button id="cancel" width="64" height="64" icon="gui/main_quit.png"
I18N="Vote dialog" text="Close" label_location="none"/>
</buttonbar>
</div>
</stkgui>

View File

@@ -1,220 +0,0 @@
<!--
Glass skin by Marianne Gagnon, released under creative-commons BY-SA 3.0+
Except background.jpg, by elisee
Except left_arrow, right_arrow and list_sort_up by Dakal
Except stars, by s@f
To make your own skin, I suggest simply duplicating this file and modifying it as needed.
There are two types of images : some will be simply stretched as a whole, others will
have non-stretchable borders (you cannot choose which one you must use, it's hardcoded
for each element type; though, as you will see below, for all "advanced stretching" images
you can easily fake "simple stretch")
All elements will have at least 2 properties :
type="X" sets what you're skinning with this entry
image="skinDirectory/imageName.png" sets which image is used for this element
Most elements also support states :
state="neutral"
state="focused"
state="down"
You can thus give different looks for different states. Not all widgets support all states,
see entries and comments below to know what's supported.
Note that checkboxes are an exception and have the following styles :
"neutral+unchecked"
"neutral+checked"
"focused+unchecked"
"focused+checked"
"Advanced stretching" images are split this way :
+----+--------------------+----+
| | | |
+----+--------------------+----+
| | | |
| | | |
| | | |
+----+--------------------+----+
| | | |
+----+--------------------+----+
The center border will be stretched in all directions. The 4 corners will not stretch at all.
Horizontal borders will stretch horizontally, verticallt borders will stretch vertically.
Use properties left_border="X" right_border="X" top_border="X" bottom_border="X" to specify
the size of each border in pixels (setting all borders to '0' makes the whole image scaled).
In some cases, you may not want vertical stretching to occur (like if the left and right sides
of the image must not be stretched vertically, e.g. for the spinner). In this case, pass
parameter preserve_h_aspect_ratios="true" to make the left and right areas stretch by keeping
their aspect ratio.
Some components may fill the full inner area with stuff; others will only take a smaller
area at the center. To adjust for this, there are properties "hborder_out_portion" and "vborder_out_portion"
that take a float from 0 to 1, representing the percentage of each border that goes out of the widget's
area (this might include stuff like shadows, etc.). The 'h' one is for horizontal borders,
the 'v' one is for vertical borders.
Finnally : the image is split, as shown above, into 9 areas. In osme cases, you may not want
all areas to be rendered. Then you can pass parameter areas="body+left+right+top+bottom"
and explicitely specify which parts you want to see. The 4 corner areas are only visible
when the border that intersect at this corner are enabled.
-->
<skin name="Glass" author="Marianne Gagnon (Auria)">
<!-- Stateless -->
<element type="background" image="glass/background.jpg" />
<element type="button" state="focused" image="glass/glassbutton_focused.png"
left_border="80" right_border="80" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" />
<element type="button" state="neutral" image="glass/glassbutton.png"
left_border="80" right_border="80" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" />
<!-- TODO : buttons could support 'pressed' state -->
<element type="textbubble" state="neutral" image="glass/textbubble.png"
left_border="13" right_border="13" top_border="13" bottom_border="13"
hborder_out_portion="0.7" vborder_out_portion="0.3" />
<element type="textbubble" state="focused" image="glass/textbubble2.png"
left_border="13" right_border="13" top_border="13" bottom_border="13"
hborder_out_portion="0.7" vborder_out_portion="0.3" />
<element type="progress" state="fill" image="glass/glassprogress_fill.png"
left_border="80" right_border="80" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" />
<element type="progress" state="neutral" image="glass/glassbutton.png"
left_border="80" right_border="80" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" />
<element type="tab" state="neutral" image="glass/glasstab.png"
left_border="75" right_border="75" top_border="0" bottom_border="15"
hborder_out_portion="0.2" />
<element type="tab" state="focused" image="glass/glasstab_focus.png"
left_border="75" right_border="75" top_border="0" bottom_border="15"
hborder_out_portion="0.2" />
<element type="tab" state="down" image="glass/glasstab_down.png"
left_border="75" right_border="75" top_border="0" bottom_border="15"
hborder_out_portion="0.2" />
<!-- Stateless -->
<element type="squareFocusHalo" image="glass/glass_square_focused.png"
left_border="6" right_border ="6" top_border="6" bottom_border="6"
hborder_out_portion="1.0" />
<element type="squareFocusHalo2" image="glass/glass_square_focused2.png"
left_border="6" right_border ="6" top_border="6" bottom_border="6"
hborder_out_portion="1.0" />
<element type="squareFocusHalo3" image="glass/glass_square_focused3.png"
left_border="6" right_border ="6" top_border="6" bottom_border="6"
hborder_out_portion="1.0" />
<element type="squareFocusHalo4" image="glass/glass_square_focused4.png"
left_border="6" right_border ="6" top_border="6" bottom_border="6"
hborder_out_portion="1.0" />
<!-- Stateless. No splitting into 9 areas is done; the image is just resized. -->
<element type="selectionHalo" image="glass/bubble.png" />
<element type="focusHalo" image="glass/glass_iconhighlight_focus.png" />
<element type="spinner" state="neutral" image="glass/glassspinner.png"
left_border="110" right_border="110" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
<element type="spinner" state="focused" image="glass/glassspinner_focus.png"
left_border="110" right_border="110" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
<!-- This one is a bit special. Only area(s) LEFT and/or RIGHT will be rendered. They will be overlaid
on top of the spinner's background -->
<element type="spinner" state="down" image="glass/glassspinner_down.png"
left_border="110" right_border="110" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
<!-- For checkboxes, no splitting into 9 areas is done; the image is just stretched -->
<element type="checkbox" state="neutral+unchecked" image="glass/glasscheckbox.png"/>
<element type="checkbox" state="neutral+checked" image="glass/glasscheckbox_checked.png"/>
<element type="checkbox" state="focused+unchecked" image="glass/glasscheckbox_focus.png"/>
<element type="checkbox" state="focused+checked" image="glass/glasscheckbox_checked_focus.png"/>
<!-- are always in neutral state for now. No splitting into 9 areas is done; the image is just stretched.
Note: the body of a guage is the same as for for spinners. -->
<element type="gaugefill" image="glass/glasssgauge_fill.png" />
<!-- Lists are always in neutral state for now -->
<element type="list" image="glass/glass_section.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<element type="listitem" state="focused" image="glass/glasssgauge_fill.png"
left_border="0" right_border="0" top_border="0" bottom_border="0"
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Scrollbars. Background and thumb have no state (always neutral state).
The buttons are the top and bottom arrows. Image must be top arrow, will
be mirrorred for bottom. Buttons can be in neutral or down state.
Advanced stretching is not used here.
-->
<element type="scrollbar_background" image="glass/scrollbar_bg.png" />
<element type="scrollbar_thumb" image="glass/scrollbar_thumb.png" />
<element type="scrollbar_button" image="glass/scrollbar_btn.png" />
<element type="scrollbar_button" state="down" image="glass/scrollbar_btn_down.png" />
<element type="left_arrow" state="neutral" image="glass/left_arrow.png" />
<element type="right_arrow" state="neutral" image="glass/right_arrow.png" />
<element type="left_arrow" state="focus" image="glass/left_arrow_focus.png" />
<element type="right_arrow" state="focus" image="glass/right_arrow_focus.png" />
<element type="list_header" state="neutral" image="glass/table_header.png" />
<element type="list_header" state="down" image="glass/table_header_down.png" />
<element type="list_sort_up" state="neutral" image="glass/list_sort_up.png" />
<element type="list_sort_down" state="neutral" image="glass/list_sort_down.png" />
<!-- Stateless -->
<element type="section" image="glass/glass_section.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Stateless -->
<element type="rounded_section" image="glass/glass_rsection.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="0.0" vborder_out_portion="0.0" />
<!-- Stateless -->
<element type="window" image="glass/dialog.png"
left_border="7" right_border="7" top_border="50" bottom_border="50"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
<!-- Stateless -->
<element type="tooltip" image="glass/tooltip.png"
left_border="10" right_border="10" top_border="10" bottom_border="10"
hborder_out_portion="1.0" vborder_out_portion="1.0" />
<!-- Colors -->
<color type="text" state="neutral" r="0" g="0" b="0" />
<color type="brighttext" state="neutral" r="255" g="145" b="0" />
<!-- For highlighted items, e.g. in list -->
<color type="text" state="focused" r="255" g="255" b="255" />
<!-- Color used to fade out background when a dialog is shown -->
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
<!-- Text field color -->
<color type="text_field" state="background" a="255" r="200" g="200" b="200" />
<color type="text_field" state="background_focused" a="255" r="195" g="222" b="194" />
<color type="text_field" state="neutral" a="255" r="138" g="138" b="138" />
<color type="text_field" state="focused" a="255" r="0" g="150" b="0" />
<!-- Rating star image -->
<element type="rating" state="neutral" image="glass/rating_star.png" />
</skin>

View File

@@ -67,12 +67,12 @@ when the border that intersect at this corner are enabled.
<element type="background" image="ocean/background.jpg" />
<element type="button" state="focused" image="ocean/glassbutton_focused.png"
left_border="80" right_border="80" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" />
left_border="13" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="button" state="neutral" image="ocean/glassbutton.png"
left_border="80" right_border="80" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" />
left_border="13" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<!-- TODO : buttons could support 'pressed' state -->

View File

@@ -67,12 +67,12 @@ when the border that intersect at this corner are enabled.
<element type="background" image="peach/background.jpg" />
<element type="button" state="focused" image="peach/glassbutton_focused.png"
left_border="80" right_border="80" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" />
left_border="13" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="button" state="neutral" image="peach/glassbutton.png"
left_border="80" right_border="80" top_border="0" bottom_border="36"
preserve_h_aspect_ratios="true" />
left_border="13" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<!-- TODO : buttons could support 'pressed' state -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -74,6 +74,9 @@
* rubber_ball-icon, plunger icon, cake icon, bowling ball texture and icon
by Totoplus62, released under CC-BY-SA 3.0
* shield-icon
by tuxfan, release under CC-BY-SA 3.0
Others are GPL, by the original (super)TuxKart team

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
data/models/shield-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -0,0 +1,20 @@
// Jean-manuel clemencon (c) supertuxkart 2013
// bubble gum shield
// TODO: Add a nice texture and soft edges when intersect with geometry
uniform sampler2D tex;
uniform float transparency;
varying vec2 uv;
varying vec3 eyeVec;
varying vec3 normal;
void main()
{
float inter = dot(normal, eyeVec);
float m = texture2D(tex, vec2(0.5, uv.y)).r;
inter = 1 - inter;
float alpha = inter + 1;// * m;
gl_FragColor = vec4(0.8, 0.16, 0.48, alpha);
}

View File

@@ -0,0 +1,23 @@
// Jean-manuel clemencon (c) supertuxkart 2013
// Creates a bubble gum shield effect
// ---
// TODO: The texture should reflect the strength of the shield,
// such that the user gets to know whether the shield has several
// "layers" or whether the shield is about to break.
varying vec2 uv;
varying vec3 eyeVec;
varying vec3 normal;
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
vec4 viewp = gl_ModelViewMatrix * gl_Vertex;
eyeVec = normalize(-viewp).xyz;
normal = gl_NormalMatrix * gl_Normal;
gl_Position = ftransform();
uv = gl_TexCoord[0].st;
}

View File

@@ -114,8 +114,10 @@
nolok-bubble-gum, easter egg -->
<switch time="5" items="1 0 4 4 2 5 2 7"/>
<!-- How often bubblegum get driven over before it disappears. -->
<bubblegum disappear-counter="1"/>
<!-- disappear-counter: How often bubblegum gets driven over before it disappears.
shield-time: How long the bubblegum shield lasts
restrict-weapons: If true, using weapons will destroy the user's shield -->
<bubblegum disappear-counter="1" shield-time="10.0" restrict-weapons="false"/>
<!-- explosion-impulse-objects is the impulse that pushes physical objects
away if there is an explosion. -->

View File

@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDYDCCAsmgAwIBAgIJAKYVnmvPe6cJMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNV
BAYTAkZSMQ8wDQYDVQQIEwZGcmFuY2UxEjAQBgNVBAcTCU1hcnNlaWxsZTEuMCwG
A1UEChMlVHV4RmFtaWx5Lm9yZyBub24tcHJvZml0IG9yZ2FuaXphdGlvbjEaMBgG
A1UEAxMRd2ViLnR1eGZhbWlseS5uZXQwHhcNMDgwNTE0MjMzMDI3WhcNMTgwNTEy
MjMzMDI3WjB+MQswCQYDVQQGEwJGUjEPMA0GA1UECBMGRnJhbmNlMRIwEAYDVQQH
EwlNYXJzZWlsbGUxLjAsBgNVBAoTJVR1eEZhbWlseS5vcmcgbm9uLXByb2ZpdCBv
cmdhbml6YXRpb24xGjAYBgNVBAMTEXdlYi50dXhmYW1pbHkubmV0MIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQCqCWPTYrW59LfzUtMgUFIse9ErIytmnNyVbzk6
11Zj0OTMuCp9ijHW47jqSp7OaOR7X5XmNyhltnidS7elXtVb/jZOINRzdejmLRWs
qBsnvWlab6kx+/u0kLAFH0w6s4Kg2K2s1eHtyid2IZLb+Xl29NGf+C6bRnUq9Bh2
6DF93QIDAQABo4HlMIHiMB0GA1UdDgQWBBSHuse3FoUQ1asK7+4YJ7FxH3tztzCB
sgYDVR0jBIGqMIGngBSHuse3FoUQ1asK7+4YJ7FxH3tzt6GBg6SBgDB+MQswCQYD
VQQGEwJGUjEPMA0GA1UECBMGRnJhbmNlMRIwEAYDVQQHEwlNYXJzZWlsbGUxLjAs
BgNVBAoTJVR1eEZhbWlseS5vcmcgbm9uLXByb2ZpdCBvcmdhbml6YXRpb24xGjAY
BgNVBAMTEXdlYi50dXhmYW1pbHkubmV0ggkAphWea897pwkwDAYDVR0TBAUwAwEB
/zANBgkqhkiG9w0BAQUFAAOBgQBYHLb4pjL7+xTk066JffNe1uCi2xXL93tsuphZ
6LVZkd3y4uIp9yayhUocOws8jptJHtr4TEV5AxS34B89AJgVERcj86K/RVSSwApO
g+ONYIyJ+Xdipdby6TIER+EgQxQJw1cxrMS3zzn7SNuo04CexqOTd5LUrtQJ/dOI
LPEqhw==
-----END CERTIFICATE-----

9473
diff.patch

File diff suppressed because it is too large Load Diff

View File

@@ -7,3 +7,5 @@ The following changes have been made:
- skies respect Z
- partial backport to expose setCurrentRendertime in the scene mgr
- a workaround for every other RTTs flipping
- aabbox intersection support
- texture override

View File

@@ -87,7 +87,16 @@ namespace video
EMF_POLYGON_OFFSET = 0x80000,
//! MaterialType override
EMF_MATERIAL_TYPE = 0x100000
EMF_MATERIAL_TYPE = 0x100000,
//! Texture
EMF_TEXTURE0 = 0x200000,
//! Texture
EMF_TEXTURE1 = 0x400000,
//! Texture
EMF_TEXTURE2 = 0x800000,
};
} // end namespace video

View File

@@ -201,6 +201,12 @@ namespace video
case EMF_POLYGON_OFFSET:
material.PolygonOffsetDirection = Material.PolygonOffsetDirection;
material.PolygonOffsetFactor = Material.PolygonOffsetFactor; break;
case EMF_TEXTURE0:
material.TextureLayer[0] = Material.TextureLayer[0]; break;
case EMF_TEXTURE1:
material.TextureLayer[1] = Material.TextureLayer[1]; break;
case EMF_TEXTURE2:
material.TextureLayer[2] = Material.TextureLayer[2]; break;
}
}
}

View File

@@ -245,6 +245,25 @@ class aabbox3d
(T)(line.getLength() * 0.5));
}
//! Returns the intersection of this box with another, if possible.
aabbox3d<T> intersect(const aabbox3d<T>& other) const
{
aabbox3d<T> out;
if (!intersectsWithBox(other))
return out;
out.MaxEdge.X = min_(MaxEdge.X, other.MaxEdge.X);
out.MaxEdge.Y = min_(MaxEdge.Y, other.MaxEdge.Y);
out.MaxEdge.Z = min_(MaxEdge.Z, other.MaxEdge.Z);
out.MinEdge.X = max_(MinEdge.X, other.MinEdge.X);
out.MinEdge.Y = max_(MinEdge.Y, other.MinEdge.Y);
out.MinEdge.Z = max_(MinEdge.Z, other.MinEdge.Z);
return out;
}
//! Tests if the box intersects with a line
/** \param linemiddle Center of the line.
\param linevect Vector of the line.

View File

@@ -16,7 +16,6 @@ set(WIIUSE_SOURCES
wiiuse.c
)
if(APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks")
@@ -27,4 +26,49 @@ if(APPLE)
)
endif()
add_library(wiiuse ${WIIUSE_SOURCES})
if(MSVC)
add_definitions("/DWIIUSE_STATIC")
add_library(wiiuse STATIC ${WIIUSE_SOURCES})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" /MTd)
else()
add_library(wiiuse ${WIIUSE_SOURCES})
endif()
if(MSVC)
if(MSVC90)
set(WIIUSE_VS_INCLUDE_DIR "C:\\Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\ 9.0\\VC\\include"
CACHE STRING "VS 9.0 include directory, see lib/wiiuse/README for details")
elseif(MSVC10)
set(WIIUSE_VS_INCLUDE_DIR "C:\\Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\ 10.0\\VC\\include"
CACHE STRING "VS 10.0 include directory, see lib/wiiuse/README for details")
endif()
mark_as_advanced(WIIUSE_VS_INCLUDE_DIR)
if(MSVC90 OR MSVC10)
# VS 9 does not have the windows device driver kit
# So the driver must be installed additionally. Also,
# in order to avoid a compilation error, you have to
# specify the visual studio include path FIRST (google
# it, known issue). So in this case add appropriate
# variables that can be set.
set(WIIUSE_WINDDK_ROOT "C:/WinDDK" CACHE
STRING "Install directory of Windows Driver Kits")
mark_as_advanced(WIIUSE_WINDDK_ROOT)
include_directories(${WIIUSE_VS_INCLUDE_DIR} ${WIIUSE_WINDDK_ROOT}/inc/api)
endif()
add_library(setupapi.lib STATIC IMPORTED)
add_library(hid.lib STATIC IMPORTED)
set_target_properties(setupapi.lib PROPERTIES
IMPORTED_LOCATION ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/setupapi.lib)
set_target_properties(hid.lib PROPERTIES
IMPORTED_LOCATION ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/hid.lib)
# This doesn't work for me with VS 11, which apparently finds its own
# copy of the libs
if(MSVC90 OR MSVC10)
set_target_properties(wiiuse PROPERTIES STATIC_LIBRARY_FLAGS
"${WIIUSE_WINDDK_ROOT}/lib/win7/i386/setupapi.lib ${WIIUSE_WINDDK_ROOT}/lib/win7/i386/hid.lib")
else()
set_target_properties(wiiuse PROPERTIES STATIC_LIBRARY_FLAGS "setupapi.lib hid.lib")
endif()
endif()

View File

@@ -173,6 +173,8 @@ src/network/types.cpp
src/online/current_user.cpp
src/online/http_manager.cpp
src/online/messages.cpp
src/online/profile.cpp
src/online/profile_manager.cpp
src/online/request.cpp
src/online/server.cpp
src/online/servers_manager.cpp
@@ -215,6 +217,7 @@ src/states_screens/dialogs/select_challenge.cpp
src/states_screens/dialogs/server_info_dialog.cpp
src/states_screens/dialogs/track_info_dialog.cpp
src/states_screens/dialogs/tutorial_message_dialog.cpp
src/states_screens/dialogs/vote_dialog.cpp
src/states_screens/feature_unlocked.cpp
src/states_screens/grand_prix_lose.cpp
src/states_screens/grand_prix_win.cpp
@@ -225,10 +228,13 @@ src/states_screens/help_screen_4.cpp
src/states_screens/kart_selection.cpp
src/states_screens/main_menu_screen.cpp
src/states_screens/networking_lobby.cpp
src/states_screens/networking_lobby_settings.cpp
src/states_screens/network_kart_selection.cpp
src/states_screens/offline_kart_selection.cpp
src/states_screens/online_profile_base.cpp
src/states_screens/online_profile_friends.cpp
src/states_screens/online_profile_overview.cpp
src/states_screens/online_screen.cpp
src/states_screens/online_user_search.cpp
src/states_screens/options_screen_audio.cpp
src/states_screens/options_screen_input2.cpp
src/states_screens/options_screen_input.cpp
@@ -465,6 +471,8 @@ src/network/types.hpp
src/online/current_user.hpp
src/online/http_manager.hpp
src/online/messages.hpp
src/online/profile.hpp
src/online/profile_manager.hpp
src/online/request.hpp
src/online/server.hpp
src/online/servers_manager.hpp
@@ -510,6 +518,7 @@ src/states_screens/dialogs/select_challenge.hpp
src/states_screens/dialogs/server_info_dialog.hpp
src/states_screens/dialogs/track_info_dialog.hpp
src/states_screens/dialogs/tutorial_message_dialog.hpp
src/states_screens/dialogs/vote_dialog.hpp
src/states_screens/feature_unlocked.hpp
src/states_screens/grand_prix_lose.hpp
src/states_screens/grand_prix_win.hpp
@@ -520,10 +529,13 @@ src/states_screens/help_screen_4.hpp
src/states_screens/kart_selection.hpp
src/states_screens/main_menu_screen.hpp
src/states_screens/networking_lobby.hpp
src/states_screens/networking_lobby_settings.hpp
src/states_screens/network_kart_selection.hpp
src/states_screens/offline_kart_selection.hpp
src/states_screens/online_profile_base.hpp
src/states_screens/online_profile_friends.hpp
src/states_screens/online_profile_overview.hpp
src/states_screens/online_screen.hpp
src/states_screens/online_user_search.hpp
src/states_screens/options_screen_audio.hpp
src/states_screens/options_screen_input2.hpp
src/states_screens/options_screen_input.hpp

View File

@@ -115,7 +115,7 @@ private:
/** Compressed size of the addon package. */
int m_size;
/** Rating for thsi addon package. */
float m_rating;
mutable float m_rating;
/** Minimum version addon is included with. */
std::string m_min_include_ver;
/** Maximum version addon is included with. */
@@ -151,6 +151,9 @@ public:
/** Returns the rating of an addon. */
const float getRating() const {return m_rating; }
// ------------------------------------------------------------------------
/** Sets the rating of an addon. */
void setRating(const float rating) const {m_rating = rating; }
// ------------------------------------------------------------------------
/** Returns the type of the addon. */
const std::string& getType() const { return m_type; }
// ------------------------------------------------------------------------

View File

@@ -42,8 +42,10 @@ ThreeDAnimation::ThreeDAnimation(const XMLNode &node, TrackObject* object) : Ani
m_crash_reset = false;
m_explode_kart = false;
m_flatten_kart = false;
node.get("reset", &m_crash_reset);
node.get("explode", &m_explode_kart);
node.get("flatten", &m_flatten_kart);
m_important_animation = (World::getWorld()->getIdent() == IDENT_CUSTSCENE);
node.get("important", &m_important_animation);

View File

@@ -53,6 +53,8 @@ private:
/** True if a collision with this object should trigger
* "exploding" a kart. */
bool m_explode_kart;
bool m_flatten_kart;
/** We have to store the rotation value as computed in blender, since
* irrlicht uses a different order, so for rotation animations we
@@ -75,6 +77,7 @@ public:
* trigger a rescue. */
bool isCrashReset() const { return m_crash_reset; }
bool isExplodeKartObject() const { return m_explode_kart; }
bool isFlattenKartObject() const { return m_flatten_kart; }
}; // ThreeDAnimation
#endif

View File

@@ -118,6 +118,7 @@ void STKConfig::load(const std::string &filename)
CHECK_NEG(m_anvil_weight, "anvil-weight" );
CHECK_NEG(m_item_switch_time, "item-switch-time" );
CHECK_NEG(m_bubblegum_counter, "bubblegum disappear counter");
CHECK_NEG(m_bubblegum_shield_time, "bubblegum shield-time" );
CHECK_NEG(m_explosion_impulse_objects, "explosion-impulse-objects" );
CHECK_NEG(m_max_history, "max-history" );
CHECK_NEG(m_max_skidmarks, "max-skidmarks" );
@@ -159,6 +160,8 @@ void STKConfig::init_defaults()
m_smooth_angle_limit =
m_penalty_time = m_explosion_impulse_objects = UNDEFINED;
m_bubblegum_counter = -100;
m_bubblegum_shield_time = -100;
m_shield_restrict_weapos = false;
m_max_karts = -100;
m_max_history = -100;
m_max_skidmarks = -100;
@@ -335,7 +338,9 @@ void STKConfig::getAllData(const XMLNode * root)
if(const XMLNode *bubblegum_node= root->getNode("bubblegum"))
{
bubblegum_node->get("disappear-counter", &m_bubblegum_counter);
bubblegum_node->get("disappear-counter", &m_bubblegum_counter );
bubblegum_node->get("shield-time", &m_bubblegum_shield_time );
bubblegum_node->get("restrict-weapons", &m_shield_restrict_weapos);
}
if(const XMLNode *explosion_node= root->getNode("explosion"))

View File

@@ -74,8 +74,10 @@ public:
passed on. */
float m_anvil_time; /**<Time an anvil is active. */
float m_item_switch_time; /**< Time items will be switched. */
int m_bubblegum_counter; /**< How many times bananas must be eaten
before they disappear. */
int m_bubblegum_counter; /**< How many times bubble gums must be
driven over before they disappear. */
float m_bubblegum_shield_time; /**<How long a bubble gum shield lasts. */
bool m_shield_restrict_weapos; /**<Wether weapon usage is punished. */
float m_explosion_impulse_objects;/**<Impulse of explosion on moving
objects, e.g. road cones, ... */
float m_penalty_time; /**< Penalty time when starting too

View File

@@ -850,12 +850,14 @@ PerCameraNode *IrrDriver::addPerCameraMesh(scene::IMesh* mesh,
*/
scene::ISceneNode *IrrDriver::addBillboard(const core::dimension2d< f32 > size,
video::ITexture *texture,
scene::ISceneNode* parent)
scene::ISceneNode* parent, bool alphaTesting)
{
scene::IBillboardSceneNode* node =
m_scene_manager->addBillboardSceneNode(parent, size);
assert(node->getMaterialCount() > 0);
node->setMaterialTexture(0, texture);
if(alphaTesting)
node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
return node;
} // addMesh
@@ -1863,9 +1865,9 @@ void IrrDriver::RTTProvider::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
}
}
irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 10, 10, 10) );
irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 35, 35, 35) );
const core::vector3df &spot_pos = core::vector3df(30, 30, 30);
const core::vector3df &spot_pos = core::vector3df(0, 30, 40);
m_light = irr_driver->getSceneManager()
->addLightSceneNode(NULL, spot_pos, video::SColorf(1.0f,1.0f,1.0f),
1600 /* radius */);

View File

@@ -159,7 +159,7 @@ public:
scene::ISceneNode *parent = NULL);
scene::ISceneNode *addBillboard(const core::dimension2d< f32 > size,
video::ITexture *texture,
scene::ISceneNode* parent=NULL);
scene::ISceneNode* parent=NULL, bool alphaTesting = false);
scene::IParticleSystemSceneNode
*addParticleNode(bool default_emitter=true);

View File

@@ -681,13 +681,14 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
{
Widget* w = GUIEngine::getWidget(id);
if (w == NULL) break;
if (w->m_deactivated)
{
GUIEngine::getCurrentScreen()->onDisabledItemClicked(w->m_properties[PROP_ID].c_str());
return EVENT_BLOCK;
}
w->onClick();
// These events are only triggered by mouse (or so I hope)
// The player that owns the mouser receives "game master" priviledges
return onWidgetActivated(w, PLAYER_ID_GAME_MASTER);

View File

@@ -813,14 +813,13 @@ void Skin::drawProgress(Widget* w, const core::recti &rect,
void Skin::drawRatingBar(Widget *w, const core::recti &rect,
const bool pressed, const bool focused)
{
static const int step_number = 3; // Harcoded number of step.
RatingBarWidget *ratingBar = (RatingBarWidget*)w;
const ITexture *texture = SkinConfig::m_render_params["rating::neutral"].getImage();
const int texture_w = texture->getSize().Width / 4;
const int texture_h = texture->getSize().Height;
const float aspect_ratio = 1.0f;
RatingBarWidget *ratingBar = (RatingBarWidget*)w;
const int star_number = ratingBar->getStarNumber();
int star_h = rect.getHeight();
@@ -834,8 +833,18 @@ void Skin::drawRatingBar(Widget *w, const core::recti &rect,
}
// center horizontally and vertically
const int x_from = rect.UpperLeftCorner.X + (rect.getWidth() - star_w) / 2;
const int y_from = rect.UpperLeftCorner.Y + (rect.getHeight() - star_h) / 2;
const int x_from = rect.UpperLeftCorner.X; // + (rect.getWidth() - star_w) / 2;
const int y_from = rect.UpperLeftCorner.Y; // + (rect.getHeight() - star_h) / 2;
core::recti stars_rect(x_from, y_from, x_from + (star_number * star_w), y_from + star_h);
if(!w->m_deactivated)
ratingBar->setStepValuesByMouse(irr_driver->getDevice()->getCursorControl()->getPosition(), stars_rect);
SColor colors[] = { SColor(100,255,255,255),
SColor(100,255,255,255),
SColor(100,255,255,255),
SColor(100,255,255,255) };
for (int i = 0; i < star_number; i++)
{
@@ -846,14 +855,15 @@ void Skin::drawRatingBar(Widget *w, const core::recti &rect,
star_rect.LowerRightCorner.X = x_from + (i + 1) * star_w;
star_rect.LowerRightCorner.Y = y_from + star_h;
int step = ratingBar->getStepOfStar(i, step_number);
int step = ratingBar->getStepsOfStar(i);
const core::recti source_area(texture_w * step, 0,
texture_w * (step + 1), texture_h);
GUIEngine::getDriver()->draw2DImage(texture,
star_rect, source_area,
0 /* no clipping */, 0,
0 /* no clipping */,
(w->m_deactivated || ID_DEBUG) ? colors : 0,
true /* alpha */);
}
@@ -2020,8 +2030,8 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor,
SColor& border_color_focus = SkinConfig::m_colors["text_field::focused"];
core::recti borderArea = rect;
borderArea.UpperLeftCorner -= position2d< s32 >( 2, 2 );
borderArea.LowerRightCorner += position2d< s32 >( 2, 2 );
//borderArea.UpperLeftCorner -= position2d< s32 >( 2, 2 );
//borderArea.LowerRightCorner += position2d< s32 >( 2, 2 );
// if within an appearing dialog, grow
if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL &&
@@ -2046,8 +2056,8 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor,
GUIEngine::getDriver()->draw2DRectangle(focused ? border_color_focus : border_color, borderArea);
core::recti innerArea = borderArea;
innerArea.UpperLeftCorner += position2d< s32 >( 2, 2 );
innerArea.LowerRightCorner -= position2d< s32 >( 2, 2 );
innerArea.UpperLeftCorner += position2d< s32 >( 3, 3 );
innerArea.LowerRightCorner -= position2d< s32 >( 3, 3 );
GUIEngine::getDriver()->draw2DRectangle(focused ? bg_color_focused : bg_color, innerArea);
return;
}

View File

@@ -362,4 +362,3 @@ void Widget::moveIrrlichtElement()
irr::core::dimension2di(m_w, m_h) ) );
}
}

View File

@@ -650,6 +650,9 @@ namespace GUIEngine
*/
bool ok() const { return (m_magic_number == 0xCAFEC001); }
/** Gets called when the widget is active and got clicked. (Only works for button widgets for now.) */
virtual void onClick() { }
};

View File

@@ -16,6 +16,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/widgets/rating_bar_widget.hpp"
#include "utils/string_utils.hpp"
#include <string.h>
@@ -23,6 +24,7 @@
#include <IGUIEnvironment.h>
#include <IGUIElement.h>
#include <IGUIButton.h>
#include <cmath>
using namespace GUIEngine;
using namespace irr::core;
@@ -31,16 +33,21 @@ using namespace irr;
// -----------------------------------------------------------------------------
RatingBarWidget::RatingBarWidget() : Widget(WTYPE_RATINGBAR)
{
m_rating = 0;
m_star_number = 0;
m_allow_voting = false;
m_rating = 0.0f;
m_hover_rating = 0.0f;
m_stars = 3;
m_steps = 3;
m_hovering = false;
for(int i = 0; i < m_stars; i++)
m_star_values.push_back(0);
}
// -----------------------------------------------------------------------------
void RatingBarWidget::add()
{
rect<s32> widget_size = rect<s32>(m_x, m_y, m_x + m_w, m_y + m_h);
const irr::core::recti widget_size = rect<s32>(m_x, m_y, m_x + m_w, m_y + m_h);
m_element = GUIEngine::getGUIEnv()->addButton(widget_size, m_parent, getNewNoFocusID(), NULL, L"");
m_id = m_element->getID();
m_element->setTabStop(false);
m_element->setTabGroup(false);
@@ -50,36 +57,65 @@ void RatingBarWidget::add()
/** Get the current step of the star
*
* \param index The index of the star.
* \param max_step The number of different steps that a star can display. Two
* step are obligatory: full and empty.
* \return The current step of the star.
*/
int RatingBarWidget::getStepOfStar(int index, int max_step)
int RatingBarWidget::getStepsOfStar(int index)
{
assert(index >= 0 && index < m_star_number); // Index must be between 0 and m_star_number - 1.
assert(max_step >= 2); // The maximun number of step must be superior or equals to 2.
assert(index >= 0 && index < m_stars); // Index must be between 0 and m_star_number - 1.
if (m_rating < index)
{
return 0;
}
else if (m_rating > index + 1)
{
return max_step - 1;
}
else
{
float step_size = 1 / (float)(max_step - 1);
for (int i = 0; i < max_step; i++)
{
if (m_rating > index + step_size * (i - 0.5)
&& m_rating < index + step_size * (i + 0.5))
return i;
}
}
return 0;
// TODO: Assert or throws a exception, what type?
return m_star_values[index];
} // getStepOfStar
void RatingBarWidget::setStepValues(float float_rating)
{
for (int star = 0; star < m_stars; star++)
{
if (float_rating < star)
m_star_values[star] = 0;
else if (float_rating > star + 1)
m_star_values[star] = m_steps-1;
else
{
m_star_values[star] = round((float_rating * (m_steps-1)) - (star*(m_steps-1)));
}
}
}
// -----------------------------------------------------------------------------
void RatingBarWidget::setRating(float rating)
{
m_rating = rating;
setStepValues(m_rating);
}
// -----------------------------------------------------------------------------
void RatingBarWidget::setStepValuesByMouse(const core::position2di & mouse_position, const core::recti & stars_rect)
{
if(m_allow_voting){
if(stars_rect.isPointInside(mouse_position))
{
m_hovering = true;
float exact_hover = (float)(mouse_position.X - stars_rect.UpperLeftCorner.X) / (float)stars_rect.getWidth() * (float)m_stars;
m_hover_rating = round(exact_hover * (m_steps-1)) / (m_steps-1);
setStepValues(m_hover_rating);
}
else if(m_hovering)
{
setStepValues(m_rating);
m_hovering = false;
}
}
}
void RatingBarWidget::onClick()
{
if(m_allow_voting)
m_rating = m_hover_rating;
}

View File

@@ -1,5 +1,6 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2009 Marianne Gagnon
// 2013 Glenn De Jonghe
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -34,10 +35,17 @@ namespace GUIEngine
*/
class RatingBarWidget : public Widget
{
float m_rating;
int m_star_number;
private:
float m_rating;
float m_hover_rating;
int m_stars;
int m_steps;
std::vector<int> m_star_values;
bool m_hovering;
bool m_allow_voting;
void setStepValues(float rating);
public:
LEAK_CHECK()
@@ -45,21 +53,29 @@ namespace GUIEngine
RatingBarWidget();
virtual ~RatingBarWidget() {}
void add();
/** Change the rating value of the widget. */
void setRating(float rating) { m_rating = rating; };
void setRating(float rating);
/** Get the current value of the widget. */
float getRating() {return m_rating; };
/** Change the number of star of the widget. */
void setStarNumber(int star_number) { m_star_number = star_number; };
/** Change the number of stars of the widget. */
void setStarNumber(int star_number) { m_stars = star_number; };
/** Get the current number of star of the widget. */
int getStarNumber() {return m_star_number; };
/** Get the current number of stars of the widget. */
int getStarNumber() {return m_stars; };
int getStepOfStar(int index, int max_step);
int getStepsOfStar(int index);
void setStepValuesByMouse(const core::position2di & mouse_position, const core::recti & stars_rect);
virtual void onClick();
void allowVoting() { m_allow_voting = true; }
};
}

View File

@@ -17,10 +17,19 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <irrlicht.h>
#include "io/file_manager.hpp"
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp"
#include "karts/kart_properties_manager.hpp"
#include "tracks/track_manager.hpp"
#include "utils/log.hpp"
#include "utils/string_utils.hpp"
#include <irrlicht.h>
#include <stdio.h>
#include <stdexcept>
#include <sstream>
@@ -32,38 +41,20 @@
#if !defined(WIN32)
# include <sys/stat.h>
# include <sys/types.h>
// For RemoveDirectory
# include <dirent.h>
# include <unistd.h>
#else
# include <direct.h>
# include <Windows.h>
#endif
/*Needed by the remove directory function */
#ifndef WIN32
# include <dirent.h>
#endif
#ifdef WIN32
# include <io.h>
# include <stdio.h>
# ifndef __CYGWIN__
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
# endif
#else
# include <unistd.h>
#endif
#include "btBulletDynamicsCommon.h"
/*Needed by the remove directory function */
#include "config/user_config.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/material_manager.hpp"
#include "karts/kart_properties_manager.hpp"
#include "tracks/track_manager.hpp"
#include "utils/log.hpp"
#include "utils/string_utils.hpp"
#ifdef __APPLE__

View File

@@ -34,7 +34,8 @@
#include "modes/three_strikes_battle.hpp"
#include "modes/world.hpp"
#include "utils/constants.hpp"
#include "utils/log.hpp" //TODO: remove after debugging is done
// Log::verbose("attachment", "Decreasing shield \n");
/** Initialises the attachment each kart has.
*/
Attachment::Attachment(AbstractKart* kart)
@@ -90,7 +91,7 @@ void Attachment::set(AttachmentType type, float time,
{
bool was_bomb = (m_type == ATTACH_BOMB);
scene::ISceneNode* bomb_scene_node = NULL;
if (was_bomb && type == ATTACH_SWATTER)
if (was_bomb && type == ATTACH_SWATTER) //What about ATTACH_NOLOKS_SWATTER ??
{
// let's keep the bomb node, and create a new one for
// the new attachment
@@ -204,6 +205,13 @@ void Attachment::clear()
*/
void Attachment::hitBanana(Item *item, int new_attachment)
{
//Bubble gum shield effect:
if(m_type == ATTACH_BUBBLEGUM_SHIELD)
{
m_time_left -= stk_config->m_bubblegum_shield_time;
return;
}
float leftover_time = 0.0f;
bool add_a_new_item = true;
@@ -403,6 +411,18 @@ void Attachment::update(float dt)
case ATTACH_TINYTUX:
// Nothing to do for tinytux, this is all handled in EmergencyAnimation
break;
case ATTACH_BUBBLEGUM_SHIELD:
if(!m_kart->isShielded())
{
m_time_left = 0.0f;
if (m_kart->m_bubble_drop)
{
Log::verbose("Attachment", "Drop a small bubble gum. \n");;
//TODO: drop a bubble gum item on the track
}
}
break;
} // switch
// Detach attachment if its time is up.

View File

@@ -59,6 +59,7 @@ public:
ATTACH_SWATTER,
ATTACH_NOLOKS_SWATTER,
ATTACH_TINYTUX,
ATTACH_BUBBLEGUM_SHIELD,
ATTACH_MAX,
ATTACH_NOTHING
};

View File

@@ -47,13 +47,14 @@ struct initAttachmentType {Attachment::AttachmentType attachment;
static const initAttachmentType iat[]=
{
{Attachment::ATTACH_PARACHUTE, "parachute.b3d", "parachute-attach-icon.png"},
{Attachment::ATTACH_BOMB, "bomb.b3d", "bomb-attach-icon.png" },
{Attachment::ATTACH_ANVIL, "anchor.b3d", "anchor-attach-icon.png" },
{Attachment::ATTACH_SWATTER, "swatter.b3d", "swatter-icon.png" },
{Attachment::ATTACH_NOLOKS_SWATTER, "swatter_nolok.b3d","swatter-icon.png" },
{Attachment::ATTACH_TINYTUX, "reset-button.b3d", "reset-attach-icon.png" },
{Attachment::ATTACH_MAX, "", "" },
{Attachment::ATTACH_PARACHUTE, "parachute.b3d", "parachute-attach-icon.png" },
{Attachment::ATTACH_BOMB, "bomb.b3d", "bomb-attach-icon.png" },
{Attachment::ATTACH_ANVIL, "anchor.b3d", "anchor-attach-icon.png" },
{Attachment::ATTACH_SWATTER, "swatter.b3d", "swatter-icon.png" },
{Attachment::ATTACH_NOLOKS_SWATTER, "swatter_nolok.b3d", "swatter-icon.png" },
{Attachment::ATTACH_TINYTUX, "reset-button.b3d", "reset-attach-icon.png" },
{Attachment::ATTACH_BUBBLEGUM_SHIELD, "bubblegum_shield.b3d", "shield-icon.png" },
{Attachment::ATTACH_MAX, "", "" },
};
//-----------------------------------------------------------------------------

View File

@@ -24,6 +24,8 @@
#include "karts/abstract_kart.hpp"
#include "utils/random_generator.hpp"
#include "utils/log.hpp" //TODO: remove after debugging is done
float Bowling::m_st_max_distance; // maximum distance for a bowling ball to be attracted
float Bowling::m_st_max_distance_squared;
float Bowling::m_st_force_to_target;
@@ -213,11 +215,21 @@ bool Bowling::hit(AbstractKart* kart, PhysicalObject* obj)
bool was_real_hit = Flyable::hit(kart, obj);
if(was_real_hit)
{
m_has_hit_kart = kart != NULL;
explode(kart, obj, /*hit_secondary*/false);
if(kart && kart->isShielded())
{
kart->decreaseShieldTime(0.0f); //Decreasing the shield time by the default value.
Log::verbose("Bowling", "Decreasing shield!");
return true;
}
else
{
m_has_hit_kart = kart != NULL;
explode(kart, obj, /*hit_secondary*/false);
}
}
return was_real_hit;
} // hit
// ----------------------------------------------------------------------------
/** Returns the hit effect object to use when this objects hits something.
* \returns The hit effect object, or NULL if no hit effect should be played.

View File

@@ -26,6 +26,8 @@
#include "utils/constants.hpp"
#include "utils/random_generator.hpp"
#include "utils/log.hpp" //TODO: remove after debugging is done
float Cake::m_st_max_distance_squared;
float Cake::m_gravity;
@@ -168,7 +170,15 @@ bool Cake::hit(AbstractKart* kart, PhysicalObject* obj)
{
bool was_real_hit = Flyable::hit(kart, obj);
if(was_real_hit)
{
if(kart && kart->isShielded())
{
kart->decreaseShieldTime(0.0f); //Decreasing the shield time by the default value.
Log::verbose("Cake", "Decreasing shield! \n");
return false; //Not sure if a shield hit is a real hit.
}
explode(kart, obj);
}
return was_real_hit;
} // hit

View File

@@ -411,7 +411,7 @@ bool Flyable::updateAndDelete(float dt)
// ----------------------------------------------------------------------------
/** Returns true if the item hit the kart who shot it (to avoid that an item
* that's too close to the shoter hits the shoter).
* that's too close to the shooter hits the shooter).
* \param kart Kart who was hit.
*/
bool Flyable::isOwnerImmunity(const AbstractKart* kart_hit) const
@@ -434,7 +434,7 @@ bool Flyable::hit(AbstractKart *kart_hit, PhysicalObject* object)
if(isOwnerImmunity(kart_hit)) return false;
if (kart_hit != NULL)
{
{ //TODO: reduce shield time; add other string ?
RaceGUIBase* gui = World::getWorld()->getRaceGUI();
irr::core::stringw hit_message =
StringUtils::insertValues(getHitString(kart_hit),

View File

@@ -279,6 +279,10 @@ Item* ItemManager::newItem(const Vec3& xyz, float distance,
void ItemManager::collectedItem(Item *item, AbstractKart *kart, int add_info)
{
assert(item);
if((item->getType() == Item::ITEM_BUBBLEGUM || item->getType() == Item::ITEM_BUBBLEGUM_NOLOK) && kart->isShielded())
{// shielded karts can simply drive over bubble gums without any effect.
return;
}
item->collected(kart);
kart->collectedItem(item, add_info);
} // collectedItem

View File

@@ -34,7 +34,7 @@
#include "utils/constants.hpp"
#include "utils/string_utils.hpp"
#include "utils/log.hpp" //TODO: remove after debugging is done
// -----------------------------------------------------------------------------
Plunger::Plunger(AbstractKart *kart)
@@ -180,6 +180,13 @@ bool Plunger::hit(AbstractKart *kart, PhysicalObject *obj)
{
if(isOwnerImmunity(kart)) return false;
/*if(kart && kart->isShielded())
{
//kart->decreaseShieldTime(0.0f); //Decreasing the shield time by the default value.
Log::verbose("Plunger", "Almost Decreasing shield! \n");
return false; //Not sure if a shield hit is a real hit.
}*/
RaceGUIBase* gui = World::getWorld()->getRaceGUI();
irr::core::stringw hit_message;

View File

@@ -32,7 +32,7 @@
#include "physics/triangle_mesh.hpp"
#include "tracks/track.hpp"
#include "utils/string_utils.hpp"
#include "utils/log.hpp" //TODO: remove after debugging is done
const wchar_t* getAnchorString()
{
@@ -162,7 +162,7 @@ void Powerup::set(PowerupManager::PowerupType type, int n)
break;
case PowerupManager::POWERUP_BUBBLEGUM:
m_sound_use = sfx_manager->createSoundSource("goo");
m_sound_use = sfx_manager->createSoundSource("goo");
break ;
case PowerupManager::POWERUP_SWITCH:
@@ -190,12 +190,38 @@ Material *Powerup::getIcon() const
return powerup_manager->getIcon(m_type);
}
//-----------------------------------------------------------------------------
/** Does the sound configuration.
*/
void Powerup::adjustSound()
{
m_sound_use->position(m_owner->getXYZ());
// in multiplayer mode, sounds are NOT positional (because we have multiple listeners)
// so the sounds of all AIs are constantly heard. So reduce volume of sounds.
if (race_manager->getNumLocalPlayers() > 1)
{
// player karts played at full volume; AI karts much dimmer
if (m_owner->getController()->isPlayerController())
{
m_sound_use->volume( 1.0f );
}
else
{
m_sound_use->volume( std::min(0.5f, 1.0f / race_manager->getNumberOfKarts()) );
}
}
}
//-----------------------------------------------------------------------------
/** Use (fire) this powerup.
*/
void Powerup::use()
{
// Play custom kart sound when collectible is used
// Play custom kart sound when collectible is used //TODO: what about the bubble gum?
if (m_type != PowerupManager::POWERUP_NOTHING &&
m_type != PowerupManager::POWERUP_SWATTER &&
m_type != PowerupManager::POWERUP_ZIPPER)
@@ -231,26 +257,11 @@ void Powerup::use()
case PowerupManager::POWERUP_RUBBERBALL:
case PowerupManager::POWERUP_BOWLING:
case PowerupManager::POWERUP_PLUNGER:
m_sound_use->position(m_owner->getXYZ());
// in multiplayer mode, sounds are NOT positional (because we have multiple listeners)
// so the sounds of all AIs are constantly heard. So reduce volume of sounds.
if (race_manager->getNumLocalPlayers() > 1)
{
// player karts played at full volume; AI karts much dimmer
if (m_owner->getController()->isPlayerController())
{
m_sound_use->volume( 1.0f );
}
else
{
m_sound_use->volume( std::min(0.5f, 1.0f / race_manager->getNumberOfKarts()) );
}
}
if(stk_config->m_shield_restrict_weapos)
m_owner->setShieldTime(0.0f); // make weapon usage destroy the shield
Powerup::adjustSound();
m_sound_use->play();
projectile_manager->newProjectile(m_owner, world->getTrack(), m_type);
break ;
@@ -259,51 +270,55 @@ void Powerup::use()
->set(Attachment::ATTACH_SWATTER,
m_owner->getKartProperties()->getSwatterDuration());
break;
case PowerupManager::POWERUP_BUBBLEGUM:
// use the bubble gum the traditional way, if the kart is looking back
if (m_owner->getControls().m_look_back)
{
Vec3 hit_point;
Vec3 normal;
const Material* material_hit;
Vec3 pos = m_owner->getXYZ();
Vec3 to=pos+Vec3(0, -10000, 0);
world->getTrack()->getTriangleMesh().castRay(pos, to, &hit_point,
Vec3 hit_point;
Vec3 normal;
const Material* material_hit;
Vec3 pos = m_owner->getXYZ();
Vec3 to=pos+Vec3(0, -10000, 0);
world->getTrack()->getTriangleMesh().castRay(pos, to, &hit_point,
&material_hit, &normal);
// This can happen if the kart is 'over nothing' when dropping
// the bubble gum
if(!material_hit)
return;
normal.normalize();
// This can happen if the kart is 'over nothing' when dropping
// the bubble gum
if(!material_hit)
return;
normal.normalize();
// in multiplayer mode, sounds are NOT positional (because we have multiple listeners)
// so the sounds of all AIs are constantly heard. So reduce volume of sounds.
if (race_manager->getNumLocalPlayers() > 1)
Powerup::adjustSound();
m_sound_use->play();
pos.setY(hit_point.getY()-0.05f);
ItemManager::get()->newItem(Item::ITEM_BUBBLEGUM, pos, normal, m_owner);
}
else // if the kart is looking forward, use the bubblegum as a shield
{
const int np = race_manager->getNumLocalPlayers();
const int nai = race_manager->getNumberOfKarts() - np;
// player karts played at full volume; AI karts much dimmer
if (m_owner->getController()->isPlayerController())
if(!m_owner->isShielded()) //if the previous shield had been used up.
{
m_sound_use->volume( 1.0f );
m_owner->getAttachment()->set(Attachment::ATTACH_BUBBLEGUM_SHIELD,
stk_config->m_bubblegum_shield_time);
}
else
else // using a bubble gum while still having a shield
{
m_sound_use->volume( 1.0f / nai );
m_owner->getAttachment()->set(Attachment::ATTACH_BUBBLEGUM_SHIELD,
stk_config->m_bubblegum_shield_time + m_owner->getShieldTime());
}
}
m_sound_use->position(m_owner->getXYZ());
m_sound_use->play();
m_sound_use = sfx_manager->createSoundSource("inflate");//Extraordinary. Usually sounds are set in Powerup::set()
//In this case this is a workaround, since the bubblegum item has two different sounds.
pos.setY(hit_point.getY()-0.05f);
Powerup::adjustSound();
m_sound_use->play();
ItemManager::get()->newItem(Item::ITEM_BUBBLEGUM, pos, normal, m_owner);
}
} // end of PowerupManager::POWERUP_BUBBLEGUM
break;
case PowerupManager::POWERUP_ANVIL:
//Attach an anvil(twice as good as the one given
//by the bananas) to the kart in the 1st position.
for(unsigned int i = 0 ; i < world->getNumKarts(); ++i)
@@ -349,6 +364,12 @@ void Powerup::use()
{
AbstractKart *kart=world->getKart(i);
if(kart->isEliminated() || kart== m_owner) continue;
if(kart->isShielded())
{
kart->decreaseShieldTime(stk_config->m_bubblegum_shield_time);
Log::verbose("Powerup", "Decreasing shield \n");
continue;
}
if(m_owner->getPosition() > kart->getPosition())
{
kart->getAttachment()

View File

@@ -56,8 +56,9 @@ public:
void set (PowerupManager::PowerupType _type, int n=1);
void reset ();
Material* getIcon () const;
void adjustSound ();
void use ();
void hitBonusBox (const Item &item, int newC=-1);
void hitBonusBox (const Item &item, int newC=-1);
/** Returns the number of powerups. */
int getNum () const {return m_number;}

View File

@@ -20,6 +20,7 @@
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"
#include "config/stk_config.hpp"
#include "items/attachment.hpp"
#include "items/projectile_manager.hpp"
#include "karts/abstract_kart.hpp"
@@ -28,6 +29,8 @@
#include "physics/triangle_mesh.hpp"
#include "tracks/track.hpp"
#include "utils/log.hpp" //TODO: remove after debugging is done
float RubberBall::m_st_interval;
float RubberBall::m_st_min_interpolation_distance;
float RubberBall::m_st_squash_duration;
@@ -719,6 +722,21 @@ bool RubberBall::hit(AbstractKart* kart, PhysicalObject* object)
}
bool was_real_hit = Flyable::hit(kart, object);
if(was_real_hit)
explode(kart, object);
{
/*if(kart && kart->isShielded() && kart->getShieldTime() > stk_config->m_bubblegum_shield_time )
{ //remove twice the default shield time
kart->decreaseShieldTime(stk_config->m_bubblegum_shield_time * 2);
Log::verbose("rubber_ball", "Decreasing shield 1! \n");
}
else */if(kart && kart->isShielded())
{
kart->decreaseShieldTime(stk_config->m_bubblegum_shield_time);
//kart->getAttachment()->update(0.0f);
//kart->setSquash(m_st_squash_duration, m_st_squash_slowdown);
Log::verbose("rubber_ball", "Decreasing shield 2! \n");
}
else
explode(kart, object);
}
return was_real_hit;
} // hit

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