ALT Linux repositórios
Group :: Jogos/Enigmas
RPM: kiki
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: kiki-1.0.2-alt1.patch
Download
Download
SWIG/KConsole.i | 2 +-
SWIG/KEventHandler.i | 2 +-
SWIG/KWindow.i | 2 +-
SWIG/KikiAction.i | 3 +
SWIG/KikiBot.i | 8 +-
SWIG/KikiController.i | 2 +-
SWIG/KikiEvent.i | 2 +-
SWIG/KikiGUI.i | 12 ++--
SWIG/KikiItems.i | 45 ++++++-------
SWIG/KikiMutant.i | 2 +-
SWIG/KikiObject.i | 4 +-
SWIG/KikiPlayer.i | 6 +-
SWIG/KikiPy_wrap.cpp | 6 +-
SWIG/KikiPython.i | 4 +-
SWIG/KikiSound.i | 2 +-
SWIG/KikiText.i | 2 +-
SWIG/KikiTypes.i | 4 +-
SWIG/KikiWorld.i | 2 +-
kodilib/linux/Makefile | 4 +-
kodilib/src/handler/KEventHandler.cpp | 113 ++++++++++++--------------------
kodilib/src/handler/KPickable.h | 1 +
kodilib/src/tools/KDisplayTools.cpp | 4 +-
kodilib/src/tools/KDisplayTools.h | 2 +-
kodilib/src/tools/KFileTools.cpp | 28 +++++---
kodilib/src/tools/KFileTools.h | 4 +-
kodilib/src/tools/KIntrospection.h | 1 +
kodilib/src/tools/KKeySymbols.h | 38 +++++-----
kodilib/src/tools/KKeyTools.cpp | 6 +-
kodilib/src/tools/KStringTools.cpp | 32 +++++-----
kodilib/src/tools/KStringTools.h | 1 +
kodilib/src/tools/KXMLTools.cpp | 21 +++---
kodilib/src/types/KKey.cpp | 4 +-
kodilib/src/widgets/KButtonSymbols.h | 24 ++++----
kodilib/src/widgets/KFileNameField.cpp | 6 +-
linux/Makefile | 19 +++---
py/config.py | 17 ++++--
py/kiki.cfg | 2 +-
py/lang.py | 20 ++++--
py/lang/dutch.py | 18 +++--
py/lang/francaise.py | 77 ++++++++++++++++++++++
py/lang/russian.py | 81 +++++++++++++++++++++++
py/levelselection.py | 2 +
py/setup.py | 2 +-
py/world.py | 2 +-
src/base/KikiAction.cpp | 16 ++++-
src/base/KikiAction.h | 2 +
src/base/KikiEvent.cpp | 9 +--
src/base/KikiPyAction.cpp | 19 ++++-
src/bots/KikiPlayer.cpp | 11 +++
src/bots/KikiPlayer.h | 2 +
src/gui/KikiCharacter.cpp | 79 ++++++++++++++++++++++-
src/gui/KikiMenu.cpp | 20 +++++-
src/gui/KikiMenu.h | 2 +
src/gui/KikiScrollMenu.cpp | 11 +++
src/gui/KikiScrollMenu.h | 1 +
src/gui/KikiText.cpp | 6 +-
src/gui/KikiText.h | 3 +-
src/gui/KikiTextLine.cpp | 2 +-
src/main/KikiController.cpp | 5 +-
src/main/KikiPython.cpp | 6 +-
src/main/KikiPythonWidget.h | 1 +
src/main/main.cpp | 9 +++
src/sound/KikiSound.cpp | 70 ++++++++++----------
src/world/KikiWorld.cpp | 1 +
64 files changed, 616 insertions(+), 298 deletions(-)
diff --git a/SWIG/KConsole.i b/SWIG/KConsole.i
index b7a5a2d..1a9aec3 100644
--- a/SWIG/KConsole.i
+++ b/SWIG/KConsole.i
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------
-%nodefault;
+%nodefault KConsole;
class KConsole : public KWindow
{
diff --git a/SWIG/KEventHandler.i b/SWIG/KEventHandler.i
index ed5c413..46b96f5 100644
--- a/SWIG/KEventHandler.i
+++ b/SWIG/KEventHandler.i
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------
-%nodefault;
+%nodefault KEventHandler;
class KEventHandler
{
diff --git a/SWIG/KWindow.i b/SWIG/KWindow.i
index 5a3bd94..1e6f355 100644
--- a/SWIG/KWindow.i
+++ b/SWIG/KWindow.i
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------
-%nodefault;
+%nodefault KWindow;
class KWindow
{
diff --git a/SWIG/KikiAction.i b/SWIG/KikiAction.i
index ac6a883..206f654 100644
--- a/SWIG/KikiAction.i
+++ b/SWIG/KikiAction.i
@@ -1,5 +1,8 @@
// --------------------------------------------------------------------------------------------------------
+%feature("pythonappend") KikiAction::KikiAction(KikiObject *) %{self.thisown = 0%}
+%feature("pythonappend") KikiAction::KikiAction(KikiObject *, int id, const std::string &) %{self.thisown = 0%}
+
class KikiAction
{
public: // ........................................................................ PUBLIC
diff --git a/SWIG/KikiBot.i b/SWIG/KikiBot.i
index b6876be..4148251 100644
--- a/SWIG/KikiBot.i
+++ b/SWIG/KikiBot.i
@@ -1,6 +1,6 @@
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiBotStatus;
class KikiBotStatus
{
@@ -26,7 +26,7 @@ class KikiBotStatus
};
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiBotFume;
class KikiBotFume : public KikiObject
{
@@ -36,7 +36,7 @@ class KikiBotFume : public KikiObject
};
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiBot;
class KikiBot : public KikiObject
{
@@ -51,4 +51,4 @@ class KikiBot : public KikiObject
void setMove ( bool );
KikiBotStatus * getStatus ();
-};
\ No newline at end of file
+};
diff --git a/SWIG/KikiController.i b/SWIG/KikiController.i
index 3a7be2e..531a303 100644
--- a/SWIG/KikiController.i
+++ b/SWIG/KikiController.i
@@ -1,6 +1,6 @@
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiController;
class KikiController : public KEventHandler, public KikiActionObject
{
diff --git a/SWIG/KikiEvent.i b/SWIG/KikiEvent.i
index 446cd96..b5d3a75 100644
--- a/SWIG/KikiEvent.i
+++ b/SWIG/KikiEvent.i
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------
-%nodefault;
+%feature("pythonappend") KikiEvent::KikiEvent(KikiObject *, const std::string &) %{self.thisown = 0%}
class KikiEvent
{
diff --git a/SWIG/KikiGUI.i b/SWIG/KikiGUI.i
index 1f0025c..69cb603 100644
--- a/SWIG/KikiGUI.i
+++ b/SWIG/KikiGUI.i
@@ -1,13 +1,13 @@
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiGUI;
class KikiGUI : public KWindow
{
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiScreenText::KikiScreenText() %{self.thisown = 0%}
class KikiScreenText : public KikiText, public KikiActionObject
{
@@ -21,7 +21,7 @@ class KikiScreenText : public KikiText, public KikiActionObject
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiMenu::KikiMenu() %{self.thisown = 0%}
class KikiMenu : public KikiScreenText
{
@@ -35,7 +35,7 @@ class KikiMenu : public KikiScreenText
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiColumnMenu::KikiColumnMenu() %{self.thisown = 0%}
class KikiColumnMenu : public KikiMenu
{
@@ -45,7 +45,7 @@ class KikiColumnMenu : public KikiMenu
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiScrollMenu::KikiScrollMenu() %{self.thisown = 0%}
class KikiScrollMenu : public KikiColumnMenu
{
@@ -58,7 +58,7 @@ class KikiScrollMenu : public KikiColumnMenu
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiPageText::KikiPageText(const std::string &, bool) %{self.thisown = 0%}
class KikiPageText : public KikiScreenText
{
diff --git a/SWIG/KikiItems.i b/SWIG/KikiItems.i
index 399a156..a80de09 100644
--- a/SWIG/KikiItems.i
+++ b/SWIG/KikiItems.i
@@ -1,7 +1,4 @@
-
// __________________________________________________________________________________________________
-%nodefault;
-
class KikiFace
{
public: // ........................................................................ PUBLIC
@@ -10,7 +7,7 @@ class KikiFace
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiWire::KikiWire() %{self.thisown = 0%}
class KikiWire : public KikiObject
{
@@ -33,7 +30,7 @@ class KikiWire : public KikiObject
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiGear::KikiGear() %{self.thisown = 0%}
class KikiGear : public KikiObject, public KikiFace
{
@@ -55,7 +52,7 @@ class KikiGear : public KikiObject, public KikiFace
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiValve::KikiValve() %{self.thisown = 0%}
class KikiValve : public KikiObject, public KikiFace
{
@@ -74,7 +71,7 @@ class KikiValve : public KikiObject, public KikiFace
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiMotorCylinder::KikiMotorCylinder() %{self.thisown = 0%}
class KikiMotorCylinder : public KikiObject
{
@@ -85,7 +82,7 @@ class KikiMotorCylinder : public KikiObject
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiMotorGear::KikiMotorGear() %{self.thisown = 0%}
class KikiMotorGear : public KikiGear
{
@@ -96,7 +93,7 @@ class KikiMotorGear : public KikiGear
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiGenerator::KikiGenerator() %{self.thisown = 0%}
class KikiGenerator : public KikiGear
{
@@ -107,7 +104,7 @@ class KikiGenerator : public KikiGear
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiLight::KikiLight() %{self.thisown = 0%}
class KikiLight : public KikiObject
{
@@ -126,7 +123,7 @@ class KikiLight : public KikiObject
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiCellText::KikiCellText(const std::string &) %{self.thisown = 0%}
class KikiCellText : public KikiObject, public KikiText
{
@@ -146,7 +143,7 @@ class KikiCellText : public KikiObject, public KikiText
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiStone::KikiStone() %{self.thisown = 0%}
class KikiStone : public KikiObject
{
@@ -164,7 +161,7 @@ class KikiStone : public KikiObject
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiWireStone::KikiWireStone() %{self.thisown = 0%}
class KikiWireStone : public KikiStone
{
@@ -182,7 +179,7 @@ class KikiWireStone : public KikiStone
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiWall::KikiWall() %{self.thisown = 0%}
class KikiWall : public KikiObject
{
@@ -200,7 +197,7 @@ class KikiWall : public KikiObject
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiBomb::KikiBomb() %{self.thisown = 0%}
class KikiBomb : public KikiObject
{
@@ -218,7 +215,7 @@ class KikiBomb : public KikiObject
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiSwitch::KikiSwitch() %{self.thisown = 0%}
class KikiSwitch : public KikiObject
{
@@ -240,7 +237,7 @@ class KikiSwitch : public KikiObject
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiGate::KikiGate() %{self.thisown = 0%}
class KikiGate : public KikiSwitch
{
@@ -258,7 +255,7 @@ class KikiGate : public KikiSwitch
%}
// __________________________________________________________________________________________________
-%nodefault;
+%nodefaultctor KikiAtom;
class KikiAtom : public KikiObject
{
@@ -269,7 +266,7 @@ class KikiAtom : public KikiObject
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiMovesAtom::KikiMovesAtom() %{self.thisown = 0%}
class KikiMovesAtom : public KikiAtom
{
@@ -279,7 +276,7 @@ class KikiMovesAtom : public KikiAtom
// __________________________________________________________________________________________________
/*
-%nodefault;
+%feature("pythonappend") KikiHealthAtom::KikiHealthAtom() %{self.thisown = 0%}
class KikiHealthAtom : public KikiAtom
{
@@ -297,7 +294,7 @@ class KikiHealthAtom : public KikiAtom
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiEnergyAtom::KikiEnergyAtom() %{self.thisown = 0%}
class KikiEnergyAtom : public KikiAtom
{
@@ -315,6 +312,8 @@ class KikiEnergyAtom : public KikiAtom
%}
*/
// __________________________________________________________________________________________________
+%feature("pythonappend") KikiValueAtom::KikiValueAtom() %{self.thisown = 0%}
+
class KikiValueAtom : public KikiAtom
{
public: // ........................................................................ PUBLIC
@@ -325,7 +324,7 @@ class KikiValueAtom : public KikiAtom
};
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiSpikes::KikiSpikes() %{self.thisown = 0%}
class KikiSpikes : public KikiObject
{
@@ -343,7 +342,7 @@ class KikiSpikes : public KikiObject
%}
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiBullet::KikiBullet() %{self.thisown = 0%}
class KikiBullet : public KikiObject
{
diff --git a/SWIG/KikiMutant.i b/SWIG/KikiMutant.i
index 49e0915..8c06da2 100644
--- a/SWIG/KikiMutant.i
+++ b/SWIG/KikiMutant.i
@@ -1,6 +1,6 @@
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiMutant::KikiMutant() %{self.thisown = 0%}
class KikiMutant : public KikiBot
{
diff --git a/SWIG/KikiObject.i b/SWIG/KikiObject.i
index 91ab2d4..14d02bf 100644
--- a/SWIG/KikiObject.i
+++ b/SWIG/KikiObject.i
@@ -1,6 +1,6 @@
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiActionObject;
class KikiActionObject
{
@@ -21,7 +21,7 @@ class KikiActionObject
};
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiObject;
class KikiObject : public KikiActionObject
{
diff --git a/SWIG/KikiPlayer.i b/SWIG/KikiPlayer.i
index b9af1de..140fd4c 100644
--- a/SWIG/KikiPlayer.i
+++ b/SWIG/KikiPlayer.i
@@ -1,6 +1,6 @@
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiStatusDisplay;
class KikiStatusDisplay
{
@@ -11,7 +11,7 @@ class KikiStatusDisplay
};
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiPlayback;
class KikiPlayback
{
@@ -22,7 +22,7 @@ class KikiPlayback
};
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiPlayer;
class KikiPlayer : public KikiBot
{
diff --git a/SWIG/KikiPy_wrap.cpp b/SWIG/KikiPy_wrap.cpp
index 233d68d..0def2b4 100644
--- a/SWIG/KikiPy_wrap.cpp
+++ b/SWIG/KikiPy_wrap.cpp
@@ -1206,7 +1206,7 @@ type_error:
obj = pyobj;
if (PyCFunction_Check(obj)) {
/* here we get the method pointer for callbacks */
- char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
c = doc ? strstr(doc, "swig_ptr: ") : 0;
if (c) {
c = ty ? SWIG_UnpackVoidPtr(c + 10, &vptr, ty->name) : 0;
@@ -16309,11 +16309,11 @@ extern "C" {
swig_type_info **types_initial) {
size_t i;
for (i = 0; methods[i].ml_name; ++i) {
- char *c = methods[i].ml_doc;
+ const char *c = methods[i].ml_doc;
if (c && (c = strstr(c, "swig_ptr: "))) {
int j;
swig_const_info *ci = 0;
- char *name = c + 10;
+ const char *name = c + 10;
for (j = 0; const_table[j].type; ++j) {
if (strncmp(const_table[j].name, name,
strlen(const_table[j].name)) == 0) {
diff --git a/SWIG/KikiPython.i b/SWIG/KikiPython.i
index 9cfbaf6..5320523 100644
--- a/SWIG/KikiPython.i
+++ b/SWIG/KikiPython.i
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------
-%nodefault;
+%nodefault KikiPythonWidget;
class KikiPythonWidget
{
@@ -20,7 +20,7 @@ class KikiPythonWidget
};
// --------------------------------------------------------------------------------------------------------
-%nodefault;
+%nodefault KikiPython;
class KikiPython : public KWindow
{
diff --git a/SWIG/KikiSound.i b/SWIG/KikiSound.i
index 68e2f98..17860b9 100644
--- a/SWIG/KikiSound.i
+++ b/SWIG/KikiSound.i
@@ -1,6 +1,6 @@
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiSound;
class KikiSound
{
diff --git a/SWIG/KikiText.i b/SWIG/KikiText.i
index f6205ea..6f1e502 100644
--- a/SWIG/KikiText.i
+++ b/SWIG/KikiText.i
@@ -1,6 +1,6 @@
// __________________________________________________________________________________________________
-%nodefault;
+%feature("pythonappend") KikiText::KikiText() %{self.thisown = 0%}
class KikiText
{
diff --git a/SWIG/KikiTypes.i b/SWIG/KikiTypes.i
index 785d7f4..c3c455a 100644
--- a/SWIG/KikiTypes.i
+++ b/SWIG/KikiTypes.i
@@ -149,7 +149,7 @@ class KColor
};
// --------------------------------------------------------------------------------------------------------
-%nodefault;
+%nodefault KProjection;
class KProjection
{
@@ -163,7 +163,7 @@ class KProjection
};
// --------------------------------------------------------------------------------------------------------
-%nodefault;
+%nodefault KKey;
struct KKey
{
diff --git a/SWIG/KikiWorld.i b/SWIG/KikiWorld.i
index 0df1e8a..d762d5f 100644
--- a/SWIG/KikiWorld.i
+++ b/SWIG/KikiWorld.i
@@ -1,6 +1,6 @@
// __________________________________________________________________________________________________
-%nodefault;
+%nodefault KikiWorld;
class KikiWorld
{
diff --git a/kodilib/linux/Makefile b/kodilib/linux/Makefile
index dae1949..d5b853a 100644
--- a/kodilib/linux/Makefile
+++ b/kodilib/linux/Makefile
@@ -21,7 +21,7 @@ KODI_INCLUDES = -I $(KODISRCDIR)/handler -I $(KODISRCDIR)/tools -I $(KODISRCDIR)
INCLUDES = $(KODI_INCLUDES) $(X11_INCLUDES) $(SDL_INCLUDES)
-CXXFLAGS = $(INCLUDES) $(SDL_CFLAGS)
+CXXOPTS = $(INCLUDES) $(SDL_CFLAGS) $(CXXFLAGS)
src = \
$(KODISRCDIR)/handler/KEventHandler.cpp \
@@ -95,4 +95,4 @@ clean:
$(RM) -f $(obj) libkodi.a
%.o: %.cpp
- $(CXX) -c $(CXXFLAGS) -o $@ $<
+ $(CXX) -c $(CXXOPTS) -o $@ $<
diff --git a/kodilib/src/handler/KEventHandler.cpp b/kodilib/src/handler/KEventHandler.cpp
index 9b12529..9916611 100644
--- a/kodilib/src/handler/KEventHandler.cpp
+++ b/kodilib/src/handler/KEventHandler.cpp
@@ -226,86 +226,55 @@ KSize KEventHandler::getScreenSize ()
// --------------------------------------------------------------------------------------------------------
bool KEventHandler::setScreenSize ( int width, int height, bool fullscreen )
{
- int flags = SDL_OPENGL; // | SDL_ANYFORMAT;
- if (fullscreen)
- {
- flags |= SDL_FULLSCREEN;
- }
- else
- {
- flags |= SDL_RESIZABLE;
- }
-
- if (SDL_VideoModeOK (width, height, 32, flags) == 0) // video mode not ok
+ // For fullscreen mode the requested resolution is ignore, we'll pick what
+ // SDL thinks is best.
+
+ int baseFlags = SDL_OPENGL;
+
+ if (fullscreen)
{
- if (fullscreen)
+ int flags = baseFlags | SDL_FULLSCREEN;
+ KSize fallbackSize = getScreenSize();
+
+ SDL_Rect ** modes = SDL_ListModes (NULL, flags);
+
+ if (modes != 0 && modes != (SDL_Rect **)-1)
{
- switch (width)
- {
- case 1600:
- KConsole::printf ("couldn't set video mode %dx%d:\ntrying to fallback to 1280x1024 mode", width, height);
- return setScreenSize (1280, 1024, true);
- case 1280:
- KConsole::printf ("couldn't set video mode %dx%d:\ntrying to fallback to 1024x768 mode", width, height);
- return setScreenSize (1024, 768, true);
- case 1024:
- KConsole::printf ("couldn't set video mode %dx%d:\ntrying to fallback to 800x600 mode", width, height);
- return setScreenSize (800, 600, true);
- default:
- break;
- }
-
- // fallback to window mode
- KConsole::printf ("couldn't set video mode %dx%d (%s) test failed",
- width, height,
- fullscreen ? "fullscreen" : "window");
- KConsole::printf ("trying to fallback to window mode");
- return setScreenSize (width, height, false);
+ for (int i = 0; modes[i]; ++i)
+ {
+ if (SDL_SetVideoMode (modes[i]->w, modes[i]->h, 0, flags) != NULL)
+ {
+ // notify interested receivers that the resolution changed
+ notification_center.notifyReceiversType(KDL_NOTIFICATION_TYPE_VIDEO_MODE_CHANGED);
+ return true;
+ }
+
+ KConsole::printf ("couldn't change vidoe mode %dx%d (fullscreen):\n%s",
+ modes[i]->w, modes[i]->h, SDL_GetError());
+ }
}
else
{
- KConsole::printError( kStringPrintf("couldn't set video mode %dx%d (window test failed)", width, height));
- return false;
+ KConsole::printf ("SDL didn't give us a list of video modes");
}
+
+ // fallback to window mode
+ KConsole::printf ("trying to fallback to window mode");
+ width = fallbackSize.w;
+ height = fallbackSize.h;
}
-
- if (SDL_SetVideoMode (width, height, 32, flags) == NULL) // paranoid
+
+ int flags = baseFlags | SDL_RESIZABLE;
+ if (SDL_SetVideoMode (width, height, 0, flags) != NULL)
{
- if (fullscreen)
- {
- switch (width)
- {
- case 1600:
- KConsole::printf ("couldn't init video mode %dx%d:\ntrying to fallback to 1280x1024 mode", width, height);
- return setScreenSize (1280, 1024, true);
- case 1280:
- KConsole::printf ("couldn't init video mode %dx%d:\ntrying to fallback to 1024x768 mode", width, height);
- return setScreenSize (1024, 768, true);
- case 1024:
- KConsole::printf ("couldn't init video mode %dx%d:\ntrying to fallback to 800x600 mode", width, height);
- return setScreenSize (800, 600, true);
- default:
- break;
- }
-
- // fallback to window mode
- KConsole::printf ("couldn't change video mode %dx%d (fullscreen setting failed)", width, height);
- KConsole::printf ("trying to fallback to window mode");
- return setScreenSize (width, height, false);
- }
- else
- {
- KConsole::printError(kStringPrintf("couldn't change video mode %dx%d (%s):\n%s\n",
- width, height,
- fullscreen ? "fullscreen" : "window", SDL_GetError()), true);
- return false;
- }
+ // notify interested receivers that the resolution changed
+ notification_center.notifyReceiversType(KDL_NOTIFICATION_TYPE_VIDEO_MODE_CHANGED);
+ return true;
}
- // notify interested receivers that the resolution changed
- notification_center.notifyReceiversType(KDL_NOTIFICATION_TYPE_VIDEO_MODE_CHANGED);
-
- return true;
+ KConsole::printError(kStringPrintf("couldn't change video mode %dx%d (window):\n%s\n",
+ width, height, SDL_GetError()), true);
+ return false;
}
// --------------------------------------------------------------------------------------------------------
@@ -332,7 +301,7 @@ void KEventHandler::setFullscreen ( bool fullscreen )
return;
}
// check if resolution is restricted
- if (modes != (SDL_Rect **)-1)
+ if (modes == (SDL_Rect **)-1)
{
// all resolutions available
width = 1024;
@@ -359,7 +328,7 @@ void KEventHandler::setFullscreen ( bool fullscreen )
return;
}
// check if resolution is restricted
- if (modes != (SDL_Rect **)-1)
+ if (modes == (SDL_Rect **)-1)
{
// all resolutions available
width = 1024;
diff --git a/kodilib/src/handler/KPickable.h b/kodilib/src/handler/KPickable.h
index 8b2d132..89f469c 100644
--- a/kodilib/src/handler/KPickable.h
+++ b/kodilib/src/handler/KPickable.h
@@ -8,6 +8,7 @@
#include "KIntrospection.h"
#include <vector>
+#include <limits.h>
#define DEBUG_PICKING false
diff --git a/kodilib/src/tools/KDisplayTools.cpp b/kodilib/src/tools/KDisplayTools.cpp
index d3a4473..352cedf 100644
--- a/kodilib/src/tools/KDisplayTools.cpp
+++ b/kodilib/src/tools/KDisplayTools.cpp
@@ -38,7 +38,7 @@ SDL_PixelFormat KDL_PIXEL_FORMAT = {
};
// --------------------------------------------------------------------------------------------------------
-int kDisplayXPMIcon ( char ** xpmData, const KPosition & pos )
+int kDisplayXPMIcon ( const char ** xpmData, const KPosition & pos )
{
glPushAttrib(GL_PIXEL_MODE_BIT);
@@ -49,7 +49,7 @@ int kDisplayXPMIcon ( char ** xpmData, const KPosition & pos )
glPixelTransferf(GL_GREEN_SCALE, color[1]);
glPixelTransferf(GL_BLUE_SCALE, color[2]);
- SDL_Surface * xpmSurface = IMG_ReadXPMFromArray (xpmData);
+ SDL_Surface * xpmSurface = IMG_ReadXPMFromArray (const_cast<char **>(xpmData));
if (xpmSurface == NULL)
{
KConsole::printError("kDisplayXPMIcon: IMG_ReadXPMFromArray failed");
diff --git a/kodilib/src/tools/KDisplayTools.h b/kodilib/src/tools/KDisplayTools.h
index f4b87ed..d50a046 100644
--- a/kodilib/src/tools/KDisplayTools.h
+++ b/kodilib/src/tools/KDisplayTools.h
@@ -15,7 +15,7 @@
void kDisplayString ( const std::string &, const KPosition &, bool = true );
void kDisplayString ( const std::string &, const KVector &, void * );
-int kDisplayXPMIcon ( char ** xpmData, const KPosition & pos );
+int kDisplayXPMIcon ( const char ** xpmData, const KPosition & pos );
void kDisplayWireSphere ( float radius = 0.5, int subdivisions = 8);
void kDisplaySolidSphere ( float radius = 0.5, int subdivisions = 8);
void kDisplaySolidCube ( float sidelength = 1.0);
diff --git a/kodilib/src/tools/KFileTools.cpp b/kodilib/src/tools/KFileTools.cpp
index 60ddc7e..a8a1ee1 100644
--- a/kodilib/src/tools/KFileTools.cpp
+++ b/kodilib/src/tools/KFileTools.cpp
@@ -7,7 +7,9 @@
#include "KConsole.h"
#include "KStringTools.h"
+#ifdef WIN32
#pragma warning(disable:4786)
+#endif
#include <fcntl.h> // open
#include <sys/types.h> // stat
@@ -42,15 +44,21 @@ string kFileJoinPaths ( const string & path1, const string & path2 )
// --------------------------------------------------------------------------------------------------------
string kFileGetCurrentPath ()
{
-#ifndef WIN32
+#ifdef _GNU_SOURCE
+ char * buffer = get_current_dir_name();
+ string current_path(buffer);
+ free(buffer);
+ return current_path;
+#else
+ #ifndef WIN32
char buffer[MAXPATHLEN+1];
getwd(buffer);
-#else
- char buffer[MAX_PATH+1];
- getcwd(buffer, MAX_PATH+1);
-#endif
-
+ #else
+ char buffer[MAX_PATH+1];
+ getcwd(buffer, MAX_PATH+1);
+ #endif
return string(buffer);
+#endif
}
// --------------------------------------------------------------------------------------------------------
@@ -214,8 +222,8 @@ string kFileAbsPathName ( const string & path )
// --------------------------------------------------------------------------------------------------------
string kFileSuffix ( const string & path )
{
- unsigned int lastDotPos = path.rfind(".");
- unsigned int lastSlashPos = path.rfind(kPathSep);
+ std::string::size_type lastDotPos = path.rfind(".");
+ std::string::size_type lastSlashPos = path.rfind(kPathSep);
if (lastDotPos < path.size() - 1 && (lastDotPos > lastSlashPos || lastSlashPos == string::npos))
{
@@ -228,7 +236,7 @@ string kFileSuffix ( const string & path )
string kFileDirName ( const string & path )
{
string native = kFileNativePath(path);
- unsigned int lastSlashPos = native.rfind(kPathSep);
+ std::string::size_type lastSlashPos = native.rfind(kPathSep);
if (lastSlashPos < native.size())
{
return native.substr(0, lastSlashPos+1);
@@ -241,7 +249,7 @@ string kFileBaseName ( const string & path, bool removeSuffix )
{
string native = kFileNativePath(path);
string baseName = native;
- unsigned int lastSlashPos = native.rfind(kPathSep);
+ std::string::size_type lastSlashPos = native.rfind(kPathSep);
if (lastSlashPos < native.size() - 1)
{
baseName = native.substr(lastSlashPos+1);
diff --git a/kodilib/src/tools/KFileTools.h b/kodilib/src/tools/KFileTools.h
index 37320e8..1993d45 100644
--- a/kodilib/src/tools/KFileTools.h
+++ b/kodilib/src/tools/KFileTools.h
@@ -6,7 +6,9 @@
#ifndef __KFileTools
#define __KFileTools
+#ifdef WIN32
#pragma warning(disable:4786)
+#endif
#include <string>
#include <vector>
@@ -35,4 +37,4 @@ bool kFileWriteStringToFile ( const string &, const string & );
string kFileJoinPaths ( const string &, const string & );
string kFileNativePath ( const string & );
-#endif
\ No newline at end of file
+#endif
diff --git a/kodilib/src/tools/KIntrospection.h b/kodilib/src/tools/KIntrospection.h
index c2a4b64..5af673a 100644
--- a/kodilib/src/tools/KIntrospection.h
+++ b/kodilib/src/tools/KIntrospection.h
@@ -11,6 +11,7 @@
#endif
#include <string>
+#include <string.h>
// --------------------------------------------------------------------------------------------------------
class KClassInfo
diff --git a/kodilib/src/tools/KKeySymbols.h b/kodilib/src/tools/KKeySymbols.h
index f85d23d..ae30b18 100644
--- a/kodilib/src/tools/KKeySymbols.h
+++ b/kodilib/src/tools/KKeySymbols.h
@@ -5,7 +5,7 @@
#ifndef __KKeySymbols
#define __KKeySymbols
-static char *KDL_KEY_ICON_META[] =
+static const char *KDL_KEY_ICON_META[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -28,7 +28,7 @@ static char *KDL_KEY_ICON_META[] =
".###.....###.",
};
-static char *KDL_KEY_ICON_ALT[] =
+static const char *KDL_KEY_ICON_ALT[] =
{
// width height ncolors chars_per_pixel
"17 13 2 1",
@@ -51,7 +51,7 @@ static char *KDL_KEY_ICON_ALT[] =
".................",
};
-static char *KDL_KEY_ICON_CTRL[] =
+static const char *KDL_KEY_ICON_CTRL[] =
{
// width height ncolors chars_per_pixel
"11 13 2 1",
@@ -74,7 +74,7 @@ static char *KDL_KEY_ICON_CTRL[] =
"...######..",
};
-static char *KDL_KEY_ICON_SHIFT[] =
+static const char *KDL_KEY_ICON_SHIFT[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -97,7 +97,7 @@ static char *KDL_KEY_ICON_SHIFT[] =
"......#......",
};
-static char *KDL_KEY_ICON_RETURN[] =
+static const char *KDL_KEY_ICON_RETURN[] =
{
// width height ncolors chars_per_pixel
"17 13 2 1",
@@ -120,7 +120,7 @@ static char *KDL_KEY_ICON_RETURN[] =
".................",
};
-static char *KDL_KEY_ICON_ENTER[] =
+static const char *KDL_KEY_ICON_ENTER[] =
{
// width height ncolors chars_per_pixel
"11 13 2 1",
@@ -143,7 +143,7 @@ static char *KDL_KEY_ICON_ENTER[] =
"...........",
};
-static char *KDL_KEY_ICON_UP[] =
+static const char *KDL_KEY_ICON_UP[] =
{
// width height ncolors chars_per_pixel
"12 13 2 1",
@@ -166,7 +166,7 @@ static char *KDL_KEY_ICON_UP[] =
".....##.....",
};
-static char *KDL_KEY_ICON_DOWN[] =
+static const char *KDL_KEY_ICON_DOWN[] =
{
// width height ncolors chars_per_pixel
"12 13 2 1",
@@ -189,7 +189,7 @@ static char *KDL_KEY_ICON_DOWN[] =
".....##.....",
};
-static char *KDL_KEY_ICON_RIGHT[] =
+static const char *KDL_KEY_ICON_RIGHT[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -212,7 +212,7 @@ static char *KDL_KEY_ICON_RIGHT[] =
"......##.....",
};
-static char *KDL_KEY_ICON_LEFT[] =
+static const char *KDL_KEY_ICON_LEFT[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -235,7 +235,7 @@ static char *KDL_KEY_ICON_LEFT[] =
".....##......",
};
-static char *KDL_KEY_ICON_HOME[] =
+static const char *KDL_KEY_ICON_HOME[] =
{
// width height ncolors chars_per_pixel
"11 13 2 1",
@@ -258,7 +258,7 @@ static char *KDL_KEY_ICON_HOME[] =
"...........",
};
-static char *KDL_KEY_ICON_END[] =
+static const char *KDL_KEY_ICON_END[] =
{
// width height ncolors chars_per_pixel
"11 13 2 1",
@@ -281,7 +281,7 @@ static char *KDL_KEY_ICON_END[] =
"...........",
};
-static char *KDL_KEY_ICON_PAGEUP[] =
+static const char *KDL_KEY_ICON_PAGEUP[] =
{
// width height ncolors chars_per_pixel
"12 13 2 1",
@@ -304,7 +304,7 @@ static char *KDL_KEY_ICON_PAGEUP[] =
".....##.....",
};
-static char *KDL_KEY_ICON_PAGEDOWN[] =
+static const char *KDL_KEY_ICON_PAGEDOWN[] =
{
// width height ncolors chars_per_pixel
"12 13 2 1",
@@ -328,7 +328,7 @@ static char *KDL_KEY_ICON_PAGEDOWN[] =
};
/*
-static char *KDL_KEY_ICON_CAPSLOCK[] =
+static const char *KDL_KEY_ICON_CAPSLOCK[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -352,7 +352,7 @@ static char *KDL_KEY_ICON_CAPSLOCK[] =
};
*/
-static char *KDL_KEY_ICON_BACKSPACE[] =
+static const char *KDL_KEY_ICON_BACKSPACE[] =
{
// width height ncolors chars_per_pixel
"19 13 2 1",
@@ -375,7 +375,7 @@ static char *KDL_KEY_ICON_BACKSPACE[] =
".....##############",
};
-static char *KDL_KEY_ICON_DELETE[] =
+static const char *KDL_KEY_ICON_DELETE[] =
{
// width height ncolors chars_per_pixel
"19 13 2 1",
@@ -398,7 +398,7 @@ static char *KDL_KEY_ICON_DELETE[] =
"##############.....",
};
-static char *KDL_KEY_ICON_TAB[] =
+static const char *KDL_KEY_ICON_TAB[] =
{
// width height ncolors chars_per_pixel
"17 13 2 1",
@@ -421,7 +421,7 @@ static char *KDL_KEY_ICON_TAB[] =
"........##.....##",
};
-static char *KDL_KEY_ICON_KP[] =
+static const char *KDL_KEY_ICON_KP[] =
{
// width height ncolors chars_per_pixel
"4 13 2 1",
diff --git a/kodilib/src/tools/KKeyTools.cpp b/kodilib/src/tools/KKeyTools.cpp
index b4a866d..cb9a3f6 100644
--- a/kodilib/src/tools/KKeyTools.cpp
+++ b/kodilib/src/tools/KKeyTools.cpp
@@ -170,7 +170,7 @@ int kKeyGetDisplayWidthForModifier ( const std::string & modName )
// --------------------------------------------------------------------------------------------------------
int kKeyGetDisplayWidthForKey ( const std::string & keyName )
{
- unsigned int keyPos = keyName.find('_', 0);
+ std::string::size_type keyPos = keyName.find('_', 0);
if (keyPos == std::string::npos)
{
return kKeyGetDisplayWidthForPureKey(keyName) + KDL_MOD_KEY_SPACING;
@@ -313,7 +313,7 @@ int kKeyDisplayPureKey ( const std::string & keyName, const KPosition & pos )
int kKeyDisplayKey ( const std::string & keyName, const KPosition & pos )
{
KPosition start = pos;
- unsigned int keyPos = keyName.find('_', 0);
+ std::string::size_type keyPos = keyName.find('_', 0);
if (keyPos == std::string::npos)
{
return start.x + kKeyDisplayPureKey(keyName, start) + KDL_MOD_KEY_SPACING;
@@ -380,7 +380,7 @@ SDLMod kKeyGetModForModName ( const std::string & modName )
// --------------------------------------------------------------------------------------------------------
SDL_keysym kKeyGetKeysymForKeyName ( const std::string & keyName )
{
- unsigned int pos = keyName.find('_');
+ std::string::size_type pos = keyName.find('_');
std::string modString;
std::string symString = keyName;
diff --git a/kodilib/src/tools/KStringTools.cpp b/kodilib/src/tools/KStringTools.cpp
index 6d4d51b..88d8c81 100644
--- a/kodilib/src/tools/KStringTools.cpp
+++ b/kodilib/src/tools/KStringTools.cpp
@@ -6,14 +6,14 @@
#include "KStringTools.h"
#include "KVector.h"
-#include <sys/types.h> // INT_MAX
+#include <limits.h> // INT_MAX
#include <stdio.h>
// --------------------------------------------------------------------------------------------------------
void kStringInsertStringBehindTags ( std::string & str, const std::string & insertString,
const std::string & tag )
{
- unsigned int oldPos = 0;
+ std::string::size_type oldPos = 0;
while ((oldPos = str.find(tag, oldPos)) != std::string::npos)
{
oldPos += tag.size();
@@ -34,8 +34,8 @@ std::vector<std::string> kStringGetComponents ( const std::string & str, const s
{
std::vector<std::string> components;
- unsigned int dividerLength = divider.size();
- unsigned int oldpos = 0, pos;
+ std::string::size_type dividerLength = divider.size();
+ std::string::size_type oldpos = 0, pos;
while ((pos = str.find(divider, oldpos)) != std::string::npos)
{
@@ -50,7 +50,7 @@ std::vector<std::string> kStringGetComponents ( const std::string & str, const s
// --------------------------------------------------------------------------------------------------------
void kStringReplace ( std::string & str, const std::string & toReplace, const std::string & replacement )
{
- unsigned int pos = 0, chars = toReplace.size();
+ std::string::size_type pos = 0, chars = toReplace.size();
while ((pos = str.find(toReplace, pos)) != std::string::npos)
{
str.replace(pos, chars, replacement);
@@ -60,11 +60,11 @@ void kStringReplace ( std::string & str, const std::string & toReplace, const st
// --------------------------------------------------------------------------------------------------------
void kStringReplaceTabs ( std::string & str, unsigned int tabWidth )
{
- unsigned int tabPos;
+ std::string::size_type tabPos;
while ((tabPos = str.find('\t')) != std::string::npos)
{
- unsigned int lastNewlinePos = str.rfind('\n', tabPos-1);
- unsigned int relPos = (lastNewlinePos == std::string::npos) ? tabPos : tabPos - lastNewlinePos;
+ std::string::size_type lastNewlinePos = str.rfind('\n', tabPos-1);
+ std::string::size_type relPos = (lastNewlinePos == std::string::npos) ? tabPos : tabPos - lastNewlinePos;
str.replace(tabPos, 1, std::string(tabWidth-(relPos % tabWidth), ' '));
}
}
@@ -114,7 +114,7 @@ unsigned int kStringCountChars ( const std::string & str, char c )
// --------------------------------------------------------------------------------------------------------
unsigned int kStringNthCharPos ( const std::string & str, unsigned int n, char c )
{
- unsigned int loc = n, oloc = 0;
+ std::string::size_type loc = n, oloc = 0;
while (n > 0 && (loc = str.find(c, oloc)) != std::string::npos)
{
n--;
@@ -138,7 +138,7 @@ void kStringCropRows ( std::string & str, unsigned int rows )
// --------------------------------------------------------------------------------------------------------
void kStringCropCols ( std::string & str, unsigned int columns )
{
- unsigned int oloc = 0, nloc = 0;
+ std::string::size_type oloc = 0, nloc = 0;
while ((nloc = str.find('\n', oloc)) != std::string::npos)
{
if ((nloc - oloc) > columns)
@@ -160,10 +160,10 @@ void kStringCropCols ( std::string & str, unsigned int columns )
unsigned int kStringCols ( const std::string & str )
{
if (str.size() == 0) return 0;
- int oloc = 0, nloc;
+ long oloc = 0, nloc;
std::string substring;
int maxlength = 0, length;
- while ((nloc = str.find('\n', oloc)) != (int)std::string::npos)
+ while ((nloc = str.find('\n', oloc)) != (long)std::string::npos)
{
substring = str.substr(oloc, nloc - oloc);
length = substring.size();
@@ -181,7 +181,7 @@ unsigned int kStringCols ( const std::string & str )
unsigned int kStringRows ( const std::string & str )
{
if (str.size() == 0) return 1;
- unsigned int loc = 0, lines = 0;
+ std::string::size_type loc = 0, lines = 0;
while ((loc = str.find('\n', loc)) != std::string::npos) { lines++; loc++; }
if (str[str.size()-1] == '\n') return lines;
return lines+1;
@@ -204,8 +204,8 @@ std::string kStringPrintf ( const std::string & fmt, va_list * argList )
{
static char str[256];
std::string format(fmt), subformat, text;
- unsigned int oloc = 0;
- unsigned int nloc = 0;
+ std::string::size_type oloc = 0;
+ std::string::size_type nloc = 0;
kStringReplaceTabs(format);
@@ -260,7 +260,7 @@ std::string kStringPrintf ( const char * fmt ...)
// --------------------------------------------------------------------------------------------------------
bool kStringHasSuffix ( const std::string & str, const std::string & suffix )
{
- unsigned int result = str.rfind(suffix);
+ std::string::size_type result = str.rfind(suffix);
if (result == std::string::npos) return false;
return (result == str.size()-suffix.size());
}
diff --git a/kodilib/src/tools/KStringTools.h b/kodilib/src/tools/KStringTools.h
index 7c9f48b..22ad513 100644
--- a/kodilib/src/tools/KStringTools.h
+++ b/kodilib/src/tools/KStringTools.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
#include <stdarg.h>
+#include <string.h>
// --------------------------------------------------------------------------------------------------------
diff --git a/kodilib/src/tools/KXMLTools.cpp b/kodilib/src/tools/KXMLTools.cpp
index 832177a..d05975f 100644
--- a/kodilib/src/tools/KXMLTools.cpp
+++ b/kodilib/src/tools/KXMLTools.cpp
@@ -7,6 +7,7 @@
#include "KConsole.h"
#include "KSeparatedMatrix.h"
#include <stdio.h>
+#include <stdlib.h>
// --------------------------------------------------------------------------------------------------------
std::string kXMLTag ( const std::string & name, const std::string & attributes, int depth )
@@ -58,11 +59,11 @@ std::string kXMLPrintf ( int depth, const char * fmt ...)
std::string kXMLParseToTagsInVector ( std::string & xml, const std::vector<std::string> & tags )
{
std::string open("<");
- unsigned int minLoc = std::string::npos;
+ std::string::size_type minLoc = std::string::npos;
std::vector<std::string>::const_iterator iter = tags.begin();
while (iter != tags.end())
{
- unsigned int loc = xml.find(open+(*iter));
+ std::string::size_type loc = xml.find(open+(*iter));
if (loc < minLoc) minLoc = loc;
iter++;
}
@@ -77,7 +78,7 @@ std::string kXMLReadNamedAttribute ( const std::string & xml, const std::string
std::string value;
std::string nameStr(name);
nameStr += "='";
- unsigned int loc = xml.find(nameStr);
+ std::string::size_type loc = xml.find(nameStr);
if (loc != std::string::npos)
{
loc += nameStr.size();
@@ -90,7 +91,7 @@ std::string kXMLReadNamedAttribute ( const std::string & xml, const std::string
// --------------------------------------------------------------------------------------------------------
bool kXMLParseNamedCloseTag ( std::string & xml, const std::string & name, bool printError )
{
- unsigned int loc = xml.find('<');
+ std::string::size_type loc = xml.find('<');
if (loc == std::string::npos)
{
if (printError) KConsole::printError(kStringPrintf("invalid XML:\nmissing close tag '%s'",
@@ -117,7 +118,7 @@ bool kXMLParseNamedCloseTag ( std::string & xml, const std::string & name, bool
// --------------------------------------------------------------------------------------------------------
bool kXMLReadNamedOpenTag ( const std::string & xml, const std::string & name, std::string * attributes )
{
- unsigned int loc = xml.find('<'), endloc;
+ std::string::size_type loc = xml.find('<'), endloc;
if (loc == std::string::npos || xml[loc+1] == '/') return false;
@@ -140,7 +141,7 @@ bool kXMLReadNamedOpenTag ( const std::string & xml, const std::string & name, s
// --------------------------------------------------------------------------------------------------------
std::string kXMLParseNamedOpenTag ( std::string & xml, const std::string & name, std::string * attributes, bool printError )
{
- unsigned int loc = xml.find('<');
+ std::string::size_type loc = xml.find('<');
if (loc == std::string::npos || xml[loc+1] == '/')
{
if (printError) KConsole::printError(kStringPrintf("invalid XML:\nmissing tag '%s'", name.c_str()));
@@ -191,7 +192,7 @@ std::string kXMLParseNamedOpenTag ( std::string & xml, const std::string & name,
// --------------------------------------------------------------------------------------------------------
bool kXMLParseOpenTag ( std::string & xml, std::string & name, std::string * attributes, bool printError )
{
- unsigned int loc = xml.find('<');
+ std::string::size_type loc = xml.find('<');
if (loc == std::string::npos || xml[loc+1] == '/')
{
if (printError) KConsole::printError("invalid XML:\nmissing open tag");
@@ -295,7 +296,7 @@ std::string kXMLValue( const std::string & name, int type, const void * value, i
// --------------------------------------------------------------------------------------------------------
bool kXMLParseValue( std::string & xml, const std::string & name, int type, void * value, bool printError )
{
- unsigned int loc = xml.find('<');
+ std::string::size_type loc = xml.find('<');
if (loc == std::string::npos || xml[loc+1] == '/')
{
if (printError) KConsole::printError(kStringPrintf("invalid XML:\nmissing value '%s'", name.c_str()));
@@ -379,8 +380,8 @@ bool kXMLParseValue( std::string & xml, const std::string & name, int type, void
}
else if (typeString == "string")
{
- unsigned int first = substring.find("\"")+1;
- unsigned int last = substring.rfind("\"", std::string::npos);
+ std::string::size_type first = substring.find("\"")+1;
+ std::string::size_type last = substring.rfind("\"", std::string::npos);
*((std::string*)value) = substring.substr(first, last-first);
}
diff --git a/kodilib/src/types/KKey.cpp b/kodilib/src/types/KKey.cpp
index 8a6dec5..b94a11e 100644
--- a/kodilib/src/types/KKey.cpp
+++ b/kodilib/src/types/KKey.cpp
@@ -31,7 +31,7 @@ KKey::KKey ( std::string keyName )
// --------------------------------------------------------------------------------------------------------
std::string KKey::getUnmodifiedName () const
{
- unsigned int keyPos = name.find('_', 0);
+ std::string::size_type keyPos = name.find('_', 0);
if (keyPos == std::string::npos)
{
return name;
@@ -42,7 +42,7 @@ std::string KKey::getUnmodifiedName () const
// --------------------------------------------------------------------------------------------------------
std::string KKey::getModifierName () const
{
- unsigned int keyPos = name.find('_', 0);
+ std::string::size_type keyPos = name.find('_', 0);
if (keyPos == std::string::npos)
{
return "";
diff --git a/kodilib/src/widgets/KButtonSymbols.h b/kodilib/src/widgets/KButtonSymbols.h
index 34a32e8..0773e76 100644
--- a/kodilib/src/widgets/KButtonSymbols.h
+++ b/kodilib/src/widgets/KButtonSymbols.h
@@ -6,7 +6,7 @@
#ifndef __KButtonSymbols
#define __KButtonSymbols
-static char *KDS_BUTTONICON_CLEAR[] =
+static const char *KDS_BUTTONICON_CLEAR[] =
{
// width height ncolors chars_per_pixel
"13 13 1 1",
@@ -28,7 +28,7 @@ static char *KDS_BUTTONICON_CLEAR[] =
".............",
};
-static char *KDS_BUTTONICON_CROSS[] =
+static const char *KDS_BUTTONICON_CROSS[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -51,7 +51,7 @@ static char *KDS_BUTTONICON_CROSS[] =
"#...........#",
};
-static char *KDS_BUTTONICON_UP[] =
+static const char *KDS_BUTTONICON_UP[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -74,7 +74,7 @@ static char *KDS_BUTTONICON_UP[] =
".............",
};
-static char *KDS_BUTTONICON_DOWN[] =
+static const char *KDS_BUTTONICON_DOWN[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -97,7 +97,7 @@ static char *KDS_BUTTONICON_DOWN[] =
".............",
};
-static char *KDS_BUTTONICON_ARROW_RIGHT[] =
+static const char *KDS_BUTTONICON_ARROW_RIGHT[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -120,7 +120,7 @@ static char *KDS_BUTTONICON_ARROW_RIGHT[] =
".............",
};
-static char *KDS_BUTTONICON_ARROW_LEFT[] =
+static const char *KDS_BUTTONICON_ARROW_LEFT[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -143,7 +143,7 @@ static char *KDS_BUTTONICON_ARROW_LEFT[] =
".............",
};
-static char *KDS_BUTTONICON_ARROW_UP[] =
+static const char *KDS_BUTTONICON_ARROW_UP[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -166,7 +166,7 @@ static char *KDS_BUTTONICON_ARROW_UP[] =
".............",
};
-static char *KDS_BUTTONICON_ARROW_DOWN[] =
+static const char *KDS_BUTTONICON_ARROW_DOWN[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -189,7 +189,7 @@ static char *KDS_BUTTONICON_ARROW_DOWN[] =
".............",
};
-static char *KDS_BUTTONICON_TOP[] =
+static const char *KDS_BUTTONICON_TOP[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -212,7 +212,7 @@ static char *KDS_BUTTONICON_TOP[] =
".............",
};
-static char *KDS_BUTTONICON_BOTTOM[] =
+static const char *KDS_BUTTONICON_BOTTOM[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -235,7 +235,7 @@ static char *KDS_BUTTONICON_BOTTOM[] =
".............",
};
-static char *KDS_BUTTONICON_DOUBLE_UP[] =
+static const char *KDS_BUTTONICON_DOUBLE_UP[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
@@ -258,7 +258,7 @@ static char *KDS_BUTTONICON_DOUBLE_UP[] =
".............",
};
-static char *KDS_BUTTONICON_DOUBLE_DOWN[] =
+static const char *KDS_BUTTONICON_DOUBLE_DOWN[] =
{
// width height ncolors chars_per_pixel
"13 13 2 1",
diff --git a/kodilib/src/widgets/KFileNameField.cpp b/kodilib/src/widgets/KFileNameField.cpp
index 81074e5..4cd425c 100644
--- a/kodilib/src/widgets/KFileNameField.cpp
+++ b/kodilib/src/widgets/KFileNameField.cpp
@@ -41,7 +41,7 @@ bool KFileNameField::handleKey ( const KKey & key )
std::string restPath; // path behind cursor
// map cropped path to current directory and rest path to file prefix
- unsigned int lastSlashPos = croppedPath.rfind("/");
+ std::string::size_type lastSlashPos = croppedPath.rfind("/");
if (lastSlashPos < croppedPath.size()-1)
{
restPath = croppedPath.substr(lastSlashPos+1);
@@ -88,7 +88,7 @@ bool KFileNameField::handleKey ( const KKey & key )
}
// ............................collect list of entries in searchDir that match prefix restPath
- unsigned int restLength = restPath.size();
+ std::string::size_type restLength = restPath.size();
std::vector<std::string> matchingEntries;
std::vector<std::string>::iterator iter = dir_entries.begin();
while (iter != dir_entries.end())
@@ -223,7 +223,7 @@ bool KFileNameField::handleKey ( const KKey & key )
// --------------------------------------------------------------------------------------------------------
void KFileNameField::selectLastPathComponent ()
{
- unsigned int lastSlashPos = text.rfind("/");
+ std::string::size_type lastSlashPos = text.rfind("/");
if (lastSlashPos == text.size()-1) lastSlashPos = text.rfind("/", lastSlashPos-1);
if (lastSlashPos < text.size()) cursor_pos = lastSlashPos+1;
else cursor_pos = 0;
diff --git a/linux/Makefile b/linux/Makefile
index dabdd8a..fe1d756 100644
--- a/linux/Makefile
+++ b/linux/Makefile
@@ -6,7 +6,7 @@
#
X11_INCLUDES = -I /usr/X11/include/
-PYTHON_VERSION=2.3
+PYTHON_VERSION=2.5
PYTHON_INCLUDES = -I /usr/include/python$(PYTHON_VERSION)
SDLCFLAGS = $(shell sdl-config --cflags)
@@ -14,11 +14,8 @@ SDLLIBS = $(shell sdl-config --libs) -lSDL_image -lSDL_mixer
GLLIBS = -lglut -lGLU -lGL
-PYTHONHOME = /usr/lib/python$(PYTHON_VERSION)/
-PYTHONLIBS = $(PYTHONHOME)/config/libpython$(PYTHON_VERSION).a -lutil \
- $(PYTHONHOME)/lib-dynload/math.so \
- $(PYTHONHOME)/lib-dynload/time.so \
- $(PYTHONHOME)/lib-dynload/_random.so
+PYTHONHOME = /usr/lib/python$(PYTHON_VERSION)
+PYTHONLIBS = -lpython$(PYTHON_VERSION) -lutil
# change this, if the kodilib directory isn't parallel to the kiki directory
@@ -46,7 +43,7 @@ KIKI_INCLUDES = -I ../SWIG $(KODILIBINC) \
INCLUDES = $(KIKI_INCLUDES) $(X11_INCLUDES) $(PYTHON_INCLUDES)
-CXXFLAGS = $(INCLUDES) $(SDLCFLAGS)
+CXXOPTS = $(INCLUDES) $(SDLCFLAGS) $(CXXFLAGS)
src = \
$(KIKISRC)/base/KikiAction.cpp \
@@ -105,8 +102,10 @@ src = \
obj = $(src:.cpp=.o)
kiki: $(KIKISRC)/../SWIG/KikiPy_wrap.cpp $(obj)
- -(cd ../SWIG; swig -c++ -python -globals kiki -o KikiPy_wrap.cpp KikiPy.i; cp kiki.py ../py)
- $(CXX) $(obj) $(KODILIB) -o kiki $(GLLIBS) $(SDLLIBS) $(PYTHONLIBS)
+ $(CXX) $(CXXOPTS) $(obj) $(KODILIB) -o kiki $(GLLIBS) $(SDLLIBS) $(PYTHONLIBS)
+
+$(KIKISRC)/../SWIG/KikiPy_wrap.cpp: $(wildcard ../SWIG/*.i)
+ -(cd ../SWIG && swig -c++ -python -globals kiki -o KikiPy_wrap.cpp KikiPy.i && cp kiki.py ../py)
obj-clean:
$(RM) -f $(obj)
@@ -115,5 +114,5 @@ clean:
$(RM) -f $(obj) kiki
%.o: %.cpp
- $(CXX) -c $(CXXFLAGS) -o $@ $<
+ $(CXX) -c $(CXXOPTS) -o $@ $<
diff --git a/py/config.py b/py/config.py
index ad8f6e4..4b6d247 100644
--- a/py/config.py
+++ b/py/config.py
@@ -46,11 +46,14 @@ class KikiConfig (ConfigParser):
Controller.setGamma(int(value))
elif option == "fullscreen":
fullscreen = self.getboolean(section, option)
- if fullscreen <> Controller.getFullscreen():
- screen_size = self.get (section, fullscreen and "fullscreen size" or "window size")
- screen_size = tuple (map (int, screen_size.split("x")))
- Controller.changeScreenSize (screen_size[0], screen_size[1], self.getboolean(section, option))
- self.set (section, "fullscreen size", "%dx%d" % Controller.getScreenSize())
+ if fullscreen:
+ # remember window size before switching to fullscreen
+ if not Controller.getFullscreen():
+ self.set (section, "window size", "%dx%d" % Controller.getScreenSize())
+ Controller.changeScreenSize (0, 0, true)
+ else:
+ window_size = map (int, self.get (section, "window size").split("x"))
+ Controller.changeScreenSize (window_size[0], window_size[1], false)
elif section == "keyboard":
player = Controller.getPlayer()
player.setKeyForAction (value, option.replace("_", " "))
@@ -70,6 +73,10 @@ class KikiConfig (ConfigParser):
def save (self):
"""save the configuration"""
+ # Save the window size. We need to do this here as the resize
+ # notifications don't get transfered to the Python code (AFAICS).
+ if not Controller.getFullscreen():
+ self.set ("display", "window size", "%dx%d" % Controller.getScreenSize())
try:
cfg_file = file (self.config_file_path, "w+")
self.write (cfg_file)
diff --git a/py/kiki.cfg b/py/kiki.cfg
index 4648c47..5ceb76f 100644
--- a/py/kiki.cfg
+++ b/py/kiki.cfg
@@ -9,7 +9,7 @@ speed = 7
fov = 90
window_size = 800x600
fullscreen_size = 1600x1280
-fullscreen = off
+fullscreen = on
language = english
gamma = 5
diff --git a/py/lang.py b/py/lang.py
index 85b567f..85ff249 100644
--- a/py/lang.py
+++ b/py/lang.py
@@ -1,16 +1,26 @@
# -*- encoding: utf-8 -*-
-
+import locale
+
+locale=locale.getdefaultlocale()[0]
+if locale: language=locale[0:2]
+else: language="en"
+
if Controller.isDebugVersion(): print "[lang.py]"
+
+lang_dict = { "nl":"dutch", "en":"english", "eu":"euskara", "fr":"francaise", "de":"german", "pt":"portuguese", "ru":"russian", "es":"spanish", "sv":"swedish", }
-Controller.language = "english"
-
-lang_list = [ "dutch", "english", "euskara", "german", "portuguese", "spanish", "swedish", ]
+if language in lang_dict:
+ Controller.language = lang_dict[language]
+else:
+ Controller.language = "english"
+
+lang_list = [ "dutch", "english", "euskara", "francaise", "german", "portuguese", "russian", "spanish", "swedish", ]
lang = {}
for langName in lang_list:
execfile (kikipy_path + os.path.sep + "lang" + os.path.sep + langName + ".py")
def getLocalizedString(text):
- if lang[Controller.language].has_key(text):
+ if text in lang[Controller.language]:
return lang[Controller.language][text]
else:
return text
diff --git a/py/lang/dutch.py b/py/lang/dutch.py
index 00b1aa5..d13d9f8 100644
--- a/py/lang/dutch.py
+++ b/py/lang/dutch.py
@@ -1,16 +1,18 @@
-# -*- encoding: utf-8 -*-
+# -*- encoding: utf-8 -*-
# Dutch (Nederlands) versions of kiki texts
# translation by Arthur Langereis
-
+
lang['dutch'] = {
# game title
-
+
"kiki the nano bot": "kiki de nano bot",
# menu
"new game": "nieuw spel",
+"continue": "verdergaan",
+"statistics": "statistieken",
"load level": "laad spel",
"next level": "volgend niveau",
"restart": "begin opnieuw",
@@ -37,10 +39,10 @@ lang['dutch'] = {
"STORY_PAGE_1": "Er leefden eens\nwat kleine robotjes\nin de nano wereld.\n\nze hadden een gelukkig\nkunstmatig leven en\nverzamelden druk materialen\nvoor de maker,\ndie meer en meer\nkleine robotjes maakte.",
"STORY_PAGE_2": "maar op een dag,\nvernietigde een parasiet\nhet controle programma\nvan de maker.\n\nvanaf dat moment werkt\nde maker slecht en\nproduceert hij slechts\nluie domme kleine robotjes\ndie op elkaar schieten\nen de nano wereld stuk maken.",
"STORY_PAGE_3": "het is jouw taak om kiki,\nde laatste gezonde bot,\nte helpen om de maker\nte repareren.\n\nveel geluk!",
-
-# statistics
-
-"STATISTICS_TEXT": "$scale(1.5)statistics\n\nyou solved %d of %d levels\n\nyour current score is %d\n\n$scale(2.0)%d",
+
+# statistics
+
+"STATISTICS_TEXT": "$scale(1.5)statistieken\n\nje loste %d van %d niveaus op\n\nje huidige score is\n\n$scale(2.0)%d",
# setup
@@ -72,7 +74,7 @@ lang['dutch'] = {
"press the new key": "druk op de nieuwe toets",
"action without key": "geen toets ingesteld",
-"back to setup": "terug naar configuratie"
+"back to setup": "terug naar configuratie"
}
diff --git a/py/lang/francaise.py b/py/lang/francaise.py
new file mode 100644
index 0000000..46ed08e
--- /dev/null
+++ b/py/lang/francaise.py
@@ -0,0 +1,77 @@
+# -*- encoding: utf-8 -*-
+# Versions Francaise de kiki texts
+# translation by philrich123.free.fr
+
+lang['francaise'] = {
+
+# game title
+
+"kiki the nano bot": "kiki le nano robot",
+
+# menu
+
+"new game": "nouvelle Partie",
+"load level": "charger le niveau",
+"next level": "niveau suivant",
+"restart": "redemarrer",
+"setup": "configuration",
+"story": "histoire",
+"demo": "demonstration",
+"about": "a propos",
+"help": "aide",
+"quit": "quitter",
+"back": "retour",
+
+# about
+
+"version": "version",
+"programmed by": "programmation de",
+"sounds from": "les sons sont de",
+"thanks": "remerciements",
+"visit": "visiter",
+"for more games": "pour plus de jeux",
+"main menu": "menu principal",
+
+# story
+
+"STORY_PAGE_1": "Il etait une fois,\ndes tout petis robots\nvivants dans un tout\npetit monde.\n\nIls vivaient une vie\ntres agitee, collectant\nles ressources necessaires\na la fabrication d'autres robots\nminuscules.",
+"STORY_PAGE_2": "Mais un jour,\nun virus detruisit le programme\nde l'appareil a fabriquer les nouveaux\nrobots.\n\nDepuis lors il \nfonctionne mal\net ne produit plus\nque des affreux petits robots\nstupides qui ne pense qu'a\ntout detruire.",
+"STORY_PAGE_3": "Votre tache est d'aider kiki,\nle seul robot sain qui reste,\na depanner le programme.\n\nbonne chance!",
+
+# statistics
+
+"STATISTICS_TEXT": "$scale(1.5)statistiques\n\nvous avez resolu %d des %d niveaux\n\nvotre score actuel est\n\n$scale(2.0)%d",
+
+# setup
+
+"language": "langue",
+"off": "non",
+"on": "oui",
+"sound": "son",
+"volume": "volume",
+"fullscreen": "plein ecran",
+"fov": "fov",
+"speed": "vitesse",
+"keyboard setup": "configuration du clavier",
+"save": "sauver",
+
+# keyboard setup
+
+"$no_itemkeyboard setup": "$no_itemconfiguration du clavier", # don't translate $no_item
+"$no_item": "$no_item", # don't change this
+
+"move forward": "aller en avant",
+"move backward": "aller en arriere",
+"turn left": "tourner a gauche",
+"turn right": "tourner a droite",
+"jump": "sauter",
+"push": "pousser",
+"shoot": "tirer",
+"change view": "changer de vue",
+"look up": "regarder vers le haut",
+"look down": "regarder vers le bas",
+
+"press the new key": "appuyer sur la nouvelle touche",
+"action without key": "action sans touche",
+"back to setup": "retour a la configuration",
+}
diff --git a/py/lang/russian.py b/py/lang/russian.py
new file mode 100644
index 0000000..a76efb5
--- /dev/null
+++ b/py/lang/russian.py
@@ -0,0 +1,81 @@
+# -*- encoding: koi8-r -*-
+# Localized versions of kiki texts
+
+lang['russian'] = {
+
+# game title
+
+"kiki the nano bot": " -",
+
+# menu
+
+"new game": " ",
+"continue": "",
+"statistics": "",
+"load level": " ",
+"next level": " ",
+"restart": " ",
+"setup": "",
+"story": "",
+"demo": "",
+"about": " ",
+"help": "",
+"quit": "",
+"back": "",
+
+# about
+
+"version": "",
+"programmed by": "programmed by",
+"sounds from": " ",
+"thanks": "",
+"visit": "",
+"for more games": " ",
+"main menu": " ",
+
+# story
+
+"STORY_PAGE_1": "once upon a time,\nthere were some\ntiny little robots\nliving in the nano world.\n\nthey lived a happy artificial life\nbusily collecting resources\nfor the maker\nwho made more and more\ntiny little robots.",
+"STORY_PAGE_2": "but one day,\na parasitic capacity\ndestroyed the maker's\nmaster control program.\n\nsince then he is\nmalfunctioning\nand only producing\nlazy stupid little robots\nwhich shoot each other\nand destroy the nano world.",
+"STORY_PAGE_3": "your task is to help kiki,\nthe only sane bot left over,\nto repair the maker.\n\ngood luck!",
+
+# statistics
+
+"STATISTICS_TEXT": "$scale(1.5):\n\n %d %d \n\n \n\n$scale(2.0)%d",
+
+# setup
+
+"language": "",
+"off": "",
+"on": "",
+"sound": "",
+"volume": "",
+"fullscreen": " ",
+"fov": "",
+"keyboard setup": " ",
+"gamma": "",
+"speed": "",
+"keyboard setup": "",
+"save": "",
+
+# keyboard setup
+
+"$no_itemkeyboard setup": "$no_itemkeyboard setup", # don't translate $no_item
+"$no_item": "$no_item", # don't change this
+
+"move forward": "",
+"move backward": "",
+"turn left": " ",
+"turn right": " ",
+"jump": "",
+"push": "",
+"shoot": "",
+"change view": " ",
+"look up": " ",
+"look down": " ",
+
+"press the new key": " ",
+"action without key": " ",
+"back to setup": " ",
+}
+
\ No newline at end of file
diff --git a/py/levelselection.py b/py/levelselection.py
index d787fac..d55fede 100644
--- a/py/levelselection.py
+++ b/py/levelselection.py
@@ -25,6 +25,8 @@ def levelSelection (level_index=-1, escapeAction=0):
# ............................................................................................................
last_level = highscore.getLastAvailableLevel()
+ if last_level < 0:
+ last_level = 0
current_level = (level_index >= 0) and level_index or last_level
world.max_level_index = last_level
diff --git a/py/setup.py b/py/setup.py
index d03d3b7..6efd524 100644
--- a/py/setup.py
+++ b/py/setup.py
@@ -132,7 +132,7 @@ def quickSetup (itemIndex = 0, escapeAction=0):
menu.addItem (Controller.getLocalizedString ("volume") + ": |%d" % (int (sound.getSoundVolume()/(128/9)),), setupOption ("volume"), True)
menu.addItem (Controller.getLocalizedString ("fullscreen") + ": |" + (Controller.getFullscreen() and Controller.getLocalizedString ("on") or Controller.getLocalizedString ("off")), setupOption ("fullscreen"), True)
menu.addItem (Controller.getLocalizedString ("fov") + ": |%d" % (int (Controller.world.getProjection().getFov()),), setupOption ("fov"), True)
- menu.addItem ("gamma: |%d" % (int (Controller.getGamma()),), setupOption ("gamma"), True)
+ menu.addItem (Controller.getLocalizedString("gamma") + "|%d" % (int (Controller.getGamma()),), setupOption ("gamma"), True)
menu.addItem (Controller.getLocalizedString ("speed") + ": |%d" % (Controller.getSpeed(),), setupOption ("speed"), True)
if escapeAction:
diff --git a/py/world.py b/py/world.py
index e86bafe..80a73fa 100644
--- a/py/world.py
+++ b/py/world.py
@@ -153,7 +153,7 @@ class KikiPyWorld (KikiPyActionObject):
if "intro" in self.dict:
if not self.preview:
intro_text = KikiScreenText ()
- intro_text.addText (self.dict["intro"])
+ intro_text.addText (Controller.getLocalizedString(self.dict["intro"]))
intro_text.show ()
world.setName (self.dict["intro"])
else:
diff --git a/src/base/KikiAction.cpp b/src/base/KikiAction.cpp
index a57c685..ee09259 100644
--- a/src/base/KikiAction.cpp
+++ b/src/base/KikiAction.cpp
@@ -19,6 +19,8 @@ KikiAction::KikiAction ( KikiActionObject * o, int i, const std::string & n, int
mode = m;
duration = d;
event = NULL;
+
+ delete_flag_ptr = NULL;
reset();
}
@@ -32,6 +34,8 @@ KikiAction::KikiAction ( KikiActionObject * o, int d, int m )
duration = d;
event = NULL;
+ delete_flag_ptr = NULL;
+
reset();
}
@@ -40,6 +44,7 @@ KikiAction::~KikiAction ()
{
if (event) event->removeAction(this);
if (action_object) action_object->removeAction(this);
+ if (delete_flag_ptr) *delete_flag_ptr = true;
}
// --------------------------------------------------------------------------------------------------------
@@ -50,9 +55,18 @@ void KikiAction::perform () { action_object->performAction (this); }
void KikiAction::finish () { action_object->finishAction (this); }
// --------------------------------------------------------------------------------------------------------
void KikiAction::finished ()
-{
+{
+ bool delete_flag = false;
+ delete_flag_ptr = &delete_flag;
+
action_object->actionFinished(this);
+ if (delete_flag)
+ {
+ return;
+ }
+ delete_flag_ptr = NULL;
+
if (current == getDuration()) // if keepRest wasn't called -> reset start and current values
{
reset();
diff --git a/src/base/KikiAction.h b/src/base/KikiAction.h
index 1462fcb..e2fd870 100644
--- a/src/base/KikiAction.h
+++ b/src/base/KikiAction.h
@@ -68,6 +68,8 @@ class KikiAction
int duration;
int mode;
KikiEvent * event;
+
+ bool * delete_flag_ptr;
};
// __________________________________________________________________________________________________
diff --git a/src/base/KikiEvent.cpp b/src/base/KikiEvent.cpp
index 5603c2d..9df74fc 100644
--- a/src/base/KikiEvent.cpp
+++ b/src/base/KikiEvent.cpp
@@ -20,10 +20,7 @@ KikiEvent::KikiEvent ( KikiActionObject * o, const std::string & name )
// --------------------------------------------------------------------------------------------------------
KikiEvent::~KikiEvent ()
{
- while (actions.empty() == false)
- {
- actions.pop_back();
- }
+ actions.clear();
}
// --------------------------------------------------------------------------------------------------------
@@ -127,7 +124,7 @@ void KikiEvent::triggerActions ()
{
KikiAction * action = save_actions.back();
action->performWithEvent (*this);
- if (save_actions.back() == action)
+ if (save_actions.empty() == false && save_actions.back() == action)
{
save_actions.pop_back();
}
@@ -153,7 +150,7 @@ void KikiEvent::finishActions ()
KikiAction * action = finished_actions.back();
//KConsole::print(this->getName() + " finishActions " + action->getName());
action->finished();
- if (finished_actions.back() == action)
+ if (finished_actions.empty() == false && finished_actions.back() == action)
{
//KConsole::print(this->getName() + " finishActions -- " + action->getName());
finished_actions.pop_back();
diff --git a/src/base/KikiPyAction.cpp b/src/base/KikiPyAction.cpp
index 2574fd0..853dcfd 100644
--- a/src/base/KikiPyAction.cpp
+++ b/src/base/KikiPyAction.cpp
@@ -44,8 +44,9 @@ void KikiPyAction::perform ()
}
else if (PyInstance_Check(python_object))
{
- result = PyObject_CallMethod (python_object, "performAction", "sf", action_name.c_str(),
- getRelativeTime());
+ result = PyObject_CallMethod (python_object, const_cast<char*>("performAction"),
+ const_cast<char*>("sf"),
+ action_name.c_str(), getRelativeTime());
}
if (result)
{
@@ -63,7 +64,12 @@ void KikiPyAction::finish ()
{
if (PyObject_TypeCheck(python_object, &PyInstance_Type))
{
- if (PyObject_CallMethod(python_object, "finishAction", "s", action_name.c_str()) == NULL)
+ PyObject * result = PyObject_CallMethod(python_object, const_cast<char*>("finishAction"), const_cast<char*>("s"), action_name.c_str());
+ if (result)
+ {
+ Py_DECREF(result);
+ }
+ else
{
KConsole::printError("KikiPyAction::finish failed");
}
@@ -75,7 +81,12 @@ void KikiPyAction::finished ()
{
if (PyObject_TypeCheck(python_object, &PyInstance_Type))
{
- if (PyObject_CallMethod(python_object, "actionFinished", "s", action_name.c_str()) == NULL)
+ PyObject * result = PyObject_CallMethod(python_object, const_cast<char*>("actionFinished"), const_cast<char*>("s"), action_name.c_str());
+ if (result)
+ {
+ Py_DECREF(result);
+ }
+ else
{
KConsole::printError("KikiPyAction::finished failed");
}
diff --git a/src/bots/KikiPlayer.cpp b/src/bots/KikiPlayer.cpp
index 97620d3..92512ab 100644
--- a/src/bots/KikiPlayer.cpp
+++ b/src/bots/KikiPlayer.cpp
@@ -474,6 +474,7 @@ void KikiPlayer::finishAction ( KikiAction * action )
if (rotate)
{
rotate_action = getActionWithId (rotate);
+ rotate_action->reset();
Controller.timer_event->addAction (rotate_action);
}
}
@@ -606,6 +607,7 @@ bool KikiPlayer::handleKey ( const KKey & key )
if (!look_action)
{
look_action = getActionWithId ((key.name == look_up_key) ? ACTION_LOOK_UP : ACTION_LOOK_DOWN);
+ look_action->reset();
Controller.timer_event->addAction (look_action);
}
@@ -741,3 +743,12 @@ const KColor & KikiPlayer::getTireColor ()
return colors[KikiPlayer_tire_color];
}
+// __________________________________________________________________________________________________
+void KikiPlayer::finishRotateAction ()
+{
+ if (rotate_action)
+ {
+ rotate = false;
+ finishAction(rotate_action);
+ }
+}
diff --git a/src/bots/KikiPlayer.h b/src/bots/KikiPlayer.h
index 8321d16..537a658 100644
--- a/src/bots/KikiPlayer.h
+++ b/src/bots/KikiPlayer.h
@@ -40,6 +40,8 @@ class KikiPlayer : public KikiBot, public KKeyHandler
void performAction ( KikiAction * action );
void finishAction ( KikiAction * action );
+ void finishRotateAction ();
+
// ........................................................................ display
void display ();
void die ();
diff --git a/src/gui/KikiCharacter.cpp b/src/gui/KikiCharacter.cpp
index 3e4a8fb..e1c2bf0 100644
--- a/src/gui/KikiCharacter.cpp
+++ b/src/gui/KikiCharacter.cpp
@@ -153,7 +153,49 @@ static KikiCharCoords KikiCharacterData[][3][30] = {
{{ {2,0}, {3,-1}, {2,-2}, {3,-2}, {4,-1}, {3,-0}, {-1}}, // tail for
{{-1}}, {{-1}}},
{{ {1,9}, {5,9}, {5,12}, {1,12}, {-1}}, // circle for
- {{2,10}, {2,11}, {4, 11}, {4,10}, {-1}}, {{-1}}},
+ {{2,10}, {2,11}, {4, 11}, {4,10}, {-1}}, {{-1}}},
+ {{ {0,0}, {4,0}, {6,1}, {6,4}, {5,5}, {2,5}, {2,6}, {6,6}, {6,8}, {0,8}, // cyrillic b
+ {-1}}, {{2,2}, {2,3}, {4,3}, {4,2}, {-1}}, {{-1}}},
+ {{ {0,0}, {2,0}, {2,6}, {6,6}, {6,8}, {0,8}, {-1}}, {{-1}}, {{-1}}}, // cyrillic g
+ {{ {0,0}, {2,2.5}, {2,0}, {3.5,0}, {3.5,2}, {6,0}, {6,2}, {4,4}, {6,6}, // cyrillic zh
+ {6,8}, {3.5,6}, {3.5,8}, {2.5,8}, {2.5,6}, {0,8}, {0,6}, {2,4}, {0,2},
+ {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {5,0}, {6,1}, {6,3}, {5,4}, {6,5}, {6,7}, {5,8}, {0,8}, {0,6}, // cyrillic z
+ {4,6}, {4,5}, {2,5}, {2,3}, {4,3}, {4,2}, {0,2}, {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {2,0}, {4,3}, {4,0}, {6,0}, {6,8}, {4,8}, {4,6}, {2,3}, {2,8}, // cyrillic i
+ {0,8}, {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {2,0}, {4,4}, {4,0}, {6,0}, {6,8}, {4,8}, {-1}}, // cyrillic l
+ {{-1}},{{-1}}},
+ {{ {0,0}, {2,0}, {2,6}, {4,6}, {4,0}, {6,0}, {6,8}, {0,8}, // cyrillic p
+ {-1}}, {{-1}},{{-1}}},
+ {{ {0,1}, {1,0}, {5,0}, {6,1}, {6,8}, {4,8}, {4,4}, {2,5}, {2,8}, {0,8}, // cyrillic u
+ {0,4}, {4,2}, {1,2}, {0,3}, {-1}}, {{-1}}, {{-1}}},
+ {{ {2,0}, {4,0}, {4,2}, {5,2}, {6,3}, {6,6}, {5,7}, {4,7}, {4,8}, {2,8}, // cyrillic f
+ {2,7}, {1,7}, {0,6}, {0,3}, {1,2}, {2,2}, {-1}},
+ {{2,3}, {2,6}, {1,5}, {1,4}, {-1}},
+ {{4,3}, {5,4}, {5,5}, {4,6}, {-1}}},
+ {{ {0,1}, {3,1}, {3,0}, {6,0}, {6,2}, {5,2}, {5,8}, {3.5,8}, {3.5,3}, // cyrillic c
+ {1.5,3}, {1.5,8}, {0,8}, {-1}}, {{-1}}, {{-1}}},
+ {{ {4,0}, {6,0}, {6,8}, {4,8}, {4,5}, {2,5}, {2,8}, {0,8}, {0,4}, {1,3}, // cyrillic ch
+ {4,3}, {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {6,0}, {6,8}, {5,8}, {5,2}, {3.5,2}, {3.5,8}, {2.5,8}, // cyrillic sh
+ {2.5,2}, {1,2}, {1,8}, {0,8}, {-1}}, {{-1}},{{-1}}},
+ {{ {0,1}, {4,1}, {4,0}, {6,2}, {5,2}, {5,8}, {4,8}, {4,2}, {3,2}, {3,8}, // cyrillic sch
+ {2,8}, {2,2}, {1,2}, {1,8}, {0,8}, {-1}}, {{-1}},{{-1}}},
+ {{ {1,0}, {4,0}, {6,1}, {6,4}, {5,5}, {3,5}, {3,8}, {0,8}, // cyrillic hard sign
+ {0,6}, {1,6}, {-1}}, {{2,2}, {2,3}, {4,3}, {4,2}, {-1}}, {{-1}}},
+ {{ {0,0}, {3,0}, {4,1}, {4,0}, {6,0}, {6,8}, {4,8}, {4,4}, // cyrillic hard i
+ {3,5}, {2,5}, {2,8}, {0,8}, {-1}},
+ {{2,1.5}, {3,2}, {3,3}, {2,3.5}, {-1}}, {{-1}}},
+ {{ {0,0}, {4,0}, {6,1}, {6,4}, {5,5}, {2,5}, {2,8}, {0,8}, // cyrillic soft sign
+ {-1}}, {{2,2}, {2,3}, {4,3}, {4,2}, {-1}}, {{-1}}},
+ {{ {0,0}, {5,0}, {6,1}, {6,7}, {5,8}, {0,8}, {0,6}, {3,6}, {4,5}, // cyrillic hard e
+ {1,5}, {1,3}, {4,3}, {3,2}, {0,2}, {-1}}, {{-1}}, {{-1}}},
+ {{ {0,0}, {1,0}, {1,3}, {2,3}, {2,1}, {3,0}, {5,0}, {6,1}, {6,7}, {5,8}, // cyrillic yu
+ {3,8}, {2,7}, {2,5}, {1,5}, {1,8}, {0,8}, {-1}},
+ {{4,1}, {5,2}, {5,6}, {4,7}, {3,6}, {3,2}, {-1}}, {{-1}}}, // cyrillic ya
+ {{ {0,0}, {2,0}, {4,2}, {4,0}, {6,0}, {6,8}, {1,8}, {0,7}, {0,5}, {1,4},
+ {3,4}, {0,1}, {-1}}, {{2,5.5}, {4,5.5}, {4,6.5}, {2,6.5}, {-1}}, {{-1}}},
};
// __________________________________________________________________________________________________
@@ -183,6 +225,41 @@ KikiCharacter::KikiCharacter ( char c )
case -93: character = 32; addon = 5; break; //
case -95: character = 32; addon = 2; break; //
case -96: character = 32; addon = 3; break; //
+ case -63: character = 32; break; //
+ case -18: character = 32; break; //
+ case -15: character = 32; break; //
+ case -62: character = 65; break; //
+ case -41: character = 33; break; //
+ case -57: character = 66; break; //
+ case -60: character = 35; break; //
+ case -59: character = 36; break; //
+ case -42: character = 67; break; //
+ case -38: character = 68; break; //
+ case -55: character = 69; break; //
+ case -54: character = 69; addon = 2; break; //
+ case -53: character = 42; break; //
+ case -52: character = 70; break; //
+ case -51: character = 44; break; //
+ case -50: character = 39; break; //
+ case -49: character = 46; break; //
+ case -48: character = 71; break; //
+ case -46: character = 47; break; //
+ case -45: character = 34; break; //
+ case -44: character = 51; break; //
+ case -43: character = 72; break; //
+ case -58: character = 73; break; //
+ case -56: character = 55; break; //
+ case -61: character = 74; break; //
+ case -34: character = 75; break; //
+ case -37: character = 76; break; //
+ case -35: character = 77; break; //
+ case -33: character = 78; break; //
+ case -39: character = 79; break; //
+ case -40: character = 80; break; //
+ case -36: character = 81; break; //
+ case -64: character = 82; break; //
+ case -47: character = 83; break; //
+ case -90: character = 40; break; //ibelorussian
default:
KConsole::printf ("KikiCharacter::KikiCharacter unknown character %c (%d)", c, c);
diff --git a/src/gui/KikiMenu.cpp b/src/gui/KikiMenu.cpp
index 5798194..21f4597 100644
--- a/src/gui/KikiMenu.cpp
+++ b/src/gui/KikiMenu.cpp
@@ -43,6 +43,16 @@ KikiMenu::KikiMenu ( int selectedItem ) : KikiScreenText ()
}
// __________________________________________________________________________________________________
+KikiMenu::~KikiMenu ()
+{
+ while (menu_items.empty() == false)
+ {
+ delete menu_items.back();
+ menu_items.pop_back();
+ }
+}
+
+// __________________________________________________________________________________________________
void KikiMenu::setCurrentIndex (int index)
{
@@ -54,7 +64,7 @@ KikiMenuItem * KikiMenu::newItem ( const std::string & itemText, KikiAction * it
{
std::string item_text (itemText);
std::string event_name (itemText);
- unsigned int pos;
+ std::string::size_type pos;
float scale_factor = 1.0;
KikiMenuItem * menu_item = new KikiMenuItem ();
@@ -402,6 +412,14 @@ KikiMenuItem::KikiMenuItem ()
}
// __________________________________________________________________________________________________
+KikiMenuItem::~KikiMenuItem ()
+{
+ delete item_text;
+ delete value_text;
+ delete extra_text;
+}
+
+// __________________________________________________________________________________________________
float KikiMenuItem::getWidth () const
{
float width = 0.0;
diff --git a/src/gui/KikiMenu.h b/src/gui/KikiMenu.h
index 1a77219..bbe4a51 100644
--- a/src/gui/KikiMenu.h
+++ b/src/gui/KikiMenu.h
@@ -15,6 +15,7 @@ class KikiMenuItem
public:
KikiMenuItem ();
+ ~KikiMenuItem ();
bool ignore;
bool option;
@@ -34,6 +35,7 @@ class KikiMenu : public KikiScreenText
// ........................................................................ (con|de)struction
KikiMenu ( int selectedItem = -1 );
+ virtual ~KikiMenu ();
// ........................................................................ menu items
virtual void addItem ( const std::string & itemText, KikiAction * action = 0, bool option = false);
diff --git a/src/gui/KikiScrollMenu.cpp b/src/gui/KikiScrollMenu.cpp
index 9b99185..fce1887 100644
--- a/src/gui/KikiScrollMenu.cpp
+++ b/src/gui/KikiScrollMenu.cpp
@@ -16,6 +16,17 @@ KikiScrollMenu::KikiScrollMenu ( int rows, int columns, int activeItem ) : KikiC
}
// __________________________________________________________________________________________________
+KikiScrollMenu::~KikiScrollMenu ()
+{
+ menu_items.clear();
+ while (all_menu_items.empty() == false)
+ {
+ delete all_menu_items.back();
+ all_menu_items.pop_back();
+ }
+}
+
+// __________________________________________________________________________________________________
void KikiScrollMenu::addItem ( const std::string & itemText, KikiAction * itemAction, bool option )
{
all_menu_items.push_back (newItem (itemText, itemAction));
diff --git a/src/gui/KikiScrollMenu.h b/src/gui/KikiScrollMenu.h
index 0876df2..6c97151 100644
--- a/src/gui/KikiScrollMenu.h
+++ b/src/gui/KikiScrollMenu.h
@@ -15,6 +15,7 @@ class KikiScrollMenu : public KikiColumnMenu
// ........................................................................ (con|de)struction
KikiScrollMenu ( int rows = 5, int columns = 4, int selectedItem = -1 );
+ virtual ~KikiScrollMenu ();
// ........................................................................ menu items
virtual void addItem ( const std::string & itemText, KikiAction * action = 0, bool option = false );
diff --git a/src/gui/KikiText.cpp b/src/gui/KikiText.cpp
index 9e8172f..c85fdfe 100644
--- a/src/gui/KikiText.cpp
+++ b/src/gui/KikiText.cpp
@@ -13,7 +13,7 @@
#include <KStringTools.h>
// __________________________________________________________________________________________________
-unsigned int KikiText::display_lists[3][58];
+unsigned int KikiText::display_lists[3][CHAR_COUNT];
std::vector<KColor> KikiText::colors(3);
const char * KikiText::color_names[] = { "base", "bright", "dark" };
int KikiText::list_color = -1;
@@ -83,7 +83,7 @@ std::string KikiText::getText () const
// __________________________________________________________________________________________________
void KikiText::invalidateLists ( int index )
{
- for (int c = 0; c < 58; c++)
+ for (int c = 0; c < CHAR_COUNT; c++)
{
if (display_lists[index][c])
{
@@ -104,7 +104,7 @@ void KikiText::init ()
{
for (int i = 0; i < 3; i++)
{
- for (int c = 0; c < 58; c++)
+ for (int c = 0; c < CHAR_COUNT; c++)
{
display_lists[i][c] = 0;
}
diff --git a/src/gui/KikiText.h b/src/gui/KikiText.h
index dc43f23..13875c8 100644
--- a/src/gui/KikiText.h
+++ b/src/gui/KikiText.h
@@ -5,6 +5,7 @@
#ifndef __KikiText
#define __KikiText
+#define CHAR_COUNT 85
#include <KColor.h>
@@ -64,7 +65,7 @@ class KikiText
KColor color;
// ........................................................................ display lists
- static unsigned int display_lists[3][58];
+ static unsigned int display_lists[3][CHAR_COUNT];
static int list_color;
// ........................................................................ depth
static float bevel_depth;
diff --git a/src/gui/KikiTextLine.cpp b/src/gui/KikiTextLine.cpp
index a7caaaf..e5e1ccb 100644
--- a/src/gui/KikiTextLine.cpp
+++ b/src/gui/KikiTextLine.cpp
@@ -46,7 +46,7 @@ void KikiTextLine::addCharacter ( char c )
void KikiTextLine::setText ( const std::string & str )
{
text = str;
- unsigned int pos;
+ std::string::size_type pos;
if ((pos = text.find ("$scale(")) != std::string::npos)
{
diff --git a/src/main/KikiController.cpp b/src/main/KikiController.cpp
index edc433e..ddafc71 100644
--- a/src/main/KikiController.cpp
+++ b/src/main/KikiController.cpp
@@ -62,10 +62,7 @@ KikiController::KikiController () : KEventHandler (), KKeyHandler (), KikiAction
}
else
{
- KConsole::printf("WARNING :: environment variable KIKI_HOME not set ...");
- KConsole::printf(" ... assuming resources in current directory");
-
- kiki_home = kFileGetCurrentPath();
+ kiki_home = "/usr/share/games/kiki-the-nano-bot";
}
#ifndef WIN32
kiki_home += "/";
diff --git a/src/main/KikiPython.cpp b/src/main/KikiPython.cpp
index 356eeb3..4fbfc2a 100644
--- a/src/main/KikiPython.cpp
+++ b/src/main/KikiPython.cpp
@@ -106,9 +106,9 @@ KikiPython::KikiPython () : KWindow ()
void KikiPython::initPython ()
{
#if defined(__APPLE__) && defined(__MACH__)
- //putenv ("PYTHONDEBUG=1");
- //putenv ("PYTHONVERBOSE=1");
- putenv ("PYTHONPATH=./py:../Frameworks/Python.framework/Versions/A/lib/python2.2");
+ putenv ("PYTHONDEBUG=1");
+ putenv ("PYTHONVERBOSE=1");
+ putenv ("PYTHONPATH=./py"); // :../Frameworks/Python.framework/Versions/A/lib/python2.2");
#elif defined(WIN32)
putenv ("PYTHONDEBUG=1");
putenv ("PYTHONVERBOSE=1");
diff --git a/src/main/KikiPythonWidget.h b/src/main/KikiPythonWidget.h
index db46d01..979ae6e 100644
--- a/src/main/KikiPythonWidget.h
+++ b/src/main/KikiPythonWidget.h
@@ -7,6 +7,7 @@
#define __KikiPythonWidget
#include "KikiPos.h"
+#include "KikiPython.h"
#include <KTextField.h>
class KikiPythonWidget : public KTextField
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 868c1d7..b81f7fa 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -9,6 +9,10 @@
#include <math.h>
#include <SDL.h>
+
+#define K_INCLUDE_GLUT
+#include "KIncludeTools.h"
+
#include "KikiController.h"
// __________________________________________________________________________________________________
@@ -19,6 +23,11 @@ int main (int argc, char * argv[])
int width, height;
SDL_Surface * screen;
+#if defined(__APPLE__) && defined(__MACH__)
+#else
+ glutInit(&argc,argv);
+#endif
+
// initialize SDL
if ( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_VIDEO) < 0 ) // SDL_INIT_TIMER
{
diff --git a/src/sound/KikiSound.cpp b/src/sound/KikiSound.cpp
index 6602599..2b0a25e 100644
--- a/src/sound/KikiSound.cpp
+++ b/src/sound/KikiSound.cpp
@@ -30,39 +30,39 @@ typedef struct _KikiSound
// __________________________________________________________________________________________________
static KikiSoundData KikiSounds[] =
{
- { KikiSound::BOT_MOVE, "bot_move.wav", 0.2 },
- { KikiSound::BOT_JUMP, "bot_jump.wav", 0.7 },
- { KikiSound::BOT_LAND, "bot_land.wav", 0.7 },
- { KikiSound::BOT_SPIKED, "bot_move.wav", 1.0 },
- { KikiSound::BOT_HEALTH_ALERT, "bot_health_alert.wav", 1.0 },
- { KikiSound::BOT_DEATH, "bot_death.wav", 1.0 },
- { KikiSound::BOT_NO_ENERGY, "bot_no_energy.wav", 1.0 },
- { KikiSound::BULLET_SHOT, "bullet_shot.wav", 1.0 },
- { KikiSound::BULLET_HIT_WALL, "bullet_hit_wall.wav", 1.0 },
- { KikiSound::BULLET_HIT_OBJECT, "bullet_hit_object.wav", 1.0 },
- { KikiSound::BULLET_HIT_PLAYER, "bullet_hit_player.wav", 1.0 },
- { KikiSound::BULLET_HIT_MUTANT, "bullet_hit_mutant.wav", 1.0 },
- { KikiSound::STONE_MOVE, "stone_move.wav", 1.0 },
- { KikiSound::STONE_LAND, "stone_land.wav", 1.0 },
- { KikiSound::SWITCH_ON, "switch_on.wav", 1.0 },
- { KikiSound::SWITCH_OFF, "switch_on.wav", 0.5 },
- { KikiSound::ATOM_BIRTH, "atom_digest.wav", 1.0 },
- { KikiSound::ATOM_DIGEST, "atom_digest.wav", 1.0 },
- { KikiSound::SPIKES_START, "bot_move.wav", 1.0 },
- { KikiSound::MENU_FADE, "menu_fade.wav", 1.0 },
- { KikiSound::MENU_ITEM, "menu_item.wav", 1.0 },
- { KikiSound::MENU_SELECT, "menu_select.wav", 1.0 },
- { KikiSound::MENU_ABORT, "menu_abort.wav", 1.0 },
- { KikiSound::GATE_OPEN, "gate_open.wav", 1.0 },
- { KikiSound::GATE_CLOSE, "gate_close.wav", 1.0 },
- { KikiSound::GATE_WARP, "gate_warp.wav", 1.0 },
- { KikiSound::BOMB_EXPLODE, "bomb_explode.wav", 1.0 },
- { KikiSound::BOMB_SPLITTER, "bomb_splitter.wav", 1.0 },
- { KikiSound::GEAR_ON, "gear_on.wav", 1.0 },
- { KikiSound::GEAR_OFF, "gear_off.wav", 1.0 },
- { KikiSound::GENERATOR_ON, "generator_on.wav", 1.0 },
- { KikiSound::GENERATOR_OFF, "generator_off.wav", 1.0 },
- { KikiSound::MOTOR, "bomb_splitter.wav", 1.0 },
+ { KikiSound::BOT_MOVE, "bot_move.ogg", 0.2 },
+ { KikiSound::BOT_JUMP, "bot_jump.ogg", 0.7 },
+ { KikiSound::BOT_LAND, "bot_land.ogg", 0.7 },
+ { KikiSound::BOT_SPIKED, "bot_move.ogg", 1.0 },
+ { KikiSound::BOT_HEALTH_ALERT, "bot_health_alert.ogg", 1.0 },
+ { KikiSound::BOT_DEATH, "bot_death.ogg", 1.0 },
+ { KikiSound::BOT_NO_ENERGY, "bot_no_energy.ogg", 1.0 },
+ { KikiSound::BULLET_SHOT, "bullet_shot.ogg", 1.0 },
+ { KikiSound::BULLET_HIT_WALL, "bullet_hit_wall.ogg", 1.0 },
+ { KikiSound::BULLET_HIT_OBJECT, "bullet_hit_object.ogg", 1.0 },
+ { KikiSound::BULLET_HIT_PLAYER, "bullet_hit_player.ogg", 1.0 },
+ { KikiSound::BULLET_HIT_MUTANT, "bullet_hit_mutant.ogg", 1.0 },
+ { KikiSound::STONE_MOVE, "stone_move.ogg", 1.0 },
+ { KikiSound::STONE_LAND, "stone_land.ogg", 1.0 },
+ { KikiSound::SWITCH_ON, "switch_on.ogg", 1.0 },
+ { KikiSound::SWITCH_OFF, "switch_on.ogg", 0.5 },
+ { KikiSound::ATOM_BIRTH, "atom_digest.ogg", 1.0 },
+ { KikiSound::ATOM_DIGEST, "atom_digest.ogg", 1.0 },
+ { KikiSound::SPIKES_START, "bot_move.ogg", 1.0 },
+ { KikiSound::MENU_FADE, "menu_fade.ogg", 1.0 },
+ { KikiSound::MENU_ITEM, "menu_item.ogg", 1.0 },
+ { KikiSound::MENU_SELECT, "menu_select.ogg", 1.0 },
+ { KikiSound::MENU_ABORT, "menu_abort.ogg", 1.0 },
+ { KikiSound::GATE_OPEN, "gate_open.ogg", 1.0 },
+ { KikiSound::GATE_CLOSE, "gate_close.ogg", 1.0 },
+ { KikiSound::GATE_WARP, "gate_warp.ogg", 1.0 },
+ { KikiSound::BOMB_EXPLODE, "bomb_explode.ogg", 1.0 },
+ { KikiSound::BOMB_SPLITTER, "bomb_splitter.ogg", 1.0 },
+ { KikiSound::GEAR_ON, "gear_on.ogg", 1.0 },
+ { KikiSound::GEAR_OFF, "gear_off.ogg", 1.0 },
+ { KikiSound::GENERATOR_ON, "generator_on.ogg", 1.0 },
+ { KikiSound::GENERATOR_OFF, "generator_off.ogg", 1.0 },
+ { KikiSound::MOTOR, "bomb_splitter.ogg", 1.0 },
};
// __________________________________________________________________________________________________
@@ -88,7 +88,7 @@ KikiSound::KikiSound ()
Mix_Volume (-1, sound_volume); // set the start volume
// title song
-#ifndef _WINDOWS
+/* #ifndef _WINDOWS
std::string song_path = kFileNativePath(Controller.getKikiHome() + "/sound/" + "title_song.mp3");
Mix_Music * music = Mix_LoadMUS(song_path.c_str());
if(!music)
@@ -103,7 +103,7 @@ KikiSound::KikiSound ()
}
}
#endif
-
+ */
int soundIndex = 0;
while (soundIndex < KikiSound::END)
{
diff --git a/src/world/KikiWorld.cpp b/src/world/KikiWorld.cpp
index bf253ae..43eea0f 100644
--- a/src/world/KikiWorld.cpp
+++ b/src/world/KikiWorld.cpp
@@ -287,6 +287,7 @@ void KikiWorld::deleteAllObjects ()
if (Controller.player)
{
+ Controller.player->finishRotateAction();
removeObject (Controller.player); // remove the player first, to keep it's state
Controller.timer_event->removeAllActions ();
Controller.removeKeyHandler (Controller.player); // prevent keyboard input while building world