Support for Maemo5 is in included patch. Thanks to Kurosu pretty much
all of my previous patches are already integrated to svn so this is
mainly configuration bits.

Support for N900 international up/down arrows is a bit hackish, but
that was the easiest way to do it.

-- 
Mikko Vartiainen
Index: data/wormux_default_maemo_config.xml
===================================================================
--- data/wormux_default_maemo_config.xml	(revision 0)
+++ data/wormux_default_maemo_config.xml	(revision 0)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resources>
+
+<section name="default_video_mode">
+  <int name="number_of_resolution_available" value="10" />
+  <point name="1" x="1680" y="1050" />
+  <point name="2" x="1600" y="1200" />
+  <point name="3" x="1400" y="1050" />
+  <point name="4" x="1366" y="768" />
+  <point name="5" x="1360" y="768" />
+  <point name="6" x="1280" y="1024" />
+  <point name="7" x="1024" y="768"  />
+  <point name="8" x="1024" y="600"  />
+  <point name="9" x="800"  y="600"  />
+  <point name="10" x="800"  y="480"  />
+  <point name="11" x="640"  y="480"  />
+</section>
+
+<section name="default_keyboard_layout">
+  <bind key="left" action="move_left" />
+  <bind key="left" action="move_left_slowly" shift="true" />
+  <bind key="right" action="move_right" />
+  <bind key="right" action="move_right_slowly" shift="true" />
+  <bind key="up" action="up" />
+  <bind key="left" action="up" alt="true" />
+  <bind key="up" action="up_slowly" shift="true" />
+  <bind key="down" action="down" />
+  <bind key="right" action="down" alt="true" />
+  <bind key="down" action="down_slowly" shift="true" />
+  <bind key="left" action="move_camera_left" control="true" />
+  <bind key="right" action="move_camera_right" control="true" />
+  <bind key="up" action="move_camera_up" control="true" />
+  <bind key="down" action="move_camera_down" control="true" />
+  <bind key="kp_enter" action="jump" />
+  <bind key="kp_enter" action="high_jump" shift="true" />
+  <bind key="kp_enter" action="back_jump" control="true" />
+  <bind key="space" action="shoot" />
+  <bind key="tab" action="next_character" />
+  <bind key="escape" action="quit" />
+  <bind key="pause" action="pause" />
+  <bind key="f10" action="fullscreen" />
+  <bind key="f9" action="toggle_interface" />
+  <bind key="q" action="weapons1" />
+  <bind key="w" action="weapons2" />
+  <bind key="e" action="weapons3" />
+  <bind key="r" action="weapons4" />
+  <bind key="t" action="weapons5" />
+  <bind key="y" action="weapons6" />
+  <bind key="u" action="weapons7" />
+  <bind key="i" action="weapons8" />
+  <bind key="c" action="center" />
+  <bind key="1" action="weapon_1" />
+  <bind key="2" action="weapon_2" />
+  <bind key="3" action="weapon_3" />
+  <bind key="4" action="weapon_4" />
+  <bind key="5" action="weapon_5" />
+  <bind key="6" action="weapon_6" />
+  <bind key="7" action="weapon_7" />
+  <bind key="8" action="weapon_8" />
+  <bind key="9" action="weapon_9" />
+  <bind key="f" action="weapon_more" />
+  <bind key="v" action="weapon_less" />
+  <bind key="s" action="chat" />
+  <bind key="t" action="chat" />
+  <bind key="return" action="chat" alt="true" />
+  <bind key="f11" action="menu_options_from_game" />
+  <bind key="m" action="minimap_from_game" />
+  <bind key="h" action="help" />
+</section>
+
+<!-- This is how to setup per language font files -->
+<section name="default_language_fonts">
+  <language name="ja_JP" file="VL-Gothic-Regular.ttf" relative="true" />
+  <language name="zh_CN" file="wqy-microhei-lite.ttc" relative="true" />
+  <language name="zh_TW" file="wqy-microhei-lite.ttc" relative="true" />
+</section>
+
+</resources>
Index: src/gui/control_config.cpp
===================================================================
--- src/gui/control_config.cpp	(revision 8339)
+++ src/gui/control_config.cpp	(working copy)
@@ -270,6 +270,18 @@
   for (uint i=0; i<items.size(); i++) {
     items[i]->SaveAction(kbd);
   }
+
+#ifdef MAEMO
+  // Forcefully set special N900 international arrow keys (fn+left is up, fn+right is down)
+  kbd->SaveKeyEvent(ManMachineInterface::KEY_UP, SDLK_LEFT,
+		    false,
+		    true,
+		    false);
+  kbd->SaveKeyEvent(ManMachineInterface::KEY_DOWN, SDLK_RIGHT,
+		    false,
+		    true,
+		    false);
+#endif
 }
 
 void ControlConfig::Pack()
Index: src/sound/jukebox.cpp
===================================================================
--- src/sound/jukebox.cpp	(revision 8339)
+++ src/sound/jukebox.cpp	(working copy)
@@ -40,7 +40,7 @@
 {
   m_config.music = true;
   m_config.effects = true;
-#ifdef ANDROID
+#if defined(ANDROID) || defined(MAEMO)
   // reduce memory usage
   m_config.frequency = 22050; //MIX_DEFAULT_FREQUENCY;
   m_config.channels = 1; // mono
@@ -129,7 +129,7 @@
 void JukeBox::SetFrequency(int frequency)
 {
   // We ignore frequency changes requests
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   if ((frequency != 11025)
       && (frequency != 22050)
       && (frequency != 44100)) frequency = 44100;
Index: src/interface/keyboard.cpp
===================================================================
--- src/interface/keyboard.cpp	(revision 8339)
+++ src/interface/keyboard.cpp	(working copy)
@@ -37,6 +37,11 @@
 #  define SDLK_LAST  SDL_NUM_SCANCODES
 #endif
 
+#ifdef MAEMO
+#undef KMOD_ALT
+#define KMOD_ALT KMOD_MODE
+#endif
+
 int  Keyboard::GetRawKeyCode(int key_code) const
 {
   return key_code % MODIFIER_OFFSET;
Index: src/interface/man_machine_interface.cpp
===================================================================
--- src/interface/man_machine_interface.cpp	(revision 8339)
+++ src/interface/man_machine_interface.cpp	(working copy)
@@ -40,6 +40,11 @@
 #include "sound/jukebox.h"
 #include "weapon/weapons_list.h"
 
+#ifdef MAEMO
+#undef SDLK_RALT
+#define SDLK_RALT SDLK_MODE
+#endif
+
 void ManMachineInterface::Reset()
 {
   for (int i = 0; i != 256; i++)
@@ -750,7 +755,11 @@
   if(name == "lshift") return SDLK_LSHIFT;
   if(name == "rctrl") return SDLK_RCTRL;
   if(name == "lctrl") return SDLK_LCTRL;
+#ifdef MAEMO__
+  if(name == "ralt") return SDLK_MODE;
+#else
   if(name == "ralt") return SDLK_RALT;
+#endif
   if(name == "lalt") return SDLK_LALT;
   if(name == "rmeta") return SDLK_RMETA;
   if(name == "lmeta") return SDLK_LMETA;
@@ -1007,7 +1016,11 @@
   if(key == SDLK_LSHIFT) return "lshift";
   if(key == SDLK_RCTRL) return "rctrl";
   if(key == SDLK_LCTRL) return "lctrl";
+#ifdef MAEMO__
+  if(key == SDLK_MODE) return "ralt";
+#else
   if(key == SDLK_RALT) return "ralt";
+#endif
   if(key == SDLK_LALT) return "lalt";
   if(key == SDLK_RMETA) return "rmeta";
   if(key == SDLK_LMETA) return "lmeta";
Index: src/interface/mouse.cpp
===================================================================
--- src/interface/mouse.cpp	(revision 8339)
+++ src/interface/mouse.cpp	(working copy)
@@ -340,10 +340,12 @@
 
 void Mouse::Show()
 {
+#if !defined(MAEMO)
   if (((Time::GetConstInstance()->Read()-last_hide_time) > 10000) && (visible == MOUSE_HIDDEN))
   {
     CenterPointer();
   }
+#endif
   visible = MOUSE_VISIBLE;
 
   if (Config::GetConstInstance()->GetDefaultMouseCursor()) {
Index: src/menu/menu.cpp
===================================================================
--- src/menu/menu.cpp	(revision 8339)
+++ src/menu/menu.cpp	(working copy)
@@ -44,6 +44,9 @@
   : actions(_actions)
   , selected_widget(NULL)
 {
+#ifdef MAEMO
+  Mouse::GetInstance()->Hide();
+#endif
   close_menu = false ;
   Surface& window = GetMainWindow();
 
Index: src/menu/options_menu.cpp
===================================================================
--- src/menu/options_menu.cpp	(revision 8339)
+++ src/menu/options_menu.cpp	(working copy)
@@ -92,7 +92,7 @@
     new PictureTextCBox(_("Wind particles?"), "menu/display_wind_particles", option_size);
   graphic_options->AddWidget(opt_display_wind_particles);
 
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   opt_display_multisky =
     new PictureTextCBox(_("Multi-layer sky?"), "menu/multisky", option_size);
   graphic_options->AddWidget(opt_display_multisky);
@@ -106,7 +106,7 @@
     new PictureTextCBox(_("Player's name?"), "menu/display_name", option_size);
   graphic_options->AddWidget(opt_display_name);
 
-#if !defined(__APPLE__) && !defined(ANDROID)
+#if !defined(__APPLE__) && !defined(ANDROID) && !defined(MAEMO)
   full_screen =
     new PictureTextCBox(_("Fullscreen?"), "menu/fullscreen", option_size);
   graphic_options->AddWidget(full_screen);
@@ -117,7 +117,7 @@
                               option_size, 30, 5, 20, 60);
   graphic_options->AddWidget(opt_max_fps);
 
-#if !defined(ANDROID)
+#if !defined(ANDROID) && !defined(MAEMO)
   // Get available video resolution
   const std::list<Point2i>& video_res = app->video->GetAvailableConfigs();
   std::list<Point2i>::const_iterator mode;
@@ -232,7 +232,7 @@
                         "menu/ico_update", option_size);
   misc_options->AddWidget(opt_updates);
 
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   opt_lefthanded_mouse =
     new PictureTextCBox(_("Left-handed mouse?"),
                         "menu/ico_lefthanded_mouse", option_size);
@@ -248,7 +248,9 @@
                               option_size, 50, 5, 5, 80);
   misc_options->AddWidget(opt_scroll_border_size);
 #endif
+#if !defined(MAEMO)
   tabs->AddNewTab("unused", _("Misc"), misc_options);
+#endif
 
   /* Sound options */
   Box * sound_options = new GridBox(3, 3, 0, false);
@@ -303,12 +305,12 @@
   // Values initialization
   opt_max_fps->SetValue(app->video->GetMaxFps());
   opt_display_wind_particles->SetValue(config->GetDisplayWindParticles());
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   opt_display_multisky->SetValue(config->GetDisplayMultiLayerSky());
 #endif
   opt_display_energy->SetValue(config->GetDisplayEnergyCharacter());
   opt_display_name->SetValue(config->GetDisplayNameCharacter());
-#if !defined(__APPLE__) && !defined(ANDROID)
+#if !defined(__APPLE__) && !defined(ANDROID) && !defined(MAEMO)
   full_screen->SetValue(app->video->IsFullScreen());
 #endif
   music_cbox->SetValue(config->GetSoundMusic());
@@ -358,7 +360,7 @@
 #endif
 
   opt_updates->SetValue(config->GetCheckUpdates());
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   opt_lefthanded_mouse->SetValue(config->GetLeftHandedMouse());
   opt_scroll_on_border->SetValue(config->GetScrollOnBorder());
   opt_scroll_border_size->SetValue(config->GetScrollBorderSize());
@@ -418,7 +420,7 @@
   if (Game::IsRunning())
     Wind::GetRef().Reset();
 
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   config->SetDisplayMultiLayerSky(opt_display_multisky->GetValue());
 #endif
   config->SetDisplayEnergyCharacter(opt_display_energy->GetValue());
@@ -426,7 +428,7 @@
 
   // Misc options
   config->SetCheckUpdates(opt_updates->GetValue());
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   config->SetLeftHandedMouse(opt_lefthanded_mouse->GetValue());
   config->SetScrollOnBorder(opt_scroll_on_border->GetValue());
   config->SetScrollBorderSize(opt_scroll_border_size->GetValue());
@@ -440,7 +442,7 @@
   AppWormux * app = AppWormux::GetInstance();
   app->video->SetMaxFps(opt_max_fps->GetValue());
 
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   // Video mode
   std::string s_mode = cbox_video_mode->GetValue();
 
Index: src/menu/options_menu.h
===================================================================
--- src/menu/options_menu.h	(revision 8339)
+++ src/menu/options_menu.h	(working copy)
@@ -45,11 +45,13 @@
   CheckBox *opt_display_wind_particles;
   CheckBox *opt_display_energy;
   CheckBox *opt_display_name;
-#ifndef ANDROID
+#if !defined(ANROID) && !defined(MAEMO)
   CheckBox *opt_display_multisky;
+#endif
 # ifndef __APPLE__
   CheckBox *full_screen;
 # endif
+#if !defined(ANROID)
   ComboBox *cbox_video_mode;
 #endif
   SpinButtonWithPicture *opt_max_fps;
@@ -66,7 +68,7 @@
 
   /* Misc options controllers */
   CheckBox *opt_updates;
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(MAEMO)
   CheckBox *opt_lefthanded_mouse;
   CheckBox *opt_scroll_on_border;
   SpinButtonWithPicture * opt_scroll_border_size;
Index: src/game/config.cpp
===================================================================
--- src/game/config.cpp	(revision 8339)
+++ src/game/config.cpp	(working copy)
@@ -88,7 +88,7 @@
   , display_energy_character(true)
   , display_name_character(true)
 
-#ifdef ANDROID
+#if defined(ANDROID) || defined(MAEMO)
   , display_wind_particles(false) // Too CPU intensive
   , display_multi_layer_sky(false) // Memory hungry + CPU intensive
 #else
@@ -100,7 +100,7 @@
   , video_width(0)
   , video_height(0)
 
-#ifdef ANDROID
+#if defined(ANDROID) || defined(MAEMO)
   , video_fullscreen(true) // No other mode supported
   , max_fps(25)
 #else
@@ -358,6 +358,8 @@
   // Load default XML conf
 #ifdef ANDROID
   m_default_config = GetDataDir() + "wormux_default_android_config.xml";
+#elif MAEMO
+  m_default_config = GetDataDir() + "wormux_default_maemo_config.xml";
 #else
   m_default_config = GetDataDir() + "wormux_default_config.xml";
 #endif
@@ -463,7 +465,7 @@
     XmlReader::ReadBool(elem, "display_energy_character", display_energy_character);
     XmlReader::ReadBool(elem, "display_name_character", display_name_character);
     XmlReader::ReadBool(elem, "default_mouse_cursor", default_mouse_cursor);
-#ifndef ANDROID // Those should never be set
+#if !defined(ANDROID) && !defined(MAEMO) // Those should never be set
     XmlReader::ReadBool(elem, "scroll_on_border", scroll_on_border);
     XmlReader::ReadUint(elem, "scroll_border_size", scroll_border_size);
 #endif
Index: src/graphic/video.cpp
===================================================================
--- src/graphic/video.cpp	(revision 8339)
+++ src/graphic/video.cpp	(working copy)
@@ -168,8 +168,12 @@
   int flags = (__fullscreen) ? SDL_FULLSCREEN : 0;
 
   flags |= SDL_SWSURFACE | SDL_DOUBLEBUF;
+#ifdef MAEMO
+  window.SetSurface(SDL_SetVideoMode(width, height, 16, flags));
+#else
   window.SetSurface(SDL_SetVideoMode(width, height, 32, flags));
 #endif
+#endif
 
   if (window.IsNull())
     return false;
_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à