From: <au...@us...> - 2010-01-30 20:41:35
|
Revision: 4566 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4566&view=rev Author: auria Date: 2010-01-30 20:41:28 +0000 (Sat, 30 Jan 2010) Log Message: ----------- Updated credits to use UTF-16, fixing accentuated characters (I'm not 100% sure the code will run on big-endian machines, gotta test) Modified Paths: -------------- main/trunk/data/CREDITS main/trunk/src/states_screens/credits.cpp Modified: main/trunk/data/CREDITS =================================================================== --- main/trunk/data/CREDITS 2010-01-30 19:53:06 UTC (rev 4565) +++ main/trunk/data/CREDITS 2010-01-30 20:41:28 UTC (rev 4566) @@ -1,239 +1,238 @@ -= Super TuxKart = -A Libre Karting Game Featuring Tux & Friends -- Version SVN -- Visit us at http://supertuxkart.sf.net - - -= SuperTuxKart Administrators = - -Joerg Henrichs (hiker) -- Project leader -- Lead Programming -- Windows Packaging - -Marianne Gagnon (Auria) -- Lead Programming -- Art director -- Mac OS X Packager - -Constantin Pelikan (conso) -- Add-ons administrator -- Art director - - -= Additional Programming = - -Stephen Dunn -- Work on Audio - -Bug fixes & misc contributions -- Damien -- Yann Leprince (sciyann) -- Robert Schuster -- Patrick Ammann -- Paul Elms (scifly) -- Xapantu - - -David -- Work on flying items - -= Visual art = - -Minibjorn -- Powerups and baddies (models + icons) -- (Bowling Ball, Cake, Plunger, Bubblegum, -- Anchor, Bomb, Gift-box, Nitro-tank) -- Fire and smoke particles -- Puffy kart -- Various textures - -Thomas Oppl -- 'Canyon' track -- 'City' track -- New 'racetrack' track -- New banana model - -Cheleb -- Nolok kart -- Pidgin kart - -Tobias Beyrer -- Wilber kart -- elePHPant kart - -GUI Icons -- onyum.com, commissioned by OpenGameArt.org/Bart Kelsey -- yeKcim (Anthony Carré) - -Ivar ten Cate (Varivar) -- Old mine track -- Tux Tollway track - -Other art contributions -- Benjamin Arnaudet : GNU kart -- MacIO : Cave X arena -- abejones : Adiumy kart -- Christian Framing (Updated EvilTux kart) -- Andy (Needer) -- Paul Elms (scifly) -- Rudy85 : Character animations - -Robert Howie -- Skyline Track (with modifications by conso) - -Elisee -- Checker background - -Marianne Gagnon (Auria) -- 'SnowTux peak' (Based on older 'Geeko peak') -- 'Shifting sands' improvements -- 'Around the Lighthouse' improvements -- 'On the beach' improvements -- 'Amazonian Journey' track -- 'Fort Magma' (based on older 'BSOD castle') -- 'Crescent Crossing' (Based on older 'little volcano') -- New icon - -Frederico de Oliveira Linhares -- Hexley kart character (modified -- to use Wilber-kart by conso) - -Johannes Sjolund -- 'The Island' track (with modifications -- by Wayne Dennis (Pixel_2ACF3)) - -Canis Lupus -- Snow Mountain track -- XR591 track (with modifications by conso) - -Stephen Dunn -- Work on Lighthouse track - -Other media sources -- BurningWell : public domain photos -- Extreme Tux Racer -- The Glest Jungle Set - -= Music = - -The Dead Rocks -- 'GreenSecretFromAmazonia' -- 'EasyJob' -- 'OneMillionDollar' - -Misc songs -- Weirwood : 'Kart grand prix' -- Magne Djupvik : 'Penguin Party' -- Paul Esra Martin (P@ule) 'G4M fan track' -- Marianne Gagnon (Auria) : 'Jungle song' -- Matt Thomas : 'Boom-boom-boom song' -- Lukas Siewert (Dr.Sternhagel) : 'Caribbean music' -- Chris Leutwyler (kronobil) : 'Old mine' - -Misc songs -- Chris Leutwyler (kronobil) : 'Snowy track' -- Brad Sucks - 'Out of it' -- ChillCarrier - 'Druckverlust' -- Deff Syndicate - 'hip hop 1' -- Alessandro Bottura - 'MayDay Mayhem' -- Speedsound - 'Sky Vibe Hi Frequency' -- Daniel Bautista - 'Symphony No. 5' - -= Sound Effects = - -Sound effects -- Daveincamas, Radio Mall, BLASTWAVEFX 02344 -- smcameron, SmiertSpionem, lonemonk, han1 -- Pogotron, roscoetoon, FreqMan -- Stephan Wiefling : Menu sounds - -Sound effects -- Stephen Dunn & morgantj : engine sound -- Stephen Dunn & Atheal Washington : skidding -- Battle For Wesnoth -- The TORCS project - -= Translations = - -German -- Dominique Leuenberger (dimstar) -- Stefan von Halenbach -- Constantin Pelikan - -Translations -- French : Marianne Gagnon (Auria) and Yann Leprince (sciyann) -- Spanish : David Ballesteros Mayo (Dividio) and Samuel (netocp-1) -- Galician : Adrián Chaves Fernández and Proxecto Trasno -- Norwegian : Magne Djupvik (Arthur_D) -- Russian and Ukrainian: Helen Antonova (Vigonett) - -More translations -- Dutch : Frans van Rijn (Asciimonster) -- Italian : Vincenzo (Gigugin) -- Swedish : Niklas Grahn (Respit) -- Romanian : Marina Muncescu -- Portugese : Flávio Zavan (nebososo) -- Danish : Joe Dalton - -More translations -- Irish : Aaron Kearns -- Finnish : Kristian Laakkonen -- Polish : Patryk Wychowaniec (patryk1303 / p98) -- Czech : Ondřej Hruška (Prasisko) -- Catalan : Albert Juhé Lluveras (Aljullu) -- Slovenian : mufic, bd4e - -= Misc = - -Website -- Tom Jenkins : skin and layout -- Remy le Guen (Vivelefrat) -- Sebastian Rode -- Hiker, Auria, Conso - -Testing -- Canarix -- JPenguin -- The Games4Mac Forum Community -- (http://community.games4mac.de) - -Donations -- Markus Liukka -- Michael Roessner (http://www.retrax.de) -- Phelippeau Rudy (rudy251079) -- Carl Olsson -- Tux_penguin -- OpenGameArt.org - -= Previous contributors = - -No more active -- Eduardo Hernandez Munoz (Coz) : Former Admin -- Sam Clarke : Windows Installer -- Hans "the farmer" Dzaack : Physics tuning -- Maik Semder (Ikework) : Bug fixes - -Game of the Month (STK version 0.0) -- Craig Keogh, Ingo Ruhnke, Jacob Persson -- James Gregory, Pascal Giard -- Matthias Braun, Oliver Jeeves -- Paul Carley, Ricardo Cruz, Caleb Sawtell -- Willian Padovani Germano, James Gregory - -Original Tuxkart -- Steve Baker (http://www.sjbaker.org/) -- Oliver Baker - -= Thanks for Playing! = -Do not hesistate to contribute! -- Give feedback -- Participate on the community -- Donate -- Make art -- Code a feature -- -- -- -- -- +\xFF\xFE= |
From: <au...@us...> - 2010-01-31 18:34:43
|
Revision: 4577 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4577&view=rev Author: auria Date: 2010-01-31 18:34:36 +0000 (Sun, 31 Jan 2010) Log Message: ----------- Added Chinese translation, minor updates to credits Modified Paths: -------------- main/trunk/data/CREDITS main/trunk/src/states_screens/credits.cpp Added Paths: ----------- main/trunk/data/po/zh_CN/ main/trunk/data/po/zh_CN/LC_MESSAGES/ main/trunk/data/po/zh_CN/LC_MESSAGES/supertuxkart.mo main/trunk/data/po/zh_CN.po Modified: main/trunk/data/CREDITS =================================================================== --- main/trunk/data/CREDITS 2010-01-31 18:21:15 UTC (rev 4576) +++ main/trunk/data/CREDITS 2010-01-31 18:34:36 UTC (rev 4577) @@ -146,7 +146,6 @@ |
From: <au...@us...> - 2010-01-31 18:52:30
|
Revision: 4579 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4579&view=rev Author: auria Date: 2010-01-31 18:52:24 +0000 (Sun, 31 Jan 2010) Log Message: ----------- Kart and track groups tabs are now dynamically determined at runtime instead of being hardcoded Modified Paths: -------------- main/trunk/data/gui/karts.stkgui main/trunk/data/gui/tracks.stkgui main/trunk/src/guiengine/widgets/ribbon_widget.cpp main/trunk/src/states_screens/kart_selection.cpp main/trunk/src/states_screens/tracks_screen.cpp Modified: main/trunk/data/gui/karts.stkgui =================================================================== --- main/trunk/data/gui/karts.stkgui 2010-01-31 18:37:48 UTC (rev 4578) +++ main/trunk/data/gui/karts.stkgui 2010-01-31 18:52:24 UTC (rev 4579) @@ -22,11 +22,15 @@ <ribbon_grid id="karts" proportion="1" square_items="true" width="100%" align="center" child_width="80" child_height="80"/> </box> + + <!-- Groups will be added dynamically at runtime --> <tabs width="100%" height="25" id="kartgroups"> + <!-- <button id="standard" I18N="Kart group" text="Standard"/> <button id="addons" I18N="Kart group" text="Add-Ons"/> <button id="special" I18N="Kart group" text="Special"/> <button id="all" I18N="Kart group" text="All"/> + --> </tabs> <spacer height="15" width="25"/> Modified: main/trunk/data/gui/tracks.stkgui =================================================================== --- main/trunk/data/gui/tracks.stkgui 2010-01-31 18:37:48 UTC (rev 4578) +++ main/trunk/data/gui/tracks.stkgui 2010-01-31 18:52:24 UTC (rev 4579) @@ -21,11 +21,8 @@ <spacer width="20" height="13" /> </box> - <tabs width="100%" height="25" id="trackgroups"> - <button id="standard" I18N="track group" text="Standard"/> - <button id="addons" I18N="track group" text="Add-Ons"/> - <button id="all" I18N="track group" text="All"/> - </tabs> + <!-- Populated dynamically at runtime --> + <tabs width="100%" height="25" id="trackgroups"> </tabs> <spacer width="20" height="13" /> Modified: main/trunk/src/guiengine/widgets/ribbon_widget.cpp =================================================================== --- main/trunk/src/guiengine/widgets/ribbon_widget.cpp 2010-01-31 18:37:48 UTC (rev 4578) +++ main/trunk/src/guiengine/widgets/ribbon_widget.cpp 2010-01-31 18:52:24 UTC (rev 4579) @@ -101,6 +101,7 @@ const int widget_x = one_button_space*(i+1) - one_button_space/2; + // ---- tab ribbons if (getRibbonType() == RIBBON_TABS) { IGUIButton * subbtn = NULL; @@ -160,7 +161,7 @@ m_children[i].m_element = subbtn; } - // ---- non-tabs ribbons + // ---- icon ribbons else if (m_children[i].m_type == WTYPE_ICON_BUTTON) { // find how much space to keep for the label under the button. Modified: main/trunk/src/states_screens/kart_selection.cpp =================================================================== --- main/trunk/src/states_screens/kart_selection.cpp 2010-01-31 18:37:48 UTC (rev 4578) +++ main/trunk/src/states_screens/kart_selection.cpp 2010-01-31 18:52:24 UTC (rev 4579) @@ -697,6 +697,24 @@ KartSelectionScreen::KartSelectionScreen() : Screen("karts.stkgui") { g_dispatcher = new FocusDispatcher(this); + + // Dynamically add tabs + // FIXME: it's not very well documented that RibbonWidgets can have dynamically generated contents + RibbonWidget* tabs = this->getWidget<RibbonWidget>("kartgroups"); + assert( tabs != NULL ); + + tabs->m_children.clearAndDeleteAll(); + + const std::vector<std::string>& groups = kart_properties_manager->getAllGroups(); + + const int amount = groups.size(); + for (int n=0; n<amount; n++) + { + ButtonWidget* item = new ButtonWidget(); + item->m_text = groups[n].c_str(); // FIXME: i18n ? + item->m_properties[PROP_ID] = groups[n]; + tabs->m_children.push_back(item); + } } // ----------------------------------------------------------------------------- void KartSelectionScreen::forgetWhatWasLoaded() Modified: main/trunk/src/states_screens/tracks_screen.cpp =================================================================== --- main/trunk/src/states_screens/tracks_screen.cpp 2010-01-31 18:37:48 UTC (rev 4578) +++ main/trunk/src/states_screens/tracks_screen.cpp 2010-01-31 18:52:24 UTC (rev 4579) @@ -31,6 +31,23 @@ TracksScreen::TracksScreen() : Screen("tracks.stkgui") { + // Dynamically add tabs + // FIXME: it's not very well documented that RibbonWidgets can have dynamically generated contents + RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups"); + assert( tabs != NULL ); + + tabs->m_children.clearAndDeleteAll(); + + const std::vector<std::string>& groups = track_manager->getAllGroups(); + + const int amount = groups.size(); + for (int n=0; n<amount; n++) + { + ButtonWidget* item = new ButtonWidget(); + item->m_text = groups[n].c_str(); // FIXME: i18n ? + item->m_properties[PROP_ID] = groups[n]; + tabs->m_children.push_back(item); + } } @@ -79,6 +96,28 @@ DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks"); assert( w != NULL ); + RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups"); + assert( tabs != NULL ); + + /* + tracks->m_children.clearAndDeleteAll(); + + ButtonWidget* item1 = new ButtonWidget(); + item1->m_text = _("Standard"); + item1->m_proeprties[PROP_ID] = "stdtracks"; + tracks->m_children.push_back(item1); + + ButtonWidget* item2 = new ButtonWidget(); + item2->m_text = _("Add-Ons"); + item2->m_proeprties[PROP_ID] = "addontracks"; + tracks->m_children.push_back(item2); +*/ + //tabs->clearItems(); + //tabs->addItem( _("Standard"), "stdtracks", "" /* image */); + //tabs->addItem( _("Add-Ons"), "stdtracks", "" /* image */); + //tabs->addItem( _("Special"), "stdtracks", "" /* image */); + //tabs->updateItemDisplay(); + // Re-build track list everytime (accounts for locking changes, etc.) w->clearItems(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-02-01 02:09:07
|
Revision: 4595 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4595&view=rev Author: hikerstk Date: 2010-02-01 02:08:57 +0000 (Mon, 01 Feb 2010) Log Message: ----------- Updated and combined windows build instructions into one paragraph of readme, and simplified old README (e.g. removed instruction on how to play the game). Modified Paths: -------------- main/trunk/README Removed Paths: ------------- main/trunk/README.cygwin main/trunk/README.windows Modified: main/trunk/README =================================================================== --- main/trunk/README 2010-02-01 00:37:19 UTC (rev 4594) +++ main/trunk/README 2010-02-01 02:08:57 UTC (rev 4595) @@ -1,22 +1,22 @@ SuperTuxKart ============== SuperTuxKart is a free kart racing game. It is focusing on fun and -not on realistic kart physics. The SuperTuxKart homepage can be found at: +not on realistic kart physics. Instruction can be found on the +in-game help page. +The SuperTuxKart homepage can be found at: + http://supertuxkart.sourceforge.net -The official SuperTuxKart forum is at: -http://supertuxkart.sourceforge.net/forum +The official SuperTuxKart forum is at. If you need support, +this would be the best place to start. -A big "thank you" to Steve Baker for designing and implementing the -original TuxKart, and to the GotM team for their invaluable work. -See the data/CREDITS file for individual credits. + http://supertuxkart.sourceforge.net/forum Hope you enjoy the game. - The SuperTuxKart development team. - HARDWARE REQUIREMENTS ===================== * You need a 3D graphics card that supports OpenGL or Mesa. @@ -25,70 +25,20 @@ * A sound card would be nice - but it's not essential. * Ideally, you want a joystick with at least 6 buttons. -PLAYING THE GAME -================ -SuperTuxKart is a kart racing game. Basically you run around the track, -and give your best shot at reaching the goal before your opponents. The ? -boxes can help you, and collection coins can build up your power, so you can -grab more than one collectable! But avoid the bananas, since they might -give you a nasty surprise. -Controls can be configured from the game, here are the defaults mappings: -Player 1: - Steer : Left / Right arrow - Accelerate : Up arrow - Brake : Down arrow - Use item : Right control - Sharp Turn : Right shift - Rescue : Backspace - Nitro : - (minus key) - Look back : Right alt +COMPILING ON WINDOWS +==================== +A project file for Visual Studio 9 (e.g. the free 2008 express +edition) is included in the sources. A separate dependency +package is available on SuperTuxKart's sourceforge page, which +includes all necessary libraries, header files, and dlls to +compile and run the source code. -Player 2: - Steer : A / D key - Accelerate : W key - Brake : S key - Use item : Left control - Sharp Turn : Left shift - Rescue : Q key - Nitro : Caps lock - Look back : Left alt +While compilation with cygwin is not officially supported, +this has been done (check with the forum for details). -Player 3: - Steer : F / H key - Accelerate : T key - Brake : G key - Use item : N key - Sharp Turn : C key - Rescue : R key - Nitro : V key - Look back : N key -Player 4: - Steer : J / L key - Accelerate : I key - Brake : K key - Use item : . key - Sharp Turn : M key - Rescue : u key - Nitro : , key - Look back : / key - -The Escape key pauses the game and shows the race menu. - - -SUPPORT -======= -The main webpage is at: - - http://supertuxkart.sourceforge.net - -If you have any problems, please go to the official SuperTuxKart Forum at: - -http://supertuxkart.sourceforge.net/forum - - LICENSE ======= This software is released under the GNU General Public License (GPL) which Deleted: main/trunk/README.cygwin =================================================================== --- main/trunk/README.cygwin 2010-02-01 00:37:19 UTC (rev 4594) +++ main/trunk/README.cygwin 2010-02-01 02:08:57 UTC (rev 4595) @@ -1,26 +0,0 @@ -Some short instruction on how to compile supertuxkart with cygwin: - -1) You have to use supertuxkart revision 593 or later (which you are - probably doing since you are reading this readme :) ). - -2) Install freeglut - This is part of the cygwin packages, so just select this in - the cygwin setup program. - -3) Install OpenAL - We have had some problems with this, so this might be the most difficult stage. - -4) Unpack superuxkart and run ./configure and make. - -That should be all. - - -Comments: -1) A -DNOMINMAX is added for cygwin compilations, since otherwise - min and max are #defined, causing problems with all std::min and - std::max constructs. - -If you have any problems, please post on the mailing list - I am -not a regular windows user, so am probably not able to help you. - - hiker Deleted: main/trunk/README.windows =================================================================== --- main/trunk/README.windows 2010-02-01 00:37:19 UTC (rev 4594) +++ main/trunk/README.windows 2010-02-01 02:08:57 UTC (rev 4595) @@ -1,54 +0,0 @@ -NOTE -==== -If you have downloaded the 0.4 version and it does not start, please -install the Microsoft Visual C++ redistributable package ('vcredist_x86.exe') -included in this directory. - -If you don't hear any sound, you have to install OpenAL (see http://ww.openal.org). -Simply install the OpenAL redistributable ('oalinst.exe'). - -The release comes with a full installer, which includes these redistributables. - - -If you are downloading a source version and want to compile it yourself: - -There are two documented ways to compile an executable for windows: using -cygwin, and using visual c++ (tested with the free Express version). - -If you have any problems, please post on the mailing list, and we will -do our best to help you. - - -Cygwin -====== -1) Install freeglut - This is part of the cygwin packages, so just select this in - the cygwin setup program. - -2) Install OpenAL - We have had some problems with this in the past, so it might be tricky. - -3) Unpack supertuxkart and run ./configure and make. - -That should be all. - -Comments: -1) A -DNOMINMAX is added for cygwin compilations, since otherwise - min and max are #defined, causing problems with all std::min and - std::max constructs. This is done automatically by the configure - script. - - - -Visual C++ Express -================== -There are now project files included for building SuperTuxKart with -Visual C++ - have a look at the src/ide/vc8 folder. -Since version r793 SuperTuxKart compiles with Visual C++ Express, -version 8.0, since rev 1267 Visual C++ project files are included. -The main project file is .../src/ide/vc8/supertuxkart.vcproj, -and it includes a sub project for the bullet library. More details -can be found in .../src/ide/vc8/README. - -You still have to install all dependencies. - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-02-01 02:16:05
|
Revision: 4597 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4597&view=rev Author: hikerstk Date: 2010-02-01 02:15:57 +0000 (Mon, 01 Feb 2010) Log Message: ----------- Updated build instructions for OSX. Modified Paths: -------------- main/trunk/README Removed Paths: ------------- main/trunk/README.macosx Modified: main/trunk/README =================================================================== --- main/trunk/README 2010-02-01 02:12:38 UTC (rev 4596) +++ main/trunk/README 2010-02-01 02:15:57 UTC (rev 4597) @@ -25,20 +25,32 @@ * A sound card would be nice - but it's not essential. * Ideally, you want a joystick with at least 6 buttons. +COMPILING SuperTuxkart +====================== - -COMPILING ON WINDOWS -==================== +WINDOWS +------- A project file for Visual Studio 9 (e.g. the free 2008 express -edition) is included in the sources. A separate dependency -package is available on SuperTuxKart's sourceforge page, which -includes all necessary libraries, header files, and dlls to -compile and run the source code. +edition) is included in the sources in src/ide/vc9. A separate +dependency package is available on SuperTuxKart's sourceforge +page, which includes all necessary libraries, header files, +and dlls to compile and run the source code. While compilation with cygwin is not officially supported, this has been done (check with the forum for details). +MAC OSX +------- +The latest information about compilation on Mac are on our wiki: +http://supertuxkart.sourceforge.net/Building_and_packaging_on_OSX +The Xcode project file is in /src/ide/Xcode/, but it still +requires that all dependencies are installed as explained on the wiki. +UNIX +---- +See INSTALL for details. + + LICENSE ======= This software is released under the GNU General Public License (GPL) which Deleted: main/trunk/README.macosx =================================================================== --- main/trunk/README.macosx 2010-02-01 02:12:38 UTC (rev 4596) +++ main/trunk/README.macosx 2010-02-01 02:15:57 UTC (rev 4597) @@ -1,419 +0,0 @@ -(*) The latest information about compilation on Mac are on our wiki: -http://supertuxkart.sourceforge.net/Building_and_packaging_on_OSX -(*) There is an experimental Xcode project in /src/ide/Xcode/. It will still require that all dependencies are installed as explained on the wiki. - -The older instructions should still work, and are quite detailed. - -System requirements Mac: -PowerPC- or Intel-Mac with 800 MHz or more, -1 GHz recommended 3D-graphics card with 32 MB or more. -100 MB free disk space. Supporting Mac OS X 10.3.9 or later. - -Compiling SuperTuxKart on OS X 10.4.x - -01. Install all updates for OS X. - -02. Download xcode 2.4.1_8m1910_6936315 from http://developer.apple.com/macosx/ - -You must be an Apple Developer Connection member to download this package. - -03. Installing XCode. - -04. Edit "/etc/profile": - --------------------------------------------------------------------------------------------------------- - -# System-wide .profile for sh(1) - -PATH="/sw/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin" - -export PATH - -PKG_CONFIG_PATH="/sw/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11R6/lib/pkgconfig:/usr/local/lib/pkgconfig" - -export PKG_CONFIG_PATH - -if [ "${BASH-no}" != "no" ]; then [ -r /etc/bashrc ] && . /etc/bashrc fi - --------------------------------------------------------------------------------------------------------- - -05. Download Fink from http://www.finkproject.org/download/index.php?phpLang=en - -06. Installing Fink. - -07. Copy the FinkCommander folder to Applications and launch FinkCommander. - -08. Run selfupdate. - -09. Run update-all. - -10. Run the index command. - -11. Installing the following 'fink' packages: - - -11.01 SDL - -11.02 audiofile - -11.03 esound - -11.04 svn - -11.05 svn-client - - -12. Download the SDL framework from http://www.libsdl.org/download-1.2.php and copy it to /Library/Frameworks. - -13. Installing Vorbis.framework and Ogg.framework: - -13.01 Download SuperTux from http://developer.berlios.de/project/showfiles.php?group_id=3467&release_id=11879 - -13.02 Right-click the SuperTux icon and select Show Package Contents from the context menu. - -13.03 Change in the folder Contents:Frameworks. And copy Vorbis.framework and Ogg.framework to <hd>:Library:Frameworks. - - -14. This step is not necessary anymore. - -15. Installing Freealut-1.1.0 from OpenAL.org //////////////////// - -15.01 Makefile.in: - -Replace the line: - -SUBDIRS = admin src include examples test_suite - -with - -SUBDIRS = admin src include - - -15.02 configure: - -Replace the line - -for ac_header in AL/alc.h AL/al.h basetsd.h ctype.h math.h stdio.h time.h - -with - -for ac_header in OpenAL/alc.h OpenAL/al.h basetsd.h ctype.h math.h stdio.h time.h - - -15.03 export CXXFLAGS="-framework OpenAL" - - -15.04 export LDFLAGS="-framework OpenAL" - - -15.05 ./configure --prefix=/usr - - -15.06 make - - -15.07 Open admin/pkgconfig/freealut.pc - -Replace the line - -Requires: openal - -with - -Requires: - - -15.08 Replace the line: - -Libs: -L${libdir} -lalut Cflags: -I${includedir} - -with - -Libs: -framework OpenAL -L${libdir} -lalut Cflags: -framework OpenAL -I${includedir} - - -15.09 sudo make install - - -16. This step is not necessary anymore. - -Installing SuperTuxKart ////////// - - -1. Copy the following code and paste it in the new file "buildUB.sh". - - -buildUB.sh: - ---------------------------------------------------------------------------------------------------------- - - -#!/bin/bash - -if [ -r ./configure ]; then - -echo "Configure found!" - -else - -echo "No Config file found! Runing autogen.sh..." - -sh autogen.sh - -fi - - -if [ -r ./config.guess ]; then - -echo "config.guess found!" - -else - -echo "config.guess not present! Copying it..." - -cp /usr/share/libtool/config.guess ./config.guess - -fi - - -if [ -r ./config.sub ]; then - -echo "config.sub found!" - -else - -echo "config.sub not present! Copying it..." - -cp /usr/share/libtool/config.sub ./config.sub - -fi - - -if [ -r ./Makefile ]; then - -echo "Makefile found!" - -else - -echo "Makefile missing! Running ./configure..." - -./configure - -if [ -r ./Makefile ]; then - -echo "Makefile present, ready to compile!" - -else - -echo "Configure not completed, Makefile still missing! Exiting..." - -exit 1 - -fi - -fi - - -echo "Setting environment variables..." - -export sdl_LIBS="" - -export LDFLAGS="-framework OpenAL -Wl,-framework,Cocoa -framework SDL -framework Cocoa -lSDLmain - --framework Vorbis -framework Ogg -L/usr/local/lib -L/opt/local/lib -L/sw/lib" - -export openal_LIBS="/usr/local/lib/libmikmod.a" - - -if [ -r ./bin/supertuxkartPPC ]; then - -echo "supertuxkartPPC is present, nothing to do." - -else - -echo "Cleaning up..." - -make clean -s - - -echo "Building PPC Binary..." - -make -e -s - - -echo "Copying PPC Binary..." - -mkdir ./bin - -if [ -r ./src/supertuxkart ]; then - -cp ./src/supertuxkart ./bin/supertuxkartPPC - -else - -echo "Error!" - -exit 1 - -fi - -fi - - -if [ -r ./bin/supertuxkartx86 ]; then - -echo "supertuxkartx86 is present, nothing to do." - -else - -echo "Cleaning up..." - -make clean -s - - -echo "Building x86 Binary..." - -export CXXFLAGS="-g -O2 -Wall -arch i386 `sdl-config --cflags`" - -export LDFLAGS=$LDFLAGS" -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -L/usr/local/lib -L/opt/local/lib -L/sw/lib" - -make -e -s - - -echo "Copying x86 Binary..." - -if [ -r ./src/supertuxkart ]; then - -cp ./src/supertuxkart ./bin/supertuxkartx86 - -else - -echo "Error!" - -exit 1 - -fi - -fi - - -echo "Creating Universal Binary..." - -lipo -create ./bin/supertuxkartPPC ./bin/supertuxkartx86 -output ./bin/supertuxkart - - -echo "Done!" - - -------------------------------------------------------------------------------------------------------------- - -2. Set the permissions for the script "buildUB.sh" - -e.g.: chmod 744 buildUB.sh - - -3. Download SuperTuxKart-Source from "http://sourceforge.net/project/showfiles.php?group_id=202302". - - -4. Go in the folder SuperTuxKart. - - -5. Copy the script "buildUB.sh" in the directory "SuperTuxKart". - - -6. ./buildUB.sh - - -7. Check-up: - - -7.01 Go in the folder "bin". - - -7.02 ./supertuxkart --version - -Print version information - -e.g.: -------------------------------------------------------------------------- -SuperTuxKart, 0.3alpha. - -SuperTuxKart, SVN revision number '975M'. -------------------------------------------------------------------------- - - -7.03 Is this a universal binary? - -file supertuxkart - - -e.g.: -------------------------------------------------------------------------- -supertuxkart: Mach-O fat file with 2 architectures - -supertuxkart (for architecture ppc): Mach-O executable ppc - -supertuxkart (for architecture i386): Mach-O executable i386 -------------------------------------------------------------------------- - - -7.04 otool -L supertuxkart - -Print shared library dependencies. - -e.g.: ------------------------------------------------------------------------------------------------- -supertuxkart: - -/System/Library/Frameworks/OpenAL.framework/Versions/A/OpenAL (compatibility version 1.0.0, - -current version 1.0.0) - -/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, - -current version 11.0.0) - -@executable_path/../Frameworks/SDL.framework/Versions/A/SDL (compatibility version 1.0.0, current - -version 1.0.0) - -@executable_path/../Frameworks/Vorbis.framework/Versions/A/Vorbis (compatibility version 1.0.0, - -current version 1.0.0) - -@executable_path/../Frameworks/Ogg.framework/Versions/A/Ogg (compatibility version 1.0.0, current - -version 1.0.0) - -/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current - -version 128.0.0) - -/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current - -version 1.0.0) - -/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current - -version 275.0.0) - -/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version - -1.0.0) - -/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) - -/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) - -/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.8) ---------------------------------------------------------------------------------------------------------- - - - -************* S T A R T T H E G A M E A N D H A V E F U N! ************** - - -Please post to the development list if you have any problems. - - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-01 20:50:22
|
Revision: 4602 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4602&view=rev Author: auria Date: 2010-02-01 20:03:32 +0000 (Mon, 01 Feb 2010) Log Message: ----------- Fixed lighthouse trees (adding a couple code cleanup that I did while searching for the issue) Modified Paths: -------------- main/trunk/data/textures/materials.xml main/trunk/data/tracks/lighthouse/materials.xml main/trunk/src/graphics/material.cpp main/trunk/src/graphics/material.hpp Modified: main/trunk/data/textures/materials.xml =================================================================== --- main/trunk/data/textures/materials.xml 2010-02-01 18:41:38 UTC (rev 4601) +++ main/trunk/data/textures/materials.xml 2010-02-01 20:03:32 UTC (rev 4602) @@ -47,7 +47,7 @@ <material name="water_light.png" light="N" reset="Y" collide="N"/> <material name="sea.png" alpha="0.0" light="N" reset="Y"/> <material name="rock.png" alpha="0.0" collide="N"/> - <material name="coniferous_tree.png" clampU="Y" clampV="Y" transparency="Y" alpha="0.5" light="N" collide="N"/> + <material name="coniferous_tree.png" transparency="Y" light="N" collide="N"/> <material name="signs.png" transparency="Y" alpha="0.5" light="N" collide="N"/> <material name="greenice.png" alpha="0.0" reset="Y" collide="N"/> <material name="snow.png" alpha="0.0" collide="N" maxSpeed="0.4" slowdownTime="4"/> Modified: main/trunk/data/tracks/lighthouse/materials.xml =================================================================== --- main/trunk/data/tracks/lighthouse/materials.xml 2010-02-01 18:41:38 UTC (rev 4601) +++ main/trunk/data/tracks/lighthouse/materials.xml 2010-02-01 20:03:32 UTC (rev 4602) @@ -3,7 +3,7 @@ <material name="lighthouse.jpg" alpha="0.0" light="N" collide="N"/> <material name="lighthouse_sky.jpg" alpha="0.0" light="N" reset="Y"/> <material name="fence.png" transparency="Y" /> - <material name="coniferous_tree.png" clampU="Y" clampV="Y" transparency="Y" light="N" collide="N"/> + <material name="coniferous_tree.png" transparency="Y" light="N" collide="N"/> <material name="sand.jpg" graphical-effect="smoke"/> <material name="sandgrass.jpg" graphical-effect="smoke"/> <material name="sea.jpg" graphical-effect="water"/> Modified: main/trunk/src/graphics/material.cpp =================================================================== --- main/trunk/src/graphics/material.cpp 2010-02-01 18:41:38 UTC (rev 4601) +++ main/trunk/src/graphics/material.cpp 2010-02-01 20:03:32 UTC (rev 4602) @@ -28,8 +28,8 @@ #include "utils/string_utils.hpp" -#define UCLAMP 1 -#define VCLAMP 2 +const unsigned int UCLAMP = 1; +const unsigned int VCLAMP = 2; //----------------------------------------------------------------------------- /** Create a new material using the parameters specified in the xml file. @@ -38,16 +38,17 @@ */ Material::Material(const XMLNode *node, int index) { + node->get("name", &m_texname); - if(m_texname=="") + if (m_texname=="") { throw std::runtime_error("No texture name specified in %s file\n"); } init(index); - bool b=false; - node->get("clampU", &b); if(b) m_clamp_tex +=UCLAMP; - b=false; - node->get("clampV", &b); if(b) m_clamp_tex +=VCLAMP; + bool b = false; + node->get("clampU", &b); if (b) m_clamp_tex |= UCLAMP; + b = false; + node->get("clampV", &b); if (b) m_clamp_tex |= VCLAMP; node->get("transparency", &m_alpha_testing ); node->get("lightmap", &m_lightmap ); node->get("alpha", &m_alpha_blending ); @@ -97,7 +98,7 @@ { m_index = index; m_clamp_tex = 0; - m_alpha_testing = false; + m_alpha_testing = false; m_lightmap = false; m_alpha_blending = false; m_lighting = true; @@ -152,7 +153,7 @@ #if (IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR >= 7) - if (m_clamp_tex & UCLAMP) + if (m_clamp_tex & UCLAMP != 0) { // m->setFlag(); // n1->getMaterial(0).TextureLayer[0].TextureWrap = video::ETC_CLAMP; @@ -169,13 +170,14 @@ m->TextureLayer[n].TextureWrapU = video::ETC_CLAMP_TO_EDGE; } } - if (m_clamp_tex & VCLAMP) + if (m_clamp_tex & VCLAMP != 0) { for (unsigned int n=0; n<video::MATERIAL_MAX_TEXTURES; n++) { m->TextureLayer[n].TextureWrapV = video::ETC_CLAMP_TO_EDGE; } } + #endif // FIXME: more parameters need to be set! } // setMaterialProperties Modified: main/trunk/src/graphics/material.hpp =================================================================== --- main/trunk/src/graphics/material.hpp 2010-02-01 18:41:38 UTC (rev 4601) +++ main/trunk/src/graphics/material.hpp 2010-02-01 20:03:32 UTC (rev 4602) @@ -40,7 +40,8 @@ bool m_zipper; bool m_resetter; bool m_ignore; - int m_clamp_tex; + /** Texture clamp bitmask */ + unsigned int m_clamp_tex; bool m_lighting; bool m_sphere_map; bool m_alpha_testing; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-01 21:02:37
|
Revision: 4603 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4603&view=rev Author: auria Date: 2010-02-01 21:02:30 +0000 (Mon, 01 Feb 2010) Log Message: ----------- Added new chest animation by MiniBjorn Modified Paths: -------------- main/trunk/data/CREDITS main/trunk/data/textures/chest.png main/trunk/src/states_screens/feature_unlocked.cpp main/trunk/src/states_screens/feature_unlocked.hpp Added Paths: ----------- main/trunk/data/models/chest.b3d main/trunk/data/models/chest.png Removed Paths: ------------- main/trunk/data/items/chest.png main/trunk/data/items/chest_bottom.b3d main/trunk/data/items/chest_top.b3d Modified: main/trunk/data/CREDITS =================================================================== --- main/trunk/data/CREDITS 2010-02-01 20:03:32 UTC (rev 4602) +++ main/trunk/data/CREDITS 2010-02-01 21:02:30 UTC (rev 4603) @@ -44,9 +44,9 @@ |
From: <au...@us...> - 2010-02-01 22:03:25
|
Revision: 4609 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4609&view=rev Author: auria Date: 2010-02-01 22:03:16 +0000 (Mon, 01 Feb 2010) Log Message: ----------- Improved handling of empty 'squares' in scrolling ribbon grids Modified Paths: -------------- main/trunk/data/tracks/lighthouse/scene.xml main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.cpp main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.hpp main/trunk/src/states_screens/kart_selection.cpp main/trunk/src/states_screens/tracks_screen.cpp main/trunk/src/tracks/track_manager.cpp Modified: main/trunk/data/tracks/lighthouse/scene.xml =================================================================== --- main/trunk/data/tracks/lighthouse/scene.xml 2010-02-01 21:38:17 UTC (rev 4608) +++ main/trunk/data/tracks/lighthouse/scene.xml 2010-02-01 22:03:16 UTC (rev 4609) @@ -49,7 +49,7 @@ <small-nitro x="27.694473" y="-5.095636" z="0.7631" /> <small-nitro x="26.239197" y="-3.513813" z="0.7631" /> <checks> - <check-line type="lap" p1="4.415620 2.438872" p2="-4.706323 2.414262" min-height="-0.598438"/> + <check-line type="lap" p1="-4.706323 2.414262" p2="4.415620 2.438872" min-height="-0.598438"/> <check-line kind="lap" p1="8.269903 1.317285" p2="-8.464786 1.317285" min-height="-0.589194"/> <check-line kind="activate" other-id="1" p1="68.019455 -45.556225" p2="44.501854 -31.783911" min-height="-9.717559"/> </checks> Modified: main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.cpp =================================================================== --- main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.cpp 2010-02-01 21:38:17 UTC (rev 4608) +++ main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.cpp 2010-02-01 22:03:16 UTC (rev 4609) @@ -29,6 +29,11 @@ # define round(x) (floor(x+0.5f)) #endif +namespace GUIEngine +{ + const char* NO_ITEM_ID = "?"; +} + DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const int max_rows) { m_scroll_offset = 0; @@ -569,7 +574,8 @@ } } - m_label->setText( L"Unknown Item" ); + if (selection_id == NO_ITEM_ID) m_label->setText( L"" ); + else m_label->setText( L"Unknown Item" ); } // ----------------------------------------------------------------------------- void DynamicRibbonWidget::updateItemDisplay() @@ -622,8 +628,8 @@ } else { - icon->setImage( "/gui/main_help.png" ); - icon->m_properties[PROP_ID] = "?"; + icon->setImage( "/textures/transparence.png" ); + icon->m_properties[PROP_ID] = NO_ITEM_ID; } } // next column } // next row Modified: main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.hpp =================================================================== --- main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.hpp 2010-02-01 21:38:17 UTC (rev 4608) +++ main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.hpp 2010-02-01 22:03:16 UTC (rev 4609) @@ -28,6 +28,9 @@ namespace GUIEngine { + /** The identifier returned for empty "cells" in the ribbon */ + extern const char* NO_ITEM_ID; + /** * Even if you have a ribbon that only acts on click/enter, you may wish to know which * item is currently highlighted. In this case, create a listener and pass it to the ribbon. Modified: main/trunk/src/states_screens/kart_selection.cpp =================================================================== --- main/trunk/src/states_screens/kart_selection.cpp 2010-02-01 21:38:17 UTC (rev 4608) +++ main/trunk/src/states_screens/kart_selection.cpp 2010-02-01 22:03:16 UTC (rev 4609) @@ -1251,6 +1251,9 @@ { unlock_manager->playLockSound(); } + else if (selection == NO_ITEM_ID) + { + } else { std::vector<int> group = kart_properties_manager->getKartsInGroup(selection); Modified: main/trunk/src/states_screens/tracks_screen.cpp =================================================================== --- main/trunk/src/states_screens/tracks_screen.cpp 2010-02-01 21:38:17 UTC (rev 4608) +++ main/trunk/src/states_screens/tracks_screen.cpp 2010-02-01 22:03:16 UTC (rev 4609) @@ -78,6 +78,9 @@ { unlock_manager->playLockSound(); } + else if (selection == NO_ITEM_ID) + { + } else { Track* clickedTrack = track_manager->getTrack(selection); Modified: main/trunk/src/tracks/track_manager.cpp =================================================================== --- main/trunk/src/tracks/track_manager.cpp 2010-02-01 21:38:17 UTC (rev 4608) +++ main/trunk/src/tracks/track_manager.cpp 2010-02-01 22:03:16 UTC (rev 4609) @@ -23,6 +23,7 @@ #include <stdexcept> #include <algorithm> #include <sstream> +#include <iostream> #include "audio/sound_manager.hpp" #include "config/stk_config.hpp" @@ -60,6 +61,7 @@ //----------------------------------------------------------------------------- /** Get TrackData by the track identifier. * \param ident Identifier = basename of the directory the track is in. + * \return The corresponding track object, or NULL if not found */ Track* TrackManager::getTrack(const std::string& ident) const { @@ -71,7 +73,10 @@ std::ostringstream msg; msg<<"TrackManager: Couldn't find track: '"<<ident<<"'"; - throw std::runtime_error(msg.str()); + std::cerr << msg.str() << std::endl; + return NULL; + + //throw std::runtime_error(msg.str()); } // getTrack //----------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-02 01:19:16
|
Revision: 4612 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4612&view=rev Author: auria Date: 2010-02-02 00:17:32 +0000 (Tue, 02 Feb 2010) Log Message: ----------- Tweaks to feature unlocked animation Modified Paths: -------------- main/trunk/data/textures/License.txt main/trunk/src/states_screens/feature_unlocked.cpp Added Paths: ----------- main/trunk/data/textures/purplenebula.png main/trunk/data/textures/purplenebula2.png Modified: main/trunk/data/textures/License.txt =================================================================== --- main/trunk/data/textures/License.txt 2010-02-01 22:20:50 UTC (rev 4611) +++ main/trunk/data/textures/License.txt 2010-02-02 00:17:32 UTC (rev 4612) @@ -10,7 +10,7 @@ * cup_*, speedback, speedfore by yeKcim (Anthony Carré) -* gold, chest, explode +* gold, explode, purplenebula* by Marianne Gagnon (Auria) * road_dirt @@ -19,7 +19,7 @@ * earth, logs, rock, sand, sea, signs, water_light, notes by Marianne Gagnon (Auria) -* bowling, plunger, cake, bubblegum, flaring-star, nitro-tank, nitro-metal, +* bowling, plunger, cake, bubblegum, flaring-star, nitro-tank, nitro-metal, chest, gift-box, gift-loop, tank-cyan, tank-blue, tank-green, plunger-icon, bubblegum-icon, cake-icon, bowling-icon, tnt-bomb, nitro-particle, smoke, anchor, anchor-icon, sand2 created by MiniBjorn (c) 2008 Added: main/trunk/data/textures/purplenebula.png =================================================================== (Binary files differ) Property changes on: main/trunk/data/textures/purplenebula.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: main/trunk/data/textures/purplenebula2.png =================================================================== (Binary files differ) Property changes on: main/trunk/data/textures/purplenebula2.png ___________________________________________________________________ Added: svn:mime-type + image/png Modified: main/trunk/src/states_screens/feature_unlocked.cpp =================================================================== --- main/trunk/src/states_screens/feature_unlocked.cpp 2010-02-01 22:20:50 UTC (rev 4611) +++ main/trunk/src/states_screens/feature_unlocked.cpp 2010-02-02 00:17:32 UTC (rev 4612) @@ -14,6 +14,8 @@ using namespace irr::gui; using namespace irr::video; +// ------------------------------------------------------------------------------------- + FeatureUnlockedCutScene::FeatureUnlockedCutScene() : Screen("feature_unlocked.stkgui") { setNeeds3D(true); @@ -23,6 +25,8 @@ m_unlocked_thing_picture = NULL; } +// ------------------------------------------------------------------------------------- + void FeatureUnlockedCutScene::setUnlockedKart(KartProperties* unlocked_kart) { assert(unlocked_kart != NULL); @@ -30,6 +34,8 @@ m_unlocked_thing_picture = NULL; } +// ------------------------------------------------------------------------------------- + void FeatureUnlockedCutScene::setUnlockedPicture(irr::video::ITexture* picture) { assert(picture != NULL); @@ -38,14 +44,25 @@ m_unlocked_thing_picture = picture; } +// ------------------------------------------------------------------------------------- + void FeatureUnlockedCutScene::init() { m_sky_angle = 0.0f; m_global_time = 0.0f; - m_sky = irr_driver->addSkyDome(file_manager->getTextureFile("lscales.png"), 16 /* hori_res */, 16 /* vert_res */, - 1.0f /* texture_percent */, 2.0f /* sphere_percent */); + //m_sky = irr_driver->addSkyDome(file_manager->getTextureFile("lscales.png"), 16 /* hori_res */, 16 /* vert_res */, + // 1.0f /* texture_percent */, 2.0f /* sphere_percent */); + std::vector<std::string> texture_names(6); + texture_names[0] = file_manager->getTextureFile("purplenebula.png"); + texture_names[1] = file_manager->getTextureFile("purplenebula2.png"); + texture_names[2] = file_manager->getTextureFile("purplenebula.png"); + texture_names[3] = file_manager->getTextureFile("purplenebula2.png"); + texture_names[4] = file_manager->getTextureFile("purplenebula.png"); + texture_names[5] = file_manager->getTextureFile("purplenebula2.png"); + m_sky = irr_driver->addSkyBox(texture_names); + m_camera = irr_driver->addCameraSceneNode(); m_camera->setPosition( core::vector3df(0.0, 30.0f, 70.0f) ); m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) ); @@ -58,40 +75,7 @@ m_chest = irr_driver->addAnimatedMesh(model_chest); m_chest->setPosition( core::vector3df(2, -3, 0) ); m_chest->setScale( core::vector3df(10.0f, 10.0f, 10.0f) ); - m_chest->setRotation( core::vector3df(0.0f, 160, 0.0f) ); - /* - scene::IMesh* model_chest = item_manager->getOtherModel("chest_bottom"); - scene::IMesh* model_chest_top = item_manager->getOtherModel("chest_top"); - scene::IMesh* model_key = item_manager->getOtherModel("key"); - - m_chest = irr_driver->addMesh(model_chest); - m_chest_top = irr_driver->addMesh(model_chest_top); - m_key = irr_driver->addMesh(model_key); - - m_chest->setPosition( core::vector3df(-3, -3, 0) ); - m_chest_top->setPosition( core::vector3df(-3, -3, 0) ); - m_key_pos = 45.0f; - m_key_angle = 0.0f; - m_key->setPosition( core::vector3df(0, 0, m_key_pos) ); - - const int materials = m_key->getMaterialCount(); - for (int n=0; n<materials; n++) - { - m_key->getMaterial(n).setFlag(EMF_LIGHTING, true); - - m_key->getMaterial(n).Shininess = 100.0f; // set size of specular highlights - m_key->getMaterial(n).SpecularColor.set(255,50,50,50); - m_key->getMaterial(n).DiffuseColor.set(255,150,150,150); - - m_key->getMaterial(n).setFlag(EMF_GOURAUD_SHADING , true); - - m_key->getMaterial(n).MaterialType = video::EMT_SPHERE_MAP; - } - - m_key->setScale( core::vector3df(0.8f, 0.8f, 0.8f) ); - */ - irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 120, 120, 120)); const core::vector3df &sun_pos = core::vector3df( 0, 200, 100.0f ); @@ -129,21 +113,10 @@ { std::cerr << "There is nothing in the chest!!!\n"; } - - /* - for (unsigned int i=0; i<sky->getMaterialCount(); i++) - { - video::SMaterial &irrMaterial = sky->getMaterial(i); - for (unsigned int j=0; j<video::MATERIAL_MAX_TEXTURES; j++) - { - video::ITexture* t = irrMaterial.getTexture(j); - if(!t) continue; - core::matrix4 *m = &irrMaterial.getTextureMatrix(j); - m_animated_textures.push_back(new MovingTexture(m, 0.05f, 0.0f)); - } // for j<MATERIAL_MAX_TEXTURES - } // for i<getMaterialCount - */ } + +// ------------------------------------------------------------------------------------- + void FeatureUnlockedCutScene::tearDown() { printf("+++++++ FeatureUnlockedCutScene:tearDown +++++++++\n"); @@ -171,6 +144,19 @@ } } +// ------------------------------------------------------------------------------------- + +//FIXME: doesn't go here... +template<typename T> +T keepInRange(T from, T to, T value) +{ + if (value < from) return from; + if (value > to ) return to; + return value; +} + +// ------------------------------------------------------------------------------------- + void FeatureUnlockedCutScene::onUpdate(float dt, irr::video::IVideoDriver* driver) { m_global_time += dt; @@ -179,52 +165,28 @@ if (m_sky_angle > 360) m_sky_angle -= 360; m_sky->setRotation( core::vector3df(0, m_sky_angle, 0) ); - const float ANIM_TO = 4.5f; + const float ANIM_FROM = 2.0f; + const float ANIM_TO = 5.5f; const int last_image = m_chest->getEndFrame() - 1; - const float current_frame = std::min((double)last_image, m_global_time/(float)ANIM_TO * last_image); - //std::cout << "current_frame: " << current_frame << std::endl; - m_chest->setCurrentFrame( current_frame ); - /* - const float KEY_Y = 6.8f; - const float KEY_FINAL_DIST = 15; - if (m_key_pos > KEY_FINAL_DIST) m_key_pos -= dt*5; - m_key->setPosition( core::vector3df(0, KEY_Y, m_key_pos) ); + if (m_global_time < ANIM_FROM) + { + // progression of the chest rotation between 0 and 1 + const float rotationProgression = keepInRange( 0.0f, 1.0f, (float)sin(M_PI/2.0f*m_global_time/double(ANIM_FROM)) ); + const float chest_rotation = keepInRange(80.0f, 160.0f, (float)(80 + rotationProgression * 80) ); + m_chest->setRotation( core::vector3df(0.0f, chest_rotation, 0.0f) ); + } - // distance at which the key starts rotating - const float KEY_ROTATION_FROM = 30.0f; - // distance at which the key finishes rotating - const float KEY_ROTATION_TO = KEY_FINAL_DIST + 10.0f; - - //const float CHEST_OPEN_FROM = KEY_ROTATION_TO + 1.0f; - //const float CHEST_OPEN_TO = KEY_ROTATION_TO + 8.0f; - - m_key_angle = 1.0f - (m_key_pos - KEY_ROTATION_TO) / (KEY_ROTATION_FROM - KEY_ROTATION_TO); - if (m_key_angle < 0.0f) m_key_angle = 0.0f; - else if (m_key_angle > 1.0f) m_key_angle = 1.0f; - - - //printf("m_key_angle = %f\n", m_key_angle); - m_key->setRotation( core::vector3df(0, m_key_angle*90.0f, -m_key_angle*90.0f) ); - - */ - + const float current_frame = keepInRange(0.0, (double)last_image, + (m_global_time - ANIM_FROM)/(double)(ANIM_TO - ANIM_FROM) * last_image); + //std::cout << "current_frame: " << current_frame << std::endl; + m_chest->setCurrentFrame( current_frame ); + const int GIFT_EXIT_FROM = ANIM_TO; const int GIFT_EXIT_TO = GIFT_EXIT_FROM + 12; if (m_global_time > GIFT_EXIT_FROM && m_global_time < GIFT_EXIT_TO && m_root_gift_node != NULL) { - /* - const double chest_top_angle = ((double)(m_global_time - GIFT_EXIT_FROM)*3/(double)GIFT_EXIT_TO)*110.0; - m_chest_top->setRotation( core::vector3df( 360.0f-(float)std::min(110.0, chest_top_angle), 0, 0 )); - if (chest_top_angle < 110.0) - { - core::vector3df chestpos = m_chest_top->getPosition(); - chestpos.Y += dt*6; - m_chest_top->setPosition(chestpos); - } - */ - core::vector3df pos = m_root_gift_node->getPosition(); pos.Y = sin( (float)((m_global_time - GIFT_EXIT_FROM)*M_PI*1.2/GIFT_EXIT_TO) )*30.0f; pos.X += 2*dt; @@ -275,10 +237,16 @@ true/* center h */, true /* center v */ ); } -void FeatureUnlockedCutScene::eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) +// ------------------------------------------------------------------------------------- + +void FeatureUnlockedCutScene::eventCallback(GUIEngine::Widget* widget, + const std::string& name, + const int playerID) { if (name == "back") { StateManager::get()->escapePressed(); } } + +// ------------------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-02-04 22:53:34
|
Revision: 4635 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4635&view=rev Author: hikerstk Date: 2010-02-04 22:53:24 +0000 (Thu, 04 Feb 2010) Log Message: ----------- Added first version of switch collectable. Modified Paths: -------------- main/trunk/data/stk_config.xml main/trunk/src/config/stk_config.cpp main/trunk/src/config/stk_config.hpp main/trunk/src/graphics/irr_driver.cpp main/trunk/src/graphics/irr_driver.hpp main/trunk/src/input/input_manager.cpp main/trunk/src/items/item.cpp main/trunk/src/items/item.hpp main/trunk/src/items/item_manager.cpp main/trunk/src/items/item_manager.hpp main/trunk/src/items/powerup.cpp main/trunk/src/items/powerup_manager.cpp main/trunk/src/items/powerup_manager.hpp main/trunk/src/karts/kart.cpp main/trunk/src/tracks/track.cpp Added Paths: ----------- main/trunk/data/switch.collectable Modified: main/trunk/data/stk_config.xml =================================================================== --- main/trunk/data/stk_config.xml 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/data/stk_config.xml 2010-02-04 22:53:24 UTC (rev 4635) @@ -70,6 +70,9 @@ zipper-time is the time a zipper is active zipper-force is the additional zipper force zipper-speed-gain is the one time additional speed +item-switch-time How long a switch is being effective. +switch-items for each item list the index of the item it is switched with. + Order: item, banana, big-nitro, small-nitro --> <attachment-parameters @@ -87,6 +90,8 @@ zipper-force="250.0" zipper-speed-gain="4.5" zipper-max-speed-fraction="2.0" + item-switch-time="5" + switch-items="1 0 1 1 4" /> <!-- GENERAL KART DEFAULTS Added: main/trunk/data/switch.collectable =================================================================== --- main/trunk/data/switch.collectable (rev 0) +++ main/trunk/data/switch.collectable 2010-02-04 22:53:24 UTC (rev 4635) @@ -0,0 +1,9 @@ +;; -*- mode: lisp -*- + +(tuxkart-collectable + (name "swap") + (mesh "zipper.b3d") + (icon "swap-icon.png") +) + +;; EOF ;; Modified: main/trunk/src/config/stk_config.cpp =================================================================== --- main/trunk/src/config/stk_config.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/config/stk_config.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -24,8 +24,9 @@ #include <sstream> #include "io/file_manager.hpp" -//#include "lisp/parser.hpp" #include "io/xml_node.hpp" +#include "items/item.hpp" +#include "items/item_manager.hpp" #include "audio/music_information.hpp" STKConfig* stk_config=0; @@ -80,6 +81,11 @@ fprintf(stderr,"No follow leader interval(s) defined in stk_config"); exit(-1); } + if(m_switch_items.size()!=Item::ITEM_LAST-Item::ITEM_FIRST+1) + { + fprintf(stderr,"No item switches defined in stk_config"); + exit(-1); + } if(m_menu_background.size()==0) { fprintf(stderr,"No menu background defined in stk_config"); @@ -104,6 +110,7 @@ CHECK_NEG(m_zipper_force, "zipper-force" ); CHECK_NEG(m_zipper_speed_gain, "zipper-speed-gain" ); CHECK_NEG(m_zipper_max_speed_fraction, "zipper-max-speed-fraction" ); + CHECK_NEG(m_item_switch_time, "item-switch-time" ); CHECK_NEG(m_final_camera_time, "final-camera-time" ); CHECK_NEG(m_explosion_impulse, "explosion-impulse" ); CHECK_NEG(m_explosion_impulse_objects, "explosion-impulse-objects" ); @@ -119,6 +126,7 @@ CHECK_NEG(m_music_credit_time, "music-credit-time" ); m_kart_properties.checkAllSet(filename); + item_manager->setSwitchItems(m_switch_items); } // load // ----------------------------------------------------------------------------- @@ -134,10 +142,11 @@ m_bomb_time = m_bomb_time_increase = m_anvil_time = m_zipper_time = m_zipper_force = m_zipper_speed_gain = - m_zipper_max_speed_fraction = m_music_credit_time = + m_zipper_max_speed_fraction = m_music_credit_time = m_explosion_impulse = m_explosion_impulse_objects = m_delay_finish_time = m_skid_fadeout_time = - m_final_camera_time = m_near_ground = UNDEFINED; + m_final_camera_time = m_near_ground = + m_item_switch_time = UNDEFINED; m_max_karts = -100; m_grid_order = -100; m_max_history = -100; @@ -150,6 +159,7 @@ m_enable_networking = true; m_scores.clear(); m_leader_intervals.clear(); + m_switch_items.clear(); } // init_defaults //----------------------------------------------------------------------------- @@ -227,11 +237,13 @@ node->get("bomb-time", &m_bomb_time); node->get("bomb-time-increase", &m_bomb_time_increase); node->get("leader-intervals", &m_leader_intervals); + node->get("switch-items", &m_switch_items); node->get("anvil-time", &m_anvil_time); node->get("zipper-time", &m_zipper_time); node->get("zipper-force", &m_zipper_force); node->get("zipper-speed-gain", &m_zipper_speed_gain); node->get("zipper-max-speed-fraction", &m_zipper_max_speed_fraction); + node->get("item-switch-time", &m_item_switch_time); node = root -> getNode("misc-defaults"); Modified: main/trunk/src/config/stk_config.hpp =================================================================== --- main/trunk/src/config/stk_config.hpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/config/stk_config.hpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -56,6 +56,7 @@ float m_zipper_speed_gain; /**<Initial one time speed gain. */ float m_zipper_max_speed_fraction;/**<Fraction of max speed allowed past regular max speed */ + float m_item_switch_time; /**< Time items will be switched. */ float m_final_camera_time; /**<Time for the movement of the final * camera. */ float m_explosion_impulse; /**<Impulse affecting each non-hit kart.*/ @@ -85,6 +86,7 @@ std::vector<float> m_leader_intervals; /**<Interval in follow the leader till last kart is reomved. */ + std::vector<int> m_switch_items; /**< How to switch items. */ std::vector<int> m_scores; /**<Scores depending on position. */ Modified: main/trunk/src/graphics/irr_driver.cpp =================================================================== --- main/trunk/src/graphics/irr_driver.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/graphics/irr_driver.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -460,7 +460,7 @@ * since the node is not optimised. * \param mesh The mesh to add. */ -scene::ISceneNode *IrrDriver::addMesh(scene::IMesh *mesh) +scene::IMeshSceneNode *IrrDriver::addMesh(scene::IMesh *mesh) { return m_scene_manager->addMeshSceneNode(mesh); } // addMesh Modified: main/trunk/src/graphics/irr_driver.hpp =================================================================== --- main/trunk/src/graphics/irr_driver.hpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/graphics/irr_driver.hpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -99,7 +99,7 @@ scene::ISceneNode *addWaterNode(scene::IMesh *mesh, float wave_height, float wave_speed, float wave_length); scene::ISceneNode *addOctTree(scene::IMesh *mesh); - scene::ISceneNode *addMesh(scene::IMesh *mesh); + scene::IMeshSceneNode*addMesh(scene::IMesh *mesh); scene::ISceneNode *addBillboard(const core::dimension2d< f32 > size, video::ITexture *texture, scene::ISceneNode* parent=NULL); scene::IParticleSystemSceneNode Modified: main/trunk/src/input/input_manager.cpp =================================================================== --- main/trunk/src/input/input_manager.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/input/input_manager.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -35,6 +35,7 @@ #include "guiengine/screen.hpp" #include "input/device_manager.hpp" #include "input/input.hpp" +#include "items/item_manager.hpp" #include "items/projectile_manager.hpp" #include "karts/kart.hpp" #include "karts/player_kart.hpp" @@ -120,6 +121,13 @@ kart->setPowerup(POWERUP_CAKE, 10000); } break; + case KEY_F4: + if (race_manager->getNumPlayers() ==1 ) + { + Kart* kart = RaceManager::getPlayerKart(0); + kart->setPowerup(POWERUP_SWITCH, 10000); + } + break; case KEY_F11: // FIXME: at this stage you can only switch back from debug view to normal // view, if switching again you noly get a grey screen - some opengl settings Modified: main/trunk/src/items/item.cpp =================================================================== --- main/trunk/src/items/item.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/items/item.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -31,13 +31,16 @@ m_rotate = rotate; m_event_handler = NULL; m_deactive_time = 0; + m_normal = normal; // Sets heading to 0, and sets pitch and roll depending on the normal. */ Vec3 hpr = Vec3(0, normal); m_coord = Coord(xyz, hpr); m_item_id = item_id; m_type = type; + m_original_type = ITEM_NONE; m_collected = false; m_time_till_return = 0.0f; // not strictly necessary, see isCollected() + m_original_mesh = mesh; m_node = irr_driver->addMesh(mesh); // If lighting would be enabled certain items (esp. bananas) // don't look smooth, so for now generally disable lighting @@ -48,6 +51,31 @@ } // Item //----------------------------------------------------------------------------- +/** Changes this item to be a new type for a certain amount of time. + * \param type New type of this item. + * \param mesh Mesh to use to display this item. + */ +void Item::switchTo(ItemType type, scene::IMesh *mesh) +{ + m_original_type = m_type; + m_type = type; + m_node->setMesh(mesh); +} // switchTo + +//----------------------------------------------------------------------------- +/** Switch backs to the original item. + */ +void Item::switchBack() +{ + assert(m_original_type!=ITEM_NONE); + m_type = m_original_type; + m_original_type = ITEM_NONE; + m_node->setMesh(m_original_mesh); +} // switchBack + +//----------------------------------------------------------------------------- +/** Removes an item. + */ Item::~Item() { irr_driver->removeNode(m_node); @@ -55,27 +83,43 @@ } // ~Item //----------------------------------------------------------------------------- +/** Resets before a race (esp. if a race is restarted). + */ void Item::reset() { m_collected = false; m_time_till_return = 0.0f; m_deactive_time = 0.0f; + if(m_original_type!=ITEM_NONE) + { + m_type = m_original_type; + m_original_type = ITEM_NONE; + } } // reset + //----------------------------------------------------------------------------- +/** Sets which karts dropped an item. This is used to avoid that a kart is + * affected by its own items. + * \param parent Kart that dropped the item. + */ void Item::setParent(Kart* parent) { - m_event_handler = parent; + m_event_handler = parent; m_deactive_time = 1.5f; } //----------------------------------------------------------------------------- -void Item::update(float delta) +/** Updated the item - rotates it, takes care of items coming back into + * the game after it has been collected. + * \param dt Time step size. + */ +void Item::update(float dt) { - if(m_event_handler != NULL && m_deactive_time > 0) m_deactive_time -= delta; + if(m_event_handler != NULL && m_deactive_time > 0) m_deactive_time -= dt; if(m_collected) { - m_time_till_return -= delta; + m_time_till_return -= dt; if ( m_time_till_return > 0 ) { Vec3 hell(m_coord.getXYZ()); @@ -95,10 +139,22 @@ if(!m_rotate) return; // have it rotate - Vec3 rotation(delta*M_PI, 0, 0); + Vec3 rotation(dt*M_PI, 0, 0); m_coord.setHPR(m_coord.getHPR()+rotation); m_node->setRotation(m_coord.getHPR().toIrrHPR()); m_node->setPosition(m_coord.getXYZ().toIrrVector()); + return; + + static float t=0; + t += dt; + + btQuaternion q(Vec3(0,0,1), t*0.1f); + btQuaternion q_orig(m_normal, 0); + btQuaternion result=q+q_orig; + btMatrix3x3 m(result); + float y, p, r; + m.getEuler(y, p, r); + m_node->setRotation(Vec3(y, p, r).toIrrHPR()); } } // update Modified: main/trunk/src/items/item.hpp =================================================================== --- main/trunk/src/items/item.hpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/items/item.hpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -30,28 +30,52 @@ class Item { public: + // The list of all items. Important for the switch item function: + // bubblegum must be the last item (since bubble gum can't be + // switched with any other item, since it's a different objecct). enum ItemType { ITEM_FIRST, ITEM_BONUS_BOX = ITEM_FIRST, ITEM_BANANA, - ITEM_GOLD_COIN, - ITEM_SILVER_COIN, + ITEM_NITRO_BIG, + ITEM_NITRO_SMALL, ITEM_BUBBLEGUM, - ITEM_LAST = ITEM_BUBBLEGUM + ITEM_LAST = ITEM_BUBBLEGUM, + ITEM_COUNT, + ITEM_NONE }; private: - ItemType m_type; // Item type - bool m_collected; // true if item was collected & is not displayed - float m_time_till_return; // time till a collected item reappears - Coord m_coord; // Original coordinates, used mainly when - // collected items reappear. + /** Item type. */ + ItemType m_type; + + /** If the item is switched, this contains the original type. + * It is ITEM_NONE if the item is not switched. */ + ItemType m_original_type; + + /** True if item was collected & is not displayed. */ + bool m_collected; + + /** Time till a collected item reappears. */ + float m_time_till_return; + + /** Original coordinates, used mainly when collected items reappear. */ + Coord m_coord; + /** Scene node of this item. */ - scene::ISceneNode *m_node; - unsigned int m_item_id; // index in item_manager field + scene::IMeshSceneNode *m_node; - bool m_rotate; // set to false if item should not rotate + /** Stores the original mesh in order to reset it. */ + scene::IMesh *m_original_mesh; + + Vec3 m_normal; + + /** Index in item_manager field. */ + unsigned int m_item_id; + + /** Set to false if item should not rotate. */ + bool m_rotate; /** optionally, set this if this item was laid by a particular kart. in this case, the 'm_deactive_time' will also be set - see below. */ @@ -92,6 +116,8 @@ bool wasCollected() const { return m_collected;} void setParent(Kart* parent); void reset(); + void switchTo(ItemType type, scene::IMesh *mesh); + void switchBack(); }; // class Item #endif Modified: main/trunk/src/items/item_manager.cpp =================================================================== --- main/trunk/src/items/item_manager.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/items/item_manager.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -23,6 +23,7 @@ #include <string> #include <sstream> +#include "config/stk_config.hpp" #include "config/user_config.hpp" #include "graphics/irr_driver.hpp" #include "graphics/material.hpp" @@ -43,9 +44,27 @@ { m_all_meshes.clear(); // The actual loading is done in loadDefaultItems + + // Prepare the switch to array, which stores which item should be + // switched to what other item. Initialise it with a mapping that + // each item is switched to itself, so basically a no-op. + m_switch_to.reserve(Item::ITEM_COUNT); + for(unsigned int i=Item::ITEM_FIRST; i<Item::ITEM_COUNT; i++) + m_switch_to.push_back((Item::ItemType)i); } // ItemManager //----------------------------------------------------------------------------- +/** Sets which objects is getting switched to what. + * \param switch A mapping of items types to item types for the mapping. + * must contain one entry for each item. + */ +void ItemManager::setSwitchItems(const std::vector<int> &switch_items) +{ + for(unsigned int i=Item::ITEM_FIRST; i<Item::ITEM_COUNT; i++) + m_switch_to[i]=(Item::ItemType)stk_config->m_switch_items[i]; +} // setSwitchItems + +//----------------------------------------------------------------------------- void ItemManager::removeTextures() { for(AllItemTypes::iterator i =m_all_items.begin(); @@ -107,8 +126,8 @@ std::string DEFAULT_NAMES[Item::ITEM_LAST - Item::ITEM_FIRST +1]; DEFAULT_NAMES[Item::ITEM_BONUS_BOX] = "gift-box"; DEFAULT_NAMES[Item::ITEM_BANANA] = "banana"; - DEFAULT_NAMES[Item::ITEM_GOLD_COIN] = "nitrotank-big"; - DEFAULT_NAMES[Item::ITEM_SILVER_COIN] = "nitrotank-small"; + DEFAULT_NAMES[Item::ITEM_NITRO_BIG] = "nitrotank-big"; + DEFAULT_NAMES[Item::ITEM_NITRO_SMALL] = "nitrotank-small"; DEFAULT_NAMES[Item::ITEM_BUBBLEGUM] = "bubblegum"; bool bError=0; @@ -143,6 +162,13 @@ } // setDefaultItemStyle //----------------------------------------------------------------------------- +/** Creates a new item. + * \param type Type of the item. + * \param xyz Position of the item. + * \param normal The normal of the terrain to set roll and pitch. + * \param parent In case of a dropped item used to avoid that a kart + * is affected by its own items. + */ Item* ItemManager::newItem(Item::ItemType type, const Vec3& xyz, const Vec3 &normal, Kart *parent) { @@ -258,6 +284,8 @@ i++; } } // for i + + m_switch_time = -1; } // reset //----------------------------------------------------------------------------- @@ -299,16 +327,53 @@ } // setStyle //----------------------------------------------------------------------------- -void ItemManager::update(float delta) +void ItemManager::update(float dt) { + // If switch time is over, switch all items back + if(m_switch_time>=0) + { + m_switch_time -= dt; + if(m_switch_time<0) + { + for(AllItemTypes::iterator i =m_all_items.begin(); + i!=m_all_items.end(); i++) + { + (*i)->switchBack(); + } // for m_all_items + } // m_switch_time < 0 + } // m_switch_time>=0 + for(AllItemTypes::iterator i =m_all_items.begin(); i!=m_all_items.end(); i++) { - (*i)->update(delta); + (*i)->update(dt); } // for m_all_items -} // delta +} // update //----------------------------------------------------------------------------- +/** Switches all items: boxes become bananas and vice versa for a certain + * amount of time (as defined in stk_config.xml. + */ +void ItemManager::switchItems() +{ + for(AllItemTypes::iterator i =m_all_items.begin(); + i!=m_all_items.end(); i++) + { + Item::ItemType new_type = m_switch_to[(*i)->getType()]; + + if(m_switch_time<0) + (*i)->switchTo(new_type, m_item_mesh[(int)new_type]); + // FIXME: if switch is used while items are switched: + // switch back - but that doesn't work properly yet + //else + // (*i)->switchBack(); + } // for m_all_items + + m_switch_time = stk_config->m_item_switch_time; + +} // switchItems + +//----------------------------------------------------------------------------- void ItemManager::loadItemStyle(const std::string filename) { if(filename.length()==0) return; @@ -326,10 +391,10 @@ throw std::runtime_error(msg.str()); delete root; } - setItem(item_node, "red", Item::ITEM_BONUS_BOX ); - setItem(item_node, "green", Item::ITEM_BANANA ); - setItem(item_node, "gold" ,Item::ITEM_GOLD_COIN ); - setItem(item_node, "silver",Item::ITEM_SILVER_COIN); + setItem(item_node, "red", Item::ITEM_BONUS_BOX ); + setItem(item_node, "green", Item::ITEM_BANANA ); + setItem(item_node, "gold" ,Item::ITEM_NITRO_BIG ); + setItem(item_node, "silver",Item::ITEM_NITRO_SMALL); delete root; } // loadItemStyle Modified: main/trunk/src/items/item_manager.hpp =================================================================== --- main/trunk/src/items/item_manager.hpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/items/item_manager.hpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -43,6 +43,13 @@ std::map<std::string,scene::IMesh*> m_all_meshes; std::string m_user_filename; + + /** Remaining time that items should remain switched. */ + float m_switch_time; + + /** What item is item is switched to. */ + std::vector<Item::ItemType> m_switch_to; + void setDefaultItemStyle(); void setItem(const lisp::Lisp *item_node, const char *colour, Item::ItemType type); @@ -62,6 +69,8 @@ void setUserFilename (char *s) {m_user_filename=s;} void collectedItem (int item_id, Kart *kart, int add_info=-1); + void switchItems (); + void setSwitchItems(const std::vector<int> &switch_items); void setStyle (); scene::IMesh* getItemModel (Item::ItemType type) {return m_item_mesh[type];} Modified: main/trunk/src/items/powerup.cpp =================================================================== --- main/trunk/src/items/powerup.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/items/powerup.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -129,6 +129,9 @@ { case POWERUP_ZIPPER: m_owner->handleZipper(); break ; + case POWERUP_SWITCH: + item_manager->switchItems(); + break; case POWERUP_CAKE: case POWERUP_BOWLING: case POWERUP_PLUNGER: Modified: main/trunk/src/items/powerup_manager.cpp =================================================================== --- main/trunk/src/items/powerup_manager.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/items/powerup_manager.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -46,6 +46,7 @@ {POWERUP_BUBBLEGUM, "bubblegum.xml" }, {POWERUP_CAKE, "cake.projectile" }, {POWERUP_ANVIL, "anvil.collectable" }, + {POWERUP_SWITCH, "switch.collectable" }, {POWERUP_PARACHUTE, "parachute.collectable" }, {POWERUP_PLUNGER, "plunger.projectile" }, {POWERUP_MAX, "" }, @@ -69,6 +70,8 @@ } // removeTextures //----------------------------------------------------------------------------- +/** Loads all projectiles from the powerup.xml file. + */ void PowerupManager::loadPowerups() { for(int i=0; ict[i].powerup != POWERUP_MAX; i++) Modified: main/trunk/src/items/powerup_manager.hpp =================================================================== --- main/trunk/src/items/powerup_manager.hpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/items/powerup_manager.hpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -33,6 +33,7 @@ enum PowerupType {POWERUP_NOTHING, POWERUP_BUBBLEGUM, POWERUP_CAKE, POWERUP_BOWLING, POWERUP_ZIPPER, POWERUP_PLUNGER, + POWERUP_SWITCH, POWERUP_PARACHUTE, POWERUP_ANVIL, //powerup.cpp assumes these two come last POWERUP_MAX}; Modified: main/trunk/src/karts/kart.cpp =================================================================== --- main/trunk/src/karts/kart.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/karts/kart.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -426,8 +426,8 @@ m_attachment.hitBanana(item, add_info); break; - case Item::ITEM_SILVER_COIN: m_collected_energy++ ; break; - case Item::ITEM_GOLD_COIN : m_collected_energy += 3 ; break; + case Item::ITEM_NITRO_SMALL: m_collected_energy++; break; + case Item::ITEM_NITRO_BIG: m_collected_energy += 3; break; case Item::ITEM_BONUS_BOX : { // In wheelie style, karts get more items depending on energy, @@ -451,7 +451,7 @@ // functions (hit{Red,Green}Item), so only coins need to be // stored here. if(network_manager->getMode()==NetworkManager::NW_SERVER && - (type==Item::ITEM_SILVER_COIN || type==Item::ITEM_GOLD_COIN) ) + (type==Item::ITEM_NITRO_BIG || type==Item::ITEM_NITRO_SMALL) ) { race_state->itemCollected(getWorldKartId(), item.getItemId()); } Modified: main/trunk/src/tracks/track.cpp =================================================================== --- main/trunk/src/tracks/track.cpp 2010-02-04 22:37:33 UTC (rev 4634) +++ main/trunk/src/tracks/track.cpp 2010-02-04 22:53:24 UTC (rev 4635) @@ -700,8 +700,8 @@ Item::ItemType type; if (name=="banana" ) type = Item::ITEM_BANANA; else if(name=="item" ) type = Item::ITEM_BONUS_BOX; - else if(name=="small-nitro") type = Item::ITEM_SILVER_COIN; - else type = Item::ITEM_GOLD_COIN; + else if(name=="small-nitro") type = Item::ITEM_NITRO_SMALL; + else type = Item::ITEM_NITRO_BIG; Vec3 xyz; // Set some kind of default in case Z is not defined in the file // (with the new track exporter it always is defined anyway). @@ -905,7 +905,8 @@ // Don't tilt the items, since otherwise the rotation will look odd, // i.e. the items will not rotate around the normal, but 'wobble' // around. - Vec3 normal(0, 0, 0.0f); + //Vec3 normal(0.7, 0, 0.7); + Vec3 normal(0, 0, 1); item_manager->newItem(type, loc, normal); } // itemCommand This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-02-07 02:05:29
|
Revision: 4648 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4648&view=rev Author: hikerstk Date: 2010-02-07 02:05:21 +0000 (Sun, 07 Feb 2010) Log Message: ----------- 1) Replaced all .projectile files with one powerup.xml file, replaced items.item with items.xml. Cleaned up item_manager and removed support for different item styles (since it didn't work anyway) 2) If a swapper item is used while items are swapped, they will now un-swap. 3) Moved all models and textures from data/items to data/models. Modified Paths: -------------- main/trunk/configure.ac main/trunk/data/models/License.txt main/trunk/src/graphics/irr_driver.cpp main/trunk/src/items/bowling.cpp main/trunk/src/items/bowling.hpp main/trunk/src/items/cake.cpp main/trunk/src/items/cake.hpp main/trunk/src/items/flyable.cpp main/trunk/src/items/flyable.hpp main/trunk/src/items/item_manager.cpp main/trunk/src/items/item_manager.hpp main/trunk/src/items/plunger.cpp main/trunk/src/items/plunger.hpp main/trunk/src/items/powerup_manager.cpp main/trunk/src/items/powerup_manager.hpp main/trunk/src/main.cpp main/trunk/src/tracks/track.cpp Added Paths: ----------- main/trunk/data/items.xml main/trunk/data/models/banana.b3d main/trunk/data/models/banana.png main/trunk/data/models/bonusblock1.png main/trunk/data/models/bonusblock2.b3d main/trunk/data/models/bubblegum.b3d main/trunk/data/models/bubblegum.png main/trunk/data/models/gift-box.b3d main/trunk/data/models/gift-box.png main/trunk/data/models/gift-loop.png main/trunk/data/models/gold.png main/trunk/data/models/nitro-tank.png main/trunk/data/models/nitrotank-big.b3d main/trunk/data/models/nitrotank-small.b3d main/trunk/data/models/tank-blue.png main/trunk/data/models/tank-cyan.png main/trunk/data/models/tank-green.png main/trunk/data/models/warning.b3d main/trunk/data/models/warning.png main/trunk/data/powerup.xml Removed Paths: ------------- main/trunk/data/bowling.projectile main/trunk/data/bubblegum.projectile main/trunk/data/bubblegum.xml main/trunk/data/cake.projectile main/trunk/data/items/ main/trunk/data/items.items main/trunk/data/plunger.projectile Modified: main/trunk/configure.ac =================================================================== --- main/trunk/configure.ac 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/configure.ac 2010-02-07 02:05:21 UTC (rev 4648) @@ -423,7 +423,6 @@ data/fonts/Makefile \ data/grandprix/Makefile \ data/gui/Makefile \ - data/items/Makefile \ data/karts/Makefile \ data/models/Makefile \ data/music/Makefile \ Deleted: main/trunk/data/bowling.projectile =================================================================== --- main/trunk/data/bowling.projectile 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/data/bowling.projectile 2010-02-07 02:05:21 UTC (rev 4648) @@ -1,21 +0,0 @@ -;; -*- mode: lisp -*- - -(tuxkart-collectable - (name "Bowling") - (model "bowling.ac") - (mesh "bowling.b3d") - (icon "bowling-icon.png") - (speed 4.0) - (min-height 0.2) ; height above terrain below which a ball is - ; started to be pulled up - (max-height 1.0) ; height above terrain at which a ball is - ; started to be pulled back to ground - (force-updown 1.0) ; force pushing the ball down - ; when it's too high above ground - (force-to-target 40) ; force with which a bowling ball flies towards - ; the nearest kart - (max-distance 25) ; maximum distance the ball can be away - ; from a kart when accelerating towards it -) - -;; EOF ;; Deleted: main/trunk/data/bubblegum.projectile =================================================================== --- main/trunk/data/bubblegum.projectile 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/data/bubblegum.projectile 2010-02-07 02:05:21 UTC (rev 4648) @@ -1,13 +0,0 @@ -;; -*- mode: lisp -*- - -(tuxkart-collectable - (name "Bubble Gum") - (model "../items/bubblegum.ac") - (icon "bubblegum-icon.png") - (speed 50.0) - (min-height 0.3) - (max-height 1.0) - (force-updown 20) -) - -;; EOF ;; Deleted: main/trunk/data/bubblegum.xml =================================================================== --- main/trunk/data/bubblegum.xml 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/data/bubblegum.xml 2010-02-07 02:05:21 UTC (rev 4648) @@ -1,13 +0,0 @@ -;; -*- mode: lisp -*- - -(tuxkart-collectable - (name "Bubble Gum") - (mesh "../items/bubblegum.b3d") - (icon "bubblegum-icon.png") - (speed 50.0) - (min-height 0.3) - (max-height 1.0) - (force-updown 20) -) - -;; EOF ;; Deleted: main/trunk/data/cake.projectile =================================================================== --- main/trunk/data/cake.projectile 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/data/cake.projectile 2010-02-07 02:05:21 UTC (rev 4648) @@ -1,14 +0,0 @@ -;; -*- mode: lisp -*- - -(tuxkart-collectable - (name "cake") - (mesh "cake.b3d") - (icon "cake-icon.png") - (speed 50.0) - (min-height 0.2) - (max-height 1.0) - (force-updown 25.0) ;; force raising/lowering the homing missile if it's too low/high - (max-distance 90.0) ;; maximum distance at which a kart is still followed -) - -;; EOF ;; Deleted: main/trunk/data/items.items =================================================================== --- main/trunk/data/items.items 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/data/items.items 2010-02-07 02:05:21 UTC (rev 4648) @@ -1,10 +0,0 @@ -;; -*- mode: lisp -*- - -(item - (gold "nitrotank-big" ) - (silver "nitrotank-small") - (green "banana" ) - (red "gift-box") -) - -;; EOF ;; Added: main/trunk/data/items.xml =================================================================== --- main/trunk/data/items.xml (rev 0) +++ main/trunk/data/items.xml 2010-02-07 02:05:21 UTC (rev 4648) @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<items> + <bonus-box model="gift-box.b3d" /> + <banana model="banana.b3d" /> + <nitro-big model="nitrotank-big.b3d" /> + <nitro-small model="nitrotank-small.b3d" /> + <!-- While a bubble gum technically + isn't an item, it is internally + handled as one, so list it here --> + <bubblegum model="bubblegum.b3d" /> +</items> + Modified: main/trunk/data/models/License.txt =================================================================== --- main/trunk/data/models/License.txt 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/data/models/License.txt 2010-02-07 02:05:21 UTC (rev 4648) @@ -2,4 +2,16 @@ created by MiniBjorn (c) 2008 released under Creative Commons Attribution-Share Alike 3.0 [http://creativecommons.org/licenses/by-sa/3.0/] -Others are GPL. \ No newline at end of file +* bubblegum.ac, nitrotank-big.ac, nitrotank-small.ac, giftbox.ac + created by MiniBjorn (c) 2008 + released under Creative Commons Attribution-Share Alike 3.0 [http://creativecommons.org/licenses/by-sa/3.0/] + +* banana.ac + created by horace aka thomas oppl (to...@fh...) (c) 2008 + released under Creative Commons Attribution-Share Alike 3.0 [http://creativecommons.org/licenses/by-sa/3.0/] + +* chest_*, key + by Marianne gagnon + released under Creative Commons Attribution-Share Alike 3.0 [http://creativecommons.org/licenses/by-sa/3.0/] + +Others are GPL. Copied: main/trunk/data/models/banana.b3d (from rev 4629, main/trunk/data/items/banana.b3d) =================================================================== (Binary files differ) Copied: main/trunk/data/models/banana.png (from rev 4629, main/trunk/data/items/banana.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/bonusblock1.png (from rev 4629, main/trunk/data/items/bonusblock1.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/bonusblock2.b3d (from rev 4629, main/trunk/data/items/bonusblock2.b3d) =================================================================== (Binary files differ) Copied: main/trunk/data/models/bubblegum.b3d (from rev 4629, main/trunk/data/items/bubblegum.b3d) =================================================================== (Binary files differ) Copied: main/trunk/data/models/bubblegum.png (from rev 4629, main/trunk/data/items/bubblegum.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/gift-box.b3d (from rev 4629, main/trunk/data/items/gift-box.b3d) =================================================================== (Binary files differ) Copied: main/trunk/data/models/gift-box.png (from rev 4629, main/trunk/data/items/gift-box.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/gift-loop.png (from rev 4629, main/trunk/data/items/gift-loop.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/gold.png (from rev 4629, main/trunk/data/items/gold.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/nitro-tank.png (from rev 4629, main/trunk/data/items/nitro-tank.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/nitrotank-big.b3d (from rev 4629, main/trunk/data/items/nitrotank-big.b3d) =================================================================== (Binary files differ) Copied: main/trunk/data/models/nitrotank-small.b3d (from rev 4629, main/trunk/data/items/nitrotank-small.b3d) =================================================================== (Binary files differ) Copied: main/trunk/data/models/tank-blue.png (from rev 4629, main/trunk/data/items/tank-blue.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/tank-cyan.png (from rev 4629, main/trunk/data/items/tank-cyan.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/tank-green.png (from rev 4629, main/trunk/data/items/tank-green.png) =================================================================== (Binary files differ) Copied: main/trunk/data/models/warning.b3d (from rev 4629, main/trunk/data/items/warning.b3d) =================================================================== (Binary files differ) Copied: main/trunk/data/models/warning.png (from rev 4629, main/trunk/data/items/warning.png) =================================================================== (Binary files differ) Deleted: main/trunk/data/plunger.projectile =================================================================== --- main/trunk/data/plunger.projectile 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/data/plunger.projectile 2010-02-07 02:05:21 UTC (rev 4648) @@ -1,21 +0,0 @@ -;; -*- mode: lisp -*- - -(tuxkart-collectable - (name "Plunger") - (model "plunger.ac") - (mesh "plunger.b3d") - (icon "plunger-icon.png") - (speed 35.0) - (min-height 0.2) ; height above terrain below which a plunger is - ; started to be pulled up - (max-height 1.0) ; height above terrain at which a plunger is - ; started to be pulled back to ground - (force-updown 35.0) ; force pushing the spark down - ; when it's too high above ground - (force-to-target 15) ; force with which a spark flies towards - ; the nearest kart - (max-distance 25) ; maximum distance the spark can be away - ; from a kart when accelerating towards it -) - -;; EOF ;; Added: main/trunk/data/powerup.xml =================================================================== --- main/trunk/data/powerup.xml (rev 0) +++ main/trunk/data/powerup.xml 2010-02-07 02:05:21 UTC (rev 4648) @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<powerup> + <item name="zipper" icon="zipper_collect.png" /> + <item name="bowling" icon="bowling-icon.png" + model="bowling.b3d" speed="4.0" + min-height="0.2" max-height="1.0" + force-updown="1" force-to-target="40" + max-distance="25" /> + <item name="bubblegum" icon="bubblegum-icon.png" /> + <item name="cake" icon="cake-icon.png" + model="cake.b3d" speed="50" + min-height="0.2" max-height="1.0" + force-updown="25" max-distance="90" /> + <item name="anchor" icon="anchor-icon.png" + model="anchor.b3d" /> + <item name="switch" icon="swap-icon.png" /> + <item name="parachute" icon="parachute.png" + model="parachute.b3d" /> + <item name="plunger" icon="plunger-icon.png" + model="plunger.b3d" speed="35" + min-height="0.2" max-height="1.0" + force-updown="35" force-to-target="15" + max-distance="25" /> +</powerup> + Modified: main/trunk/src/graphics/irr_driver.cpp =================================================================== --- main/trunk/src/graphics/irr_driver.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/graphics/irr_driver.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -327,7 +327,7 @@ material_manager->reInit(); - powerup_manager -> loadPowerups(); + powerup_manager -> loadAllPowerups(); kart_properties_manager -> loadAllKarts(); item_manager -> loadDefaultItems(); projectile_manager -> loadData(); Modified: main/trunk/src/items/bowling.cpp =================================================================== --- main/trunk/src/items/bowling.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/bowling.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -18,6 +18,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "graphics/camera.hpp" +#include "io/xml_node.hpp" #include "items/bowling.hpp" #include "karts/player_kart.hpp" @@ -69,17 +70,21 @@ } // Bowling // ----------------------------------------------------------------------------- -void Bowling::init(const lisp::Lisp* lisp, scene::IMesh *bowling) +/** Initialises this object with data from the power.xml file. + * \param node XML Node + * \param bowling The bowling ball mesh + */ +void Bowling::init(const XMLNode &node, scene::IMesh *bowling) { - Flyable::init(lisp, bowling, POWERUP_BOWLING); - m_st_max_distance = 20.0f; + Flyable::init(node, bowling, POWERUP_BOWLING); + m_st_max_distance = 20.0f; m_st_max_distance_squared = 20.0f * 20.0f; - m_st_force_to_target = 10.0f; + m_st_force_to_target = 10.0f; - lisp->get("max-distance", m_st_max_distance ); + node.get("max-distance", &m_st_max_distance ); m_st_max_distance_squared = m_st_max_distance*m_st_max_distance; - lisp->get("force-to-target", m_st_force_to_target); + node.get("force-to-target", &m_st_force_to_target); } // init // ----------------------------------------------------------------------------- Modified: main/trunk/src/items/bowling.hpp =================================================================== --- main/trunk/src/items/bowling.hpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/bowling.hpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -25,6 +25,8 @@ #include "items/flyable.hpp" +class XMLNode; + class Bowling : public Flyable { private: @@ -34,7 +36,7 @@ public: Bowling(Kart* kart); - static void init(const lisp::Lisp* lisp, scene::IMesh *bowling); + static void init(const XMLNode &node, scene::IMesh *bowling); virtual void update(float dt); int getExplosionSound() const { return SFXManager::SOUND_BOWLING_STRIKE; } Modified: main/trunk/src/items/cake.cpp =================================================================== --- main/trunk/src/items/cake.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/cake.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -24,6 +24,7 @@ #include <iostream> +#include "io/xml_node.hpp" #include "karts/kart.hpp" #include "utils/constants.hpp" @@ -114,9 +115,13 @@ } // Cake // ----------------------------------------------------------------------------- -void Cake::init(const lisp::Lisp* lisp, scene::IMesh *cake_model) +/** Initialises the object from an entry in the powerup.xml file. + * \param node The xml node for this object. + * \param cakde_model The mesh model of the cake. + */ +void Cake::init(const XMLNode &node, scene::IMesh *cake_model) { - Flyable::init(lisp, cake_model, POWERUP_CAKE); + Flyable::init(node, cake_model, POWERUP_CAKE); m_st_max_distance = 80.0f; m_st_max_distance_squared = 80.0f * 80.0f; m_gravity = 9.8f; @@ -124,8 +129,7 @@ if (m_gravity < 0) m_gravity *= -1; - - lisp->get("max-distance", m_st_max_distance ); + node.get("max-distance", &m_st_max_distance ); m_st_max_distance_squared = m_st_max_distance*m_st_max_distance; } // init Modified: main/trunk/src/items/cake.hpp =================================================================== --- main/trunk/src/items/cake.hpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/cake.hpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -27,6 +27,8 @@ #include "items/flyable.hpp" +class XMLNode; + class Cake : public Flyable { private: @@ -39,7 +41,7 @@ // projectile (NULL if none) public: Cake (Kart *kart); - static void init (const lisp::Lisp* lisp, scene::IMesh *cake_model); + static void init (const XMLNode &node, scene::IMesh *cake_model); virtual void update (float dt); virtual void hitTrack () { hit(NULL); } // Kinematic objects are not allowed to have a velocity (assertion in Modified: main/trunk/src/items/flyable.cpp =================================================================== --- main/trunk/src/items/flyable.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/flyable.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -26,6 +26,7 @@ #include "graphics/irr_driver.hpp" #include "graphics/mesh_tools.hpp" +#include "io/xml_node.hpp" #include "items/projectile_manager.hpp" #include "karts/kart.hpp" #include "modes/world.hpp" @@ -114,17 +115,17 @@ } // createPhysics // ----------------------------------------------------------------------------- -void Flyable::init(const lisp::Lisp* lisp, scene::IMesh *model, +void Flyable::init(const XMLNode &node, scene::IMesh *model, PowerupType type) { m_st_speed[type] = 25.0f; m_st_max_height[type] = 1.0f; m_st_min_height[type] = 3.0f; m_st_force_updown[type] = 15.0f; - lisp->get("speed", m_st_speed[type] ); - lisp->get("min-height", m_st_min_height[type] ); - lisp->get("max-height", m_st_max_height[type] ); - lisp->get("force-updown", m_st_force_updown[type]); + node.get("speed", &(m_st_speed[type]) ); + node.get("min-height", &(m_st_min_height[type]) ); + node.get("max-height", &(m_st_max_height[type]) ); + node.get("force-updown", &(m_st_force_updown[type])); // Store the size of the model Vec3 min, max; Modified: main/trunk/src/items/flyable.hpp =================================================================== --- main/trunk/src/items/flyable.hpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/flyable.hpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -34,6 +34,7 @@ class FlyableInfo; class Kart; class PhysicalObject; +class XMLNode; class Flyable : public Moveable, public TerrainInfo { @@ -114,7 +115,7 @@ * terrain. Missiles can 'follow the terrain' with this adjustment, * but gravity will basically be disabled. */ void setAdjustZVelocity(bool f) { m_adjust_z_velocity = f; } - static void init (const lisp::Lisp* lisp, scene::IMesh *model, + static void init (const XMLNode &node, scene::IMesh *model, PowerupType type); virtual void update (float); void updateFromServer(const FlyableInfo &f, float dt); Modified: main/trunk/src/items/item_manager.cpp =================================================================== --- main/trunk/src/items/item_manager.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/item_manager.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -98,70 +98,36 @@ //----------------------------------------------------------------------------- void ItemManager::loadDefaultItems() { - // Load all models. This can't be done in the constructor, - // since the file_manager isn't ready at that stage. - // ------------------------------------------------------- - std::set<std::string> files; - file_manager->listFiles(files, file_manager->getItemsDir(), - /*is_full_path*/true, - /*make_full_path*/true); - for(std::set<std::string>::iterator i = files.begin(); - i != files.end(); ++i) + // The names must be given in the order of the definition of ItemType + // in item.hpp. Note that bubblegum strictly isn't an item, + // it is implemented as one, and so loaded here, too. + static const std::string item_names[] = {"bonus-box", "banana", + "nitro-big", "nitro-small", + "bubblegum" }; + + const XMLNode *root = file_manager->createXMLTree("data/items.xml"); + for(unsigned int i=Item::ITEM_FIRST; i<=Item::ITEM_LAST; i++) { - if(StringUtils::getExtension(*i)!="b3d") continue; - scene::IMesh *mesh = irr_driver->getAnimatedMesh(*i); - if(!mesh) continue; - std::string shortName = StringUtils::getBasename(StringUtils::removeExtension(*i)); + const XMLNode *node = root->getNode(item_names[i]); + std::string model_filename; + if (node) + node->get("model", &model_filename); + scene::IMesh *mesh = irr_driver->getAnimatedMesh(model_filename); + if(!node || model_filename.size()==0 || !mesh) + { + fprintf(stderr, "Item model '%s' in items.xml could not be loaded - aborting", + item_names[i].c_str()); + exit(-1); + } + std::string shortName = + StringUtils::getBasename(StringUtils::removeExtension(model_filename)); m_all_meshes[shortName] = mesh; + m_item_mesh[i] = mesh; mesh->grab(); } // for i - - setDefaultItemStyle(); } // loadDefaultItems //----------------------------------------------------------------------------- -void ItemManager::setDefaultItemStyle() -{ - // FIXME - This should go in an internal, system wide configuration file - std::string DEFAULT_NAMES[Item::ITEM_LAST - Item::ITEM_FIRST +1]; - DEFAULT_NAMES[Item::ITEM_BONUS_BOX] = "gift-box"; - DEFAULT_NAMES[Item::ITEM_BANANA] = "banana"; - DEFAULT_NAMES[Item::ITEM_NITRO_BIG] = "nitrotank-big"; - DEFAULT_NAMES[Item::ITEM_NITRO_SMALL] = "nitrotank-small"; - DEFAULT_NAMES[Item::ITEM_BUBBLEGUM] = "bubblegum"; - - bool bError=0; - std::ostringstream msg; - for(int i=Item::ITEM_FIRST; i<=Item::ITEM_LAST; i++) - { - m_item_mesh[i] = m_all_meshes[DEFAULT_NAMES[i]]; - if(!m_item_mesh[i]) - { - msg << "Item model '" << DEFAULT_NAMES[i] - << "' is missing (see item_manager)!\n"; - bError=1; - break; - } // if !m_item_model - } // for i - if(bError) - { - fprintf(stderr, "The following models are available:\n"); - for(CI_type i=m_all_meshes.begin(); i!=m_all_meshes.end(); ++i) - { - if(i->second) - { - fprintf(stderr, " %s in %s.ac.\n", - i->first.c_str(), - i->first.c_str()); - } // if i->second - } - throw std::runtime_error(msg.str()); - exit(-1); - } // if bError - -} // setDefaultItemStyle - -//----------------------------------------------------------------------------- /** Creates a new item. * \param type Type of the item. * \param xyz Position of the item. @@ -225,40 +191,6 @@ delete *i; } m_all_items.clear(); - - setDefaultItemStyle(); - - // FIXME - this seems outdated - - // Then load the default style from the user_config file - // ----------------------------------------------------- - // This way if an item is not defined in the item-style-file, the - // default (i.e. old herring) is used. - try - { - // FIXME: This should go in a system-wide configuration file, - // and only one of this and the hard-coded settings in - // setDefaultItemStyle are necessary!!! - loadItemStyle(UserConfigParams::m_item_style); - } - catch(std::runtime_error) - { - fprintf(stderr,"The item style '%s' in your configuration file does not exist.\nIt is ignored.\n", - UserConfigParams::m_item_style.c_str()); - UserConfigParams::m_item_style=""; - } - - try - { - loadItemStyle(m_user_filename); - } - catch(std::runtime_error) - { - fprintf(stderr,"The item style '%s' specified on the command line does not exist.\nIt is ignored.\n", - m_user_filename.c_str()); - m_user_filename=""; // reset to avoid further warnings. - } - } // cleanup //----------------------------------------------------------------------------- @@ -289,44 +221,6 @@ } // reset //----------------------------------------------------------------------------- -/** Sets the selected item style to be used in the track. The style depends on - * either the GP or the track selected. - */ -void ItemManager::setStyle() -{ - if(race_manager->getMajorMode()== RaceManager::MAJOR_MODE_GRAND_PRIX) - { - try - { - item_manager->loadItemStyle(race_manager->getItemStyle()); - } - catch(std::runtime_error) - { - fprintf(stderr, "The grand prix '%ls' contains an invalid item style '%s'.\n", - race_manager->getGrandPrix()->getName().c_str(), - race_manager->getItemStyle().c_str()); - fprintf(stderr, "Please fix the file 'l%s'.\n", - race_manager->getGrandPrix()->getFilename().c_str()); - } - } - else - { - try - { - item_manager->loadItemStyle(RaceManager::getTrack()->getItemStyle()); - } - catch(std::runtime_error) - { - fprintf(stderr, "The track '%ls' contains an invalid item style '%s'.\n", - RaceManager::getTrack()->getName().c_str(), - RaceManager::getTrack()->getItemStyle().c_str()); - fprintf(stderr, "Please fix the file '%s'.\n", - RaceManager::getTrack()->getFilename().c_str()); - } - } -} // setStyle - -//----------------------------------------------------------------------------- void ItemManager::update(float dt) { // If switch time is over, switch all items back @@ -365,40 +259,18 @@ (*i)->switchTo(new_type, m_item_mesh[(int)new_type]); // FIXME: if switch is used while items are switched: // switch back - but that doesn't work properly yet - //else - // (*i)->switchBack(); + else + (*i)->switchBack(); } // for m_all_items - m_switch_time = stk_config->m_item_switch_time; + // if the items are already switched (m_switch_time >=0) + // then switch back, and set m_switch_time to -1 to indicate + // that the items are now back to normal. + m_switch_time = m_switch_time < 0 ? stk_config->m_item_switch_time : -1; } // switchItems //----------------------------------------------------------------------------- -void ItemManager::loadItemStyle(const std::string filename) -{ - if(filename.length()==0) return; - const lisp::Lisp* root = 0; - lisp::Parser parser; - - root = parser.parse(file_manager->getConfigFile(filename + ".items")); - - const lisp::Lisp* item_node = root->getLisp("item"); - if(!item_node) - { - std::ostringstream msg; - msg << "Couldn't load map '" << filename << "': no item node."; - delete root; - throw std::runtime_error(msg.str()); - delete root; - } - setItem(item_node, "red", Item::ITEM_BONUS_BOX ); - setItem(item_node, "green", Item::ITEM_BANANA ); - setItem(item_node, "gold" ,Item::ITEM_NITRO_BIG ); - setItem(item_node, "silver",Item::ITEM_NITRO_SMALL); - delete root; -} // loadItemStyle - -//----------------------------------------------------------------------------- void ItemManager::setItem(const lisp::Lisp *item_node, const char *colour, Item::ItemType type) { Modified: main/trunk/src/items/item_manager.hpp =================================================================== --- main/trunk/src/items/item_manager.hpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/item_manager.hpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -44,16 +44,15 @@ std::string m_user_filename; - /** Remaining time that items should remain switched. */ + /** Remaining time that items should remain switched. If the + * value is <0, it indicates that the items are not switched atm. */ float m_switch_time; /** What item is item is switched to. */ std::vector<Item::ItemType> m_switch_to; - void setDefaultItemStyle(); void setItem(const lisp::Lisp *item_node, const char *colour, Item::ItemType type); - void loadItemStyle (const std::string filename); public: ItemManager(); @@ -71,7 +70,6 @@ int add_info=-1); void switchItems (); void setSwitchItems(const std::vector<int> &switch_items); - void setStyle (); scene::IMesh* getItemModel (Item::ItemType type) {return m_item_mesh[type];} scene::IMesh* getOtherModel (const std::string modelName) Modified: main/trunk/src/items/plunger.cpp =================================================================== --- main/trunk/src/items/plunger.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/plunger.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -23,6 +23,7 @@ #include "items/plunger.hpp" #include "graphics/irr_driver.hpp" +#include "io/xml_node.hpp" #include "items/rubber_band.hpp" #include "items/projectile_manager.hpp" #include "karts/player_kart.hpp" @@ -107,9 +108,9 @@ } // ~Plunger // ----------------------------------------------------------------------------- -void Plunger::init(const lisp::Lisp* lisp, scene::IMesh *plunger_model) +void Plunger::init(const XMLNode &node, scene::IMesh *plunger_model) { - Flyable::init(lisp, plunger_model, POWERUP_PLUNGER); + Flyable::init(node, plunger_model, POWERUP_PLUNGER); } // init // ----------------------------------------------------------------------------- Modified: main/trunk/src/items/plunger.hpp =================================================================== --- main/trunk/src/items/plunger.hpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/plunger.hpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -27,9 +27,10 @@ using namespace irr; #include "items/flyable.hpp" -class RubberBand; class Kart; class PhysicalObject; +class RubberBand; +class XMLNode; class Plunger : public Flyable { @@ -44,7 +45,7 @@ public: Plunger(Kart *kart); ~Plunger(); - static void init(const lisp::Lisp* lisp, scene::IMesh* missile); + static void init(const XMLNode &node, scene::IMesh* missile); /** Sets the keep-alive value. Setting it to 0 will remove the plunger * at the next update - which is used if the rubber band snaps. */ Modified: main/trunk/src/items/powerup_manager.cpp =================================================================== --- main/trunk/src/items/powerup_manager.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/powerup_manager.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -27,31 +27,11 @@ #include "graphics/material.hpp" #include "graphics/material_manager.hpp" #include "io/file_manager.hpp" +#include "io/xml_node.hpp" #include "items/bowling.hpp" #include "items/cake.hpp" #include "items/plunger.hpp" - -typedef struct -{ - PowerupType powerup; - const char*const dataFile; -} -initPowerupType; - -initPowerupType ict[]= -{ - {POWERUP_ZIPPER, "zipper.collectable" }, - {POWERUP_BOWLING, "bowling.projectile" }, - {POWERUP_BUBBLEGUM, "bubblegum.xml" }, - {POWERUP_CAKE, "cake.projectile" }, - {POWERUP_ANVIL, "anvil.collectable" }, - {POWERUP_SWITCH, "switch.collectable" }, - {POWERUP_PARACHUTE, "parachute.collectable" }, - {POWERUP_PLUNGER, "plunger.projectile" }, - {POWERUP_MAX, "" }, -}; - PowerupManager* powerup_manager=0; //----------------------------------------------------------------------------- @@ -65,82 +45,95 @@ } // PowerupManager //----------------------------------------------------------------------------- +PowerupManager::~PowerupManager() +{ + for(unsigned int i=POWERUP_FIRST; i<=POWERUP_LAST; i++) + { + m_all_meshes[(PowerupType)i]->drop(); + } + +} // ~PowerupManager + +//----------------------------------------------------------------------------- void PowerupManager::removeTextures() { } // removeTextures //----------------------------------------------------------------------------- -/** Loads all projectiles from the powerup.xml file. +/** Determines the powerup type for a given name. + * \param name Name of the powerup to look up. + * \return The type, or POWERUP_NOTHING if the name is not found */ -void PowerupManager::loadPowerups() +PowerupType PowerupManager::getPowerupType(const std::string &name) { - for(int i=0; ict[i].powerup != POWERUP_MAX; i++) + // Must match the order of PowerupType in powerup_manager.hpp!! + static std::string powerup_names[] = { + "", /* Nothing */ + "bubblegum", "cake", "bowling", "zipper", "plunger", "switch", + "parachute", "anchor" + }; + + for(unsigned int i=POWERUP_FIRST; i<=POWERUP_LAST; i++) { - Load(ict[i].powerup, ict[i].dataFile); + if(powerup_names[i]==name) return(PowerupType)i; } -} // loadPowerups + return POWERUP_NOTHING; +} // getPowerupType //----------------------------------------------------------------------------- -void PowerupManager::Load(int collectType, const char* filename) +/** Loads all projectiles from the powerup.xml file. + */ +void PowerupManager::loadAllPowerups() { - const lisp::Lisp* ROOT = 0; - - lisp::Parser parser; - std::string tmp= "data/" + (std::string)filename; - ROOT = parser.parse(file_manager->getConfigFile(filename)); - - const lisp::Lisp* lisp = ROOT->getLisp("tuxkart-collectable"); - if(!lisp) + XMLNode *root = file_manager->createXMLTree("data/powerup.xml"); + for(unsigned int i=0; i<root->getNumNodes(); i++) { - std::ostringstream msg; - msg << "No 'tuxkart-collectable' node found while parsing '" - << filename << "'."; - throw std::runtime_error(msg.str()); + const XMLNode *node=root->getNode(i); + std::string name; + node->get("name", &name); + PowerupType type = getPowerupType(name); + LoadPowerup(type, *node); } - LoadNode(lisp, collectType); +} // loadAllPowerups - delete ROOT; - -} // Load - //----------------------------------------------------------------------------- -void PowerupManager::LoadNode(const lisp::Lisp* lisp, int collectType ) +void PowerupManager::LoadPowerup(PowerupType type, const XMLNode &node) { - std::string sName, sModel, sIconFile; - lisp->get("name", sName ); - lisp->get("mesh", sModel ); - lisp->get("icon", sIconFile ); - // load material - m_all_icons[collectType] = material_manager->getMaterial(sIconFile, - /* full_path */ false, - /*make_permanent */ true); - if(sModel!="") + std::string icon_file(""); + node.get("icon", &icon_file); + m_all_icons[type] = material_manager->getMaterial(icon_file, + /* full_path */ false, + /*make_permanent */ true); + + + std::string model(""); + node.get("model", &model); + if(model.size()>0) { // FIXME LEAK: not freed (unimportant, since the models have to exist // for the whole game anyway). - std::string full_path = file_manager->getModelFile(sModel); - m_all_meshes[collectType] = irr_driver->getMesh(full_path); + std::string full_path = file_manager->getModelFile(model); + m_all_meshes[type] = irr_driver->getMesh(full_path); + if(!m_all_meshes[type]) + { + std::ostringstream o; + o<<"Can't load model '"<<model<<"' for powerup type '"<<type<<"', aborting."; + throw std::runtime_error(o.str()); + } } else { - m_all_meshes[collectType] = 0; - m_all_extends[collectType] = btVector3(0.0f,0.0f,0.0f); + m_all_meshes[type] = 0; + m_all_extends[type] = btVector3(0.0f,0.0f,0.0f); } - if(!m_all_meshes[collectType]) - { - std::ostringstream o; - o<<"Can't load model '"<<sModel<<"' for '"<<sName<<"', aborting."; - throw std::runtime_error(o.str()); - } // Load special attributes for certain powerups - switch (collectType) { + switch (type) { case POWERUP_BOWLING: - Bowling::init(lisp, m_all_meshes[collectType]); break; + Bowling::init(node, m_all_meshes[type]); break; case POWERUP_PLUNGER: - Plunger::init(lisp, m_all_meshes[collectType]); break; + Plunger::init(node, m_all_meshes[type]); break; case POWERUP_CAKE: - Cake::init(lisp, m_all_meshes[collectType]); break; + Cake::init(node, m_all_meshes[type]); break; default:; } // switch } // LoadNode - Modified: main/trunk/src/items/powerup_manager.hpp =================================================================== --- main/trunk/src/items/powerup_manager.hpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/items/powerup_manager.hpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -27,19 +27,24 @@ #include "btBulletDynamicsCommon.h" class Material; +class XMLNode; // The anvil and parachute must be at the end of the enum, and the // zipper just before them (see Powerup::hitBonusBox). enum PowerupType {POWERUP_NOTHING, - POWERUP_BUBBLEGUM, POWERUP_CAKE, + POWERUP_FIRST, + POWERUP_BUBBLEGUM = POWERUP_FIRST, + POWERUP_CAKE, POWERUP_BOWLING, POWERUP_ZIPPER, POWERUP_PLUNGER, POWERUP_SWITCH, - POWERUP_PARACHUTE, POWERUP_ANVIL, //powerup.cpp assumes these two come last + POWERUP_PARACHUTE, + POWERUP_ANVIL, //powerup.cpp assumes these two come last + POWERUP_LAST=POWERUP_ANVIL, POWERUP_MAX}; class PowerupManager { -protected: +private: Material* m_all_icons [POWERUP_MAX]; float m_all_max_distance[POWERUP_MAX]; // if a target is closer than this float m_all_force_to_target[POWERUP_MAX]; // apply this force to move towards @@ -48,11 +53,13 @@ scene::IMesh *m_all_meshes[POWERUP_MAX]; btVector3 m_all_extends[POWERUP_MAX]; void LoadNode (const lisp::Lisp* lisp, int collectType); + PowerupType getPowerupType(const std::string &name); public: - PowerupManager (); - void loadPowerups(); + PowerupManager (); + ~PowerupManager (); + void loadAllPowerups (); void removeTextures (); - void Load (int collectType, const char* filename); + void LoadPowerup (PowerupType type, const XMLNode &node); Material* getIcon (int type) const {return m_all_icons [type]; } /** Returns the mesh for a certain powerup. * \param type Mesh type for which the model is returned. */ Modified: main/trunk/src/main.cpp =================================================================== --- main/trunk/src/main.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/main.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -613,7 +613,7 @@ kart_properties_manager -> loadAllKarts (); unlock_manager = new UnlockManager(); projectile_manager -> loadData (); - powerup_manager -> loadPowerups (); + powerup_manager -> loadAllPowerups (); item_manager -> loadDefaultItems(); attachment_manager -> loadModels (); Modified: main/trunk/src/tracks/track.cpp =================================================================== --- main/trunk/src/tracks/track.cpp 2010-02-06 23:45:27 UTC (rev 4647) +++ main/trunk/src/tracks/track.cpp 2010-02-07 02:05:21 UTC (rev 4648) @@ -617,7 +617,6 @@ m_has_final_camera = false; m_is_arena = false; m_track_object_manager = new TrackObjectManager(); - item_manager->setStyle(); // Load the graph only now: this function is called from world, after // the race gui was created. The race gui is needed since it stores This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-02-07 08:49:43
|
Revision: 4657 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4657&view=rev Author: hikerstk Date: 2010-02-07 08:49:36 +0000 (Sun, 07 Feb 2010) Log Message: ----------- 1) Removed bubblegum as a separate object, instead bubblegums are now created as normal items. 2) Now bubblebum can be used in swapping as well, so all nitro become bubblegums, and all bubblegums become items. Modified Paths: -------------- main/trunk/data/stk_config.xml main/trunk/src/Makefile.am main/trunk/src/ide/vc9/supertuxkart.vcproj main/trunk/src/input/input_manager.cpp main/trunk/src/items/item.cpp main/trunk/src/items/item.hpp main/trunk/src/items/item_manager.cpp Removed Paths: ------------- main/trunk/src/items/bubblegumitem.cpp main/trunk/src/items/bubblegumitem.hpp Modified: main/trunk/data/stk_config.xml =================================================================== --- main/trunk/data/stk_config.xml 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/data/stk_config.xml 2010-02-07 08:49:36 UTC (rev 4657) @@ -72,7 +72,7 @@ zipper-speed-gain is the one time additional speed item-switch-time How long a switch is being effective. switch-items for each item list the index of the item it is switched with. - Order: item, banana, big-nitro, small-nitro + Order: item, banana, big-nitro, small-nitro, bubble-bum --> <attachment-parameters @@ -91,7 +91,7 @@ zipper-speed-gain="4.5" zipper-max-speed-fraction="2.0" item-switch-time="5" - switch-items="1 0 1 1 4" + switch-items="1 0 4 4 0" /> <!-- GENERAL KART DEFAULTS Modified: main/trunk/src/Makefile.am =================================================================== --- main/trunk/src/Makefile.am 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/src/Makefile.am 2010-02-07 08:49:36 UTC (rev 4657) @@ -132,8 +132,6 @@ items/attachment_manager.hpp \ items/bowling.cpp \ items/bowling.hpp \ - items/bubblegumitem.cpp \ - items/bubblegumitem.hpp \ items/cake.cpp \ items/cake.hpp \ items/flyable.cpp \ Modified: main/trunk/src/ide/vc9/supertuxkart.vcproj =================================================================== --- main/trunk/src/ide/vc9/supertuxkart.vcproj 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/src/ide/vc9/supertuxkart.vcproj 2010-02-07 08:49:36 UTC (rev 4657) @@ -605,10 +605,6 @@ > </File> <File - RelativePath="..\..\items\bubblegumitem.cpp" - > - </File> - <File RelativePath="..\..\items\cake.cpp" > </File> @@ -1427,10 +1423,6 @@ > </File> <File - RelativePath="..\..\items\bubblegumitem.hpp" - > - </File> - <File RelativePath="..\..\items\cake.hpp" > </File> Modified: main/trunk/src/input/input_manager.cpp =================================================================== --- main/trunk/src/input/input_manager.cpp 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/src/input/input_manager.cpp 2010-02-07 08:49:36 UTC (rev 4657) @@ -103,7 +103,7 @@ if (race_manager->getNumPlayers() ==1 ) { Kart* kart = RaceManager::getWorld()->getLocalPlayerKart(0); - kart->setPowerup(POWERUP_BOWLING, 10000); + kart->setPowerup(POWERUP_BUBBLEGUM, 10000); projectile_manager->newExplosion(Vec3(0, 8, 0.5)); } break; Deleted: main/trunk/src/items/bubblegumitem.cpp =================================================================== --- main/trunk/src/items/bubblegumitem.cpp 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/src/items/bubblegumitem.cpp 2010-02-07 08:49:36 UTC (rev 4657) @@ -1,45 +0,0 @@ -// $Id: item.cpp 2405 2008-10-31 20:48:19Z auria $ -// -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2004 Steve Baker <sjb...@ai...> -// -// 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, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#include "items/bubblegumitem.hpp" - -BubbleGumItem::BubbleGumItem(ItemType type, const Vec3& xyz, const Vec3 &normal, - scene::IMesh* mesh, unsigned int item_id) - : Item(type, xyz, normal, mesh, item_id, - /* rotate */ false) -{ -} // BubbleGumItem - -//----------------------------------------------------------------------------- -BubbleGumItem::~BubbleGumItem() -{ -} // ~BubbleGumItem - -//----------------------------------------------------------------------------- -/** Is called when the item is hit by a kart. The bubble gum item then - * inactivates itself for 0.5 seconds, but disables the reappearing of - * the bubble gum. - */ -void BubbleGumItem::collected(float t) -{ - deactivate(0.5); - // Set the time till reappear to -1 seconds --> the item will - // reappear immediately. - Item::collected(-1); -} // isCollected Deleted: main/trunk/src/items/bubblegumitem.hpp =================================================================== --- main/trunk/src/items/bubblegumitem.hpp 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/src/items/bubblegumitem.hpp 2010-02-07 08:49:36 UTC (rev 4657) @@ -1,37 +0,0 @@ -// $Id: item.hpp 2405 2008-10-31 20:48:19Z auria $ -// -// SuperTuxKart - a fun racing game with go-kart -// Copyright (C) 2004 Steve Baker <sjb...@ai...> -// -// 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, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#ifndef HEADER_BUBBLEGUMITEM_HPP -#define HEADER_BUBBLEGUMITEM_HPP - -#include "items/item.hpp" - -// ----------------------------------------------------------------------------- -class BubbleGumItem : public Item -{ -public: - BubbleGumItem(ItemType type, const Vec3& xyz, - const Vec3 &normal, scene::IMesh* mesh, - unsigned int item_id); - ~BubbleGumItem (); - virtual void collected(float t); -} -; // class Item - -#endif Modified: main/trunk/src/items/item.cpp =================================================================== --- main/trunk/src/items/item.cpp 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/src/items/item.cpp 2010-02-07 08:49:36 UTC (rev 4657) @@ -26,9 +26,9 @@ #include "utils/vec3.hpp" Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal, - scene::IMesh* mesh, unsigned int item_id, bool rotate) + scene::IMesh* mesh, unsigned int item_id) { - m_rotate = rotate; + setType(type); m_event_handler = NULL; m_deactive_time = 0; m_normal = normal; @@ -36,7 +36,6 @@ Vec3 hpr = Vec3(0, normal); m_coord = Coord(xyz, hpr); m_item_id = item_id; - m_type = type; m_original_type = ITEM_NONE; m_collected = false; m_time_till_return = 0.0f; // not strictly necessary, see isCollected() @@ -47,6 +46,17 @@ } // Item //----------------------------------------------------------------------------- +/** Sets the type of this item, but also derived values, e.g. m_rotate. + * (bubblegums do not return). + * \param type New type of the item. + */ +void Item::setType(ItemType type) +{ + m_type = type; + m_rotate = type!=ITEM_BUBBLEGUM; +} // setType + +//----------------------------------------------------------------------------- /** Changes this item to be a new type for a certain amount of time. * \param type New type of this item. * \param mesh Mesh to use to display this item. @@ -54,7 +64,7 @@ void Item::switchTo(ItemType type, scene::IMesh *mesh) { m_original_type = m_type; - m_type = type; + setType(type); m_node->setMesh(mesh); } // switchTo @@ -64,7 +74,7 @@ void Item::switchBack() { assert(m_original_type!=ITEM_NONE); - m_type = m_original_type; + setType(m_original_type); m_original_type = ITEM_NONE; m_node->setMesh(m_original_mesh); } // switchBack @@ -88,7 +98,7 @@ m_deactive_time = 0.0f; if(m_original_type!=ITEM_NONE) { - m_type = m_original_type; + setType(m_original_type); m_original_type = ITEM_NONE; } } // reset @@ -102,7 +112,7 @@ { m_event_handler = parent; m_deactive_time = 1.5f; -} +} // setParent //----------------------------------------------------------------------------- /** Updated the item - rotates it, takes care of items coming back into @@ -111,7 +121,7 @@ */ void Item::update(float dt) { - if(m_event_handler != NULL && m_deactive_time > 0) m_deactive_time -= dt; + if(m_deactive_time > 0) m_deactive_time -= dt; if(m_collected) { @@ -161,9 +171,20 @@ */ void Item::collected(float t) { - m_collected = true; - // Note if the time is negative, in update the m_collected flag will - // be automatically set to false again. - m_time_till_return = t; + m_collected = true; + if(m_type==ITEM_BUBBLEGUM) + { + deactivate(0.5); + // Set the time till reappear to -1 seconds --> the item will + // reappear immediately. + m_time_till_return = -1; + + } + else + { + // Note if the time is negative, in update the m_collected flag will + // be automatically set to false again. + m_time_till_return = t; + } } // isCollected Modified: main/trunk/src/items/item.hpp =================================================================== --- main/trunk/src/items/item.hpp 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/src/items/item.hpp 2010-02-07 08:49:36 UTC (rev 4657) @@ -84,10 +84,10 @@ deactivate collision so a kart is not hit by its own item */ float m_deactive_time; + void setType(ItemType type); public: Item (ItemType type, const Vec3& xyz, const Vec3& normal, - scene::IMesh* mesh, unsigned int item_id, - bool rotate=true); + scene::IMesh* mesh, unsigned int item_id); virtual ~Item (); void update (float delta); virtual void collected(float t=2.0f); Modified: main/trunk/src/items/item_manager.cpp =================================================================== --- main/trunk/src/items/item_manager.cpp 2010-02-07 03:59:03 UTC (rev 4656) +++ main/trunk/src/items/item_manager.cpp 2010-02-07 08:49:36 UTC (rev 4657) @@ -29,7 +29,6 @@ #include "graphics/material.hpp" #include "graphics/material_manager.hpp" #include "io/file_manager.hpp" -#include "items/bubblegumitem.hpp" #include "karts/kart.hpp" #include "network/network_manager.hpp" #include "tracks/track.hpp" @@ -143,12 +142,7 @@ const Vec3 &normal, Kart *parent) { Item* h; - if(type == Item::ITEM_BUBBLEGUM) - h = new BubbleGumItem(type, xyz, normal, m_item_mesh[type], - m_all_items.size()); - else - h = new Item(type, xyz, normal, m_item_mesh[type], - m_all_items.size()); + h = new Item(type, xyz, normal, m_item_mesh[type], m_all_items.size()); if(parent != NULL) h->setParent(parent); m_all_items.push_back(h); @@ -209,7 +203,7 @@ { if((*i)->getType()==Item::ITEM_BUBBLEGUM) { - BubbleGumItem *b=static_cast<BubbleGumItem*>(*i); + Item *b=*i; AllItemTypes::iterator i_next = m_all_items.erase(i); delete b; i = i_next; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mbj...@us...> - 2010-02-07 21:14:15
|
Revision: 4662 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4662&view=rev Author: mbjornstk Date: 2010-02-07 21:14:08 +0000 (Sun, 07 Feb 2010) Log Message: ----------- Add bubblegum to cheats (F5) and make real gum become small nitro on swap. Modified Paths: -------------- main/trunk/data/stk_config.xml main/trunk/src/input/input_manager.cpp Modified: main/trunk/data/stk_config.xml =================================================================== --- main/trunk/data/stk_config.xml 2010-02-07 16:16:12 UTC (rev 4661) +++ main/trunk/data/stk_config.xml 2010-02-07 21:14:08 UTC (rev 4662) @@ -91,7 +91,7 @@ zipper-speed-gain="4.5" zipper-max-speed-fraction="2.0" item-switch-time="5" - switch-items="1 0 4 4 0" + switch-items="1 0 4 4 3" /> <!-- GENERAL KART DEFAULTS Modified: main/trunk/src/input/input_manager.cpp =================================================================== --- main/trunk/src/input/input_manager.cpp 2010-02-07 16:16:12 UTC (rev 4661) +++ main/trunk/src/input/input_manager.cpp 2010-02-07 21:14:08 UTC (rev 4662) @@ -135,6 +135,13 @@ if(value && control_is_pressed) UserConfigParams::m_bullet_debug = !UserConfigParams::m_bullet_debug; break; + case KEY_F5: + if (race_manager->getNumPlayers() ==1 ) + { + Kart* kart = RaceManager::getPlayerKart(0); + kart->setPowerup(POWERUP_BUBBLEGUM, 10000); + } + break; #endif case KEY_F12: UserConfigParams::m_display_fps = !UserConfigParams::m_display_fps; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-12 01:48:58
|
Revision: 4688 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4688&view=rev Author: auria Date: 2010-02-12 01:48:47 +0000 (Fri, 12 Feb 2010) Log Message: ----------- Initial work towards STK adding GPs to the selection screen Modified Paths: -------------- main/trunk/data/gui/tracks.stkgui main/trunk/src/states_screens/tracks_screen.cpp Modified: main/trunk/data/gui/tracks.stkgui =================================================================== --- main/trunk/data/gui/tracks.stkgui 2010-02-11 20:55:33 UTC (rev 4687) +++ main/trunk/data/gui/tracks.stkgui 2010-02-12 01:48:47 UTC (rev 4688) @@ -5,12 +5,9 @@ <header width="100%" I18N="Section in track selection screen" text="Grand Prix" align="center" text_align="center" /> - <buttonbar id="gps" height="175" width="100%" align="center" square_items="true"> - <icon-button id="gp1" width="171" height="128" icon="gui/track_random.png" text="Penguin Playground"/> - <icon-button id="gp2" width="171" height="128" icon="gui/track_random.png" text="Snag Drive"/> - <icon-button id="gp3" width="171" height="128" icon="gui/track_random.png" text="To the Moon and Back"/> - <icon-button id="gp4" width="171" height="128" icon="gui/track_random.png" text="At World's End"/> - </buttonbar> + <scrollable_toolbar id="gps" height="175" width="100%" align="center" label_location="each" + square_items="true" align="center" + child_width="128" child_height="128" /> <header width="100%" I18N="Section in track selection screen" text="All Tracks" align="center" text_align="center" /> Modified: main/trunk/src/states_screens/tracks_screen.cpp =================================================================== --- main/trunk/src/states_screens/tracks_screen.cpp 2010-02-11 20:55:33 UTC (rev 4687) +++ main/trunk/src/states_screens/tracks_screen.cpp 2010-02-12 01:48:47 UTC (rev 4688) @@ -18,6 +18,8 @@ #include "challenges/unlock_manager.hpp" #include "guiengine/widget.hpp" #include "io/file_manager.hpp" +#include "race/grand_prix_data.hpp" +#include "race/grand_prix_manager.hpp" #include "states_screens/state_manager.hpp" #include "states_screens/tracks_screen.hpp" #include "states_screens/dialogs/track_info_dialog.hpp" @@ -95,74 +97,70 @@ } else if (name == "gps") { - RibbonWidget* w = dynamic_cast<RibbonWidget*>(widget); - if(w != NULL) - std::cout << "Clicked on GrandPrix " << w->getSelectionIDString(GUI_PLAYER_ID).c_str() << std::endl; + RibbonWidget* tracks_widget = dynamic_cast<RibbonWidget*>(widget); + if(tracks_widget != NULL) + std::cout << "Clicked on GrandPrix " << tracks_widget->getSelectionIDString(GUI_PLAYER_ID).c_str() << std::endl; } } void TracksScreen::init() { - DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks"); - assert( w != NULL ); + DynamicRibbonWidget* gps_widget = this->getWidget<DynamicRibbonWidget>("gps"); + assert( gps_widget != NULL ); + DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks"); + assert( tracks_widget != NULL ); + RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups"); assert( tabs != NULL ); + + // Reset GP list everytime (accounts for locking changes, etc.) + gps_widget->clearItems(); - /* - tracks->m_children.clearAndDeleteAll(); + // Build GP list + const int gpAmount = grand_prix_manager->getNumberOfGrandPrix(); + for (int n=0; n<gpAmount; n++) + { + const GrandPrixData* gp = grand_prix_manager->getGrandPrix(n); + std::cout << "Got GP : " << gp->getId() << std::endl; + + std::vector<std::string> tracks = gp->getTracks(); + + // TODO: use actual screenshots + if (unlock_manager->isLocked(gp->getId())) + { + gps_widget->addItem( _("Locked : solve active challenges to gain access to more!"), "locked", "gui/main_help.png", true ); + } + else + { + gps_widget->addItem( gp->getName(), gp->getId(), "gui/main_help.png", false ); + } + } + gps_widget->updateItemDisplay(); - ButtonWidget* item1 = new ButtonWidget(); - item1->m_text = _("Standard"); - item1->m_proeprties[PROP_ID] = "stdtracks"; - tracks->m_children.push_back(item1); + // Reset track list everytime (accounts for locking changes, etc.) + tracks_widget->clearItems(); - ButtonWidget* item2 = new ButtonWidget(); - item2->m_text = _("Add-Ons"); - item2->m_proeprties[PROP_ID] = "addontracks"; - tracks->m_children.push_back(item2); -*/ - //tabs->clearItems(); - //tabs->addItem( _("Standard"), "stdtracks", "" /* image */); - //tabs->addItem( _("Add-Ons"), "stdtracks", "" /* image */); - //tabs->addItem( _("Special"), "stdtracks", "" /* image */); - //tabs->updateItemDisplay(); - - // Re-build track list everytime (accounts for locking changes, etc.) - w->clearItems(); - + // Build track list const int trackAmount = track_manager->getNumberOfTracks(); - //bool hasLockedTracks = false; for (int n=0; n<trackAmount; n++) { Track* curr = track_manager->getTrack(n); if (curr->isArena()) continue; - /* if (unlock_manager->isLocked(curr->getIdent())) { - hasLockedTracks = true; - continue; + tracks_widget->addItem( _("Locked : solve active challenges to gain access to more!"), "locked", curr->getScreenshotFile(), true ); } - */ - if (unlock_manager->isLocked(curr->getIdent())) - { - w->addItem( _("Locked : solve active challenges to gain access to more!"), "locked", curr->getScreenshotFile(), true ); - } else { - w->addItem( curr->getName(), curr->getIdent(), curr->getScreenshotFile(), false ); + tracks_widget->addItem( curr->getName(), curr->getIdent(), curr->getScreenshotFile(), false ); } } - w->addItem(_("Random Track"), "random_track", "/gui/track_random.png"); -/* - if (hasLockedTracks) - { - w->addItem(_("Locked Tracks"), "Lock", "textures/gui_lock.png"); - } - */ - w->updateItemDisplay(); + tracks_widget->addItem(_("Random Track"), "random_track", "/gui/track_random.png"); + + tracks_widget->updateItemDisplay(); } void TracksScreen::tearDown() @@ -171,9 +169,9 @@ void TracksScreen::setFocusOnTrack(const std::string& trackName) { - DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks"); - assert( w != NULL ); + DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks"); + assert( tracks_widget != NULL ); // FIXME: don't hardcode player 0? - w->setSelection(trackName, 0, true); + tracks_widget->setSelection(trackName, 0, true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-12 17:45:18
|
Revision: 4692 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4692&view=rev Author: auria Date: 2010-02-12 17:45:10 +0000 (Fri, 12 Feb 2010) Log Message: ----------- Max number of rows in a ribbon grid is no more hardcoded, can now be specified ion XML. Modified Paths: -------------- main/trunk/data/gui/karts.stkgui main/trunk/data/gui/tracks.stkgui main/trunk/src/guiengine/engine.hpp main/trunk/src/guiengine/screen_loader.cpp main/trunk/src/guiengine/widget.hpp main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.cpp main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.hpp Modified: main/trunk/data/gui/karts.stkgui =================================================================== --- main/trunk/data/gui/karts.stkgui 2010-02-12 12:29:33 UTC (rev 4691) +++ main/trunk/data/gui/karts.stkgui 2010-02-12 17:45:10 UTC (rev 4692) @@ -20,7 +20,7 @@ <box proportion="2" width="100%" layout="vertical-row"> <ribbon_grid id="karts" proportion="1" square_items="true" width="100%" align="center" - child_width="80" child_height="80"/> + child_width="80" child_height="80" max_rows="3"/> </box> <!-- Groups will be added dynamically at runtime --> Modified: main/trunk/data/gui/tracks.stkgui =================================================================== --- main/trunk/data/gui/tracks.stkgui 2010-02-12 12:29:33 UTC (rev 4691) +++ main/trunk/data/gui/tracks.stkgui 2010-02-12 17:45:10 UTC (rev 4692) @@ -14,7 +14,8 @@ <box proportion="1" width="100%" layout="vertical-row"> <ribbon_grid id="tracks" proportion="1" width="100%" square_items="true" - label_location="bottom" align="center" child_width="160" child_height="120" /> + label_location="bottom" align="center" max_rows="4" + child_width="160" child_height="120" /> <spacer width="20" height="13" /> </box> Modified: main/trunk/src/guiengine/engine.hpp =================================================================== --- main/trunk/src/guiengine/engine.hpp 2010-02-12 12:29:33 UTC (rev 4691) +++ main/trunk/src/guiengine/engine.hpp 2010-02-12 17:45:10 UTC (rev 4692) @@ -198,6 +198,9 @@ (if ommitted, "none" is the default). "each" means that every item has its own label. "bottom" means there is a single label for all at the bottom, that displays the name of the current item. +PROP_MAX_ROWS "max_rows" +Currently used for ribbon grids only. Indicates the maximum amount of rows this ribbon can have. + +--------------------------+ + Using the Engine in Code + +--------------------------+ Modified: main/trunk/src/guiengine/screen_loader.cpp =================================================================== --- main/trunk/src/guiengine/screen_loader.cpp 2010-02-12 12:29:33 UTC (rev 4691) +++ main/trunk/src/guiengine/screen_loader.cpp 2010-02-12 17:45:10 UTC (rev 4692) @@ -130,15 +130,15 @@ } else if (!strcmp("ribbon_grid", xml->getNodeName())) { - append_to.push_back(new DynamicRibbonWidget()); + append_to.push_back(new DynamicRibbonWidget(false /* combo */, true /* multi-row */)); } else if (!strcmp("scrollable_ribbon", xml->getNodeName())) { - append_to.push_back(new DynamicRibbonWidget(true, 1)); + append_to.push_back(new DynamicRibbonWidget(true /* combo */, false /* multi-row */)); } else if (!strcmp("scrollable_toolbar", xml->getNodeName())) { - append_to.push_back(new DynamicRibbonWidget(false, 1)); + append_to.push_back(new DynamicRibbonWidget(false /* combo */, false /* multi-row */)); } else if (!strcmp("model", xml->getNodeName())) { @@ -185,6 +185,7 @@ READ_PROPERTY(max_height, PROP_MAX_HEIGHT); READ_PROPERTY(extend_label, PROP_EXTEND_LABEL); READ_PROPERTY(label_location, PROP_LABELS_LOCATION); + READ_PROPERTY(max_rows, PROP_MAX_ROWS); #undef READ_PROPERTY const char* text = xml->getAttributeValue( "text" ); Modified: main/trunk/src/guiengine/widget.hpp =================================================================== --- main/trunk/src/guiengine/widget.hpp 2010-02-12 12:29:33 UTC (rev 4691) +++ main/trunk/src/guiengine/widget.hpp 2010-02-12 17:45:10 UTC (rev 4692) @@ -79,7 +79,8 @@ PROP_MAX_HEIGHT, PROP_SQUARE, PROP_EXTEND_LABEL, - PROP_LABELS_LOCATION + PROP_LABELS_LOCATION, + PROP_MAX_ROWS }; bool isWithinATextBox(); Modified: main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.cpp =================================================================== --- main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.cpp 2010-02-12 12:29:33 UTC (rev 4691) +++ main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.cpp 2010-02-12 17:45:10 UTC (rev 4692) @@ -34,21 +34,20 @@ const char* NO_ITEM_ID = "?"; } -DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const int max_rows) +DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row) { - m_scroll_offset = 0; - m_needed_cols = 0; - m_col_amount = 0; - m_has_label = false; + m_scroll_offset = 0; + m_needed_cols = 0; + m_col_amount = 0; m_previous_item_count = 0; + m_multi_row = multi_row; + m_combo = combo; + m_has_label = false; + m_left_widget = NULL; + m_right_widget = NULL; + m_type = WTYPE_DYNAMIC_RIBBON; - m_max_rows = max_rows; - m_combo = combo; - - m_left_widget = NULL; - m_right_widget = NULL; - m_type = WTYPE_DYNAMIC_RIBBON; - + // by default, set all players to have no selection in this ribbon for (int n=0; n<MAX_PLAYER_COUNT; n++) { m_selected_item[n] = -1; @@ -144,10 +143,22 @@ m_child_height = 256; } - // determine row amonunt + // determine row amount m_row_amount = (int)round((h-m_label_height) / (float)m_child_height); - if (m_row_amount > m_max_rows) m_row_amount = m_max_rows; + if (m_properties[PROP_MAX_ROWS].size() > 0) + { + const int max_rows = atoi(m_properties[PROP_MAX_ROWS].c_str()); + if (max_rows < 1) + { + std::cout << "/!\\ WARNING : the 'max_rows' property must be an integer greater than zero." + << " Ingoring current value '" << m_properties[PROP_MAX_ROWS] << "'\n"; + } + else + { + if (m_row_amount > max_rows) m_row_amount = max_rows; + } + } // get and build a list of IDs (by now we may not yet know everything about items, // but we need to get IDs *now* in order for tabbing to work. m_ids.resize(m_row_amount); Modified: main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.hpp =================================================================== --- main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.hpp 2010-02-12 12:29:33 UTC (rev 4691) +++ main/trunk/src/guiengine/widgets/dynamic_ribbon_widget.hpp 2010-02-12 17:45:10 UTC (rev 4692) @@ -91,8 +91,8 @@ /** The total number of columns given item count and row count (even counting not visible with current scrolling) */ int m_needed_cols; - /** The maximum number of rows, as passed to the constructor */ - int m_max_rows; + /** Whether this ribbon can have multiple rows (i.e. ribbon grid) or is a single line */ + bool m_multi_row; /** irrlicht relies on consecutive IDs to perform keyboard navigation between widgets. However, since this widget is dynamic, irrlicht widgets are not created as early as all others, so by the time we're ready @@ -143,7 +143,12 @@ public: - DynamicRibbonWidget(const bool combo=false, const int max_rows=4); + /** + * \param combo Whether this is a "combo" ribbon, i.e. whether there is always one selected item. + * If set to false, will behave more like a toolbar. + * \param multi_row Whether this ribbon can have more than one row + */ + DynamicRibbonWidget(const bool combo, const bool multi_row); /** Reference pointers only, the actual instances are owned by m_children. Used to create mtultiple-row ribbons (what appears to be a grid of icons is actually a vector of stacked basic ribbons) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-15 02:38:01
|
Revision: 4723 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4723&view=rev Author: auria Date: 2010-02-15 02:37:54 +0000 (Mon, 15 Feb 2010) Log Message: ----------- Added sound effect to using the Swapper powerup Modified Paths: -------------- main/trunk/data/sfx/License.txt main/trunk/data/sfx/sfx.config main/trunk/src/audio/sfx_manager.cpp main/trunk/src/audio/sfx_manager.hpp main/trunk/src/items/powerup.cpp Added Paths: ----------- main/trunk/data/sfx/swap.ogg Modified: main/trunk/data/sfx/License.txt =================================================================== --- main/trunk/data/sfx/License.txt 2010-02-15 02:14:52 UTC (rev 4722) +++ main/trunk/data/sfx/License.txt 2010-02-15 02:37:54 UTC (rev 4723) @@ -16,7 +16,7 @@ Released under the Creative Commons Sampling Plus 1.0 license (http://creativecommons.org/licenses/sampling+/1.0/) By Marianne Gagnon (Auria), based on "Approx_850_Enthusiast_Audience" by lonemonk, released under the same license -* locked +* locked and swap By "Stephan" from pdsounds.org (license is public domain) * horn Modified: main/trunk/data/sfx/sfx.config =================================================================== --- main/trunk/data/sfx/sfx.config 2010-02-15 02:14:52 UTC (rev 4722) +++ main/trunk/data/sfx/sfx.config 2010-02-15 02:37:54 UTC (rev 4723) @@ -110,6 +110,12 @@ (roll-off 0.1 ) (positional 1 ) ) + (swap + (filename "swap.ogg") + (volume 1.0 ) + (roll-off 0.1 ) + (positional 1 ) + ) (goo (filename "goo.ogg") (volume 1.0 ) Added: main/trunk/data/sfx/swap.ogg =================================================================== (Binary files differ) Property changes on: main/trunk/data/sfx/swap.ogg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: main/trunk/src/audio/sfx_manager.cpp =================================================================== --- main/trunk/src/audio/sfx_manager.cpp 2010-02-15 02:14:52 UTC (rev 4722) +++ main/trunk/src/audio/sfx_manager.cpp 2010-02-15 02:37:54 UTC (rev 4723) @@ -142,6 +142,8 @@ loadSingleSfx(lisp, "full", SOUND_FULL ); loadSingleSfx(lisp, "prestart", SOUND_PRESTART ); loadSingleSfx(lisp, "start", SOUND_START ); + loadSingleSfx(lisp, "swap", SOUND_SWAP ); + loadSingleSfx(lisp, "engine_small", SOUND_ENGINE_SMALL ); loadSingleSfx(lisp, "engine_large", SOUND_ENGINE_LARGE ); } // loadSfx Modified: main/trunk/src/audio/sfx_manager.hpp =================================================================== --- main/trunk/src/audio/sfx_manager.hpp 2010-02-15 02:14:52 UTC (rev 4722) +++ main/trunk/src/audio/sfx_manager.hpp 2010-02-15 02:37:54 UTC (rev 4723) @@ -46,7 +46,7 @@ SOUND_UGH, SOUND_SKID, SOUND_BOWLING_ROLL, SOUND_BOWLING_STRIKE, SOUND_WINNER, SOUND_CRASH, SOUND_GRAB, SOUND_SHOT, SOUND_GOO, SOUND_WEE, SOUND_EXPLOSION, SOUND_BZZT, SOUND_BEEP, SOUND_BACK_MENU, SOUND_USE_ANVIL, SOUND_USE_PARACHUTE, SOUND_SELECT_MENU, SOUND_MOVE_MENU, SOUND_FULL, SOUND_LOCKED, - SOUND_PRESTART, SOUND_START, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE, + SOUND_PRESTART, SOUND_START, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE, SOUND_SWAP, NUM_SOUNDS }; Modified: main/trunk/src/items/powerup.cpp =================================================================== --- main/trunk/src/items/powerup.cpp 2010-02-15 02:14:52 UTC (rev 4722) +++ main/trunk/src/items/powerup.cpp 2010-02-15 02:37:54 UTC (rev 4723) @@ -96,6 +96,10 @@ m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_GOO); break ; + case POWERUP_SWITCH: + m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SWAP); + break; + case POWERUP_NOTHING: case POWERUP_CAKE: case POWERUP_PLUNGER: @@ -121,7 +125,12 @@ if (m_type != POWERUP_NOTHING && m_type != POWERUP_ZIPPER) m_owner->playCustomSFX(SFXManager::CUSTOM_SHOOT); // FIXME - for some collectibles, set() is never called - if(m_sound_use == NULL) m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT); + if(m_sound_use == NULL) + { + //if (m_type == POWERUP_SWITCH) m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SWAP); + //else + m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT); + } m_number--; World *world = World::getWorld(); @@ -131,6 +140,8 @@ break ; case POWERUP_SWITCH: item_manager->switchItems(); + m_sound_use->position(m_owner->getXYZ()); + m_sound_use->play(); break; case POWERUP_CAKE: case POWERUP_BOWLING: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-15 19:17:44
|
Revision: 4728 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4728&view=rev Author: auria Date: 2010-02-15 19:17:35 +0000 (Mon, 15 Feb 2010) Log Message: ----------- Converted sound effects file to XML. Along the way, refactored the audio code to be more flexible. before, when a sound changed, you needed to edit the config file of STK, edit the enum in the header, edit the loader in the .cpp... was annoying. Now you only need to edit the config file. Modified Paths: -------------- main/trunk/data/sfx/License.txt main/trunk/data/sfx/Makefile.am main/trunk/data/sfx/tintagel/README main/trunk/src/audio/sfx_manager.cpp main/trunk/src/audio/sfx_manager.hpp main/trunk/src/audio/sfx_openal.cpp main/trunk/src/challenges/unlock_manager.cpp main/trunk/src/graphics/explosion.cpp main/trunk/src/graphics/explosion.hpp main/trunk/src/items/bowling.hpp main/trunk/src/items/flyable.hpp main/trunk/src/items/powerup.cpp main/trunk/src/items/projectile_manager.cpp main/trunk/src/items/projectile_manager.hpp main/trunk/src/karts/controller/player_controller.cpp main/trunk/src/karts/kart.cpp main/trunk/src/karts/kart_properties.cpp main/trunk/src/karts/kart_properties.hpp main/trunk/src/modes/world_status.cpp main/trunk/src/states_screens/kart_selection.cpp main/trunk/src/states_screens/options_screen_av.cpp Added Paths: ----------- main/trunk/data/sfx/crash.ogg main/trunk/data/sfx/energy_bar_full.ogg main/trunk/data/sfx/grab_collectable.ogg main/trunk/data/sfx/pre_start_race.ogg main/trunk/data/sfx/sfx.xml main/trunk/data/sfx/start_race.ogg Removed Paths: ------------- main/trunk/data/sfx/sfx.config main/trunk/data/sfx/tintagel/crash.ogg main/trunk/data/sfx/tintagel/deselect_option.ogg main/trunk/data/sfx/tintagel/energy_bar_full.ogg main/trunk/data/sfx/tintagel/grab_collectable.ogg main/trunk/data/sfx/tintagel/move_option.ogg main/trunk/data/sfx/tintagel/pre_start_race.ogg main/trunk/data/sfx/tintagel/select_option.ogg main/trunk/data/sfx/tintagel/start_race.ogg Modified: main/trunk/data/sfx/License.txt =================================================================== --- main/trunk/data/sfx/License.txt 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/data/sfx/License.txt 2010-02-15 19:17:35 UTC (rev 4728) @@ -1,65 +1,123 @@ All sounds are released under GPL, except: +* anvil + Released under the GPL + by the "Battle For Wesnoth" project + +* bowling_roll + Released under the Creative Commons Sampling Plus 1.0 license + (http://creativecommons.org/licenses/sampling+/1.0/, see license text below) + By Marianne Gagnon (Auria), based on "PaintCan", "StoneSpinLong" and + "PaintCanDropHardAndRoll" by daveincamas, released under the same license + +* bzzt + Released under the GNU GPL, coming from original (Super)TuxKart + +* crash + obtained from : http://www.freesoundfiles.tintagel.net/Audio/ + (see license text below) + +* energy_bar_full + obtained from : http://www.freesoundfiles.tintagel.net/Audio/ + (see license text below) + * engine_large Released under the Free Art License by the TORCS project "http://torcs.sourceforge.net/" + +* engine_small + Released under Creative Commons sampling Plus 1.0 License (see license text below) + by Stephen Dunn (stevo14), based on "lawnmower" by morgantj. + +* explosion + Released under the GNU GPL, coming from original (Super)TuxKart + +* goo (Based on sound "Slime pour horror juicy" by BLASTWAVEFX 02344 + Released under the SoundSnap license (http://www.soundsnap.com/licence) + (see license text below) -* skid - Released under Creative Commons Attribution - Share Alike License 3.0 - by Atheal Washington and Stephen Dunn (stevo14) +* gp_end + Released under the Creative Commons Sampling Plus 1.0 license + (http://creativecommons.org/licenses/sampling+/1.0/, see license text below) + By Marianne Gagnon (Auria), based on "Approx_850_Enthusiast_Audience" + by lonemonk, released under the same license -* bowling_roll - Released under the Creative Commons Sampling Plus 1.0 license (http://creativecommons.org/licenses/sampling+/1.0/) - By Marianne Gagnon (Auria), based on "PaintCan", "StoneSpinLong" and - "PaintCanDropHardAndRoll" by daveincamas, released under the same license -* gp_end - Released under the Creative Commons Sampling Plus 1.0 license (http://creativecommons.org/licenses/sampling+/1.0/) - By Marianne Gagnon (Auria), based on "Approx_850_Enthusiast_Audience" by lonemonk, released under the same license +* grab_collectable + obtained from : http://www.freesoundfiles.tintagel.net/Audio/ + (see license text below) -* locked and swap - By "Stephan" from pdsounds.org (license is public domain) - * horn Released under the Creative Commons BY (Attribution) 3.0 Recorded by Mike Koenig, with modifications by Marianne Gagnon (Auria) - + +* locked + By "Stephan" from pdsounds.org (license is public domain) + * parachute - Released under the Creative Commons Sampling Plus 1.0 license (http://creativecommons.org/licenses/sampling+/1.0/) + Released under the Creative Commons Sampling Plus 1.0 license + (http://creativecommons.org/licenses/sampling+/1.0/, see license text below) By Marianne Gagnon (Auria), based on "kiss" by roscoetoon, "kissy_sound" by FreqMan, "rockets" by SmiertSpionem and "Swishes" by Pogotron, all released under the same license + +* pre_start_rac + obtained from : http://www.freesoundfiles.tintagel.net/Audio/ + (see license text below) * shoot - Released under the Creative Commons Sampling Plus 1.0 license (http://creativecommons.org/licenses/sampling+/1.0/) + Released under the Creative Commons Sampling Plus 1.0 license + (http://creativecommons.org/licenses/sampling+/1.0/, see license text below) By Marianne Gagnon (Auria), based on "rocket_exhaust_1" by smcameron and "rockets" by SmiertSpionem, both released under the same license -* engine_small - Released under Creative Commons sampling Plus 1.0 License (see above) - by Stephen Dunn (stevo14), based on "lawnmower" by morgantj. +* skid + Released under Creative Commons Attribution - Share Alike License 3.0 + by Atheal Washington and Stephen Dunn (stevo14) + +* start_race + obtained from : http://www.freesoundfiles.tintagel.net/Audio/ + (see license text below) -* anvil - Released under the GPL - by the "Battle For Wesnoth" project - * strike (Based on sound "11913201" by Radio Mall) -* goo (Based on sound "Slime pour horror juicy" by BLASTWAVEFX 02344 Released under the SoundSnap license (http://www.soundsnap.com/licence) + (see license text below) + +* swap + By "Stephan" from pdsounds.org (license is public domain) + +* ugh + Released under the GNU GPL, coming from original (Super)TuxKart + +* wee + Released under the GNU GPL, coming from original (Super)TuxKart + +______________________________________________________________________________________________________ + + +Tintagel license : + | These sound files are provided free of charge, without any representation or warranty whatsoever. + | To the best of our knowledge, all wave, midi, and audio files presented here are in the public + | domain and are available for use without restriction. + SoundSnap license (short version) : | You are Free: | - To remix or transform the sounds in any way | - To copy, distribute and transmit the sounds - | - To use the sounds in any music, film, video game, website etc. whether commercial or not, without paying royalties or other fees + | - To use the sounds in any music, film, video game, website etc. whether commercial + | or not, without paying royalties or other fees | You Cannot: - | - Make commercial distribution of these sounds 'as they are'. For example, you cannot download and sell them as part of a CD library + | - Make commercial distribution of these sounds 'as they are'. + | For example, you cannot download and sell them as part of a CD library Creative-Common Sampling Plus license (short version) : | You are free: - | - To sample, mash-up, or otherwise creatively transform this work for commercial or noncommercial purposes. + | - To sample, mash-up, or otherwise creatively transform this work for + | commercial or noncommercial purposes. | - To perform, display, and distribute copies of this whole work for noncommercial purposes | Under the following conditions: | - You must attribute the work in the manner specified by the author or licensor | (but not in any way that suggests that they endorse you or your use of the work). - | - You may not use this work to advertise for or promote anything but the work you create from it. - | - For any reuse or distribution, you must make clear to others the license terms of this work. \ No newline at end of file + | - You may not use this work to advertise for or promote anything + | but the work you create from it. + | - For any reuse or distribution, you must make clear to others the license terms of this work. Modified: main/trunk/data/sfx/Makefile.am =================================================================== --- main/trunk/data/sfx/Makefile.am 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/data/sfx/Makefile.am 2010-02-15 19:17:35 UTC (rev 4728) @@ -3,5 +3,5 @@ pkgdatadir = $(datadir)/games/$(PACKAGE)/data/sfx nobase_dist_pkgdata_DATA = $(shell find $(srcdir) -name "*.ogg") \ - $(shell find $(srcdir) -name "sfx.config") \ + $(shell find $(srcdir) -name "sfx.xml") \ License.txt Copied: main/trunk/data/sfx/crash.ogg (from rev 4726, main/trunk/data/sfx/tintagel/crash.ogg) =================================================================== (Binary files differ) Copied: main/trunk/data/sfx/energy_bar_full.ogg (from rev 4726, main/trunk/data/sfx/tintagel/energy_bar_full.ogg) =================================================================== (Binary files differ) Copied: main/trunk/data/sfx/grab_collectable.ogg (from rev 4726, main/trunk/data/sfx/tintagel/grab_collectable.ogg) =================================================================== (Binary files differ) Copied: main/trunk/data/sfx/pre_start_race.ogg (from rev 4726, main/trunk/data/sfx/tintagel/pre_start_race.ogg) =================================================================== (Binary files differ) Deleted: main/trunk/data/sfx/sfx.config =================================================================== --- main/trunk/data/sfx/sfx.config 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/data/sfx/sfx.config 2010-02-15 19:17:35 UTC (rev 4728) @@ -1,156 +0,0 @@ -;; -*- mode: lisp -*- - -(sfx-config - (ugh - (filename "ugh.ogg") ;; The name of the wav file associated with this Sound effect - (volume 1.0 ) ;; Range: 0.0 (silent) to 1.0 (full volume) - (roll-off 0.1 ) ;; The ammount of volume that is subtracted for every unit - ;; of distance between the sound and the listener. - (positional 0 ) ;; 1 = true, 0 = false - ) - (winner - (filename "gp_end.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (locked - (filename "locked.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (grab - (filename "tintagel/grab_collectable.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (bzzt - (filename "bzzt.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (bowling_roll - (filename "bowling_roll.ogg") - (volume 1.0 ) - (roll-off 0.05 ) - (positional 1 ) - ) - (bowling_strike - (filename "strike.ogg") - (volume 1.0 ) - (roll-off 0.05 ) - (positional 1 ) - ) - (wee - (filename "wee.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (back_menu - (filename "tintagel/deselect_option.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (select_menu - (filename "tintagel/select_option.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (move_menu - (filename "tintagel/move_option.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (full - (filename "tintagel/energy_bar_full.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (prestart - (filename "tintagel/pre_start_race.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (start - (filename "tintagel/start_race.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 0 ) - ) - (engine_small - (filename "engine_small.ogg") - (volume 0.4 ) - (roll-off 0.2 ) - (positional 1 ) - ) - (engine_large - (filename "engine_large.ogg") - (volume 0.4 ) - (roll-off 0.2 ) - (positional 1 ) - ) - (crash - (filename "tintagel/crash.ogg") - (volume 1.0 ) - (roll-off 0.5 ) - (positional 1 ) - ) - (shot - (filename "shoot.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 1 ) - ) - (swap - (filename "swap.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 1 ) - ) - (goo - (filename "goo.ogg") - (volume 1.0 ) - (roll-off 0.1 ) - (positional 1 ) - ) - (skid - (filename "skid.ogg") - (volume 1.0 ) - (roll-off 0.5 ) - (positional 1 ) - ) - (explosion - (filename "explosion.ogg") - (volume 1.0 ) - (roll-off 0.05 ) - (positional 1 ) - ) - (beep - (filename "horn.ogg") - (volume 0.6 ) - (roll-off 0.2 ) - (positional 1 ) - ) - (use_anvil - (filename "anvil.ogg") - (volume 1.0 ) - (roll-off 0.5 ) - (positional 1 ) - ) - (use_parachute - (filename "parachute.ogg") - (volume 1.0 ) - (roll-off 0.5 ) - (positional 1 ) - ) -) -;; EOF ;; Added: main/trunk/data/sfx/sfx.xml =================================================================== --- main/trunk/data/sfx/sfx.xml (rev 0) +++ main/trunk/data/sfx/sfx.xml 2010-02-15 19:17:35 UTC (rev 4728) @@ -0,0 +1,40 @@ + +<sfx-config> + + <!-- + + Attributes : + + filename The name of the ogg file associated with this Sound effect + volume Range: 0.0 silent to 1.0 full volume + rolloff The ammount of volume that is subtracted for every unit + of distance between the sound and the listener. + positional true or false + + --> + + <sfx name="ugh" filename="ugh.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="winner" filename="gp_end.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="locked" filename="locked.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="grab" filename="grab_collectable.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="bzzt" filename="bzzt.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="bowling_roll" filename="bowling_roll.ogg" volume="1.0" rolloff="0.05" positional="true" /> + <sfx name="bowling_strike" filename="strike.ogg" volume="1.0" rolloff="0.05" positional="true" /> + <sfx name="wee" filename="wee.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="full" filename="energy_bar_full.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="prestart" filename="pre_start_race.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="start" filename="start_race.ogg" volume="1.0" rolloff="0.1" positional="false" /> + <sfx name="engine_small" filename="engine_small.ogg" volume="0.4" rolloff="0.2" positional="true" /> + <sfx name="engine_large" filename="engine_large.ogg" volume="0.4" rolloff="0.2" positional="true" /> + <sfx name="crash" filename="crash.ogg" volume="1.0" rolloff="0.5" positional="true" /> + <sfx name="shot" filename="shoot.ogg" volume="1.0" rolloff="0.1" positional="true" /> + <sfx name="swap" filename="swap.ogg" volume="1.0" rolloff="0.1" positional="true" /> + <sfx name="goo" filename="goo.ogg" volume="1.0" rolloff="0.1" positional="true" /> + <sfx name="skid" filename="skid.ogg" volume="1.0" rolloff="0.5" positional="true" /> + <sfx name="explosion" filename="explosion.ogg" volume="1.0" rolloff="0.05" positional="true" /> + <sfx name="beep" filename="horn.ogg" volume="0.6" rolloff="0.2" positional="true" /> + <sfx name="use_anvil" filename="anvil.ogg" volume="1.0" rolloff="0.5" positional="true" /> + <sfx name="use_parachute" filename="parachute.ogg" volume="1.0" rolloff="0.5" positional="true" /> + +<sfx-config/> + Property changes on: main/trunk/data/sfx/sfx.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + native Copied: main/trunk/data/sfx/start_race.ogg (from rev 4726, main/trunk/data/sfx/tintagel/start_race.ogg) =================================================================== (Binary files differ) Modified: main/trunk/data/sfx/tintagel/README =================================================================== --- main/trunk/data/sfx/tintagel/README 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/data/sfx/tintagel/README 2010-02-15 19:17:35 UTC (rev 4728) @@ -1,4 +1,5 @@ -The sound files in this directory were obtained from: +* crash, energy_bar_full, grab_collectable, pre_start_rac, start_race +were obtained from: http://www.freesoundfiles.tintagel.net/Audio/ Deleted: main/trunk/data/sfx/tintagel/crash.ogg =================================================================== (Binary files differ) Deleted: main/trunk/data/sfx/tintagel/deselect_option.ogg =================================================================== (Binary files differ) Deleted: main/trunk/data/sfx/tintagel/energy_bar_full.ogg =================================================================== (Binary files differ) Deleted: main/trunk/data/sfx/tintagel/grab_collectable.ogg =================================================================== (Binary files differ) Deleted: main/trunk/data/sfx/tintagel/move_option.ogg =================================================================== (Binary files differ) Deleted: main/trunk/data/sfx/tintagel/pre_start_race.ogg =================================================================== (Binary files differ) Deleted: main/trunk/data/sfx/tintagel/select_option.ogg =================================================================== (Binary files differ) Deleted: main/trunk/data/sfx/tintagel/start_race.ogg =================================================================== (Binary files differ) Modified: main/trunk/src/audio/sfx_manager.cpp =================================================================== --- main/trunk/src/audio/sfx_manager.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/audio/sfx_manager.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -53,11 +53,7 @@ // The sound manager initialises OpenAL m_initialized = sound_manager->initialized(); m_masterGain = 1.0f; - m_sfx_buffers.resize(NUM_SOUNDS); - m_sfx_positional.resize(NUM_SOUNDS); - m_sfx_rolloff.resize(NUM_SOUNDS); - m_sfx_gain.resize(NUM_SOUNDS); - if(!m_initialized) return; + if (!m_initialized) return; loadSfx(); setMasterSFXVolume( UserConfigParams::m_sfx_volume ); @@ -67,20 +63,35 @@ //----------------------------------------------------------------------------- SFXManager::~SFXManager() { - //make sure there aren't any stray sfx's sitting around anywhere - for(std::vector<SFXBase*>::iterator i=m_all_sfx.begin(); - i!=m_all_sfx.end(); i++) + // ---- clear m_all_sfx + const int sfxAmount = m_all_sfx.size(); + for (int n=0; n<sfxAmount; n++) { - delete (*i); - } // for i in m_all_sfx + delete m_all_sfx[n]; + } m_all_sfx.clear(); - //the unbuffer all of the buffers - for(unsigned int ii = 0; ii != m_sfx_buffers.size(); ii++) + // ---- clear m_quick_sounds { - alDeleteBuffers(1, &(m_sfx_buffers[ii])); - } + std::map<std::string, SFXBase*>::iterator i = m_quick_sounds.begin(); + for (; i != m_quick_sounds.end(); i++) + { + SFXBase* snd = (*i).second; + delete snd; + } + } + m_quick_sounds.clear(); + // ---- clear m_all_sfx_types + { + std::map<std::string, SFXBufferInfo>::iterator i = m_all_sfx_types.begin(); + for (; i != m_all_sfx_types.end(); i++) + { + (*i).second.freeBuffer(); + } + m_all_sfx_types.clear(); + } + sfx_manager = NULL; } // ~SFXManager @@ -97,56 +108,35 @@ */ void SFXManager::loadSfx() { - // TODO : implement as XML - const lisp::Lisp* root = 0; - std::string sfx_config_name = file_manager->getSFXFile("sfx.config"); - try + std::string sfx_config_name = file_manager->getSFXFile("sfx.xml"); + XMLNode* root = file_manager->createXMLTree(sfx_config_name); + if (!root) { - lisp::Parser parser; - root = parser.parse(sfx_config_name); + std::cerr << "Could not read sounf effects XML file " << sfx_config_name.c_str() << std::endl; } - catch(std::exception& e) + + const int amount = root->getNumNodes(); + for (int i=0; i<amount; i++) { - (void)e; // avoid warning about unreferenced local variable - std::ostringstream msg; - msg << "Sfx config file '" << sfx_config_name - << "' does not exist - aborting.\n"; - throw std::runtime_error(msg.str()); - } - - const lisp::Lisp* lisp = root->getLisp("sfx-config"); - if(!lisp) - { - std::string msg="No sfx-config node"; - throw std::runtime_error(msg); - } - loadSingleSfx(lisp, "ugh", SOUND_UGH ); - loadSingleSfx(lisp, "skid", SOUND_SKID ); - loadSingleSfx(lisp, "locked", SOUND_LOCKED ); - loadSingleSfx(lisp, "bowling_roll", SOUND_BOWLING_ROLL ); - loadSingleSfx(lisp, "bowling_strike",SOUND_BOWLING_STRIKE ); - loadSingleSfx(lisp, "winner", SOUND_WINNER ); - loadSingleSfx(lisp, "crash", SOUND_CRASH ); - loadSingleSfx(lisp, "grab", SOUND_GRAB ); - loadSingleSfx(lisp, "goo", SOUND_GOO ); - loadSingleSfx(lisp, "shot", SOUND_SHOT ); - loadSingleSfx(lisp, "wee", SOUND_WEE ); - loadSingleSfx(lisp, "explosion", SOUND_EXPLOSION ); - loadSingleSfx(lisp, "bzzt", SOUND_BZZT ); - loadSingleSfx(lisp, "beep", SOUND_BEEP ); - loadSingleSfx(lisp, "back_menu", SOUND_BACK_MENU ); - loadSingleSfx(lisp, "use_anvil", SOUND_USE_ANVIL ); - loadSingleSfx(lisp, "use_parachute", SOUND_USE_PARACHUTE ); - loadSingleSfx(lisp, "select_menu", SOUND_SELECT_MENU ); - loadSingleSfx(lisp, "move_menu", SOUND_MOVE_MENU ); - loadSingleSfx(lisp, "full", SOUND_FULL ); - loadSingleSfx(lisp, "prestart", SOUND_PRESTART ); - loadSingleSfx(lisp, "start", SOUND_START ); - loadSingleSfx(lisp, "swap", SOUND_SWAP ); - - loadSingleSfx(lisp, "engine_small", SOUND_ENGINE_SMALL ); - loadSingleSfx(lisp, "engine_large", SOUND_ENGINE_LARGE ); -} // loadSfx + const XMLNode* node = root->getNode(i); + + if (node->getName() == "sfx-config") + { + // outer node, ignore + } + else if (node->getName() == "sfx") + { + loadSingleSfx(node); + } + else + { + std::cerr << "Unknown node in sfx XML file : " << node->getName().c_str() << std::endl; + throw std::runtime_error("Unknown node in sfx XML file"); + } + }// nend for + + delete root; + } // loadSfx //---------------------------------------------------------------------------- /** Load a vorbis file into an OpenAL buffer based on a routine by Peter Mulholland, used with permission (quote : "Feel free to use") @@ -226,7 +216,7 @@ I'm just too stupid with C++ to figure it out. The switch code is less then ideal. */ - +/* const char *SFXManager::getCustomTagName(int id) { switch (id) @@ -244,7 +234,7 @@ }; return ""; } // getCustomTagName - +*/ /* addSingleSfx() @@ -254,102 +244,155 @@ individual karts (character voices) so that we can avoid creating an enumeration for each effect, for each kart. - sfxFile must be an absolute pathname, so get that straight first. + \param sfxFile must be an absolute pathname + \return whether loading this sound effect was successful */ -int SFXManager::addSingleSfx(std::string sfxFile, - int positional, - float rolloff, - float gain) -/* Returns sfx ID or -1 on error*/ +bool SFXManager::addSingleSfx(const char* sfx_name, + std::string sfxFile, + bool positional, + float rolloff, + float gain) { - int sfxID; + std::string filename; + + SFXBufferInfo sfxInfo; + - m_sfx_buffers.push_back(0); - sfxID = m_sfx_buffers.size() - 1; - - /* FIXME: Check for existance of file before resizing vectors */ - - m_sfx_rolloff.push_back(rolloff); - m_sfx_positional.push_back(positional); - m_sfx_gain.push_back(gain); - - alGenBuffers(1, &(m_sfx_buffers[sfxID])); - if (!checkError("generating a buffer")) return -1; - - if (!loadVorbisBuffer(sfxFile.c_str(), m_sfx_buffers[sfxID])) + sfxInfo.m_sfx_rolloff = rolloff; + sfxInfo.m_sfx_positional = positional; + sfxInfo.m_sfx_gain = gain; + + printf("Loading SFX %s\n", sfxFile.c_str()); + + alGetError(); // clear errors from previously + + alGenBuffers(1, &sfxInfo.m_sfx_buffer); + if (!checkError("generating a buffer")) { - printf("Failed to load sound effect %s\n", sfxFile.c_str()); + return false; } + + if (!loadVorbisBuffer(sfx_name, sfxInfo.m_sfx_buffer)) + { + fprintf(stderr, "Could not load sound effect %s\n", sfx_name); + return false; + } + + m_all_sfx_types[sfx_name] = sfxInfo; + + return true; +} // addSingleSFX - // debugging - /*printf("addSingleSfx() id:%d sfxFile:%s\n", sfxID, sfxFile.c_str());*/ +//---------------------------------------------------------------------------- - return sfxID; -} // addSingleSFX +void SFXManager::loadSingleSfx(const XMLNode* node) +{ + std::string filename; + std::string sfx_name; -void SFXManager::loadSingleSfx(const lisp::Lisp* lisp, - const char *name, int item) -{ - if (item < 0 || item >= (int)m_sfx_gain.size()) + SFXBufferInfo sfxInfo; + + if (node->get("filename", &filename) == 0) { - printf("loadSingleSfx: Invalid SFX ID.\n"); + fprintf(stderr, "/!\\ The 'filename' attribute is mandatory in the SFX XML file!\n"); return; } + + if (node->get("name", &sfx_name) == 0) + { + fprintf(stderr, "/!\\ The 'name' attribute is mandatory in the SFX XML file!\n"); + return; + } + + node->get("rolloff", &sfxInfo.m_sfx_rolloff ); + node->get("positional", &sfxInfo.m_sfx_positional ); + node->get("volume", &sfxInfo.m_sfx_gain ); - const lisp::Lisp* sfxLisp = lisp->getLisp(name); - std::string wav; float rolloff = 0.1f; float gain = 1.0f; int positional = 0; - - sfxLisp->get("filename", wav ); - sfxLisp->get("roll-off", rolloff ); - sfxLisp->get("positional", positional ); - sfxLisp->get("volume", gain ); - - m_sfx_rolloff[item] = rolloff; - m_sfx_positional[item] = positional; - m_sfx_gain[item] = gain; - - std::string path = file_manager->getSFXFile(wav); + std::string path = file_manager->getSFXFile(filename); printf("Loading SFX %s\n", path.c_str()); - alGenBuffers(1, &(m_sfx_buffers[item])); + alGenBuffers(1, &sfxInfo.m_sfx_buffer); if (!checkError("generating a buffer")) return; - if(!loadVorbisBuffer(path.c_str(), m_sfx_buffers[item])) + assert( alIsBuffer(sfxInfo.m_sfx_buffer) ); + + if (!loadVorbisBuffer(path.c_str(), sfxInfo.m_sfx_buffer)) { - printf("Could not load sound effect %s\n", name); + fprintf(stderr, "Could not load sound effect %s\n", path.c_str()); + return; } + + //printf(">>>>>> Addind sound effect '%s' to the map\n", sfx_name.c_str()); + + m_all_sfx_types[sfx_name.c_str()] = sfxInfo; + + assert( alIsBuffer(m_all_sfx_types[sfx_name.c_str()].m_sfx_buffer) ); + + /* + std::map<std::string, SFXBufferInfo>::iterator i = m_all_sfx_types.begin(); + for (; i != m_all_sfx_types.end(); i++ ) + { + printf(" got '%s', buffer is %i\n", i->first.c_str(), i->second.m_sfx_buffer); + } + */ + + } // loadSingleSfx //---------------------------------------------------------------------------- /** Creates a new SFX object. The memory for this object is managed completely * by the SFXManager. This makes it easy to use different implementations of - * SFX - since newSFX can return whatever type is used. To free the memory, + * SFX - since createSoundSource can return whatever type is used. To free the memory, * call deleteSFX(). * \param id Identifier of the sound effect to create. */ -SFXBase *SFXManager::newSFX(int id) +SFXBase* SFXManager::createSoundSource(const SFXBufferInfo& info, const bool addToSFXList) { bool positional = false; - if (id < 0 || id >= (int)m_sfx_gain.size()) + if (race_manager->getNumLocalPlayers() < 2) { - printf("newSFX: Invalid SFX ID %d.\n", id); - return NULL; + positional = info.m_sfx_positional; } - if(race_manager->getNumLocalPlayers() < 2) - positional = m_sfx_positional[id]!=0; + assert( alIsBuffer(info.m_sfx_buffer) ); - SFXBase *p = new SFXOpenAL(m_sfx_buffers[id], positional, m_sfx_rolloff[id], m_sfx_gain[id]); + SFXBase* sfx = new SFXOpenAL(info.m_sfx_buffer, positional, info.m_sfx_rolloff, info.m_sfx_gain); + // debugging /*printf("newSfx(): id:%d buffer:%p, rolloff:%f, gain:%f %p\n", id, m_sfx_buffers[id], m_sfx_rolloff[id], m_sfx_gain[id], p);*/ - p->volume(m_masterGain); - m_all_sfx.push_back(p); - return p; -} // newSFX + + sfx->volume(m_masterGain); + + if (addToSFXList) m_all_sfx.push_back(sfx); + + return sfx; +} // createSoundSource //---------------------------------------------------------------------------- + +SFXBase* SFXManager::createSoundSource(const char* name, const bool addToSFXList) +{ + std::map<std::string, SFXBufferInfo>::iterator i = m_all_sfx_types.find(name); + if ( i == m_all_sfx_types.end() ) + { + fprintf( stderr, "SFXManager::createSoundSource could not find the requested sound effect : '%s'\n", name); + + /* + std::map<std::string, SFXBufferInfo>::iterator it = m_all_sfx_types.begin(); + for (; it != m_all_sfx_types.end(); it++ ) + { + printf(" got '%s'\n", it->first.c_str()); + }*/ + + return NULL; + } + + return createSoundSource( i->second, addToSFXList ); +} + +//---------------------------------------------------------------------------- /** Delete a sound effect object, and removes it from the internal list of * all SFXs. This call deletes the object, and removes it from the list of * all SFXs. @@ -379,7 +422,7 @@ */ void SFXManager::pauseAll() { - for(std::vector<SFXBase*>::iterator i=m_all_sfx.begin(); + for (std::vector<SFXBase*>::iterator i=m_all_sfx.begin(); i!=m_all_sfx.end(); i++) { (*i)->pause(); @@ -390,13 +433,12 @@ */ void SFXManager::resumeAll() { - for(std::vector<SFXBase*>::iterator i=m_all_sfx.begin(); + for (std::vector<SFXBase*>::iterator i=m_all_sfx.begin(); i!=m_all_sfx.end(); i++) { SFXStatus status = (*i)->getStatus(); // Initial happens when - if(status==SFX_PAUSED) - (*i)->resume(); + if (status==SFX_PAUSED) (*i)->resume(); } // for i in m_all_sfx } // resumeAll @@ -418,19 +460,29 @@ //----------------------------------------------------------------------------- void SFXManager::setMasterSFXVolume(float gain) { - if(gain > 1.0) - gain = 1.0f; - if(gain < 0.0f) - gain = 0.0f; + if (gain > 1.0) gain = 1.0f; + if (gain < 0.0f) gain = 0.0f; m_masterGain = gain; - for(std::vector<SFXBase*>::iterator i=m_all_sfx.begin(); - i!=m_all_sfx.end(); i++) + // regular SFX { - (*i)->volume(m_masterGain); - } // for i in m_all_sfx - + for (std::vector<SFXBase*>::iterator i=m_all_sfx.begin(); + i!=m_all_sfx.end(); i++) + { + (*i)->volume(m_masterGain); + } // for i in m_all_sfx + } + + // quick SFX + { + std::map<std::string, SFXBase*>::iterator i = m_quick_sounds.begin(); + for (; i != m_quick_sounds.end(); i++) + { + (*i).second->volume(m_masterGain); + } + } + } // setMasterSFXVolume //----------------------------------------------------------------------------- @@ -449,18 +501,19 @@ } // getErrorString //----------------------------------------------------------------------------- -void SFXManager::quickSound(SFXType soundType) -{ - static std::map<SFXType, SFXBase*> allSounds; + +std::map<std::string, SFXBase*> SFXManager::m_quick_sounds; + +void SFXManager::quickSound(const char* soundType) +{ + std::map<std::string, SFXBase*>::iterator sound = m_quick_sounds.find(soundType); - std::map<SFXType, SFXBase*>::iterator sound = allSounds.find(soundType); - - if (sound == allSounds.end()) + if (sound == m_quick_sounds.end()) { - // sound not yet in our list - SFXBase* newSound = sfx_manager->newSFX(soundType); + // sound not yet in our local list of quick sounds + SFXBase* newSound = sfx_manager->createSoundSource(soundType, false); newSound->play(); - allSounds[soundType] = newSound; + m_quick_sounds[soundType] = newSound; } else { Modified: main/trunk/src/audio/sfx_manager.hpp =================================================================== --- main/trunk/src/audio/sfx_manager.hpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/audio/sfx_manager.hpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -21,6 +21,7 @@ #define HEADER_SFX_MANAGER_HPP #include <vector> +#include <map> #ifdef __APPLE__ # include <OpenAL/al.h> #else @@ -31,8 +32,8 @@ #include "utils/vec3.hpp" class SFXBase; +class XMLNode; - /** Manager of all sound effects. The manager reads all sound effects and * maintains the corresponding buffers. Each sound effect objects uses * on of the (shared) buffers from the sound manager. @@ -40,21 +41,11 @@ class SFXManager { public: - /** The different type of sound effects. */ - enum SFXType - { - SOUND_UGH, SOUND_SKID, SOUND_BOWLING_ROLL, SOUND_BOWLING_STRIKE, SOUND_WINNER, SOUND_CRASH, SOUND_GRAB, - SOUND_SHOT, SOUND_GOO, SOUND_WEE, SOUND_EXPLOSION, SOUND_BZZT, SOUND_BEEP, SOUND_BACK_MENU, SOUND_USE_ANVIL, - SOUND_USE_PARACHUTE, SOUND_SELECT_MENU, SOUND_MOVE_MENU, SOUND_FULL, SOUND_LOCKED, - SOUND_PRESTART, SOUND_START, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE, SOUND_SWAP, - NUM_SOUNDS - }; - - /* - Entries for custom SFX sounds. These are unique for each kart. - eg. kart->playCustomSFX(SFX_MANAGER::CUSTOM_HORN) - */ + /** + * Entries for custom SFX sounds. These are unique for each kart. + * eg. kart->playCustomSFX(SFX_MANAGER::CUSTOM_HORN) + */ enum CustomSFX { CUSTOM_HORN, // Replaces default horn @@ -70,10 +61,6 @@ NUM_CUSTOMS }; - // LISP (or in the future xml) tag for each custom sound - const char *getCustomTagName(int id); - - /** Status of a sound effect. */ enum SFXStatus { @@ -82,32 +69,67 @@ }; private: - /** The buffers for all sound effects. These are shared among all + + class SFXBufferInfo + { + private: + public: + ALuint m_sfx_buffer; + bool m_sfx_positional; + float m_sfx_rolloff; + float m_sfx_gain; + + SFXBufferInfo() + { + m_sfx_buffer = 0; + m_sfx_gain = 1.0f; + m_sfx_rolloff = 0.1f; + m_sfx_positional = false; + } + + + /** Cannot appear in destructor because copy-constructors may be used, + * and the OpenAL source must not be deleted on a copy */ + void freeBuffer() + { + alDeleteBuffers(1, &m_sfx_buffer); + m_sfx_buffer = 0; + } + ~SFXBufferInfo() + { + } + }; + + /** The buffers and info for all sound effects. These are shared among all * instances of SFXOpenal. */ - std::vector<ALuint> m_sfx_buffers; - std::vector<int> m_sfx_positional; - std::vector<float> m_sfx_rolloff; - std::vector<float> m_sfx_gain; - std::vector<SFXBase*> m_all_sfx; + std::map<std::string, SFXBufferInfo> m_all_sfx_types; + + /** The actual instances (sound sources) */ + std::vector<SFXBase*> m_all_sfx; + + /** To play non-positional sounds without having to create a new object for each */ + static std::map<std::string, SFXBase*> m_quick_sounds; + bool m_initialized; float m_masterGain; void loadSfx(); - void loadSingleSfx(const lisp::Lisp *lisp, - const char *name, - int type); + void loadSingleSfx(const XMLNode* node); public: SFXManager(); virtual ~SFXManager(); bool sfxAllowed(); - int addSingleSfx( std::string filename, - int positional, + bool addSingleSfx( const char* sfx_name, + std::string filename, + bool positional, float rolloff, float gain); - SFXBase *newSFX(int id); + SFXBase* createSoundSource(const SFXBufferInfo& info, const bool addToSFXList=true); + SFXBase* createSoundSource(const char* name, const bool addToSFXList=true); + void deleteSFX(SFXBase *sfx); void pauseAll(); void resumeAll(); @@ -120,7 +142,7 @@ /** Positional sound is cool, but creating a new object just to play a simple menu sound is not. This function allows for 'quick sounds' in a single call.*/ - static void quickSound(SFXType soundType); + static void quickSound(const char* soundName); }; Modified: main/trunk/src/audio/sfx_openal.cpp =================================================================== --- main/trunk/src/audio/sfx_openal.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/audio/sfx_openal.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -43,19 +43,28 @@ m_defaultGain = gain; alGenSources(1, &m_soundSource ); - if(!SFXManager::checkError("generating a source")) return; + if (!SFXManager::checkError("generating a source")) return; + assert( alIsBuffer(m_soundBuffer) ); + assert( alIsSource(m_soundSource) ); + + //std::cout << "Setting a source with buffer " << m_soundBuffer << ", rolloff " << rolloff + // << ", gain=" << m_defaultGain << ", positional=" << (positional ? "true" : "false") << std::endl; + alSourcei (m_soundSource, AL_BUFFER, m_soundBuffer); + + if (!SFXManager::checkError("attaching the buffer to the source")) return; + alSource3f(m_soundSource, AL_POSITION, 0.0, 0.0, 0.0); alSource3f(m_soundSource, AL_VELOCITY, 0.0, 0.0, 0.0); alSource3f(m_soundSource, AL_DIRECTION, 0.0, 0.0, 0.0); alSourcef (m_soundSource, AL_ROLLOFF_FACTOR, rolloff ); alSourcef (m_soundSource, AL_GAIN, m_defaultGain); - if(positional) - alSourcei (m_soundSource, AL_SOURCE_RELATIVE, AL_FALSE); - else - alSourcei (m_soundSource, AL_SOURCE_RELATIVE, AL_TRUE); + + if (positional) alSourcei (m_soundSource, AL_SOURCE_RELATIVE, AL_FALSE); + else alSourcei (m_soundSource, AL_SOURCE_RELATIVE, AL_TRUE); + m_positional = positional; m_ok = SFXManager::checkError("setting up the source"); } // SFXOpenAL Modified: main/trunk/src/challenges/unlock_manager.cpp =================================================================== --- main/trunk/src/challenges/unlock_manager.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/challenges/unlock_manager.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -44,7 +44,7 @@ // in main). unlock_manager=this; - m_locked_sound = sfx_manager->newSFX(SFXManager::SOUND_LOCKED); + m_locked_sound = sfx_manager->createSoundSource("locked"); // Read challenges from .../data // ----------------------------- Modified: main/trunk/src/graphics/explosion.cpp =================================================================== --- main/trunk/src/graphics/explosion.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/graphics/explosion.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -30,7 +30,7 @@ const float explosion_time = 1.5f; const float burst_time = 0.1f; -Explosion::Explosion(const Vec3& coord, const int explosion_sound) +Explosion::Explosion(const Vec3& coord, const char* explosion_sound) { m_remaining_time = burst_time; // short emision time, explosion, not constant flame m_node = irr_driver->addParticleNode(); @@ -69,7 +69,7 @@ //paf->drop(); - m_explode_sound = sfx_manager->newSFX( (SFXManager::SFXType)explosion_sound ); + m_explode_sound = sfx_manager->createSoundSource( explosion_sound ); init(coord); } // Explosion Modified: main/trunk/src/graphics/explosion.hpp =================================================================== --- main/trunk/src/graphics/explosion.hpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/graphics/explosion.hpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -34,7 +34,7 @@ scene::IParticleSystemSceneNode *m_node; public: - Explosion(const Vec3& coord, const int explosion_sound); + Explosion(const Vec3& coord, const char* explosion_sound); ~Explosion(); void init (const Vec3& coord); void update (float delta_t); Modified: main/trunk/src/items/bowling.hpp =================================================================== --- main/trunk/src/items/bowling.hpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/items/bowling.hpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -39,7 +39,7 @@ static void init(const XMLNode &node, scene::IMesh *bowling); virtual void update(float dt); - int getExplosionSound() const { return SFXManager::SOUND_BOWLING_STRIKE; } + const char* getExplosionSound() const { return "bowling_strike"; } }; // Bowling Modified: main/trunk/src/items/flyable.hpp =================================================================== --- main/trunk/src/items/flyable.hpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/items/flyable.hpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -128,7 +128,7 @@ void setHasHit () { m_has_hit_something = true; } void reset () { Moveable::reset(); } bool isOwnerImmunity(const Kart *kart_hit) const; - virtual int getExplosionSound() const { return SFXManager::SOUND_EXPLOSION; } + virtual const char* getExplosionSound() const { return "explosion"; } /** Indicates if an explosion needs to be added if this flyable * is removed. */ virtual bool needsExplosion() const {return true;} Modified: main/trunk/src/items/powerup.cpp =================================================================== --- main/trunk/src/items/powerup.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/items/powerup.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -81,30 +81,30 @@ break ; case POWERUP_BOWLING: - m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_BOWLING_ROLL); + m_sound_use = sfx_manager->createSoundSource("bowling_roll"); break ; case POWERUP_ANVIL: - m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_USE_ANVIL); + m_sound_use = sfx_manager->createSoundSource("use_anvil"); break; case POWERUP_PARACHUTE: - m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_USE_PARACHUTE); + m_sound_use = sfx_manager->createSoundSource("use_parachute"); break; case POWERUP_BUBBLEGUM: - m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_GOO); + m_sound_use = sfx_manager->createSoundSource("goo"); break ; case POWERUP_SWITCH: - m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SWAP); + m_sound_use = sfx_manager->createSoundSource("swap"); break; case POWERUP_NOTHING: case POWERUP_CAKE: case POWERUP_PLUNGER: default : - m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT); + m_sound_use = sfx_manager->createSoundSource("shot"); break ; } @@ -129,7 +129,7 @@ { //if (m_type == POWERUP_SWITCH) m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SWAP); //else - m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT); + m_sound_use = sfx_manager->createSoundSource("shot"); } m_number--; Modified: main/trunk/src/items/projectile_manager.cpp =================================================================== --- main/trunk/src/items/projectile_manager.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/items/projectile_manager.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -186,7 +186,7 @@ // ----------------------------------------------------------------------------- /** See if there is an old, unused explosion object available. If so, * reuse this object, otherwise create a new one. */ -Explosion* ProjectileManager::newExplosion(const Vec3& coord, const int explosion_sound) +Explosion* ProjectileManager::newExplosion(const Vec3& coord, const char* explosion_sound) { Explosion *e = new Explosion(coord, explosion_sound); m_active_explosions.push_back(e); Modified: main/trunk/src/items/projectile_manager.hpp =================================================================== --- main/trunk/src/items/projectile_manager.hpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/items/projectile_manager.hpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -66,7 +66,7 @@ void cleanup (); void update (float dt); Flyable* newProjectile (Kart *kart, PowerupType type); - Explosion* newExplosion (const Vec3& coord, const int explosion_sound=(SFXManager::SFXType)SFXManager::SOUND_EXPLOSION); + Explosion* newExplosion (const Vec3& coord, const char* explosion_sound="explosion"); void Deactivate (Flyable *p) {} void removeTextures (); }; Modified: main/trunk/src/karts/controller/player_controller.cpp =================================================================== --- main/trunk/src/karts/controller/player_controller.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/karts/controller/player_controller.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -50,11 +50,11 @@ kart->setCamera(new Camera(player_index, kart)); kart->getCamera()->setMode(Camera::CM_NORMAL); - m_bzzt_sound = sfx_manager->newSFX(SFXManager::SOUND_BZZT ); - m_wee_sound = sfx_manager->newSFX(SFXManager::SOUND_WEE ); - m_ugh_sound = sfx_manager->newSFX(SFXManager::SOUND_UGH ); - m_grab_sound = sfx_manager->newSFX(SFXManager::SOUND_GRAB ); - m_full_sound = sfx_manager->newSFX(SFXManager::SOUND_FULL ); + m_bzzt_sound = sfx_manager->createSoundSource( "bzzt" ); + m_wee_sound = sfx_manager->createSoundSource( "wee" ); + m_ugh_sound = sfx_manager->createSoundSource( "ugh" ); + m_grab_sound = sfx_manager->createSoundSource( "grab" ); + m_full_sound = sfx_manager->createSoundSource( "full" ); reset(); } // PlayerController Modified: main/trunk/src/karts/kart.cpp =================================================================== --- main/trunk/src/karts/kart.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/karts/kart.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -88,8 +88,8 @@ m_view_blocked_by_plunger = 0; - // Initialize custom sound vector - m_custom_sounds.resize(SFXManager::NUM_CUSTOMS); + // Initialize custom sound vector (TODO: add back when properly done) + // m_custom_sounds.resize(SFXManager::NUM_CUSTOMS); // Set position and heading: m_reset_transform = init_transform; @@ -109,21 +109,24 @@ m_kart_mode = KM_RACE; m_wheel_rotation = 0; - // Create SFXBase for each custom sound + // Create SFXBase for each custom sound (TODO: add back when properly done) + /* for (int n = 0; n < SFXManager::NUM_CUSTOMS; n++) { int id = m_kart_properties->getCustomSfxId((SFXManager::CustomSFX)n); // If id == -1 the custom sound was not defined in the .irrkart config file if (id != -1) + { m_custom_sounds[n] = sfx_manager->newSFX(id); - } + } + }*/ - m_engine_sound = sfx_manager->newSFX(m_kart_properties->getEngineSfxType()); - m_beep_sound = sfx_manager->newSFX( SFXManager::SOUND_BEEP ); - m_crash_sound = sfx_manager->newSFX( SFXManager::SOUND_CRASH ); - m_goo_sound = sfx_manager->newSFX( SFXManager::SOUND_GOO ); - m_skid_sound = sfx_manager->newSFX( SFXManager::SOUND_SKID ); + m_engine_sound = sfx_manager->createSoundSource(m_kart_properties->getEngineSfxType()); + m_beep_sound = sfx_manager->createSoundSource( "beep" ); + m_crash_sound = sfx_manager->createSoundSource( "crash" ); + m_goo_sound = sfx_manager->createSoundSource( "goo" ); + m_skid_sound = sfx_manager->createSoundSource( "skid" ); if(!m_engine_sound) { @@ -280,12 +283,13 @@ m_engine_sound->stop(); } - // Delete all custom sounds + // Delete all custom sounds (TODO: add back when properly done) + /* for (int n = 0; n < SFXManager::NUM_CUSTOMS; n++) { if (m_custom_sounds[n] != NULL) sfx_manager->deleteSFX(m_custom_sounds[n]); - } + }*/ sfx_manager->deleteSFX(m_engine_sound ); sfx_manager->deleteSFX(m_crash_sound ); @@ -669,11 +673,13 @@ Moveable::update(dt); + /* (TODO: add back when properly done) for (int n = 0; n < SFXManager::NUM_CUSTOMS; n++) { if (m_custom_sounds[n] != NULL) m_custom_sounds[n]->position ( getXYZ() ); } - + */ + m_beep_sound->position ( getXYZ() ); m_engine_sound->position ( getXYZ() ); m_crash_sound->position ( getXYZ() ); @@ -993,6 +999,10 @@ bool Kart::playCustomSFX(unsigned int type) { + // (TODO: add back when properly done) + return false; + + /* bool ret = false; // Stop all other character voices for this kart before playing a new one @@ -1012,13 +1022,16 @@ if (m_custom_sounds[type] != NULL) { ret = true; - printf("Kart SFX: playing %s for %s.\n", sfx_manager->getCustomTagName(type), m_kart_properties->getIdent().c_str()); + //printf("Kart SFX: playing %s for %s.\n", sfx_manager->getCustomTagName(type), m_kart_properties->getIdent().c_str()); // If it's already playing, let it finish if (m_custom_sounds[type]->getStatus() != SFXManager::SFX_PLAYING) + { m_custom_sounds[type]->play(); + } } } return ret; + */ } // ----------------------------------------------------------------------------- void Kart::updatePhysics (float dt) Modified: main/trunk/src/karts/kart_properties.cpp =================================================================== --- main/trunk/src/karts/kart_properties.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/karts/kart_properties.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -80,10 +80,10 @@ m_version = 0; m_color = video::SColor(255, 0, 0, 0); m_shape = 32; // close enough to a circle. - m_engine_sfx_type = SFXManager::SOUND_ENGINE_SMALL; + m_engine_sfx_type = "engine_small"; + // The default constructor for stk_config uses filename="" - if(filename!="") - load(filename); + if (filename != "") load(filename); } // KartProperties //----------------------------------------------------------------------------- @@ -222,13 +222,13 @@ std::string sfx_type_string; root->get("engine-sound", &sfx_type_string); - if(sfx_type_string == "large") + if (sfx_type_string == "large") { - m_engine_sfx_type = SFXManager::SOUND_ENGINE_LARGE; + m_engine_sfx_type = "engine_large"; } - else if(sfx_type_string == "small") + else if (sfx_type_string == "small") { - m_engine_sfx_type = SFXManager::SOUND_ENGINE_SMALL; + m_engine_sfx_type = "engine_small"; } root->get("has-skidmarks", &m_has_skidmarks); @@ -362,7 +362,8 @@ lisp->get("brake-factor", m_brake_factor); lisp->get("mass", m_mass); - // Load custom kart SFX files + /* + // Load custom kart SFX files (TODO: enable back when it's implemented properly) for (int i = 0; i < SFXManager::NUM_CUSTOMS; i++) { std::string tempFile; @@ -385,24 +386,26 @@ m_custom_sfx_id[i] = -1; } } - +*/ std::string sfx_type_string; lisp->get("engine-sound", sfx_type_string); if(sfx_type_string == "large") { - m_engine_sfx_type = SFXManager::SOUND_ENGINE_LARGE; + m_engine_sfx_type = "engine_large"; } else if(sfx_type_string == "small") { - m_engine_sfx_type = SFXManager::SOUND_ENGINE_SMALL; + m_engine_sfx_type = "engine_small"; } std::vector<float> v; if(lisp->getVector("max-speed-radius", v)) { - if(v.size()!=2) + if (v.size()!=2) + { printf("Incorrect max-speed-angle specifications for kart '%s'\n", getIdent().c_str()); + } else { m_max_speed_turn = v[0]; Modified: main/trunk/src/karts/kart_properties.hpp =================================================================== --- main/trunk/src/karts/kart_properties.hpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/karts/kart_properties.hpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -107,8 +107,7 @@ float m_rubber_band_duration;/**< Duration a rubber band works. */ float m_wheel_base; /**< Wheel base of the kart. */ float m_nitro_power_boost; /**< Nitro power boost. */ - SFXManager::SFXType - m_engine_sfx_type; /**< Engine sound effect. */ + std::string m_engine_sfx_type; /**< Engine sound effect. */ // bullet physics data // ------------------- @@ -207,8 +206,7 @@ float getTimeFullSteerAI () const {return m_time_full_steer_ai; } float getBrakeFactor () const {return m_brake_factor; } float getMaxSpeedReverseRatio () const {return m_max_speed_reverse_ratio; } - SFXManager::SFXType getEngineSfxType() - const {return m_engine_sfx_type; } + const char* getEngineSfxType () const {return m_engine_sfx_type.c_str(); } //bullet physics get functions float getSuspensionStiffness () const {return m_suspension_stiffness; } Modified: main/trunk/src/modes/world_status.cpp =================================================================== --- main/trunk/src/modes/world_status.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/modes/world_status.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -34,8 +34,8 @@ m_phase = SETUP_PHASE; // FIXME - is it a really good idea to reload and delete the sound every race?? - m_prestart_sound = sfx_manager->newSFX(SFXManager::SOUND_PRESTART); - m_start_sound = sfx_manager->newSFX(SFXManager::SOUND_START); + m_prestart_sound = sfx_manager->createSoundSource("prestart"); + m_start_sound = sfx_manager->createSoundSource("start"); } // WorldStatus //----------------------------------------------------------------------------- Modified: main/trunk/src/states_screens/kart_selection.cpp =================================================================== --- main/trunk/src/states_screens/kart_selection.cpp 2010-02-15 16:12:50 UTC (rev 4727) +++ main/trunk/src/states_screens/kart_selection.cpp 2010-02-15 19:17:35 UTC (rev 4728) @@ -423,7 +423,7 @@ playerName->elementRemoved(); playerName = NULL; - SFXManager::quickSound( SFXManager::SOUND_WEE ); + SFXManager::quickSound( "wee" ); modelView->setRotateTo(30.0f, 150.0f); @@ -834,7 +834,7 @@ // Check that this player has not already confirmed, then they can't back out if (m_kart_widg... [truncated message content] |
From: <au...@us...> - 2010-02-16 00:36:56
|
Revision: 4737 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4737&view=rev Author: auria Date: 2010-02-16 00:33:41 +0000 (Tue, 16 Feb 2010) Log Message: ----------- Converted GPs to XML Modified Paths: -------------- main/trunk/data/grandprix/alltracks.grandprix main/trunk/data/grandprix/atworldsend.grandprix main/trunk/data/grandprix/penguinplayground.grandprix main/trunk/data/grandprix/snagdrive.grandprix main/trunk/data/grandprix/tothemoonandback.grandprix main/trunk/data/gui/tracks.stkgui main/trunk/data/po/extract_strings_from_XML.py main/trunk/data/po/fr/LC_MESSAGES/supertuxkart.mo main/trunk/data/po/fr.po main/trunk/data/po/supertuxkart.pot main/trunk/data/po/update_pot.sh main/trunk/src/race/grand_prix_data.cpp main/trunk/src/race/grand_prix_data.hpp main/trunk/src/race/grand_prix_manager.cpp Modified: main/trunk/data/grandprix/alltracks.grandprix =================================================================== --- main/trunk/data/grandprix/alltracks.grandprix 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/grandprix/alltracks.grandprix 2010-02-16 00:33:41 UTC (rev 4737) @@ -1,10 +1,23 @@ -;; -*- mode: lisp -*- -(supertuxkart-grand-prix - (name _("All tracks")) - (description _("All tracks included in SuperTuxKart")) - (tracks "beach" "startrack" "lighthouse" "jungle" "mines" "islandtrack" "sandtrack" "fortmagma" "snowtuxpeak" "crescentcrossing" "olivermath" "racetrack" "city" "xr591" "canyon" "snowmountain" "tuxtollway" "skyline") - (laps 2 3 4 3 3 2 3 3 3 2 4 3 2 3 2 3 2 3) -) +<supertuxkart_grand_prix name="All tracks" description="All tracks included in SuperTuxKart"> -;; EOF ;; + <track id="beach" laps="2" /> + <track id="startrack" laps="3" /> + <track id="lighthouse" laps="4" /> + <track id="jungle" laps="3" /> + <track id="mines" laps="3" /> + <track id="islandtrack" laps="2" /> + <track id="sandtrack" laps="3" /> + <track id="fortmagma" laps="3" /> + <track id="snowtuxpeak" laps="3" /> + <track id="crescentcrossing" laps="2" /> + <track id="olivermath" laps="4" /> + <track id="racetrack" laps="3" /> + <track id="city" laps="2" /> + <track id="xr591" laps="3" /> + <track id="canyon" laps="2" /> + <track id="snowmountain" laps="3" /> + <track id="tuxtollway" laps="2" /> + <track id="skyline" laps="3" /> + +</supertuxkart_grand_prix> Modified: main/trunk/data/grandprix/atworldsend.grandprix =================================================================== --- main/trunk/data/grandprix/atworldsend.grandprix 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/grandprix/atworldsend.grandprix 2010-02-16 00:33:41 UTC (rev 4737) @@ -1,10 +1,11 @@ -;; -*- mode: lisp -*- -(supertuxkart-grand-prix - (name _("At world's end")) - (description _("Last grand prix, longer and harder")) - (tracks "fortmagma" "canyon" "city" "snowtuxpeak" "racetrack") - (laps 3 2 2 3 3) -) +<supertuxkart_grand_prix name="At World's End" description="Last grand prix, longer and harder"> -;; EOF ;; + <track id="fortmagma" laps="3" /> + <track id="canyon" laps="2" /> + <track id="city" laps="2" /> + <track id="snowtuxpeak" laps="3" /> + <track id="racetrack" laps="3" /> + +</supertuxkart_grand_prix> + Modified: main/trunk/data/grandprix/penguinplayground.grandprix =================================================================== --- main/trunk/data/grandprix/penguinplayground.grandprix 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/grandprix/penguinplayground.grandprix 2010-02-16 00:33:41 UTC (rev 4737) @@ -1,10 +1,9 @@ -;; -*- mode: lisp -*- -(supertuxkart-grand-prix - (name _("Penguin Playground")) - (description _("First grand prix, easy to get started")) - (tracks "sandtrack" "snowmountain" "olivermath" "jungle") - (laps 3 3 4 2 ) -) +<supertuxkart_grand_prix name="Penguin Playground" description="First grand prix, easy to get started"> -;; EOF ;; + <track id="sandtrack" laps="3" /> + <track id="snowmountain" laps="3" /> + <track id="olivermath" laps="4" /> + <track id="jungle" laps="2" /> + +</supertuxkart_grand_prix> Modified: main/trunk/data/grandprix/snagdrive.grandprix =================================================================== --- main/trunk/data/grandprix/snagdrive.grandprix 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/grandprix/snagdrive.grandprix 2010-02-16 00:33:41 UTC (rev 4737) @@ -1,10 +1,10 @@ -;; -*- mode: lisp -*- -(supertuxkart-grand-prix - (name _("Snag Drive")) - (description _("Third grand prix")) - (tracks "islandtrack" "tuxtollway" "mines" "crescentcrossing") - (laps 2 2 3 2) -) +<supertuxkart_grand_prix name="Snag Drive" description="Third grand prix"> -;; EOF ;; + <track id="islandtrack" laps="2" /> + <track id="tuxtollway" laps="2" /> + <track id="mines" laps="3" /> + <track id="crescentcrossing" laps="2" /> + +</supertuxkart_grand_prix> + Modified: main/trunk/data/grandprix/tothemoonandback.grandprix =================================================================== --- main/trunk/data/grandprix/tothemoonandback.grandprix 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/grandprix/tothemoonandback.grandprix 2010-02-16 00:33:41 UTC (rev 4737) @@ -1,10 +1,10 @@ -;; -*- mode: lisp -*- -(supertuxkart-grand-prix - (name _("To the Moon and Back")) - (description _("Second grand prix")) - (tracks "lighthouse" "skyline" "startrack" "xr591" "beach") - (laps 4 3 3 3 2 ) -) +<supertuxkart_grand_prix name="To the Moon and Back" description="Second grand prix"> -;; EOF ;; + <track id="lighthouse" laps="4" /> + <track id="skyline" laps="3" /> + <track id="startrack" laps="3" /> + <track id="xr591" laps="3" /> + <track id="beach" laps="2" /> + +</supertuxkart_grand_prix> Modified: main/trunk/data/gui/tracks.stkgui =================================================================== --- main/trunk/data/gui/tracks.stkgui 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/gui/tracks.stkgui 2010-02-16 00:33:41 UTC (rev 4737) @@ -6,8 +6,7 @@ align="center" text_align="center" /> <scrollable_toolbar id="gps" height="175" width="100%" align="center" label_location="each" - square_items="true" align="center" - child_width="160" child_height="120" /> + square_items="true" child_width="160" child_height="120" /> <header width="100%" I18N="Section in track selection screen" text="All Tracks" align="center" text_align="center" /> Modified: main/trunk/data/po/extract_strings_from_XML.py =================================================================== --- main/trunk/data/po/extract_strings_from_XML.py 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/po/extract_strings_from_XML.py 2010-02-16 00:33:41 UTC (rev 4737) @@ -3,7 +3,7 @@ f = open('./data/po/gui_strings.h', 'w') -def traverse(file, node, isChallenge, level=0): +def traverse(file, node, isChallenge, isGP, level=0): for e in node.childNodes: if e.localName == None: @@ -15,7 +15,7 @@ if e.hasAttribute("I18N"): comment = e.getAttribute("I18N") - if isChallenge: + if isChallenge or isGP: if e.hasAttribute("name"): # print "Label=", e.getAttribute("name"), " Comment=", comment line = "" @@ -47,16 +47,26 @@ f.write( line ) - traverse(file, e, isChallenge, level+1) + traverse(file, e, isChallenge, isGP, level+1) filenames = sys.argv[1:] for file in filenames: - print "Parsing", file + #print "Parsing", file isChallenge = False + isGP = False + if file.endswith(".challenge"): isChallenge = True + if file.endswith(".grandprix"): + isGP = True - doc = xml.dom.minidom.parse(file) - traverse(file, doc, isChallenge) + try: + doc = xml.dom.minidom.parse(file) + except: + print "============================================" + print "/!\\ Expat doesn't like ", file, "!" + print "============================================" + + traverse(file, doc, isChallenge, isGP) Modified: main/trunk/data/po/fr/LC_MESSAGES/supertuxkart.mo =================================================================== (Binary files differ) Modified: main/trunk/data/po/fr.po =================================================================== --- main/trunk/data/po/fr.po 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/po/fr.po 2010-02-16 00:33:41 UTC (rev 4737) @@ -2,8 +2,8 @@ msgstr "" "Project-Id-Version: supertuxkart\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-02-01 21:05-0500\n" -"PO-Revision-Date: 2010-02-01 21:06-0500\n" +"POT-Creation-Date: 2010-02-15 19:20-0500\n" +"PO-Revision-Date: 2010-02-15 19:21-0500\n" "Last-Translator: Marianne Gagnon (Auria) <aur...@gm...>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -12,13 +12,13 @@ "X-Poedit-Language: French\n" #. I18N: In the track setup screen (number of laps choice, where %i is the number) -#: src/states_screens/dialogs/track_info_dialog.cpp:114 +#: src/states_screens/dialogs/track_info_dialog.cpp:116 #, c-format msgid "%i laps" msgstr "%i tours" #. I18N: as in "fastest lap: 60 seconds by Wilber" -#: src/modes/linear_world.cpp:263 +#: src/modes/linear_world.cpp:270 #, c-format msgid "%s by %s" msgstr "%s par %s" @@ -28,7 +28,7 @@ msgid "%s is ready" msgstr "%s est prêt" -#: src/modes/world.cpp:461 +#: src/modes/world.cpp:520 #, c-format msgid "" "'%s' has\n" @@ -38,7 +38,7 @@ "été éliminé." #. I18N: for empty highscores entries -#: src/states_screens/dialogs/track_info_dialog.cpp:237 +#: src/states_screens/dialogs/track_info_dialog.cpp:238 msgid "(Empty)" msgstr "(Vide)" @@ -66,7 +66,7 @@ msgstr "* Le jeu va automatiquement détecter quelle configuration utiliser selon la touche 'feu' utilisée pour se joindre au jeu." #. I18N: Game mode -#: src/race/race_manager.hpp:121 +#: src/race/race_manager.hpp:120 msgid "3 Strikes Battle" msgstr "Combat 3 Prises" @@ -76,10 +76,14 @@ msgid "3 Strikes Battle : only in multiplayer games. Hit others with weapons until they lose all their lives." msgstr "Combat '3 prises' : seulement dans les jeux multijoueurs. Utilise des armes pour faire perdre leurs vies à tes rivaux !" -#: src/states_screens/dialogs/track_info_dialog.cpp:161 +#: src/states_screens/dialogs/track_info_dialog.cpp:163 msgid "= Highscores =" msgstr "= Meilleurs scores =" +#: src/states_screens/dialogs/race_over_dialog.cpp:229 +msgid "Abort Grand Prix" +msgstr "Abandonner le Grand Prix" + #. I18N: ./data/gui/main.stkgui #. I18N: Main menu button #: data/po/gui_strings.h:194 @@ -93,7 +97,7 @@ msgstr "Accélérer" #. I18N: In the 'add new input device' dialog -#: src/states_screens/dialogs/add_device_dialog.cpp:56 +#: src/states_screens/dialogs/add_device_dialog.cpp:58 msgid "Add Keyboard Configuration" msgstr "Ajouter un clavier" @@ -119,21 +123,31 @@ #. I18N: ./data/gui/arenas.stkgui #. I18N: track group #: src/states_screens/kart_selection.cpp:723 -#: src/states_screens/tracks_screen.cpp:56 +#: src/states_screens/tracks_screen.cpp:61 #: data/po/gui_strings.h:15 msgid "All" msgstr "Tout" #. I18N: ./data/gui/tracks.stkgui #. I18N: Section in track selection screen -#: data/po/gui_strings.h:412 +#: data/po/gui_strings.h:400 msgid "All Tracks" msgstr "Toutes les pistes" -#: src/states_screens/race_setup_screen.cpp:164 +#: src/states_screens/race_setup_screen.cpp:124 msgid "All blows allowed, so catch weapons and make clever use of them!" msgstr "Tous les coups sont permis, alors collecte des armes et utilise-les astucieusement!" +#. I18N: ./data/grandprix/alltracks.grandprix +#: data/po/gui_strings.h:475 +msgid "All tracks" +msgstr "Toutes les pistes" + +#. I18N: ./data/grandprix/alltracks.grandprix +#: data/po/gui_strings.h:478 +msgid "All tracks included in SuperTuxKart" +msgstr "Toutes les pistes de SuperTuxKart" + #. I18N: ./data/gui/help2.stkgui #: data/po/gui_strings.h:116 msgid "Anchor - slows down greatly the kart in the first position" @@ -151,8 +165,8 @@ msgid "Arenas" msgstr "Arènes" -#. I18N: ./data/gui/tracks.stkgui -#: data/po/gui_strings.h:408 +#. I18N: ./data/grandprix/atworldsend.grandprix +#: data/po/gui_strings.h:481 msgid "At World's End" msgstr "Au bout du monde" @@ -202,7 +216,7 @@ msgstr "Retour" #. I18N: In the 'paused' screen -#: src/states_screens/dialogs/race_paused_dialog.cpp:67 +#: src/states_screens/dialogs/race_paused_dialog.cpp:70 msgid "Back to Race" msgstr "Retour à la course" @@ -213,7 +227,7 @@ msgid "Back to main menu" msgstr "Retour au menu principal" -#: src/states_screens/dialogs/race_over_dialog.cpp:232 +#: src/states_screens/dialogs/race_over_dialog.cpp:249 msgid "Back to the main menu" msgstr "Retour au menu principal" @@ -240,14 +254,15 @@ msgid "Cake - thrown at the closest rival, best on short ranges and long straights" msgstr "Gâteau - lance-le sur ton plus proche rival, idéal sur courtes distances et sur les routes droites" -#: src/states_screens/dialogs/add_device_dialog.cpp:71 -#: src/states_screens/dialogs/enter_player_name_dialog.cpp:69 -#: src/states_screens/dialogs/player_info_dialog.cpp:85 +#: src/states_screens/dialogs/add_device_dialog.cpp:73 +#: src/states_screens/dialogs/confirm_resolution_dialog.cpp:79 +#: src/states_screens/dialogs/enter_player_name_dialog.cpp:72 +#: src/states_screens/dialogs/player_info_dialog.cpp:87 msgid "Cancel" msgstr "Annuler" #. I18N: In the player info dialog (when deleting) -#: src/states_screens/dialogs/player_info_dialog.cpp:165 +#: src/states_screens/dialogs/player_info_dialog.cpp:169 msgid "Cancel Remove" msgstr "Annuler la supression" @@ -270,7 +285,7 @@ msgstr "Choisis un Kart" #. I18N: ./data/tracks/crescentcrossing/crescentcrossing.challenge -#: data/po/gui_strings.h:463 +#: data/po/gui_strings.h:451 msgid "Collect Nitro in Math Class" msgstr "Nitro dans la classe de maths !" @@ -281,7 +296,7 @@ msgstr "Ramasse les boîtes bleues : elles contiennent des armes et divers bonus" #. I18N: ./data/grandprix/tothemoonandback.challenge -#: data/po/gui_strings.h:439 +#: data/po/gui_strings.h:427 msgid "Collect the Pharaohs Treasure" msgstr "Le trésor du Pharaon" @@ -292,16 +307,21 @@ msgstr "La nitro que tu collectes peut être ensuite utilisée pour te propulser vers l'avant en utilisant la touche correspondante. Ton niveau de nitro est visible dans la barre à la droite de l'écran." #. I18N: ./data/grandprix/alltracks.challenge -#: data/po/gui_strings.h:424 +#: data/po/gui_strings.h:412 msgid "Come first in the At World's End Grand Prix with 3 'Racer' Level AI karts." msgstr "Arrive premier dans le grand prix 'Au bout du monde' contre 3 opposants virtuels de niveau élevé." #. I18N: In the player info dialog (when deleting) -#: src/states_screens/dialogs/player_info_dialog.cpp:147 +#: src/states_screens/dialogs/player_info_dialog.cpp:151 msgid "Confirm Remove" msgstr "Confirme la suppression" -#: src/states_screens/race_setup_screen.cpp:170 +#: src/states_screens/dialogs/confirm_resolution_dialog.cpp:126 +#, c-format +msgid "Confirm resolution within %i seconds" +msgstr "Confirme la résolution dans les %i prochaines secondes." + +#: src/states_screens/race_setup_screen.cpp:131 msgid "Contains no powerups, so only your driving skills matter!" msgstr "Aucun bonus dans les pistes - seule ton habileté compte !" @@ -310,7 +330,7 @@ msgid "Continue" msgstr "Continuer" -#: src/states_screens/dialogs/race_over_dialog.cpp:227 +#: src/states_screens/dialogs/race_over_dialog.cpp:244 msgid "Continue Grand Prix" msgstr "Continuer le Grand Prix" @@ -333,7 +353,7 @@ msgstr "Crédits" #. I18N: In the player info dialog (when deleting) -#: src/states_screens/dialogs/player_info_dialog.cpp:131 +#: src/states_screens/dialogs/player_info_dialog.cpp:135 #, c-format msgid "Do you really want to delete player '%s' ?" msgstr "Voulez-vous vraiment supprimer le joueur '%s' ?" @@ -346,12 +366,12 @@ msgstr "Activé" #. I18N: In the 'add new player' dialog -#: src/states_screens/dialogs/enter_player_name_dialog.cpp:35 +#: src/states_screens/dialogs/enter_player_name_dialog.cpp:38 msgid "Enter the new player's name" msgstr "Entre le nom du nouveau joueur" #. I18N: In the 'paused' screen -#: src/states_screens/dialogs/race_paused_dialog.cpp:136 +#: src/states_screens/dialogs/race_paused_dialog.cpp:139 msgid "Exit Race" msgstr "Quitter la course" @@ -361,56 +381,56 @@ msgid "Expert" msgstr "Expert" -#: src/states_screens/feature_unlocked.cpp:234 +#: src/states_screens/feature_unlocked.cpp:246 msgid "Feature Unlocked" msgstr "Fonctionnalité Déverouillée" -#: src/modes/linear_world.cpp:229 +#: src/modes/linear_world.cpp:233 msgid "Final lap!" msgstr "Dernier tour!" #. I18N: ./data/tracks/jungle/jungle.challenge -#: data/po/gui_strings.h:478 +#: data/po/gui_strings.h:466 msgid "Finish 3 laps in Racetrack with 3 easy AI karts in under 2:40 minutes." msgstr "Finis 3 tours dans 'Piste de course' avec trois opposants virtuels novices en 2:40." #. I18N: ./data/tracks/snowtuxpeak/snowtuxpeak.challenge -#: data/po/gui_strings.h:484 +#: data/po/gui_strings.h:472 msgid "Finish 3 laps on the City track with 3 AI karts in under 4:20 minutes." msgstr "Finis 3 tours dans la piste 'Ville' contre 3 opposants virtuels en 4:20." #. I18N: ./data/tracks/canyon/canyon.challenge -#: data/po/gui_strings.h:454 +#: data/po/gui_strings.h:442 msgid "Finish 3 laps on the Tux Tollway track with 3 AI karts in under 3:35 minutes." msgstr "Finis 3 tours dans 'L'autoroute de Tux' contre 3 opposants virtuels en 3:35." #. I18N: ./data/tracks/jungle/jungle.challenge -#: data/po/gui_strings.h:475 +#: data/po/gui_strings.h:463 msgid "Finish Race track in 2:40" msgstr "Piste de course en 2:40" #. I18N: ./data/tracks/canyon/canyon.challenge -#: data/po/gui_strings.h:451 +#: data/po/gui_strings.h:439 msgid "Finish Tux Tollway track in 3:35" msgstr "L'autoroute de Tux en 3:35" #. I18N: ./data/tracks/snowtuxpeak/snowtuxpeak.challenge -#: data/po/gui_strings.h:481 +#: data/po/gui_strings.h:469 msgid "Finish the City track in 4:20" msgstr "Course dans la ville en 4:20" #. I18N: ./data/tracks/crescentcrossing/crescentcrossing.challenge -#: data/po/gui_strings.h:466 +#: data/po/gui_strings.h:454 msgid "Finish with at least 6 points of nitro on three laps of Oliver's Math Class in under 52 seconds." msgstr "Ramasse au moins 6 points de nitro en 3 tours de 'La classe de Maths d'Oliver' en 52 secondes." #. I18N: ./data/grandprix/tothemoonandback.challenge -#: data/po/gui_strings.h:442 +#: data/po/gui_strings.h:430 msgid "Finish with at least 9 nitro points on 3 laps of Shifting Sands in under 2:20 minutes." msgstr "Ramasse au moins 9 points de nitro en 3 tours sur la piste 'Sables mouvants' en 2:20." #. I18N: Shown at the end of a race -#: src/states_screens/race_gui.cpp:76 +#: src/states_screens/race_gui.cpp:75 msgid "Finished" msgstr "Fini" @@ -420,18 +440,23 @@ msgid "Fire" msgstr "Tirer" +#. I18N: ./data/grandprix/penguinplayground.grandprix +#: data/po/gui_strings.h:496 +msgid "First grand prix, easy to get started" +msgstr "Premier grand prix, facile pour commencer" + #. I18N: Game mode -#: src/race/race_manager.hpp:119 +#: src/race/race_manager.hpp:118 msgid "Follow the Leader" msgstr "Suis le meneur" #. I18N: ./data/tracks/city/city.challenge -#: data/po/gui_strings.h:457 +#: data/po/gui_strings.h:445 msgid "Follow the Leader in the Jungle" msgstr "Suis le meneur dans la jungle" #. I18N: ./data/grandprix/atworldsend.challenge -#: data/po/gui_strings.h:427 +#: data/po/gui_strings.h:415 msgid "Follow the Leader on a Desert Island" msgstr "Suis le meneur sur une île déserte" @@ -483,7 +508,7 @@ msgid "General" msgstr "Général" -#: src/states_screens/race_gui.cpp:81 +#: src/states_screens/race_gui.cpp:80 msgid "Go!" msgstr "Partez!" @@ -496,16 +521,16 @@ #. I18N: In the 'paused' screen #. I18N: ./data/gui/main.stkgui #. I18N: Main menu button -#: src/states_screens/dialogs/race_paused_dialog.cpp:126 +#: src/states_screens/dialogs/race_paused_dialog.cpp:129 #: data/po/gui_strings.h:190 msgid "Help" msgstr "Aide" -#: src/states_screens/dialogs/race_over_dialog.cpp:153 +#: src/states_screens/dialogs/race_over_dialog.cpp:158 msgid "Highscores" msgstr "Meilleurs scores" -#: src/states_screens/race_setup_screen.cpp:190 +#: src/states_screens/race_setup_screen.cpp:153 msgid "Hit others with weapons until they lose all their lives. (Only in multiplayer games)" msgstr "" "Combat '3 prises' \n" @@ -523,16 +548,26 @@ msgid "Intermediate" msgstr "Intermédiaire" +#. I18N: In the 'confirm resolution' dialog, that's shown when switching resoluton +#: src/states_screens/dialogs/confirm_resolution_dialog.cpp:63 +msgid "Keep this resolution" +msgstr "Conserver cette résolution." + #: src/states_screens/options_screen_input.cpp:234 #, c-format msgid "Keyboard %i" msgstr "Clavier %i" -#: src/states_screens/race_gui.cpp:77 +#: src/states_screens/race_gui.cpp:76 msgid "Lap" msgstr "Tour" -#: src/modes/follow_the_leader.cpp:152 +#. I18N: ./data/grandprix/atworldsend.grandprix +#: data/po/gui_strings.h:484 +msgid "Last grand prix, longer and harder" +msgstr "Dernier grand prix, plus long et difficile" + +#: src/modes/follow_the_leader.cpp:128 msgid "Leader" msgstr "Meneur" @@ -544,11 +579,15 @@ #: src/states_screens/arenas_screen.cpp:83 #: src/states_screens/challenges.cpp:83 -#: src/states_screens/race_setup_screen.cpp:175 -#: src/states_screens/tracks_screen.cpp:151 +#: src/states_screens/race_setup_screen.cpp:136 +#: src/states_screens/tracks_screen.cpp:199 msgid "Locked : solve active challenges to gain access to more!" msgstr "Barré : relève des défis pour accéder à plus!" +#: src/states_screens/tracks_screen.cpp:175 +msgid "Locked!" +msgstr "Verrouillé!" + #. I18N: ./data/gui/options_input.stkgui #. I18N: Key binding #: data/po/gui_strings.h:328 @@ -585,7 +624,7 @@ msgid "Networking" msgstr "Jeu en ligne" -#: src/challenges/challenge.cpp:123 +#: src/challenges/challenge.cpp:121 #, c-format msgid "" "New Grand Prix '%s'\n" @@ -594,7 +633,7 @@ "Nouveau grand prix\n" "'%s' déverrouillé" -#: src/challenges/challenge.cpp:129 +#: src/challenges/challenge.cpp:127 #, c-format msgid "" "New difficulty\n" @@ -605,11 +644,11 @@ "'%s'\n" "déverrouillée" -#: src/modes/linear_world.cpp:257 +#: src/modes/linear_world.cpp:264 msgid "New fastest lap" msgstr "Meilleur temps" -#: src/challenges/challenge.cpp:116 +#: src/challenges/challenge.cpp:114 #, c-format msgid "" "New game mode\n" @@ -620,7 +659,7 @@ "jeu déverrouillé :\n" "'%s'" -#: src/challenges/challenge.cpp:135 +#: src/challenges/challenge.cpp:133 #, c-format msgid "" "New kart\n" @@ -631,7 +670,7 @@ "'%s'\n" "déverrouillé" -#: src/challenges/challenge.cpp:110 +#: src/challenges/challenge.cpp:108 #, c-format msgid "" "New track '%s'\n" @@ -648,7 +687,7 @@ msgstr "Nitro" #. I18N: Game mode -#: src/race/race_manager.hpp:115 +#: src/race/race_manager.hpp:114 msgid "Normal Race" msgstr "Course Normale" @@ -667,7 +706,7 @@ #. I18N: In the 'paused' screen #. I18N: ./data/gui/main.stkgui #. I18N: Main menu button -#: src/states_screens/dialogs/race_paused_dialog.cpp:116 +#: src/states_screens/dialogs/race_paused_dialog.cpp:119 #: data/po/gui_strings.h:186 msgid "Options" msgstr "Options" @@ -677,16 +716,16 @@ msgid "Parachute - slows down all karts in a better position!" msgstr "Parachute - ralentit tous les karts en meilleure position que toi !" -#: src/states_screens/dialogs/race_paused_dialog.cpp:54 +#: src/states_screens/dialogs/race_paused_dialog.cpp:57 msgid "Paused" msgstr "Pause" -#: src/karts/player_kart.cpp:254 +#: src/karts/controller/player_controller.cpp:251 msgid "Penalty time!!" msgstr "Temps de pénalité !" -#. I18N: ./data/gui/tracks.stkgui -#: data/po/gui_strings.h:399 +#. I18N: ./data/grandprix/penguinplayground.grandprix +#: data/po/gui_strings.h:493 msgid "Penguin Playground" msgstr "Pour jeunes pingouins" @@ -714,11 +753,11 @@ msgid "Plunger - throw straight to pull an opponent back, or throw while looking back to make one lose sight!" msgstr "Débouchoir à ventouse - lance-le droit devant pour tirer un opposant vers l'arrière, ou lance-le en regardant vers l'arrière pour lui obstruer la vue !" -#: src/states_screens/dialogs/press_a_key_dialog.cpp:49 +#: src/states_screens/dialogs/press_a_key_dialog.cpp:51 msgid "Press ESC to cancel" msgstr "Appuie sur <ESC> pour annuler" -#: src/states_screens/dialogs/press_a_key_dialog.cpp:32 +#: src/states_screens/dialogs/press_a_key_dialog.cpp:34 msgid "Press a key" msgstr "Appuie sur une touche" @@ -740,7 +779,7 @@ msgid "Race" msgstr "Course" -#: src/states_screens/dialogs/race_over_dialog.cpp:61 +#: src/states_screens/dialogs/race_over_dialog.cpp:62 msgid "Race Results" msgstr "Résultats de la course" @@ -749,7 +788,7 @@ msgid "Race Setup" msgstr "Réglages de la course" -#: src/states_screens/dialogs/race_over_dialog.cpp:213 +#: src/states_screens/dialogs/race_over_dialog.cpp:215 msgid "Race in this track again" msgstr "Rejouer cette piste" @@ -763,12 +802,12 @@ msgid "Random Kart" msgstr "Kart aléatoire" -#: src/states_screens/tracks_screen.cpp:158 +#: src/states_screens/tracks_screen.cpp:209 msgid "Random Track" msgstr "Piste aléatoire" #. I18N: as in "ready, set, go", shown at the beginning of the race -#: src/states_screens/race_gui.cpp:79 +#: src/states_screens/race_gui.cpp:78 msgid "Ready!" msgstr "À vos marques..." @@ -779,12 +818,12 @@ msgstr "Course normale - tous les coups sont permis, alors utilise les armes pour t'aider à gagner!" #. I18N: In the player info dialog -#: src/states_screens/dialogs/player_info_dialog.cpp:103 +#: src/states_screens/dialogs/player_info_dialog.cpp:105 msgid "Remove" msgstr "Supprimer" #. I18N: In the player info dialog -#: src/states_screens/dialogs/player_info_dialog.cpp:70 +#: src/states_screens/dialogs/player_info_dialog.cpp:72 msgid "Rename" msgstr "Renommer" @@ -795,7 +834,7 @@ msgstr "Sauvetage" #. I18N: In the 'paused' screen -#: src/states_screens/dialogs/race_paused_dialog.cpp:106 +#: src/states_screens/dialogs/race_paused_dialog.cpp:109 msgid "Restart Race" msgstr "Recommencer la course" @@ -805,22 +844,27 @@ msgid "Right" msgstr "Droite" -#: src/states_screens/race_setup_screen.cpp:182 +#: src/states_screens/race_setup_screen.cpp:144 msgid "Run for second place, as the last kart will be disqualified every time the counter hits zero. Beware : going in front of the leader will get you eliminated too!" msgstr "vise la seconde place, car lorsque le compte à rebours atteint zéro, le dernier est éliminé. Attention: dépasser le meneur n'est pas non plus recommendé, car là aussi tu risques l'élimination!" +#. I18N: ./data/grandprix/tothemoonandback.grandprix +#: data/po/gui_strings.h:508 +msgid "Second grand prix" +msgstr "Second grand prix" + #. I18N: ./data/gui/racesetup.stkgui #: data/po/gui_strings.h:392 msgid "Select a game mode" msgstr "Choisis un mode de jeu" -#: src/states_screens/race_gui.cpp:80 +#: src/states_screens/race_gui.cpp:79 msgid "Set!" msgstr "Prêts" #. I18N: In the 'paused' screen -#: src/states_screens/dialogs/race_over_dialog.cpp:201 -#: src/states_screens/dialogs/race_paused_dialog.cpp:96 +#: src/states_screens/dialogs/race_over_dialog.cpp:204 +#: src/states_screens/dialogs/race_paused_dialog.cpp:99 msgid "Setup New Race" msgstr "Nouvelle course" @@ -830,8 +874,8 @@ msgid "Sharp Turn" msgstr "Virage brusque" -#. I18N: ./data/gui/tracks.stkgui -#: data/po/gui_strings.h:402 +#. I18N: ./data/grandprix/snagdrive.grandprix +#: data/po/gui_strings.h:499 msgid "Snag Drive" msgstr "Chemin des Embûches" @@ -847,7 +891,11 @@ msgid "Standard" msgstr "Standard" -#: src/states_screens/dialogs/track_info_dialog.cpp:125 +#: src/states_screens/dialogs/gp_info_dialog.cpp:137 +msgid "Start Grand Prix" +msgstr "Commencer le Grand Prix" + +#: src/states_screens/dialogs/track_info_dialog.cpp:127 msgid "Start Race" msgstr "Commencer la course" @@ -888,8 +936,13 @@ "Le fichier des meilleurs scores était\n" "trop vieux, il a donc été supprimé." +#. I18N: ./data/grandprix/snagdrive.grandprix +#: data/po/gui_strings.h:502 +msgid "Third grand prix" +msgstr "Troisième grand prix" + #. I18N: Game mode -#: src/race/race_manager.hpp:117 +#: src/race/race_manager.hpp:116 msgid "Time Trial" msgstr "Contre la Montre" @@ -899,7 +952,7 @@ msgid "Time Trial: Contains no powerups, so only your driving skills matter!" msgstr "Contre la montre : aucun bonus dans les pistes - seule ton habileté compte !" -#: src/states_screens/dialogs/add_device_dialog.cpp:45 +#: src/states_screens/dialogs/add_device_dialog.cpp:47 msgid "" "To add a new Gamepad/Joystick device, simply start SuperTuxKart with it connected and it will appear in the list.\n" "\n" @@ -915,8 +968,8 @@ msgid "To help you win, there are some powerups you can collect :" msgstr "Pour t'aider à gagner, voici certains bonus que tu peux ramasser :" -#. I18N: ./data/gui/tracks.stkgui -#: data/po/gui_strings.h:405 +#. I18N: ./data/grandprix/tothemoonandback.grandprix +#: data/po/gui_strings.h:505 msgid "To the Moon and Back" msgstr "Jusqu'à la lune" @@ -932,7 +985,7 @@ msgid "Video" msgstr "Vidéo" -#: src/modes/linear_world.cpp:612 +#: src/modes/linear_world.cpp:622 msgid "WRONG WAY!" msgstr "MAUVAISE DIRECTION !" @@ -949,65 +1002,65 @@ msgstr "Armes" #. I18N: ./data/followtheleader.challenge -#: data/po/gui_strings.h:415 +#: data/po/gui_strings.h:403 msgid "Win Penguin Playground Grand Prix" msgstr "Gagne le Grand Prix 'Pour jeunes pingouins'" #. I18N: ./data/followtheleader.challenge -#: data/po/gui_strings.h:418 +#: data/po/gui_strings.h:406 msgid "Win Penguin Playground Grand Prix with 3 'Racer' Level AI karts." msgstr "Remporte le grand prix 'Jusqu'à la lune' contre 3 opposants virtuels expérimentés." #. I18N: ./data/grandprix/snagdrive.challenge -#: data/po/gui_strings.h:433 +#: data/po/gui_strings.h:421 msgid "Win To the Moon and Back Grand Prix" msgstr "Remporte le grand prix 'Jusqu'à la lune'." #. I18N: ./data/tracks/fortmagma/fortmagma.challenge -#: data/po/gui_strings.h:472 +#: data/po/gui_strings.h:460 msgid "Win a 1 lap Head to Head on Tux Tollway against 1 'Racer' level AI kart." msgstr "Remporte un duel d'un tour sur l'Autoroute de Tux contre un opposant virtuel expérimenté." #. I18N: ./data/karts/gnu/gnu.challenge -#: data/po/gui_strings.h:448 +#: data/po/gui_strings.h:436 msgid "Win a 4 lap race on Snow Mountain against 4 'Racer' level AI kart." msgstr "Remporte un duel d'un tour sur l'Autoroute de Tux contre un opposant virtuel expérimenté." #. I18N: ./data/tracks/city/city.challenge -#: data/po/gui_strings.h:460 +#: data/po/gui_strings.h:448 msgid "Win a Follow the Leader race with 3 AI karts in the Amazonian Jungle." msgstr "Remporte une course de type 'Suis le meneur' contre 3 opposants dans la jungle." #. I18N: ./data/grandprix/atworldsend.challenge -#: data/po/gui_strings.h:430 +#: data/po/gui_strings.h:418 msgid "Win a Follow the Leader race with 3 AI karts on a Desert Island." msgstr "Remporte une course de type 'Suis le meneur' contre 3 opposants sur un île déserte." #. I18N: ./data/tracks/fortmagma/fortmagma.challenge -#: data/po/gui_strings.h:469 +#: data/po/gui_strings.h:457 msgid "Win a Head to Head on Tux Tollway" msgstr "Remporte un duel sur l'Autoroute de Tux." #. I18N: ./data/karts/gnu/gnu.challenge -#: data/po/gui_strings.h:445 +#: data/po/gui_strings.h:433 msgid "Win a race on Snow Mountain" msgstr "Remporte une course sur \"Sommet enneigé\"" #. I18N: ./data/grandprix/alltracks.challenge -#: data/po/gui_strings.h:421 +#: data/po/gui_strings.h:409 msgid "Win the At World's End Grand Prix" msgstr "Remporte le grand prix 'Au bout du monde'." #. I18N: ./data/grandprix/snagdrive.challenge -#: data/po/gui_strings.h:436 +#: data/po/gui_strings.h:424 msgid "Win the To the Moon and Back Grand Prix with 3 'Racer' Level AI karts." msgstr "Remporte le grand prix 'Jusqu'à la lune' contre 3 opposants virtuels expérimentés." -#: src/karts/player_kart.cpp:354 +#: src/karts/controller/player_controller.cpp:342 msgid "You finished the race!" msgstr "Tu as fini la course !" -#: src/modes/world.cpp:457 +#: src/modes/world.cpp:516 msgid "" "You have been\n" "eliminated!" @@ -1015,7 +1068,7 @@ "Tu as été\n" "éliminé !" -#: src/karts/player_kart.cpp:353 +#: src/karts/controller/player_controller.cpp:341 msgid "You won the race!" msgstr "Tu as gagné la course !" @@ -1037,10 +1090,6 @@ #~ msgid "Special" #~ msgstr "Spécial" -#~ msgid "All tracks" -#~ msgstr "Toutes les pistes" -#~ msgid "All tracks included in SuperTuxKart" -#~ msgstr "Toutes les pistes de SuperTuxKart" #~ msgid "Amazonian Journey" #~ msgstr "Voyage en Amazonie" #~ msgid "Around the Lighthouse" @@ -1067,14 +1116,10 @@ #~ "modifié par Marianne Gagnon" #~ msgid "Crescent Crossing" #~ msgstr "Sous la pleine lune" -#~ msgid "First grand prix, easy to get started" -#~ msgstr "Premier grand prix, facile pour commencer" #~ msgid "Fort Magma" #~ msgstr "Fort Magma" #~ msgid "King Weird's Castle" #~ msgstr "Château du Roi Tordu" -#~ msgid "Last grand prix, longer and harder" -#~ msgstr "Dernier grand prix, plus long et difficile" #~ msgid "Oliver's Math Class" #~ msgstr "Classe de maths d'Oliver" #~ msgid "On the Beach" @@ -1083,8 +1128,6 @@ #~ msgstr "Île préhistorique" #~ msgid "Racetrack" #~ msgstr "Piste de course" -#~ msgid "Second grand prix" -#~ msgstr "Second grand prix" #~ msgid "Secret Garden" #~ msgstr "Jardin Secret" #~ msgid "Shifting Sands" @@ -1101,8 +1144,6 @@ #~ msgstr "L'île" #~ msgid "The old mine" #~ msgstr "La vieille mine" -#~ msgid "Third grand prix" -#~ msgstr "Troisième grand prix" #~ msgid "Tux Tollway" #~ msgstr "Autoroute de Tux" #~ msgid "XR591" Modified: main/trunk/data/po/supertuxkart.pot =================================================================== --- main/trunk/data/po/supertuxkart.pot 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/po/supertuxkart.pot 2010-02-16 00:33:41 UTC (rev 4737) @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-02-01 21:05-0500\n" +"POT-Creation-Date: 2010-02-15 19:20-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -17,13 +17,13 @@ "Content-Transfer-Encoding: 8bit\n" #. I18N: In the track setup screen (number of laps choice, where %i is the number) -#: src/states_screens/dialogs/track_info_dialog.cpp:114 +#: src/states_screens/dialogs/track_info_dialog.cpp:116 #, c-format msgid "%i laps" msgstr "" #. I18N: as in "fastest lap: 60 seconds by Wilber" -#: src/modes/linear_world.cpp:263 +#: src/modes/linear_world.cpp:270 #, c-format msgid "%s by %s" msgstr "" @@ -33,7 +33,7 @@ msgid "%s is ready" msgstr "" -#: src/modes/world.cpp:461 +#: src/modes/world.cpp:520 #, c-format msgid "" "'%s' has\n" @@ -41,7 +41,7 @@ msgstr "" #. I18N: for empty highscores entries -#: src/states_screens/dialogs/track_info_dialog.cpp:237 +#: src/states_screens/dialogs/track_info_dialog.cpp:238 msgid "(Empty)" msgstr "" @@ -75,7 +75,7 @@ msgstr "" #. I18N: Game mode -#: src/race/race_manager.hpp:121 +#: src/race/race_manager.hpp:120 msgid "3 Strikes Battle" msgstr "" @@ -87,10 +87,14 @@ "they lose all their lives." msgstr "" -#: src/states_screens/dialogs/track_info_dialog.cpp:161 +#: src/states_screens/dialogs/track_info_dialog.cpp:163 msgid "= Highscores =" msgstr "" +#: src/states_screens/dialogs/race_over_dialog.cpp:229 +msgid "Abort Grand Prix" +msgstr "" + #. I18N: ./data/gui/main.stkgui #. I18N: Main menu button #: data/po/gui_strings.h:194 @@ -104,7 +108,7 @@ msgstr "" #. I18N: In the 'add new input device' dialog -#: src/states_screens/dialogs/add_device_dialog.cpp:56 +#: src/states_screens/dialogs/add_device_dialog.cpp:58 msgid "Add Keyboard Configuration" msgstr "" @@ -130,20 +134,30 @@ #. I18N: ./data/gui/arenas.stkgui #. I18N: track group #: src/states_screens/kart_selection.cpp:723 -#: src/states_screens/tracks_screen.cpp:56 data/po/gui_strings.h:15 +#: src/states_screens/tracks_screen.cpp:61 data/po/gui_strings.h:15 msgid "All" msgstr "" #. I18N: ./data/gui/tracks.stkgui #. I18N: Section in track selection screen -#: data/po/gui_strings.h:412 +#: data/po/gui_strings.h:400 msgid "All Tracks" msgstr "" -#: src/states_screens/race_setup_screen.cpp:164 +#: src/states_screens/race_setup_screen.cpp:124 msgid "All blows allowed, so catch weapons and make clever use of them!" msgstr "" +#. I18N: ./data/grandprix/alltracks.grandprix +#: data/po/gui_strings.h:475 +msgid "All tracks" +msgstr "" + +#. I18N: ./data/grandprix/alltracks.grandprix +#: data/po/gui_strings.h:478 +msgid "All tracks included in SuperTuxKart" +msgstr "" + #. I18N: ./data/gui/help2.stkgui #: data/po/gui_strings.h:116 msgid "Anchor - slows down greatly the kart in the first position" @@ -161,8 +175,8 @@ msgid "Arenas" msgstr "" -#. I18N: ./data/gui/tracks.stkgui -#: data/po/gui_strings.h:408 +#. I18N: ./data/grandprix/atworldsend.grandprix +#: data/po/gui_strings.h:481 msgid "At World's End" msgstr "" @@ -208,7 +222,7 @@ msgstr "" #. I18N: In the 'paused' screen -#: src/states_screens/dialogs/race_paused_dialog.cpp:67 +#: src/states_screens/dialogs/race_paused_dialog.cpp:70 msgid "Back to Race" msgstr "" @@ -218,7 +232,7 @@ msgid "Back to main menu" msgstr "" -#: src/states_screens/dialogs/race_over_dialog.cpp:232 +#: src/states_screens/dialogs/race_over_dialog.cpp:249 msgid "Back to the main menu" msgstr "" @@ -246,14 +260,15 @@ "Cake - thrown at the closest rival, best on short ranges and long straights" msgstr "" -#: src/states_screens/dialogs/add_device_dialog.cpp:71 -#: src/states_screens/dialogs/enter_player_name_dialog.cpp:69 -#: src/states_screens/dialogs/player_info_dialog.cpp:85 +#: src/states_screens/dialogs/add_device_dialog.cpp:73 +#: src/states_screens/dialogs/confirm_resolution_dialog.cpp:79 +#: src/states_screens/dialogs/enter_player_name_dialog.cpp:72 +#: src/states_screens/dialogs/player_info_dialog.cpp:87 msgid "Cancel" msgstr "" #. I18N: In the player info dialog (when deleting) -#: src/states_screens/dialogs/player_info_dialog.cpp:165 +#: src/states_screens/dialogs/player_info_dialog.cpp:169 msgid "Cancel Remove" msgstr "" @@ -276,7 +291,7 @@ msgstr "" #. I18N: ./data/tracks/crescentcrossing/crescentcrossing.challenge -#: data/po/gui_strings.h:463 +#: data/po/gui_strings.h:451 msgid "Collect Nitro in Math Class" msgstr "" @@ -287,7 +302,7 @@ msgstr "" #. I18N: ./data/grandprix/tothemoonandback.challenge -#: data/po/gui_strings.h:439 +#: data/po/gui_strings.h:427 msgid "Collect the Pharaohs Treasure" msgstr "" @@ -301,17 +316,22 @@ msgstr "" #. I18N: ./data/grandprix/alltracks.challenge -#: data/po/gui_strings.h:424 +#: data/po/gui_strings.h:412 msgid "" "Come first in the At World's End Grand Prix with 3 'Racer' Level AI karts." msgstr "" #. I18N: In the player info dialog (when deleting) -#: src/states_screens/dialogs/player_info_dialog.cpp:147 +#: src/states_screens/dialogs/player_info_dialog.cpp:151 msgid "Confirm Remove" msgstr "" -#: src/states_screens/race_setup_screen.cpp:170 +#: src/states_screens/dialogs/confirm_resolution_dialog.cpp:126 +#, c-format +msgid "Confirm resolution within %i seconds" +msgstr "" + +#: src/states_screens/race_setup_screen.cpp:131 msgid "Contains no powerups, so only your driving skills matter!" msgstr "" @@ -320,7 +340,7 @@ msgid "Continue" msgstr "" -#: src/states_screens/dialogs/race_over_dialog.cpp:227 +#: src/states_screens/dialogs/race_over_dialog.cpp:244 msgid "Continue Grand Prix" msgstr "" @@ -342,7 +362,7 @@ msgstr "" #. I18N: In the player info dialog (when deleting) -#: src/states_screens/dialogs/player_info_dialog.cpp:131 +#: src/states_screens/dialogs/player_info_dialog.cpp:135 #, c-format msgid "Do you really want to delete player '%s' ?" msgstr "" @@ -354,12 +374,12 @@ msgstr "" #. I18N: In the 'add new player' dialog -#: src/states_screens/dialogs/enter_player_name_dialog.cpp:35 +#: src/states_screens/dialogs/enter_player_name_dialog.cpp:38 msgid "Enter the new player's name" msgstr "" #. I18N: In the 'paused' screen -#: src/states_screens/dialogs/race_paused_dialog.cpp:136 +#: src/states_screens/dialogs/race_paused_dialog.cpp:139 msgid "Exit Race" msgstr "" @@ -369,61 +389,61 @@ msgid "Expert" msgstr "" -#: src/states_screens/feature_unlocked.cpp:234 +#: src/states_screens/feature_unlocked.cpp:246 msgid "Feature Unlocked" msgstr "" -#: src/modes/linear_world.cpp:229 +#: src/modes/linear_world.cpp:233 msgid "Final lap!" msgstr "" #. I18N: ./data/tracks/jungle/jungle.challenge -#: data/po/gui_strings.h:478 +#: data/po/gui_strings.h:466 msgid "Finish 3 laps in Racetrack with 3 easy AI karts in under 2:40 minutes." msgstr "" #. I18N: ./data/tracks/snowtuxpeak/snowtuxpeak.challenge -#: data/po/gui_strings.h:484 +#: data/po/gui_strings.h:472 msgid "Finish 3 laps on the City track with 3 AI karts in under 4:20 minutes." msgstr "" #. I18N: ./data/tracks/canyon/canyon.challenge -#: data/po/gui_strings.h:454 +#: data/po/gui_strings.h:442 msgid "" "Finish 3 laps on the Tux Tollway track with 3 AI karts in under 3:35 minutes." msgstr "" #. I18N: ./data/tracks/jungle/jungle.challenge -#: data/po/gui_strings.h:475 +#: data/po/gui_strings.h:463 msgid "Finish Race track in 2:40" msgstr "" #. I18N: ./data/tracks/canyon/canyon.challenge -#: data/po/gui_strings.h:451 +#: data/po/gui_strings.h:439 msgid "Finish Tux Tollway track in 3:35" msgstr "" #. I18N: ./data/tracks/snowtuxpeak/snowtuxpeak.challenge -#: data/po/gui_strings.h:481 +#: data/po/gui_strings.h:469 msgid "Finish the City track in 4:20" msgstr "" #. I18N: ./data/tracks/crescentcrossing/crescentcrossing.challenge -#: data/po/gui_strings.h:466 +#: data/po/gui_strings.h:454 msgid "" "Finish with at least 6 points of nitro on three laps of Oliver's Math Class " "in under 52 seconds." msgstr "" #. I18N: ./data/grandprix/tothemoonandback.challenge -#: data/po/gui_strings.h:442 +#: data/po/gui_strings.h:430 msgid "" "Finish with at least 9 nitro points on 3 laps of Shifting Sands in under " "2:20 minutes." msgstr "" #. I18N: Shown at the end of a race -#: src/states_screens/race_gui.cpp:76 +#: src/states_screens/race_gui.cpp:75 msgid "Finished" msgstr "" @@ -433,18 +453,23 @@ msgid "Fire" msgstr "" +#. I18N: ./data/grandprix/penguinplayground.grandprix +#: data/po/gui_strings.h:496 +msgid "First grand prix, easy to get started" +msgstr "" + #. I18N: Game mode -#: src/race/race_manager.hpp:119 +#: src/race/race_manager.hpp:118 msgid "Follow the Leader" msgstr "" #. I18N: ./data/tracks/city/city.challenge -#: data/po/gui_strings.h:457 +#: data/po/gui_strings.h:445 msgid "Follow the Leader in the Jungle" msgstr "" #. I18N: ./data/grandprix/atworldsend.challenge -#: data/po/gui_strings.h:427 +#: data/po/gui_strings.h:415 msgid "Follow the Leader on a Desert Island" msgstr "" @@ -495,7 +520,7 @@ msgid "General" msgstr "" -#: src/states_screens/race_gui.cpp:81 +#: src/states_screens/race_gui.cpp:80 msgid "Go!" msgstr "" @@ -508,16 +533,16 @@ #. I18N: In the 'paused' screen #. I18N: ./data/gui/main.stkgui #. I18N: Main menu button -#: src/states_screens/dialogs/race_paused_dialog.cpp:126 +#: src/states_screens/dialogs/race_paused_dialog.cpp:129 #: data/po/gui_strings.h:190 msgid "Help" msgstr "" -#: src/states_screens/dialogs/race_over_dialog.cpp:153 +#: src/states_screens/dialogs/race_over_dialog.cpp:158 msgid "Highscores" msgstr "" -#: src/states_screens/race_setup_screen.cpp:190 +#: src/states_screens/race_setup_screen.cpp:153 msgid "" "Hit others with weapons until they lose all their lives. (Only in " "multiplayer games)" @@ -537,16 +562,26 @@ msgid "Intermediate" msgstr "" +#. I18N: In the 'confirm resolution' dialog, that's shown when switching resoluton +#: src/states_screens/dialogs/confirm_resolution_dialog.cpp:63 +msgid "Keep this resolution" +msgstr "" + #: src/states_screens/options_screen_input.cpp:234 #, c-format msgid "Keyboard %i" msgstr "" -#: src/states_screens/race_gui.cpp:77 +#: src/states_screens/race_gui.cpp:76 msgid "Lap" msgstr "" -#: src/modes/follow_the_leader.cpp:152 +#. I18N: ./data/grandprix/atworldsend.grandprix +#: data/po/gui_strings.h:484 +msgid "Last grand prix, longer and harder" +msgstr "" + +#: src/modes/follow_the_leader.cpp:128 msgid "Leader" msgstr "" @@ -558,11 +593,15 @@ #: src/states_screens/arenas_screen.cpp:83 #: src/states_screens/challenges.cpp:83 -#: src/states_screens/race_setup_screen.cpp:175 -#: src/states_screens/tracks_screen.cpp:151 +#: src/states_screens/race_setup_screen.cpp:136 +#: src/states_screens/tracks_screen.cpp:199 msgid "Locked : solve active challenges to gain access to more!" msgstr "" +#: src/states_screens/tracks_screen.cpp:175 +msgid "Locked!" +msgstr "" + #. I18N: ./data/gui/options_input.stkgui #. I18N: Key binding #: data/po/gui_strings.h:328 @@ -599,14 +638,14 @@ msgid "Networking" msgstr "" -#: src/challenges/challenge.cpp:123 +#: src/challenges/challenge.cpp:121 #, c-format msgid "" "New Grand Prix '%s'\n" "now available" msgstr "" -#: src/challenges/challenge.cpp:129 +#: src/challenges/challenge.cpp:127 #, c-format msgid "" "New difficulty\n" @@ -614,11 +653,11 @@ "now available" msgstr "" -#: src/modes/linear_world.cpp:257 +#: src/modes/linear_world.cpp:264 msgid "New fastest lap" msgstr "" -#: src/challenges/challenge.cpp:116 +#: src/challenges/challenge.cpp:114 #, c-format msgid "" "New game mode\n" @@ -626,7 +665,7 @@ "now available" msgstr "" -#: src/challenges/challenge.cpp:135 +#: src/challenges/challenge.cpp:133 #, c-format msgid "" "New kart\n" @@ -634,7 +673,7 @@ "now available" msgstr "" -#: src/challenges/challenge.cpp:110 +#: src/challenges/challenge.cpp:108 #, c-format msgid "" "New track '%s'\n" @@ -648,7 +687,7 @@ msgstr "" #. I18N: Game mode -#: src/race/race_manager.hpp:115 +#: src/race/race_manager.hpp:114 msgid "Normal Race" msgstr "" @@ -667,7 +706,7 @@ #. I18N: In the 'paused' screen #. I18N: ./data/gui/main.stkgui #. I18N: Main menu button -#: src/states_screens/dialogs/race_paused_dialog.cpp:116 +#: src/states_screens/dialogs/race_paused_dialog.cpp:119 #: data/po/gui_strings.h:186 msgid "Options" msgstr "" @@ -677,16 +716,16 @@ msgid "Parachute - slows down all karts in a better position!" msgstr "" -#: src/states_screens/dialogs/race_paused_dialog.cpp:54 +#: src/states_screens/dialogs/race_paused_dialog.cpp:57 msgid "Paused" msgstr "" -#: src/karts/player_kart.cpp:254 +#: src/karts/controller/player_controller.cpp:251 msgid "Penalty time!!" msgstr "" -#. I18N: ./data/gui/tracks.stkgui -#: data/po/gui_strings.h:399 +#. I18N: ./data/grandprix/penguinplayground.grandprix +#: data/po/gui_strings.h:493 msgid "Penguin Playground" msgstr "" @@ -715,11 +754,11 @@ "back to make one lose sight!" msgstr "" -#: src/states_screens/dialogs/press_a_key_dialog.cpp:49 +#: src/states_screens/dialogs/press_a_key_dialog.cpp:51 msgid "Press ESC to cancel" msgstr "" -#: src/states_screens/dialogs/press_a_key_dialog.cpp:32 +#: src/states_screens/dialogs/press_a_key_dialog.cpp:34 msgid "Press a key" msgstr "" @@ -741,7 +780,7 @@ msgid "Race" msgstr "" -#: src/states_screens/dialogs/race_over_dialog.cpp:61 +#: src/states_screens/dialogs/race_over_dialog.cpp:62 msgid "Race Results" msgstr "" @@ -750,7 +789,7 @@ msgid "Race Setup" msgstr "" -#: src/states_screens/dialogs/race_over_dialog.cpp:213 +#: src/states_screens/dialogs/race_over_dialog.cpp:215 msgid "Race in this track again" msgstr "" @@ -764,12 +803,12 @@ msgid "Random Kart" msgstr "" -#: src/states_screens/tracks_screen.cpp:158 +#: src/states_screens/tracks_screen.cpp:209 msgid "Random Track" msgstr "" #. I18N: as in "ready, set, go", shown at the beginning of the race -#: src/states_screens/race_gui.cpp:79 +#: src/states_screens/race_gui.cpp:78 msgid "Ready!" msgstr "" @@ -782,12 +821,12 @@ msgstr "" #. I18N: In the player info dialog -#: src/states_screens/dialogs/player_info_dialog.cpp:103 +#: src/states_screens/dialogs/player_info_dialog.cpp:105 msgid "Remove" msgstr "" #. I18N: In the player info dialog -#: src/states_screens/dialogs/player_info_dialog.cpp:70 +#: src/states_screens/dialogs/player_info_dialog.cpp:72 msgid "Rename" msgstr "" @@ -798,7 +837,7 @@ msgstr "" #. I18N: In the 'paused' screen -#: src/states_screens/dialogs/race_paused_dialog.cpp:106 +#: src/states_screens/dialogs/race_paused_dialog.cpp:109 msgid "Restart Race" msgstr "" @@ -808,25 +847,30 @@ msgid "Right" msgstr "" -#: src/states_screens/race_setup_screen.cpp:182 +#: src/states_screens/race_setup_screen.cpp:144 msgid "" "Run for second place, as the last kart will be disqualified every time the " "counter hits zero. Beware : going in front of the leader will get you " "eliminated too!" msgstr "" +#. I18N: ./data/grandprix/tothemoonandback.grandprix +#: data/po/gui_strings.h:508 +msgid "Second grand prix" +msgstr "" + #. I18N: ./data/gui/racesetup.stkgui #: data/po/gui_strings.h:392 msgid "Select a game mode" msgstr "" -#: src/states_screens/race_gui.cpp:80 +#: src/states_screens/race_gui.cpp:79 msgid "Set!" msgstr "" #. I18N: In the 'paused' screen -#: src/states_screens/dialogs/race_over_dialog.cpp:201 -#: src/states_screens/dialogs/race_paused_dialog.cpp:96 +#: src/states_screens/dialogs/race_over_dialog.cpp:204 +#: src/states_screens/dialogs/race_paused_dialog.cpp:99 msgid "Setup New Race" msgstr "" @@ -836,8 +880,8 @@ msgid "Sharp Turn" msgstr "" -#. I18N: ./data/gui/tracks.stkgui -#: data/po/gui_strings.h:402 +#. I18N: ./data/grandprix/snagdrive.grandprix +#: data/po/gui_strings.h:499 msgid "Snag Drive" msgstr "" @@ -853,7 +897,11 @@ msgid "Standard" msgstr "" -#: src/states_screens/dialogs/track_info_dialog.cpp:125 +#: src/states_screens/dialogs/gp_info_dialog.cpp:137 +msgid "Start Grand Prix" +msgstr "" + +#: src/states_screens/dialogs/track_info_dialog.cpp:127 msgid "Start Race" msgstr "" @@ -891,8 +939,13 @@ "all highscores have been erased." msgstr "" +#. I18N: ./data/grandprix/snagdrive.grandprix +#: data/po/gui_strings.h:502 +msgid "Third grand prix" +msgstr "" + #. I18N: Game mode -#: src/race/race_manager.hpp:117 +#: src/race/race_manager.hpp:116 msgid "Time Trial" msgstr "" @@ -902,7 +955,7 @@ msgid "Time Trial: Contains no powerups, so only your driving skills matter!" msgstr "" -#: src/states_screens/dialogs/add_device_dialog.cpp:45 +#: src/states_screens/dialogs/add_device_dialog.cpp:47 msgid "" "To add a new Gamepad/Joystick device, simply start SuperTuxKart with it " "connected and it will appear in the list.\n" @@ -920,8 +973,8 @@ msgid "To help you win, there are some powerups you can collect :" msgstr "" -#. I18N: ./data/gui/tracks.stkgui -#: data/po/gui_strings.h:405 +#. I18N: ./data/grandprix/tothemoonandback.grandprix +#: data/po/gui_strings.h:505 msgid "To the Moon and Back" msgstr "" @@ -937,7 +990,7 @@ msgid "Video" msgstr "" -#: src/modes/linear_world.cpp:612 +#: src/modes/linear_world.cpp:622 msgid "WRONG WAY!" msgstr "" @@ -952,72 +1005,72 @@ msgstr "" #. I18N: ./data/followtheleader.challenge -#: data/po/gui_strings.h:415 +#: data/po/gui_strings.h:403 msgid "Win Penguin Playground Grand Prix" msgstr "" #. I18N: ./data/followtheleader.challenge -#: data/po/gui_strings.h:418 +#: data/po/gui_strings.h:406 msgid "Win Penguin Playground Grand Prix with 3 'Racer' Level AI karts." msgstr "" #. I18N: ./data/grandprix/snagdrive.challenge -#: data/po/gui_strings.h:433 +#: data/po/gui_strings.h:421 msgid "Win To the Moon and Back Grand Prix" msgstr "" #. I18N: ./data/tracks/fortmagma/fortmagma.challenge -#: data/po/gui_strings.h:472 +#: data/po/gui_strings.h:460 msgid "" "Win a 1 lap Head to Head on Tux Tollway against 1 'Racer' level AI kart." msgstr "" #. I18N: ./data/karts/gnu/gnu.challenge -#: data/po/gui_strings.h:448 +#: data/po/gui_strings.h:436 msgid "Win a 4 lap race on Snow Mountain against 4 'Racer' level AI kart." msgstr "" #. I18N: ./data/tracks/city/city.challenge -#: data/po/gui_strings.h:460 +#: data/po/gui_strings.h:448 msgid "Win a Follow the Leader race with 3 AI karts in the Amazonian Jungle." msgstr "" #. I18N: ./data/grandprix/atworldsend.challenge -#: data/po/gui_strings.h:430 +#: data/po/gui_strings.h:418 msgid "Win a Follow the Leader race with 3 AI karts on a Desert Island." msgstr "" #. I18N: ./data/tracks/fortmagma/fortmagma.challenge -#: data/po/gui_strings.h:469 +#: data/po/gui_strings.h:457 msgid "Win a Head to Head on Tux Tollway" msgstr "" #. I18N: ./data/karts/gnu/gnu.challenge -#: data/po/gui_strings.h:445 +#: data/po/gui_strings.h:433 msgid "Win a race on Snow Mountain" msgstr "" #. I18N: ./data/grandprix/alltracks.challenge -#: data/po/gui_strings.h:421 +#: data/po/gui_strings.h:409 msgid "Win the At World's End Grand Prix" msgstr "" #. I18N: ./data/grandprix/snagdrive.challenge -#: data/po/gui_strings.h:436 +#: data/po/gui_strings.h:424 msgid "Win the To the Moon and Back Grand Prix with 3 'Racer' Level AI karts." msgstr "" -#: src/karts/player_kart.cpp:354 +#: src/karts/controller/player_controller.cpp:342 msgid "You finished the race!" msgstr "" -#: src/modes/world.cpp:457 +#: src/modes/world.cpp:516 msgid "" "You have been\n" "eliminated!" msgstr "" -#: src/karts/player_kart.cpp:353 +#: src/karts/controller/player_controller.cpp:341 msgid "You won the race!" msgstr "" Modified: main/trunk/data/po/update_pot.sh =================================================================== --- main/trunk/data/po/update_pot.sh 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/data/po/update_pot.sh 2010-02-16 00:33:41 UTC (rev 4737) @@ -4,8 +4,8 @@ CPP_FILE_LIST="`find ./src -name '*.cpp' -print` `find ./src -name '*.hpp' -print`" LISP_FILE_LIST="`find ./data -name '*.track' -print` `find ./data -name '*.challenge' -print` `find ./data -name '*.grandprix' -print`" -XML_FILE_LIST=`find ./data -name '*.xml' -print` -STKGUI_FILE_LIST=`find ./data -name '*.stkgui' -print && find ./data -name '*.challenge' -print` +#XML_FILE_LIST=`find ./data -name '*.xml' -print` +OTHER_XML_FILES=`find ./data -name '*.stkgui' -print && find ./data -name '*.challenge' -print && find ./data -name '*.grandprix' -print` echo "--------------------" echo " Source Files :" @@ -20,13 +20,10 @@ echo "--------------------" echo " XMl Files :" echo "--------------------" -echo $STKGUI_FILE_LIST # $XML_FILE_LIST +echo $OTHER_XML_FILES # $XML_FILE_LIST # XML Files -# (Since xgettext cannot read XML directly, strings are extracted using 'grep' and 'sed' first -#grep -ho 'text=\"[^\"]*' $XML_FILE_LIST $STKGUI_FILE_LIST | sed 's/text=\"\(.*\)/_(\"\1\")/' > ./data/po/gui_strings.txt -# nothing in .xml files atm. If there ever is, add $XML_FILE_LIST below -python ./data/po/extract_strings_from_XML.py $STKGUI_FILE_LIST +python ./data/po/extract_strings_from_XML.py $OTHER_XML_FILES Modified: main/trunk/src/race/grand_prix_data.cpp =================================================================== --- main/trunk/src/race/grand_prix_data.cpp 2010-02-15 23:33:15 UTC (rev 4736) +++ main/trunk/src/race/grand_prix_data.cpp 2010-02-16 00:33:41 UTC (rev 4737) @@ -24,50 +24,102 @@ #include <stdexcept> #include "io/file_manager.hpp" -#include "lisp/parser.hpp" -#include "lisp/lisp.hpp" #include "tracks/track_manager.hpp" #include "utils/string_utils.hpp" #include "utils/translation.hpp" -GrandPrixData::GrandPrixData(const std::string filename) +GrandPrixData::GrandPrixData(const std::string filename) throw(std::logic_error) { m_filename = filename; m_id = StringUtils::getBasename(StringUtils::removeExtension(filename)); - const lisp::Lisp* lisp = 0; - try + + XMLNode* root = file_manager->createXMLTree(file_manager->getDataDir()+filename); + if (!root) { - lisp::Parser parser; - lisp = parser.parse(file_manager->getConfigFile(m_filename)); - - lisp = lisp->getLisp("supertuxkart-grand-prix"); - if(!lisp) + fprintf(stderr, "/!\\ Error while trying to read grandprix file '%s'\n", filename.c_str()); + throw std::logic_error("File not found"); + } + + bool foundName = false; + + if (root->getName() == "supertuxkart_grand_prix") + { + std::string temp_name; + if (root->get("name", &temp_name) == 0) { - throw std::runtime_error("No supertuxkart-grand-prix node"); + fprintf(stderr, "/!\\ Error while trying to read grandprix file '%s' : " + "missing 'name' attribute\n", filename.c_str()); + delete root; + throw std::logic_error("File contents are incomplete or corrupt"); } - - std::string temp_name; - lisp->get ("name", temp_name ); - // FIXME: for now all GP names are automatically translated by - // the lisp code, so no need to translate them here (which actually - // results in a crash, since the translated name is wchar_t and not - // utf-8. - //m_name = _(temp_name.c_str()); - m_name = temp_name.c_str(); + m_name = _(temp_name.c_str()); + foundName = true; - lisp->get ("description", m_description ); - lisp->get ("item", m_item_style); - lisp->getVector("tracks", m_tracks ); - lisp->getVector("laps", m_laps ); + std::string temp_desc; + const int readDesc = root->get( "description", &temp_desc ); + if (readDesc == 1 && temp_desc.size() > 0) + { + m_description = _(temp_desc.c_str()); + } + + // This used to be there, but I'm leaving it out since it seems it was unused + // lisp->get("item", m_item_style); + } - catch(std::exception& err) + else { - fprintf(stderr, "Error while reading grandprix file '%s'\n", filename.c_str()); - fprintf(stderr, "%s", err.what()); - fprintf(stderr, "\n"); + fprintf(stderr, "/!\\ Error while trying to read grandprix file '%s' : " + "Root node has an unexpected name\n", filename.c_str()); + delete root; + throw std::logic_error("File contents are incomplete or corrupt"); } - delete lisp; + + const int amount = root->getNumNodes(); + for (int i=0; i<amount; i++) + { + const XMLNode* node = root->getNode(i); + + // read a track entry + if (node->getName() == "track") + { + std::string trackID; + int numLaps; + + const int idFound = node->get("id", &trackID ); + const int lapFound = node->get("laps", &numLaps ); + + if (!idFound || !lapFound) + { + fprintf(stderr, "/!\\ Error while trying to read grandprix file '%s' : " + "<track> tag does not have id and laps attributes. \n", filename.c_str()); + delete root; + throw std:... [truncated message content] |
From: <au...@us...> - 2010-02-16 01:18:46
|
Revision: 4741 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4741&view=rev Author: auria Date: 2010-02-16 01:18:40 +0000 (Tue, 16 Feb 2010) Log Message: ----------- Converted music files to XML Modified Paths: -------------- main/trunk/data/music/Boom_boom_boom.music main/trunk/data/music/BradSucks-OutOfIt.music main/trunk/data/music/CaribbeanMusic.music main/trunk/data/music/ChillCarrier-Druckverlust.music main/trunk/data/music/Hip-Hop1.music main/trunk/data/music/Penguin_Party.music main/trunk/data/music/SkyVibe-HighFrequency.music main/trunk/data/music/SymphonyNo5.music main/trunk/data/music/TheDeadRocks-EasyJob.music main/trunk/data/music/TheDeadRocks-GreenSecretFromAmazonia.music main/trunk/data/music/TheDeadRocks-OneMillionDollar.music main/trunk/data/music/kart_grand_prix.music main/trunk/data/music/main_theme.music main/trunk/data/tracks/jungle/amazon_jungle.music main/trunk/data/tracks/mines/West.music main/trunk/data/tracks/secretgarden/garden.music main/trunk/data/tracks/snowmountain/Snowy.music main/trunk/data/tracks/startrack/Ethereal_Spectrum.music main/trunk/src/audio/music_information.cpp main/trunk/src/audio/music_information.hpp Modified: main/trunk/data/music/Boom_boom_boom.music =================================================================== --- main/trunk/data/music/Boom_boom_boom.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/Boom_boom_boom.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,7 +1,6 @@ -(music-information - (title "Boom boom boom" ) - (enable-fast #t ) - (composer "Matt Thomas" ) - (music "Boom_boom_boom.ogg") - (loop 10 ) -) +<music> + <title value="Boom boom boom" /> + <!-- <enable-fast #t /> --> + <composer value="Matt Thomas" /> + <file value="Boom_boom_boom.ogg"/> +</music> Modified: main/trunk/data/music/BradSucks-OutOfIt.music =================================================================== --- main/trunk/data/music/BradSucks-OutOfIt.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/BradSucks-OutOfIt.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,8 +1,7 @@ -(music-information - (title "Out of it" ) - (composer "Brad Sucks" ) - (music "BradSucks-OutOfIt.ogg") - (loop 10 ) - (gain 0.8) -) +<music> + <title value="Out of it" /> + <composer value="Brad Sucks" /> + <file value="BradSucks-OutOfIt.ogg" /> + <gain value="0.8" /> +</music> Modified: main/trunk/data/music/CaribbeanMusic.music =================================================================== --- main/trunk/data/music/CaribbeanMusic.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/CaribbeanMusic.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,8 +1,7 @@ -(music-information - (title "Caribbean Music" ) - (enable-fast #t ) - (composer "Dr.Sternhagel" ) - (music "CaribbeanMusic.ogg") - (loop 10 ) -) +<music> + <title value="Caribbean Music" /> + <!-- <enable-fast #t /> --> + <composer value="Dr.Sternhagel" /> + <file value="CaribbeanMusic.ogg" /> +</music> Modified: main/trunk/data/music/ChillCarrier-Druckverlust.music =================================================================== --- main/trunk/data/music/ChillCarrier-Druckverlust.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/ChillCarrier-Druckverlust.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,8 +1,7 @@ -(music-information - (title "Druckverlust" ) - (composer "ChillCarrier" ) - (music "ChillCarrier-Druckverlust.ogg") - (loop 10 ) - (gain 0.8) -) +<music> + <title value="Druckverlust" /> + <composer value="ChillCarrier" /> + <file value="ChillCarrier-Druckverlust.ogg" /> + <gain value="0.8" /> +</music> Modified: main/trunk/data/music/Hip-Hop1.music =================================================================== --- main/trunk/data/music/Hip-Hop1.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/Hip-Hop1.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,8 +1,7 @@ -(music-information - (title "Hip-Hop 1" ) - (composer "Deff Syndicate") - (music "Hip-Hop1.ogg" ) - (loop 10 ) - (gain 0.7 ) -) +<music> + <title value="Hip-Hop 1" /> + <composer value="Deff Syndicate"/> + <file value="Hip-Hop1.ogg" /> + <gain value="0.7" /> +</music> Modified: main/trunk/data/music/Penguin_Party.music =================================================================== --- main/trunk/data/music/Penguin_Party.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/Penguin_Party.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,7 +1,6 @@ -(music-information - (title "Penguin Party") - (enable-fast #t ) - (composer "Magne Djupvik") - (music "Penguin_Party.ogg") - (loop 10) -) +<music> + <title value="Penguin Party" /> + <!-- <enable-fast #t /> --> + <composer value="Magne Djupvik" /> + <file value="Penguin_Party.ogg"/> +</music> Modified: main/trunk/data/music/SkyVibe-HighFrequency.music =================================================================== --- main/trunk/data/music/SkyVibe-HighFrequency.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/SkyVibe-HighFrequency.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,8 +1,7 @@ -(music-information - (title "Sky Vibe - High Frequency") - (composer "Speedsound") - (music "SkyVibe-HighFrequency.ogg") - (loop 10 ) - (gain 0.5 ) -) +<music> + <title value="Sky Vibe - High Frequency" /> + <composer value="Speedsound" /> + <file value="SkyVibe-HighFrequency.ogg" /> + <gain value="0.5" /> +</music> Modified: main/trunk/data/music/SymphonyNo5.music =================================================================== --- main/trunk/data/music/SymphonyNo5.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/SymphonyNo5.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,7 +1,6 @@ -(music-information - (title "Symphony No. 5" ) - (composer "Daniel Bautista" ) - (music "SymphonyNo5.ogg") - (loop 10 ) -) +<music> + <title value="Symphony No. 5" /> + <composer value="Daniel Bautista" /> + <file value="SymphonyNo5.ogg" /> +</music> Modified: main/trunk/data/music/TheDeadRocks-EasyJob.music =================================================================== --- main/trunk/data/music/TheDeadRocks-EasyJob.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/TheDeadRocks-EasyJob.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,7 +1,6 @@ -(music-information - (title "EasyJob" ) - (composer "The Dead Rocks" ) - (music "TheDeadRocks-EasyJob.ogg") - (loop 10 ) -) +<music> + <title value="EasyJob" /> + <composer value="The Dead Rocks" /> + <file value="TheDeadRocks-EasyJob.ogg" /> +</music> Modified: main/trunk/data/music/TheDeadRocks-GreenSecretFromAmazonia.music =================================================================== --- main/trunk/data/music/TheDeadRocks-GreenSecretFromAmazonia.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/TheDeadRocks-GreenSecretFromAmazonia.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,7 +1,6 @@ -(music-information - (title "Green Secret From Amazonia" ) - (composer "The Dead Rocks" ) - (music "TheDeadRocks-GreenSecretFromAmazonia.ogg") - (loop 10 ) -) +<music> + <title value="Green Secret From Amazonia" /> + <composer value="The Dead Rocks" /> + <file value="TheDeadRocks-GreenSecretFromAmazonia.ogg" /> +</music> Modified: main/trunk/data/music/TheDeadRocks-OneMillionDollar.music =================================================================== --- main/trunk/data/music/TheDeadRocks-OneMillionDollar.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/TheDeadRocks-OneMillionDollar.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,7 +1,6 @@ -(music-information - (title "One Million Dollar" ) - (composer "The Dead Rocks" ) - (music "TheDeadRocks-OneMillionDollar.ogg") - (loop 10 ) -) +<music> + <title value="One Million Dollar" /> + <composer value="The Dead Rocks" /> + <file value="TheDeadRocks-OneMillionDollar.ogg" /> +</music> Modified: main/trunk/data/music/kart_grand_prix.music =================================================================== --- main/trunk/data/music/kart_grand_prix.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/kart_grand_prix.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,6 +1,5 @@ -(music-information - (title "Kart Grand Prix" ) - (composer "Weirwood" ) - (music "kart_grand_prix.ogg") - (loop 10 ) -) +<music> + <title value="Kart Grand Prix" /> + <composer value="Weirwood" /> + <file value="kart_grand_prix.ogg"/> +</music> Modified: main/trunk/data/music/main_theme.music =================================================================== --- main/trunk/data/music/main_theme.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/music/main_theme.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,6 +1,5 @@ -(music-information - (title "MayDay Mayhem") - (composer "Alessandro Bottura" ) - (music "MayDayMayhem.ogg" ) - (loop 10) -) +<music> + <title value="MayDay Mayhem" /> + <composer value="Alessandro Bottura" /> + <file value="MayDayMayhem.ogg" /> +</music> Modified: main/trunk/data/tracks/jungle/amazon_jungle.music =================================================================== --- main/trunk/data/tracks/jungle/amazon_jungle.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/tracks/jungle/amazon_jungle.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,6 +1,5 @@ -(music-information - (title "Amazon Jungle") - (composer "Auria") - (music "amazon_jungle.ogg") - (loop 10) -) +<music> + <title value="Amazon Jungle" /> + <composer value="Auria" /> + <file value="amazon_jungle.ogg" /> +</music> Modified: main/trunk/data/tracks/mines/West.music =================================================================== --- main/trunk/data/tracks/mines/West.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/tracks/mines/West.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,7 +1,6 @@ -(music-information - (title "West" ) - (composer "Chris Leutwyler (Krobonil)") - (music "West.ogg") - (loop 10 ) -) +<music> + <title value="West" /> + <composer value="Chris Leutwyler (Krobonil)" /> + <file value="West.ogg" /> +</music> Modified: main/trunk/data/tracks/secretgarden/garden.music =================================================================== --- main/trunk/data/tracks/secretgarden/garden.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/tracks/secretgarden/garden.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,6 +1,5 @@ -(music-information - (title "Secret Garden") - (composer "DJ Helium") - (music "garden.ogg") - (loop 10) -) +<music> + <title value="Secret Garden" /> + <composer value="DJ Helium" /> + <file value="garden.ogg" /> +</music> Modified: main/trunk/data/tracks/snowmountain/Snowy.music =================================================================== --- main/trunk/data/tracks/snowmountain/Snowy.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/tracks/snowmountain/Snowy.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,7 +1,6 @@ -(music-information - (title "Snowy" ) - (composer "Chris Leutwyler (Krobonil)") - (music "Snowy.ogg") - (loop 10 ) -) +<music> + <title value="Snowy" /> + <composer value="Chris Leutwyler (Krobonil)" /> + <file value="Snowy.ogg" /> +</music> Modified: main/trunk/data/tracks/startrack/Ethereal_Spectrum.music =================================================================== --- main/trunk/data/tracks/startrack/Ethereal_Spectrum.music 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/data/tracks/startrack/Ethereal_Spectrum.music 2010-02-16 01:18:40 UTC (rev 4741) @@ -1,6 +1,5 @@ -(music-information - (title "Ethereal Spectrum" ) - (composer "Asha B." ) - (music "Ethereal_Spectrum_(ver_loop).ogg") - (loop 10 ) -) +<music> + <title value="Ethereal Spectrum" /> + <composer value="Asha B." /> + <file value="Ethereal_Spectrum_(ver_loop).ogg" /> +</music> Modified: main/trunk/src/audio/music_information.cpp =================================================================== --- main/trunk/src/audio/music_information.cpp 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/src/audio/music_information.cpp 2010-02-16 01:18:40 UTC (rev 4741) @@ -24,17 +24,16 @@ #include "audio/music_ogg.hpp" #include "config/user_config.hpp" -#include "lisp/lisp.hpp" -#include "lisp/parser.hpp" +#include "io/file_manager.hpp" #include "tracks/track.hpp" #include "tracks/track_manager.hpp" #include "utils/string_utils.hpp" -MusicInformation::MusicInformation(const std::string& filename) +MusicInformation::MusicInformation(const std::string& filename) throw (std::runtime_error) { m_title = ""; m_composer = ""; - m_numLoops = LOOP_FOREVER; + //m_numLoops = LOOP_FOREVER; m_normal_filename = ""; m_fast_filename = ""; m_normal_music = NULL; @@ -45,7 +44,7 @@ m_gain = 1.0f; m_adjustedGain = 1.0f; - if(StringUtils::getExtension(filename)!="music") + if (StringUtils::getExtension(filename) != "music") { // Create information just from ogg file // ------------------------------------- @@ -57,6 +56,70 @@ // Otherwise read config file // -------------------------- + + XMLNode* root = file_manager->createXMLTree(filename); + if (!root) + { + std::cerr << "Could not read music XML file " << filename.c_str() << std::endl; + throw std::runtime_error("Can open music XML file"); + } + + const int amount = root->getNumNodes(); + for (int i=0; i<amount; i++) + { + const XMLNode* node = root->getNode(i); + + if (node->getName() == "music") + { + // outer node, ignore + } + else if (node->getName() == "title") + { + if (node->get("value", &m_title) == 0) + { + fprintf(stderr, "/!\\ The '<title value=' attribute is mandatory in the music XML file!\n"); + throw std::runtime_error("Incomplete or corrupt music XML file"); + return; + } + } + else if (node->getName() == "composer") + { + if (node->get("value", &m_composer) == 0) + { + fprintf(stderr, "/!\\ The '<composer value=' attribute is mandatory in the music XML file!\n"); + throw std::runtime_error("Incomplete or corrupt music XML file"); + return; + } + } + else if (node->getName() == "file") + { + if (node->get("value", &m_normal_filename) == 0) + { + fprintf(stderr, "/!\\ The '<file value=' attribute is mandatory in the music XML file!\n"); + throw std::runtime_error("Incomplete or corrupt music XML file"); + return; + } + } + else if (node->getName() == "gain") + { + node->get("gain", &m_gain); + } + else + { + std::cerr << "Unknown node in music XML file : " << node->getName().c_str() << std::endl; + throw std::runtime_error("Unknown node in music XML file"); + } + }// nend for + + delete root; + + //TODO: not implemented back (is this useful in any way?) + // LISP->getVector("tracks", m_all_tracks ); + + //TODO: not implemented back (is this used in any way?) + m_enable_fast = false; + + /* lisp::Parser parser; const lisp::Lisp* const ROOT = parser.parse(filename); @@ -85,18 +148,18 @@ LISP->getVector("tracks", m_all_tracks ); LISP->get ("gain", m_gain ); m_adjustedGain = m_gain; - + */ + // Get the path from the filename and add it to the ogg filename - std::string path=StringUtils::getPath(filename); - m_normal_filename=path+"/"+m_normal_filename; + std::string path = StringUtils::getPath(filename); + m_normal_filename = path + "/" + m_normal_filename; // Get the path from the filename and add it to the ogg filename - if(m_fast_filename!="") + if (m_fast_filename != "") { - m_fast_filename=path+"/"+m_fast_filename; + m_fast_filename = path + "/" + m_fast_filename; } - delete ROOT; } // MusicInformation Modified: main/trunk/src/audio/music_information.hpp =================================================================== --- main/trunk/src/audio/music_information.hpp 2010-02-16 00:49:05 UTC (rev 4740) +++ main/trunk/src/audio/music_information.hpp 2010-02-16 01:18:40 UTC (rev 4741) @@ -21,6 +21,7 @@ #define HEADER_MUSIC_INFORMATION_HPP #include <string> +#include <stdexcept> #include <vector> class Music; @@ -33,7 +34,8 @@ std::string m_normal_filename; std::string m_fast_filename; std::vector<std::string> m_all_tracks; - int m_numLoops; + //int m_numLoops; + /** If faster music is enabled at all (either separate file or using * the pitch shift approach). */ bool m_enable_fast; @@ -54,12 +56,12 @@ float m_time_since_faster; public: - MusicInformation (const std::string& filename); + MusicInformation (const std::string& filename) throw (std::runtime_error); const std::string& getComposer () const {return m_composer; } const std::string& getTitle () const {return m_title; } const std::string& getNormalFilename() const {return m_normal_filename; } const std::string& getFastFilename () const {return m_fast_filename; } - int getNumLoops () const {return m_numLoops; } + //int getNumLoops () const {return m_numLoops; } float getFasterTime () const {return m_faster_time; } float getMaxPitch () const {return m_max_pitch; } void addMusicToTracks (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-02-17 11:59:58
|
Revision: 4750 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4750&view=rev Author: hikerstk Date: 2010-02-17 11:59:51 +0000 (Wed, 17 Feb 2010) Log Message: ----------- Refactor end of race handling so that more functions are done in a base class only (esp. code that was previously duplicated in the battle mode and standard race). There is now time for an end animation, even if the player should finish last (in which case the previous end camera would not be shown). This mostly in preparation for end animations. Modified Paths: -------------- main/trunk/data/stk_config.xml main/trunk/src/audio/music_information.hpp main/trunk/src/karts/controller/controller.cpp main/trunk/src/karts/controller/controller.hpp main/trunk/src/karts/controller/end_controller.cpp main/trunk/src/karts/controller/end_controller.hpp main/trunk/src/karts/controller/player_controller.hpp main/trunk/src/karts/kart.cpp main/trunk/src/karts/moveable.cpp main/trunk/src/main_loop.cpp main/trunk/src/modes/follow_the_leader.cpp main/trunk/src/modes/follow_the_leader.hpp main/trunk/src/modes/linear_world.cpp main/trunk/src/modes/linear_world.hpp main/trunk/src/modes/profile_world.cpp main/trunk/src/modes/profile_world.hpp main/trunk/src/modes/standard_race.cpp main/trunk/src/modes/standard_race.hpp main/trunk/src/modes/three_strikes_battle.cpp main/trunk/src/modes/three_strikes_battle.hpp main/trunk/src/modes/world.cpp main/trunk/src/modes/world.hpp main/trunk/src/modes/world_status.cpp main/trunk/src/modes/world_status.hpp main/trunk/src/network/race_result_message.cpp main/trunk/src/race/grand_prix_data.hpp main/trunk/src/race/race_manager.cpp main/trunk/src/race/race_manager.hpp Modified: main/trunk/data/stk_config.xml =================================================================== --- main/trunk/data/stk_config.xml 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/data/stk_config.xml 2010-02-17 11:59:51 UTC (rev 4750) @@ -48,7 +48,7 @@ max-skidmarks="100" skid-fadeout-time="60" near-ground="2" - delay-finish-time="10" + delay-finish-time="4" music-credit-time="10" final-camera-time="1.5" /> Modified: main/trunk/src/audio/music_information.hpp =================================================================== --- main/trunk/src/audio/music_information.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/audio/music_information.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -56,6 +56,7 @@ float m_time_since_faster; public: +#pragma warning(disable:4290) MusicInformation (const std::string& filename) throw (std::runtime_error); const std::string& getComposer () const {return m_composer; } const std::string& getTitle () const {return m_title; } Modified: main/trunk/src/karts/controller/controller.cpp =================================================================== --- main/trunk/src/karts/controller/controller.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/karts/controller/controller.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -26,10 +26,11 @@ /** Constructor, saves the kart pointer and a pointer to the KartControl * of the kart. */ -Controller::Controller(Kart *kart) +Controller::Controller(Kart *kart, ActivePlayer *player) { m_controls = &(kart->getControls()); m_kart = kart; + m_player = player; } // Controller // ---------------------------------------------------------------------------- Modified: main/trunk/src/karts/controller/controller.hpp =================================================================== --- main/trunk/src/karts/controller/controller.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/karts/controller/controller.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -25,6 +25,7 @@ class Kart; class Item; +class ActivePlayer; /** This is the base class for kart controller - that can be a player * or a a robot. @@ -39,14 +40,21 @@ * it commands. */ KartControl *m_controls; + /** If this belongs to a player, it stores the active player data + * structure. Otherwise it is 0. */ + ActivePlayer *m_player; public: - Controller (Kart *kart); + Controller (Kart *kart, ActivePlayer *player=NULL); virtual ~Controller () {}; + /** Returns the active player for this controller (NULL + * if this controller does not belong to a player. */ + ActivePlayer *getPlayer () {return m_player;} virtual void reset () {}; virtual void update (float dt) {}; virtual void handleZipper () {}; virtual void collectedItem (const Item &item, int add_info=-1, float previous_energy=0) {}; + virtual void crashed () {}; virtual void setPosition (int p) {}; virtual void finishedRace (float time) {}; Modified: main/trunk/src/karts/controller/end_controller.cpp =================================================================== --- main/trunk/src/karts/controller/end_controller.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/karts/controller/end_controller.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -44,7 +44,8 @@ #include "tracks/track.hpp" #include "utils/constants.hpp" -EndController::EndController(Kart *kart) : Controller(kart) +EndController::EndController(Kart *kart, ActivePlayer *player) + : Controller(kart, player) { m_kart_length = m_kart->getKartProperties()->getKartModel()->getLength(); m_kart_width = m_kart->getKartProperties()->getKartModel()->getWidth(); @@ -55,11 +56,13 @@ m_next_node_index.reserve(m_quad_graph->getNumNodes()); m_successor_index.reserve(m_quad_graph->getNumNodes()); - // Initialise the fields with -1 + // Initialise the fields for(unsigned int i=0; i<m_quad_graph->getNumNodes(); i++) { m_next_node_index.push_back(-1); - m_successor_index.push_back(-1); + // 0 is always a valid successor - so even if the kart should end + // up by accident on a non-selected path, it will keep on working. + m_successor_index.push_back(0); } // For now pick one part on random, which is not adjusted during the run std::vector<unsigned int> next; Modified: main/trunk/src/karts/controller/end_controller.hpp =================================================================== --- main/trunk/src/karts/controller/end_controller.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/karts/controller/end_controller.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -38,10 +38,15 @@ class EndController : public Controller { private: - int m_min_steps; //Minimum number of steps to check. If 0, the AI doesn't - //even has check around the kart, if 1, it checks around - //the kart always, and more than that will check the - //remaining number of steps in front of the kart, always + /** Stores the type of the previous controller. This is necessary so that + * after the end of race ths kart (and its results) can still be + * identified to be from a player kart. */ + bool m_was_player_controller; + + int m_min_steps; //Minimum number of steps to check. If 0, the AI doesn't + //even has check around the kart, if 1, it checks around + //the kart always, and more than that will check the + //remaining number of steps in front of the kart, always float m_max_handicap_accel; //The allowed maximum speed, in percentage, //from 0.0 to 1.0. Used only when //m_wait_for_players == true. @@ -109,28 +114,30 @@ *variable, except handle_race_start() that isn't associated with any *specific action (more like, associated with inaction). */ - void handleAcceleration(const float DELTA); - void handleSteering(float dt); - void handleRescue(const float DELTA); - void handleBraking(); - + void handleAcceleration(const float DELTA); + void handleSteering(float dt); + void handleRescue(const float DELTA); + void handleBraking(); /*Lower level functions not called directly from update()*/ - float steerToAngle(const size_t SECTOR, const float ANGLE); - float steerToPoint(const Vec3 &point, float dt); + float steerToAngle(const size_t SECTOR, const float ANGLE); + float steerToPoint(const Vec3 &point, float dt); - void checkCrashes(const int STEPS, const Vec3& pos); - void findNonCrashingPoint(Vec3 *result); - - float normalizeAngle(float angle); - int calcSteps(); - void setSteering(float angle, float dt); - void findCurve(); - + void checkCrashes(const int STEPS, const Vec3& pos); + void findNonCrashingPoint(Vec3 *result); + float normalizeAngle(float angle); + int calcSteps(); + void setSteering(float angle, float dt); + void findCurve(); public: - EndController(Kart *kart); + EndController(Kart *kart, ActivePlayer* player); ~EndController(); virtual void update (float delta) ; virtual void reset (); + /** Returns if the original controller of the kart was a player + * controller. This way e.g. highscores can still be assigned + * to the right player. */ + virtual bool isPlayerController () const {return m_player!=NULL;} + }; // EndKart #endif Modified: main/trunk/src/karts/controller/player_controller.hpp =================================================================== --- main/trunk/src/karts/controller/player_controller.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/karts/controller/player_controller.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -33,26 +33,23 @@ class PlayerController : public Controller { private: - int m_steer_val, m_steer_val_l, m_steer_val_r; - int m_prev_accel; - bool m_prev_brake; + int m_steer_val, m_steer_val_l, m_steer_val_r; + int m_prev_accel; + bool m_prev_brake; - ActivePlayer *m_player; - float m_penalty_time; + float m_penalty_time; - SFXBase *m_bzzt_sound; - SFXBase *m_wee_sound; - SFXBase *m_ugh_sound; - SFXBase *m_grab_sound; - SFXBase *m_full_sound; + SFXBase *m_bzzt_sound; + SFXBase *m_wee_sound; + SFXBase *m_ugh_sound; + SFXBase *m_grab_sound; + SFXBase *m_full_sound; - void steer(float, int); + void steer(float, int); public: PlayerController (Kart *kart, ActivePlayer *_player, unsigned int player_index); ~PlayerController (); - ActivePlayer *getPlayer () { return m_player; } - PlayerProfile *getPlayerProfile () { return m_player->getProfile(); } void update (float); void action (PlayerAction action, int value); void handleZipper (); Modified: main/trunk/src/karts/kart.cpp =================================================================== --- main/trunk/src/karts/kart.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/karts/kart.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -40,6 +40,7 @@ #include "modes/world.hpp" #include "io/file_manager.hpp" #include "items/item_manager.hpp" +#include "karts/controller/end_controller.hpp" #include "karts/kart_model.hpp" #include "karts/kart_properties_manager.hpp" #include "network/race_state.hpp" @@ -381,8 +382,6 @@ World::getWorld()->getPhysics()->addKart(this); } - if(m_node) - m_node->setVisible(true); // In case that the kart was eliminated if(m_camera) m_camera->reset(); // If the controller was replaced (e.g. replaced by end controller), @@ -392,6 +391,10 @@ m_controller = m_saved_controller; m_saved_controller = NULL; } + // Reset is also called when the kart is created, at which time + // m_controller is not yet defined. + if(m_controller) + m_controller->reset(); m_view_blocked_by_plunger = 0.0; m_attachment.clear(); m_powerup.reset(); @@ -451,11 +454,17 @@ */ void Kart::finishedRace(float time) { + // m_finished_race can be true if e.g. an AI kart was set to finish + // because the race was over (i.e. estimating the finish time). If + // this kart then crosses the finish line (with the end controller) + // it would trigger a race end again. + if(m_finished_race) return; m_finished_race = true; m_finish_time = time; m_kart_mode = KM_END_ANIM; m_controller->finishedRace(time); - race_manager->RaceFinished(this, time); + race_manager->kartFinishedRace(this, time); + setController(new EndController(this, m_controller->getPlayer())); } // finishedRace //----------------------------------------------------------------------------- Modified: main/trunk/src/karts/moveable.cpp =================================================================== --- main/trunk/src/karts/moveable.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/karts/moveable.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -97,6 +97,11 @@ m_body->setAngularVelocity(btVector3(0, 0, 0)); m_body->setCenterOfMassTransform(m_transform); } + if(m_node) + m_node->setVisible(true); // In case that the objects was eliminated + if(m_animated_node) + m_animated_node->setVisible(true); + Coord c(m_transform); m_hpr = c.getHPR(); } // reset Modified: main/trunk/src/main_loop.cpp =================================================================== --- main/trunk/src/main_loop.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/main_loop.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -112,7 +112,7 @@ if ( World::getWorld()->getPhase() != WorldStatus::LIMBO_PHASE) { history->update(dt); - World::getWorld()->update(dt); + World::getWorld()->updateWorld(dt); } // phase != limbo phase } // updateRace Modified: main/trunk/src/modes/follow_the_leader.cpp =================================================================== --- main/trunk/src/modes/follow_the_leader.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/follow_the_leader.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -83,21 +83,12 @@ // almost over, use fast music if(getCurrentNumKarts()==3) sound_manager->switchToFastMusic(); - - // The follow the leader race is over if there is only one kart left, - // or if all players have gone - if(isRaceOver()) - { - // Note: LinearWorld::terminateRace adds the scores for all remaining - // karts in the race. - enterRaceOverState(false); - return; - } + // End of race is detected from the World::update() } // countdownReachedZero //----------------------------------------------------------------------------- -/** The follow the leader race is over if there is only one kart left, - * or if all players have gone. +/** The follow the leader race is over if there is only one kart left (plus + * the leader), or if all players have gone. */ bool FollowTheLeaderRace::isRaceOver() { @@ -146,9 +137,13 @@ race_time[kart_id] = race_manager->getOverallTime(kart_id); // check this kart is not in front of leader. If it is, give a score of 0 - if(m_kart_info[kart_id].m_race_lap * world->getTrack()->getTrackLength() + getDistanceDownTrackForKart(kart_id) > - m_kart_info[0].m_race_lap * world->getTrack()->getTrackLength() + getDistanceDownTrackForKart(0)) + if( getLapForKart(kart_id) * world->getTrack()->getTrackLength() + + getDistanceDownTrackForKart(kart_id) + > getLapForKart(0) * world->getTrack()->getTrackLength() + + getDistanceDownTrackForKart(0)) + { scores[kart_id] = 0; + } } //Bubblesort Modified: main/trunk/src/modes/follow_the_leader.hpp =================================================================== --- main/trunk/src/modes/follow_the_leader.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/follow_the_leader.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -23,7 +23,9 @@ class FollowTheLeaderRace : public LinearWorld { +private: std::vector<float> m_leader_intervals; // time till elimination in follow leader + public: FollowTheLeaderRace(); Modified: main/trunk/src/modes/linear_world.cpp =================================================================== --- main/trunk/src/modes/linear_world.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/linear_world.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -139,8 +139,8 @@ KartInfo& kart_info = m_kart_info[n]; Kart* kart = m_karts[n]; - // Nothing to do for karts that are currently being rescued. - if(kart->isRescue()) continue; + // Nothing to do for karts that are currently being rescued or eliminated + if(kart->isRescue() || kart->isEliminated()) continue; // ---------- deal with sector data --------- @@ -176,15 +176,14 @@ for(unsigned int i=0; i<kart_amount; i++) { // ---------- update rank ------ - if(!m_karts[i]->hasFinishedRace() && !m_karts[i]->isEliminated()) - { - updateRacePosition(m_karts[i], m_kart_info[i]); - // During the last lap update the estimated finish time. - // This is used to play the faster music, and by the AI - if(m_kart_info[i].m_race_lap == race_manager->getNumLaps()-1) - m_kart_info[i].m_estimated_finish = estimateFinishTimeForKart(m_karts[i]); - checkForWrongDirection(i); - } + if(m_karts[i]->hasFinishedRace() || m_karts[i]->isEliminated()) + continue; + updateRacePosition(m_karts[i], m_kart_info[i]); + // During the last lap update the estimated finish time. + // This is used to play the faster music, and by the AI + if(m_kart_info[i].m_race_lap == race_manager->getNumLaps()-1) + m_kart_info[i].m_estimated_finish = estimateFinishTimeForKart(m_karts[i]); + checkForWrongDirection(i); } #ifdef DEBUG // FIXME: Debug output in case that the double position error @@ -207,7 +206,6 @@ pos_used[m_karts[i]->getPosition()]=i; } #endif - } // update //----------------------------------------------------------------------------- @@ -242,7 +240,6 @@ if(network_manager->getMode()!=NetworkManager::NW_CLIENT) { kart->finishedRace(getTime()); - createEndKart(kart_index); } } { @@ -409,26 +406,6 @@ return m_kart_display_info; } // getKartsDisplayInfo -//----------------------------------------------------------------------------- -void LinearWorld::terminateRace() -{ - World::terminateRace(); - - // if some karts have not yet finished the race yet, estimate - // their times and use these values to proceed without waiting - const unsigned int kart_amount = m_karts.size(); - for ( KartList::size_type i = 0; i < kart_amount; ++i) - { - // Eliminated karts have already called raceFinished. - if(!m_karts[i]->hasFinishedRace() && !m_karts[i]->isEliminated()) - { - const float est_finish_time = m_kart_info[i].m_estimated_finish; - m_karts[i]->finishedRace(est_finish_time); - createEndKart(i); - } // if !hasFinishedRace - } // for i -} // terminateRace - // ---------------------------------------------------------------------------- /** Sets up the mapping from kart position to kart index. */ @@ -465,7 +442,7 @@ // the average speed computed above. return getTime() + (full_distance - distance_covered) / average_speed; -} // estimateFinishTime +} // estimateFinishTimeForKart //----------------------------------------------------------------------------- /** Decide where to drop a rescued kart Modified: main/trunk/src/modes/linear_world.hpp =================================================================== --- main/trunk/src/modes/linear_world.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/linear_world.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -54,58 +54,57 @@ protected: RaceGUI::KartIconDisplayInfo* m_kart_display_info; + + /** This vector contains an 'KartInfo' struct for every kart in the race. + * This member is not strictly private but try not to use it directly outside + * tightly related classes (e.g. AI) + */ + std::vector<KartInfo> m_kart_info; + /** Linear races can trigger rescues for one additional reason : shortcuts. * It may need to do some specific world before calling the generic Kart::forceRescue */ - void rescueKartAfterShortcut(Kart* kart, KartInfo& kart_info); - - void checkForWrongDirection(unsigned int i); - float estimateFinishTimeForKart(Kart* kart); - void updateRacePosition ( Kart* kart, KartInfo& kart_info ); + void rescueKartAfterShortcut(Kart* kart, KartInfo& kart_info); + void checkForWrongDirection(unsigned int i); + void updateRacePosition(Kart* kart, KartInfo& kart_info ); + virtual float estimateFinishTimeForKart(Kart* kart); + public: - LinearWorld(); + LinearWorld(); /** call just after instanciating. can't be moved to the contructor as child classes must be instanciated, otherwise polymorphism will fail and the results will be incorrect */ - void init(); - virtual ~LinearWorld(); - - /** This vector contains an 'KartInfo' struct for every kart in the race. - * This member is not strictly private but try not to use it directly outside - * tightly related classes (e.g. AI) - */ - std::vector<KartInfo> m_kart_info; + void init(); + virtual ~LinearWorld(); + virtual void update(float delta); + int getSectorForKart(const int kart_id) const; + float getDistanceDownTrackForKart(const int kart_id) const; + float getDistanceToCenterForKart(const int kart_id) const; + float getEstimatedFinishTime(const int kart_id) const; + int getLapForKart(const int kart_id) const; + void setTimeAtLapForKart(float t, const int kart_id); + float getTimeAtLapForKart(const int kart_id) const; - virtual void update(float delta); + virtual RaceGUI::KartIconDisplayInfo* + getKartsDisplayInfo(); + virtual void moveKartAfterRescue(Kart* kart, btRigidBody* body); - int getSectorForKart(const int kart_id) const; - float getDistanceDownTrackForKart(const int kart_id) const; - float getDistanceToCenterForKart(const int kart_id) const; - float getEstimatedFinishTime(const int kart_id) const; - int getLapForKart(const int kart_id) const; - void setTimeAtLapForKart(float t, const int kart_id); - float getTimeAtLapForKart(const int kart_id) const; - - virtual RaceGUI::KartIconDisplayInfo* getKartsDisplayInfo(); - virtual void moveKartAfterRescue(Kart* kart, btRigidBody* body); + virtual void restartRace(); - virtual void terminateRace(); - virtual void restartRace(); - - virtual bool raceHasLaps(){ return true; } - virtual void newLap(unsigned int kart_index); + virtual bool raceHasLaps(){ return true; } + virtual void newLap(unsigned int kart_index); - virtual bool haveBonusBoxes(){ return true; } + virtual bool haveBonusBoxes(){ return true; } /** Called by the race result GUI at the end of the race to know the final order (fill in the 'order' array) */ - virtual void raceResultOrder( int* order ); + virtual void raceResultOrder( int* order ); /** Returns true if the kart is on a valid driveline quad. * \param kart_index Index of the kart. */ - bool isOnRoad(unsigned int kart_index) const - { return m_kart_info[kart_index].m_on_road; } -}; + bool isOnRoad(unsigned int kart_index) const + { return m_kart_info[kart_index].m_on_road; } +}; // LinearWorld #endif Modified: main/trunk/src/modes/profile_world.cpp =================================================================== --- main/trunk/src/modes/profile_world.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/profile_world.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -115,7 +115,11 @@ } // update //----------------------------------------------------------------------------- -void ProfileWorld::enterRaceOverState(const bool delay) +/** This function is called when the race is finished, but end-of-race + * animations have still to be played. In the case of profiling, + * we can just abort here without waiting for the animations. + */ +void ProfileWorld::enterRaceOverState() { float runtime = (irr_driver->getRealTime()-m_start_time)*0.001f; printf("Number of frames: %d time %f, Average FPS: %f\n", Modified: main/trunk/src/modes/profile_world.hpp =================================================================== --- main/trunk/src/modes/profile_world.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/profile_world.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -53,7 +53,7 @@ virtual std::string getInternalCode() const {return "PROFILE"; } virtual void update(float dt); virtual bool isRaceOver(); - virtual void enterRaceOverState(const bool delay=false); + virtual void enterRaceOverState(); static void setProfileModeTime(float time); static void setProfileModeLaps(int laps); Modified: main/trunk/src/modes/standard_race.cpp =================================================================== --- main/trunk/src/modes/standard_race.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/standard_race.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -27,53 +27,12 @@ } // StandardRace //----------------------------------------------------------------------------- -StandardRace::~StandardRace() -{ -} // ~StandardRace - -//----------------------------------------------------------------------------- -/** Called once per frame to update race specific data structures. - * \param dt TIme step size. - */ -void StandardRace::update(float dt) -{ - LinearWorld::update(dt); - if(!WorldStatus::isRacePhase()) return; - - // All karts are finished - if(race_manager->getFinishedKarts() >= getNumKarts() ) - { - enterRaceOverState(); - unlock_manager->raceFinished(); - } // if all karts are finished - - // All player karts are finished, but computer still racing - // =========================================================== - else if(isRaceOver()) - { - // Update the estimated finishing time for all karts that haven't - // finished yet. - const unsigned int kart_amount = getNumKarts(); - for(unsigned int i = 0; i < kart_amount ; i++) - { - if(!m_karts[i]->hasFinishedRace()) - { - m_karts[i]->finishedRace(estimateFinishTimeForKart(m_karts[i])); - createEndKart(i); - } - } // i<kart_amount - - // Set delay mode to have time for camera animation, and - // to give the AI some time to get non-estimated timings - enterRaceOverState(); - } -} // update - -//----------------------------------------------------------------------------- /** Returns true if the race is finished, i.e. all player karts are finished. */ bool StandardRace::isRaceOver() { + // The race is over if all players have finished the race. Remaining + // times for AI opponents will be estimated in enterRaceOverState return race_manager->allPlayerFinished(); } // isRaceOver @@ -106,6 +65,6 @@ if(race_manager->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL) return IDENT_TTRIAL; else - return IDENT_STD; - + return IDENT_STD; } // getIdent + Modified: main/trunk/src/modes/standard_race.hpp =================================================================== --- main/trunk/src/modes/standard_race.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/standard_race.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -26,18 +26,19 @@ */ class StandardRace : public LinearWorld { +protected: + // clock events + virtual bool isRaceOver(); + public: - StandardRace(); - virtual ~StandardRace(); + StandardRace(); + virtual ~StandardRace() {}; - // clock events - virtual bool isRaceOver(); - // overriding World methods - virtual void update(float delta); - virtual void getDefaultCollectibles(int& collectible_type, int& amount); - virtual bool haveBonusBoxes(); - virtual std::string getIdent() const; + virtual void getDefaultCollectibles(int& collectible_type, int& amount); + virtual bool haveBonusBoxes(); + virtual std::string + getIdent() const; }; #endif Modified: main/trunk/src/modes/three_strikes_battle.cpp =================================================================== --- main/trunk/src/modes/three_strikes_battle.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/three_strikes_battle.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -60,26 +60,6 @@ } // ~ThreeStrikesBattle //----------------------------------------------------------------------------- - -void ThreeStrikesBattle::terminateRace() -{ - updateKartRanks(); - - // if some karts have not yet finished yet - const unsigned int kart_amount = m_karts.size(); - for ( KartList::size_type i = 0; i < kart_amount; ++i) - { - if(!m_karts[i]->hasFinishedRace()) - { - m_karts[i]->finishedRace(WorldStatus::getTime()); - createEndKart(i); - } // if !hasFinishedRace - } // for i - - World::terminateRace(); -} // terminateRace - -//----------------------------------------------------------------------------- void ThreeStrikesBattle::kartHit(const int kart_id) { assert(kart_id >= 0); @@ -172,16 +152,6 @@ } // updateKartRank //----------------------------------------------------------------------------- -void ThreeStrikesBattle::enterRaceOverState(const bool delay) -{ - World::enterRaceOverState(delay); - // Add the results for the remaining kart - for(unsigned int i=0; i<getNumKarts(); i++) - if(!m_karts[i]->isEliminated()) - race_manager->RaceFinished(m_karts[i], WorldStatus::getTime()); -} // enterRaceOverState - -//----------------------------------------------------------------------------- /** The battle is over if only one kart is left, or no player kart. */ bool ThreeStrikesBattle::isRaceOver() @@ -190,6 +160,17 @@ } // isRaceOver //----------------------------------------------------------------------------- +/** Called when the race finishes, i.e. after playing (if necessary) an + * end of race animation. It updates the time for all karts still racing, + * and then updates the ranks. + */ +void ThreeStrikesBattle::terminateRace() +{ + updateKartRanks(); + World::terminateRace(); +} // terminateRace + +//----------------------------------------------------------------------------- void ThreeStrikesBattle::restartRace() { World::restartRace(); Modified: main/trunk/src/modes/three_strikes_battle.hpp =================================================================== --- main/trunk/src/modes/three_strikes_battle.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/three_strikes_battle.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -51,7 +51,6 @@ // overriding World methods virtual void restartRace(); - virtual void enterRaceOverState(const bool delay=false); //virtual void getDefaultCollectibles(int& collectible_type, int& amount); virtual bool useFastMusicNearEnd() const { return false; } Modified: main/trunk/src/modes/world.cpp =================================================================== --- main/trunk/src/modes/world.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/world.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -55,10 +55,23 @@ World* World::m_world = NULL; +/** The main world class is used to handle the track and the karts. + * The end of the race is detected in two phases: first the (abstract) + * function isRaceOver, which must be implemented by all game modes, + * must return true. In which case enterRaceOverState is called. At + * this time a winning (or losing) animation can be played. The WorldStatus + * class will in its enterRaceOverState switch to DELAY_FINISH_PHASE, + * but the remaining AI kart will keep on racing during that time. + * After a time period specified in stk_config.xml WorldStatus will + * switch to FINISH_PHASE and call terminateRace. Now the finishing status + * of all karts is set (i.e. in a normal race the arrival time for karts + * will be estimated), highscore is updated, and the race result gui + * is being displayed. + */ //----------------------------------------------------------------------------- /** Constructor. Note that in the constructor it is not possible to call any - * functions that use RaceManager::getWorld(), since this is only defined - * after the constructor. Those functions can be called in the init() + * functions that use World::getWorld(), since this is only defined + * after the constructor. Those functions must be called in the init() * function, which is called immediately after the constructor. */ World::World() : WorldStatus() @@ -70,7 +83,7 @@ // ---------------------------------------------------------------------------- /** This function is called after the World constructor. In init() functions - * can be called that use RaceManager::getWorld(). The init function is + * can be called that use World::getWorld(). The init function is * called immediately after the constructor. */ void World::init() @@ -146,7 +159,7 @@ * this player on the local machine. * \param global_player_id If the kart is a player kart this is the index of * this player globally (i.e. including network players). - * \param init_pos The start XYZ coordinates. + * \param init_pos The start transform (xyz and hpr). */ Kart *World::createKart(const std::string &kart_ident, int index, int local_player_id, int global_player_id, @@ -158,7 +171,7 @@ switch(race_manager->getKartType(index)) { case RaceManager::KT_PLAYER: - std::cout << "===== World : creating player kart for kart #" << index << " which has local_player_id " << local_player_id << " ===========\n"; + std::cout << "===== World : creating player controller for kart #" << index << " which has local_player_id " << local_player_id << " ===========\n"; controller = new PlayerController(new_kart, StateManager::get()->getActivePlayer(local_player_id), local_player_id); @@ -170,7 +183,7 @@ //m_num_players++; //break; case RaceManager::KT_AI: - std::cout << "===== World : creating AI kart for #" << index << "===========\n"; + std::cout << "===== World : creating AI controller for #" << index << "===========\n"; controller = loadAIController(new_kart); break; @@ -254,13 +267,27 @@ //----------------------------------------------------------------------------- /** Called at the end of a race. Updates highscores, pauses the game, and - * informs the unlock manager about the finished race. + * informs the unlock manager about the finished race. This function must + * be called after all other stats were updated from the different game + * modes. */ void World::terminateRace() { + // Update the estimated finishing time for all karts that haven't + // finished yet. + const unsigned int kart_amount = getNumKarts(); + for(unsigned int i = 0; i < kart_amount ; i++) + { + if(!m_karts[i]->hasFinishedRace() && !m_karts[i]->isEliminated()) + { + m_karts[i]->finishedRace(estimateFinishTimeForKart(m_karts[i])); + + } + } // i<kart_amount updateHighscores(); WorldStatus::pause(); unlock_manager->raceFinished(); + WorldStatus::terminateRace(); } // terminateRace //----------------------------------------------------------------------------- @@ -341,6 +368,26 @@ } // resetAllKarts //----------------------------------------------------------------------------- +/** This is the main interface to update the world. This function calls + * update(), and checks for the end of the race. Note that race over + * handling can not necessarily be done in update(), since not all + * data structures might have been updated (e.g.LinearWorld must + * call World::update() first, to get updated kart positions. If race + * over would be handled in World::update, LinearWorld had no opportunity + * to update its data structures before the race is finished). + * \param dt Time step size. + */ +void World::updateWorld(float dt) +{ + update(dt); + if( (!isFinishPhase()) && isRaceOver()) + { + enterRaceOverState(); + } + +} // updateWorld + +//----------------------------------------------------------------------------- void World::update(float dt) { if(history->replayHistory()) dt=history->getNextDelta(); @@ -530,13 +577,12 @@ camera->setMode(Camera::CM_LEADER_MODE); m_eliminated_players++; } - //projectile_manager->newExplosion(kart->getXYZ()); + // The kart can't be really removed from the m_kart array, since otherwise // a race can't be restarted. So it's only marked to be eliminated (and // ignored in all loops). Important:world->getCurrentNumKarts() returns // the number of karts still racing. This value can not be used for loops // over all karts, use race_manager->getNumKarts() instead! - race_manager->RaceFinished(kart, WorldStatus::getTime()); kart->eliminate(); m_eliminated_karts++; @@ -594,13 +640,4 @@ ((PlayerController*)(m_karts[i]->getController()))->resetInputState(); } // pause -//----------------------------------------------------------------------------- -/** Replaces the kart with index i with an EndKart, i.e. a kart that shows the - * end animation, and does not use any items anymore. - * \param i Index of the kart to be replaced. - */ -void World::createEndKart(unsigned int i) -{ - m_karts[i]->setController(new EndController(m_karts[i])); -} // createEndKart /* EOF */ Modified: main/trunk/src/modes/world.hpp =================================================================== --- main/trunk/src/modes/world.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/world.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -110,7 +110,6 @@ void removeKart (int kart_number); Controller* loadAIController (Kart *kart); - void estimateFinishTimes(); virtual Kart *createKart(const std::string &kart_ident, int index, int local_player_id, int global_player_id, @@ -122,8 +121,19 @@ /** Pointer to the race GUI. The race GUI is handedl by world. */ RaceGUI *m_race_gui; - virtual void onGo(); - + virtual void onGo(); + /** Returns true if the race is over. Must be defined by all modes. */ + virtual bool isRaceOver() = 0; + virtual void update(float dt); + /** Used for AI karts that are still racing when all player kart finished. + * Generally it should estimate the arrival time for those karts, but as + * a default (useful for battle mode and ftl races) we just use the + * current time for this (since this is a good value for karts still + * around at the end of a race, and other criteria (number of lives, + * race position) will be used to determine the final order. + */ + virtual float estimateFinishTimeForKart(Kart* kart) {return getTime(); } + public: World(); virtual ~World(); @@ -139,9 +149,7 @@ results will be incorrect */ virtual void init(); - virtual void update(float delta); - /** Returns true if the race is over. Must be defined by all modes. */ - virtual bool isRaceOver() = 0; + void updateWorld(float dt); virtual void restartRace(); void disableRace(); // Put race into limbo phase /** Returns a pointer to the race gui. */ @@ -225,7 +233,6 @@ /** Called by the race result GUI at the end of the race to know the final order (fill in the 'order' array) */ virtual void raceResultOrder( int* order ) = 0; - void createEndKart(unsigned int i); }; #endif Modified: main/trunk/src/modes/world_status.cpp =================================================================== --- main/trunk/src/modes/world_status.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/world_status.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -70,24 +70,31 @@ } // setClockMode //----------------------------------------------------------------------------- -/** Adjusts the phase to be finish or delay_finish. - * \param delay True if there should be a delay before the game finishes. +/** Called when the race is finished, but it still leaves some time + * for an end of race animation, and potentially let some more AI karts + * finish the race. */ -void WorldStatus::enterRaceOverState(const bool delay) +void WorldStatus::enterRaceOverState() { - if(m_phase == DELAY_FINISH_PHASE || m_phase == FINISH_PHASE) return; // we already know + // Don't + if( m_phase == DELAY_FINISH_PHASE + || m_phase == FINISH_PHASE + || m_phase == LIMBO_PHASE ) return; - if(delay) - { - m_phase = DELAY_FINISH_PHASE; - m_auxiliary_timer = 0.0f; - } - else - m_phase = FINISH_PHASE; + m_phase = DELAY_FINISH_PHASE; + m_auxiliary_timer = 0.0f; +} // enterRaceOverState + +//----------------------------------------------------------------------------- +/** Called when it's really over (delay over if any). This function must be + * called after all stats were updated from the different modes! + */ +void WorldStatus::terminateRace() +{ if(network_manager->getMode()==NetworkManager::NW_SERVER) network_manager->sendRaceResults(); -} // enterRaceOverState +} // terminateRace //----------------------------------------------------------------------------- /** Updates all status information, called once per frame. @@ -150,8 +157,8 @@ // NOTE: no break, fall through to FINISH_PHASE handling!! } case FINISH_PHASE: + terminateRace(); new RaceOverDialog(0.6f, 0.9f); - terminateRace(); return; default: break; // default for RACE_PHASE, LIMBO_PHASE } Modified: main/trunk/src/modes/world_status.hpp =================================================================== --- main/trunk/src/modes/world_status.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/modes/world_status.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -115,12 +115,9 @@ void pause(); void unpause(); - - virtual void enterRaceOverState(const bool delay=false); + virtual void enterRaceOverState(); - /** Called when it's really over (delay over if any) - */ - virtual void terminateRace() = 0; + virtual void terminateRace(); /* * Will be called to notify your derived class that the clock, Modified: main/trunk/src/network/race_result_message.cpp =================================================================== --- main/trunk/src/network/race_result_message.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/network/race_result_message.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -56,7 +56,6 @@ char position = getChar(); kart->setPosition(position); kart->finishedRace(time); - world->createEndKart(i); } } // RaceResultMessage Modified: main/trunk/src/race/grand_prix_data.hpp =================================================================== --- main/trunk/src/race/grand_prix_data.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/race/grand_prix_data.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -49,6 +49,7 @@ public: /** Load the GrandPrixData from the given filename */ +#pragma warning(disable:4290) GrandPrixData (const std::string filename) throw(std::logic_error); GrandPrixData () {}; // empty for initialising Modified: main/trunk/src/race/race_manager.cpp =================================================================== --- main/trunk/src/race/race_manager.cpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/race/race_manager.cpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -373,12 +373,13 @@ //----------------------------------------------------------------------------- /** A kart has finished the race at the specified time (which can be - * different from RaceManager::getWorld()->getClock() in case of setting extrapolated arrival - * times). + * different from World::getWorld()->getClock() in case of setting + * extrapolated arrival times). This function is only called from + * kart::finishedRace() * \param kart The kart that finished the race. * \param time Time at which the kart finished the race. */ -void RaceManager::RaceFinished(const Kart *kart, float time) +void RaceManager::kartFinishedRace(const Kart *kart, float time) { unsigned int id = kart->getWorldKartId(); int pos = kart->getPosition(); @@ -392,7 +393,7 @@ m_kart_status[id].m_last_time = time; m_num_finished_karts ++; if(kart->getController()->isPlayerController()) m_num_finished_players++; -} // raceFinished +} // kartFinishedRace //----------------------------------------------------------------------------- /** Reruns the last race. This is called after a race is finished, and it will Modified: main/trunk/src/race/race_manager.hpp =================================================================== --- main/trunk/src/race/race_manager.hpp 2010-02-17 11:36:44 UTC (rev 4749) +++ main/trunk/src/race/race_manager.hpp 2010-02-17 11:59:51 UTC (rev 4750) @@ -210,7 +210,7 @@ void setNumPlayers(int num); void setPlayerKart(unsigned int player_id, const RemoteKartInfo& ki); - void RaceFinished(const Kart* kart, float time); + void kartFinishedRace(const Kart* kart, float time); void setTrack(const std::string& track); void setGrandPrix(const GrandPrixData &gp){ m_grand_prix = gp; } void setDifficulty(Difficulty diff); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-17 22:19:54
|
Revision: 4754 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4754&view=rev Author: auria Date: 2010-02-17 22:19:47 +0000 (Wed, 17 Feb 2010) Log Message: ----------- Fixed the code-side confusion of track description vs designer (track exporter needs to be adapted accordingly) Modified Paths: -------------- main/trunk/data/tracks/canyon/track.xml main/trunk/data/tracks/jungle/track.xml main/trunk/data/tracks/lighthouse/track.xml main/trunk/data/tracks/mines/track.xml main/trunk/data/tracks/snowmountain/track.xml main/trunk/src/states_screens/dialogs/track_info_dialog.cpp main/trunk/src/tracks/track.cpp main/trunk/src/tracks/track.hpp Modified: main/trunk/data/tracks/canyon/track.xml =================================================================== --- main/trunk/data/tracks/canyon/track.xml 2010-02-17 16:48:12 UTC (rev 4753) +++ main/trunk/data/tracks/canyon/track.xml 2010-02-17 22:19:47 UTC (rev 4754) @@ -2,7 +2,7 @@ <track name = "Canyon" version = "1" groups = "standard" - description = "Thomas Oppl" + designer = "Thomas Oppl" music = "TheDeadRocks-EasyJob.music" screenshot = "canyon_screenshot.png" > Modified: main/trunk/data/tracks/jungle/track.xml =================================================================== --- main/trunk/data/tracks/jungle/track.xml 2010-02-17 16:48:12 UTC (rev 4753) +++ main/trunk/data/tracks/jungle/track.xml 2010-02-17 22:19:47 UTC (rev 4754) @@ -2,7 +2,7 @@ <track name = "Amazonian Journey" version = "1" groups = "standard" - description = "M. Gagnon" + designer = "Marianne Gagnon" music = "amazon_jungle.music" screenshot = "sshot-jungle.png" > </track> Modified: main/trunk/data/tracks/lighthouse/track.xml =================================================================== --- main/trunk/data/tracks/lighthouse/track.xml 2010-02-17 16:48:12 UTC (rev 4753) +++ main/trunk/data/tracks/lighthouse/track.xml 2010-02-17 22:19:47 UTC (rev 4754) @@ -2,7 +2,7 @@ <track name = "Around the Lighthouse" version = "1" groups = "standard" - description = "Ingo Ruhnke & Marianne Gagnon & Stephen Dunn" + designer = "Ingo Ruhnke & Marianne Gagnon & Stephen Dunn" music = "ChillCarrier-Druckverlust.music" screenshot = "sshot-lighthouse.png" > Modified: main/trunk/data/tracks/mines/track.xml =================================================================== --- main/trunk/data/tracks/mines/track.xml 2010-02-17 16:48:12 UTC (rev 4753) +++ main/trunk/data/tracks/mines/track.xml 2010-02-17 22:19:47 UTC (rev 4754) @@ -2,7 +2,7 @@ <track name = "Old Mine" version = "1" groups = "standard" - description = "Description" + designer = "Ivar ten Cate" music = "West.ogg" screenshot = "sshot-mines.png" > Modified: main/trunk/data/tracks/snowmountain/track.xml =================================================================== --- main/trunk/data/tracks/snowmountain/track.xml 2010-02-17 16:48:12 UTC (rev 4753) +++ main/trunk/data/tracks/snowmountain/track.xml 2010-02-17 22:19:47 UTC (rev 4754) @@ -2,7 +2,7 @@ <track name = "Snow Mountain" version = "1" groups = "standard" - description = "Canis Lupus" + designer = "Canis Lupus" music = "Snowy.music" screenshot = "sshot-snowmountain.png" > Modified: main/trunk/src/states_screens/dialogs/track_info_dialog.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/track_info_dialog.cpp 2010-02-17 16:48:12 UTC (rev 4753) +++ main/trunk/src/states_screens/dialogs/track_info_dialog.cpp 2010-02-17 22:19:47 UTC (rev 4754) @@ -71,6 +71,9 @@ core::rect< s32 > creator_info_area(0, hscores_y_to, m_area.getWidth()/2, y2); + std::cout << "(( Track author : " << stringc(track->getDesigner().c_str()).c_str() + << " - " << track->getDesigner().size() << " chars )))\n"; + //I18N: when showing who is the author of track '%s' (place %s where the name of the author should appear) stringw text = StringUtils::insertValues(_("Track by %s"), track->getDesigner().c_str()); Modified: main/trunk/src/tracks/track.cpp =================================================================== --- main/trunk/src/tracks/track.cpp 2010-02-17 16:48:12 UTC (rev 4753) +++ main/trunk/src/tracks/track.cpp 2010-02-17 22:19:47 UTC (rev 4754) @@ -62,7 +62,7 @@ m_root = StringUtils::getPath(StringUtils::removeExtension(m_filename)); m_ident = StringUtils::getBasename(m_root); m_item_style = ""; - m_description = ""; + //m_description = ""; m_designer = ""; m_screenshot = ""; m_version = 0; @@ -202,7 +202,7 @@ root->get("name", &temp_name); m_name = _(temp_name.c_str()); - root->get("description", &m_description); + //root->get("description", &m_description); root->get("designer", &m_designer); root->get("version", &m_version); std::vector<std::string> filenames; Modified: main/trunk/src/tracks/track.hpp =================================================================== --- main/trunk/src/tracks/track.hpp 2010-02-17 16:48:12 UTC (rev 4753) +++ main/trunk/src/tracks/track.hpp 2010-02-17 22:19:47 UTC (rev 4754) @@ -213,7 +213,7 @@ /** Returns the filename of this track. */ const std::string& getFilename () const {return m_filename; } - const std::string& getDescription () const {return m_description; } + //const std::string& getDescription () const {return m_description; } const std::string& getDesigner () const {return m_designer; } /** Returns an absolute path to the screenshot file of this track */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-02-20 01:42:39
|
Revision: 4775 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4775&view=rev Author: hikerstk Date: 2010-02-20 01:42:32 +0000 (Sat, 20 Feb 2010) Log Message: ----------- Added support of far camera to stk, updated final camera handling of track exporter. Modified Paths: -------------- main/trunk/data/tracks/stk_track.py main/trunk/src/graphics/camera.cpp main/trunk/src/tracks/track.cpp main/trunk/src/tracks/track.hpp Modified: main/trunk/data/tracks/stk_track.py =================================================================== --- main/trunk/data/tracks/stk_track.py 2010-02-20 01:39:51 UTC (rev 4774) +++ main/trunk/data/tracks/stk_track.py 2010-02-20 01:42:32 UTC (rev 4775) @@ -407,7 +407,6 @@ version = getIdProperty(scene, "version", "1" ) groups = getIdProperty(scene, "groups", "standard" ) is_arena = getIdProperty(scene, "arena", "" ) - camera_far = getIdProperty(scene, "camera-far", "" ) designer = getIdProperty(scene, "designer", "" ) # Support for multi-line descriptions: designer = designer.replace("\\n", "\n") @@ -442,8 +441,6 @@ print "No music file defined, ignored." if is_arena: f.write(" arena = \"%s\"\n"%is_arena) - if camera_far: - f.write(" camera-far = \"%s\"\n"%camera_far) if screenshot: f.write(" screenshot = \"%s\"\n"%screenshot) else: @@ -1083,6 +1080,9 @@ """ %(texture, hori, verti, tex_percent, sphere_percent)) elif sky=="box": pass + camera_far = getIdProperty(scene, "camera-far", "" ) + if camera_far: + f.write(" <camera far=\"%s\"/>\n"%camera_far) self.writeStartPositions(f, lStart) f.write("</scene>\n") Modified: main/trunk/src/graphics/camera.cpp =================================================================== --- main/trunk/src/graphics/camera.cpp 2010-02-20 01:39:51 UTC (rev 4774) +++ main/trunk/src/graphics/camera.cpp 2010-02-20 01:42:32 UTC (rev 4775) @@ -131,6 +131,7 @@ } // switch m_camera->setFOV(m_fov); m_camera->setAspectRatio(m_aspect); + m_camera->setFarValue(World::getWorld()->getTrack()->getCameraFar()); } // setupCamera // ---------------------------------------------------------------------------- Modified: main/trunk/src/tracks/track.cpp =================================================================== --- main/trunk/src/tracks/track.cpp 2010-02-20 01:39:51 UTC (rev 4774) +++ main/trunk/src/tracks/track.cpp 2010-02-20 01:42:32 UTC (rev 4775) @@ -72,6 +72,7 @@ m_all_meshes.clear(); m_has_final_camera = false; m_is_arena = false; + m_camera_far = 1000.0f; m_quad_graph = NULL; m_animation_manager = NULL; m_check_manager = NULL; @@ -719,6 +720,10 @@ node->get("h", &h); m_start_heading.push_back(h); } + else if(name=="camera") + { + node->get("far", &m_camera_far); + } else if(name=="animations") { m_animation_manager = new AnimationManager(*this, *node); Modified: main/trunk/src/tracks/track.hpp =================================================================== --- main/trunk/src/tracks/track.hpp 2010-02-20 01:39:51 UTC (rev 4774) +++ main/trunk/src/tracks/track.hpp 2010-02-20 01:42:32 UTC (rev 4775) @@ -89,6 +89,8 @@ /** The version of this track. A certain STK version will only support * certain track versions. */ int m_version; + /** Far value for cameras for this track. */ + float m_camera_far; /** The graph used to connect the quads. */ QuadGraph *m_quad_graph; @@ -267,6 +269,9 @@ /** Sets the current ambient color for a kart with index k. */ void setAmbientColor(const video::SColor &color, unsigned int k); + /** Returns the far value for cameras. */ + float getCameraFar() const { return m_camera_far; } + /** Get the number of start positions defined in the scene file. */ unsigned int getNumberOfStartPositions() const { return m_start_positions.size(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-21 02:22:12
|
Revision: 4784 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4784&view=rev Author: auria Date: 2010-02-21 02:22:05 +0000 (Sun, 21 Feb 2010) Log Message: ----------- No more crash on end of GP (nothing useful show yet) Modified Paths: -------------- main/trunk/src/Makefile.am main/trunk/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj main/trunk/src/race/race_manager.cpp main/trunk/src/states_screens/dialogs/track_info_dialog.cpp Added Paths: ----------- main/trunk/data/gui/grand_prix_over.stkgui main/trunk/src/states_screens/grand_prix_over.cpp main/trunk/src/states_screens/grand_prix_over.hpp Added: main/trunk/data/gui/grand_prix_over.stkgui =================================================================== --- main/trunk/data/gui/grand_prix_over.stkgui (rev 0) +++ main/trunk/data/gui/grand_prix_over.stkgui 2010-02-21 02:22:05 UTC (rev 4784) @@ -0,0 +1,5 @@ +<stkgui> + + <button id="continue" x="20" y="-40" width="250" height="35" align="left" text="Continue"/> + +</stkgui> \ No newline at end of file Modified: main/trunk/src/Makefile.am =================================================================== --- main/trunk/src/Makefile.am 2010-02-21 01:50:59 UTC (rev 4783) +++ main/trunk/src/Makefile.am 2010-02-21 02:22:05 UTC (rev 4784) @@ -282,6 +282,8 @@ states_screens/arenas_screen.hpp \ states_screens/feature_unlocked.cpp \ states_screens/feature_unlocked.hpp \ + states_screens/grand_prix_over.cpp \ + states_screens/grand_prix_over.hpp \ states_screens/help_screen_1.cpp \ states_screens/help_screen_1.hpp \ states_screens/help_screen_2.cpp \ Modified: main/trunk/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj =================================================================== --- main/trunk/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj 2010-02-21 01:50:59 UTC (rev 4783) +++ main/trunk/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj 2010-02-21 02:22:05 UTC (rev 4784) @@ -268,6 +268,7 @@ 958D8C54104F523000A81934 /* race_paused_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 958D8C53104F523000A81934 /* race_paused_dialog.cpp */; }; 959482D310EBC0790031BADF /* track_object_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 959482CF10EBC0790031BADF /* track_object_manager.cpp */; }; 959482D410EBC0790031BADF /* track_object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 959482D110EBC0790031BADF /* track_object.cpp */; }; + 959D42FD1130C4F2005077E2 /* grand_prix_over.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 959D42FB1130C4F2005077E2 /* grand_prix_over.cpp */; }; 95B5CD14102DE08F00EF2001 /* device_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95B5CD13102DE08F00EF2001 /* device_config.cpp */; }; 95C77D631069589B0080838E /* ambient_light_sphere.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C77D621069589B0080838E /* ambient_light_sphere.cpp */; }; 95C77D66106958A50080838E /* check_line.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C77D65106958A50080838E /* check_line.cpp */; }; @@ -494,6 +495,8 @@ 959482D010EBC0790031BADF /* track_object_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = track_object_manager.hpp; path = ../../tracks/track_object_manager.hpp; sourceTree = SOURCE_ROOT; }; 959482D110EBC0790031BADF /* track_object.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = track_object.cpp; path = ../../tracks/track_object.cpp; sourceTree = SOURCE_ROOT; }; 959482D210EBC0790031BADF /* track_object.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = track_object.hpp; path = ../../tracks/track_object.hpp; sourceTree = SOURCE_ROOT; }; + 959D42FB1130C4F2005077E2 /* grand_prix_over.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = grand_prix_over.cpp; path = ../../states_screens/grand_prix_over.cpp; sourceTree = SOURCE_ROOT; }; + 959D42FC1130C4F2005077E2 /* grand_prix_over.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = grand_prix_over.hpp; path = ../../states_screens/grand_prix_over.hpp; sourceTree = SOURCE_ROOT; }; 95A118290F77EA3100B18B3D /* input.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input.hpp; path = ../../input/input.hpp; sourceTree = SOURCE_ROOT; }; 95A1182A0F77EA3100B18B3D /* input_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = input_manager.cpp; path = ../../input/input_manager.cpp; sourceTree = SOURCE_ROOT; }; 95A1182B0F77EA3100B18B3D /* input_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input_manager.hpp; path = ../../input/input_manager.hpp; sourceTree = SOURCE_ROOT; }; @@ -1313,6 +1316,8 @@ 958330C310122B4A00C5137E /* credits.hpp */, 95D2343E1078227A00625256 /* feature_unlocked.cpp */, 95D2343D1078227A00625256 /* feature_unlocked.hpp */, + 959D42FB1130C4F2005077E2 /* grand_prix_over.cpp */, + 959D42FC1130C4F2005077E2 /* grand_prix_over.hpp */, 9522F1DE10795E8A0067ECF5 /* help_screen_1.cpp */, 9522F1DF10795E8A0067ECF5 /* help_screen_1.hpp */, 9522F1E210795EFF0067ECF5 /* help_screen_2.cpp */, @@ -2613,6 +2618,7 @@ 956C6ED51128D3FB004336C8 /* end_controller.cpp in Sources */, 956C6ED61128D3FB004336C8 /* new_ai_controller.cpp in Sources */, 956C6ED71128D3FB004336C8 /* player_controller.cpp in Sources */, + 959D42FD1130C4F2005077E2 /* grand_prix_over.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: main/trunk/src/race/race_manager.cpp =================================================================== --- main/trunk/src/race/race_manager.cpp 2010-02-21 01:50:59 UTC (rev 4783) +++ main/trunk/src/race/race_manager.cpp 2010-02-21 02:22:05 UTC (rev 4784) @@ -24,8 +24,6 @@ #include "challenges/unlock_manager.hpp" #include "config/user_config.hpp" #include "config/stk_config.hpp" -#include "states_screens/kart_selection.hpp" -#include "states_screens/state_manager.hpp" #include "input/device_manager.hpp" #include "input/input_manager.hpp" #include "karts/kart_properties_manager.hpp" @@ -35,6 +33,10 @@ #include "modes/world.hpp" #include "modes/three_strikes_battle.hpp" #include "network/network_manager.hpp" +#include "states_screens/grand_prix_over.hpp" +#include "states_screens/kart_selection.hpp" +#include "states_screens/main_menu_screen.hpp" +#include "states_screens/state_manager.hpp" #include "tracks/track_manager.hpp" RaceManager* race_manager= NULL; @@ -360,8 +362,9 @@ delete []race_time; unlock_manager->grandPrixFinished(); - // TODO - Grand Prix ending - // menu_manager->switchToGrandPrixEnding(); + + StateManager::get()->resetAndGoToScreen( MainMenuScreen::getInstance() ); + StateManager::get()->pushScreen ( GrandPrixOver::getInstance() ); } delete World::getWorld(); Modified: main/trunk/src/states_screens/dialogs/track_info_dialog.cpp =================================================================== --- main/trunk/src/states_screens/dialogs/track_info_dialog.cpp 2010-02-21 01:50:59 UTC (rev 4783) +++ main/trunk/src/states_screens/dialogs/track_info_dialog.cpp 2010-02-21 02:22:05 UTC (rev 4784) @@ -290,6 +290,8 @@ if (num_laps != -1) race_manager->setNumLaps( num_laps ); + race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE); + race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge //race_manager->setNumKarts( 1 ); network_manager->setupPlayerKartInfo(); Added: main/trunk/src/states_screens/grand_prix_over.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_over.cpp (rev 0) +++ main/trunk/src/states_screens/grand_prix_over.cpp 2010-02-21 02:22:05 UTC (rev 4784) @@ -0,0 +1,111 @@ + +#include "states_screens/grand_prix_over.hpp" + + +#include "guiengine/engine.hpp" +#include "io/file_manager.hpp" +#include "items/item_manager.hpp" +#include "states_screens/state_manager.hpp" +#include "utils/translation.hpp" + +#include <SColor.h> + +using namespace irr::core; +using namespace irr::gui; +using namespace irr::video; + +// ------------------------------------------------------------------------------------- + +GrandPrixOver::GrandPrixOver() : Screen("grand_prix_over.stkgui") +{ + setNeeds3D(true); + + throttleFPS = false; +} + +// ------------------------------------------------------------------------------------- + +void GrandPrixOver::init() +{ + m_sky_angle = 0.0f; + m_global_time = 0.0f; + + //m_sky = irr_driver->addSkyDome(file_manager->getTextureFile("lscales.png"), 16 /* hori_res */, 16 /* vert_res */, + // 1.0f /* texture_percent */, 2.0f /* sphere_percent */); + + std::vector<std::string> texture_names(6); + texture_names[0] = file_manager->getTextureFile("purplenebula.png"); + texture_names[1] = file_manager->getTextureFile("purplenebula2.png"); + texture_names[2] = file_manager->getTextureFile("purplenebula.png"); + texture_names[3] = file_manager->getTextureFile("purplenebula2.png"); + texture_names[4] = file_manager->getTextureFile("purplenebula.png"); + texture_names[5] = file_manager->getTextureFile("purplenebula2.png"); + m_sky = irr_driver->addSkyBox(texture_names); + + m_camera = irr_driver->addCameraSceneNode(); + m_camera->setPosition( core::vector3df(0.0, 30.0f, 70.0f) ); + m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) ); + m_camera->setTarget( core::vector3df(0, 10, 0.0f) ); + m_camera->setFOV( DEGREE_TO_RAD*50.0f ); + m_camera->updateAbsolutePosition(); + + irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 120, 120, 120)); + + const core::vector3df &sun_pos = core::vector3df( 0, 200, 100.0f ); + m_light = irr_driver->getSceneManager()->addLightSceneNode(NULL, sun_pos, video::SColorf(1.0f,1.0f,1.0f), 10000.0f /* radius */); + m_light->getLightData().DiffuseColor = irr::video::SColorf(1.0f, 1.0f, 1.0f, 1.0f); + m_light->getLightData().SpecularColor = irr::video::SColorf(1.0f, 1.0f, 1.0f, 1.0f); + +} + +// ------------------------------------------------------------------------------------- + +void GrandPrixOver::tearDown() +{ + irr_driver->removeNode(m_sky); + m_sky = NULL; + + irr_driver->removeCameraSceneNode(m_camera); + m_camera = NULL; + + irr_driver->removeNode(m_light); + m_light = NULL; +} + +// ------------------------------------------------------------------------------------- + +void GrandPrixOver::onUpdate(float dt, irr::video::IVideoDriver* driver) +{ + m_global_time += dt; + + m_sky_angle += dt*2; + if (m_sky_angle > 360) m_sky_angle -= 360; + m_sky->setRotation( core::vector3df(0, m_sky_angle, 0) ); + + + static const int w = irr_driver->getFrameSize().Width; + static const int h = irr_driver->getFrameSize().Height; + const irr::video::SColor color(255, 255, 255, 255); + + static int test_y = 0; + + GUIEngine::getTitleFont()->draw(_("Grand Prix Results"), + core::rect< s32 >( 0, test_y, w, h/10 ), + color, + true/* center h */, true /* center v */ ); +} + +// ------------------------------------------------------------------------------------- + +void GrandPrixOver::eventCallback(GUIEngine::Widget* widget, + const std::string& name, + const int playerID) +{ + if (name == "continue") + { + // we assume the main menu was pushed before showing this menu + StateManager::get()->popMenu(); + } +} + +// ------------------------------------------------------------------------------------- Property changes on: main/trunk/src/states_screens/grand_prix_over.cpp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: main/trunk/src/states_screens/grand_prix_over.hpp =================================================================== --- main/trunk/src/states_screens/grand_prix_over.hpp (rev 0) +++ main/trunk/src/states_screens/grand_prix_over.hpp 2010-02-21 02:22:05 UTC (rev 4784) @@ -0,0 +1,39 @@ +#ifndef HEADER_GRAND_PRIX_OVER_HPP +#define HEADER_GRAND_PRIX_OVER_HPP + +#include "guiengine/screen.hpp" + +namespace irr { namespace scene { class ISceneNode; class ICameraSceneNode; class ILightSceneNode; } } +class KartProperties; + + +class GrandPrixOver : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<GrandPrixOver> +{ + friend class GUIEngine::ScreenSingleton<GrandPrixOver>; + + GrandPrixOver(); + + /** sky angle, 0-360 */ + float m_sky_angle; + + /** Global evolution of time */ + double m_global_time; + + + irr::scene::ISceneNode* m_sky; + irr::scene::ICameraSceneNode* m_camera; + + irr::scene::ILightSceneNode* m_light; +public: + + void onUpdate(float dt, irr::video::IVideoDriver*); + + void init(); + void tearDown(); + + void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); + +}; + +#endif + Property changes on: main/trunk/src/states_screens/grand_prix_over.hpp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-21 23:10:30
|
Revision: 4787 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4787&view=rev Author: auria Date: 2010-02-21 23:10:24 +0000 (Sun, 21 Feb 2010) Log Message: ----------- Initial work on end-of-GP Modified Paths: -------------- main/trunk/data/textures/materials.xml main/trunk/src/race/race_manager.cpp main/trunk/src/states_screens/grand_prix_over.cpp main/trunk/src/states_screens/grand_prix_over.hpp main/trunk/src/states_screens/main_menu_screen.cpp Added Paths: ----------- main/trunk/data/models/door.png main/trunk/data/models/shroom_color2.png main/trunk/data/models/shroom_color_a.png main/trunk/data/models/village.b3d main/trunk/data/models/wood_podium.b3d main/trunk/data/textures/oakbark.jpg main/trunk/data/textures/oakleaf_fall.tga Added: main/trunk/data/models/door.png =================================================================== (Binary files differ) Property changes on: main/trunk/data/models/door.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: main/trunk/data/models/shroom_color2.png =================================================================== (Binary files differ) Property changes on: main/trunk/data/models/shroom_color2.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: main/trunk/data/models/shroom_color_a.png =================================================================== (Binary files differ) Property changes on: main/trunk/data/models/shroom_color_a.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: main/trunk/data/models/village.b3d =================================================================== (Binary files differ) Property changes on: main/trunk/data/models/village.b3d ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: main/trunk/data/models/wood_podium.b3d =================================================================== (Binary files differ) Property changes on: main/trunk/data/models/wood_podium.b3d ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: main/trunk/data/textures/materials.xml =================================================================== --- main/trunk/data/textures/materials.xml 2010-02-21 02:40:59 UTC (rev 4786) +++ main/trunk/data/textures/materials.xml 2010-02-21 23:10:24 UTC (rev 4787) @@ -14,6 +14,7 @@ <material name="stonewall.png" alpha="0.0" collide="N"/> <material name="pebbles.png" alpha="0.0" collide="N"/> <material name="egypt.png" alpha="0.0"/> + <material name="oakleaf_fall.tga" alpha="Y" collide="N" ignore="Y" /> <material name="starparticle.png" clampU="Y" clampV="Y" alpha="Y" collide="N" ignore="Y" light="N"/> <material name="pyramidwall.png" alpha="0.0" collide="N"/> <material name="lava.png" alpha="0.0" light="N" reset="Y"/> Added: main/trunk/data/textures/oakbark.jpg =================================================================== (Binary files differ) Property changes on: main/trunk/data/textures/oakbark.jpg ___________________________________________________________________ Added: svn:mime-type + image/jpeg Added: main/trunk/data/textures/oakleaf_fall.tga =================================================================== (Binary files differ) Property changes on: main/trunk/data/textures/oakleaf_fall.tga ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: main/trunk/src/race/race_manager.cpp =================================================================== --- main/trunk/src/race/race_manager.cpp 2010-02-21 02:40:59 UTC (rev 4786) +++ main/trunk/src/race/race_manager.cpp 2010-02-21 23:10:24 UTC (rev 4787) @@ -351,7 +351,7 @@ } } while(!sorted); - for(unsigned int i=start; i < NUM_KARTS; ++i) + for (unsigned int i=start; i < NUM_KARTS; ++i) { //printf("setting kart %s to rank %i\n", race_manager->getKartName(position[i]).c_str(), i-start); m_kart_status[position[i]].m_gp_final_rank = i - start; @@ -365,6 +365,18 @@ StateManager::get()->resetAndGoToScreen( MainMenuScreen::getInstance() ); StateManager::get()->pushScreen ( GrandPrixOver::getInstance() ); + + std::string winners[3]; + for (unsigned int i=start; i < m_kart_status.size(); ++i) + { + const int rank = m_kart_status[i].m_gp_final_rank; + if (rank >= 0 && rank < 3) + { + winners[rank] = m_kart_status[i].m_ident; + } + } + + GrandPrixOver::getInstance()->setKarts(winners); } delete World::getWorld(); Modified: main/trunk/src/states_screens/grand_prix_over.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_over.cpp 2010-02-21 02:40:59 UTC (rev 4786) +++ main/trunk/src/states_screens/grand_prix_over.cpp 2010-02-21 23:10:24 UTC (rev 4787) @@ -1,19 +1,25 @@ #include "states_screens/grand_prix_over.hpp" - +#include "graphics/irr_driver.hpp" #include "guiengine/engine.hpp" #include "io/file_manager.hpp" #include "items/item_manager.hpp" +#include "karts/kart_properties_manager.hpp" #include "states_screens/state_manager.hpp" #include "utils/translation.hpp" #include <SColor.h> +#include <iostream> using namespace irr::core; using namespace irr::gui; using namespace irr::video; +const float INITIAL_Y = -3.0f; +const float INITIAL_PODIUM_Y = -3.6f; +const float PODIUM_HEIGHT[3] = { 0.325f, 0.5f, 0.15f }; + // ------------------------------------------------------------------------------------- GrandPrixOver::GrandPrixOver() : Screen("grand_prix_over.stkgui") @@ -21,34 +27,60 @@ setNeeds3D(true); throttleFPS = false; + + m_kart_node[0] = NULL; + m_kart_node[1] = NULL; + m_kart_node[2] = NULL; } // ------------------------------------------------------------------------------------- void GrandPrixOver::init() { + m_phase = 1; m_sky_angle = 0.0f; m_global_time = 0.0f; - //m_sky = irr_driver->addSkyDome(file_manager->getTextureFile("lscales.png"), 16 /* hori_res */, 16 /* vert_res */, - // 1.0f /* texture_percent */, 2.0f /* sphere_percent */); + m_sky = irr_driver->addSkyDome(file_manager->getTextureFile("clouds.png"), + 16 /* hori_res */, 16 /* vert_res */, + 1.0f /* texture_percent */, 2.0f /* sphere_percent */); - std::vector<std::string> texture_names(6); - texture_names[0] = file_manager->getTextureFile("purplenebula.png"); - texture_names[1] = file_manager->getTextureFile("purplenebula2.png"); - texture_names[2] = file_manager->getTextureFile("purplenebula.png"); - texture_names[3] = file_manager->getTextureFile("purplenebula2.png"); - texture_names[4] = file_manager->getTextureFile("purplenebula.png"); - texture_names[5] = file_manager->getTextureFile("purplenebula2.png"); - m_sky = irr_driver->addSkyBox(texture_names); - m_camera = irr_driver->addCameraSceneNode(); - m_camera->setPosition( core::vector3df(0.0, 30.0f, 70.0f) ); + m_camera->setPosition( core::vector3df(3.0, 0.0f, -5.0f) ); m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) ); - m_camera->setTarget( core::vector3df(0, 10, 0.0f) ); + m_camera->setTarget( core::vector3df(1.5f, -2.0f, 0.0f) ); m_camera->setFOV( DEGREE_TO_RAD*50.0f ); m_camera->updateAbsolutePosition(); + + scene::IMesh* model_village = irr_driver->getMesh( file_manager->getModelFile("village.b3d") ); + assert(model_village != NULL); + m_village = irr_driver->addMesh(model_village); + m_village->setPosition( core::vector3df(2, INITIAL_Y, 0) ); + + + scene::IMesh* podium_model = irr_driver->getMesh( file_manager->getModelFile("wood_podium.b3d") ); + assert(podium_model != NULL); + + + m_podium_x[0] = 1.4f; + m_podium_z[0] = 0.0f; + + m_podium_x[1] = 2.2f; + m_podium_z[1] = 0.5f; + + m_podium_x[2] = 3.0f; + m_podium_z[2] = 0.0f; + + m_podium_step[0] = irr_driver->addMesh(podium_model); + m_podium_step[0]->setPosition( core::vector3df(m_podium_x[0], INITIAL_PODIUM_Y, m_podium_z[0]) ); + + m_podium_step[1] = irr_driver->addMesh(podium_model); + m_podium_step[1]->setPosition( core::vector3df(m_podium_x[1], INITIAL_PODIUM_Y, m_podium_z[1]) ); + + m_podium_step[2] = irr_driver->addMesh(podium_model); + m_podium_step[2]->setPosition( core::vector3df(m_podium_x[2], INITIAL_PODIUM_Y, m_podium_z[2]) ); + irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 120, 120, 120)); const core::vector3df &sun_pos = core::vector3df( 0, 200, 100.0f ); @@ -70,6 +102,17 @@ irr_driver->removeNode(m_light); m_light = NULL; + + irr_driver->removeNode(m_village); + m_village = NULL; + + for (int n=0; n<3; n++) + { + irr_driver->removeNode(m_podium_step[n]); + m_podium_step[n] = NULL; + irr_driver->removeNode(m_kart_node[n]); + m_kart_node[n] = NULL; + } } // ------------------------------------------------------------------------------------- @@ -83,6 +126,112 @@ m_sky->setRotation( core::vector3df(0, m_sky_angle, 0) ); + // ---- karts move + if (m_phase == 1) + { + int karts_on_target = 0; + for (int k=0; k<3; k++) + { + if (m_kart_node[k] != NULL) + { + bool x_target_reached = false, z_target_reached = false; + + if (fabsf(m_kart_x[k] - m_podium_x[k]) > dt) + { + if (m_kart_x[k] < m_podium_x[k]) + { + m_kart_x[k] += dt; + } + else if (m_kart_x[k] > m_podium_x[k]) + { + m_kart_x[k] -= dt; + } + } + else + { + m_kart_x[k] = m_podium_x[k]; + x_target_reached = true; + } + + if (fabsf(m_kart_z[k] - m_podium_z[k]) > dt) + { + if (m_kart_z[k] < m_podium_z[k]) + { + m_kart_z[k] += dt; + } + else if (m_kart_z[k] > m_podium_z[k]) + { + m_kart_z[k] -= dt; + } + } + else + { + m_kart_z[k] = m_podium_z[k]; + z_target_reached=true; + } + + + if (x_target_reached && z_target_reached) karts_on_target++; + + //std::cout << "kart position [" << k << "] = " << m_kart_x[k] << ", " << m_kart_z[k] << std::endl; + + m_kart_node[k]->setPosition( core::vector3df(m_kart_x[k], m_kart_y[k], m_kart_z[k]) ); + } + } // end for + + if (karts_on_target == 3) + { + m_phase = 2; + } + } + + // ---- Karts Rotate + else if (m_phase == 2) + { + int karts_on_target = 0; + for (int k=0; k<3; k++) + { + if (m_kart_node[k] != NULL) + { + if (m_kart_rotation[k] < 180.f) + { + m_kart_rotation[k] += 25.0f*dt; + m_kart_node[k]->setRotation( core::vector3df(0, m_kart_rotation[k], 0) ); + m_podium_step[k]->setRotation( core::vector3df(0, m_kart_rotation[k], 0) ); + } + else + { + karts_on_target++; + } + } + } // end for + + if (karts_on_target == 3) m_phase = 3; + } + + // ---- Podium Rises + else if (m_phase == 3) + { + for (int k=0; k<3; k++) + { + if (m_kart_node[k] != NULL) + { + const float y_target = INITIAL_Y + PODIUM_HEIGHT[k]; + if (m_kart_y[k] < y_target) + { + m_kart_y[k] += dt*(PODIUM_HEIGHT[k]); + m_kart_node[k]->setPosition( core::vector3df(m_kart_x[k], m_kart_y[k], m_kart_z[k]) ); + m_podium_step[k]->setPosition( core::vector3df(m_podium_x[k], + INITIAL_PODIUM_Y - (INITIAL_Y - m_kart_y[k]), + m_podium_z[k]) ); + + } + } + } // end for + + } + + // ---- title static const int w = irr_driver->getFrameSize().Width; static const int h = irr_driver->getFrameSize().Height; const irr::video::SColor color(255, 255, 255, 255); @@ -109,3 +258,48 @@ } // ------------------------------------------------------------------------------------- + +void GrandPrixOver::setKarts(const std::string idents_arg[3]) +{ + // reorder in "podium order" (i.e. second player to the left, first player in the middle, last at the right) + std::string idents[3]; + idents[0] = idents_arg[1]; + idents[1] = idents_arg[0]; + idents[2] = idents_arg[2]; + + for (int n=0; n<3; n++) + { + if (idents[n].size() == 0) continue; + + scene::ISceneNode* kart_main_node = NULL; + + const KartProperties* kart = kart_properties_manager->getKart(idents[n]); + if (kart != NULL) + { + KartModel* kartModel = kart->getKartModel(); + + m_kart_x[n] = n*2; + m_kart_y[n] = INITIAL_Y; + m_kart_z[n] = -4; + m_kart_rotation[n] = 0.0f; + + kart_main_node = irr_driver->addMesh(kartModel->getModel()); + kart_main_node->setPosition( core::vector3df(m_kart_x[n], m_kart_y[n], m_kart_z[n]) ); + kart_main_node->setScale( core::vector3df(0.4f, 0.4, 0.4f) ); + kart_main_node->updateAbsolutePosition(); + + for (int wheel=0; wheel<4; wheel++) + { + scene::ISceneNode* wheel_model = irr_driver->getSceneManager()->addMeshSceneNode( + kartModel->getWheelModel(wheel), + kart_main_node); + wheel_model->setPosition( kartModel->getWheelGraphicsPosition(wheel).toIrrVector() ); + wheel_model->updateAbsolutePosition(); + } + } + + m_kart_node[n] = kart_main_node; + } +} + +// ------------------------------------------------------------------------------------- Modified: main/trunk/src/states_screens/grand_prix_over.hpp =================================================================== --- main/trunk/src/states_screens/grand_prix_over.hpp 2010-02-21 02:40:59 UTC (rev 4786) +++ main/trunk/src/states_screens/grand_prix_over.hpp 2010-02-21 23:10:24 UTC (rev 4787) @@ -19,11 +19,22 @@ /** Global evolution of time */ double m_global_time; + irr::scene::IMeshSceneNode* m_village; + + irr::scene::IMeshSceneNode* m_podium_step[3]; + irr::scene::ISceneNode* m_kart_node[3]; irr::scene::ISceneNode* m_sky; irr::scene::ICameraSceneNode* m_camera; irr::scene::ILightSceneNode* m_light; + + int m_phase; + + float m_kart_x[3], m_kart_y[3], m_kart_z[3]; + float m_podium_x[3], m_podium_z[3]; + float m_kart_rotation[3]; + public: void onUpdate(float dt, irr::video::IVideoDriver*); @@ -31,6 +42,8 @@ void init(); void tearDown(); + void setKarts(const std::string idents[3]); + void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID); }; Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-02-21 02:40:59 UTC (rev 4786) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-02-21 23:10:24 UTC (rev 4787) @@ -31,6 +31,8 @@ // FIXME : remove, temporary test #include "states_screens/feature_unlocked.hpp" +#include "states_screens/grand_prix_over.hpp" + #include "tracks/track_manager.hpp" #include "tracks/track.hpp" @@ -65,6 +67,12 @@ if (selection == "network") { // FIXME : remove, temporary test + GrandPrixOver* scene = GrandPrixOver::getInstance(); + const std::string winners[] = { "tux", "nolok", "pidgin" }; + scene->setKarts( winners ); + StateManager::get()->pushScreen(scene); + + /* FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance(); static int i = 0; @@ -81,6 +89,7 @@ scene->setUnlockedPicture( irr_driver->getTexture(track_manager->getTrack("beach")->getScreenshotFile().c_str()) ); StateManager::get()->pushScreen(scene); } + */ } if (selection == "new") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-02-22 01:27:06
|
Revision: 4793 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4793&view=rev Author: auria Date: 2010-02-22 00:46:04 +0000 (Mon, 22 Feb 2010) Log Message: ----------- Play a different music on GP end screen Modified Paths: -------------- main/trunk/src/states_screens/grand_prix_over.cpp Added Paths: ----------- main/trunk/data/music/win_theme.music main/trunk/data/music/win_theme.ogg Added: main/trunk/data/music/win_theme.music =================================================================== --- main/trunk/data/music/win_theme.music (rev 0) +++ main/trunk/data/music/win_theme.music 2010-02-22 00:46:04 UTC (rev 4793) @@ -0,0 +1,6 @@ +<music> + <title value="Win Theme" /> + <composer value="Weirwood" /> + <file value="win_theme.ogg" /> +</music> + Added: main/trunk/data/music/win_theme.ogg =================================================================== (Binary files differ) Property changes on: main/trunk/data/music/win_theme.ogg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: main/trunk/src/states_screens/grand_prix_over.cpp =================================================================== --- main/trunk/src/states_screens/grand_prix_over.cpp 2010-02-22 00:15:36 UTC (rev 4792) +++ main/trunk/src/states_screens/grand_prix_over.cpp 2010-02-22 00:46:04 UTC (rev 4793) @@ -1,6 +1,7 @@ #include "states_screens/grand_prix_over.hpp" +#include "audio/sound_manager.hpp" #include "graphics/irr_driver.hpp" #include "guiengine/engine.hpp" #include "io/file_manager.hpp" @@ -31,12 +32,23 @@ m_kart_node[0] = NULL; m_kart_node[1] = NULL; m_kart_node[2] = NULL; + + m_podium_x[0] = 1.4f; + m_podium_z[0] = 0.0f; + + m_podium_x[1] = 2.2f; + m_podium_z[1] = 0.5f; + + m_podium_x[2] = 3.0f; + m_podium_z[2] = 0.0f; } // ------------------------------------------------------------------------------------- void GrandPrixOver::init() { + sound_manager->startMusic(sound_manager->getMusicInformation(file_manager->getMusicFile("win_theme.music"))); + m_phase = 1; m_sky_angle = 0.0f; m_global_time = 0.0f; @@ -69,15 +81,6 @@ assert(podium_model != NULL); - m_podium_x[0] = 1.4f; - m_podium_z[0] = 0.0f; - - m_podium_x[1] = 2.2f; - m_podium_z[1] = 0.5f; - - m_podium_x[2] = 3.0f; - m_podium_z[2] = 0.0f; - m_podium_step[0] = irr_driver->addMesh(podium_model); m_podium_step[0]->setPosition( core::vector3df(m_podium_x[0], INITIAL_PODIUM_Y, m_podium_z[0]) ); @@ -119,6 +122,11 @@ if (m_kart_node[n] != NULL) irr_driver->removeNode(m_kart_node[n]); m_kart_node[n] = NULL; } + + // restore menu music when leaving (FIXME: this assume we always go to menu after) + sound_manager->stopMusic(); + sound_manager->startMusic(stk_config->m_title_music); + } // ------------------------------------------------------------------------------------- @@ -140,25 +148,7 @@ { if (m_kart_node[k] != NULL) { - bool x_target_reached = false, z_target_reached = false; - - if (fabsf(m_kart_x[k] - m_podium_x[k]) > dt) - { - if (m_kart_x[k] < m_podium_x[k]) - { - m_kart_x[k] += dt; - } - else if (m_kart_x[k] > m_podium_x[k]) - { - m_kart_x[k] -= dt; - } - } - else - { - m_kart_x[k] = m_podium_x[k]; - x_target_reached = true; - } - + if (fabsf(m_kart_z[k] - m_podium_z[k]) > dt) { if (m_kart_z[k] < m_podium_z[k]) @@ -169,18 +159,9 @@ { m_kart_z[k] -= dt; } + karts_not_yet_done++; } - else - { - m_kart_z[k] = m_podium_z[k]; - z_target_reached=true; - } - - - if (!x_target_reached || !z_target_reached) karts_not_yet_done++; - - //std::cout << "kart position [" << k << "] = " << m_kart_x[k] << ", " << m_kart_z[k] << std::endl; - + m_kart_node[k]->setPosition( core::vector3df(m_kart_x[k], m_kart_y[k], m_kart_z[k]) ); } } // end for @@ -302,7 +283,7 @@ { KartModel* kartModel = kart->getKartModel(); - m_kart_x[n] = n*2; + m_kart_x[n] = m_podium_x[n]; m_kart_y[n] = INITIAL_Y; m_kart_z[n] = -4; m_kart_rotation[n] = 0.0f; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |