...
authornemo
Mon, 05 Dec 2011 18:38:07 -0500
changeset 6502 714e1a535864
parent 6500 c9eaf1dd16c8 (diff)
parent 6406 3601b9f6df8c (current diff)
child 6503 854856e698b4
...
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/FrontendDataUtils.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/GameMode.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Grave.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Map.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Scheme.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Team.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Weapon.java
project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/UserInput/TouchInterface.java
--- a/.hgeol	Sat Nov 19 23:34:09 2011 +0100
+++ b/.hgeol	Mon Dec 05 18:38:07 2011 -0500
@@ -6,3 +6,4 @@
 **.txt = native
 **.pas = native
 **.inc = native
+**.hs = native
--- a/.hgignore	Sat Nov 19 23:34:09 2011 +0100
+++ b/.hgignore	Mon Dec 05 18:38:07 2011 -0500
@@ -6,8 +6,10 @@
 glob:Makefile
 glob:bin
 glob:*.hi
+glob:*.ppu
 glob:*.*~
 glob:*.core
+glob:hedgewars.pro.user
 glob:config.inc
 glob:cmake_install.cmake
 glob:QTfrontend/hwconsts.cpp
@@ -36,3 +38,15 @@
 glob:*.orig
 glob:*.bak
 glob:*.rej
+glob:project_files/Android-build/SDL-android-project/jni/**
+glob:project_files/Android-build/SDL-android-project/obj
+glob:project_files/Android-build/SDL-android-project/libs
+glob:project_files/Android-build/SDL-android-project/bin
+glob:project_files/Android-build/SDL-android-project/gen
+glob:project_files/Android-build/SDL-android-project/local.properties
+glob:project_files/Android-build/SDL-android-project/default.properties
+glob:project_files/Android-build/SDL-android-project/.*
+glob:project_files/Android-build/complete_build.sh
+glob:project_files/Android-build/pushToDevice.sh
+glob:project_files/Android-build/Makefile.android
+glob:project_files/Android-build/out
--- a/CMakeLists.txt	Sat Nov 19 23:34:09 2011 +0100
+++ b/CMakeLists.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -42,7 +42,7 @@
 set(CPACK_PACKAGE_VERSION_MAJOR 0)
 set(CPACK_PACKAGE_VERSION_MINOR 9)
 set(CPACK_PACKAGE_VERSION_PATCH 17${version_suffix})
-set(HEDGEWARS_PROTO_VER 41)
+set(HEDGEWARS_PROTO_VER 42)
 set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
 
 
@@ -192,6 +192,11 @@
 add_subdirectory(misc/liblua)
 add_subdirectory(hedgewars)
 
+#run cmake -DBUILD_ANDROID_PORT=1 to enable this
+if(BUILD_ANDROID_PORT)
+	add_subdirectory(project_files/Android-build)
+endif()
+
 if(NOT BUILD_ENGINE_LIBRARY)
 	add_subdirectory(bin)
 	add_subdirectory(misc/quazip)
@@ -264,7 +269,7 @@
 	"CMakeCache\\\\.txt$"
 #	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/libopenalbridge"
 #	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/libfreetype"
-#	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/liblua"
+	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/liblua"
 #	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/libtremor"
 	"^${CMAKE_CURRENT_SOURCE_DIR}/project_files/HedgewarsMobile/"
 	"^${CMAKE_CURRENT_SOURCE_DIR}/bin/[a-z]"
--- a/QTfrontend/CMakeLists.txt	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/CMakeLists.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -1,5 +1,5 @@
 # Configure for Qt4
-set(QT_MIN_VERSION "4.5.0")
+set(QT_MIN_VERSION "4.6.0")
 include(CheckLibraryExists)
 
 set(QT_USE_QTCORE TRUE)
--- a/QTfrontend/M3InstallController.m	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/M3InstallController.m	Mon Dec 05 18:38:07 2011 -0500
@@ -36,7 +36,7 @@
 @implementation M3InstallController
 
 - (id) init {
-	if (self = [super init]) {
+        if ((self = [super init])) {
 		NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
 		NSString *title = [NSString stringWithFormat:NSLocalizedString(@"%@ is currently running from a disk image", @"AppName is currently running from a disk image"), appName];
 		NSString *body = [NSString stringWithFormat:NSLocalizedString(@"Would you like to install %@ in your applications folder before quitting?", @"Would you like to install App Name in your applications folder before quitting?"), appName];
--- a/QTfrontend/NSWorkspace_RBAdditions.m	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/NSWorkspace_RBAdditions.m	Mon Dec 05 18:38:07 2011 -0500
@@ -9,6 +9,7 @@
 #import "NSWorkspace_RBAdditions.h"
 #include <IOKit/IOKitLib.h>
 #include <sys/mount.h>
+#include <mach/mach.h>
 
 NSString* NSWorkspace_RBfstypename = @"NSWorkspace_RBfstypename";
 NSString* NSWorkspace_RBmntonname = @"NSWorkspace_RBmntonname";
@@ -66,14 +67,14 @@
 				partition = [props objectForKey:@"Content"];
 			} else if (IOObjectConformsTo(nextParent,"IODiskImageBlockStorageDeviceOutKernel")) {
 				NSData* data = nil;
-				if (data = [[props objectForKey:@"Protocol Characteristics"] objectForKey:@"Virtual Interface Location Path"]) {
+                                if ((data = [[props objectForKey:@"Protocol Characteristics"] objectForKey:@"Virtual Interface Location Path"])) {
 					image = [[[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding] autorelease];
 				}
 			} else if (IOObjectConformsTo(nextParent,"IOHDIXHDDriveInKernel")) {
 				image = [props objectForKey:@"KDIURLPath"];
 			}
 			NSDictionary* subdict;
-			if (subdict = [props objectForKey:@"Protocol Characteristics"]) {
+                        if ((subdict = [props objectForKey:@"Protocol Characteristics"])) {
 				connection = [subdict objectForKey:@"Physical Interconnect"];
 			} else {
 				connection = [props objectForKey:@"Physical Interconnect"];
@@ -88,21 +89,21 @@
 				[dict setObject:image forKey:NSWorkspace_RBimagefilepath];
 			}
 			NSString* value;
-			if (subdict = [props objectForKey:@"Device Characteristics"]) {
-				if (value = [subdict objectForKey:@"Product Name"]) {
+                        if ((subdict = [props objectForKey:@"Device Characteristics"])) {
+                                if ((value = [subdict objectForKey:@"Product Name"])) {
 					result = AddPart(result,value);
 				}
-				if (value = [subdict objectForKey:@"Product Revision Level"]) {
+                                if ((value = [subdict objectForKey:@"Product Revision Level"])) {
 					result = AddPart(result,value);
 				}
-				if (value = [subdict objectForKey:@"Vendor Name"]) {
+                                if ((value = [subdict objectForKey:@"Vendor Name"])) {
 					result = AddPart(result,value);
 				}
 			}
-			if (value = [props objectForKey:@"USB Serial Number"]) {
+                        if ((value = [props objectForKey:@"USB Serial Number"])) {
 				result = AddPart(result,value);
 			}
-			if (value = [props objectForKey:@"USB Vendor Name"]) {
+                        if ((value = [props objectForKey:@"USB Vendor Name"])) {
 				result = AddPart(result,value);
 			}
 			NSString* cls = [(NSString*)IOObjectCopyClass(nextParent) autorelease];
@@ -124,6 +125,7 @@
 
 // This formats the (partially undocumented) AFPXMountInfo info into a string.
 
+/*
 static NSString* FormatAFPURL(AFPXVolMountInfoPtr mountInfo,NSString** devdesc) {
 	UInt8* work = ((UInt8*)mountInfo)+mountInfo->serverNameOffset;
 	if (devdesc) {
@@ -162,6 +164,7 @@
 	}
 	return [NSString stringWithFormat:@"afp://%@/%@",dns?:(ip?:@""),volname];
 }
+*/
 
 @implementation NSWorkspace (NSWorkspace_RBAdditions)
 
--- a/QTfrontend/hwconsts.h	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/hwconsts.h	Mon Dec 05 18:38:07 2011 -0500
@@ -61,19 +61,19 @@
 #define HEDGEHOGS_PER_TEAM           8
 
 #define AMMOLINE_DEFAULT_QT     "939192942219912103223511100120100000021111010101111101"
-#define AMMOLINE_DEFAULT_PROB   "040504054160065554655446477657666666615551010111541101"
+#define AMMOLINE_DEFAULT_PROB   "040504054160065554655446477657666666615551010111541111"
 #define AMMOLINE_DEFAULT_DELAY  "000000000000020550000004000700400000000022000000060000"
-#define AMMOLINE_DEFAULT_CRATE  "131111031211111112311411111111111111121111110111111101"
+#define AMMOLINE_DEFAULT_CRATE  "131111031211111112311411111111111111121111110111111111"
 
-#define AMMOLINE_CRAZY_QT       "999999999999999999299999999999999929999999990999999209"
-#define AMMOLINE_CRAZY_PROB     "111111011111111111111111111111111111111111110111111101"
+#define AMMOLINE_CRAZY_QT       "999999999999999999299999999999999929999999990999999229"
+#define AMMOLINE_CRAZY_PROB     "111111011111111111111111111111111111111111110111111111"
 #define AMMOLINE_CRAZY_DELAY    "000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CRAZY_CRATE    "131111031211111112311411111111111111121111010111111101"
+#define AMMOLINE_CRAZY_CRATE    "131111031211111112311411111111111111121111010111111111"
 
 #define AMMOLINE_PROMODE_QT     "909000900000000000000900000000000000000000000000000000"
 #define AMMOLINE_PROMODE_PROB   "000000000000000000000000000000000000000000000000000000"
 #define AMMOLINE_PROMODE_DELAY  "000000000000020550000004000700400000000020000000000000"
-#define AMMOLINE_PROMODE_CRATE  "111111111111111111111111111111111111111110010111111101"
+#define AMMOLINE_PROMODE_CRATE  "111111111111111111111111111111111111111110010111111111"
 
 #define AMMOLINE_SHOPPA_QT      "000000990000000000000000000000000000000000000000000000"
 #define AMMOLINE_SHOPPA_PROB    "444441004424440221011212122242200000000200040001001100"
@@ -81,19 +81,19 @@
 #define AMMOLINE_SHOPPA_CRATE   "111111111111111111111111111111111111111110110111111100"
 
 #define AMMOLINE_CLEAN_QT       "101000900001000001100000000000000000000000000000100000"
-#define AMMOLINE_CLEAN_PROB     "040504054160065554655446477657666666615551010111541101"
+#define AMMOLINE_CLEAN_PROB     "040504054160065554655446477657666666615551010111541111"
 #define AMMOLINE_CLEAN_DELAY    "000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CLEAN_CRATE    "131111031211111112311411111111111111121111110111111101"
+#define AMMOLINE_CLEAN_CRATE    "131111031211111112311411111111111111121111110111111111"
 
 #define AMMOLINE_MINES_QT       "000000990009000000030000000000000000000000000000000000"
 #define AMMOLINE_MINES_PROB     "000000000000000000000000000000000000000000000000000000"
 #define AMMOLINE_MINES_DELAY    "000000000000020550000004000700400000000020000000060000"
-#define AMMOLINE_MINES_CRATE    "111111111111111111111111111111111111111111110111111101"
+#define AMMOLINE_MINES_CRATE    "111111111111111111111111111111111111111111110111111111"
 
 #define AMMOLINE_PORTALS_QT     "900000900200000000210000000000000011000009000000000000"
-#define AMMOLINE_PORTALS_PROB   "040504054160065554655446477657666666615551010111541101"
+#define AMMOLINE_PORTALS_PROB   "040504054160065554655446477657666666615551010111541111"
 #define AMMOLINE_PORTALS_DELAY  "000000000000020550000004000700400000000020000000060000"
-#define AMMOLINE_PORTALS_CRATE  "131111031211111112311411111111111111121111110111111101"
+#define AMMOLINE_PORTALS_CRATE  "131111031211111112311411111111111111121111110111111111"
 
 
 #define NETGAME_DEFAULT_PORT 46631
--- a/QTfrontend/hwform.cpp	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/hwform.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -40,6 +40,9 @@
 #include <QShortcut>
 #include <QDesktopServices>
 #include <QInputDialog>
+#include <QPropertyAnimation>
+#include <QGraphicsEffect>
+#include <QParallelAnimationGroup>
 
 #include "hwform.h"
 #include "game.h"
@@ -79,6 +82,7 @@
 #include "bgwidget.h"
 #include "xfire.h"
 #include "drawmapwidget.h"
+#include "mouseoverfilter.h"
 
 #include "HWDataManager.h"
 
@@ -279,6 +283,23 @@
        wBackground->startAnimation();
     }
 
+    //Install all eventFilters :
+
+    MouseOverFilter *filter = new MouseOverFilter();
+    filter->setUi(&ui);
+
+    QList<QWidget *> widgets;
+
+    for (int i=0; i < ui.Pages->count(); i++)
+    {
+        widgets = ui.Pages->widget(i)->findChildren<QWidget *>();
+
+        for (int i=0; i < widgets.size(); i++)
+        {
+            widgets.at(i)->installEventFilter(filter);
+        }
+    }
+
     PagesStack.push(ID_PAGE_MAIN);
     GoBack();
 }
@@ -544,32 +565,113 @@
 
 void HWForm::GoToPage(int id)
 {
+    bool stopAnim = false;
+
     int lastid = ui.Pages->currentIndex();
     PagesStack.push(ui.Pages->currentIndex());
+
     OnPageShown(id, lastid);
     ui.Pages->setCurrentIndex(id);
+
+    if (id == ID_PAGE_DRAWMAP)
+        stopAnim = true;
+
+    if (frontendEffects && !stopAnim)
+    {
+        /**Start animation :**/
+        int coeff = 1;
+#ifndef Q_OS_MAC
+        coeff = 2;
+        QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id));
+        ui.Pages->widget(id)->setGraphicsEffect(effectNew);
+
+        QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(lastid));
+        ui.Pages->widget(lastid)->setGraphicsEffect(effectLast);
+#endif
+
+        //New page animation
+        animationNewSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
+        animationNewSlide->setDuration(500);
+        animationNewSlide->setStartValue(QPoint(width()/coeff, 0));
+        animationNewSlide->setEndValue(QPoint(0, 0));
+        animationNewSlide->setEasingCurve(QEasingCurve::OutExpo);
+
+#ifndef Q_OS_MAC
+        animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
+        animationNewOpacity->setDuration(500);
+        animationNewOpacity->setStartValue(0.01);
+        animationNewOpacity->setEndValue(1);
+        animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
+#endif
+
+        //Last page animation
+        ui.Pages->widget(lastid)->setHidden(false);
+
+        animationOldSlide = new QPropertyAnimation(ui.Pages->widget(lastid), "pos");
+        animationOldSlide->setDuration(500);
+        animationOldSlide->setStartValue(QPoint(0, 0));
+        animationOldSlide->setEndValue(QPoint(-width()/coeff, 0));
+        animationOldSlide->setEasingCurve(QEasingCurve::OutExpo);
+
+#ifndef Q_OS_MAC
+        animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
+        animationOldOpacity->setDuration(500);
+        animationOldOpacity->setStartValue(1);
+        animationOldOpacity->setEndValue(0.01);
+        animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
+#endif
+
+        QParallelAnimationGroup *group = new QParallelAnimationGroup;
+        group->addAnimation(animationOldSlide);
+        group->addAnimation(animationNewSlide);
+#ifndef Q_OS_MAC
+        group->addAnimation(animationOldOpacity);
+        group->addAnimation(animationNewOpacity);
+#endif
+        group->start();
+
+        connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
+    }
 }
 
 void HWForm::GoBack()
 {
+    bool stopAnim = false;
     int curid = ui.Pages->currentIndex();
     if (curid == ID_PAGE_MAIN)
+    {
+        stopAnim = true;
         exit();
+    }
 
     int id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
     ui.Pages->setCurrentIndex(id);
     OnPageShown(id, curid);
 
     if (id == ID_PAGE_CONNECTING)
+    {
+        stopAnim = true;
         GoBack();
+    }
     if (id == ID_PAGE_NETSERVER)
+    {
+        stopAnim = true;
         GoBack();
+    }
     if ((!hwnet) && (id == ID_PAGE_ROOMSLIST))
+    {
+        stopAnim = true;
         GoBack();
+    }
+    if (curid == ID_PAGE_DRAWMAP)
+        stopAnim = true;
 
     if ((!hwnet) || (!hwnet->isInRoom()))
         if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME)
+        {
+            stopAnim = true;
             GoBack();
+        }
 
     if (curid == ID_PAGE_ROOMSLIST || curid == ID_PAGE_CONNECTING) NetDisconnect();
     if (curid == ID_PAGE_NETGAME && hwnet && hwnet->isInRoom()) hwnet->partRoom();
@@ -578,6 +680,66 @@
 
     if (curid == ID_PAGE_SCHEME)
         ammoSchemeModel->Save();
+
+    /**Start animation :**/
+
+    if (curid != 0 && frontendEffects && !stopAnim)
+    {
+        int coeff = 1;
+#ifndef Q_OS_MAC
+        coeff = 2;
+        QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id));
+        effectNew->setOpacity(1);
+        ui.Pages->widget(id)->setGraphicsEffect(effectNew);
+
+        QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(curid));
+        ui.Pages->widget(curid)->setGraphicsEffect(effectLast);
+#endif
+
+        //Last page animation
+        animationOldSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
+        animationOldSlide->setDuration(500);
+        animationOldSlide->setStartValue(QPoint(-width()/coeff, 0));
+        animationOldSlide->setEndValue(QPoint(0, 0));
+        animationOldSlide->setEasingCurve(QEasingCurve::OutExpo);
+
+#ifndef Q_OS_MAC
+        animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
+        animationOldOpacity->setDuration(500);
+        animationOldOpacity->setStartValue(1);
+        animationOldOpacity->setEndValue(0.01);
+        animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
+#endif
+        //New page animation
+        ui.Pages->widget(curid)->setHidden(false);
+
+        animationNewSlide = new QPropertyAnimation(ui.Pages->widget(curid), "pos");
+        animationNewSlide->setDuration(500);
+        animationNewSlide->setStartValue(QPoint(0, 0));
+        animationNewSlide->setEndValue(QPoint(width()/coeff, 0));
+        animationNewSlide->setEasingCurve(QEasingCurve::OutExpo);
+
+#ifndef Q_OS_MAC
+        animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
+        animationNewOpacity->setDuration(500);
+        animationNewOpacity->setStartValue(0.01);
+        animationNewOpacity->setEndValue(1);
+        animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
+#endif
+
+        QParallelAnimationGroup *group = new QParallelAnimationGroup;
+        group->addAnimation(animationOldSlide);
+        group->addAnimation(animationNewSlide);
+#ifndef Q_OS_MAC
+        group->addAnimation(animationOldOpacity);
+        group->addAnimation(animationNewOpacity);
+#endif
+        group->start();
+
+        connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
+    }
+
+
 }
 
 void HWForm::OpenSnapshotFolder()
--- a/QTfrontend/hwform.h	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/hwform.h	Mon Dec 05 18:38:07 2011 -0500
@@ -23,6 +23,7 @@
 #include <QStack>
 #include <QTime>
 #include <QPointer>
+#include <QPropertyAnimation>
 
 #include "netserver.h"
 #include "game.h"
@@ -60,6 +61,8 @@
     void updateXfire();
     void PlayDemoQuick(const QString & demofilename);
     void exit();
+    void setButtonDescription(QString desc);
+    void backDescription();
 
 private slots:
     void GoToSaves();
@@ -170,6 +173,11 @@
     QSignalMapper * pageSwitchMapper;
     QByteArray m_lastDemo;
 
+    QPropertyAnimation *animationNewSlide;
+    QPropertyAnimation *animationOldSlide;
+    QPropertyAnimation *animationNewOpacity;
+    QPropertyAnimation *animationOldOpacity;
+
 #ifdef __APPLE__
     InstallController * panel;
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/ui/mouseoverfilter.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,48 @@
+#include "mouseoverfilter.h"
+#include "ui/page/AbstractPage.h"
+#include "ui_hwform.h"
+
+#include <QEvent>
+#include <QWidget>
+#include <QStackedLayout>
+#include <QLabel>
+
+MouseOverFilter::MouseOverFilter(QObject *parent) :
+    QObject(parent)
+{
+}
+
+bool MouseOverFilter::eventFilter( QObject *dist, QEvent *event )
+{
+    if (event->type() == QEvent::Enter)
+    {
+        QWidget * widget = dynamic_cast<QWidget*>(dist);
+
+        abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget());
+
+        if (widget->whatsThis() != NULL)
+            abstractpage->setButtonDescription(widget->whatsThis());
+        else if (widget->toolTip() != NULL)
+            abstractpage->setButtonDescription(widget->toolTip());
+
+        return true;
+    }
+    else if (event->type() == QEvent::Leave)
+    {
+        abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget());
+
+        if (abstractpage->getDefautDescription() != NULL)
+        {
+            abstractpage->setButtonDescription( * abstractpage->getDefautDescription());
+        }
+        else
+            abstractpage->setButtonDescription("");
+    }
+
+    return false;
+}
+
+void MouseOverFilter::setUi(Ui_HWForm *uiForm)
+{
+    ui = uiForm;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/ui/mouseoverfilter.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,27 @@
+#ifndef MOUSEOVERFILTER_H
+#define MOUSEOVERFILTER_H
+
+#include <QObject>
+
+#include "ui_hwform.h"
+#include "ui/page/AbstractPage.h"
+
+class MouseOverFilter : public QObject
+{
+    Q_OBJECT
+public:
+    explicit MouseOverFilter(QObject *parent = 0);
+    void setUi(Ui_HWForm *uiForm);
+protected:
+    bool eventFilter( QObject *dist, QEvent *event );
+signals:
+
+public slots:
+
+private:
+    Ui_HWForm *ui;
+    AbstractPage* abstractpage;
+
+};
+
+#endif // MOUSEOVERFILTER_H
--- a/QTfrontend/ui/page/AbstractPage.cpp	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/ui/page/AbstractPage.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -22,10 +22,14 @@
  */
 
 #include "AbstractPage.h"
+#include <QLabel>
+#include <QSize>
+#include <QFontMetricsF>
 
 AbstractPage::AbstractPage(QWidget* parent)
 {
     Q_UNUSED(parent);
+    defautDesc = new QString();
 
     font14 = new QFont("MS Shell Dlg", 14);
 }
@@ -45,12 +49,20 @@
     pageLayout->addWidget(btnBack, 1, 0, 1, 1, Qt::AlignLeft | Qt::AlignBottom);
 
     // add body layout as defined by the subclass
-    pageLayout->addLayout(bodyLayoutDefinition(), 0, 0, 1, 2);
+    pageLayout->addLayout(bodyLayoutDefinition(), 0, 0, 1, 3);
+
+    descLabel = new QLabel();
+    descLabel->setAlignment(Qt::AlignCenter);
+    descLabel->setWordWrap(true);
+    descLabel->setOpenExternalLinks(true);
+    descLabel->setFixedHeight(50);
+    descLabel->setStyleSheet("font-size: 16px");
+    pageLayout->addWidget(descLabel, 1, 1);
 
     // add footer layout
     QLayout * fld = footerLayoutDefinition();
     if (fld != NULL)
-        pageLayout->addLayout(fld, 1, 1);
+        pageLayout->addLayout(fld, 1, 2);
 
     // connect signals
     connect(btnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
@@ -97,3 +109,19 @@
 {
     btnBack->setVisible(visible);
 }
+
+void AbstractPage::setButtonDescription(QString desc)
+{
+    descLabel->setText(desc);
+}
+
+void AbstractPage::setDefautDescription(QString text)
+{
+    *defautDesc = text;
+    descLabel->setText(text);
+}
+
+QString * AbstractPage::getDefautDescription()
+{
+    return defautDesc;
+}
--- a/QTfrontend/ui/page/AbstractPage.h	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/ui/page/AbstractPage.h	Mon Dec 05 18:38:07 2011 -0500
@@ -56,6 +56,27 @@
 {
     Q_OBJECT
 
+    public:
+
+        /**
+        * @brief Changes the desc text (should not be called manualy)
+        *
+        * @param desc the description of the widget focused
+        */
+        void setButtonDescription(QString desc);
+
+        /**
+        * @brief Changes the desc defaut text
+        *
+        * @param text the defaut desc
+        */
+        void setDefautDescription(QString text);
+
+        /**
+        * @brief Get the desc defaut text
+        */
+        QString * getDefautDescription();
+
     signals:
         /**
          * @brief This signal is emitted when going back to the previous is
@@ -153,6 +174,9 @@
 
         QFont * font14; ///< used font
 
+        QLabel * descLabel; ///< text description
+        QString * defautDesc;
+
     private:
 
         QPushButton * btnBack; ///< back button
--- a/QTfrontend/ui/page/pagemain.cpp	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/ui/page/pagemain.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -42,19 +42,25 @@
     pageLayout->setRowStretch(4, 1);
 
     BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true);
-    BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)"));
+    BtnSinglePlayer->setToolTip(tr("Local Game"));
+    BtnSinglePlayer->setWhatsThis(tr("Play a game on a single computer"));
     pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter);
 
     BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true);
-    BtnNet->setToolTip(tr("Network Game (Play a game across a network)"));
+    BtnNet->setToolTip(tr("Network Game"));
+    BtnNet->setWhatsThis(tr("Play a game across a network"));
     pageLayout->setAlignment(BtnNet, Qt::AlignHCenter);
 
     // button order matters for overlapping (what's on top and what isn't)
     BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true);
     BtnInfo->setStyleSheet("border: transparent;background: transparent;");
+    //BtnInfo->setToolTip(tr("Credits")); //tooltip looks horrible with transparent background buttons
+    BtnInfo->setWhatsThis(tr("Read about who is behind the Hedgewars Project"));
     pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter);
 
     BtnDataDownload = addButton(tr("Downloadable Content"), pageLayout, 4, 0, 1, 4, false);
+    //BtnDataDownload->setToolTip(tr(Downloadable Content"));
+    BtnDataDownload->setWhatsThis(tr("Access the user created content downloadable from our website"));
     pageLayout->setAlignment(BtnDataDownload, Qt::AlignHCenter);
 
     return pageLayout;
@@ -91,10 +97,12 @@
 
     if(!isDevBuild)
     {
-        mainNote->setText(QLabel::tr("Tip: ") + randomTip());
+        setDefautDescription(QLabel::tr("Tip: ") + randomTip());
     }
     else
-        mainNote->setText(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!"));
+    {
+        setDefautDescription(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!"));
+    }
 
 }
 
--- a/QTfrontend/ui/widget/SquareLabel.cpp	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/ui/widget/SquareLabel.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -24,7 +24,7 @@
 SquareLabel::SquareLabel(QWidget * parent) :
     QWidget(parent)
 {
-    if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true);
+    //if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true);
 }
 
 void SquareLabel::paintEvent(QPaintEvent * event)
--- a/QTfrontend/ui/widget/chatwidget.cpp	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -245,6 +245,9 @@
 {
     this->gameSettings = gameSettings;
     this->notify = notify;
+
+    m_isAdmin = false;
+
     if(gameSettings->value("frontend/sound", true).toBool())
     {
         if (notify)
@@ -710,10 +713,7 @@
 {
     QListWidgetItem * curritem = chatNicks->currentItem();
     if (curritem)
-    {
-        displayNotice(tr("Kicking %1 ...").arg(Qt::escape(curritem->text())));
         emit kick(curritem->text());
-    }
 }
 
 void HWChatWidget::onBan()
@@ -832,6 +832,11 @@
     else
         nick = m_clickedNick;
 
+    // don't display all actions for own nick
+    bool isSelf = (nick == m_userNick);
+
+    acFollow->setVisible(!isSelf);
+
     // update context menu labels according to possible action
     if(ignoreList.contains(nick, Qt::CaseInsensitive))
     {
@@ -842,6 +847,7 @@
     {
         acIgnore->setText(QAction::tr("Ignore"));
         acIgnore->setIcon(QIcon(":/res/ignore.png"));
+        acIgnore->setVisible(!isSelf);
     }
 
     if(friendsList.contains(nick, Qt::CaseInsensitive))
@@ -853,6 +859,13 @@
     {
         acFriend->setText(QAction::tr("Add friend"));
         acFriend->setIcon(QIcon(":/res/addfriend.png"));
+        acFriend->setVisible(!isSelf);
+    }
+
+    if (m_isAdmin)
+    {
+        acKick->setVisible(!isSelf);
+        acBan->setVisible(!isSelf);
     }
 }
 
@@ -882,6 +895,8 @@
     chatNicks->removeAction(acKick);
     chatNicks->removeAction(acBan);
 
+    m_isAdmin = b;
+
     if(b)
     {
         chatNicks->insertAction(0, acKick);
--- a/QTfrontend/ui/widget/chatwidget.h	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/ui/widget/chatwidget.h	Mon Dec 05 18:38:07 2011 -0500
@@ -123,6 +123,7 @@
   void nickCountUpdate(int cnt);
 
  private:
+  bool m_isAdmin;
   QGridLayout mainLayout;
   QTextBrowser* chatText;
   QStringList chatStrings;
--- a/QTfrontend/ui/widget/itemNum.cpp	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/ui/widget/itemNum.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -27,7 +27,7 @@
   numItems(min+2 >= max ? min : min+2)
 {
     enabled = true;
-    if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true);
+    //if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true);
 }
 
 ItemNum::~ItemNum()
--- a/QTfrontend/ui/widget/selectWeapon.cpp	Sat Nov 19 23:34:09 2011 +0100
+++ b/QTfrontend/ui/widget/selectWeapon.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -129,7 +129,6 @@
     int i = 0, k = 0;
     for(; i < m_numItems; ++i) {
         if (i == 6) continue;
-        if (i == 52) continue; // Disable structures for now
         if (k % 4 == 0) ++j;
         SelWeaponItem * swi = new SelWeaponItem(true, i, currentState[i].digitValue(), QImage(":/res/ammopic.png"), QImage(":/res/ammopicgrey.png"), this);
         weaponItems[i].append(swi);
@@ -255,7 +254,7 @@
     if(wconf->contains(newName)) {
         //name already used -> look for an appropriate name:
         int i=2;
-        while(wconf->contains(newName = tr("new")+QString::number(i++)));
+        while(wconf->contains(newName = tr("new")+QString::number(i++))) ;
     }
     setWeaponsName(newName);
 }
@@ -286,7 +285,7 @@
         if(wconf->contains(newName)) {
             //name already used -> look for an appropriate name:
             int i=2;
-            while(wconf->contains(newName = tr("copy of") + " " + curWeaponsName+QString::number(i++)));
+            while(wconf->contains(newName = tr("copy of") + " " + curWeaponsName+QString::number(i++))) ;
         }
         setWeaponsName(newName);
         setWeapons(ammo);
--- a/gameServer/CoreTypes.hs	Sat Nov 19 23:34:09 2011 +0100
+++ b/gameServer/CoreTypes.hs	Mon Dec 05 18:38:07 2011 -0500
@@ -79,7 +79,6 @@
     GameInfo
         Data.Sequence.empty
         []
-        []
 
 data RoomInfo =
     RoomInfo
--- a/gameServer/HWProtoInRoomState.hs	Sat Nov 19 23:34:09 2011 +0100
+++ b/gameServer/HWProtoInRoomState.hs	Mon Dec 05 18:38:07 2011 -0500
@@ -179,7 +179,7 @@
             return [
                 ModifyRoom
                     (\r -> r{
-                        gameInfo = Just $ newGameInfo allPlayersRegistered (mapParams rm) (params rm)
+                        gameInfo = Just $ newGameInfo (teams rm) allPlayersRegistered (mapParams rm) (params rm)
                         }
                     ),
                 AnswerClients chans ["RUN_GAME"]
--- a/hedgewars/ArgParsers.inc	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/ArgParsers.inc	Mon Dec 05 18:38:07 2011 -0500
@@ -159,7 +159,7 @@
     recordFileName:= ParamStr(3);
     paramIndex:= 4;
     wrongParameter:= false;
-    while (paramIndex <= ParamCount) and not wrongParameter do
+    while (paramIndex <= ParamCount) and (not wrongParameter) do
         begin
         if ParamStr(paramIndex) = '--set-video'  then
 //--set-video [screen width] [screen height] [color dept]
--- a/hedgewars/CMakeLists.txt	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/CMakeLists.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -36,8 +36,10 @@
     uIO.pas
     uKeys.pas
     uLand.pas
+    uLandGenMaze.pas
     uLandGraphics.pas
     uLandObjects.pas
+    uLandOutline.pas
     uLandPainted.pas
     uLandTemplates.pas
     uLandTexture.pas
@@ -184,8 +186,8 @@
 
 add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}")
 IF(NOT APPLE)
-add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
-add_dependencies(${engine_output_name} ENGINECLEAN)
+    add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
+    add_dependencies(${engine_output_name} ENGINECLEAN)
 ENDIF()
 
 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
--- a/hedgewars/GSHandlers.inc	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/GSHandlers.inc	Mon Dec 05 18:38:07 2011 -0500
@@ -84,7 +84,7 @@
         if (gi^.Kind = gtHedgehog) then
             begin
             d := r - hwRound(Distance(gi^.X - x, gi^.Y - y));
-            if (d > 1) and not gi^.Invulnerable and (GetRandom(2) = 0) then
+            if (d > 1) and (not gi^.Invulnerable) and (GetRandom(2) = 0) then
                 begin
                 if (CurrentHedgehog^.Gear = gi) then
                     PlaySound(sndOops, gi^.Hedgehog^.Team^.voicepack)
@@ -114,8 +114,8 @@
     begin
     Z := cHHZ;
     Active := false;
-    State:= State and not (gstHHDriven or gstAttacking or gstAttacked);
-    Message := Message and not gmAttack;
+    State:= State and (not (gstHHDriven or gstAttacking or gstAttacked));
+    Message := Message and (not gmAttack);
     end;
 HH^.GearHidden:= HH^.Gear;
 HH^.Gear:= nil
@@ -126,102 +126,18 @@
 HH^.Gear:=HH^.GearHidden;
 HH^.GearHidden:= nil;
 InsertGearToList(HH^.Gear);
-HH^.Gear^.State:= (HH^.Gear^.State and not (gstHHDriven or gstInvisible or gstAttacking)) or gstAttacked;
+HH^.Gear^.State:= (HH^.Gear^.State and (not (gstHHDriven or gstInvisible or gstAttacking))) or gstAttacked;
 AddGearCI(HH^.Gear);
 HH^.Gear^.Active:= true;
 ScriptCall('onHogRestore', HH^.Gear^.Uid)
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
-procedure doStepDrowningGear(Gear: PGear);
-forward;
-
-function CheckGearDrowning(Gear: PGear): boolean;
-var 
-    skipSpeed, skipAngle, skipDecay: hwFloat;
-    i, maxDrops, X, Y: LongInt;
-    vdX, vdY: real;
-    particle: PVisualGear;
-    isSubmersible: boolean;
-begin
-    isSubmersible:= (Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack);
-    // probably needs tweaking. might need to be in a case statement based upon gear type
-    Y:= hwRound(Gear^.Y);
-    if cWaterLine < Y + Gear^.Radius then
-        begin
-        skipSpeed := _0_25;
-        skipAngle := _1_9;
-        skipDecay := _0_87;
-        X:= hwRound(Gear^.X);
-        vdX:= hwFloat2Float(Gear^.dX);
-        vdY:= hwFloat2Float(Gear^.dY);
-        // this could perhaps be a tiny bit higher.
-        if  (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and
-           (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then
-            begin
-            Gear^.dY.isNegative := true;
-            Gear^.dY := Gear^.dY * skipDecay;
-            Gear^.dX := Gear^.dX * skipDecay;
-            CheckGearDrowning := false;
-            PlaySound(sndSkip)
-            end
-        else
-            begin
-            if not isSubmersible then
-                begin
-                CheckGearDrowning := true;
-                Gear^.State := gstDrowning;
-                Gear^.RenderTimer := false;
-                if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and 
-                   (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then
-                    if Gear^.Kind = gtHedgehog then
-                        begin
-                        if Gear^.Hedgehog^.Effects[heResurrectable] then
-                            ResurrectHedgehog(Gear)
-                        else
-                            begin
-                            Gear^.doStep := @doStepDrowningGear;
-                            Gear^.State := Gear^.State and (not gstHHDriven);
-                            AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
-                            end
-                        end
-                    else Gear^.doStep := @doStepDrowningGear;
-                    if Gear^.Kind = gtFlake then exit // skip splashes 
-                end;
-            if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or
-               (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then
-                // don't play splash if they are already way past the surface
-                PlaySound(sndSplash)
-            end;
-
-        if ((cReducedQuality and rqPlainSplash) = 0) and 
-           (((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or
-             (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01)))) then
-            begin
-            AddVisualGear(X, cWaterLine, vgtSplash);
-
-            maxDrops := (Gear^.Radius div 2) + round(vdX * Gear^.Radius * 2) + round(vdY * Gear^.Radius * 2);
-            for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do
-                begin
-                particle := AddVisualGear(X - 3 + Random(6), cWaterLine, vgtDroplet);
-                if particle <> nil then
-                    begin
-                    particle^.dX := particle^.dX - vdX / 10;
-                    particle^.dY := particle^.dY - vdY / 5;
-                    end
-                end
-            end;
-        if isSubmersible and (CurAmmoGear^.Pos = 0) then CurAmmoGear^.Pos := 1000
-        end
-    else
-        CheckGearDrowning := false;
-end;
-
 procedure CheckCollision(Gear: PGear); inline;
 begin
     if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) or (TestCollisionYwithGear(Gear, hwSign(Gear^.dY)) <> 0) then
         Gear^.State := Gear^.State or gstCollision
-    else Gear^.State := Gear^.State and not gstCollision
+    else Gear^.State := Gear^.State and (not gstCollision)
 end;
 
 procedure CheckCollisionWithLand(Gear: PGear); inline;
@@ -229,55 +145,12 @@
     if TestCollisionX(Gear, hwSign(Gear^.dX)) or TestCollisionY(Gear, hwSign(Gear^.dY)
        )
         then Gear^.State := Gear^.State or      gstCollision
-    else Gear^.State := Gear^.State and not gstCollision
+    else Gear^.State := Gear^.State and (not gstCollision)
 end;
 
-procedure CheckHHDamage(Gear: PGear);
-var 
-    dmg: Longword;
-    i: LongInt;
-    particle: PVisualGear;
-begin
-    if _0_4 < Gear^.dY then
-        begin
-        dmg := ModifyDamage(1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70), Gear);
-        PlaySound(sndBump);
-        if dmg < 1 then exit;
-
-        for i:= min(12, (3 + dmg div 10)) downto 0 do
-            begin
-            particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
-            if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480);
-            end;
-
-        if (Gear^.Invulnerable) then exit;
-
-        //if _0_6 < Gear^.dY then
-        //    PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack)
-        //else
-        //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
-
-        if Gear^.LastDamage <> nil then
-            ApplyDamage(Gear, Gear^.LastDamage, dmg, dsFall)
-            else
-            ApplyDamage(Gear, CurrentHedgehog, dmg, dsFall);
-    end
-end;
 
 ////////////////////////////////////////////////////////////////////////////////
-procedure CalcRotationDirAngle(Gear: PGear);
-var 
-    dAngle: real;
-begin
-    dAngle := (Gear^.dX.QWordValue + Gear^.dY.QWordValue) / $80000000;
-    if not Gear^.dX.isNegative then
-        Gear^.DirAngle := Gear^.DirAngle + dAngle
-    else
-        Gear^.DirAngle := Gear^.DirAngle - dAngle;
-
-    if Gear^.DirAngle < 0 then Gear^.DirAngle := Gear^.DirAngle + 360
-    else if 360 < Gear^.DirAngle then Gear^.DirAngle := Gear^.DirAngle - 360
-end;
+
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepDrowningGear(Gear: PGear);
@@ -307,7 +180,7 @@
     // clip velocity at 1.9 - over 1 per pixel, but really shouldn't cause many actual problems.
     if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862;
     if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862;
-    Gear^.State := Gear^.State and not gstCollision;
+    Gear^.State := Gear^.State and (not gstCollision);
     collV := 0;
     collH := 0;
     tdX := Gear^.dX;
@@ -324,7 +197,7 @@
         if land <> 0 then
             begin
             collV := -1;
-            if land and lfIce <> 0 then Gear^.dX := Gear^.dX * (_1 - (_1 - Gear^.Friction) / _10)
+            if land and lfIce <> 0 then Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1)
             else Gear^.dX := Gear^.dX * Gear^.Friction;
 
             Gear^.dY := - Gear^.dY * Gear^.Elasticity;
@@ -333,14 +206,16 @@
         else if (Gear^.AdvBounce=1) and (TestCollisionYwithGear(Gear, 1) <> 0) then collV := 1;
         end
     else 
-        begin
+        begin // Gear^.dY.isNegative is false
         land:= TestCollisionYwithGear(Gear, 1);
         if land <> 0 then
             begin
             collV := 1;
             isFalling := false;
-            if land and lfIce <> 0 then Gear^.dX := Gear^.dX * (_1 - (_1 - Gear^.Friction) / _10)
-            else Gear^.dX := Gear^.dX * Gear^.Friction;
+            if land and lfIce <> 0 then 
+                Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1)
+            else 
+                Gear^.dX := Gear^.dX * Gear^.Friction;
 
             Gear^.dY := - Gear^.dY * Gear^.Elasticity;
             Gear^.State := Gear^.State or gstCollision
@@ -348,7 +223,7 @@
         else
             begin
             isFalling := true;
-            if (Gear^.AdvBounce=1) and not Gear^.dY.isNegative and (TestCollisionYwithGear(Gear, -1) <> 0) then
+            if (Gear^.AdvBounce=1) and (TestCollisionYwithGear(Gear, -1) <> 0) then
                 collV := -1
             end
         end;
@@ -388,9 +263,8 @@
     if Gear^.Kind <> gtBee then
         CheckGearDrowning(Gear);
     //if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and
-    if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) and
-       (not isFalling) then
-        Gear^.State := Gear^.State and not gstMoving
+    if (not isFalling) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) then
+        Gear^.State := Gear^.State and (not gstMoving)
     else
         Gear^.State := Gear^.State or      gstMoving;
 
@@ -503,29 +377,29 @@
         end;
     DeleteGear(Gear);
     exit
-end;
-
-CalcRotationDirAngle(Gear);
-
-if Gear^.Kind = gtHellishBomb then
-begin
-
-    if Gear^.Timer = 3000 then
+    end;
+
+    CalcRotationDirAngle(Gear);
+
+    if Gear^.Kind = gtHellishBomb then
     begin
-        Gear^.nImpactSounds := 0;
-        PlaySound(sndHellish);
+
+        if Gear^.Timer = 3000 then
+        begin
+            Gear^.nImpactSounds := 0;
+            PlaySound(sndHellish);
+        end;
+
+        if (GameTicks and $3F) = 0 then
+            if (Gear^.State and gstCollision) = 0 then
+                AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace);
     end;
-
-    if (GameTicks and $3F) = 0 then
-        if (Gear^.State and gstCollision) = 0 then
-            AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace);
-end;
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepMolotov(Gear: PGear);
 var 
-	s: Longword;
+    s: Longword;
     i, gX, gY: LongInt;
     dX, dY: hwFloat;
     smoke, glass: PVisualGear;
@@ -655,7 +529,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepSnowflake(Gear: PGear);
-var xx, yy, px, py: LongInt;
+var xx, yy, px, py, rx, ry, lx, ly: LongInt;
     move, draw, allpx, gun: Boolean;
     s: PSDL_Surface;
     p: PLongwordArray;
@@ -667,7 +541,7 @@
 draw:= false;
 if gun then
     begin
-    Gear^.State:= Gear^.State and not gstInvisible;
+    Gear^.State:= Gear^.State and (not gstInvisible);
     doStepFallingGear(Gear);
     CheckCollision(Gear);
     if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then draw:= true;
@@ -678,7 +552,7 @@
     begin
     with Gear^ do
         begin
-        State:= State and not gstInvisible;
+        State:= State and (not gstInvisible);
         X:= X + cWindSpeed * 3200 + dX;
         Y:= Y + dY + cGravity * vobFallSpeed * 8;  // using same value as flakes to try and get similar results
         xx:= hwRound(X);
@@ -756,34 +630,35 @@
             for py:= 0 to Pred(s^.h) do
                 begin
                 for px:= 0 to Pred(s^.w) do
-                    if ((((yy + py) and LAND_HEIGHT_MASK) = 0) and (((xx + px) and LAND_WIDTH_MASK) = 0)) and ((Land[yy + py, xx + px] and $FF) = 0) then
+                    begin
+                    lx:=xx + px; ly:=yy + py;
+                    if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (Land[ly, lx] and $FF = 0) then
                         begin
-                        if gun then
+                        rx:= lx;
+                        ry:= ly;
+                        if cReducedQuality and rqBlurryLand <> 0 then
                             begin
-                            // try to avoid speckles. might need disabling
-                            LandDirty[yy div 32, xx div 32]:= 1;
-                            Land[yy + py, xx + px]:= (Land[yy + py, xx + px] or lfDamaged or lfObject) and not lfBasic;
-                            end
-                        else if Land[yy + py, xx + px] and $FF00 = 0 then Land[yy + py, xx + px]:= lf;
-                        if (cReducedQuality and rqBlurryLand) = 0 then
-                            begin
+                            rx:= rx div 2;ry:= ry div 2;
+                            end;
+                        if Land[yy + py, xx + px] and $FF00 = 0 then
                             if gun then
-                                LandPixels[yy + py, xx + px]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
-                            else LandPixels[yy + py, xx + px]:= addBgColor(LandPixels[yy + py, xx + px], p^[px]);
-                            end
-                        else
-                            begin
-                            if gun then
-                                LandPixels[(yy + py) div 2, (xx + px) div 2]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
-                            else LandPixels[(yy + py) div 2, (xx + px) div 2]:= addBgColor(LandPixels[(yy + py) div 2, (xx + px) div 2], p^[px]);
-                            end;
+                                begin
+                                LandDirty[yy div 32, xx div 32]:= 1;
+                                if LandPixels[ry, rx] = 0 then Land[ly, lx]:=  lfDamaged or lfObject
+                                else Land[ly, lx]:=  lfDamaged or lfBasic
+                                end
+                            else Land[ly, lx]:= lf;
+                        if gun then
+                            LandPixels[ry, rx]:= (cExplosionBorderColor and (not AMask)) or (p^[px] and AMask)
+                        else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]);
                         end
-                    else allpx:= false;
+                    else allpx:= false
+                    end;
                 p:= @(p^[s^.pitch shr 2])
                 end;
             
-            
-            Land[py, px+1]:= lfBasic;
+            // Why is this here.  For one thing, there's no test on +1 being safe. 
+            //Land[py, px+1]:= lfBasic;
             
             if allpx then UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w))
             else
@@ -949,8 +824,8 @@
     dec(Gear^.Timer);
     if Gear^.Timer = 0 then
     begin
-        Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and not gmAttack;
-        Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and not gstAttacking;
+        Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and (not gmAttack);
+        Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and (not gstAttacking);
         AttackBar:= 0;
         
         Gear^.SoundChannel := LoopSound(sndBee);
@@ -1267,7 +1142,7 @@
         begin
         HHGear^.State := HHGear^.State or gstNoDamage;
         doMakeExplosion(x, y + 7, 6, Gear^.Hedgehog, EXPLDontDraw);
-        HHGear^.State := HHGear^.State and not gstNoDamage
+        HHGear^.State := HHGear^.State and (not gstNoDamage)
         end;
 
     if (Gear^.Timer mod 47) = 0 then
@@ -1397,7 +1272,7 @@
 
         if ((HHGear^.State and gstMoving) = 0) then
             begin
-            HHGear^.State := HHGear^.State and not gstAttacking;
+            HHGear^.State := HHGear^.State and (not gstAttacking);
             prevX := hwRound(HHGear^.X);
 
             // why the call to HedgehogStep then a further increment of X?
@@ -1424,7 +1299,7 @@
                 end;
             HHGear^.State := HHGear^.State or gstNoDamage;
             AmmoShove(Gear, 2, 15);
-            HHGear^.State := HHGear^.State and not gstNoDamage
+            HHGear^.State := HHGear^.State and (not gstNoDamage)
             end;
         end;
 
@@ -1489,7 +1364,7 @@
     if (GameFlags and gfMoreWind) <> 0 then HHGear^.dX := HHGear^.dX + cWindSpeed / HHGear^.Density;
 
     if (Gear^.Message and gmAttack) <> 0 then
-    begin
+        begin
         Gear^.X := HHGear^.X;
         Gear^.Y := HHGear^.Y;
 
@@ -1497,11 +1372,33 @@
 
         Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX);
         Gear^.dY := -AngleCos(HHGear^.Angle);
-        Gear^.Friction := _450 * _0_01 * cRopePercent;
+        Gear^.Friction := _4_5 * cRopePercent;
         Gear^.Elasticity := _0;
-        Gear^.State := Gear^.State and not gsttmpflag;
+        Gear^.State := Gear^.State and (not gsttmpflag);
         Gear^.doStep := @doStepRope;
-    end
+        end
+end;
+
+procedure RopeDeleteMe(Gear, HHGear: PGear);
+begin
+    with HHGear^ do
+    begin
+        Message := Message and (not gmAttack);
+        State := (State or gstMoving) and (not gstWinner);
+    end;
+    DeleteGear(Gear)
+end;
+
+procedure RopeWaitCollision(Gear, HHGear: PGear);
+begin
+    with HHGear^ do
+    begin
+        Message := Message and (not gmAttack);
+        State := State or gstMoving;
+    end;
+    RopePoints.Count := 0;
+    Gear^.Elasticity := _0;
+    Gear^.doStep := @doStepRopeAfterAttack
 end;
 
 procedure doStepRopeWork(Gear: PGear);
@@ -1512,28 +1409,6 @@
     haveCollision,
     haveDivided: boolean;
 
-procedure DeleteMe;
-begin
-    with HHGear^ do
-    begin
-        Message := Message and not gmAttack;
-        State := (State or gstMoving) and not gstWinner;
-    end;
-    DeleteGear(Gear)
-end;
-
-procedure WaitCollision;
-begin
-    with HHGear^ do
-    begin
-        Message := Message and not gmAttack;
-        State := State or gstMoving;
-    end;
-    RopePoints.Count := 0;
-    Gear^.Elasticity := _0;
-    Gear^.doStep := @doStepRopeAfterAttack
-end;
-
 begin
     HHGear := Gear^.Hedgehog^.Gear;
 
@@ -1541,14 +1416,14 @@
        or (CheckGearDrowning(HHGear)) then
         begin
         PlaySound(sndRopeRelease);
-        DeleteMe;
+        RopeDeleteMe(Gear, HHGear);
         exit
         end;
 
-    if (Gear^.Message and gmLeft  <> 0) and not TestCollisionXwithGear(HHGear, -1) then
+    if (Gear^.Message and gmLeft  <> 0) and (not TestCollisionXwithGear(HHGear, -1)) then
         HHGear^.dX := HHGear^.dX - _0_0002;
 
-    if (Gear^.Message and gmRight <> 0) and not TestCollisionXwithGear(HHGear,  1) then
+    if (Gear^.Message and gmRight <> 0) and (not TestCollisionXwithGear(HHGear,  1)) then
         HHGear^.dX := HHGear^.dX + _0_0002;
 
     // vector between hedgehog and rope attaching point
@@ -1755,9 +1630,9 @@
                 begin
                 PlaySound(sndRopeRelease);
                 if CurAmmoType <> amParachute then
-                    WaitCollision
+                    RopeWaitCollision(Gear, HHGear)
                 else
-                    DeleteMe
+                    RopeDeleteMe(Gear, HHGear)
                 end
         end
     else
@@ -1765,12 +1640,7 @@
             Gear^.State := Gear^.State or gsttmpFlag;
 end;
 
-procedure doStepRopeAttach(Gear: PGear);
-var 
-    HHGear: PGear;
-    tx, ty, tt: hwFloat;
-
-procedure RemoveFromAmmo;
+procedure RopeRemoveFromAmmo(Gear, HHGear: PGear);
 begin
     if (Gear^.State and gstAttacked) = 0 then
     begin
@@ -1780,6 +1650,10 @@
     ApplyAmmoChanges(HHGear^.Hedgehog^)
 end;
 
+procedure doStepRopeAttach(Gear: PGear);
+var 
+    HHGear: PGear;
+    tx, ty, tt: hwFloat;
 begin
     Gear^.X := Gear^.X - Gear^.dX;
     Gear^.Y := Gear^.Y - Gear^.dY;
@@ -1800,7 +1674,7 @@
             begin
             CheckHHDamage(HHGear);
             HHGear^.dY := _0
-            //HHGear^.State:= HHGear^.State and not (gstHHJumping or gstHHHJump);
+            //HHGear^.State:= HHGear^.State and (not (gstHHJumping or gstHHHJump));
             end
         else
             begin
@@ -1824,11 +1698,11 @@
                 PlaySound(sndRopeAttach);
                 with HHGear^ do
                     begin
-                    State := State and not (gstAttacking or gstHHJumping or gstHHHJump);
-                    Message := Message and not gmAttack
+                    State := State and (not (gstAttacking or gstHHJumping or gstHHHJump));
+                    Message := Message and (not gmAttack)
                     end;
 
-                RemoveFromAmmo;
+                RopeRemoveFromAmmo(Gear, HHGear);
 
                 tt := _0;
                 exit
@@ -1850,11 +1724,11 @@
         PlaySound(sndRopeAttach);
         with HHGear^ do
             begin
-            State := State and not (gstAttacking or gstHHJumping or gstHHHJump);
-            Message := Message and not gmAttack
+            State := State and (not (gstAttacking or gstHHJumping or gstHHHJump));
+            Message := Message and (not gmAttack)
             end;
 
-        RemoveFromAmmo;
+        RopeRemoveFromAmmo(Gear, HHGear);
 
         exit
         end;
@@ -1866,8 +1740,8 @@
         begin
         with Gear^.Hedgehog^.Gear^ do
             begin
-            State := State and not gstAttacking;
-            Message := Message and not gmAttack
+            State := State and (not gstAttacking);
+            Message := Message and (not gmAttack)
             end;
         DeleteGear(Gear)
         end;
@@ -1913,7 +1787,7 @@
             else if Gear^.dX.isNegative and (Gear^.dX < -_0_2) and TestCollisionXwithGear(Gear, -1) then
                  inc(Gear^.Damage, hwRound(Gear^.dX * -_70));
         
-        if (Gear^.Damage > random(30)) and ((GameTicks and $FF) = 0) then
+        if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then
             begin
             vg:= AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
             if vg <> nil then vg^.Scale:= 0.5
@@ -1954,7 +1828,7 @@
                     PlaySound(sndVaporize);
                     Gear^.Health := 0;
                     Gear^.Damage := 0;
-                    Gear^.State := Gear^.State and not gstAttacking
+                    Gear^.State := Gear^.State and (not gstAttacking)
                     end;
                 exit
                 end;
@@ -1968,7 +1842,10 @@
 procedure doStepSMine(Gear: PGear);
 begin
     // TODO: do real calculation?
-    if TestCollisionXwithGear(Gear, 2) or (TestCollisionYwithGear(Gear, -2) <> 0) or TestCollisionXwithGear(Gear, -2) or (TestCollisionYwithGear(Gear, 2) <> 0) then
+    if TestCollisionXwithGear(Gear, 2) 
+        or (TestCollisionYwithGear(Gear, -2) <> 0) 
+        or TestCollisionXwithGear(Gear, -2) 
+        or (TestCollisionYwithGear(Gear, 2) <> 0) then
     begin
         if (hwAbs(Gear^.dX) > _0) or (hwAbs(Gear^.dY) > _0) then
         begin
@@ -1997,13 +1874,14 @@
         else // gstAttacking <> 0
         begin
             AllInactive := false;
-            if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
             if Gear^.Timer = 0 then
             begin
                 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
                 DeleteGear(Gear);
                 exit
-            end;
+            end else
+                if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
+
             dec(Gear^.Timer);
         end
     end
@@ -2127,7 +2005,7 @@
         SetAllToActive;
         // something (hh, mine, etc...) could be on top of the case
         with CurrentHedgehog^ do
-            if Gear <> nil then Gear^.Message := Gear^.Message and not (gmLJump or gmHJump);
+            if Gear <> nil then Gear^.Message := Gear^.Message and (not (gmLJump or gmHJump));
         exit
     end;
 
@@ -2440,7 +2318,7 @@
         HHGear^.State := HHGear^.State or gstNoDamage;
         Gear^.Y := HHGear^.Y;
         AmmoShove(Gear, 30, 40);
-        HHGear^.State := HHGear^.State and not gstNoDamage
+        HHGear^.State := HHGear^.State and (not gstNoDamage)
     end;
 
     HHGear^.dY := HHGear^.dY + cGravity;
@@ -2531,8 +2409,8 @@
 
     AfterAttack;
 
-    HHGear^.State := HHGear^.State and not (gstAttacking or gstAttacked or gstMoving);
-    HHGear^.Message := HHGear^.Message and not gmAttack;
+    HHGear^.State := HHGear^.State and (not (gstAttacking or gstAttacked or gstMoving));
+    HHGear^.Message := HHGear^.Message and (not gmAttack);
 
     Gear^.doStep := @doStepParachuteWork;
 
@@ -2641,13 +2519,13 @@
     y := HHGear^.Y;
 
     if (Distance(tx - x, ty - y) > _256) or
-       not TryPlaceOnLand(Gear^.Target.X - SpritesData[sprAmGirder].Width div 2,
+       (not TryPlaceOnLand(Gear^.Target.X - SpritesData[sprAmGirder].Width div 2,
        Gear^.Target.Y - SpritesData[sprAmGirder].Height div 2,
-       sprAmGirder, Gear^.State, true, false) then
+       sprAmGirder, Gear^.State, true, false)) then
     begin
         PlaySound(sndDenied);
-        HHGear^.Message := HHGear^.Message and not gmAttack;
-        HHGear^.State := HHGear^.State and not gstAttacking;
+        HHGear^.Message := HHGear^.Message and (not gmAttack);
+        HHGear^.State := HHGear^.State and (not gstAttacking);
         HHGear^.State := HHGear^.State or gstHHChooseTarget;
         isCursorVisible := true;
         DeleteGear(Gear)
@@ -2659,8 +2537,8 @@
         AfterAttack;
     end;
 
-    HHGear^.State := HHGear^.State and not (gstAttacking or gstAttacked);
-    HHGear^.Message := HHGear^.Message and not gmAttack;
+    HHGear^.State := HHGear^.State and (not (gstAttacking or gstAttacked));
+    HHGear^.Message := HHGear^.Message and (not gmAttack);
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -2705,8 +2583,8 @@
        Gear^.Target.Y - SpritesData[sprHHTelepMask].Height div 2,
        sprHHTelepMask, 0, false, false) then
     begin
-        HHGear^.Message := HHGear^.Message and not gmAttack;
-        HHGear^.State := HHGear^.State and not gstAttacking;
+        HHGear^.Message := HHGear^.Message and (not gmAttack);
+        HHGear^.State := HHGear^.State and (not gstAttacking);
         HHGear^.State := HHGear^.State or gstHHChooseTarget;
         DeleteGear(Gear);
         isCursorVisible := true;
@@ -2740,10 +2618,10 @@
 begin
     AllInactive := false;
 
-    if ((Gear^.Message and not gmSwitch) <> 0) or (TurnTimeLeft = 0) then
+    if ((Gear^.Message and (not gmSwitch)) <> 0) or (TurnTimeLeft = 0) then
     begin
         HHGear := Gear^.Hedgehog^.Gear;
-        Msg := Gear^.Message and not gmSwitch;
+        Msg := Gear^.Message and (not gmSwitch);
         DeleteGear(Gear);
         ApplyAmmoChanges(HHGear^.Hedgehog^);
 
@@ -2756,8 +2634,8 @@
     if (Gear^.Message and gmSwitch) <> 0 then
     begin
         HHGear := CurrentHedgehog^.Gear;
-        HHGear^.Message := HHGear^.Message and not gmSwitch;
-        Gear^.Message := Gear^.Message and not gmSwitch;
+        HHGear^.Message := HHGear^.Message and (not gmSwitch);
+        Gear^.Message := Gear^.Message and (not gmSwitch);
         State := HHGear^.State;
         HHGear^.State := 0;
         HHGear^.Active := false;
@@ -2796,8 +2674,8 @@
     OnUsedAmmo(HHGear^.Hedgehog^);
     with HHGear^ do
     begin
-        State := State and not gstAttacking;
-        Message := Message and not gmAttack
+        State := State and (not gstAttacking);
+        Message := Message and (not gmAttack)
     end
 end;
 
@@ -3017,24 +2895,23 @@
 end;
 
 
+procedure PrevAngle(Gear: PGear; dA: LongInt);
+begin
+    Gear^.Angle := (LongInt(Gear^.Angle) + 4 - dA) mod 4
+end;
+
+procedure NextAngle(Gear: PGear; dA: LongInt);
+begin
+    Gear^.Angle := (LongInt(Gear^.Angle) + 4 + dA) mod 4
+end;
+
 procedure doStepCakeWork(Gear: PGear);
 
 const dirs: array[0..3] of TPoint =   ((x: 0; y: -1), (x: 1; y: 0),(x: 0; y: 1),(x: -1; y: 0));
 var 
     xx, yy, xxn, yyn: LongInt;
-    da: LongInt;
+    dA: LongInt;
     tdx, tdy: hwFloat;
-
-procedure PrevAngle;
-begin
-    Gear^.Angle := (LongInt(Gear^.Angle) + 4 - dA) mod 4
-end;
-
-procedure NextAngle;
-begin
-    Gear^.Angle := (LongInt(Gear^.Angle) + 4 + dA) mod 4
-end;
-
 begin
     AllInactive := false;
 
@@ -3049,7 +2926,7 @@
 
     if (xx = 0) then
         if TestCollisionYwithGear(Gear, yy) <> 0 then
-            PrevAngle
+            PrevAngle(Gear, dA)
     else
     begin
         Gear^.Tag := 0;
@@ -3057,13 +2934,13 @@
         if not TestCollisionXwithGear(Gear, xxn) then
         begin
             Gear^.X := Gear^.X + int2hwFloat(xxn);
-            NextAngle
+            NextAngle(Gear, dA)
         end;
     end;
 
     if (yy = 0) then
         if TestCollisionXwithGear(Gear, xx) then
-            PrevAngle
+            PrevAngle(Gear, dA)
     else
     begin
         Gear^.Tag := 0;
@@ -3071,7 +2948,7 @@
         if not TestCollisionY(Gear, yyn) then
         begin
             Gear^.Y := Gear^.Y + int2hwFloat(yyn);
-            NextAngle
+            NextAngle(Gear, dA)
         end;
     end;
 
@@ -3298,9 +3175,9 @@
     if (Gear^.Timer = 0) or (t^.Count <> 0) or 
        ( ((Gear^.State and gsttmpFlag) = 0) and
          (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0)
-         and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)))
+         and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))))
 // CheckLandValue returns true if the type isn't matched
-       or not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible) then
+       or (not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible)) then
         begin
         //out of time or exited ground
         StopSound(Gear^.SoundChannel);
@@ -3311,7 +3188,7 @@
         DeleteGear(Gear);
         exit
         end
-    else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) then
+    else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then
         begin
         StopSound(Gear^.SoundChannel);
         Gear^.Tag := 1;
@@ -3421,7 +3298,7 @@
     HHGear: PGear;
 begin
     HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.Message := HHGear^.Message and not (gmUp or gmDown);
+    HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown));
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepBallgunWork
 end;
@@ -3492,7 +3369,7 @@
 
     if ((HHGear^.Message and gmAttack) <> 0) and (Gear^.Health <> 0) then
     begin
-        HHGear^.Message := HHGear^.Message and not gmAttack;
+        HHGear^.Message := HHGear^.Message and (not gmAttack);
         AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY *
         _0_5, 0);
         dec(Gear^.Health)
@@ -3541,7 +3418,7 @@
             end;
 
         HHGear^.Message := 0;
-        ParseCommand('/taunt '#1, true)
+        ParseCommand('/taunt ' + #1, true)
     end
 end;
 
@@ -3646,9 +3523,9 @@
                      '%', cWhiteColor, fntSmall)
         end;
 
-    if HHGear^.Message and (gmAttack or gmUp or gmPrecise or gmLeft or gmRight) <> 0 then Gear^
-        .State := Gear^.State and not gsttmpFlag;
-    HHGear^.Message := HHGear^.Message and not (gmUp or gmPrecise or gmLeft or gmRight);
+    if HHGear^.Message and (gmAttack or gmUp or gmPrecise or gmLeft or gmRight) <> 0 then 
+        Gear^.State := Gear^.State and (not gsttmpFlag);
+    HHGear^.Message := HHGear^.Message and (not (gmUp or gmPrecise or gmLeft or gmRight));
     HHGear^.State := HHGear^.State or gstMoving;
 
     Gear^.X := HHGear^.X;
@@ -3698,8 +3575,8 @@
     AfterAttack;
     with HHGear^ do
     begin
-        State := State and not gstAttacking;
-        Message := Message and not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight);
+        State := State and (not gstAttacking);
+        Message := Message and (not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight));
         if (dY < _0_1) and (dY > -_0_1) then
         begin
             Gear^.State := Gear^.State or gsttmpFlag;
@@ -3769,7 +3646,7 @@
 
     if (HHGear^.Message and gmAttack <> 0) then
         begin
-        HHGear^.Message := HHGear^.Message and not gmAttack;
+        HHGear^.Message := HHGear^.Message and (not gmAttack);
         if Gear^.FlightTime > 0 then
             begin
             AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + 32, gtEgg, 0, Gear^.dX * _0_5, Gear^.dY, 0);
@@ -3779,8 +3656,8 @@
         end;
 
     if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then
-        Gear^.State := Gear^.State and not gsttmpFlag;
-    HHGear^.Message := HHGear^.Message and not (gmUp or gmPrecise or gmLeft or gmRight);
+        Gear^.State := Gear^.State and (not gsttmpFlag);
+    HHGear^.Message := HHGear^.Message and (not (gmUp or gmPrecise or gmLeft or gmRight));
     HHGear^.State := HHGear^.State or gstMoving;
 
     Gear^.X := HHGear^.X;
@@ -3832,7 +3709,7 @@
             exit
         end;
     HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.Message := HHGear^.Message and not (gmUp or gmPrecise or gmLeft or gmRight);
+    HHGear^.Message := HHGear^.Message and (not (gmUp or gmPrecise or gmLeft or gmRight));
     if abs(hwRound(HHGear^.Y - Gear^.Y)) > 32 then
     begin
         if Gear^.Timer = 0 then
@@ -3855,7 +3732,7 @@
         Gear^.Timer := 500;
         Gear^.dX := _0;
         Gear^.dY := _0;
-        Gear^.State :=  Gear^.State and not gstAnimation;
+        Gear^.State :=  Gear^.State and (not gstAnimation);
         Gear^.doStep := @doStepBirdyDescend;
     end
 end;
@@ -3864,7 +3741,7 @@
 var 
     HHGear: PGear;
 begin
-    gear^.State :=  gear^.State or gstAnimation and not gstTmpFlag;
+    gear^.State :=  gear^.State or gstAnimation and (not gstTmpFlag);
     Gear^.doStep := @doStepBirdyAppear;
     if CurrentHedgehog = nil then
     begin
@@ -3883,8 +3760,8 @@
     FollowGear := HHGear;
     with HHGear^ do
         begin
-        State := State and not gstAttacking;
-        Message := Message and not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight)
+        State := State and (not gstAttacking);
+        Message := Message and (not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight))
         end
 end;
 
@@ -3927,10 +3804,10 @@
     if (CurrentHedgehog <> nil)
        and (CurrentHedgehog^.Gear <> nil)
        and ((CurrentHedgehog^.Gear^.Message and gmSwitch) <> 0) then
-        With CurrentHedgehog^ do
+        with CurrentHedgehog^ do
             if (CurAmmoType = amPortalGun) then
             begin
-                CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and not gmSwitch;
+                CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and (not gmSwitch);
                 
                 CurWeapon:= GetAmmoEntry(CurrentHedgehog^);
                 if CurWeapon^.Pos <> 0 then
@@ -4040,11 +3917,11 @@
         // won't port stuff that does not move towards the front/portal entrance
         if iscake then
         begin
-            if not ((iterator^.X - Gear^.X)*ox + (iterator^.Y - Gear^.Y)*oy).isNegative then
+            if not (((iterator^.X - Gear^.X)*ox + (iterator^.Y - Gear^.Y)*oy).isNegative) then
                 continue;
         end
         else
-            if not (Gear^.dX*ox + Gear^.dY*oy).isNegative then
+            if not ((Gear^.dX*ox + Gear^.dY*oy).isNegative) then
                 continue;
 
         isbullet:= (iterator^.Kind in [gtShotgunShot, gtDEagleShot, gtSniperRifleShot, gtSineGunShot]);
@@ -4083,7 +3960,7 @@
             continue;
 
         // only port bullets close to the portal
-        if isBullet and not (hwAbs(poffs) < _3) then
+        if isBullet and (not (hwAbs(poffs) < _3)) then
             continue;
 
         //
@@ -4104,7 +3981,7 @@
         ny := Gear^.dX;
         // ... decide where the top is based on the hog's direction when firing the portal
         if Gear^.Elasticity.isNegative then
-            nx.isNegative := not nx.isNegative
+            nx.isNegative := (not nx.isNegative)
         else
             ny.isNegative := not ny.isNegative;
 
@@ -4136,7 +4013,7 @@
         nx := conPortal^.dY;
         ny := conPortal^.dX;
         if conPortal^.Elasticity.isNegative then
-            nx.isNegative := not nx.isNegative
+            nx.isNegative := (not nx.isNegative)
         else
             ny.isNegative := not ny.isNegative;
 
@@ -4173,7 +4050,7 @@
         iterator^.X := conPortal^.X + poffs * conPortal^.dX + noffs * nx;
         iterator^.Y := conPortal^.Y + poffs * conPortal^.dY + noffs * ny;
 
-        if not hasdxy and not (conPortal^.dY.isNegative) then
+        if not hasdxy and (not (conPortal^.dY.isNegative)) then
         begin
             iterator^.dY:= iterator^.dY + hwAbs(cGravity * (iterator^.Y - conPortal^.Y))
         end;
@@ -4228,7 +4105,7 @@
         else
             begin
             inc(iterator^.PortalCounter);
-            iterator^.State:= iterator^.State and not gstHHHJump
+            iterator^.State:= iterator^.State and (not gstHHHJump)
             end;
 
         if not isbullet and (iterator^.Kind <> gtFlake) then
@@ -4261,10 +4138,7 @@
     end;
 end;
 
-procedure doStepMovingPortal_real(Gear: PGear);
-var 
-    x, y, tx, ty: LongInt;
-    s: hwFloat;
+
 
 procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean);
 var
@@ -4292,6 +4166,10 @@
     if destroyGear then oldPortal^.Timer:= 0;
 end;
 
+procedure doStepMovingPortal_real(Gear: PGear);
+var 
+    x, y, tx, ty: LongInt;
+    s: hwFloat;
 begin
     x := hwRound(Gear^.X);
     y := hwRound(Gear^.Y);
@@ -4302,7 +4180,7 @@
     if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] > 255) then
     begin
         Gear^.State := Gear^.State or gstCollision;
-        Gear^.State := Gear^.State and not gstMoving;
+        Gear^.State := Gear^.State and (not gstMoving);
         if not CalcSlopeTangent(Gear, x, y, tx, ty, 255)
            or (DistanceI(tx,ty) < _12) then // reject shots at too irregular terrain
         begin
@@ -4363,13 +4241,13 @@
     newPortal^.IntersectGear := nil;
 
     if CurrentHedgehog <> nil then
-        With CurrentHedgehog^ do
+        with CurrentHedgehog^ do
         begin
             CurWeapon:= GetAmmoEntry(CurrentHedgehog^);
             // let's save the HH's dX's direction so we can decide where the "top" of the portal hole
             newPortal^.Elasticity.isNegative := CurrentHedgehog^.Gear^.dX.isNegative;
             // when doing a backjump the dx is the opposite of the facing direction
-            if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then
+            if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
                 newPortal^.Elasticity.isNegative := not newPortal^.Elasticity.isNegative;
 
             // make portal gun look unloaded
@@ -4398,7 +4276,7 @@
                 iterator := iterator^.NextGear
             end;
         end;
-    newPortal^.State := newPortal^.State and not gstCollision;
+    newPortal^.State := newPortal^.State and (not gstCollision);
     newPortal^.State := newPortal^.State or gstMoving;
     newPortal^.doStep := @doStepMovingPortal;
 end;
@@ -4426,7 +4304,7 @@
         end;
         AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote);
         CurrentHedgehog^.Gear^.MsgParam := 0;
-        CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and not gmSlot;
+        CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and (not gmSlot);
         end;
 
     if (*((Gear^.Pos = 3) and ((GameFlags and gfSolidLand) <> 0)) or*) (Gear^.Pos = 5) then
@@ -4697,7 +4575,7 @@
     HHGear: PGear;
 begin
     HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.Message := HHGear^.Message and not (gmUp or gmDown or gmLeft or gmRight);
+    HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown or gmLeft or gmRight));
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepFlamethrowerWork
 end;
@@ -4747,7 +4625,7 @@
 
     if (Gear^.Health = 0) or (HHGear^.Damage <> 0) or ((HHGear^.Message and gmAttack) <> 0) then
         begin
-        HHGear^.Message:= HHGear^.Message and not gmAttack;
+        HHGear^.Message:= HHGear^.Message and (not gmAttack);
         DeleteGear(Gear);
         AfterAttack
         end
@@ -4769,7 +4647,7 @@
     HHGear: PGear;
 begin
     HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.Message := HHGear^.Message and not (gmUp or gmDown or gmLeft or gmRight or gmAttack);
+    HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown or gmLeft or gmRight or gmAttack));
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepLandGunWork
 end;
@@ -4827,7 +4705,7 @@
             end
     end;
 
-HHGear^.State:= HHGear^.State and not gstNoDamage;
+HHGear^.State:= HHGear^.State and (not gstNoDamage);
 Gear^.Timer:= 250;
 Gear^.doStep:= @doStepIdle
 end;
@@ -5068,53 +4946,79 @@
 procedure doStepStructure(Gear: PGear);
 var 
     x, y: LongInt;
+    HH: PHedgehog;
+    t: PGear;
 begin
+    HH:= Gear^.Hedgehog;
+
     if (Gear^.State and gstMoving) <> 0 then
         begin
         AddGearCI(Gear);
         Gear^.dX:= _0;
         Gear^.dY:= _0;
-        Gear^.State:= Gear^.State and not gstMoving;
-        end;
-
-    if CurAmmoGear = Gear then
-        begin
-        if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then
-            begin
-            DeleteGear(Gear);
-            exit
-            end;
-        if Gear = CurAmmoGear then CurAmmoGear := nil;
-        Gear^.Hedgehog:= CurrentHedgehog;
-        RemoveGearFromList(CurrentHedgehog^.Gear);
-        CurrentHedgehog^.Gear^.Z := cHHZ;
-        CurrentHedgehog^.Gear^.Active := false;
-        CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstHHDriven;
-        CurrentHedgehog^.GearHidden:= CurrentHedgehog^.Gear;
-        CurrentHedgehog^.Gear:= nil;
-        Gear^.Tag:= TotalRounds + Gear^.Tag;
-        AddGearCI(Gear);
+        Gear^.State:= Gear^.State and (not gstMoving);
         end;
 
     dec(Gear^.Health, Gear^.Damage);
-    Gear^.Damage := 0;
+    Gear^.Damage:= 0;
         
-    if (Gear^.Tag = TotalRounds) or (Gear^.Health <= 0) then
+    if Gear^.Pos = 1 then
         begin
-        if Gear^.Hedgehog <> nil then
+        AddGearCI(Gear);
+        AfterAttack;
+        if Gear = CurAmmoGear then CurAmmoGear:= nil;
+        if HH^.Gear <> nil then HideHog(HH);
+        Gear^.Pos:= 2
+        end;
+        
+    if Gear^.Pos = 2 then
+        begin
+        if ((GameTicks mod 100) = 0) and (Gear^.Timer < 1000) then
             begin
-            Gear^.Hedgehog^.Gear:= Gear^.Hedgehog^.GearHidden;
-            Gear^.Hedgehog^.GearHidden:= nil;
-            Gear^.Hedgehog^.Gear^.X:= Gear^.X;
-            Gear^.Hedgehog^.Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Radius + cHHRadius);
-            InsertGearToList(Gear^.Hedgehog^.Gear);
-            Gear^.Hedgehog:= nil;
-            SetAllHHToActive;
+            if (Gear^.Timer mod 10) = 0 then
+                begin
+                DeleteCI(Gear);
+                Gear^.Y:= Gear^.Y - _0_5;
+                AddGearCI(Gear);
+                end;
+            inc(Gear^.Timer);
             end;
+        if Gear^.Tag <= TotalRounds then Gear^.Pos:= 3;
         end;
         
+    if Gear^.Pos = 3 then
+        if Gear^.Timer < 1000 then
+            begin
+            if (Gear^.Timer mod 10) = 0 then
+                begin
+                DeleteCI(Gear);
+                Gear^.Y:= Gear^.Y - _0_5;
+                AddGearCI(Gear);
+                end;
+            inc(Gear^.Timer);
+            end
+        else
+            begin
+            if HH^.GearHidden <> nil then RestoreHog(HH);
+            Gear^.Pos:= 4;
+            end;
+        
+    if Gear^.Pos = 4 then
+        if ((GameTicks mod 1000) = 0) and ((GameFlags and gfInvulnerable) = 0) then
+            begin
+            t:= GearsList;
+            while t <> nil do
+                begin
+                if (t^.Kind = gtHedgehog) and (t^.Hedgehog^.Team^.Clan = HH^.Team^.Clan) then
+                    t^.Invulnerable:= true;
+                t:= t^.NextGear;
+                end;
+            end;
+        
     if Gear^.Health <= 0 then
         begin
+        if HH^.GearHidden <> nil then RestoreHog(HH);
+        
         x := hwRound(Gear^.X);
         y := hwRound(Gear^.Y);
 
@@ -5178,10 +5082,10 @@
        ((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then
         with HH^.Gear^ do
             begin
-	        State:= State or gstAnimation;
-	        Tag:= 2;
-	        Timer:= 0;
-	        Pos:= 0
+            State:= State or gstAnimation;
+            Tag:= 2;
+            Timer:= 0;
+            Pos:= 0
             end
     end;
 if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then dec(Gear^.Power);
@@ -5245,8 +5149,8 @@
         begin
         if HH^.Gear <> nil then
             begin
-            HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
-            HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
+            HH^.Gear^.Message := HH^.Gear^.Message and (not gmAttack);
+            HH^.Gear^.State:= HH^.Gear^.State and (not gstAttacking);
             end;
         PlaySound(sndDenied);
         DeleteGear(gear);
@@ -5263,8 +5167,8 @@
         begin
         if HH^.Gear <> nil then
             begin
-            HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
-            HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
+            HH^.Gear^.Message := HH^.Gear^.Message and (not gmAttack);
+            HH^.Gear^.State:= HH^.Gear^.State and (not gstAttacking);
             end;
             PlaySound(sndDenied);
             DeleteGear(gear);
--- a/hedgewars/HHHandlers.inc	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/HHHandlers.inc	Mon Dec 05 18:38:07 2011 -0500
@@ -17,1138 +17,3 @@
  *)
 
 ////////////////////////////////////////////////////////////////////////////////
-
-procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
-begin
-if (Source = dsFall) or (Source = dsExplosion) then
-    case random(3) of
-        0: PlaySound(sndOoff1, Hedgehog^.Team^.voicepack);
-        1: PlaySound(sndOoff2, Hedgehog^.Team^.voicepack);
-        2: PlaySound(sndOoff3, Hedgehog^.Team^.voicepack);
-    end
-else if (Source = dsPoison) then
-    case random(2) of
-        0: PlaySound(sndPoisonCough, Hedgehog^.Team^.voicepack);
-        1: PlaySound(sndPoisonMoan, Hedgehog^.Team^.voicepack);
-    end
-else
-    case random(4) of
-        0: PlaySound(sndOw1, Hedgehog^.Team^.voicepack);
-        1: PlaySound(sndOw2, Hedgehog^.Team^.voicepack);
-        2: PlaySound(sndOw3, Hedgehog^.Team^.voicepack);
-        3: PlaySound(sndOw4, Hedgehog^.Team^.voicepack);
-    end
-end;
-
-// Shouldn't more of this ammo switching stuff be moved to uAmmos ?
-function ChangeAmmo(HHGear: PGear): boolean;
-var slot, i: Longword;
-    ammoidx: LongInt;
-begin
-ChangeAmmo:= false;
-slot:= HHGear^.MsgParam;
-
-with HHGear^.Hedgehog^ do
-    begin
-    HHGear^.Message:= HHGear^.Message and not gmSlot;
-    ammoidx:= 0;
-    if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) or
-       ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or
-       ((HHGear^.State and gstHHDriven) = 0) then exit;
-    ChangeAmmo:= true;
-
-    while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx);
-
-    if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(HHGear^.Hedgehog^);
-
-    MultiShootAttacks:= 0;
-    HHGear^.Message:= HHGear^.Message and not (gmLJump or gmHJump);
-    
-    if Ammoz[CurAmmoType].Slot = slot then
-        begin
-        i:= 0;
-        repeat
-        inc(ammoidx);
-        if (ammoidx > cMaxSlotAmmoIndex) then
-            begin
-            inc(i);
-            CurAmmoType:= amNothing;
-            ammoidx:= -1;
-            //TryDo(i < 2, 'Engine bug: no ammo in current slot', true)
-            end;
-        until (i = 1) or ((Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns))
-        end 
-    else
-        begin
-        i:= 0;
-        // check whether there is ammo in slot
-        while (i <= cMaxSlotAmmoIndex)
-          and ((Ammo^[slot, i].Count = 0)
-               or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns)) do inc(i);
-
-        if i <= cMaxSlotAmmoIndex then ammoidx:= i
-        else ammoidx:= -1
-        end;
-        if ammoidx >= 0 then CurAmmoType:= Ammo^[slot, ammoidx].AmmoType;
-    end
-end;
-
-procedure HHSetWeapon(HHGear: PGear);
-var t: LongInt;
-    weap: TAmmoType;
-    Hedgehog: PHedgehog;
-    s: boolean;
-begin
-s:= false;
-
-weap:= TAmmoType(HHGear^.MsgParam);
-Hedgehog:= HHGear^.Hedgehog;
-
-if Hedgehog^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then exit; // weapon is not activated yet
-
-HHGear^.MsgParam:= Ammoz[weap].Slot;
-
-t:= cMaxSlotAmmoIndex;
-
-HHGear^.Message:= HHGear^.Message and not gmWeapon;
-
-with Hedgehog^ do
-    while (CurAmmoType <> weap) and (t >= 0) do
-        begin
-        s:= ChangeAmmo(HHGear);
-        dec(t)
-        end;
-
-if s then ApplyAmmoChanges(HHGear^.Hedgehog^)
-end;
-
-procedure HHSetTimer(Gear: PGear);
-var CurWeapon: PAmmo;
-    color: LongWord;
-begin
-Gear^.Message:= Gear^.Message and not gmTimer;
-CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
-with Gear^.Hedgehog^ do
-    if ((Gear^.Message and gmPrecise) <> 0) and ((CurWeapon^.Propz and ammoprop_SetBounce) <> 0) then
-        begin
-        color:= Gear^.Hedgehog^.Team^.Clan^.Color;
-        case Gear^.MsgParam of
-            1: begin
-               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate);
-               CurWeapon^.Bounciness:= 350;
-               end;
-            2: begin
-               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate);
-               CurWeapon^.Bounciness:= 700;
-               end;
-            3: begin
-               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate);
-               CurWeapon^.Bounciness:= 1000;
-               end;
-            4: begin
-               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate);
-               CurWeapon^.Bounciness:= 2000;
-               end;
-            5: begin
-               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate);
-               CurWeapon^.Bounciness:= 4000;
-               end
-            end
-        end
-    else if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then
-        begin
-        CurWeapon^.Timer:= 1000 * Gear^.MsgParam;
-        with CurrentTeam^ do
-            ApplyAmmoChanges(Hedgehogs[CurrHedgehog]);
-        end;
-end;
-
-
-procedure Attack(Gear: PGear);
-var xx, yy, newDx, newDy, lx, ly: hwFloat;
-    speech: PVisualGear;
-    newGear:  PGear;
-    CurWeapon: PAmmo;
-    altUse: boolean;
-    elastic: hwFloat;
-begin
-newGear:= nil;
-bShowFinger:= false;
-CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
-with Gear^,
-     Gear^.Hedgehog^ do
-     begin
-     if ((State and gstHHDriven) <> 0)and
-        ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
-        (((State and gstMoving) = 0) or
-            (Power > 0) or
-            (CurAmmoType = amTeleport) or 
-            // Allow attacks while moving on ammo with AltAttack
-            ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or
-            ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and
-        ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then
-        begin
-        State:= State or gstAttacking;
-        if Power = cMaxPower then Message:= Message and not gmAttack
-        else if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) = 0 then Message:= Message and not gmAttack
-        else begin
-             if Power = 0 then
-                begin
-                AttackBar:= CurrentTeam^.AttackBar;
-                PlaySound(sndThrowPowerUp)
-                end;
-             inc(Power)
-             end;
-        if ((Message and gmAttack) <> 0) then exit;
-
-        if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0 then
-           begin
-           StopSound(sndThrowPowerUp);
-           PlaySound(sndThrowRelease);
-           end;
-
-        xx:= SignAs(AngleSin(Angle), dX);
-        yy:= -AngleCos(Angle);
-
-        lx:= X + int2hwfloat(round(GetLaunchX(CurAmmoType, hwSign(dX), Angle)));
-        ly:= Y + int2hwfloat(round(GetLaunchY(CurAmmoType, Angle)));
-
-        if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then xx:= - xx;
-        if Ammoz[CurAmmoType].Ammo.AttackVoice <> sndNone then
-           AddVoice(Ammoz[CurAmmoType].Ammo.AttackVoice, CurrentTeam^.voicepack);
-
-// Initiating alt attack
-        if  (CurAmmoGear <> nil) and
-            ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and
-            ((Gear^.Message and gmLJump) <> 0) and
-            ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
-            begin
-            newDx:= dX / _2; 
-            newDy:= dY / _2;
-            altUse:= true;
-            end
-        else
-            begin
-            newDx:= xx*Power/cPowerDivisor;
-            newDy:= yy*Power/cPowerDivisor;
-            altUse:= false
-            end;
-
-             case CurAmmoType of
-                      amGrenade: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGrenade,         0, newDx, newDy, CurWeapon^.Timer);
-                      amMolotov: newGear:= AddGear(hwRound(lx), hwRound(ly), gtMolotov,      0, newDx, newDy, 0);
-                  amClusterBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtClusterBomb,  0, newDx, newDy, CurWeapon^.Timer);
-                      amGasBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGasBomb,      0, newDx, newDy, CurWeapon^.Timer);
-                      amBazooka: newGear:= AddGear(hwRound(lx), hwRound(ly), gtShell,        0, newDx, newDy, 0);
-                     amSnowball: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSnowball,     0, newDx, newDy, 0);
-                          amBee: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBee,          0, newDx, newDy, 0);
-                      amShotgun: begin
-                                 PlaySound(sndShotgunReload);
-                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
-                                 end;
-                   amPickHammer: newGear:= AddGear(hwRound(lx), hwRound(ly) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
-                         amSkip: ParseCommand('/skip', true);
-                         amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
-                         amMine: if altUse then
-                                    newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, newDx, newDy, 3000)
-                                 else
-                                    newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
-                        amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
-                       amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
-                      amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
-                    amPortalGun: begin
-                                 newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, 
-                                 // set selected color
-                                 CurWeapon^.Pos);
-                                 end;
-                  amSniperRifle: begin
-                                 PlaySound(sndSniperReload);
-                                 newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0);
-                                 end;
-                     amDynamite: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
-                    amFirePunch: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0);
-                         amWhip: begin
-                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
-                                 PlaySound(sndWhipCrack)
-                                 end;
-                       amHammer: begin
-                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtHammer, 0, SignAs(_1, dX), - _0_8, 0);
-                                 PlaySound(sndWhack)
-                                 end;
-                  amBaseballBat: begin
-                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtShover, gsttmpFlag, xx * _0_5, yy * _0_5, 0);
-                                 PlaySound(sndBaseballBat) // TODO: Only play if something is hit?
-                                 end;
-                    amParachute: begin
-                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtParachute, 0, _0, _0, 0);
-                                 PlaySound(sndParachute)
-                                 end;
-                    // we save CurWeapon^.Pos (in this case: cursor direction) by using it as (otherwise irrelevant) X value of the new gear.
-                    amAirAttack: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 0, _0, _0, 0);
-                   amMineStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 1, _0, _0, 0);
-                  amDrillStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
-                       amNapalm: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0);
-                    amBlowTorch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0);
-                       amGirder: newGear:= AddGear(0, 0, gtGirder, CurWeapon^.Pos, _0, _0, 0);
-                     amTeleport: newGear:= AddGear(CurWeapon^.Pos, 0, gtTeleport, 0, _0, _0, 0);
-                       amSwitch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSwitcher, 0, _0, _0, 0);
-                       amMortar: begin
-                                 playSound(sndMortar);
-                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtMortar,  0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
-                                 end;
-                      amRCPlane: begin
-                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane,  0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
-                                 newGear^.SoundChannel:= LoopSound(sndRCPlane, nil)
-                                 end;
-                       amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
-                         amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0);
-                    amSeduction: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSeduction, 0, _0, _0, 0);
-                   amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon,  0, newDx, newDy, CurWeapon^.Timer);
-                  amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb,    0, newDx, newDy, 0);
-                        amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0);
-                      amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
-                    amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
-                    amBirdy: begin
-                             PlaySound(sndWhistle);
-                             newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0);
-                             end;
-                      amLowGravity: begin
-                                    PlaySound(sndLowGravity);
-                                    cGravity:= cMaxWindSpeed;
-                                    cGravityf:= 0.00025
-                                    end;
-                      amExtraDamage:begin 
-                                    PlaySound(sndHellishImpact4);
-                                    cDamageModifier:= _1_5
-                                    end;
-                      amInvulnerable: Invulnerable:= true;
-                      amExtraTime:  begin
-                                    PlaySound(sndSwitchHog);
-                                    TurnTimeLeft:= TurnTimeLeft + 30000
-                                    end;
-                      amLaserSight: cLaserSighting:= true;
-                      amVampiric: begin
-                                  PlaySound(sndOw1, Team^.voicepack);
-                                  cVampiric:= true;
-                                  end;
-                      amPiano: begin
-                               // Tuck the hedgehog away until the piano attack is completed
-                               Unplaced:= true;
-                               X:= _0;
-                               Y:= _0;
-                               newGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
-                               PauseMusic
-                               end;
-                      amFlamethrower: newGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower,  0, xx * _0_5, yy * _0_5, 0);
-                      amLandGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtLandGun,  0, xx * _0_5, yy * _0_5, 0);
-                    amResurrector: begin
-                        newGear:= AddGear(hwRound(lx), hwRound(ly),
-                                gtResurrector, 0, _0, _0, 0);
-                        newGear^.SoundChannel := LoopSound(sndResurrector);
-                    end;
-                   //amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0);
-                     amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000);
-                        amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
-                  end;
-             case CurAmmoType of
-                      amGrenade, amMolotov, 
-                  amClusterBomb, amGasBomb, 
-                      amBazooka, amSnowball, 
-                          amBee, amSMine,
-                       amMortar, amWatermelon,
-                  amHellishBomb, amDrill: FollowGear:= newGear;
-
-                      amShotgun, amPickHammer,
-                         amRope, amDEagle,
-                      amSineGun, amSniperRifle,
-                    amFirePunch, amWhip,
-                       amHammer, amBaseballBat,
-                    amParachute, amBlowTorch,
-                       amGirder, amTeleport,
-                       amSwitch, amRCPlane,
-                     amKamikaze, amCake,
-                    amSeduction, amBallgun,
-                      amJetpack, amBirdy,
-                 amFlamethrower, amLandGun,
-                  amResurrector, amStructure,
-                       amTardis, amPiano: CurAmmoGear:= newGear;
-                  end;
-              if (CurAmmoType = amMine) or (CurAmmoType = amSMine) and (GameFlags and gfInfAttack <> 0) then newGear^.FlightTime:= GameTicks + 1000;
-        if Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then
-            begin
-            newGear^.Target.X:= TargetPoint.X;
-            newGear^.Target.Y:= TargetPoint.Y
-            end;
-
-        // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
-        if altUse then FollowGear:= nil;
-
-        if (newGear <> nil) and ((Ammoz[newGear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) then
-            begin
-            elastic:=  int2hwfloat(CurWeapon^.Bounciness) / _1000;
-
-            if elastic < _1 then newGear^.Elasticity:= newGear^.Elasticity * elastic
-            else if elastic > _1 then newGear^.Elasticity:= _1 - ((_1-newGear^.Elasticity) / elastic);
-(* Experimented with friction modifier. Didn't seem helpful 
-            fric:= int2hwfloat(CurWeapon^.Bounciness) / _250;
-            if fric < _1 then newGear^.Friction:= newGear^.Friction * fric
-            else if fric > _1 then newGear^.Friction:= _1 - ((_1-newGear^.Friction) / fric)*)
-            end;
-
-
-        uStats.AmmoUsed(CurAmmoType);
-
-        if not (SpeechText = '') then
-            begin
-            speech:= AddVisualGear(0, 0, vgtSpeechBubble);
-            if speech <> nil then
-               begin
-               speech^.Text:= SpeechText;
-               speech^.Hedgehog:= Gear^.Hedgehog;
-               speech^.FrameTicks:= SpeechType;
-               end;
-            SpeechText:= ''
-            end;
-
-        Power:= 0;
-        if (CurAmmoGear <> nil)
-           and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
-           begin
-           Message:= Message or gmAttack;
-           CurAmmoGear^.Message:= Message
-           end else begin
-           if not CurrentTeam^.ExtDriven and
-             ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then SendIPC('a');
-           AfterAttack;
-           end
-        end else Message:= Message and not gmAttack;
-     end;
-     TargetPoint.X := NoPointX;
-     ScriptCall('onHogAttack');	
-end;
-
-procedure AfterAttack;
-var s: shortstring;
-    a: TAmmoType;
-begin
-with CurrentHedgehog^.Gear^,
-        CurrentHedgehog^ do
-    begin
-    a:= CurAmmoType;
-    State:= State and not gstAttacking;
-    if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then
-        begin
-        Inc(MultiShootAttacks);
-        
-        if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then
-            begin
-            s:= inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1);
-            AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
-            end;
-        
-        if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) or
-            ((GameFlags and gfMultiWeapon) <> 0) then
-            begin
-            isInMultiShoot:= true
-            end
-        else
-            begin
-            OnUsedAmmo(CurrentHedgehog^);
-            if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (((GameFlags and gfInfAttack) = 0) or PlacingHogs) then
-                begin
-                if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft;
-                TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100;
-                end;
-            if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) then State:= State or gstAttacked;
-            if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then ApplyAmmoChanges(CurrentHedgehog^)
-            end;
-        end
-    else
-        begin
-        OnUsedAmmo(CurrentHedgehog^);
-        ApplyAmmoChanges(CurrentHedgehog^);
-        end;
-    AttackBar:= 0
-    end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepHedgehogDead(Gear: PGear);
-const frametime = 200;
-      timertime = frametime * 6;
-begin
-if Gear^.Hedgehog^.Unplaced then exit;
-if Gear^.Timer > 1 then
-    begin
-    AllInactive:= false;
-    dec(Gear^.Timer);
-    if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos)
-    end 
-else if Gear^.Timer = 1 then
-    begin
-    Gear^.State:= Gear^.State or gstNoDamage;
-    doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, CurrentHedgehog, EXPLAutoSound);
-    AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
-    DeleteGear(Gear);
-    SetAllToActive
-    end 
-else // Gear^.Timer = 0
-    begin
-    AllInactive:= false;
-    Gear^.Z:= cCurrHHZ;
-    RemoveGearFromList(Gear);
-    InsertGearToList(Gear);
-    PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
-    Gear^.Pos:= 0;
-    Gear^.Timer:= timertime
-    end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepHedgehogGone(Gear: PGear);
-const frametime = 65;
-      timertime = frametime * 11;
-begin
-if Gear^.Hedgehog^.Unplaced then exit;
-if Gear^.Timer > 1 then
-    begin
-    AllInactive:= false;
-    dec(Gear^.Timer);
-    if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos)
-    end else
-if Gear^.Timer = 1 then
-    begin
-    DeleteGear(Gear);
-    SetAllToActive
-    end else // Gear^.Timer = 0
-    begin
-    AllInactive:= false;
-    Gear^.Z:= cCurrHHZ;
-    RemoveGearFromList(Gear);
-    InsertGearToList(Gear);
-    PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
-    PlaySound(sndWarp);
-    Gear^.Pos:= 0;
-    Gear^.Timer:= timertime
-    end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure PickUp(HH, Gear: PGear);
-var s: shortstring;
-    a: TAmmoType;
-    i: LongInt;
-    vga: PVisualGear;
-begin
-Gear^.Message:= gmDestroy;
-PlaySound(sndShotgunReload);
-if (Gear^.Pos and posCaseExplode) <> 0 then
-    if (Gear^.Pos and posCasePoison) <> 0 then
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned)
-    else
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound)
-else if (Gear^.Pos and posCasePoison) <> 0 then
-    doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned + EXPLNoDamage)
-else
-case Gear^.Pos of
-       posCaseUtility,
-       posCaseAmmo: begin
-                    if Gear^.AmmoType <> amNothing then a:= Gear^.AmmoType 
-                    else
-                        begin
-                        for i:= 0 to GameTicks and $7F do GetRandom(2); // Burn some random numbers
-                        if Gear^.Pos = posCaseUtility then a:= GetUtility
-                        else a:= GetAmmo
-                        end;
-                    AddAmmo(HH^.Hedgehog^, a);
-// Possibly needs to check shared clan ammo game flag once added.
-// On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up
-                    if (not (HH^.Hedgehog^.Team^.ExtDriven 
-                      or (HH^.Hedgehog^.BotLevel > 0)))
-                      or (HH^.Hedgehog^.Team^.Clan^.ClanIndex = LocalClan)
-                      or (GameType = gmtDemo)  then
-                        begin
-                        s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')';
-                        AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
-
-                        // show ammo icon
-                        vga:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtAmmo);
-                        if vga <> nil then
-                            vga^.Frame:= Longword(a);
-                        end;
-
-                    end;
-     posCaseHealth: begin
-                    inc(HH^.Health, Gear^.Health);
-                    HH^.Hedgehog^.Effects[hePoisoned] := false;
-                    str(Gear^.Health, s);
-                    s:= '+' + s;
-                    AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
-                    RenderHealth(HH^.Hedgehog^);
-                    RecountTeamHealth(HH^.Hedgehog^.Team);
-
-                    i:= 0;
-                    while i < Gear^.Health do
-                        begin
-                        vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot);
-                        if vga <> nil then
-                            with vga^ do
-                                begin
-                                Tint:= $00FF00FF;
-                                State:= ord(sprHealth)
-                                end;
-                        inc(i, 5);
-                        end;
-                    end;
-     end
-end;
-
-const StepTicks: LongWord = 0;
-
-procedure HedgehogStep(Gear: PGear);
-var PrevdX: LongInt;
-    CurWeapon: PAmmo;
-begin
-CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
-if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then
-   begin
-   if isCursorVisible then
-      with Gear^.Hedgehog^ do
-        with CurWeapon^ do
-          begin
-          if (Gear^.Message and gmLeft  ) <> 0 then
-             Pos:= (Pos - 1 + Ammoz[AmmoType].PosCount) mod Ammoz[AmmoType].PosCount
-          else
-          if (Gear^.Message and gmRight ) <> 0 then
-             Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount
-          else exit;
-          StepTicks:= 200;
-          exit
-          end;
-
-    if ((Gear^.Message and gmAnimate) <> 0) then
-        begin
-        Gear^.Message:= 0;
-        Gear^.State:= Gear^.State or gstAnimation;
-        Gear^.Tag:= Gear^.MsgParam;
-        Gear^.Timer:= 0;
-        Gear^.Pos:= 0
-        end;
-
-   if ((Gear^.Message and gmLJump ) <> 0) then
-      begin
-      Gear^.Message:= Gear^.Message and not gmLJump;
-      DeleteCI(Gear);
-      if TestCollisionYwithGear(Gear, -1) = 0 then
-         if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else
-         if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1;
-      if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX))
-         or   (TestCollisionYwithGear(Gear, -1) <> 0)) then
-         begin
-         Gear^.dY:= -_0_15;
-         if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX);
-         Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
-         PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack);
-         exit
-         end;
-      end;
-
-   if ((Gear^.Message and gmHJump ) <> 0) then
-      begin
-      DeleteCI(Gear);
-      Gear^.Message:= Gear^.Message and not gmHJump;
-
-      Gear^.dY:= -_0_2;
-      SetLittle(Gear^.dX);
-      Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
-      PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack);
-      exit
-      end;
-
-   PrevdX:= hwSign(Gear^.dX);
-   if (Gear^.Message and gmLeft  )<>0 then Gear^.dX:= -cLittle else
-   if (Gear^.Message and gmRight )<>0 then Gear^.dX:=  cLittle else exit;
-
-   if (Gear^.Message and (gmLeft or gmRight)) <> 0 then
-      begin
-      StepSoundTimer:= cHHStepTicks;
-      end;
-   
-   StepTicks:= cHHStepTicks;
-   if PrevdX <> hwSign(Gear^.dX) then
-      begin
-      FollowGear:= Gear;
-      exit
-      end;
-   DeleteCI(Gear); // must be after exit!! (see previous line)
-
-   Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
-   if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
-      begin
-      if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX))
-         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
-      if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX))
-         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
-      if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX))
-         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
-      if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
-         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
-      if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
-         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
-      if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
-         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
-      end;
-
-   if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then
-      Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX);
-
-   SetAllHHToActive;
-
-   if TestCollisionYwithGear(Gear, 1) = 0 then
-   begin
-   Gear^.Y:= Gear^.Y + _1;
-   if TestCollisionYwithGear(Gear, 1) = 0 then
-   begin
-   Gear^.Y:= Gear^.Y + _1;
-   if TestCollisionYwithGear(Gear, 1) = 0 then
-   begin
-   Gear^.Y:= Gear^.Y + _1;
-   if TestCollisionYwithGear(Gear, 1) = 0 then
-   begin
-   Gear^.Y:= Gear^.Y + _1;
-   if TestCollisionYwithGear(Gear, 1) = 0 then
-   begin
-   Gear^.Y:= Gear^.Y + _1;
-   if TestCollisionYwithGear(Gear, 1) = 0 then
-   begin
-   Gear^.Y:= Gear^.Y + _1;
-   if TestCollisionYwithGear(Gear, 1) = 0 then
-      begin
-      Gear^.Y:= Gear^.Y - _6;
-      Gear^.dY:= _0;
-      Gear^.State:= Gear^.State or gstMoving;
-      exit
-      end;
-   end
-   end
-   end
-   end
-   end
-   end;
-   AddGearCI(Gear)
-   end
-end;
-
-procedure HedgehogChAngle(HHGear: PGear);
-var da: LongWord;
-begin
-with HHGear^.Hedgehog^ do
-    if ((CurAmmoType = amRope) and 
-        ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) or
-       ((CurAmmoType = amPortalGun) and 
-        ((HHGear^.State and gstMoving) <> 0)) then da:= 2
-    else da:= 1;
-
-if (((HHGear^.Message and gmPrecise) = 0) or ((GameTicks mod 5) = 1)) then
-    if ((HHGear^.Message and gmUp) <> 0) and (HHGear^.Angle >= CurMinAngle + da) then dec(HHGear^.Angle, da)
-    else
-    if ((HHGear^.Message and gmDown) <> 0) and (HHGear^.Angle + da <= CurMaxAngle) then inc(HHGear^.Angle, da)
-end;
-
-procedure doStepHedgehog(Gear: PGear); forward;
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepHedgehogMoving(Gear: PGear);
-var isFalling, isUnderwater: boolean;
-    land: Word;
-begin
-land:= 0;
-isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius;
-if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862;
-if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862;
-
-if Gear^.Hedgehog^.Unplaced then
-   begin
-   Gear^.dY:= _0;
-   Gear^.dX:= _0;
-   Gear^.State:= Gear^.State and not gstMoving;
-   exit
-   end;
-isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1);
-if isFalling then
-   begin
-   if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then Gear^.dY:= _0;
-   Gear^.State:= Gear^.State or gstMoving;
-   if (CurrentHedgehog^.Gear = Gear)
-        and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then 
-        begin
-        FollowGear:= Gear;
-        end;
-   if isUnderwater then Gear^.dY:= Gear^.dY + cGravity / _2
-   else
-       begin
-       Gear^.dY:= Gear^.dY + cGravity;
-// this set of circumstances could be less complex if jumping was more clearly identified
-       if ((GameFlags and gfMoreWind) <> 0) and 
-          (((Gear^.Damage <> 0) or
-          ((CurAmmoGear <> nil) and
-            ((CurAmmoGear^.AmmoType = amJetpack) or
-            (CurAmmoGear^.AmmoType = amBirdy))) or
-          ((Gear^.dY.QWordValue + Gear^.dX.QWordValue) > _0_55.QWordValue)))
-          then Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
-       end
-   end 
-else
-   begin
-   land:= TestCollisionYwithGear(Gear, 1);
-   if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) and ((land and lfIce) = 0)
-      and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
-
-   if not Gear^.dY.isNegative then
-      begin
-      CheckHHDamage(Gear);
-
-      if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) and
-         (Gear^.dX.QWordValue < _0_02.QWordValue) then Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump
-
-      Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump);
-      Gear^.dY:= _0;
-      end else Gear^.dY:= Gear^.dY + cGravity;
-
-   if ((Gear^.State and gstMoving) <> 0) then
-       begin
-       if land and lfIce <> 0 then
-           begin
-           Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2)
-           end
-       else Gear^.dX:= Gear^.dX * Gear^.Friction;
-       end
-   end;
-
-if (Gear^.State <> 0) then DeleteCI(Gear);
-
-if isUnderwater then
-   begin
-   Gear^.dY:= Gear^.dY * _0_999;
-   Gear^.dX:= Gear^.dX * _0_999;
-   end;
-
-if (Gear^.State and gstMoving) <> 0 then
-   if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then
-      if not isFalling then
-         if hwAbs(Gear^.dX) > _0_01 then
-            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -1, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_96; Gear^.Y:= Gear^.Y - _1 end else
-            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -2, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_93; Gear^.Y:= Gear^.Y - _2 end else
-            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_9 ; Gear^.Y:= Gear^.Y - _3 end else
-            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_87; Gear^.Y:= Gear^.Y - _4 end else
-            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_84; Gear^.Y:= Gear^.Y - _5 end else
-            if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX
-                                   else begin
-                                        Gear^.State:= Gear^.State and not gstMoving;
-                                        while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1;
-                                        SetLittle(Gear^.dX)
-                                        end
-            else begin
-                 Gear^.State:= Gear^.State and not gstMoving;
-                 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1;
-                 SetLittle(Gear^.dX)
-                 end
-         else if (hwAbs(Gear^.dX) > cLittle)
-                and ((Gear^.State and gstHHJumping) = 0)
-                then Gear^.dX:= -Gear^.Elasticity * Gear^.dX
-                else SetLittle(Gear^.dX);
-
-if (not isFalling) and
-   (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
-   begin
-   Gear^.State:= Gear^.State and not gstWinner;
-   Gear^.State:= Gear^.State and not gstMoving;
-   while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1;
-   SetLittle(Gear^.dX);
-   Gear^.dY:= _0
-   end else Gear^.State:= Gear^.State or gstMoving;
-
-if (Gear^.State and gstMoving) <> 0 then
-   begin
-   Gear^.State:= Gear^.State and not gstAnimation;
-// ARTILLERY but not being moved by explosions
-   Gear^.X:= Gear^.X + Gear^.dX;
-   Gear^.Y:= Gear^.Y + Gear^.dY;
-   if (not Gear^.dY.isNegative) and
-      (not TestCollisionYKick(Gear, 1)) and
-       TestCollisionYwithXYShift(Gear, 0, 1, 1) then
-      begin
-      CheckHHDamage(Gear);
-      Gear^.dY:= _0;
-      Gear^.Y:= Gear^.Y + _1
-      end;
-   CheckGearDrowning(Gear);
-   // hide target cursor if current hog is drowning
-   if (Gear^.State and gstDrowning) <> 0 then
-       if (CurrentHedgehog^.Gear = Gear) then
-          isCursorVisible:= false
-   end;
-
-if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then
-    begin
-    inc(Gear^.FlightTime);
-    if Gear^.FlightTime = 3000 then
-        begin
-        AddCaption(GetEventString(eidHomerun), cWhiteColor, capgrpMessage);
-        PlaySound(sndHomerun)
-        end;
-    end
-else
-    begin
-    uStats.hedgehogFlight(Gear, Gear^.FlightTime);
-    Gear^.FlightTime:= 0;
-    end;
-
-end;
-
-procedure doStepHedgehogDriven(HHGear: PGear);
-var t: PGear;
-    wasJumping: boolean;
-    Hedgehog: PHedgehog;
-begin
-Hedgehog:= HHGear^.Hedgehog;
-if isInMultiShoot then
-   HHGear^.Message:= 0;
-
-if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Utility) <> 0) and isInMultiShoot then 
-    AllInactive:= true
-else if not isInMultiShoot then AllInactive:= false;
-
-if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then
-    begin
-    if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft;
-    TurnTimeLeft:= 0;
-    isCursorVisible:= false;
-    HHGear^.State:= HHGear^.State and not (gstHHDriven or gstAnimation or gstAttacking);
-    AttackBar:= 0;
-    if HHGear^.Damage > 0 then
-        HHGear^.State:= HHGear^.State and not (gstHHJumping or gstHHHJump);
-    exit
-    end;
-
-if (HHGear^.State and gstAnimation) <> 0 then
-    begin
-    HHGear^.Message:= 0;
-    if (HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].VoiceDelay) and (HHGear^.Timer = 0) then PlaySound(Wavez[TWave(HHGear^.Tag)].Voice, Hedgehog^.Team^.voicepack);
-    inc(HHGear^.Timer);
-    if HHGear^.Timer = Wavez[TWave(HHGear^.Tag)].Interval then
-        begin
-        HHGear^.Timer:= 0;
-        inc(HHGear^.Pos);
-        if HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].FramesCount then
-            HHGear^.State:= HHGear^.State and not gstAnimation
-        end;
-    exit
-    end;
-
-if ((HHGear^.State and gstMoving) <> 0)
-    or (StepTicks = cHHStepTicks)
-    or (CurAmmoGear <> nil) then // we are moving
-    begin
-    with Hedgehog^ do
-        if (CurAmmoGear = nil)
-        and (HHGear^.dY > _0_39)
-        and (CurAmmoType = amParachute) then HHGear^.Message:= HHGear^.Message or gmAttack;
-    // check for case with ammo
-    t:= CheckGearNear(HHGear, gtCase, 36, 36);
-    if t <> nil then
-        PickUp(HHGear, t)
-    end;
-
-if (CurAmmoGear = nil) then
-    if (((HHGear^.Message and gmAttack) <> 0)
-        or ((HHGear^.State and gstAttacking) <> 0)) then
-        Attack(HHGear) // should be before others to avoid desync with '/put' msg and changing weapon msgs
-    else
-else 
-    with Hedgehog^ do
-        if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)
-            and ((HHGear^.Message and gmLJump) <> 0)
-            and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
-            begin
-            Attack(HHGear);
-            HHGear^.Message:= HHGear^.Message and not gmLJump
-            end;
-
-if (CurAmmoGear = nil)
-    or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) 
-    or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then
-    begin
-    if ((HHGear^.Message and gmSlot) <> 0) then
-        if ChangeAmmo(HHGear) then ApplyAmmoChanges(Hedgehog^);
-
-    if ((HHGear^.Message and gmWeapon) <> 0) then HHSetWeapon(HHGear);
-
-    if ((HHGear^.Message and gmTimer) <> 0) then HHSetTimer(HHGear);
-    end;
-
-if CurAmmoGear <> nil then
-   begin
-   CurAmmoGear^.Message:= HHGear^.Message;
-   exit
-   end;
-
-if not isInMultiShoot then
-   HedgehogChAngle(HHGear);
-
-if (HHGear^.State and gstMoving) <> 0 then
-    begin
-    wasJumping:= ((HHGear^.State and gstHHJumping) <> 0);
-
-    if ((HHGear^.Message and gmHJump) <> 0) and
-        wasJumping and
-        ((HHGear^.State and gstHHHJump) = 0) then
-        if (not (hwAbs(HHGear^.dX) > cLittle)) and (HHGear^.dY < -_0_02) then
-            begin
-            HHGear^.State:= HHGear^.State or gstHHHJump;
-            HHGear^.dY:= -_0_25;
-            if not cArtillery then HHGear^.dX:= -SignAs(_0_02, HHGear^.dX);
-            PlaySound(sndJump2, Hedgehog^.Team^.voicepack)
-            end;
-
-    HHGear^.Message:= HHGear^.Message and not (gmLJump or gmHJump);
-
-    if (not cArtillery) and wasJumping and
-        TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX);
-
-    if Hedgehog^.Gear <> nil then doStepHedgehogMoving(HHGear);
-
-    if ((HHGear^.State and (gstMoving or gstDrowning)) = 0) then
-        begin
-        AddGearCI(HHGear);
-        if wasJumping then
-            StepTicks:= 410
-        else
-            StepTicks:= 95
-        end;
-    exit
-    end;
-
-    if not isInMultiShoot and (Hedgehog^.Gear <> nil) then
-        begin
-        if StepTicks > 0 then dec(StepTicks);
-        if (StepTicks = 0) then HedgehogStep(HHGear)
-        end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepHedgehogFree(Gear: PGear);
-var prevState: Longword;
-begin
-prevState:= Gear^.State;
-
-doStepHedgehogMoving(Gear);
-
-if (Gear^.State and (gstMoving or gstDrowning)) <> 0 then
-    begin
-    if Gear^.Damage > 0 then CalcRotationDirAngle(Gear);
-    AllInactive:= false;
-    exit
-    end;
-
-if (Gear^.Health = 0) then
-    begin
-    if PrvInactive or ((GameFlags and gfInfAttack) <> 0) then
-        begin
-        Gear^.Timer:= 0;
-        FollowGear:= Gear;
-        PrvInactive:= false;
-        AllInactive:= false;
-
-        if (Gear^.State and gstHHGone) = 0 then
-            begin
-            Gear^.Hedgehog^.Effects[hePoisoned] := false;
-            if Gear^.Hedgehog^.Effects[heResurrectable] then begin
-                ResurrectHedgehog(Gear);
-            end else 
-                begin
-                Gear^.State:= (Gear^.State or gstHHDeath) and not gstAnimation;
-                Gear^.doStep:= @doStepHedgehogDead;
-                // Death message
-                AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
-                end;
-            end
-        else
-            begin
-            Gear^.State:= Gear^.State and not gstAnimation;
-            Gear^.doStep:= @doStepHedgehogGone;
-
-            // Gone message
-            AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
-            end
-        end;
-    exit
-    end;
-
-if ((Gear^.State and gstWait) = 0) and
-    (prevState <> Gear^.State) then
-    begin
-    Gear^.State:= Gear^.State or gstWait;
-    Gear^.Timer:= 150
-    end else
-    begin
-    if Gear^.Timer = 0 then
-        begin
-        Gear^.State:= Gear^.State and not (gstWait or gstLoser or gstWinner or gstAttacked or gstNotKickable or gstHHChooseTarget);
-        Gear^.Active:= false;
-        AddGearCI(Gear);
-        exit
-        end else dec(Gear^.Timer)
-    end;
-
-AllInactive:= false
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepHedgehog(Gear: PGear);
-(*
-var x,y,tx,ty: LongInt;
-    tdX, tdY, slope: hwFloat; 
-    land: Word; *)
-var slope: hwFloat; 
-begin
-if (Gear^.Message and gmDestroy) <> 0 then
-    begin
-    DeleteGear(Gear);
-    exit
-    end;
-
-if (Gear^.State and gstHHDriven) = 0 then
-    doStepHedgehogFree(Gear)
-else
-    begin
-    with Gear^.Hedgehog^ do
-        if Team^.hasGone then
-            TeamGoneEffect(Team^)
-        else
-            doStepHedgehogDriven(Gear)
-    end;
-if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0) and
-   (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0) and
-   not Gear^.dY.isNegative and
-   (GameTicks mod (100*LongWOrd(hwRound(cMaxWindSpeed*2/cGravity))) = 0) and
-   (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then
-    begin
-    slope:= CalcSlopeBelowGear(Gear);
-    Gear^.dX:=Gear^.dX+slope*_0_07;
-    if slope.QWordValue <> 0 then Gear^.State:= Gear^.State or gstMoving;
-(*
-    x:= hwRound(Gear^.X);
-    y:= hwRound(Gear^.Y);
-    AddVisualGear(x, y, vgtSmokeTrace);
-    AddVisualGear(x - hwRound(_5*slope), y + hwRound(_5*slope), vgtSmokeTrace);
-    AddVisualGear(x + hwRound(_5*slope), y - hwRound(_5*slope), vgtSmokeTrace);
-    AddVisualGear(x - hwRound(_20 * slope), y + hwRound(_20 * slope), vgtSmokeTrace);
-    AddVisualGear(x + hwRound(_20 * slope), y - hwRound(_20 * slope), vgtSmokeTrace);
-    AddVisualGear(x - hwRound(_30 * slope), y + hwRound(_30 * slope), vgtSmokeTrace);
-    AddVisualGear(x + hwRound(_30 * slope), y - hwRound(_30 * slope), vgtSmokeTrace);
-    AddVisualGear(x - hwRound(_40 * slope), y + hwRound(_40 * slope), vgtSmokeTrace);
-    AddVisualGear(x + hwRound(_40 * slope), y - hwRound(_40 * slope), vgtSmokeTrace);
-    AddVisualGear(x - hwRound(_50 * slope), y + hwRound(_50 * slope), vgtSmokeTrace);
-    AddVisualGear(x + hwRound(_50 * slope), y - hwRound(_50 * slope), vgtSmokeTrace); *)
-    end
-end;
--- a/hedgewars/LuaPas.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/LuaPas.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -15,7 +15,7 @@
 {$INCLUDE "config.inc"}
 
 type
-  size_t   = type Cardinal;
+  size_t   = Cardinal;
   Psize_t  = ^size_t;
   PPointer = ^Pointer;
 
@@ -45,8 +45,8 @@
 ** ===================================================================
 *)
 type
-  LUA_NUMBER_  = type Double;            // ending underscore is needed in Pascal
-  LUA_INTEGER_ = type PtrInt;
+  LUA_NUMBER_  = Double;            // ending underscore is needed in Pascal
+  LUA_INTEGER_ = PtrInt;
 
 (*
 @@ LUA_IDSIZE gives the maximum size for the description of the source
@@ -115,7 +115,7 @@
   LUA_AUTHORS     = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes';
 
   (* mark for precompiled code (`<esc>Lua') *)
-  LUA_SIGNATURE = #27'Lua';
+  LUA_SIGNATURE = #27 + 'Lua';
 
   (* option for multiple returns in `lua_pcall' and `lua_call' *)
   LUA_MULTRET = -1;
@@ -429,8 +429,8 @@
 function lua_getgccount(L : Plua_State) : LongInt;
 
 type
-  lua_Chuckreader = type lua_Reader;
-  lua_Chuckwriter = type lua_Writer;
+  lua_Chuckreader = lua_Reader;
+  lua_Chuckwriter = lua_Writer;
 
 (* ====================================================================== *)
 
@@ -983,7 +983,7 @@
 begin
   if not(B^.p < B^.buffer + LUAL_BUFFERSIZE) then
     luaL_prepbuffer(B);
-  B^.p^ := c;
+  (B^.p^) := c;
   Inc(B^.p);
 end;
 
--- a/hedgewars/PascalExports.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/PascalExports.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -32,6 +32,10 @@
 
 {$INCLUDE "config.inc"}
 procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export;
+function HW_getNumberOfWeapons:LongInt; cdecl; export;
+function HW_getMaxNumberOfTeams:LongInt; cdecl; export;
+function HW_getMaxNumberOfHogs:LongInt; cdecl; export;
+procedure HW_terminate(closeFrontend: Boolean); cdecl; export;
 
 implementation
 {$IFDEF HWLIBRARY}
--- a/hedgewars/SDLh.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/SDLh.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -41,7 +41,9 @@
   {$IFDEF HAIKU}
     {$linklib root}
   {$ELSE}
-    {$linklib pthread}
+    {$IFNDEF ANDROID}
+      {$linklib pthread}
+    {$ENDIF}
   {$ENDIF}
 {$ENDIF}
 
@@ -858,7 +860,9 @@
 procedure SDL_StartTextInput; cdecl; external SDLLibName;
 
 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName;
+function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName;
 {$ELSE}
+function  SDL_CreateThread(fn: Pointer; data: Pointer): PSDL_Thread; cdecl; external SDLLibName;
 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; mask: LongWord): LongInt; cdecl; external SDLLibName;
 {$ENDIF}
 
@@ -876,6 +880,7 @@
 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
 function  SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
 
+procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName;
 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
 function  SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP';
--- a/hedgewars/hwLibrary.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/hwLibrary.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -17,15 +17,43 @@
  *)
 
 Library hwLibrary;
+{$INCLUDE "options.inc"}
 
-// Add all your Pascal units to the "uses" clause below to add them to the program.
+// Add all your Pascal units to the 'uses' clause below to add them to the program.
 // Mark all Pascal procedures/functions that you wish to call from C/C++/Objective-C code using
-// "cdecl; export;" (see the fpclogo.pas unit for an example), and then add C-declarations for
-// these procedures/functions to the PascalImports.h file (also in the "Pascal Sources" group)
+// 'cdecl; export;' (see the fpclogo.pas unit for an example), and then add C-declarations for
+// these procedures/functions to the PascalImports.h file (also in the 'Pascal Sources' group)
 // to make these functions available in the C/C++/Objective-C source files
-// (add "#include PascalImports.h" near the top of these files if it's not there yet)
-uses PascalExports, hwengine;
+// (add '#include PascalImports.h' near the top of these files if it is not there yet)
+uses PascalExports, hwengine{$IFDEF ANDROID}, jni{$ENDIF};
 exports Game, HW_versionInfo;
+
+{$IFDEF ANDROID}
+function JNI_HW_versionInfoNet(env: PJNIEnv; obj: JObject):JInt;cdecl;
+begin
+    env:= env; // avoid hint
+    obj:= obj; // avoid hint
+    JNI_HW_versionInfoNet:= cNetProtoVersion;
+end;
+
+function JNI_HW_versionInfoVersion(env: PJNIEnv; obj: JObject):JString; cdecl;
+var envderef : JNIEnv;
+begin
+    obj:= obj; // avoid hint
+    envderef:= @env;
+    JNI_HW_versionInfoVersion := envderef^.NewStringUTF(env, PChar(cVersionString));
+end;
+
+exports
+    JNI_HW_versionInfoNet name Java_Prefix+'HWversionInfoNetProto', 
+    JNI_HW_versionInfoVersion name Java_Prefix+'HWversionInfoVersion', 
+    GenLandPreview name Java_Prefix + 'GenLandPreview',
+    HW_getNumberOfweapons name Java_Prefix + 'HWgetNumberOfWeapons',
+    HW_getMaxNumberOfHogs name Java_Prefix + 'HWgetMaxNumberOfHogs',
+    HW_getMaxNumberOfTeams name Java_Prefix + 'HWgetMaxNumberOfTeams',
+    HW_terminate name Java_Prefix + 'HWterminate';
+{$ENDIF}
+
 begin
 
 end.
--- a/hedgewars/hwengine.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/hwengine.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -31,12 +31,14 @@
 
 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound,
      uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions,
-     sysutils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted;
+     sysutils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted
+     {$IFDEF SDL13}, uTouch{$ENDIF}{$IFDEF ANDROID}, GLUnit{$ENDIF};
 
 {$IFDEF HWLIBRARY}
 procedure initEverything(complete:boolean);
 procedure freeEverything(complete:boolean);
 procedure Game(gameArgs: PPChar); cdecl; export;
+procedure GenLandPreview(port: Longint); cdecl; export;
 
 implementation
 {$ELSE}
@@ -187,6 +189,9 @@
                         cScreenResizeDelay:= RealTicks+500;
                         *)
                         end;
+                SDL_FINGERMOTION: onTouchMotion(event.tfinger.x, event.tfinger.y,event.tfinger.dx, event.tfinger.dy, event.tfinger.fingerId);
+                SDL_FINGERDOWN: onTouchDown(event.tfinger.x, event.tfinger.y, event.tfinger.fingerId);
+                SDL_FINGERUP: onTouchUp(event.tfinger.x, event.tfinger.y, event.tfinger.fingerId);
 {$ELSE}
                 SDL_KEYDOWN: if GameState = gsChat then
                     KeyPressChat(event.key.keysym.unicode);
@@ -254,8 +259,6 @@
     cBits:= 32;
     cFullScreen:= false;
     cTimerInterval:= 8;
-    PathPrefix:= 'Data';
-    UserPathPrefix:= '../Documents';
     cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF};
     val(gameArgs[0], ipcPort);
     val(gameArgs[1], cScreenWidth);
@@ -268,7 +271,8 @@
     isSoundEnabled:= gameArgs[6] = '1';
     isMusicEnabled:= gameArgs[7] = '1';
     cAltDamage:= gameArgs[8] = '1';
-    val(gameArgs[9], rotationQt);
+    PathPrefix:= gameArgs[9];
+    UserPathPrefix:= '../Documents';
     recordFileName:= gameArgs[10];
     cStereoMode:= smNone;
 {$ENDIF}
@@ -278,7 +282,6 @@
     cOrigScreenHeight:= cScreenHeight;
 
     initEverything(true);
-
     WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
     AddFileLog('Prefix: "' + PathPrefix +'"');
     AddFileLog('UserPrefix: "' + UserPathPrefix +'"');
@@ -384,6 +387,8 @@
 
     if complete then
     begin
+{$IFDEF ANDROID}GLUnit.init;{$ENDIF}
+{$IFDEF SDL13}uTouch.initModule;{$ENDIF}
         uAI.initModule;
         //uAIActions does not need initialization
         //uAIAmmoTests does not need initialization
--- a/hedgewars/options.inc	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/options.inc	Mon Dec 05 18:38:07 2011 -0500
@@ -27,16 +27,29 @@
 
 {$DEFINE GLunit:=GL}
 
+{$IFDEF ANDROID}
+  {$DEFINE SDL13}
+  {$DEFINE HWLIBRARY}
+  {$DEFINE S3D_DISABLED}
+  {$DEFINE GLunit:=gles11}
+  {$DEFINE MOBILE}
+  {$DEFINE Java_Prefix := 'Java_org_hedgewars_hedgeroid_EngineProtocol_PascalExports_'}
+  {$DEFINE USE_SDLTHREADS}
+{$ENDIF}
+
 {$IFDEF IPHONEOS}
   {$DEFINE SDL13}
   {$DEFINE HWLIBRARY}
   {$DEFINE S3D_DISABLED}
   {$DEFINE GLunit:=gles11}
-{$ELSE}
+  {$DEFINE MOBILE}
+{$ENDIF}
+
+{$IFNDEF IPHONEOS}
+  // not needed on ios because it is switched from the compiler command line arguments
   {$DEFINE DEBUGFILE}
   //{$DEFINE TRACEAIACTIONS}
   //{$DEFINE COUNTTICKS}
 {$ENDIF}
 
-
 //also available LUA_DISABLED
--- a/hedgewars/uAI.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uAI.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -30,13 +30,17 @@
 
 implementation
 uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions,
-     uAmmos, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes,
+     uAmmos, SysUtils{$IFNDEF USE_SDLTHREADS} {$IFDEF UNIX}, cthreads{$ENDIF} {$ENDIF}, uTypes,
      uVariables, uCommands, uUtils, uDebug;
 
 var BestActions: TActions;
     CanUseAmmo: array [TAmmoType] of boolean;
     StopThinking: boolean;
+{$IFDEF USE_SDLTHREADS} 
+    ThinkThread: PSDL_Thread = nil;
+{$ELSE}
     ThinkThread: TThreadID;
+{$ENDIF}
     hasThread: LongInt;
 
 procedure FreeActionsList;
@@ -117,9 +121,11 @@
        with CurrentHedgehog^ do
             a:= CurAmmoType;
        aa:= a;
-       
+{$IFDEF USE_SDLTHREADS}
+       SDL_delay(0);    //ThreadSwitch was only a hint
+{$ELSE}
        ThreadSwitch();
-       
+{$ENDIF}       
        repeat
         if (CanUseAmmo[a]) and
            ((not isMoved) or ((AmmoTests[a].flags and amtest_OnTurn) = 0)) then
@@ -366,7 +372,12 @@
 
 FillBonuses((Me^.State and gstAttacked) <> 0);
 AddFileLog('Enter Think Thread');
-BeginThread(@Think, Me, ThinkThread)
+{$IFDEF USE_SDLTHREADS}
+ThinkThread := SDL_CreateThread(@Think{$IFDEF SDL13}, nil{$ENDIF}, Me);
+{$ELSE}
+BeginThread(@Think, Me, ThinkThread);
+{$ENDIF}
+AddFileLog('Thread started');
 end;
 
 procedure ProcessBot;
@@ -397,6 +408,7 @@
 procedure initModule;
 begin
     hasThread:= 0;
+    ThinkThread:= ThinkThread;
 end;
 
 procedure freeModule;
--- a/hedgewars/uAIActions.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uAIActions.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -119,28 +119,27 @@
      end
 end;
 
+procedure CheckHang(Me: PGear);
+const PrevX: LongInt = 0;
+      timedelta: Longword = 0;
+begin
+if hwRound(Me^.X) <> PrevX then
+   begin
+   PrevX:= hwRound(Me^.X);
+   timedelta:= 0
+   end else
+   begin
+   inc(timedelta);
+   if timedelta > 1700 then
+      begin
+      timedelta:= 0;
+      FreeActionsList
+      end
+   end
+end;
+
 procedure ProcessAction(var Actions: TActions; Me: PGear);
 var s: shortstring;
-
-    procedure CheckHang;
-    const PrevX: LongInt = 0;
-          timedelta: Longword = 0;
-    begin
-    if hwRound(Me^.X) <> PrevX then
-       begin
-       PrevX:= hwRound(Me^.X);
-       timedelta:= 0
-       end else
-       begin
-       inc(timedelta);
-       if timedelta > 1700 then
-          begin
-          timedelta:= 0;
-          FreeActionsList
-          end
-       end
-    end;
-
 begin
 repeat
 if Actions.Pos >= Actions.Count then exit;
@@ -165,7 +164,7 @@
                                FreeActionsList;
                                exit
                                end
-                          else begin CheckHang; exit end;
+                          else begin CheckHang(Me); exit end;
            aia_WaitXR: if hwRound(Me^.X) = Param then
                           begin
                           Action:= aia_LookRight;
@@ -178,7 +177,7 @@
                                FreeActionsList;
                                exit
                                end
-                          else begin CheckHang; exit end;
+                          else begin CheckHang(Me); exit end;
          aia_LookLeft: if not Me^.dX.isNegative then
                           begin
                           ParseCommand('+left', true);
--- a/hedgewars/uAIAmmoTests.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uAIAmmoTests.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -124,33 +124,11 @@
 function TestBazooka(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
 var Vx, Vy, r, mX, mY: real;
     rTime: LongInt;
-    Score, EX, EY: LongInt;
+    EX, EY: LongInt;
     valueResult: LongInt;
-
-    function CheckTrace: LongInt;
-    var x, y, dX, dY: real;
-        t: LongInt;
-        value: LongInt;
-    begin
-    x:= mX;
-    y:= mY;
-    dX:= Vx;
-    dY:= -Vy;
-    t:= rTime;
-    repeat
-      x:= x + dX;
-      y:= y + dY;
-      dX:= dX + cWindSpeedf;
-      dY:= dY + cGravityf;
-      dec(t)
-    until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0);
-    EX:= trunc(x);
-    EY:= trunc(y);
-    value:= RateExplosion(Me, EX, EY, 101);
-    if value = 0 then value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64;
-    CheckTrace:= value;
-    end;
-
+    x, y, dX, dY: real;
+    t: LongInt;
+    value: LongInt;
 begin
 mX:= hwFloat2Float(Me^.X);
 mY:= hwFloat2Float(Me^.Y);
@@ -165,15 +143,30 @@
   r:= sqrt(sqr(Vx) + sqr(Vy));
   if not (r > 1) then
      begin
-     Score:= CheckTrace;
-     if valueResult <= Score then
+        x:= mX;
+        y:= mY;
+        dX:= Vx;
+        dY:= -Vy;
+        t:= rTime;
+        repeat
+              x:= x + dX;
+              y:= y + dY;
+              dX:= dX + cWindSpeedf;
+              dY:= dY + cGravityf;
+              dec(t)
+        until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0);
+        EX:= trunc(x);
+        EY:= trunc(y);
+        value:= RateExplosion(Me, EX, EY, 101);
+        if value = 0 then value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64;
+     if valueResult <= value then
         begin
         ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
         ap.Power:= trunc(r * cMaxPower) - random((Level - 1) * 17 + 1);
         ap.ExplR:= 100;
         ap.ExplX:= EX;
         ap.ExplY:= EY;
-        valueResult:= Score
+        valueResult:= value
         end;
      end
 until (rTime > 4250);
@@ -183,32 +176,11 @@
 function TestSnowball(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
 var Vx, Vy, r: hwFloat;
     rTime: LongInt;
-    Score, EX, EY: LongInt;
+    EX, EY: LongInt;
     valueResult: LongInt;
-
-    function CheckTrace: LongInt;
-    var x, y, dX, dY: hwFloat;
-        t: LongInt;
-        value: LongInt;
-    begin
-    x:= Me^.X;
-    y:= Me^.Y;
-    dX:= Vx;
-    dY:= -Vy;
-    t:= rTime;
-    repeat
-      x:= x + dX;
-      y:= y + dY;
-      dX:= dX + cWindSpeed;
-      dY:= dY + cGravity;
-      dec(t)
-    until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t <= 0);
-    EX:= hwRound(x);
-    EY:= hwRound(y);
-    value:= RateExplosion(Me, EX, EY, 5);
-    if value = 0 then value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64;
-    CheckTrace:= value;
-    end;
+    x, y, dX, dY: hwFloat;
+    t: LongInt;
+    value: LongInt;
 
 begin
 ap.Time:= 0;
@@ -222,16 +194,32 @@
   r:= Distance(Vx, Vy);
   if not (r > _1) then
      begin
-     Score:= CheckTrace;
-     if valueResult <= Score then
-        begin
-        ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
-        ap.Power:= hwRound(r * cMaxPower) - random((Level - 1) * 17 + 1);
-        ap.ExplR:= 100;
-        ap.ExplX:= EX;
-        ap.ExplY:= EY;
-        valueResult:= Score
-        end;
+        x:= Me^.X;
+        y:= Me^.Y;
+        dX:= Vx;
+        dY:= -Vy;
+        t:= rTime;
+        repeat
+          x:= x + dX;
+          y:= y + dY;
+          dX:= dX + cWindSpeed;
+          dY:= dY + cGravity;
+          dec(t)
+        until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t <= 0);
+        EX:= hwRound(x);
+        EY:= hwRound(y);
+        value:= RateExplosion(Me, EX, EY, 5);
+        if value = 0 then value:= - Metric(Targ.X, Targ.Y, EX, EY) div 64;
+
+        if valueResult <= value then
+            begin
+            ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
+            ap.Power:= hwRound(r * cMaxPower) - random((Level - 1) * 17 + 1);
+            ap.ExplR:= 100;
+            ap.ExplX:= EX;
+            ap.ExplY:= EY;
+            valueResult:= value
+            end;
      end
 until (rTime > 4250);
 TestSnowball:= valueResult
@@ -241,26 +229,8 @@
 var Vx, Vy, r: hwFloat;
     Score, EX, EY, valueResult: LongInt;
     TestTime: Longword;
-
-    function CheckTrace: LongInt;
-    var x, y, dY: hwFloat;
-        t: LongInt;
-    begin
-    x:= Me^.X;
-    y:= Me^.Y;
-    dY:= -Vy;
-    t:= TestTime;
-    repeat
-      x:= x + Vx;
-      y:= y + dY;
-      dY:= dY + cGravity;
-      dec(t)
-    until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 7) or (t = 0);
-    EX:= hwRound(x);
-    EY:= hwRound(y);
-    if t < 50 then CheckTrace:= RateExplosion(Me, EX, EY, 97)  // average of 17 attempts, most good, but some failing spectacularly
-              else CheckTrace:= BadTurn
-    end;
+    x, y, dY: hwFloat;
+    t: LongInt;
 begin
 valueResult:= BadTurn;
 TestTime:= 0;
@@ -272,17 +242,31 @@
   r:= Distance(Vx, Vy);
   if not (r > _1) then
      begin
-     Score:= CheckTrace;
-     if valueResult < Score then
-        begin
-        ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level));
-        ap.Power:= hwRound(r * cMaxPower) + AIrndSign(random(Level) * 15);
-        ap.Time:= TestTime;
-        ap.ExplR:= 100;
-        ap.ExplX:= EX;
-        ap.ExplY:= EY;
-        valueResult:= Score
-        end;
+        x:= Me^.X;
+        y:= Me^.Y;
+        dY:= -Vy;
+        t:= TestTime;
+        repeat
+          x:= x + Vx;
+          y:= y + dY;
+          dY:= dY + cGravity;
+          dec(t)
+        until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 7) or (t = 0);
+        EX:= hwRound(x);
+        EY:= hwRound(y);
+        if t < 50 then Score:= RateExplosion(Me, EX, EY, 97)  // average of 17 attempts, most good, but some failing spectacularly
+                  else Score:= BadTurn;
+                  
+        if valueResult < Score then
+            begin
+            ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level));
+            ap.Power:= hwRound(r * cMaxPower) + AIrndSign(random(Level) * 15);
+            ap.Time:= TestTime;
+            ap.ExplR:= 100;
+            ap.ExplX:= EX;
+            ap.ExplY:= EY;
+            valueResult:= Score
+            end;
      end
 until (TestTime > 4250);
 TestMolotov:= valueResult
@@ -293,26 +277,8 @@
 var Vx, Vy, r: hwFloat;
     Score, EX, EY, valueResult: LongInt;
     TestTime: Longword;
-
-    function CheckTrace: LongInt;
-    var x, y, dY: hwFloat;
-        t: LongInt;
-    begin
-    x:= Me^.X;
-    y:= Me^.Y;
-    dY:= -Vy;
-    t:= TestTime;
-    repeat
-      x:= x + Vx;
-      y:= y + dY;
-      dY:= dY + cGravity;
-      dec(t)
-    until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t = 0);
-    EX:= hwRound(x);
-    EY:= hwRound(y);
-    if t < 50 then CheckTrace:= RateExplosion(Me, EX, EY, 101)
-              else CheckTrace:= BadTurn
-    end;
+    x, y, dY: hwFloat;
+    t: LongInt;
 begin
 valueResult:= BadTurn;
 TestTime:= 0;
@@ -323,9 +289,25 @@
   Vy:= cGravity * ((TestTime + tDelta) div 2) - (int2hwFloat(Targ.Y) - Me^.Y) / int2hwFloat(TestTime + tDelta);
   r:= Distance(Vx, Vy);
   if not (r > _1) then
-     begin
-     Score:= CheckTrace;
-     if valueResult < Score then
+    begin
+    x:= Me^.X;
+    y:= Me^.Y;
+    dY:= -Vy;
+    t:= TestTime;
+    repeat
+        x:= x + Vx;
+        y:= y + dY;
+        dY:= dY + cGravity;
+        dec(t)
+    until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t = 0);
+    EX:= hwRound(x);
+    EY:= hwRound(y);
+    if t < 50 then 
+        Score:= RateExplosion(Me, EX, EY, 101)
+    else 
+        Score:= BadTurn;
+
+    if valueResult < Score then
         begin
         ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level));
         ap.Power:= hwRound(r * cMaxPower) + AIrndSign(random(Level) * 15);
@@ -335,7 +317,7 @@
         ap.ExplY:= EY;
         valueResult:= Score
         end;
-     end
+    end
 until (TestTime = 4000);
 TestGrenade:= valueResult
 end;
@@ -345,26 +327,8 @@
 var Vx, Vy, r: hwFloat;
     Score, EX, EY, valueResult: LongInt;
     TestTime: Longword;
-
-    function CheckTrace: LongInt;
-    var x, y, dY: hwFloat;
-        t: LongInt;
-    begin
-    x:= Me^.X;
-    y:= Me^.Y;
-    dY:= -Vy;
-    t:= TestTime;
-    repeat
-      x:= x + Vx;
-      y:= y + dY;
-      dY:= dY + cGravity;
-      dec(t)
-    until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t = 0);
-    EX:= hwRound(x);
-    EY:= hwRound(y);
-    if t < 50 then CheckTrace:= RateExplosion(Me, EX, EY, 41)
-              else CheckTrace:= BadTurn
-    end;
+    x, y, dY: hwFloat;
+    t: LongInt;
 begin
 valueResult:= BadTurn;
 TestTime:= 0;
@@ -380,7 +344,23 @@
   r:= Distance(Vx, Vy);
   if not (r > _1) then
      begin
-     Score:= CheckTrace;
+    x:= Me^.X;
+    y:= Me^.Y;
+    dY:= -Vy;
+    t:= TestTime;
+    repeat
+        x:= x + Vx;
+        y:= y + dY;
+        dY:= dY + cGravity;
+        dec(t)
+    until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t = 0);
+    EX:= hwRound(x);
+    EY:= hwRound(y);
+    if t < 50 then 
+        Score:= RateExplosion(Me, EX, EY, 41)
+    else 
+        Score:= BadTurn;
+
      if valueResult < Score then
         begin
         ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level));
@@ -401,26 +381,8 @@
 var Vx, Vy, r: hwFloat;
     Score, EX, EY, valueResult: LongInt;
     TestTime: Longword;
-
-    function CheckTrace: LongInt;
-    var x, y, dY: hwFloat;
-        t: LongInt;
-    begin
-    x:= Me^.X;
-    y:= Me^.Y;
-    dY:= -Vy;
-    t:= TestTime;
-    repeat
-      x:= x + Vx;
-      y:= y + dY;
-      dY:= dY + cGravity;
-      dec(t)
-    until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t = 0);
-    EX:= hwRound(x);
-    EY:= hwRound(y);
-    if t < 50 then CheckTrace:= RateExplosion(Me, EX, EY, 381)
-              else CheckTrace:= BadTurn
-    end;
+    x, y, dY: hwFloat;
+    t: LongInt;
 begin
 valueResult:= BadTurn;
 TestTime:= 0;
@@ -431,9 +393,25 @@
   Vy:= cGravity * ((TestTime + tDelta) div 2) - (int2hwFloat(Targ.Y-200) - Me^.Y) / int2hwFloat(TestTime + tDelta);
   r:= Distance(Vx, Vy);
   if not (r > _1) then
-     begin
-     Score:= CheckTrace;
-     if valueResult < Score then
+    begin
+    x:= Me^.X;
+    y:= Me^.Y;
+    dY:= -Vy;
+    t:= TestTime;
+    repeat
+        x:= x + Vx;
+        y:= y + dY;
+        dY:= dY + cGravity;
+        dec(t)
+    until TestCollExcludingMe(Me, hwRound(x), hwRound(y), 5) or (t = 0);
+    EX:= hwRound(x);
+    EY:= hwRound(y);
+    if t < 50 then 
+        Score:= RateExplosion(Me, EX, EY, 381)
+    else 
+        Score:= BadTurn;
+        
+    if valueResult < Score then
         begin
         ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level));
         ap.Power:= hwRound(r * cMaxPower * _0_9) + AIrndSign(random(Level) * 15);
@@ -443,56 +421,19 @@
         ap.ExplY:= EY;
         valueResult:= Score
         end;
-     end
+    end
 until (TestTime = 4000);
 TestWatermelon:= valueResult
 end;
 
-function TestMortar(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
-//const tDelta = 24;
-var Vx, Vy: hwFloat;
-    Score, EX, EY, valueResult: LongInt;
-    TestTime: Longword;
 
-    function CheckTrace: LongInt;
-    var x, y, dY: hwFloat;
-        value: LongInt;
-    begin
-        x:= Me^.X;
-        y:= Me^.Y;
-        dY:= -Vy;
-
-        repeat
-            x:= x + Vx;
-            y:= y + dY;
-            dY:= dY + cGravity;
-            EX:= hwRound(x);
-            EY:= hwRound(y);
-        until TestCollExcludingMe(Me, EX, EY, 5) or (EY > cWaterLine);
-
-        if (EY < cWaterLine) and not dY.isNegative then
-            begin
-            value:= RateExplosion(Me, EX, EY, 91);
-            if (value = 0) then
-                if (dY > _0_15) then
-                    value:= - abs(Targ.Y - EY) div 32
-                else
-                    value:= BadTurn
-            else if (value < 0) then value:= BadTurn
-            end
-        else
-            value:= BadTurn;
-
-        CheckTrace:= value;
-    end;
-
-    function Solve: LongWord;
+    function Solve(TX, TY, MX, MY: LongInt): LongWord;
     var A, B, D, T: hwFloat;
         C: LongInt;
     begin
         A:= hwSqr(cGravity) * _0_25;
-        B:= - cGravity * (Targ.Y - hwRound(Me^.Y)) - _1;
-        C:= sqr(Targ.Y - hwRound(Me^.Y)) + sqr(Targ.X - hwRound(Me^.X));
+        B:= - cGravity * (TY - MY) - _1;
+        C:= sqr(TY - MY) + sqr(TX - MX);
         D:= hwSqr(B) - (A * C * 4);
         if D.isNegative = false then
             begin
@@ -504,21 +445,51 @@
             Solve:= hwRound(T)
             end else Solve:= 0
     end;
-
+    
+function TestMortar(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
+//const tDelta = 24;
+var Vx, Vy: hwFloat;
+    Score, EX, EY, valueResult: LongInt;
+    TestTime: Longword;
+    x, y, dY: hwFloat;
 begin
 valueResult:= BadTurn;
 ap.ExplR:= 0;
 
 if (Level > 2) then exit(BadTurn);
 
-TestTime:= Solve;
+TestTime:= Solve(Targ.X, Targ.Y, hwRound(Me^.X), hwRound(Me^.Y));
 
 if TestTime = 0 then exit(BadTurn);
 
     Vx:= (int2hwFloat(Targ.X) - Me^.X) / int2hwFloat(TestTime);
     Vy:= cGravity * (TestTime div 2) - (int2hwFloat(Targ.Y) - Me^.Y) / int2hwFloat(TestTime);
 
-    Score:= CheckTrace;
+    x:= Me^.X;
+    y:= Me^.Y;
+    dY:= -Vy;
+
+    repeat
+        x:= x + Vx;
+        y:= y + dY;
+        dY:= dY + cGravity;
+        EX:= hwRound(x);
+        EY:= hwRound(y);
+    until TestCollExcludingMe(Me, EX, EY, 5) or (EY > cWaterLine);
+
+    if (EY < cWaterLine) and (not dY.isNegative) then
+        begin
+        Score:= RateExplosion(Me, EX, EY, 91);
+        if (Score = 0) then
+            if (dY > _0_15) then
+                Score:= - abs(Targ.Y - EY) div 32
+            else
+                Score:= BadTurn
+        else if (Score < 0) then Score:= BadTurn
+        end
+    else
+        Score:= BadTurn;
+
     if valueResult < Score then
         begin
         ap.Angle:= DxDy2AttackAngle(Vx, Vy) + AIrndSign(random(Level));
--- a/hedgewars/uAIMisc.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uAIMisc.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -115,20 +115,19 @@
 else friendlyfactor:= max(30, 300 - f * 80 div max(1,e))
 end;
 
+procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt);
+begin
+bonuses.ar[bonuses.Count].x:= x;
+bonuses.ar[bonuses.Count].y:= y;
+bonuses.ar[bonuses.Count].Radius:= r;
+bonuses.ar[bonuses.Count].Score:= s;
+inc(bonuses.Count);
+TryDo(bonuses.Count <= MAXBONUS, 'Bonuses overflow', true)
+end;
+
 procedure FillBonuses(isAfterAttack: boolean; filter: TGearsType);
 var Gear: PGear;
     MyClan: PClan;
-
-    procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt);
-    begin
-    bonuses.ar[bonuses.Count].x:= x;
-    bonuses.ar[bonuses.Count].y:= y;
-    bonuses.ar[bonuses.Count].Radius:= r;
-    bonuses.ar[bonuses.Count].Score:= s;
-    inc(bonuses.Count);
-    TryDo(bonuses.Count <= MAXBONUS, 'Bonuses overflow', true)
-    end;
-
 begin
 bonuses.Count:= 0;
 MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan;
--- a/hedgewars/uAmmos.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uAmmos.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -111,8 +111,7 @@
            ((a = amInvulnerable) and ((GameFlags and gfInvulnerable) <> 0)) or
            ((a = amLaserSight) and ((GameFlags and gfLaserSight) <> 0)) or
            ((a = amVampiric) and ((GameFlags and gfVampiric) <> 0)) or
-           ((a = amExtraTime) and (cHedgehogTurnTime >= 1000000)) or
-            (a = amStructure) then
+           ((a = amExtraTime) and (cHedgehogTurnTime >= 1000000)) then
             begin
             cnt:= 0;
             Ammoz[a].Probability:= 0
--- a/hedgewars/uCaptions.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uCaptions.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -79,7 +79,7 @@
     grp: TCapGroup;
     offset: LongInt;
 begin
-{$IFDEF IPHONEOS}
+{$IFDEF MOBILE}
     offset:= 48;
 {$ELSE}
     offset:= 8;
--- a/hedgewars/uChat.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uChat.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -327,7 +327,7 @@
     SendIPC('s' + s);
 
     if copy(s, 1, 4) = '/me ' then
-        s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
+        s:= #2 + '* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
     else
         s:= #1 + UserNick + ': ' + s;
 
--- a/hedgewars/uCollisions.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uCollisions.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -393,7 +393,7 @@
     i, j, k, mx, my, li, ri, jfr, jto, tmpo : ShortInt;
     tmpx, tmpy: LongWord;
     dx, dy, s: hwFloat;
-    offset: Array[0..7,0..1] of ShortInt;
+    offset: array[0..7,0..1] of ShortInt;
     isColl: Boolean;
 
 begin
@@ -523,7 +523,7 @@
 function CalcSlopeBelowGear(Gear: PGear): hwFloat;
 var dx, dy: hwFloat;
     collX, i, y, x, gx, sdx, sdy: LongInt;
-    isColl, succ: Boolean;
+    isColl, bSucc: Boolean;
 begin
 
 
@@ -560,13 +560,13 @@
 
     sdx:= 0;
     sdy:= 0;
-    succ := CalcSlopeTangent(Gear, collX, y, sdx, sdy, 255);
+    bSucc := CalcSlopeTangent(Gear, collX, y, sdx, sdy, 255);
 
     // restore original dx/dy
     Gear^.dX := dx;
     Gear^.dY := dy;
 
-    if succ and (sdx <> 0) and (sdy <> 0) then
+    if bSucc and (sdx <> 0) and (sdy <> 0) then
     begin
         dx := int2hwFloat(sdy) / (abs(sdx) + abs(sdy));
         dx.isNegative := (sdx * sdy) < 0;
--- a/hedgewars/uCommandHandlers.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uCommandHandlers.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -214,7 +214,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('l');
 with CurrentHedgehog^.Gear^ do
-    Message:= Message and not (gmLeft and InputMask);
+    Message:= Message and (not (gmLeft and InputMask));
     ScriptCall('onLeftUp');
 end;
 
@@ -235,7 +235,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('r');
 with CurrentHedgehog^.Gear^ do
-    Message:= Message and not (gmRight and InputMask);
+    Message:= Message and (not (gmRight and InputMask));
     ScriptCall('onRightUp');
 end;
 
@@ -256,7 +256,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('u');
 with CurrentHedgehog^.Gear^ do
-    Message:= Message and not (gmUp and InputMask);
+    Message:= Message and (not (gmUp and InputMask));
     ScriptCall('onUpUp');
 end;
 
@@ -277,7 +277,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('d');
 with CurrentHedgehog^.Gear^ do
-    Message:= Message and not (gmDown and InputMask);
+    Message:= Message and (not (gmDown and InputMask));
     ScriptCall('onDownUp');
 end;
 
@@ -298,7 +298,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('z');
 with CurrentHedgehog^.Gear^ do
-    Message:= Message and not (gmPrecise and InputMask);
+    Message:= Message and (not (gmPrecise and InputMask));
     ScriptCall('onPreciseUp');
 end;
 
@@ -350,7 +350,7 @@
     begin
     if not CurrentTeam^.ExtDriven and
         ((Message and gmAttack) <> 0) then SendIPC('a');
-    Message:= Message and not (gmAttack and InputMask);
+    Message:= Message and (not (gmAttack and InputMask));
     ScriptCall('onAttackUp');
     end
 end;
@@ -505,7 +505,7 @@
             if bShowAmmoMenu then bShowAmmoMenu:= false
             else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or
                     ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or
-                    ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true
+                    ((Gear^.State and gstHHDriven) = 0) then begin end else bShowAmmoMenu:= true
             end;
     end
 end;
--- a/hedgewars/uCommands.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uCommands.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -23,7 +23,7 @@
 interface
 
 var isDeveloperMode: boolean;
-type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean);
+type TVariableType = (vtCommand, vtLongInt, vtBoolean);
      TCommandHandler = procedure (var params: shortstring);
 
 procedure initModule;
@@ -75,7 +75,7 @@
 //WriteLnToConsole(CmdStr);
 if CmdStr[0]=#0 then exit;
 c:= CmdStr[1];
-if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
+if (c = '/') or (c = '$') then Delete(CmdStr, 1, 1) else c:= '/';
 s:= '';
 SplitBySpace(CmdStr, s);
 AddFileLog('[Cmd] ' + c + CmdStr + ' (' + inttostr(length(s)) + ')');
@@ -96,12 +96,6 @@
                             str(PLongInt(t^.Handler)^, s);
                             WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
                             end else val(s, PLongInt(t^.Handler)^);
-              vthwFloat: if c='$' then
-                         if s[0]=#0 then
-                            begin
-                            //str(PhwFloat(t^.Handler)^:4:6, s);
-                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
-                            end else; //val(s, PhwFloat(t^.Handler)^, i);
              vtBoolean: if c='$' then
                          if s[0]=#0 then
                             begin
--- a/hedgewars/uConsole.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uConsole.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -26,9 +26,10 @@
 procedure WriteToConsole(s: shortstring);
 procedure WriteLnToConsole(s: shortstring);
 function  GetLastConsoleLine: shortstring;
+function ShortStringAsPChar(s: shortstring): PChar;
 
 implementation
-uses Types, uVariables, uUtils;
+uses Types, uVariables, uUtils {$IFDEF ANDROID}, log in 'log.pas'{$ENDIF};
 
 const cLineWidth: LongInt = 0;
       cLinesCount = 8;
@@ -53,6 +54,9 @@
 begin
 {$IFNDEF NOCONSOLE}
 AddFileLog('[Con] ' + s);
+{$IFDEF ANDROID}
+  Log.__android_log_write(Log.Android_LOG_DEBUG, 'HW_Engine', ShortStringAsPChar('[Con]' + s));
+{$ELSE}
 Write(stderr, s);
 done:= false;
 
@@ -70,20 +74,29 @@
     done:= (Length(s) = 0);
     end;
 {$ENDIF}
+{$ENDIF}
 end;
 
 procedure WriteLnToConsole(s: shortstring);
 begin
 {$IFNDEF NOCONSOLE}
 WriteToConsole(s);
+{$IFNDEF ANDROID}
 WriteLn(stderr);
 inc(CurrLine);
 if CurrLine = cLinesCount then
     CurrLine:= 0;
 PByte(@ConsoleLines[CurrLine].s)^:= 0
 {$ENDIF}
+{$ENDIF}
 end;
 
+function ShortStringAsPChar(s: shortstring) : PChar;
+begin
+    if Length(s) = High(s) then Dec(s[0]);
+    s[Ord(Length(s))+1] := #0;
+    exit(@s[1]);
+end;
 
 function GetLastConsoleLine: shortstring;
 var valueStr: shortstring;
--- a/hedgewars/uConsts.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uConsts.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -158,7 +158,7 @@
     // do not change this value
     cDefaultZoomLevel = 2.0;
 
-{$IFDEF IPHONEOS}
+{$IFDEF MOBILE}
     cMaxZoomLevel = 0.5;
     cMinZoomLevel = 3.5;
     cZoomDelta = 0.20;
@@ -168,6 +168,8 @@
     cZoomDelta = 0.25;
 {$ENDIF}
 
+    cMinMaxZoomLevelDelta = cMaxZoomLevel - cMinZoomLevel;
+
     cSendEmptyPacketTime = 1000;
     trigTurns = $80000001;
 
--- a/hedgewars/uFloat.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uFloat.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -62,6 +62,7 @@
 
 // The implemented operators
 
+operator = (const z1, z2: hwFloat) z : boolean; inline;
 operator + (const z1, z2: hwFloat) z : hwFloat; inline;
 operator - (const z1, z2: hwFloat) z : hwFloat; inline;
 operator - (const z1: hwFloat) z : hwFloat; inline;
@@ -88,7 +89,7 @@
 function AngleCos(const Angle: Longword): hwFloat;
 function SignAs(const num, signum: hwFloat): hwFloat; inline; // Returns an hwFloat with the value of parameter num and the sign of signum.
 function hwSign(r: hwFloat): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
-
+function isZero(const z: hwFloat): boolean; inline;
 {$IFDEF FPC}
 {$J-}
 {$ENDIF}
@@ -147,6 +148,7 @@
               _2: hwFloat = (isNegative: false; QWordValue:  4294967296 * 2);
               _3: hwFloat = (isNegative: false; QWordValue:  4294967296 * 3);
               _4: hwFloat = (isNegative: false; QWordValue:  4294967296 * 4);
+            _4_5: hwFloat = (isNegative: false; QWordValue:  4294967296 * 9 div 2);
               _5: hwFloat = (isNegative: false; QWordValue:  4294967296 * 5);
               _6: hwFloat = (isNegative: false; QWordValue:  4294967296 * 6);
              _10: hwFloat = (isNegative: false; QWordValue:  4294967296 * 10);
@@ -159,10 +161,13 @@
              _40: hwFloat = (isNegative: false; QWordValue:  4294967296 * 40);
              _50: hwFloat = (isNegative: false; QWordValue:  4294967296 * 50);
              _70: hwFloat = (isNegative: false; QWordValue:  4294967296 * 70);
+             _90: hwFloat = (isNegative: false; QWordValue:  4294967296 * 90);
             _128: hwFloat = (isNegative: false; QWordValue:  4294967296 * 128);
+            _180: hwFloat = (isNegative: false; QWordValue:  4294967296 * 180);
             _250: hwFloat = (isNegative: false; QWordValue:  4294967296 * 250);
             _256: hwFloat = (isNegative: false; QWordValue:  4294967296 * 256);
             _300: hwFloat = (isNegative: false; QWordValue:  4294967296 * 300);
+            _360: hwFloat = (isNegative: false; QWordValue:  4294967296 * 360);
             _450: hwFloat = (isNegative: false; QWordValue:  4294967296 * 450);
            _1000: hwFloat = (isNegative: false; QWordValue:  4294967296 * 1000);
            _1024: hwFloat = (isNegative: false; QWordValue:  4294967296 * 1024);
@@ -198,6 +203,12 @@
 if i.isNegative then hwFloat2Float:= -hwFloat2Float;
 end;
 
+operator = (const z1, z2: hwFloat) z : boolean; inline;
+begin
+    z:= (z1.isNegative = z2.isNegative) and (z1.QWordValue = z2.QWordValue);
+end;
+
+
 operator + (const z1, z2: hwFloat) z : hwFloat;
 begin
 if z1.isNegative = z2.isNegative then
@@ -312,9 +323,9 @@
 str(z.Round, cstr);
 if z.Frac <> 0 then
    begin
-   str(z.Frac / $100000000:1:10, tmpstr);
+   str(z.Frac / $100000000, tmpstr);
    delete(tmpstr, 1, 2);
-   cstr:= cstr + '.' + tmpstr
+   cstr:= cstr + '.' + copy(tmpstr, 1, 10)
    end;
 if z.isNegative then cstr:= '-' + cstr
 end;
@@ -404,6 +415,10 @@
                 else AngleCos.QWordValue:= SinTable[Angle - 1024]
 end;
 
+function isZero(const z: hwFloat): boolean; inline; 
+begin
+    isZero := z.QWordValue = 0;
+end;
 {$ENDIF}
 
 end.
--- a/hedgewars/uGame.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uGame.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -26,7 +26,7 @@
 ////////////////////
    implementation
 ////////////////////
-uses uKeys, uTeams, uIO, uAI, uGears, uSound, uMobile, uVisualGears, uTypes, uVariables;
+uses uKeys, uTeams, uIO, uAI, uGears, uSound, uMobile, uVisualGears, uTypes, uVariables{$IFDEF SDL13}, uTouch{$ENDIF};
 
 procedure DoGameTick(Lag: LongInt);
 var i: LongInt;
@@ -52,7 +52,8 @@
     if not CurrentTeam^.ExtDriven then
        begin
        if CurrentHedgehog^.BotLevel <> 0 then ProcessBot;
-       ProcessGears
+       ProcessGears;
+       {$IFDEF SDL13}ProcessTouch;{$ENDIF}
        end else
        begin
        NetGetNextCmd;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uGearUtils.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,126 @@
+unit uGearUtils;
+interface
+uses uTypes;
+
+procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord = $FFFFFFFF); 
+
+implementation
+uses uGearsList;
+
+procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
+var Gear: PGear;
+    dmg, dmgRadius, dmgBase: LongInt;
+    fX, fY: hwFloat;
+    vg: PVisualGear;
+    i, cnt: LongInt;
+begin
+    if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');
+    if Radius > 25 then KickFlakes(Radius, X, Y);
+
+    if ((Mask and EXPLNoGfx) = 0) then
+        begin
+        vg:= nil;
+        if Radius > 50 then vg:= AddVisualGear(X, Y, vgtBigExplosion)
+        else if Radius > 10 then vg:= AddVisualGear(X, Y, vgtExplosion);
+        if vg <> nil then
+            vg^.Tint:= Tint;
+        end;
+    if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion);
+
+    if (Mask and EXPLAllDamageInRadius) = 0 then
+        dmgRadius:= Radius shl 1
+    else
+        dmgRadius:= Radius;
+    dmgBase:= dmgRadius + cHHRadius div 2;
+    fX:= int2hwFloat(X);
+    fY:= int2hwFloat(Y);
+    Gear:= GearsList;
+    while Gear <> nil do
+        begin
+        dmg:= 0;
+        //dmg:= dmgRadius  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y)));
+        //if (dmg > 1) and
+        if (Gear^.State and gstNoDamage) = 0 then
+            begin
+            case Gear^.Kind of
+                gtHedgehog,
+                    gtMine,
+                    gtBall,
+                    gtMelonPiece,
+                    gtGrenade,
+                    gtClusterBomb,
+                //    gtCluster, too game breaking I think
+                    gtSMine,
+                    gtCase,
+                    gtTarget,
+                    gtFlame,
+                    gtExplosives,
+                    gtStructure: begin
+    // Run the calcs only once we know we have a type that will need damage
+                            if hwRound(hwAbs(Gear^.X-fX)+hwAbs(Gear^.Y-fY)) < dmgBase then
+                                dmg:= dmgBase - max(hwRound(Distance(Gear^.X - fX, Gear^.Y - fY)),Gear^.Radius);
+                            if dmg > 1 then
+                                begin
+                                dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
+                                //AddFileLog('Damage: ' + inttostr(dmg));
+                                if (Mask and EXPLNoDamage) = 0 then
+                                    begin
+                                    if not Gear^.Invulnerable then
+                                        ApplyDamage(Gear, AttackingHog, dmg, dsExplosion)
+                                    else
+                                        Gear^.State:= Gear^.State or gstWinner;
+                                    end;
+                                if ((Mask and EXPLDoNotTouchAny) = 0) and (((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog)) then
+                                    begin
+                                    DeleteCI(Gear);
+                                    if Gear^.Kind <> gtHedgehog then
+                                        begin
+                                        Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - fX)/Gear^.Density;
+                                        Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - fY)/Gear^.Density;
+                                        end
+                                    else
+                                        begin
+                                        Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - fX);
+                                        Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - fY);
+                                        end;
+
+                                    Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser);
+                                    if not Gear^.Invulnerable then
+                                        Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner);
+                                    Gear^.Active:= true;
+                                    if Gear^.Kind <> gtFlame then FollowGear:= Gear
+                                    end;
+                                if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and (not Gear^.Invulnerable) then
+                                    Gear^.Hedgehog^.Effects[hePoisoned] := true;
+                                end;
+
+                            end;
+                    gtGrave: begin
+    // Run the calcs only once we know we have a type that will need damage
+                            if hwRound(hwAbs(Gear^.X-fX)+hwAbs(Gear^.Y-fY)) < dmgBase then
+                                dmg:= dmgBase - hwRound(Distance(Gear^.X - fX, Gear^.Y - fY));
+                            if dmg > 1 then
+                                begin
+                                dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
+                                Gear^.dY:= - _0_004 * dmg;
+                                Gear^.Active:= true
+                                end
+                            end;
+                end;
+            end;
+        Gear:= Gear^.NextGear
+        end;
+
+    if (Mask and EXPLDontDraw) = 0 then
+        if (GameFlags and gfSolidLand) = 0 then
+            begin
+            cnt:= DrawExplosion(X, Y, Radius) div 1608; // approx 2 16x16 circles to erase per chunk
+            if (cnt > 0) and (SpritesData[sprChunk].Texture <> nil) then
+                for i:= 0 to cnt do
+                    AddVisualGear(X, Y, vgtChunk)
+            end;
+
+    uAIMisc.AwareOfExplosion(0, 0, 0)
+end;
+
+end.
--- a/hedgewars/uGears.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uGears.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -37,17 +37,14 @@
 
 procedure initModule;
 procedure freeModule;
-function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
 function  SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear;
 function  SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear;
 function  GetAmmo: TAmmoType;
 function  GetUtility: TAmmoType;
-procedure ResurrectHedgehog(gear: PGear);
 procedure HideHog(HH: PHedgehog);
 procedure RestoreHog(HH: PHedgehog);
 procedure ProcessGears;
 procedure EndTurnCleanup;
-procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
 procedure SetAllToActive;
 procedure SetAllHHToActive;
 procedure DrawGears;
@@ -57,27 +54,20 @@
 function  GearByUID(uid : Longword) : PGear;
 procedure InsertGearToList(Gear: PGear);
 procedure RemoveGearFromList(Gear: PGear);
-function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
-procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean = false);
 procedure DeleteGear(Gear: PGear); 
 
 
 implementation
 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
      uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
-     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture;
+     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
+     uGearsHedgehog;
 
 
-procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord = $FFFFFFFF); forward;
 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
 //procedure AmmoFlameWork(Ammo: PGear); forward;
 function  GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward;
-function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
 procedure SpawnBoxOfSmth; forward;
-procedure AfterAttack; forward;
-procedure HedgehogStep(Gear: PGear); forward;
-procedure doStepHedgehogMoving(Gear: PGear); forward;
-procedure HedgehogChAngle(HHGear: PGear); forward;
 procedure ShotgunShot(Gear: PGear); forward;
 procedure PickUp(HH, Gear: PGear); forward;
 procedure HHSetWeapon(HHGear: PGear); forward;
@@ -88,7 +78,6 @@
 // Note: step handlers of gears that are hedgehogs are in a different file
 //       than the handlers for all other gears.
 {$INCLUDE "GSHandlers.inc"}
-{$INCLUDE "HHHandlers.inc"}
 
 const doStepHandlers: array[TGearType] of TGearStepProcedure = (
             @doStepBomb,
@@ -154,523 +143,6 @@
             @doStepLandGun,
             @doStepTardis);
 
-procedure InsertGearToList(Gear: PGear);
-var tmp, ptmp: PGear;
-begin
-    tmp:= GearsList;
-    ptmp:= GearsList;
-    while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do
-        begin
-        ptmp:= tmp;
-        tmp:= tmp^.NextGear
-        end;
-
-    if ptmp <> tmp then
-        begin
-        Gear^.NextGear:= ptmp^.NextGear;
-        Gear^.PrevGear:= ptmp;
-        if ptmp^.NextGear <> nil then ptmp^.NextGear^.PrevGear:= Gear;
-        ptmp^.NextGear:= Gear
-        end
-    else
-        begin
-        Gear^.NextGear:= GearsList;
-        if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear;
-        GearsList:= Gear;
-        end;
-end;
-
-procedure RemoveGearFromList(Gear: PGear);
-begin
-if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
-if Gear^.PrevGear <> nil then
-    Gear^.PrevGear^.NextGear:= Gear^.NextGear
-else
-    GearsList:= Gear^.NextGear
-end;
-
-procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
-var tag: PVisualGear;
-begin
-tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);
-if (tag <> nil) then
-    tag^.Hedgehog:= HHGear^.Hedgehog; // the tag needs the tag to determine the text color
-AllInactive:= false;
-HHGear^.Active:= true;
-end;
-
-function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
-const Counter: Longword = 0;
-var gear: PGear;
-begin
-inc(Counter);
-AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
-
-New(gear);
-FillChar(gear^, sizeof(TGear), 0);
-gear^.X:= int2hwFloat(X);
-gear^.Y:= int2hwFloat(Y);
-gear^.Target.X:= NoPointX;
-gear^.Kind := Kind;
-gear^.State:= State;
-gear^.Active:= true;
-gear^.dX:= dX;
-gear^.dY:= dY;
-gear^.doStep:= doStepHandlers[Kind];
-gear^.CollisionIndex:= -1;
-gear^.Timer:= Timer;
-gear^.FlightTime:= 0;
-gear^.uid:= Counter;
-gear^.SoundChannel:= -1;
-gear^.ImpactSound:= sndNone;
-gear^.nImpactSounds:= 0;
-gear^.Density:= _1;
-// Define ammo association, if any.
-gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
-if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then gear^.Z:= cHHZ+1
-else gear^.Z:= cUsualZ;
-
-if CurrentHedgehog <> nil then
-    begin
-    gear^.Hedgehog:= CurrentHedgehog;
-    gear^.IntersectGear:= CurrentHedgehog^.Gear
-    end;
-    
-case Kind of
-     gtGrenade,
-     gtClusterBomb,
-     gtGasBomb: begin
-                gear^.ImpactSound:= sndGrenadeImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.AdvBounce:= 1;
-                gear^.Radius:= 5;
-                gear^.Elasticity:= _0_8;
-                gear^.Friction:= _0_8;
-                gear^.Density:= _1_5;
-                gear^.RenderTimer:= true;
-                if gear^.Timer = 0 then gear^.Timer:= 3000
-                end;
-  gtWatermelon: begin
-                gear^.ImpactSound:= sndMelonImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.AdvBounce:= 1;
-                gear^.Radius:= 6;
-                gear^.Elasticity:= _0_8;
-                gear^.Friction:= _0_995;
-                gear^.Density:= _2;
-                gear^.RenderTimer:= true;
-                if gear^.Timer = 0 then gear^.Timer:= 3000
-                end;
-  gtMelonPiece: begin
-                gear^.Density:= _2;
-                end;
-    gtHedgehog: begin
-                gear^.AdvBounce:= 1;
-                gear^.Radius:= cHHRadius;
-                gear^.Elasticity:= _0_35;
-                gear^.Friction:= _0_999;
-                gear^.Angle:= cMaxAngle div 2;
-                gear^.Density:= _3;
-                gear^.Z:= cHHZ;
-                if (GameFlags and gfAISurvival) <> 0 then
-                    if gear^.Hedgehog^.BotLevel > 0 then
-                        gear^.Hedgehog^.Effects[heResurrectable] := true;
-                end;
-       gtShell: begin
-                gear^.Radius:= 4;
-                gear^.Density:= _1;
-                end;
-       gtSnowball: begin
-                gear^.ImpactSound:= sndMudballImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.Radius:= 4;
-                gear^.Elasticity:= _1;
-                gear^.Friction:= _1;
-                gear^.Density:= _0_5;
-                end;
-
-     gtFlake: begin
-                with Gear^ do
-                    begin
-                    Pos:= 0;
-                    Radius:= 1;
-                    DirAngle:= random * 360;
-                    if State and gstTmpFlag = 0 then
-                        begin
-                        dx.isNegative:= GetRandom(2) = 0;
-                        dx.QWordValue:= GetRandom(100000000);
-                        dy.isNegative:= false;
-                        dy.QWordValue:= GetRandom(70000000);
-                        if GetRandom(2) = 0 then dx := -dx
-                        end;
-                    State:= State or gstInvisible;
-                    Health:= random(vobFrameTicks);
-                    Timer:= random(vobFramesCount);
-                    Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity
-                    end
-                end;
-       gtGrave: begin
-                gear^.ImpactSound:= sndGraveImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.Radius:= 10;
-                gear^.Elasticity:= _0_6;
-                end;
-         gtBee: begin
-                gear^.Radius:= 5;
-                gear^.Timer:= 500;
-                gear^.RenderTimer:= true;
-                gear^.Elasticity:= _0_9;
-                gear^.Tag:= 0;
-                end;
-   gtSeduction: begin
-                gear^.Radius:= 250;
-                end;
- gtShotgunShot: begin
-                gear^.Timer:= 900;
-                gear^.Radius:= 2
-                end;
-  gtPickHammer: begin
-                gear^.Radius:= 10;
-                gear^.Timer:= 4000
-                end;
-   gtHammerHit: begin
-                gear^.Radius:= 8;
-                gear^.Timer:= 125
-                end;
-        gtRope: begin
-                gear^.Radius:= 3;
-                gear^.Friction:= _450 * _0_01 * cRopePercent;
-                RopePoints.Count:= 0;
-                end;
-        gtMine: begin
-                gear^.ImpactSound:= sndMineImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.Health:= 10;
-                gear^.State:= gear^.State or gstMoving;
-                gear^.Radius:= 2;
-                gear^.Elasticity:= _0_55;
-                gear^.Friction:= _0_995;
-                gear^.Density:= _0_9;
-                if cMinesTime < 0 then
-                    gear^.Timer:= getrandom(51)*100
-                else
-                    gear^.Timer:= cMinesTime;
-                end;
-       gtSMine: begin
-                gear^.Health:= 10;
-                gear^.State:= gear^.State or gstMoving;
-                gear^.Radius:= 2;
-                gear^.Elasticity:= _0_55;
-                gear^.Friction:= _0_995;
-                gear^.Density:= _0_9;
-                gear^.Timer:= 500;
-                end;
-        gtCase: begin
-                gear^.ImpactSound:= sndGraveImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.Radius:= 16;
-                gear^.Elasticity:= _0_3
-                end;
-  gtExplosives: begin
-                gear^.ImpactSound:= sndGrenadeImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.Radius:= 16;
-                gear^.Elasticity:= _0_4;
-                gear^.Friction:= _0_995;
-                gear^.Density:= _6;
-                gear^.Health:= cBarrelHealth;
-                gear^.Z:= cHHZ-1
-                end;
-  gtDEagleShot: begin
-                gear^.Radius:= 1;
-                gear^.Health:= 50
-                end;
-  gtSniperRifleShot: begin
-                gear^.Radius:= 1;
-                gear^.Health:= 50
-                end;
-    gtDynamite: begin
-                gear^.Radius:= 3;
-                gear^.Elasticity:= _0_55;
-                gear^.Friction:= _0_03;
-                gear^.Density:= _2;
-                gear^.Timer:= 5000;
-                end;
-     gtCluster: begin
-                gear^.Radius:= 2;
-                gear^.Density:= _1_5;
-                gear^.RenderTimer:= true
-                end;
-      gtShover: gear^.Radius:= 20;
-       gtFlame: begin
-                gear^.Tag:= GetRandom(32);
-                gear^.Radius:= 1;
-                gear^.Health:= 5;
-                gear^.Density:= _1;
-                if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then
-                    begin
-                    gear^.dY:= (getrandom - _0_8) * _0_03;
-                    gear^.dX:= (getrandom - _0_5) * _0_4
-                    end
-                end;
-   gtFirePunch: begin
-                gear^.Radius:= 15;
-                gear^.Tag:= Y
-                end;
-     gtAirBomb: begin
-                gear^.Radius:= 5;
-                gear^.Density:= _2;
-                end;
-   gtBlowTorch: begin
-                gear^.Radius:= cHHRadius + cBlowTorchC;
-                gear^.Timer:= 7500
-                end;
-    gtSwitcher: begin
-                gear^.Z:= cCurrHHZ
-                end;
-      gtTarget: begin
-                gear^.ImpactSound:= sndGrenadeImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.Radius:= 10;
-                gear^.Elasticity:= _0_3;
-                gear^.Timer:= 0
-                end;
-      gtTardis: begin
-                gear^.Timer:= 0;
-                gear^.Pos:= 1;
-                gear^.Z:= cCurrHHZ+1;
-                end;
-      gtMortar: begin
-                gear^.Radius:= 4;
-                gear^.Elasticity:= _0_2;
-                gear^.Friction:= _0_08;
-                gear^.Density:= _1;
-                end;
-        gtWhip: gear^.Radius:= 20;
-      gtHammer: gear^.Radius:= 20;
-    gtKamikaze: begin
-                gear^.Health:= 2048;
-                gear^.Radius:= 20
-                end;
-        gtCake: begin
-                gear^.Health:= 2048;
-                gear^.Radius:= 7;
-                gear^.Z:= cOnHHZ;
-                gear^.RenderTimer:= true;
-                gear^.DirAngle:= -90 * hwSign(Gear^.dX);
-                if not dX.isNegative then gear^.Angle:= 1 else gear^.Angle:= 3
-                end;
- gtHellishBomb: begin
-                gear^.ImpactSound:= sndHellishImpact1;
-                gear^.nImpactSounds:= 4;
-                gear^.AdvBounce:= 1;
-                gear^.Radius:= 4;
-                gear^.Elasticity:= _0_5;
-                gear^.Friction:= _0_96;
-                gear^.Density:= _1_5;
-                gear^.RenderTimer:= true;
-                gear^.Timer:= 5000
-                end;
-       gtDrill: begin
-                if gear^.Timer = 0 then gear^.Timer:= 5000;
-                // Tag for drill strike. if 1 then first impact occured already
-                gear^.Tag := 0;
-                gear^.Radius:= 4;
-                gear^.Density:= _1;
-                end;
-        gtBall: begin
-                gear^.ImpactSound:= sndGrenadeImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.AdvBounce:= 1;
-                gear^.Radius:= 5;
-                gear^.Tag:= random(8);
-                gear^.Timer:= 5000;
-                gear^.Elasticity:= _0_7;
-                gear^.Friction:= _0_995;
-                gear^.Density:= _1_5;
-                end;
-     gtBallgun: begin
-                gear^.Timer:= 5001;
-                end;
-     gtRCPlane: begin
-                gear^.Timer:= 15000;
-                gear^.Health:= 3;
-                gear^.Radius:= 8
-                end;
-     gtJetpack: begin
-                gear^.Health:= 2000;
-                gear^.Damage:= 100
-                end;
-     gtMolotov: begin
-                gear^.Radius:= 6;
-                gear^.Density:= _2;
-                end;
-       gtBirdy: begin
-                gear^.Radius:= 16; // todo: check
-                gear^.Timer:= 0;
-                gear^.Health := 2000;
-                gear^.FlightTime := 2;
-                end;
-         gtEgg: begin
-                gear^.Radius:= 4;
-                gear^.Elasticity:= _0_6;
-                gear^.Friction:= _0_96;
-                gear^.Density:= _1;
-                if gear^.Timer = 0 then gear^.Timer:= 3000
-                end;
-      gtPortal: begin
-                gear^.ImpactSound:= sndMelonImpact;
-                gear^.nImpactSounds:= 1;
-                gear^.AdvBounce:= 0;
-                gear^.Radius:= 17;
-                // set color
-                gear^.Tag:= 2 * gear^.Timer;
-                gear^.Timer:= 15000;
-                gear^.RenderTimer:= false;
-                gear^.Health:= 100;
-                end;
-       gtPiano: begin
-                gear^.Radius:= 32;
-                gear^.Density:= _50;
-                end;
- gtSineGunShot: begin
-                gear^.Radius:= 5;
-                gear^.Health:= 6000;
-                end;
-gtFlamethrower: begin
-                gear^.Tag:= 10;
-                gear^.Timer:= 10;
-                gear^.Health:= 500;
-                gear^.Damage:= 100;
-                end;
-     gtLandGun: begin
-                gear^.Tag:= 10;
-                gear^.Timer:= 10;
-                gear^.Health:= 1000;
-                gear^.Damage:= 100;
-                end;
- gtPoisonCloud: begin
-                gear^.Timer:= 5000;
-                gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000;
-                end;
- gtResurrector: begin
-                gear^.Radius := 100;
-                gear^.Tag := 0
-                end;
-     gtWaterUp: begin
-                gear^.Tag := 47;
-                end;
-  gtNapalmBomb: begin
-                gear^.Timer:= 1000;
-                gear^.Radius:= 5;
-                gear^.Density:= _1_5;
-                end;
-   gtStructure: begin
-                gear^.Elasticity:= _0_55;
-                gear^.Friction:= _0_995;
-                gear^.Density:= _0_9;
-                gear^.Radius:= 13;
-                gear^.Health:= 200;
-                gear^.Tag:= 3;
-                end;
-    end;
-
-InsertGearToList(gear);
-AddGear:= gear;
-
-ScriptCall('onGearAdd', gear^.uid);
-end;
-
-procedure DeleteGear(Gear: PGear);
-var team: PTeam;
-    t,i: Longword;
-    k: boolean;
-begin
-
-ScriptCall('onGearDelete', gear^.uid);
-
-DeleteCI(Gear);
-
-FreeTexture(Gear^.Tex);
-Gear^.Tex:= nil;
-
-// make sure that portals have their link removed before deletion
-if (Gear^.Kind = gtPortal) then
-    begin
-    if (Gear^.IntersectGear <> nil) then
-        if (Gear^.IntersectGear^.IntersectGear = Gear) then
-            Gear^.IntersectGear^.IntersectGear:= nil;
-    end
-else if Gear^.Kind = gtHedgehog then
-    (*
-    This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS.  I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves.  I believe it should be removed
-     if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
-        begin
-        AttackBar:= 0;
-        Gear^.Message:= gmDestroy;
-        CurAmmoGear^.Message:= gmDestroy;
-        exit
-        end
-    else*)
-        begin
-        if (hwRound(Gear^.Y) >= cWaterLine) then
-            begin
-            t:= max(Gear^.Damage, Gear^.Health);
-            Gear^.Damage:= t;
-            if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then
-                spawnHealthTagForHH(Gear, t);
-            end;
-
-        team:= Gear^.Hedgehog^.Team;
-        if CurrentHedgehog^.Gear = Gear then
-            begin
-            AttackBar:= 0;
-            FreeActionsList; // to avoid ThinkThread on drawned gear
-            if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (CurrentHedgehog^.MultiShootAttacks > 0) then OnUsedAmmo(CurrentHedgehog^);
-            end;
-
-        Gear^.Hedgehog^.Gear:= nil;
-        if Gear^.Hedgehog^.King then
-            begin
-            // are there any other kings left? Just doing nil check.  Presumably a mortally wounded king will get reaped soon enough
-            k:= false;
-            for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
-                if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then k:= true;
-            if not k then
-                for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
-                    begin
-                    team^.Clan^.Teams[i]^.hasGone:= true;
-                    TeamGoneEffect(team^.Clan^.Teams[i]^)
-                    end
-            end;
-
-        // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
-        // same stand for CheckHHDamage
-        if (Gear^.LastDamage <> nil) then
-            uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true)
-        else
-            uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
-
-        inc(KilledHHs);
-        RecountTeamHealth(team);
-        if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and not Gear^.Hedgehog^.Effects[heResurrectable] then
-            with CurrentHedgehog^ do 
-                begin
-                inc(Team^.stats.AIKills);
-                FreeTexture(Team^.AIKillsTex);
-                Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
-                end
-        end;
-with Gear^ do
-    AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
-
-if CurAmmoGear = Gear then CurAmmoGear:= nil;
-if FollowGear = Gear then FollowGear:= nil;
-if lastGearByUID = Gear then lastGearByUID := nil;
-RemoveGearFromList(Gear);
-Dispose(Gear)
-end;
-
 function CheckNoDamage: boolean; // returns TRUE in case of no damaged hhs
 var Gear: PGear;
     dmg: LongInt;
@@ -698,9 +170,9 @@
 
             if (Gear^.Hedgehog^.Team = CurrentTeam) and
                (Gear^.Damage <> Gear^.Karma) and
-                not Gear^.Hedgehog^.King and
-                not Gear^.Hedgehog^.Effects[hePoisoned] and
-                not SuddenDeathDmg then
+                (not Gear^.Hedgehog^.King) and
+                (not Gear^.Hedgehog^.Effects[hePoisoned]) and
+                (not SuddenDeathDmg) then
                 Gear^.State:= Gear^.State or gstLoser;
 
             spawnHealthTagForHH(Gear, dmg);
@@ -863,7 +335,7 @@
     stHealth: begin
             if (cWaterRise <> 0) or (cHealthDecrease <> 0) then
                 begin
-                if (TotalRounds = cSuddenDTurns) and not SuddenDeath and not isInMultiShoot then
+                if (TotalRounds = cSuddenDTurns) and (not SuddenDeath) and (not isInMultiShoot) then
                     begin
                     SuddenDeath:= true;
                     if cHealthDecrease <> 0 then
@@ -881,16 +353,17 @@
                         end;
                     AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
                     playSound(sndSuddenDeath);
-                    MusicFN:= SDMusic;
-                    ChangeMusic
+                    StopMusic //No SDMusic for now
+                    //MusicFN:= SDMusic;
+                    //ChangeMusic
                     end
-                else if (TotalRounds < cSuddenDTurns) and not isInMultiShoot then
+                else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then
                     begin
                     i:= cSuddenDTurns - TotalRounds;
                     s:= inttostr(i);
                     if i = 1 then
                         AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState)
-                    else if i in [2, 5, 10, 15, 20, 25, 50, 100] then
+                    else if (i = 2) or ((i > 0) and ((i mod 50 = 0) or ((i <= 25) and (i mod 5 = 0)))) then
                         AddCaption(Format(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState);
                     end;
                 end;
@@ -940,14 +413,14 @@
         begin
         dec(delay2);
 
-        if ((delay2 mod cInactDelay) = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and not CurrentHedgehog^.Unplaced then
+        if ((delay2 mod cInactDelay) = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (not CurrentHedgehog^.Unplaced) then
             begin
             if (CurrentHedgehog^.Gear^.State and gstAttacked <> 0) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0) then
                 begin
                 CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstHHChooseTarget;
                 isCursorVisible := true
                 end;
-            CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstAttacked;
+            CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and (not gstAttacked);
             end;
         if delay2 = 0 then
             begin
@@ -969,7 +442,7 @@
 if TurnTimeLeft > 0 then
         if CurrentHedgehog^.Gear <> nil then
             if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0)
-                and not isInMultiShoot then
+                and (not isInMultiShoot) then
                 begin
                 if (TurnTimeLeft = 5000)
                     and (cHedgehogTurnTime >= 10000)
@@ -1067,7 +540,7 @@
         t:= t^.NextGear
         end;
    
-    if ((GameFlags and gfResetWeps) <> 0) and not PlacingHogs then
+    if ((GameFlags and gfResetWeps) <> 0) and (not PlacingHogs) then
         ResetWeapons;
 
     if (GameFlags and gfResetHealth) <> 0 then
@@ -1075,69 +548,6 @@
             RecountTeamHealth(TeamsArray[i])
 end;
 
-procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
-var s: shortstring;
-    vampDmg, tmpDmg, i: Longword;
-    vg: PVisualGear;
-begin
-  if Damage = 0 then exit; // nothing to apply
-
-    if (Gear^.Kind = gtHedgehog) then
-    begin
-    Gear^.LastDamage := AttackerHog;
-
-    Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
-    HHHurt(Gear^.Hedgehog, Source);
-    AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
-    tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
-    if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then
-        begin
-        if cVampiric then
-            begin
-            vampDmg:= hwRound(int2hwFloat(tmpDmg)*_0_8);
-            if vampDmg >= 1 then
-                begin
-                // was considering pulsing on attack, Tiy thinks it should be permanent while in play
-                //CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric;
-                inc(CurrentHedgehog^.Gear^.Health,vampDmg);
-                str(vampDmg, s);
-                s:= '+' + s;
-                AddCaption(s, CurrentHedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
-                RenderHealth(CurrentHedgehog^);
-                RecountTeamHealth(CurrentHedgehog^.Team);
-                i:= 0;
-                while i < vampDmg do
-                    begin
-                    vg:= AddVisualGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), vgtStraightShot);
-                    if vg <> nil then
-                        with vg^ do
-                            begin
-                            Tint:= $FF0000FF;
-                            State:= ord(sprHealth)
-                            end;
-                    inc(i, 5);
-                    end;
-                end
-            end;
-        if ((GameFlags and gfKarma) <> 0) and
-           ((GameFlags and gfInvulnerable) = 0) and
-           not CurrentHedgehog^.Gear^.Invulnerable then
-           begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
-           inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
-           CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
-           spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
-           end;
-        uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false);    
-        end;
-    end else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
-        begin
-        Gear^.Hedgehog:= AttackerHog;
-        end;
-    inc(Gear^.Damage, Damage);
-    
-    ScriptCall('onGearDamage', Gear^.UID, Damage);
-end;
-
 procedure SetAllToActive;
 var t: PGear;
 begin
@@ -1328,7 +738,7 @@
                                 Gear^.Active:= true;
                                 if Gear^.Kind <> gtFlame then FollowGear:= Gear
                                 end;
-                            if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and not Gear^.Invulnerable then
+                            if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and (not Gear^.Invulnerable) then
                                 Gear^.Hedgehog^.Effects[hePoisoned] := true;
                             end;
 
@@ -1479,7 +889,7 @@
                         Gear^.State:= Gear^.State or gstWinner;
                     if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then 
                         begin
-                        if (Ammo^.Hedgehog^.Gear <> nil) then Ammo^.Hedgehog^.Gear^.State:= Ammo^.Hedgehog^.Gear^.State and not gstNotKickable;
+                        if (Ammo^.Hedgehog^.Gear <> nil) then Ammo^.Hedgehog^.Gear^.State:= Ammo^.Hedgehog^.Gear^.State and (not gstNotKickable);
                         ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch
                         end;
 
@@ -1600,24 +1010,6 @@
     end;
 end;
 
-function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
-var t: PGear;
-begin
-t:= GearsList;
-rX:= sqr(rX);
-rY:= sqr(rY);
-
-while t <> nil do
-    begin
-    if (t <> Gear) and (t^.Kind = Kind) then
-        if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then
-        exit(t);
-    t:= t^.NextGear
-    end;
-
-CheckGearNear:= nil
-end;
-
 {procedure AmmoFlameWork(Ammo: PGear);
 var t: PGear;
 begin
@@ -1638,21 +1030,6 @@
     end;
 end;}
 
-function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear;
-var t: PGear;
-begin
-t:= GearsList;
-rX:= sqr(rX);
-rY:= sqr(rY);
-while t <> nil do
-    begin
-    if t^.Kind in Kind then
-        if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then
-            exit(t);
-    t:= t^.NextGear
-    end;
-CheckGearsNear:= nil
-end;
 
 function CountGears(Kind: TGearType): Longword;
 var t: PGear;
@@ -1668,33 +1045,6 @@
 CountGears:= count;
 end;
 
-procedure ResurrectHedgehog(gear: PGear);
-var tempTeam : PTeam;
-begin
-    AttackBar:= 0;
-    gear^.dX := _0;
-    gear^.dY := _0;
-    gear^.Damage := 0;
-    gear^.Health := gear^.Hedgehog^.InitialHealth;
-    gear^.Hedgehog^.Effects[hePoisoned] := false;
-    if not CurrentHedgehog^.Effects[heResurrectable] then
-        with CurrentHedgehog^ do 
-            begin
-            inc(Team^.stats.AIKills);
-            FreeTexture(Team^.AIKillsTex);
-            Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
-            end;
-    tempTeam := gear^.Hedgehog^.Team;
-    DeleteCI(gear);
-    FindPlace(gear, false, 0, LAND_WIDTH, true); 
-    if gear <> nil then begin
-        RenderHealth(gear^.Hedgehog^);
-        ScriptCall('onGearResurrect', gear^.uid);
-        gear^.State := gstWait;
-    end;
-    RecountTeamHealth(tempTeam);
-end;
-
 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword): PGear;
 begin
     FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0);
@@ -1886,119 +1236,6 @@
     end
 end;
 
-procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean = false);
-
-    function CountNonZeroz(x, y, r, c: LongInt): LongInt;
-    var i: LongInt;
-        count: LongInt = 0;
-    begin
-    if (y and LAND_HEIGHT_MASK) = 0 then
-        for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do
-            if Land[y, i] <> 0 then
-               begin
-               inc(count);
-               if count = c then exit(count)
-               end;
-    CountNonZeroz:= count;
-    end;
-
-var x: LongInt;
-    y, sy: LongInt;
-    ar: array[0..511] of TPoint;
-    ar2: array[0..1023] of TPoint;
-    cnt, cnt2: Longword;
-    delta: LongInt;
-    reallySkip, tryAgain: boolean;
-begin
-reallySkip:= false; // try not skipping proximity at first
-tryAgain:= true;
-while tryAgain do
-    begin
-    delta:= 250;
-    cnt2:= 0;
-    repeat
-        x:= Left + LongInt(GetRandom(Delta));
-        repeat
-            inc(x, Delta);
-            cnt:= 0;
-            y:= min(1024, topY) - 2 * Gear^.Radius;
-            while y < cWaterLine do
-                begin
-                repeat
-                    inc(y, 2);
-                until (y >= cWaterLine) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) = 0);
-
-                sy:= y;
-
-                repeat
-                    inc(y);
-                until (y >= cWaterLine) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) <> 0);
-
-                if (y - sy > Gear^.Radius * 2) and
-                   (((Gear^.Kind = gtExplosives)
-                       and (y < cWaterLine)
-                       and (reallySkip or (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 60, 60) = nil))
-                       and (CountNonZeroz(x, y+1, Gear^.Radius - 1, Gear^.Radius+1) > Gear^.Radius))
-                   or
-                     ((Gear^.Kind <> gtExplosives)
-                       and (y < cWaterLine)
-                       and (reallySkip or (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 110, 110) = nil)))) then
-                    begin
-                    ar[cnt].X:= x;
-                    if withFall then ar[cnt].Y:= sy + Gear^.Radius
-                                else ar[cnt].Y:= y - Gear^.Radius;
-                    inc(cnt)
-                    end;
-
-                inc(y, 45)
-                end;
-
-            if cnt > 0 then
-                with ar[GetRandom(cnt)] do
-                    begin
-                    ar2[cnt2].x:= x;
-                    ar2[cnt2].y:= y;
-                    inc(cnt2)
-                    end
-        until (x + Delta > Right);
-
-        dec(Delta, 60)
-    until (cnt2 > 0) or (Delta < 70);
-    if (cnt2 = 0) and skipProximity and not reallySkip then tryAgain:= true
-    else tryAgain:= false;
-    reallySkip:= true;
-    end;
-
-if cnt2 > 0 then
-    with ar2[GetRandom(cnt2)] do
-        begin
-        Gear^.X:= int2hwFloat(x);
-        Gear^.Y:= int2hwFloat(y);
-        AddFileLog('Assigned Gear coordinates (' + inttostr(x) + ',' + inttostr(y) + ')');
-        end
-    else
-    begin
-    OutError('Can''t find place for Gear', false);
-    if Gear^.Kind = gtHedgehog then Gear^.Hedgehog^.Effects[heResurrectable] := false;
-    DeleteGear(Gear);
-    Gear:= nil
-    end
-end;
-
-function ModifyDamage(dmg: Longword; Gear: PGear): Longword;
-var i: hwFloat;
-begin
-(* Invulnerability cannot be placed in here due to still needing kicks
-   Not without a new damage machine.
-   King check should be in here instead of ApplyDamage since Tiy wants them kicked less
-*)
-i:= _1;
-if (CurrentHedgehog <> nil) and CurrentHedgehog^.King then i:= _1_5;
-if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.King) then
-   ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent * _0_5)
-else
-   ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent)
-end;
 
 function GearByUID(uid : Longword) : PGear;
 var gear: PGear;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uGearsHedgehog.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,1150 @@
+(*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *)
+
+{$INCLUDE "options.inc"}
+
+unit uGearsHedgehog;
+interface
+uses uTypes;
+
+procedure doStepHedgehog(Gear: PGear);
+procedure AfterAttack; 
+procedure HedgehogStep(Gear: PGear); 
+procedure doStepHedgehogMoving(Gear: PGear); 
+procedure HedgehogChAngle(HHGear: PGear); 
+
+implementation
+uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, uMisc, 
+    uCommands, uLocale, uUtils, uVisualGears, uStats, uIO, uScript,
+    uGearsList, uGears, uCollisions, uRandom, uStore, uTeams, 
+    uGearsUtils;
+
+// Shouldn't more of this ammo switching stuff be moved to uAmmos ?
+function ChangeAmmo(HHGear: PGear): boolean;
+var slot, i: Longword;
+    ammoidx: LongInt;
+begin
+ChangeAmmo:= false;
+slot:= HHGear^.MsgParam;
+
+with HHGear^.Hedgehog^ do
+    begin
+    HHGear^.Message:= HHGear^.Message and (not gmSlot);
+    ammoidx:= 0;
+    if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) or
+       ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or
+       ((HHGear^.State and gstHHDriven) = 0) then exit;
+    ChangeAmmo:= true;
+
+    while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx);
+
+    if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(HHGear^.Hedgehog^);
+
+    MultiShootAttacks:= 0;
+    HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
+    
+    if Ammoz[CurAmmoType].Slot = slot then
+        begin
+        i:= 0;
+        repeat
+        inc(ammoidx);
+        if (ammoidx > cMaxSlotAmmoIndex) then
+            begin
+            inc(i);
+            CurAmmoType:= amNothing;
+            ammoidx:= -1;
+            //TryDo(i < 2, 'Engine bug: no ammo in current slot', true)
+            end;
+        until (i = 1) or ((Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns))
+        end 
+    else
+        begin
+        i:= 0;
+        // check whether there is ammo in slot
+        while (i <= cMaxSlotAmmoIndex)
+          and ((Ammo^[slot, i].Count = 0)
+               or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns)) do inc(i);
+
+        if i <= cMaxSlotAmmoIndex then ammoidx:= i
+        else ammoidx:= -1
+        end;
+        if ammoidx >= 0 then CurAmmoType:= Ammo^[slot, ammoidx].AmmoType;
+    end
+end;
+
+procedure HHSetWeapon(HHGear: PGear);
+var t: LongInt;
+    weap: TAmmoType;
+    Hedgehog: PHedgehog;
+    s: boolean;
+begin
+s:= false;
+
+weap:= TAmmoType(HHGear^.MsgParam);
+Hedgehog:= HHGear^.Hedgehog;
+
+if Hedgehog^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then exit; // weapon is not activated yet
+
+HHGear^.MsgParam:= Ammoz[weap].Slot;
+
+t:= cMaxSlotAmmoIndex;
+
+HHGear^.Message:= HHGear^.Message and (not gmWeapon);
+
+with Hedgehog^ do
+    while (CurAmmoType <> weap) and (t >= 0) do
+        begin
+        s:= ChangeAmmo(HHGear);
+        dec(t)
+        end;
+
+if s then ApplyAmmoChanges(HHGear^.Hedgehog^)
+end;
+
+procedure HHSetTimer(Gear: PGear);
+var CurWeapon: PAmmo;
+    color: LongWord;
+begin
+Gear^.Message:= Gear^.Message and (not gmTimer);
+CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
+with Gear^.Hedgehog^ do
+    if ((Gear^.Message and gmPrecise) <> 0) and ((CurWeapon^.Propz and ammoprop_SetBounce) <> 0) then
+        begin
+        color:= Gear^.Hedgehog^.Team^.Clan^.Color;
+        case Gear^.MsgParam of
+            1: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate);
+               CurWeapon^.Bounciness:= 350;
+               end;
+            2: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate);
+               CurWeapon^.Bounciness:= 700;
+               end;
+            3: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate);
+               CurWeapon^.Bounciness:= 1000;
+               end;
+            4: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate);
+               CurWeapon^.Bounciness:= 2000;
+               end;
+            5: begin
+               AddCaption(format(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate);
+               CurWeapon^.Bounciness:= 4000;
+               end
+            end
+        end
+    else if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then
+        begin
+        CurWeapon^.Timer:= 1000 * Gear^.MsgParam;
+        with CurrentTeam^ do
+            ApplyAmmoChanges(Hedgehogs[CurrHedgehog]);
+        end;
+end;
+
+
+procedure Attack(Gear: PGear);
+var xx, yy, newDx, newDy, lx, ly: hwFloat;
+    speech: PVisualGear;
+    newGear:  PGear;
+    CurWeapon: PAmmo;
+    altUse: boolean;
+    elastic: hwFloat;
+begin
+newGear:= nil;
+bShowFinger:= false;
+CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
+with Gear^,
+     Gear^.Hedgehog^ do
+     begin
+     if ((State and gstHHDriven) <> 0)and
+        ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
+        (((State and gstMoving) = 0) or
+            (Power > 0) or
+            (CurAmmoType = amTeleport) or 
+            // Allow attacks while moving on ammo with AltAttack
+            ((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or
+            ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and
+        ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then
+        begin
+        State:= State or gstAttacking;
+        if Power = cMaxPower then Message:= Message and (not gmAttack)
+        else if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) = 0 then Message:= Message and (not gmAttack)
+        else begin
+             if Power = 0 then
+                begin
+                AttackBar:= CurrentTeam^.AttackBar;
+                PlaySound(sndThrowPowerUp)
+                end;
+             inc(Power)
+             end;
+        if ((Message and gmAttack) <> 0) then exit;
+
+        if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0 then
+           begin
+           StopSound(sndThrowPowerUp);
+           PlaySound(sndThrowRelease);
+           end;
+
+        xx:= SignAs(AngleSin(Angle), dX);
+        yy:= -AngleCos(Angle);
+
+        lx:= X + int2hwfloat(round(GetLaunchX(CurAmmoType, hwSign(dX), Angle)));
+        ly:= Y + int2hwfloat(round(GetLaunchY(CurAmmoType, Angle)));
+
+        if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then xx:= - xx;
+        if Ammoz[CurAmmoType].Ammo.AttackVoice <> sndNone then
+           AddVoice(Ammoz[CurAmmoType].Ammo.AttackVoice, CurrentTeam^.voicepack);
+
+// Initiating alt attack
+        if  (CurAmmoGear <> nil) and
+            ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and
+            ((Gear^.Message and gmLJump) <> 0) and
+            ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
+            begin
+            newDx:= dX / _2; 
+            newDy:= dY / _2;
+            altUse:= true;
+            end
+        else
+            begin
+            newDx:= xx*Power/cPowerDivisor;
+            newDy:= yy*Power/cPowerDivisor;
+            altUse:= false
+            end;
+
+             case CurAmmoType of
+                      amGrenade: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGrenade,         0, newDx, newDy, CurWeapon^.Timer);
+                      amMolotov: newGear:= AddGear(hwRound(lx), hwRound(ly), gtMolotov,      0, newDx, newDy, 0);
+                  amClusterBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtClusterBomb,  0, newDx, newDy, CurWeapon^.Timer);
+                      amGasBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGasBomb,      0, newDx, newDy, CurWeapon^.Timer);
+                      amBazooka: newGear:= AddGear(hwRound(lx), hwRound(ly), gtShell,        0, newDx, newDy, 0);
+                     amSnowball: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSnowball,     0, newDx, newDy, 0);
+                          amBee: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBee,          0, newDx, newDy, 0);
+                      amShotgun: begin
+                                 PlaySound(sndShotgunReload);
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
+                                 end;
+                   amPickHammer: newGear:= AddGear(hwRound(lx), hwRound(ly) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
+                         amSkip: ParseCommand('/skip', true);
+                         amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
+                         amMine: if altUse then
+                                    newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, newDx, newDy, 3000)
+                                 else
+                                    newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
+                        amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
+                       amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
+                      amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
+                    amPortalGun: begin
+                                 newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, 
+                                 // set selected color
+                                 CurWeapon^.Pos);
+                                 end;
+                  amSniperRifle: begin
+                                 PlaySound(sndSniperReload);
+                                 newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0);
+                                 end;
+                     amDynamite: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
+                    amFirePunch: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0);
+                         amWhip: begin
+                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
+                                 PlaySound(sndWhipCrack)
+                                 end;
+                       amHammer: begin
+                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtHammer, 0, SignAs(_1, dX), - _0_8, 0);
+                                 PlaySound(sndWhack)
+                                 end;
+                  amBaseballBat: begin
+                                 newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtShover, gsttmpFlag, xx * _0_5, yy * _0_5, 0);
+                                 PlaySound(sndBaseballBat) // TODO: Only play if something is hit?
+                                 end;
+                    amParachute: begin
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtParachute, 0, _0, _0, 0);
+                                 PlaySound(sndParachute)
+                                 end;
+                    // we save CurWeapon^.Pos (in this case: cursor direction) by using it as (otherwise irrelevant) X value of the new gear.
+                    amAirAttack: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 0, _0, _0, 0);
+                   amMineStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 1, _0, _0, 0);
+                  amDrillStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
+                       amNapalm: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0);
+                    amBlowTorch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0);
+                       amGirder: newGear:= AddGear(0, 0, gtGirder, CurWeapon^.Pos, _0, _0, 0);
+                     amTeleport: newGear:= AddGear(CurWeapon^.Pos, 0, gtTeleport, 0, _0, _0, 0);
+                       amSwitch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSwitcher, 0, _0, _0, 0);
+                       amMortar: begin
+                                 playSound(sndMortar);
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtMortar,  0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
+                                 end;
+                      amRCPlane: begin
+                                 newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane,  0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
+                                 newGear^.SoundChannel:= LoopSound(sndRCPlane, nil)
+                                 end;
+                       amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
+                         amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0);
+                    amSeduction: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSeduction, 0, _0, _0, 0);
+                   amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon,  0, newDx, newDy, CurWeapon^.Timer);
+                  amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb,    0, newDx, newDy, 0);
+                        amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0);
+                      amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
+                    amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
+                    amBirdy: begin
+                             PlaySound(sndWhistle);
+                             newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0);
+                             end;
+                      amLowGravity: begin
+                                    PlaySound(sndLowGravity);
+                                    cGravity:= cMaxWindSpeed;
+                                    cGravityf:= 0.00025
+                                    end;
+                      amExtraDamage:begin 
+                                    PlaySound(sndHellishImpact4);
+                                    cDamageModifier:= _1_5
+                                    end;
+                      amInvulnerable: Invulnerable:= true;
+                      amExtraTime:  begin
+                                    PlaySound(sndSwitchHog);
+                                    TurnTimeLeft:= TurnTimeLeft + 30000
+                                    end;
+                      amLaserSight: cLaserSighting:= true;
+                      amVampiric: begin
+                                  PlaySound(sndOw1, Team^.voicepack);
+                                  cVampiric:= true;
+                                  end;
+                      amPiano: begin
+                               // Tuck the hedgehog away until the piano attack is completed
+                               Unplaced:= true;
+                               X:= _0;
+                               Y:= _0;
+                               newGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
+                               PauseMusic
+                               end;
+                      amFlamethrower: newGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower,  0, xx * _0_5, yy * _0_5, 0);
+                      amLandGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtLandGun,  0, xx * _0_5, yy * _0_5, 0);
+                    amResurrector: begin
+                        newGear:= AddGear(hwRound(lx), hwRound(ly),
+                                gtResurrector, 0, _0, _0, 0);
+                        newGear^.SoundChannel := LoopSound(sndResurrector);
+                    end;
+                   //amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0);
+                     amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000);
+                        amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
+                  end;
+             case CurAmmoType of
+                      amGrenade, amMolotov, 
+                  amClusterBomb, amGasBomb, 
+                      amBazooka, amSnowball, 
+                          amBee, amSMine,
+                       amMortar, amWatermelon,
+                  amHellishBomb, amDrill: FollowGear:= newGear;
+
+                      amShotgun, amPickHammer,
+                         amRope, amDEagle,
+                      amSineGun, amSniperRifle,
+                    amFirePunch, amWhip,
+                       amHammer, amBaseballBat,
+                    amParachute, amBlowTorch,
+                       amGirder, amTeleport,
+                       amSwitch, amRCPlane,
+                     amKamikaze, amCake,
+                    amSeduction, amBallgun,
+                      amJetpack, amBirdy,
+                 amFlamethrower, amLandGun,
+                  amResurrector, amStructure,
+                       amTardis, amPiano: CurAmmoGear:= newGear;
+                  end;
+              if (CurAmmoType = amMine) or (CurAmmoType = amSMine) and (GameFlags and gfInfAttack <> 0) then newGear^.FlightTime:= GameTicks + 1000;
+        if Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then
+            begin
+            newGear^.Target.X:= TargetPoint.X;
+            newGear^.Target.Y:= TargetPoint.Y
+            end;
+
+        // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
+        if altUse then FollowGear:= nil;
+
+        if (newGear <> nil) and ((Ammoz[newGear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) then
+            begin
+            elastic:=  int2hwfloat(CurWeapon^.Bounciness) / _1000;
+
+            if elastic < _1 then newGear^.Elasticity:= newGear^.Elasticity * elastic
+            else if elastic > _1 then newGear^.Elasticity:= _1 - ((_1-newGear^.Elasticity) / elastic);
+(* Experimented with friction modifier. Didn't seem helpful 
+            fric:= int2hwfloat(CurWeapon^.Bounciness) / _250;
+            if fric < _1 then newGear^.Friction:= newGear^.Friction * fric
+            else if fric > _1 then newGear^.Friction:= _1 - ((_1-newGear^.Friction) / fric)*)
+            end;
+
+
+        uStats.AmmoUsed(CurAmmoType);
+
+        if not (SpeechText = '') then
+            begin
+            speech:= AddVisualGear(0, 0, vgtSpeechBubble);
+            if speech <> nil then
+               begin
+               speech^.Text:= SpeechText;
+               speech^.Hedgehog:= Gear^.Hedgehog;
+               speech^.FrameTicks:= SpeechType;
+               end;
+            SpeechText:= ''
+            end;
+
+        Power:= 0;
+        if (CurAmmoGear <> nil)
+           and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
+           begin
+           Message:= Message or gmAttack;
+           CurAmmoGear^.Message:= Message
+           end else begin
+           if not CurrentTeam^.ExtDriven and
+             ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then SendIPC('a');
+           AfterAttack;
+           end
+        end else Message:= Message and (not gmAttack);
+     end;
+     TargetPoint.X := NoPointX;
+     ScriptCall('onHogAttack');
+end;
+
+procedure AfterAttack;
+var s: shortstring;
+    a: TAmmoType;
+begin
+with CurrentHedgehog^.Gear^,
+        CurrentHedgehog^ do
+    begin
+    a:= CurAmmoType;
+    State:= State and (not gstAttacking);
+    if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then
+        begin
+        Inc(MultiShootAttacks);
+        
+        if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then
+            begin
+            s:= inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1);
+            AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
+            end;
+        
+        if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) or
+            ((GameFlags and gfMultiWeapon) <> 0) then
+            begin
+            isInMultiShoot:= true
+            end
+        else
+            begin
+            OnUsedAmmo(CurrentHedgehog^);
+            if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (((GameFlags and gfInfAttack) = 0) or PlacingHogs) then
+                begin
+                if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft;
+                TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100;
+                end;
+            if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) then State:= State or gstAttacked;
+            if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then ApplyAmmoChanges(CurrentHedgehog^)
+            end;
+        end
+    else
+        begin
+        OnUsedAmmo(CurrentHedgehog^);
+        ApplyAmmoChanges(CurrentHedgehog^);
+        end;
+    AttackBar:= 0
+    end
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepHedgehogDead(Gear: PGear);
+const frametime = 200;
+      timertime = frametime * 6;
+begin
+if Gear^.Hedgehog^.Unplaced then exit;
+if Gear^.Timer > 1 then
+    begin
+    AllInactive:= false;
+    dec(Gear^.Timer);
+    if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos)
+    end 
+else if Gear^.Timer = 1 then
+    begin
+    Gear^.State:= Gear^.State or gstNoDamage;
+    doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, CurrentHedgehog, EXPLAutoSound);
+    AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
+    DeleteGear(Gear);
+    SetAllToActive
+    end 
+else // Gear^.Timer = 0
+    begin
+    AllInactive:= false;
+    Gear^.Z:= cCurrHHZ;
+    RemoveGearFromList(Gear);
+    InsertGearToList(Gear);
+    PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
+    Gear^.Pos:= 0;
+    Gear^.Timer:= timertime
+    end
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepHedgehogGone(Gear: PGear);
+const frametime = 65;
+      timertime = frametime * 11;
+begin
+if Gear^.Hedgehog^.Unplaced then exit;
+if Gear^.Timer > 1 then
+    begin
+    AllInactive:= false;
+    dec(Gear^.Timer);
+    if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos)
+    end else
+if Gear^.Timer = 1 then
+    begin
+    DeleteGear(Gear);
+    SetAllToActive
+    end else // Gear^.Timer = 0
+    begin
+    AllInactive:= false;
+    Gear^.Z:= cCurrHHZ;
+    RemoveGearFromList(Gear);
+    InsertGearToList(Gear);
+    PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
+    PlaySound(sndWarp);
+    Gear^.Pos:= 0;
+    Gear^.Timer:= timertime
+    end
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure PickUp(HH, Gear: PGear);
+var s: shortstring;
+    a: TAmmoType;
+    i: LongInt;
+    vga: PVisualGear;
+begin
+Gear^.Message:= gmDestroy;
+PlaySound(sndShotgunReload);
+if (Gear^.Pos and posCaseExplode) <> 0 then
+    if (Gear^.Pos and posCasePoison) <> 0 then
+        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned)
+    else
+        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound)
+else if (Gear^.Pos and posCasePoison) <> 0 then
+    doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned + EXPLNoDamage)
+else
+case Gear^.Pos of
+       posCaseUtility,
+       posCaseAmmo: begin
+                    if Gear^.AmmoType <> amNothing then a:= Gear^.AmmoType 
+                    else
+                        begin
+                        for i:= 0 to GameTicks and $7F do GetRandom(2); // Burn some random numbers
+                        if Gear^.Pos = posCaseUtility then a:= GetUtility
+                        else a:= GetAmmo
+                        end;
+                    AddAmmo(HH^.Hedgehog^, a);
+// Possibly needs to check shared clan ammo game flag once added.
+// On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up
+                    if (not (HH^.Hedgehog^.Team^.ExtDriven 
+                      or (HH^.Hedgehog^.BotLevel > 0)))
+                      or (HH^.Hedgehog^.Team^.Clan^.ClanIndex = LocalClan)
+                      or (GameType = gmtDemo)  then
+                        begin
+                        s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')';
+                        AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
+
+                        // show ammo icon
+                        vga:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtAmmo);
+                        if vga <> nil then
+                            vga^.Frame:= Longword(a);
+                        end;
+
+                    end;
+     posCaseHealth: begin
+                    inc(HH^.Health, Gear^.Health);
+                    HH^.Hedgehog^.Effects[hePoisoned] := false;
+                    str(Gear^.Health, s);
+                    s:= '+' + s;
+                    AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
+                    RenderHealth(HH^.Hedgehog^);
+                    RecountTeamHealth(HH^.Hedgehog^.Team);
+
+                    i:= 0;
+                    while i < Gear^.Health do
+                        begin
+                        vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot);
+                        if vga <> nil then
+                            with vga^ do
+                                begin
+                                Tint:= $00FF00FF;
+                                State:= ord(sprHealth)
+                                end;
+                        inc(i, 5);
+                        end;
+                    end;
+     end
+end;
+
+const StepTicks: LongWord = 0;
+
+procedure HedgehogStep(Gear: PGear);
+var PrevdX: LongInt;
+    CurWeapon: PAmmo;
+begin
+CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
+if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then
+   begin
+   if isCursorVisible then
+      with Gear^.Hedgehog^ do
+        with CurWeapon^ do
+          begin
+          if (Gear^.Message and gmLeft  ) <> 0 then
+             Pos:= (Pos - 1 + Ammoz[AmmoType].PosCount) mod Ammoz[AmmoType].PosCount
+          else
+          if (Gear^.Message and gmRight ) <> 0 then
+             Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount
+          else exit;
+          StepTicks:= 200;
+          exit
+          end;
+
+    if ((Gear^.Message and gmAnimate) <> 0) then
+        begin
+        Gear^.Message:= 0;
+        Gear^.State:= Gear^.State or gstAnimation;
+        Gear^.Tag:= Gear^.MsgParam;
+        Gear^.Timer:= 0;
+        Gear^.Pos:= 0
+        end;
+
+   if ((Gear^.Message and gmLJump ) <> 0) then
+      begin
+      Gear^.Message:= Gear^.Message and (not gmLJump);
+      DeleteCI(Gear);
+      if TestCollisionYwithGear(Gear, -1) = 0 then
+         if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else
+         if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1;
+      if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX))
+         or   (TestCollisionYwithGear(Gear, -1) <> 0)) then
+         begin
+         Gear^.dY:= -_0_15;
+         if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX);
+         Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
+         PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack);
+         exit
+         end;
+      end;
+
+   if ((Gear^.Message and gmHJump ) <> 0) then
+      begin
+      DeleteCI(Gear);
+      Gear^.Message:= Gear^.Message and (not gmHJump);
+
+      Gear^.dY:= -_0_2;
+      SetLittle(Gear^.dX);
+      Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
+      PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack);
+      exit
+      end;
+
+   PrevdX:= hwSign(Gear^.dX);
+   if (Gear^.Message and gmLeft  )<>0 then Gear^.dX:= -cLittle else
+   if (Gear^.Message and gmRight )<>0 then Gear^.dX:=  cLittle else exit;
+
+   if (Gear^.Message and (gmLeft or gmRight)) <> 0 then
+      begin
+      StepSoundTimer:= cHHStepTicks;
+      end;
+   
+   StepTicks:= cHHStepTicks;
+   if PrevdX <> hwSign(Gear^.dX) then
+      begin
+      FollowGear:= Gear;
+      exit
+      end;
+   DeleteCI(Gear); // must be after exit!! (see previous line)
+
+   Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
+   if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
+      begin
+      if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX))
+         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
+      if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX))
+         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
+      if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX))
+         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
+      if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
+         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
+      if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
+         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
+      if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
+         or (TestCollisionYwithGear(Gear, -1) <> 0)) then Gear^.Y:= Gear^.Y - _1;
+      end;
+
+   if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then
+      Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX);
+
+   SetAllHHToActive;
+
+   if TestCollisionYwithGear(Gear, 1) = 0 then
+   begin
+   Gear^.Y:= Gear^.Y + _1;
+   if TestCollisionYwithGear(Gear, 1) = 0 then
+   begin
+   Gear^.Y:= Gear^.Y + _1;
+   if TestCollisionYwithGear(Gear, 1) = 0 then
+   begin
+   Gear^.Y:= Gear^.Y + _1;
+   if TestCollisionYwithGear(Gear, 1) = 0 then
+   begin
+   Gear^.Y:= Gear^.Y + _1;
+   if TestCollisionYwithGear(Gear, 1) = 0 then
+   begin
+   Gear^.Y:= Gear^.Y + _1;
+   if TestCollisionYwithGear(Gear, 1) = 0 then
+   begin
+   Gear^.Y:= Gear^.Y + _1;
+   if TestCollisionYwithGear(Gear, 1) = 0 then
+      begin
+      Gear^.Y:= Gear^.Y - _6;
+      Gear^.dY:= _0;
+      Gear^.State:= Gear^.State or gstMoving;
+      exit
+      end;
+   end
+   end
+   end
+   end
+   end
+   end;
+   AddGearCI(Gear)
+   end
+end;
+
+procedure HedgehogChAngle(HHGear: PGear);
+var da: LongWord;
+begin
+with HHGear^.Hedgehog^ do
+    if ((CurAmmoType = amRope) and 
+        ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) or
+       ((CurAmmoType = amPortalGun) and 
+        ((HHGear^.State and gstMoving) <> 0)) then da:= 2
+    else da:= 1;
+
+if (((HHGear^.Message and gmPrecise) = 0) or ((GameTicks mod 5) = 1)) then
+    if ((HHGear^.Message and gmUp) <> 0) and (HHGear^.Angle >= CurMinAngle + da) then dec(HHGear^.Angle, da)
+    else
+    if ((HHGear^.Message and gmDown) <> 0) and (HHGear^.Angle + da <= CurMaxAngle) then inc(HHGear^.Angle, da)
+end;
+
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepHedgehogMoving(Gear: PGear);
+var isFalling, isUnderwater: boolean;
+    land: Word;
+begin
+land:= 0;
+isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius;
+if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862;
+if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862;
+
+if Gear^.Hedgehog^.Unplaced then
+   begin
+   Gear^.dY:= _0;
+   Gear^.dX:= _0;
+   Gear^.State:= Gear^.State and (not gstMoving);
+   exit
+   end;
+isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1);
+if isFalling then
+   begin
+   if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then Gear^.dY:= _0;
+   Gear^.State:= Gear^.State or gstMoving;
+   if (CurrentHedgehog^.Gear = Gear)
+        and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then 
+        begin
+        FollowGear:= Gear;
+        end;
+   if isUnderwater then Gear^.dY:= Gear^.dY + cGravity / _2
+   else
+       begin
+       Gear^.dY:= Gear^.dY + cGravity;
+// this set of circumstances could be less complex if jumping was more clearly identified
+       if ((GameFlags and gfMoreWind) <> 0) and 
+          (((Gear^.Damage <> 0) or
+          ((CurAmmoGear <> nil) and
+            ((CurAmmoGear^.AmmoType = amJetpack) or
+            (CurAmmoGear^.AmmoType = amBirdy))) or
+          ((Gear^.dY.QWordValue + Gear^.dX.QWordValue) > _0_55.QWordValue)))
+          then Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
+       end
+   end 
+else
+   begin
+   land:= TestCollisionYwithGear(Gear, 1);
+   if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) and ((land and lfIce) = 0)
+      and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
+
+   if not Gear^.dY.isNegative then
+      begin
+      CheckHHDamage(Gear);
+
+      if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) and
+         (Gear^.dX.QWordValue < _0_02.QWordValue) then Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump
+
+      Gear^.State:= Gear^.State and (not (gstHHJumping or gstHHHJump));
+      Gear^.dY:= _0;
+      end else Gear^.dY:= Gear^.dY + cGravity;
+
+   if ((Gear^.State and gstMoving) <> 0) then
+       begin
+       if land and lfIce <> 0 then
+           begin
+           Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2)
+           end
+       else Gear^.dX:= Gear^.dX * Gear^.Friction;
+       end
+   end;
+
+if (Gear^.State <> 0) then DeleteCI(Gear);
+
+if isUnderwater then
+   begin
+   Gear^.dY:= Gear^.dY * _0_999;
+   Gear^.dX:= Gear^.dX * _0_999;
+   end;
+
+if (Gear^.State and gstMoving) <> 0 then
+   if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then
+      if not isFalling then
+         if hwAbs(Gear^.dX) > _0_01 then
+            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -1, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_96; Gear^.Y:= Gear^.Y - _1 end else
+            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -2, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_93; Gear^.Y:= Gear^.Y - _2 end else
+            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_9 ; Gear^.Y:= Gear^.Y - _3 end else
+            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_87; Gear^.Y:= Gear^.Y - _4 end else
+            if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_84; Gear^.Y:= Gear^.Y - _5 end else
+            if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX
+                                   else begin
+                                        Gear^.State:= Gear^.State and (not gstMoving);
+                                        while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1;
+                                        SetLittle(Gear^.dX)
+                                        end
+            else begin
+                 Gear^.State:= Gear^.State and (not gstMoving);
+                 while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1;
+                 SetLittle(Gear^.dX)
+                 end
+         else if (hwAbs(Gear^.dX) > cLittle)
+                and ((Gear^.State and gstHHJumping) = 0)
+                then Gear^.dX:= -Gear^.Elasticity * Gear^.dX
+                else SetLittle(Gear^.dX);
+
+if (not isFalling) and
+   (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
+   begin
+   Gear^.State:= Gear^.State and (not gstWinner);
+   Gear^.State:= Gear^.State and (not gstMoving);
+   while TestCollisionYWithGear(Gear,1) = 0 do Gear^.Y:= Gear^.Y+_1;
+   SetLittle(Gear^.dX);
+   Gear^.dY:= _0
+   end else Gear^.State:= Gear^.State or gstMoving;
+
+if (Gear^.State and gstMoving) <> 0 then
+   begin
+   Gear^.State:= Gear^.State and (not gstAnimation);
+// ARTILLERY but not being moved by explosions
+   Gear^.X:= Gear^.X + Gear^.dX;
+   Gear^.Y:= Gear^.Y + Gear^.dY;
+   if (not Gear^.dY.isNegative) and
+      (not TestCollisionYKick(Gear, 1)) and
+       TestCollisionYwithXYShift(Gear, 0, 1, 1) then
+      begin
+      CheckHHDamage(Gear);
+      Gear^.dY:= _0;
+      Gear^.Y:= Gear^.Y + _1
+      end;
+   CheckGearDrowning(Gear);
+   // hide target cursor if current hog is drowning
+   if (Gear^.State and gstDrowning) <> 0 then
+       if (CurrentHedgehog^.Gear = Gear) then
+          isCursorVisible:= false
+   end;
+
+if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then
+    begin
+    inc(Gear^.FlightTime);
+    if Gear^.FlightTime = 3000 then
+        begin
+        AddCaption(GetEventString(eidHomerun), cWhiteColor, capgrpMessage);
+        PlaySound(sndHomerun)
+        end;
+    end
+else
+    begin
+    uStats.hedgehogFlight(Gear, Gear^.FlightTime);
+    Gear^.FlightTime:= 0;
+    end;
+
+end;
+
+procedure doStepHedgehogDriven(HHGear: PGear);
+var t: PGear;
+    wasJumping: boolean;
+    Hedgehog: PHedgehog;
+begin
+Hedgehog:= HHGear^.Hedgehog;
+if isInMultiShoot then
+   HHGear^.Message:= 0;
+
+if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Utility) <> 0) and isInMultiShoot then 
+    AllInactive:= true
+else if not isInMultiShoot then AllInactive:= false;
+
+if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then
+    begin
+    if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft;
+    TurnTimeLeft:= 0;
+    isCursorVisible:= false;
+    HHGear^.State:= HHGear^.State and (not (gstHHDriven or gstAnimation or gstAttacking));
+    AttackBar:= 0;
+    if HHGear^.Damage > 0 then
+        HHGear^.State:= HHGear^.State and (not (gstHHJumping or gstHHHJump));
+    exit
+    end;
+
+if (HHGear^.State and gstAnimation) <> 0 then
+    begin
+    HHGear^.Message:= 0;
+    if (HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].VoiceDelay) and (HHGear^.Timer = 0) then PlaySound(Wavez[TWave(HHGear^.Tag)].Voice, Hedgehog^.Team^.voicepack);
+    inc(HHGear^.Timer);
+    if HHGear^.Timer = Wavez[TWave(HHGear^.Tag)].Interval then
+        begin
+        HHGear^.Timer:= 0;
+        inc(HHGear^.Pos);
+        if HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].FramesCount then
+            HHGear^.State:= HHGear^.State and (not gstAnimation)
+        end;
+    exit
+    end;
+
+if ((HHGear^.State and gstMoving) <> 0)
+    or (StepTicks = cHHStepTicks)
+    or (CurAmmoGear <> nil) then // we are moving
+    begin
+    with Hedgehog^ do
+        if (CurAmmoGear = nil)
+        and (HHGear^.dY > _0_39)
+        and (CurAmmoType = amParachute) then HHGear^.Message:= HHGear^.Message or gmAttack;
+    // check for case with ammo
+    t:= CheckGearNear(HHGear, gtCase, 36, 36);
+    if t <> nil then
+        PickUp(HHGear, t)
+    end;
+
+if (CurAmmoGear = nil) then
+    if (((HHGear^.Message and gmAttack) <> 0)
+        or ((HHGear^.State and gstAttacking) <> 0)) then
+        Attack(HHGear) // should be before others to avoid desync with '/put' msg and changing weapon msgs
+    else
+else 
+    with Hedgehog^ do
+        if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)
+            and ((HHGear^.Message and gmLJump) <> 0)
+            and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
+            begin
+            Attack(HHGear);
+            HHGear^.Message:= HHGear^.Message and (not gmLJump)
+            end;
+
+if (CurAmmoGear = nil)
+    or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) 
+    or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then
+    begin
+    if ((HHGear^.Message and gmSlot) <> 0) then
+        if ChangeAmmo(HHGear) then ApplyAmmoChanges(Hedgehog^);
+
+    if ((HHGear^.Message and gmWeapon) <> 0) then HHSetWeapon(HHGear);
+
+    if ((HHGear^.Message and gmTimer) <> 0) then HHSetTimer(HHGear);
+    end;
+
+if CurAmmoGear <> nil then
+   begin
+   CurAmmoGear^.Message:= HHGear^.Message;
+   exit
+   end;
+
+if not isInMultiShoot then
+   HedgehogChAngle(HHGear);
+
+if (HHGear^.State and gstMoving) <> 0 then
+    begin
+    wasJumping:= ((HHGear^.State and gstHHJumping) <> 0);
+
+    if ((HHGear^.Message and gmHJump) <> 0) and
+        wasJumping and
+        ((HHGear^.State and gstHHHJump) = 0) then
+        if (not (hwAbs(HHGear^.dX) > cLittle)) and (HHGear^.dY < -_0_02) then
+            begin
+            HHGear^.State:= HHGear^.State or gstHHHJump;
+            HHGear^.dY:= -_0_25;
+            if not cArtillery then HHGear^.dX:= -SignAs(_0_02, HHGear^.dX);
+            PlaySound(sndJump2, Hedgehog^.Team^.voicepack)
+            end;
+
+    HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
+
+    if (not cArtillery) and wasJumping and
+        TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX);
+
+    if Hedgehog^.Gear <> nil then doStepHedgehogMoving(HHGear);
+
+    if ((HHGear^.State and (gstMoving or gstDrowning)) = 0) then
+        begin
+        AddGearCI(HHGear);
+        if wasJumping then
+            StepTicks:= 410
+        else
+            StepTicks:= 95
+        end;
+    exit
+    end;
+
+    if not isInMultiShoot and (Hedgehog^.Gear <> nil) then
+        begin
+        if StepTicks > 0 then dec(StepTicks);
+        if (StepTicks = 0) then HedgehogStep(HHGear)
+        end
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepHedgehogFree(Gear: PGear);
+var prevState: Longword;
+begin
+prevState:= Gear^.State;
+
+doStepHedgehogMoving(Gear);
+
+if (Gear^.State and (gstMoving or gstDrowning)) <> 0 then
+    begin
+    if Gear^.Damage > 0 then CalcRotationDirAngle(Gear);
+    AllInactive:= false;
+    exit
+    end;
+
+if (Gear^.Health = 0) then
+    begin
+    if PrvInactive or ((GameFlags and gfInfAttack) <> 0) then
+        begin
+        Gear^.Timer:= 0;
+        FollowGear:= Gear;
+        PrvInactive:= false;
+        AllInactive:= false;
+
+        if (Gear^.State and gstHHGone) = 0 then
+            begin
+            Gear^.Hedgehog^.Effects[hePoisoned] := false;
+            if Gear^.Hedgehog^.Effects[heResurrectable] then begin
+                ResurrectHedgehog(Gear);
+            end else 
+                begin
+                Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation);
+                Gear^.doStep:= @doStepHedgehogDead;
+                // Death message
+                AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
+                end;
+            end
+        else
+            begin
+            Gear^.State:= Gear^.State and (not gstAnimation);
+            Gear^.doStep:= @doStepHedgehogGone;
+
+            // Gone message
+            AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
+            end
+        end;
+    exit
+    end;
+
+if ((Gear^.State and gstWait) = 0) and
+    (prevState <> Gear^.State) then
+    begin
+    Gear^.State:= Gear^.State or gstWait;
+    Gear^.Timer:= 150
+    end else
+    begin
+    if Gear^.Timer = 0 then
+        begin
+        Gear^.State:= Gear^.State and (not (gstWait or gstLoser or gstWinner or gstAttacked or gstNotKickable or gstHHChooseTarget));
+        Gear^.Active:= false;
+        AddGearCI(Gear);
+        exit
+        end else dec(Gear^.Timer)
+    end;
+
+AllInactive:= false
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepHedgehog(Gear: PGear);
+(*
+var x,y,tx,ty: LongInt;
+    tdX, tdY, slope: hwFloat; 
+    land: Word; *)
+var slope: hwFloat; 
+begin
+if (Gear^.Message and gmDestroy) <> 0 then
+    begin
+    DeleteGear(Gear);
+    exit
+    end;
+
+if (Gear^.State and gstHHDriven) = 0 then
+    doStepHedgehogFree(Gear)
+else
+    begin
+    with Gear^.Hedgehog^ do
+        if Team^.hasGone then
+            TeamGoneEffect(Team^)
+        else
+            doStepHedgehogDriven(Gear)
+    end;
+if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0) and
+   (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0) and
+   (not Gear^.dY.isNegative) and
+   (GameTicks mod (100*LongWOrd(hwRound(cMaxWindSpeed*2/cGravity))) = 0) and
+   (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then
+    begin
+    slope:= CalcSlopeBelowGear(Gear);
+    Gear^.dX:=Gear^.dX+slope*_0_07;
+    if slope.QWordValue <> 0 then Gear^.State:= Gear^.State or gstMoving;
+(*
+    x:= hwRound(Gear^.X);
+    y:= hwRound(Gear^.Y);
+    AddVisualGear(x, y, vgtSmokeTrace);
+    AddVisualGear(x - hwRound(_5*slope), y + hwRound(_5*slope), vgtSmokeTrace);
+    AddVisualGear(x + hwRound(_5*slope), y - hwRound(_5*slope), vgtSmokeTrace);
+    AddVisualGear(x - hwRound(_20 * slope), y + hwRound(_20 * slope), vgtSmokeTrace);
+    AddVisualGear(x + hwRound(_20 * slope), y - hwRound(_20 * slope), vgtSmokeTrace);
+    AddVisualGear(x - hwRound(_30 * slope), y + hwRound(_30 * slope), vgtSmokeTrace);
+    AddVisualGear(x + hwRound(_30 * slope), y - hwRound(_30 * slope), vgtSmokeTrace);
+    AddVisualGear(x - hwRound(_40 * slope), y + hwRound(_40 * slope), vgtSmokeTrace);
+    AddVisualGear(x + hwRound(_40 * slope), y - hwRound(_40 * slope), vgtSmokeTrace);
+    AddVisualGear(x - hwRound(_50 * slope), y + hwRound(_50 * slope), vgtSmokeTrace);
+    AddVisualGear(x + hwRound(_50 * slope), y - hwRound(_50 * slope), vgtSmokeTrace); *)
+    end
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uGearsList.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,542 @@
+(*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *)
+
+{$INCLUDE "options.inc"}
+unit uGearsList;
+
+interface
+uses uFloat, uTypes;
+
+function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
+procedure DeleteGear(Gear: PGear);
+
+implementation
+
+uses uDebug, uRandom, uUtils, uConsts, uVariables, uAmmos, uTeams, uStats,
+    uTextures, uScript, uRenderUtils, uAI, uCollisions, uGearsHedgehog;
+
+procedure InsertGearToList(Gear: PGear);
+var tmp, ptmp: PGear;
+begin
+    tmp:= GearsList;
+    ptmp:= GearsList;
+    while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do
+        begin
+        ptmp:= tmp;
+        tmp:= tmp^.NextGear
+        end;
+
+    if ptmp <> tmp then
+        begin
+        Gear^.NextGear:= ptmp^.NextGear;
+        Gear^.PrevGear:= ptmp;
+        if ptmp^.NextGear <> nil then ptmp^.NextGear^.PrevGear:= Gear;
+        ptmp^.NextGear:= Gear
+        end
+    else
+        begin
+        Gear^.NextGear:= GearsList;
+        if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear;
+        GearsList:= Gear;
+        end;
+end;
+
+procedure RemoveGearFromList(Gear: PGear);
+begin
+if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
+if Gear^.PrevGear <> nil then
+    Gear^.PrevGear^.NextGear:= Gear^.NextGear
+else
+    GearsList:= Gear^.NextGear
+end;
+    
+function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
+const Counter: Longword = 0;
+var gear: PGear;
+begin
+inc(Counter);
+AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
+
+New(gear);
+FillChar(gear^, sizeof(TGear), 0);
+gear^.X:= int2hwFloat(X);
+gear^.Y:= int2hwFloat(Y);
+gear^.Target.X:= NoPointX;
+gear^.Kind := Kind;
+gear^.State:= State;
+gear^.Active:= true;
+gear^.dX:= dX;
+gear^.dY:= dY;
+gear^.doStep:= doStepHandlers[Kind];
+gear^.CollisionIndex:= -1;
+gear^.Timer:= Timer;
+gear^.FlightTime:= 0;
+gear^.uid:= Counter;
+gear^.SoundChannel:= -1;
+gear^.ImpactSound:= sndNone;
+gear^.nImpactSounds:= 0;
+gear^.Density:= _1;
+// Define ammo association, if any.
+gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
+if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then gear^.Z:= cHHZ+1
+else gear^.Z:= cUsualZ;
+
+if CurrentHedgehog <> nil then
+    begin
+    gear^.Hedgehog:= CurrentHedgehog;
+    gear^.IntersectGear:= CurrentHedgehog^.Gear
+    end;
+    
+case Kind of
+     gtGrenade,
+     gtClusterBomb,
+     gtGasBomb: begin
+                gear^.ImpactSound:= sndGrenadeImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.AdvBounce:= 1;
+                gear^.Radius:= 5;
+                gear^.Elasticity:= _0_8;
+                gear^.Friction:= _0_8;
+                gear^.Density:= _1_5;
+                gear^.RenderTimer:= true;
+                if gear^.Timer = 0 then gear^.Timer:= 3000
+                end;
+  gtWatermelon: begin
+                gear^.ImpactSound:= sndMelonImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.AdvBounce:= 1;
+                gear^.Radius:= 6;
+                gear^.Elasticity:= _0_8;
+                gear^.Friction:= _0_995;
+                gear^.Density:= _2;
+                gear^.RenderTimer:= true;
+                if gear^.Timer = 0 then gear^.Timer:= 3000
+                end;
+  gtMelonPiece: begin
+                gear^.Density:= _2;
+                end;
+    gtHedgehog: begin
+                gear^.AdvBounce:= 1;
+                gear^.Radius:= cHHRadius;
+                gear^.Elasticity:= _0_35;
+                gear^.Friction:= _0_999;
+                gear^.Angle:= cMaxAngle div 2;
+                gear^.Density:= _3;
+                gear^.Z:= cHHZ;
+                if (GameFlags and gfAISurvival) <> 0 then
+                    if gear^.Hedgehog^.BotLevel > 0 then
+                        gear^.Hedgehog^.Effects[heResurrectable] := true;
+                end;
+       gtShell: begin
+                gear^.Radius:= 4;
+                gear^.Density:= _1;
+                end;
+       gtSnowball: begin
+                gear^.ImpactSound:= sndMudballImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.Radius:= 4;
+                gear^.Elasticity:= _1;
+                gear^.Friction:= _1;
+                gear^.Density:= _0_5;
+                end;
+
+     gtFlake: begin
+                with Gear^ do
+                    begin
+                    Pos:= 0;
+                    Radius:= 1;
+                    DirAngle:= random * 360;
+                    if State and gstTmpFlag = 0 then
+                        begin
+                        dx.isNegative:= GetRandom(2) = 0;
+                        dx.QWordValue:= GetRandom(100000000);
+                        dy.isNegative:= false;
+                        dy.QWordValue:= GetRandom(70000000);
+                        if GetRandom(2) = 0 then dx := -dx
+                        end;
+                    State:= State or gstInvisible;
+                    Health:= random(vobFrameTicks);
+                    Timer:= random(vobFramesCount);
+                    Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity
+                    end
+                end;
+       gtGrave: begin
+                gear^.ImpactSound:= sndGraveImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.Radius:= 10;
+                gear^.Elasticity:= _0_6;
+                end;
+         gtBee: begin
+                gear^.Radius:= 5;
+                gear^.Timer:= 500;
+                gear^.RenderTimer:= true;
+                gear^.Elasticity:= _0_9;
+                gear^.Tag:= 0;
+                end;
+   gtSeduction: begin
+                gear^.Radius:= 250;
+                end;
+ gtShotgunShot: begin
+                gear^.Timer:= 900;
+                gear^.Radius:= 2
+                end;
+  gtPickHammer: begin
+                gear^.Radius:= 10;
+                gear^.Timer:= 4000
+                end;
+   gtHammerHit: begin
+                gear^.Radius:= 8;
+                gear^.Timer:= 125
+                end;
+        gtRope: begin
+                gear^.Radius:= 3;
+                gear^.Friction:= _450 * _0_01 * cRopePercent;
+                RopePoints.Count:= 0;
+                end;
+        gtMine: begin
+                gear^.ImpactSound:= sndMineImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.Health:= 10;
+                gear^.State:= gear^.State or gstMoving;
+                gear^.Radius:= 2;
+                gear^.Elasticity:= _0_55;
+                gear^.Friction:= _0_995;
+                gear^.Density:= _0_9;
+                if cMinesTime < 0 then
+                    gear^.Timer:= getrandom(51)*100
+                else
+                    gear^.Timer:= cMinesTime;
+                end;
+       gtSMine: begin
+                gear^.Health:= 10;
+                gear^.State:= gear^.State or gstMoving;
+                gear^.Radius:= 2;
+                gear^.Elasticity:= _0_55;
+                gear^.Friction:= _0_995;
+                gear^.Density:= _0_9;
+                gear^.Timer:= 500;
+                end;
+        gtCase: begin
+                gear^.ImpactSound:= sndGraveImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.Radius:= 16;
+                gear^.Elasticity:= _0_3
+                end;
+  gtExplosives: begin
+                gear^.ImpactSound:= sndGrenadeImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.Radius:= 16;
+                gear^.Elasticity:= _0_4;
+                gear^.Friction:= _0_995;
+                gear^.Density:= _6;
+                gear^.Health:= cBarrelHealth;
+                gear^.Z:= cHHZ-1
+                end;
+  gtDEagleShot: begin
+                gear^.Radius:= 1;
+                gear^.Health:= 50
+                end;
+  gtSniperRifleShot: begin
+                gear^.Radius:= 1;
+                gear^.Health:= 50
+                end;
+    gtDynamite: begin
+                gear^.Radius:= 3;
+                gear^.Elasticity:= _0_55;
+                gear^.Friction:= _0_03;
+                gear^.Density:= _2;
+                gear^.Timer:= 5000;
+                end;
+     gtCluster: begin
+                gear^.Radius:= 2;
+                gear^.Density:= _1_5;
+                gear^.RenderTimer:= true
+                end;
+      gtShover: gear^.Radius:= 20;
+       gtFlame: begin
+                gear^.Tag:= GetRandom(32);
+                gear^.Radius:= 1;
+                gear^.Health:= 5;
+                gear^.Density:= _1;
+                if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then
+                    begin
+                    gear^.dY:= (getrandom - _0_8) * _0_03;
+                    gear^.dX:= (getrandom - _0_5) * _0_4
+                    end
+                end;
+   gtFirePunch: begin
+                gear^.Radius:= 15;
+                gear^.Tag:= Y
+                end;
+     gtAirBomb: begin
+                gear^.Radius:= 5;
+                gear^.Density:= _2;
+                end;
+   gtBlowTorch: begin
+                gear^.Radius:= cHHRadius + cBlowTorchC;
+                gear^.Timer:= 7500
+                end;
+    gtSwitcher: begin
+                gear^.Z:= cCurrHHZ
+                end;
+      gtTarget: begin
+                gear^.ImpactSound:= sndGrenadeImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.Radius:= 10;
+                gear^.Elasticity:= _0_3;
+                gear^.Timer:= 0
+                end;
+      gtTardis: begin
+                gear^.Timer:= 0;
+                gear^.Pos:= 1;
+                gear^.Z:= cCurrHHZ+1;
+                end;
+      gtMortar: begin
+                gear^.Radius:= 4;
+                gear^.Elasticity:= _0_2;
+                gear^.Friction:= _0_08;
+                gear^.Density:= _1;
+                end;
+        gtWhip: gear^.Radius:= 20;
+      gtHammer: gear^.Radius:= 20;
+    gtKamikaze: begin
+                gear^.Health:= 2048;
+                gear^.Radius:= 20
+                end;
+        gtCake: begin
+                gear^.Health:= 2048;
+                gear^.Radius:= 7;
+                gear^.Z:= cOnHHZ;
+                gear^.RenderTimer:= true;
+                gear^.DirAngle:= -90 * hwSign(Gear^.dX);
+                if not dX.isNegative then gear^.Angle:= 1 else gear^.Angle:= 3
+                end;
+ gtHellishBomb: begin
+                gear^.ImpactSound:= sndHellishImpact1;
+                gear^.nImpactSounds:= 4;
+                gear^.AdvBounce:= 1;
+                gear^.Radius:= 4;
+                gear^.Elasticity:= _0_5;
+                gear^.Friction:= _0_96;
+                gear^.Density:= _1_5;
+                gear^.RenderTimer:= true;
+                gear^.Timer:= 5000
+                end;
+       gtDrill: begin
+                if gear^.Timer = 0 then gear^.Timer:= 5000;
+                // Tag for drill strike. if 1 then first impact occured already
+                gear^.Tag := 0;
+                gear^.Radius:= 4;
+                gear^.Density:= _1;
+                end;
+        gtBall: begin
+                gear^.ImpactSound:= sndGrenadeImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.AdvBounce:= 1;
+                gear^.Radius:= 5;
+                gear^.Tag:= random(8);
+                gear^.Timer:= 5000;
+                gear^.Elasticity:= _0_7;
+                gear^.Friction:= _0_995;
+                gear^.Density:= _1_5;
+                end;
+     gtBallgun: begin
+                gear^.Timer:= 5001;
+                end;
+     gtRCPlane: begin
+                gear^.Timer:= 15000;
+                gear^.Health:= 3;
+                gear^.Radius:= 8
+                end;
+     gtJetpack: begin
+                gear^.Health:= 2000;
+                gear^.Damage:= 100
+                end;
+     gtMolotov: begin
+                gear^.Radius:= 6;
+                gear^.Density:= _2;
+                end;
+       gtBirdy: begin
+                gear^.Radius:= 16; // todo: check
+                gear^.Timer:= 0;
+                gear^.Health := 2000;
+                gear^.FlightTime := 2;
+                end;
+         gtEgg: begin
+                gear^.Radius:= 4;
+                gear^.Elasticity:= _0_6;
+                gear^.Friction:= _0_96;
+                gear^.Density:= _1;
+                if gear^.Timer = 0 then gear^.Timer:= 3000
+                end;
+      gtPortal: begin
+                gear^.ImpactSound:= sndMelonImpact;
+                gear^.nImpactSounds:= 1;
+                gear^.AdvBounce:= 0;
+                gear^.Radius:= 17;
+                // set color
+                gear^.Tag:= 2 * gear^.Timer;
+                gear^.Timer:= 15000;
+                gear^.RenderTimer:= false;
+                gear^.Health:= 100;
+                end;
+       gtPiano: begin
+                gear^.Radius:= 32;
+                gear^.Density:= _50;
+                end;
+ gtSineGunShot: begin
+                gear^.Radius:= 5;
+                gear^.Health:= 6000;
+                end;
+gtFlamethrower: begin
+                gear^.Tag:= 10;
+                gear^.Timer:= 10;
+                gear^.Health:= 500;
+                gear^.Damage:= 100;
+                end;
+     gtLandGun: begin
+                gear^.Tag:= 10;
+                gear^.Timer:= 10;
+                gear^.Health:= 1000;
+                gear^.Damage:= 100;
+                end;
+ gtPoisonCloud: begin
+                gear^.Timer:= 5000;
+                gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000;
+                end;
+ gtResurrector: begin
+                gear^.Radius := 100;
+                gear^.Tag := 0
+                end;
+     gtWaterUp: begin
+                gear^.Tag := 47;
+                end;
+  gtNapalmBomb: begin
+                gear^.Timer:= 1000;
+                gear^.Radius:= 5;
+                gear^.Density:= _1_5;
+                end;
+   gtStructure: begin
+                gear^.Elasticity:= _0_55;
+                gear^.Friction:= _0_995;
+                gear^.Density:= _0_9;
+                gear^.Radius:= 13;
+                gear^.Health:= 200;
+                gear^.Timer:= 0;
+                gear^.Tag:= TotalRounds + 3;
+                gear^.Pos:= 1;
+                end;
+    end;
+
+InsertGearToList(gear);
+AddGear:= gear;
+
+ScriptCall('onGearAdd', gear^.uid);
+end;
+
+procedure DeleteGear(Gear: PGear);
+var team: PTeam;
+    t,i: Longword;
+    k: boolean;
+begin
+
+ScriptCall('onGearDelete', gear^.uid);
+
+DeleteCI(Gear);
+
+FreeTexture(Gear^.Tex);
+Gear^.Tex:= nil;
+
+// make sure that portals have their link removed before deletion
+if (Gear^.Kind = gtPortal) then
+    begin
+    if (Gear^.IntersectGear <> nil) then
+        if (Gear^.IntersectGear^.IntersectGear = Gear) then
+            Gear^.IntersectGear^.IntersectGear:= nil;
+    end
+else if Gear^.Kind = gtHedgehog then
+    (*
+    This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS.  I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves.  I believe it should be removed
+     if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
+        begin
+        AttackBar:= 0;
+        Gear^.Message:= gmDestroy;
+        CurAmmoGear^.Message:= gmDestroy;
+        exit
+        end
+    else*)
+        begin
+        if (hwRound(Gear^.Y) >= cWaterLine) then
+            begin
+            t:= max(Gear^.Damage, Gear^.Health);
+            Gear^.Damage:= t;
+            if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then
+                spawnHealthTagForHH(Gear, t);
+            end;
+
+        team:= Gear^.Hedgehog^.Team;
+        if CurrentHedgehog^.Gear = Gear then
+            begin
+            AttackBar:= 0;
+            FreeActionsList; // to avoid ThinkThread on drawned gear
+            if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (CurrentHedgehog^.MultiShootAttacks > 0) then OnUsedAmmo(CurrentHedgehog^);
+            end;
+
+        Gear^.Hedgehog^.Gear:= nil;
+        if Gear^.Hedgehog^.King then
+            begin
+            // are there any other kings left? Just doing nil check.  Presumably a mortally wounded king will get reaped soon enough
+            k:= false;
+            for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
+                if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then k:= true;
+            if not k then
+                for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
+                    begin
+                    team^.Clan^.Teams[i]^.hasGone:= true;
+                    TeamGoneEffect(team^.Clan^.Teams[i]^)
+                    end
+            end;
+
+        // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
+        // same stand for CheckHHDamage
+        if (Gear^.LastDamage <> nil) then
+            uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true)
+        else
+            uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
+
+        inc(KilledHHs);
+        RecountTeamHealth(team);
+        if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and (not Gear^.Hedgehog^.Effects[heResurrectable]) then
+            with CurrentHedgehog^ do 
+                begin
+                inc(Team^.stats.AIKills);
+                FreeTexture(Team^.AIKillsTex);
+                Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
+                end
+        end;
+with Gear^ do
+    AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
+
+if CurAmmoGear = Gear then CurAmmoGear:= nil;
+if FollowGear = Gear then FollowGear:= nil;
+if lastGearByUID = Gear then lastGearByUID := nil;
+RemoveGearFromList(Gear);
+Dispose(Gear)
+end;
+
+end.
--- a/hedgewars/uGearsRender.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uGearsRender.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -74,20 +74,16 @@
 end;
 
 
-procedure DrawRope(Gear: PGear);
-var roplen: LongInt;
-    i: Longword;
-
-    procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt);
-    var  eX, eY, dX, dY: LongInt;
-        i, sX, sY, x, y, d: LongInt;
-        b: boolean;
-    begin
+procedure DrawRopeLine(X1, Y1, X2, Y2, roplen: LongInt);
+var  eX, eY, dX, dY: LongInt;
+    i, sX, sY, x, y, d: LongInt;
+    b: boolean;
+begin
     if (X1 = X2) and (Y1 = Y2) then
-    begin
-    //OutError('WARNING: zero length rope line!', false);
-    exit
-    end;
+        begin
+        //OutError('WARNING: zero length rope line!', false);
+        exit
+        end;
     eX:= 0;
     eY:= 0;
     dX:= X2 - X1;
@@ -101,44 +97,50 @@
         dX:= -dX
         end else sX:= dX;
 
-    if (dY > 0) then sY:= 1
+    if (dY > 0) then 
+        sY:= 1
     else
-    if (dY < 0) then
-        begin
-        sY:= -1;
-        dY:= -dY
-        end else sY:= dY;
-
-        if (dX > dY) then d:= dX
-                    else d:= dY;
-
-        x:= X1;
-        y:= Y1;
-
-        for i:= 0 to d do
+        if (dY < 0) then
             begin
-            inc(eX, dX);
-            inc(eY, dY);
-            b:= false;
-            if (eX > d) then
-                begin
-                dec(eX, d);
-                inc(x, sX);
-                b:= true
-                end;
-            if (eY > d) then
-                begin
-                dec(eY, d);
-                inc(y, sY);
-                b:= true
-                end;
-            if b then
-                begin
-                inc(roplen);
-                if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0)
-                end
-        end
-    end;
+            sY:= -1;
+            dY:= -dY
+            end else 
+            sY:= dY;
+
+    if (dX > dY) then d:= dX
+                else d:= dY;
+
+    x:= X1;
+    y:= Y1;
+
+    for i:= 0 to d do
+        begin
+        inc(eX, dX);
+        inc(eY, dY);
+        b:= false;
+        if (eX > d) then
+            begin
+            dec(eX, d);
+            inc(x, sX);
+            b:= true
+            end;
+        if (eY > d) then
+            begin
+            dec(eY, d);
+            inc(y, sY);
+            b:= true
+            end;
+        if b then
+            begin
+            inc(roplen);
+            if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0)
+            end
+    end
+end;
+
+procedure DrawRope(Gear: PGear);
+var roplen: LongInt;
+    i: Longword;
 begin
     if (cReducedQuality and rqSimpleRope) <> 0 then
         DrawRopeLinesRQ(Gear)
@@ -151,17 +153,17 @@
             while i < Pred(RopePoints.Count) do
                     begin
                     DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
-                                hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy);
+                                hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy, roplen);
                     inc(i)
                     end;
             DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
-                        hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy);
+                        hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, roplen);
             DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
-                        hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy);
+                        hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
             end else
             if Gear^.Elasticity.QWordValue > 0 then
             DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
-                        hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy);
+                        hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
         end;
 
 
@@ -188,7 +190,7 @@
 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
 var i, t: LongInt;
     amt: TAmmoType;
-    sign, hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
+    sign, hx, hy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
     dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real;  // laser, change
     defaultPos, HatVisible: boolean;
     HH: PHedgehog;
@@ -197,7 +199,7 @@
     HH:= Gear^.Hedgehog;
     if HH^.Unplaced then exit;
     m:= 1;
-    if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1;
+    if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then m:= -1;
     sx:= ox + 1; // this offset is very common
     sy:= oy - 3;
     sign:= hwSign(Gear^.dX);
@@ -319,10 +321,12 @@
                     end;
                 end;
             // draw crosshair
-            cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle));
-            cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle));
+            CrosshairX := Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle));
+            CrosshairY := Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle));
+ 
+            
             DrawRotatedTex(HH^.Team^.CrosshairTex,
-                    12, 12, cx + WorldDx, cy + WorldDy, 0,
+                    12, 12, CrosshairX + WorldDx, CrosshairY + WorldDy, 0,
                     sign * (Gear^.Angle * 180.0) / cMaxAngle);
             end;
         hx:= ox + 8 * sign;
@@ -540,7 +544,7 @@
             begin
             if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then
                 begin
-                Gear^.State:= Gear^.State and not gstAnimation;
+                Gear^.State:= Gear^.State and (not gstAnimation);
                 end
             else
                 begin
@@ -803,7 +807,7 @@
 
     with HH^ do
         begin
-        if ((Gear^.State and not gstWinner) = 0)
+        if ((Gear^.State and (not gstWinner)) = 0)
             or ((Gear^.State = gstWait) and (Gear^.dY.QWordValue = 0))
             or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then
             begin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uGearsUtils.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,557 @@
+(*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *)
+
+{$INCLUDE "options.inc"}
+
+unit uGearsUtils;
+interface
+uses uTypes;
+
+procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord = $FFFFFFFF); 
+function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
+procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
+procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
+procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
+procedure CheckHHDamage(Gear: PGear);
+procedure CalcRotationDirAngle(Gear: PGear);
+procedure ResurrectHedgehog(gear: PGear);
+procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean = false);
+function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
+function  CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear;
+
+
+implementation
+uses uFloat, uSound, uCollisions, uUtils, uConsts, uVisualGears, uAIMisc,
+    uVariables, uLandGraphics, uScript, uStats, uCaptions, uTeams, uStore,
+    uLocale, uTextures, uRenderUtils, uRandom, uGearsList, SDLh, uDebug;
+
+procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
+var Gear: PGear;
+    dmg, dmgRadius, dmgBase: LongInt;
+    fX, fY: hwFloat;
+    vg: PVisualGear;
+    i, cnt: LongInt;
+begin
+    if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');
+    if Radius > 25 then KickFlakes(Radius, X, Y);
+
+    if ((Mask and EXPLNoGfx) = 0) then
+        begin
+        vg:= nil;
+        if Radius > 50 then vg:= AddVisualGear(X, Y, vgtBigExplosion)
+        else if Radius > 10 then vg:= AddVisualGear(X, Y, vgtExplosion);
+        if vg <> nil then
+            vg^.Tint:= Tint;
+        end;
+    if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion);
+
+    if (Mask and EXPLAllDamageInRadius) = 0 then
+        dmgRadius:= Radius shl 1
+    else
+        dmgRadius:= Radius;
+    dmgBase:= dmgRadius + cHHRadius div 2;
+    fX:= int2hwFloat(X);
+    fY:= int2hwFloat(Y);
+    Gear:= GearsList;
+    while Gear <> nil do
+        begin
+        dmg:= 0;
+        //dmg:= dmgRadius  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y)));
+        //if (dmg > 1) and
+        if (Gear^.State and gstNoDamage) = 0 then
+            begin
+            case Gear^.Kind of
+                gtHedgehog,
+                    gtMine,
+                    gtBall,
+                    gtMelonPiece,
+                    gtGrenade,
+                    gtClusterBomb,
+                //    gtCluster, too game breaking I think
+                    gtSMine,
+                    gtCase,
+                    gtTarget,
+                    gtFlame,
+                    gtExplosives,
+                    gtStructure: begin
+    // Run the calcs only once we know we have a type that will need damage
+                            if hwRound(hwAbs(Gear^.X-fX)+hwAbs(Gear^.Y-fY)) < dmgBase then
+                                dmg:= dmgBase - max(hwRound(Distance(Gear^.X - fX, Gear^.Y - fY)),Gear^.Radius);
+                            if dmg > 1 then
+                                begin
+                                dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
+                                //AddFileLog('Damage: ' + inttostr(dmg));
+                                if (Mask and EXPLNoDamage) = 0 then
+                                    begin
+                                    if not Gear^.Invulnerable then
+                                        ApplyDamage(Gear, AttackingHog, dmg, dsExplosion)
+                                    else
+                                        Gear^.State:= Gear^.State or gstWinner;
+                                    end;
+                                if ((Mask and EXPLDoNotTouchAny) = 0) and (((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog)) then
+                                    begin
+                                    DeleteCI(Gear);
+                                    if Gear^.Kind <> gtHedgehog then
+                                        begin
+                                        Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - fX)/Gear^.Density;
+                                        Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - fY)/Gear^.Density;
+                                        end
+                                    else
+                                        begin
+                                        Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - fX);
+                                        Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - fY);
+                                        end;
+
+                                    Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser);
+                                    if not Gear^.Invulnerable then
+                                        Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner);
+                                    Gear^.Active:= true;
+                                    if Gear^.Kind <> gtFlame then FollowGear:= Gear
+                                    end;
+                                if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and (not Gear^.Invulnerable) then
+                                    Gear^.Hedgehog^.Effects[hePoisoned] := true;
+                                end;
+
+                            end;
+                    gtGrave: begin
+    // Run the calcs only once we know we have a type that will need damage
+                            if hwRound(hwAbs(Gear^.X-fX)+hwAbs(Gear^.Y-fY)) < dmgBase then
+                                dmg:= dmgBase - hwRound(Distance(Gear^.X - fX, Gear^.Y - fY));
+                            if dmg > 1 then
+                                begin
+                                dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
+                                Gear^.dY:= - _0_004 * dmg;
+                                Gear^.Active:= true
+                                end
+                            end;
+                end;
+            end;
+        Gear:= Gear^.NextGear
+        end;
+
+    if (Mask and EXPLDontDraw) = 0 then
+        if (GameFlags and gfSolidLand) = 0 then
+            begin
+            cnt:= DrawExplosion(X, Y, Radius) div 1608; // approx 2 16x16 circles to erase per chunk
+            if (cnt > 0) and (SpritesData[sprChunk].Texture <> nil) then
+                for i:= 0 to cnt do
+                    AddVisualGear(X, Y, vgtChunk)
+            end;
+
+    uAIMisc.AwareOfExplosion(0, 0, 0)
+end;
+
+function ModifyDamage(dmg: Longword; Gear: PGear): Longword;
+var i: hwFloat;
+begin
+(* Invulnerability cannot be placed in here due to still needing kicks
+   Not without a new damage machine.
+   King check should be in here instead of ApplyDamage since Tiy wants them kicked less
+*)
+i:= _1;
+if (CurrentHedgehog <> nil) and CurrentHedgehog^.King then i:= _1_5;
+if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.King) then
+   ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent * _0_5)
+else
+   ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent)
+end;
+
+procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
+var s: shortstring;
+    vampDmg, tmpDmg, i: Longword;
+    vg: PVisualGear;
+begin
+  if Damage = 0 then exit; // nothing to apply
+
+    if (Gear^.Kind = gtHedgehog) then
+    begin
+    Gear^.LastDamage := AttackerHog;
+
+    Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
+    HHHurt(Gear^.Hedgehog, Source);
+    AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
+    tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
+    if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then
+        begin
+        if cVampiric then
+            begin
+            vampDmg:= hwRound(int2hwFloat(tmpDmg)*_0_8);
+            if vampDmg >= 1 then
+                begin
+                // was considering pulsing on attack, Tiy thinks it should be permanent while in play
+                //CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric;
+                inc(CurrentHedgehog^.Gear^.Health,vampDmg);
+                str(vampDmg, s);
+                s:= '+' + s;
+                AddCaption(s, CurrentHedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
+                RenderHealth(CurrentHedgehog^);
+                RecountTeamHealth(CurrentHedgehog^.Team);
+                i:= 0;
+                while i < vampDmg do
+                    begin
+                    vg:= AddVisualGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), vgtStraightShot);
+                    if vg <> nil then
+                        with vg^ do
+                            begin
+                            Tint:= $FF0000FF;
+                            State:= ord(sprHealth)
+                            end;
+                    inc(i, 5);
+                    end;
+                end
+            end;
+        if ((GameFlags and gfKarma) <> 0) and
+           ((GameFlags and gfInvulnerable) = 0) and
+           (not CurrentHedgehog^.Gear^.Invulnerable) then
+           begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
+           inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
+           CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
+           spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
+           end;
+        uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false);    
+        end;
+    end else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
+        begin
+        Gear^.Hedgehog:= AttackerHog;
+        end;
+    inc(Gear^.Damage, Damage);
+    
+    ScriptCall('onGearDamage', Gear^.UID, Damage);
+end;
+
+procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
+var tag: PVisualGear;
+begin
+tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);
+if (tag <> nil) then
+    tag^.Hedgehog:= HHGear^.Hedgehog; // the tag needs the tag to determine the text color
+AllInactive:= false;
+HHGear^.Active:= true;
+end;
+    
+procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
+begin
+if (Source = dsFall) or (Source = dsExplosion) then
+    case random(3) of
+        0: PlaySound(sndOoff1, Hedgehog^.Team^.voicepack);
+        1: PlaySound(sndOoff2, Hedgehog^.Team^.voicepack);
+        2: PlaySound(sndOoff3, Hedgehog^.Team^.voicepack);
+    end
+else if (Source = dsPoison) then
+    case random(2) of
+        0: PlaySound(sndPoisonCough, Hedgehog^.Team^.voicepack);
+        1: PlaySound(sndPoisonMoan, Hedgehog^.Team^.voicepack);
+    end
+else
+    case random(4) of
+        0: PlaySound(sndOw1, Hedgehog^.Team^.voicepack);
+        1: PlaySound(sndOw2, Hedgehog^.Team^.voicepack);
+        2: PlaySound(sndOw3, Hedgehog^.Team^.voicepack);
+        3: PlaySound(sndOw4, Hedgehog^.Team^.voicepack);
+    end
+end;
+
+procedure CheckHHDamage(Gear: PGear);
+var 
+    dmg: Longword;
+    i: LongInt;
+    particle: PVisualGear;
+begin
+    if _0_4 < Gear^.dY then
+        begin
+        dmg := ModifyDamage(1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70), Gear);
+        PlaySound(sndBump);
+        if dmg < 1 then exit;
+
+        for i:= min(12, (3 + dmg div 10)) downto 0 do
+            begin
+            particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
+            if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480);
+            end;
+
+        if (Gear^.Invulnerable) then exit;
+
+        //if _0_6 < Gear^.dY then
+        //    PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack)
+        //else
+        //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
+
+        if Gear^.LastDamage <> nil then
+            ApplyDamage(Gear, Gear^.LastDamage, dmg, dsFall)
+            else
+            ApplyDamage(Gear, CurrentHedgehog, dmg, dsFall);
+    end
+end;
+
+
+procedure CalcRotationDirAngle(Gear: PGear);
+var 
+    dAngle: real;
+begin
+    dAngle := (Gear^.dX.QWordValue + Gear^.dY.QWordValue) / $80000000;
+    if not Gear^.dX.isNegative then
+        Gear^.DirAngle := Gear^.DirAngle + dAngle
+    else
+        Gear^.DirAngle := Gear^.DirAngle - dAngle;
+
+    if Gear^.DirAngle < 0 then Gear^.DirAngle := Gear^.DirAngle + 360
+    else if 360 < Gear^.DirAngle then Gear^.DirAngle := Gear^.DirAngle - 360
+end;
+
+function CheckGearDrowning(Gear: PGear): boolean;
+var 
+    skipSpeed, skipAngle, skipDecay: hwFloat;
+    i, maxDrops, X, Y: LongInt;
+    vdX, vdY: real;
+    particle: PVisualGear;
+    isSubmersible: boolean;
+begin
+    // probably needs tweaking. might need to be in a case statement based upon gear type
+    Y:= hwRound(Gear^.Y);
+    if cWaterLine < Y + Gear^.Radius then
+        begin
+        isSubmersible:= (Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack);
+        skipSpeed := _0_25;
+        skipAngle := _1_9;
+        skipDecay := _0_87;
+        X:= hwRound(Gear^.X);
+        vdX:= hwFloat2Float(Gear^.dX);
+        vdY:= hwFloat2Float(Gear^.dY);
+        // this could perhaps be a tiny bit higher.
+        if  (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and
+           (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then
+            begin
+            Gear^.dY.isNegative := true;
+            Gear^.dY := Gear^.dY * skipDecay;
+            Gear^.dX := Gear^.dX * skipDecay;
+            CheckGearDrowning := false;
+            PlaySound(sndSkip)
+            end
+        else
+            begin
+            if not isSubmersible then
+                begin
+                CheckGearDrowning := true;
+                Gear^.State := gstDrowning;
+                Gear^.RenderTimer := false;
+                if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and 
+                   (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then
+                    if Gear^.Kind = gtHedgehog then
+                        begin
+                        if Gear^.Hedgehog^.Effects[heResurrectable] then
+                            ResurrectHedgehog(Gear)
+                        else
+                            begin
+                            Gear^.doStep := @doStepDrowningGear;
+                            Gear^.State := Gear^.State and (not gstHHDriven);
+                            AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
+                            end
+                        end
+                    else Gear^.doStep := @doStepDrowningGear;
+                    if Gear^.Kind = gtFlake then exit // skip splashes 
+                end;
+            if ((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or
+               (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then
+                // don't play splash if they are already way past the surface
+                PlaySound(sndSplash)
+            end;
+
+        if ((cReducedQuality and rqPlainSplash) = 0) and 
+           (((not isSubmersible) and (Y < cWaterLine + 64 + Gear^.Radius)) or
+             (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01)))) then
+            begin
+            AddVisualGear(X, cWaterLine, vgtSplash);
+
+            maxDrops := (Gear^.Radius div 2) + round(vdX * Gear^.Radius * 2) + round(vdY * Gear^.Radius * 2);
+            for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do
+                begin
+                particle := AddVisualGear(X - 3 + Random(6), cWaterLine, vgtDroplet);
+                if particle <> nil then
+                    begin
+                    particle^.dX := particle^.dX - vdX / 10;
+                    particle^.dY := particle^.dY - vdY / 5;
+                    end
+                end
+            end;
+        if isSubmersible and (CurAmmoGear^.Pos = 0) then CurAmmoGear^.Pos := 1000
+        end
+    else
+        CheckGearDrowning := false;
+end;
+
+
+procedure ResurrectHedgehog(gear: PGear);
+var tempTeam : PTeam;
+begin
+    AttackBar:= 0;
+    gear^.dX := _0;
+    gear^.dY := _0;
+    gear^.Damage := 0;
+    gear^.Health := gear^.Hedgehog^.InitialHealth;
+    gear^.Hedgehog^.Effects[hePoisoned] := false;
+    if not CurrentHedgehog^.Effects[heResurrectable] then
+        with CurrentHedgehog^ do 
+            begin
+            inc(Team^.stats.AIKills);
+            FreeTexture(Team^.AIKillsTex);
+            Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
+            end;
+    tempTeam := gear^.Hedgehog^.Team;
+    DeleteCI(gear);
+    FindPlace(gear, false, 0, LAND_WIDTH, true); 
+    if gear <> nil then begin
+        RenderHealth(gear^.Hedgehog^);
+        ScriptCall('onGearResurrect', gear^.uid);
+        gear^.State := gstWait;
+    end;
+    RecountTeamHealth(tempTeam);
+end;
+
+function CountNonZeroz(x, y, r, c: LongInt): LongInt;
+var i: LongInt;
+    count: LongInt = 0;
+begin
+if (y and LAND_HEIGHT_MASK) = 0 then
+    for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do
+        if Land[y, i] <> 0 then
+            begin
+            inc(count);
+            if count = c then exit(count)
+            end;
+CountNonZeroz:= count;
+end;
+
+procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean);
+var x: LongInt;
+    y, sy: LongInt;
+    ar: array[0..511] of TPoint;
+    ar2: array[0..1023] of TPoint;
+    cnt, cnt2: Longword;
+    delta: LongInt;
+    reallySkip, tryAgain: boolean;
+begin
+reallySkip:= false; // try not skipping proximity at first
+tryAgain:= true;
+while tryAgain do
+    begin
+    delta:= 250;
+    cnt2:= 0;
+    repeat
+        x:= Left + LongInt(GetRandom(Delta));
+        repeat
+            inc(x, Delta);
+            cnt:= 0;
+            y:= min(1024, topY) - 2 * Gear^.Radius;
+            while y < cWaterLine do
+                begin
+                repeat
+                    inc(y, 2);
+                until (y >= cWaterLine) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) = 0);
+
+                sy:= y;
+
+                repeat
+                    inc(y);
+                until (y >= cWaterLine) or (CountNonZeroz(x, y, Gear^.Radius - 1, 1) <> 0);
+
+                if (y - sy > Gear^.Radius * 2) and
+                   (((Gear^.Kind = gtExplosives)
+                       and (y < cWaterLine)
+                       and (reallySkip or (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 60, 60) = nil))
+                       and (CountNonZeroz(x, y+1, Gear^.Radius - 1, Gear^.Radius+1) > Gear^.Radius))
+                   or
+                     ((Gear^.Kind <> gtExplosives)
+                       and (y < cWaterLine)
+                       and (reallySkip or (CheckGearsNear(x, y - Gear^.Radius, [gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives], 110, 110) = nil)))) then
+                    begin
+                    ar[cnt].X:= x;
+                    if withFall then ar[cnt].Y:= sy + Gear^.Radius
+                                else ar[cnt].Y:= y - Gear^.Radius;
+                    inc(cnt)
+                    end;
+
+                inc(y, 45)
+                end;
+
+            if cnt > 0 then
+                with ar[GetRandom(cnt)] do
+                    begin
+                    ar2[cnt2].x:= x;
+                    ar2[cnt2].y:= y;
+                    inc(cnt2)
+                    end
+        until (x + Delta > Right);
+
+        dec(Delta, 60)
+    until (cnt2 > 0) or (Delta < 70);
+    if (cnt2 = 0) and skipProximity and (not reallySkip) then tryAgain:= true
+    else tryAgain:= false;
+    reallySkip:= true;
+    end;
+
+if cnt2 > 0 then
+    with ar2[GetRandom(cnt2)] do
+        begin
+        Gear^.X:= int2hwFloat(x);
+        Gear^.Y:= int2hwFloat(y);
+        AddFileLog('Assigned Gear coordinates (' + inttostr(x) + ',' + inttostr(y) + ')');
+        end
+    else
+    begin
+    OutError('Can''t find place for Gear', false);
+    if Gear^.Kind = gtHedgehog then Gear^.Hedgehog^.Effects[heResurrectable] := false;
+    DeleteGear(Gear);
+    Gear:= nil
+    end
+end;
+
+function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
+var t: PGear;
+begin
+t:= GearsList;
+rX:= sqr(rX);
+rY:= sqr(rY);
+
+while t <> nil do
+    begin
+    if (t <> Gear) and (t^.Kind = Kind) then
+        if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then
+        exit(t);
+    t:= t^.NextGear
+    end;
+
+CheckGearNear:= nil
+end;
+
+
+function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear;
+var t: PGear;
+begin
+t:= GearsList;
+rX:= sqr(rX);
+rY:= sqr(rY);
+while t <> nil do
+    begin
+    if t^.Kind in Kind then
+        if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then
+            exit(t);
+    t:= t^.NextGear
+    end;
+CheckGearsNear:= nil
+end;
+end.
--- a/hedgewars/uIO.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uIO.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -142,8 +142,7 @@
 procedure IPCCheckSock;
 const ss: shortstring = '';
 var i: LongInt;
-    buf: array[0..255] of byte;
-    s: shortstring absolute buf;
+    s: shortstring;
 begin
 if IPCSock = nil then
    exit;
@@ -153,10 +152,10 @@
 
 while SDLNet_CheckSockets(fds, 0) > 0 do
     begin
-    i:= SDLNet_TCP_Recv(IPCSock, @buf[1], 255 - Length(ss));
+    i:= SDLNet_TCP_Recv(IPCSock, @s[1], 255 - Length(ss));
     if i > 0 then
         begin
-        buf[0]:= i;
+        s[0]:= char(i);
         ss:= ss + s;
         while (Length(ss) > 1) and (Length(ss) > byte(ss[1])) do
             begin
@@ -171,8 +170,7 @@
 var f: file;
     ss: shortstring = '';
     i: LongInt;
-    buf: array[0..255] of byte;
-    s: shortstring absolute buf;
+    s: shortstring;
 begin
 
 // set RDNLY on file open
@@ -184,12 +182,12 @@
 tryDo(IOResult = 0, 'Error opening file ' + fileName, true);
 
 i:= 0; // avoid compiler hints
-buf[0]:= 0;
+s[0]:= #0;
 repeat
-    BlockRead(f, buf[1], 255 - Length(ss), i);
+    BlockRead(f, s[1], 255 - Length(ss), i);
     if i > 0 then
         begin
-        buf[0]:= i;
+        s[0]:= char(i);
         ss:= ss + s;
         while (Length(ss) > 1)and(Length(ss) > byte(ss[1])) do
             begin
@@ -315,7 +313,7 @@
             end;
         'b': begin
             s:= copy(headcmd^.str, 2, Pred(headcmd^.len));
-            ParseCommand('chatmsg '#4 + s, true);
+            ParseCommand('chatmsg ' + #4 + s, true);
             WriteLnToConsole(s)
             end;
 // TODO: deprecate 'F'
--- a/hedgewars/uKeys.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uKeys.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -147,7 +147,7 @@
     if (tkbd[i] = 0) and (tkbdn[i] <> 0) then
          begin
          ParseCommand(CurrentBinds[i], Trusted);
-         if (CurrentTeam <> nil) and not CurrentTeam^.ExtDriven and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true)
+         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true)
          end
     else if (CurrentBinds[i][1] = '+')
             and (tkbdn[i] = 0)
@@ -156,7 +156,7 @@
             s:= CurrentBinds[i];
             s[1]:= '-';
             ParseCommand(s, Trusted);
-            if (CurrentTeam <> nil) and not CurrentTeam^.ExtDriven and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true)
+            if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true)
             end;
     tkbd[i]:= tkbdn[i]
     end
@@ -329,6 +329,7 @@
 {$ENDIF}
 
 for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+IntToStr(i);
+for i:= 1 to 5  do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i);
 
 SetDefaultBinds();
 end;
--- a/hedgewars/uLand.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uLand.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -22,12 +22,6 @@
 interface
 uses SDLh, uLandTemplates, uFloat, uConsts, GLunit, uTypes;
 
-type direction = record x, y: LongInt; end;
-const DIR_N: direction = (x: 0; y: -1);
-    DIR_E: direction = (x: 1; y: 0);
-    DIR_S: direction = (x: 0; y: 1);
-    DIR_W: direction = (x: -1; y: 0);
-
 procedure initModule;
 procedure freeModule;
 procedure DrawBottomBorder;
@@ -36,248 +30,9 @@
 
 implementation
 uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, sysutils,
-     uVariables, uUtils, uCommands, Adler32, uDebug, uLandPainted, uTextures;
-
-operator=(const a, b: direction) c: Boolean;
-begin
-    c := (a.x = b.x) and (a.y = b.y);
-end;
-
-type TPixAr = record
-              Count: Longword;
-              ar: array[0..Pred(cMaxEdgePoints)] of TPoint;
-              end;
-
-procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
-var
-  eX, eY, dX, dY: LongInt;
-  i, sX, sY, x, y, d: LongInt;
-begin
-eX:= 0;
-eY:= 0;
-dX:= X2 - X1;
-dY:= Y2 - Y1;
-
-if (dX > 0) then sX:= 1
-else
-  if (dX < 0) then
-     begin
-     sX:= -1;
-     dX:= -dX
-     end else sX:= dX;
-
-if (dY > 0) then sY:= 1
-  else
-  if (dY < 0) then
-     begin
-     sY:= -1;
-     dY:= -dY
-     end else sY:= dY;
-
-if (dX > dY) then d:= dX
-             else d:= dY;
-
-x:= X1;
-y:= Y1;
-
-for i:= 0 to d do
-    begin
-    inc(eX, dX);
-    inc(eY, dY);
-    if (eX > d) then
-       begin
-       dec(eX, d);
-       inc(x, sX);
-       end;
-    if (eY > d) then
-       begin
-       dec(eY, d);
-       inc(y, sY);
-       end;
-
-    if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
-       Land[y, x]:= Color;
-    end
-end;
-
-procedure DrawEdge(var pa: TPixAr; Color: Longword);
-var i: LongInt;
-begin
-i:= 0;
-with pa do
-while i < LongInt(Count) - 1 do
-    if (ar[i + 1].X = NTPX) then inc(i, 2)
-       else begin
-       DrawLine(ar[i].x, ar[i].y, ar[i + 1].x, ar[i + 1].y, Color);
-       inc(i)
-       end
-end;
-
-procedure Vector(p1, p2, p3: TPoint; var Vx, Vy: hwFloat);
-var d1, d2, d: hwFloat;
-begin
-Vx:= int2hwFloat(p1.X - p3.X);
-Vy:= int2hwFloat(p1.Y - p3.Y);
-d:= DistanceI(p2.X - p1.X, p2.Y - p1.Y);
-d1:= DistanceI(p2.X - p3.X, p2.Y - p3.Y);
-d2:= Distance(Vx, Vy);
-if d1 < d then d:= d1;
-if d2 < d then d:= d2;
-d:= d * _1div3;
-if d2.QWordValue = 0 then
-   begin
-   Vx:= _0;
-   Vy:= _0
-   end else
-   begin
-   d2:= _1 / d2;
-   Vx:= Vx * d2;
-   Vy:= Vy * d2;
-
-   Vx:= Vx * d;
-   Vy:= Vy * d
-   end
-end;
+     uVariables, uUtils, uCommands, Adler32, uDebug, uLandPainted, uTextures,
+     uLandGenMaze, uLandOutline;
 
-procedure AddLoopPoints(var pa, opa: TPixAr; StartI, EndI: LongInt; Delta: hwFloat);
-var i, pi, ni: LongInt;
-    NVx, NVy, PVx, PVy: hwFloat;
-    x1, x2, y1, y2: LongInt;
-    tsq, tcb, t, r1, r2, r3, cx1, cx2, cy1, cy2: hwFloat;
-    X, Y: LongInt;
-begin
-pi:= EndI;
-i:= StartI;
-ni:= Succ(StartI);
-{$HINTS OFF}
-Vector(opa.ar[pi], opa.ar[i], opa.ar[ni], NVx, NVy);
-{$HINTS ON}
-repeat
-    inc(pi);
-    if pi > EndI then pi:= StartI;
-    inc(i);
-    if i > EndI then i:= StartI;
-    inc(ni);
-    if ni > EndI then ni:= StartI;
-    PVx:= NVx;
-    PVy:= NVy;
-    Vector(opa.ar[pi], opa.ar[i], opa.ar[ni], NVx, NVy);
-
-    x1:= opa.ar[pi].x;
-    y1:= opa.ar[pi].y;
-    x2:= opa.ar[i].x;
-    y2:= opa.ar[i].y;
-    cx1:= int2hwFloat(x1) - PVx;
-    cy1:= int2hwFloat(y1) - PVy;
-    cx2:= int2hwFloat(x2) + NVx;
-    cy2:= int2hwFloat(y2) + NVy;
-    t:= _0;
-    while t.Round = 0 do
-          begin
-          tsq:= t * t;
-          tcb:= tsq * t;
-          r1:= (_1 - t*3 + tsq*3 - tcb);
-          r2:= (     t*3 - tsq*6 + tcb*3);
-          r3:= (           tsq*3 - tcb*3);
-          X:= hwRound(r1 * x1 + r2 * cx1 + r3 * cx2 + tcb * x2);
-          Y:= hwRound(r1 * y1 + r2 * cy1 + r3 * cy2 + tcb * y2);
-          t:= t + Delta;
-          pa.ar[pa.Count].x:= X;
-          pa.ar[pa.Count].y:= Y;
-          inc(pa.Count);
-          TryDo(pa.Count <= cMaxEdgePoints, 'Edge points overflow', true)
-          end;
-until i = StartI;
-pa.ar[pa.Count].x:= opa.ar[StartI].X;
-pa.ar[pa.Count].y:= opa.ar[StartI].Y;
-inc(pa.Count)
-end;
-
-procedure BezierizeEdge(var pa: TPixAr; Delta: hwFloat);
-var i, StartLoop: LongInt;
-    opa: TPixAr;
-begin
-opa:= pa;
-pa.Count:= 0;
-i:= 0;
-StartLoop:= 0;
-while i < LongInt(opa.Count) do
-    if (opa.ar[i + 1].X = NTPX) then
-       begin
-       AddLoopPoints(pa, opa, StartLoop, i, Delta);
-       inc(i, 2);
-       StartLoop:= i;
-       pa.ar[pa.Count].X:= NTPX;
-       pa.ar[pa.Count].Y:= 0;
-       inc(pa.Count);
-       end else inc(i)
-end;
-
-procedure FillLand(x, y: LongInt);
-var Stack: record
-           Count: Longword;
-           points: array[0..8192] of record
-                                     xl, xr, y, dir: LongInt;
-                                     end
-           end;
-
-    procedure Push(_xl, _xr, _y, _dir: LongInt);
-    begin
-    TryDo(Stack.Count <= 8192, 'FillLand: stack overflow', true);
-    _y:= _y + _dir;
-    if (_y < 0) or (_y >= LAND_HEIGHT) then exit;
-    with Stack.points[Stack.Count] do
-         begin
-         xl:= _xl;
-         xr:= _xr;
-         y:= _y;
-         dir:= _dir
-         end;
-    inc(Stack.Count)
-    end;
-
-    procedure Pop(var _xl, _xr, _y, _dir: LongInt);
-    begin
-    dec(Stack.Count);
-    with Stack.points[Stack.Count] do
-         begin
-         _xl:= xl;
-         _xr:= xr;
-         _y:= y;
-         _dir:= dir
-         end
-    end;
-
-var xl, xr, dir: LongInt;
-begin
-Stack.Count:= 0;
-xl:= x - 1;
-xr:= x;
-Push(xl, xr, y, -1);
-Push(xl, xr, y,  1);
-dir:= 0;
-while Stack.Count > 0 do
-      begin
-      Pop(xl, xr, y, dir);
-      while (xl > 0) and (Land[y, xl] <> 0) do dec(xl);
-      while (xr < LAND_WIDTH - 1) and (Land[y, xr] <> 0) do inc(xr);
-      while (xl < xr) do
-            begin
-            while (xl <= xr) and (Land[y, xl] = 0) do inc(xl);
-            x:= xl;
-            while (xl <= xr) and (Land[y, xl] <> 0) do
-                  begin
-                  Land[y, xl]:= 0;
-                  inc(xl)
-                  end;
-            if x < xl then
-               begin
-               Push(x, Pred(xl), y, dir);
-               Push(x, Pred(xl), y,-dir);
-               end;
-            end;
-      end;
-end;
 
 procedure ColorizeLand(Surface: PSDL_Surface);
 var tmpsurf: PSDL_Surface;
@@ -417,84 +172,6 @@
      end
 end;
 
-function CheckIntersect(V1, V2, V3, V4: TPoint): boolean;
-var c1, c2, dm: LongInt;
-begin
-dm:= (V4.y - V3.y) * (V2.x - V1.x) - (V4.x - V3.x) * (V2.y - V1.y);
-c1:= (V4.x - V3.x) * (V1.y - V3.y) - (V4.y - V3.y) * (V1.x - V3.x);
-if dm = 0 then exit(false);
-
-c2:= (V2.x - V3.x) * (V1.y - V3.y) - (V2.y - V3.y) * (V1.x - V3.x);
-if dm > 0 then
-   begin
-   if (c1 < 0) or (c1 > dm) then exit(false);
-   if (c2 < 0) or (c2 > dm) then exit(false)
-   end else
-   begin
-   if (c1 > 0) or (c1 < dm) then exit(false);
-   if (c2 > 0) or (c2 < dm) then exit(false)
-   end;
-
-//AddFileLog('1  (' + inttostr(V1.x) + ',' + inttostr(V1.y) + ')x(' + inttostr(V2.x) + ',' + inttostr(V2.y) + ')');
-//AddFileLog('2  (' + inttostr(V3.x) + ',' + inttostr(V3.y) + ')x(' + inttostr(V4.x) + ',' + inttostr(V4.y) + ')');
-CheckIntersect:= true
-end;
-
-function CheckSelfIntersect(var pa: TPixAr; ind: Longword): boolean;
-var i: Longword;
-begin
-if (ind <= 0) or (ind >= Pred(pa.Count)) then exit(false);
-for i:= 1 to pa.Count - 3 do
-    if (i <= ind - 1) or (i >= ind + 2) then
-      begin
-      if (i <> ind - 1) and
-         CheckIntersect(pa.ar[ind], pa.ar[ind - 1], pa.ar[i], pa.ar[i - 1]) then exit(true);
-      if (i <> ind + 2) and
-         CheckIntersect(pa.ar[ind], pa.ar[ind + 1], pa.ar[i], pa.ar[i - 1]) then exit(true);
-      end;
-CheckSelfIntersect:= false
-end;
-
-procedure RandomizePoints(var pa: TPixAr);
-const cEdge = 55;
-      cMinDist = 8;
-var radz: array[0..Pred(cMaxEdgePoints)] of LongInt;
-    i, k, dist, px, py: LongInt;
-begin
-for i:= 0 to Pred(pa.Count) do
-  begin
-  radz[i]:= 0;
-  with pa.ar[i] do
-    if x <> NTPX then
-      begin
-      radz[i]:= Min(Max(x - cEdge, 0), Max(LAND_WIDTH - cEdge - x, 0));
-      radz[i]:= Min(radz[i], Min(Max(y - cEdge, 0), Max(LAND_HEIGHT - cEdge - y, 0)));
-      if radz[i] > 0 then
-        for k:= 0 to Pred(i) do
-          begin
-          dist:= Max(abs(x - pa.ar[k].x), abs(y - pa.ar[k].y));
-          radz[k]:= Max(0, Min((dist - cMinDist) div 2, radz[k]));
-          radz[i]:= Max(0, Min(dist - radz[k] - cMinDist, radz[i]))
-        end
-      end;
-  end;
-
-for i:= 0 to Pred(pa.Count) do
-  with pa.ar[i] do
-    if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
-      begin
-      px:= x;
-      py:= y;
-      x:= x + LongInt(GetRandom(7) - 3) * (radz[i] * 5 div 7) div 3;
-      y:= y + LongInt(GetRandom(7) - 3) * (radz[i] * 5 div 7) div 3;
-      if CheckSelfIntersect(pa, i) then
-         begin
-         x:= px;
-         y:= py
-         end;
-      end
-end;
-
 
 procedure GenBlank(var Template: TEdgeTemplate);
 var pa: TPixAr;
@@ -610,437 +287,6 @@
     SDL_UnlockSurface(Surface);
 end;
 
-procedure GenMaze;
-const small_cell_size = 128;
-    medium_cell_size = 192;
-    large_cell_size = 256;
-    braidness = 10;
-
-var x, y: LongInt;
-    cellsize: LongInt; //selected by the user in the gui
-    seen_cells_x, seen_cells_y: LongInt; //number of cells that can be visited by the generator, that is every second cell in x and y direction. the cells between there are walls that will be removed when we move from one cell to another
-    num_edges_x, num_edges_y: LongInt; //number of resulting edges that need to be vertexificated
-    num_cells_x, num_cells_y: LongInt; //actual number of cells, depending on cell size
-    seen_list: array of array of LongInt;
-    xwalls: array of array of Boolean;
-    ywalls: array of array of Boolean;
-    x_edge_list: array of array of Boolean;
-    y_edge_list: array of array of Boolean;
-    maze: array of array of Boolean;
-    pa: TPixAr;
-    num_vertices: LongInt;
-    off_y: LongInt;
-    num_steps: LongInt;
-    current_step: LongInt;
-    step_done: array of Boolean;
-    done: Boolean;
-    last_cell: array of record x, y: LongInt; end;
-    came_from: array of array of record x, y: LongInt; end;
-    came_from_pos: array of LongInt;
-    maze_inverted: Boolean;
-
-function when_seen(x: LongInt; y: LongInt): LongInt;
-begin
-if (x < 0) or (x >= seen_cells_x) or (y < 0) or (y >= seen_cells_y) then
-    when_seen := current_step
-else
-    when_seen := seen_list[x, y];
-end;
-
-function is_x_edge(x, y: LongInt): Boolean;
-begin
-if (x < 0) or (x > num_edges_x) or (y < 0) or (y > num_cells_y) then
-    is_x_edge := false
-else
-    is_x_edge := x_edge_list[x, y];
-end;
-
-function is_y_edge(x, y: LongInt): Boolean;
-begin
-if (x < 0) or (x > num_cells_x) or (y < 0) or (y > num_edges_y) then
-    is_y_edge := false
-else
-    is_y_edge := y_edge_list[x, y];
-end;
-
-procedure see_cell;
-var dir: direction;
-    tries: LongInt;
-    x, y: LongInt;
-    found_cell: Boolean;
-    next_dir_clockwise: Boolean;
-
-begin
-x := last_cell[current_step].x;
-y := last_cell[current_step].y;
-seen_list[x, y] := current_step;
-case GetRandom(4) of
-    0: dir := DIR_N;
-    1: dir := DIR_E;
-    2: dir := DIR_S;
-    3: dir := DIR_W;
-end;
-tries := 0;
-found_cell := false;
-if getrandom(2) = 1 then next_dir_clockwise := true
-else next_dir_clockwise := false;
-
-while (tries < 5) and not found_cell do
-begin
-    if when_seen(x + dir.x, y + dir.y) = current_step then //we are seeing ourselves, try another direction
-    begin
-        //we have already seen the target cell, decide if we should remove the wall anyway
-        //(or put a wall there if maze_inverted, but we are not doing that right now)
-        if not maze_inverted and (GetRandom(braidness) = 0) then
-        //or just warn that inverted+braid+indestructible terrain != good idea
-        begin
-            case dir.x of
-                -1: if x > 0 then ywalls[x-1, y] := false;
-                1: if x < seen_cells_x - 1 then ywalls[x, y] := false;
-            end;
-            case dir.y of
-                -1: if y > 0 then xwalls[x, y-1] := false;
-                1: if y < seen_cells_y - 1 then xwalls[x, y] := false;
-            end;
-        end;
-        if next_dir_clockwise then
-        begin
-            if dir = DIR_N then
-                dir := DIR_E
-            else if dir = DIR_E then
-                dir := DIR_S
-            else if dir = DIR_S then
-                dir := DIR_W
-            else
-                dir := DIR_N;
-        end
-        else
-        begin
-            if dir = DIR_N then
-                dir := DIR_W
-            else if dir = DIR_E then
-                dir := DIR_N
-            else if dir = DIR_S then
-                dir := DIR_E
-            else
-                dir := DIR_S;
-        end
-    end
-    else if when_seen(x + dir.x, y + dir.y) = -1 then //cell was not seen yet, go there
-    begin
-        case dir.y of
-            -1: xwalls[x, y-1] := false;
-            1: xwalls[x, y] := false;
-        end;
-        case dir.x of
-            -1: ywalls[x-1, y] := false;
-            1: ywalls[x, y] := false;
-        end;
-        last_cell[current_step].x := x+dir.x;
-        last_cell[current_step].y := y+dir.y;
-        came_from_pos[current_step] := came_from_pos[current_step] + 1;
-        came_from[current_step, came_from_pos[current_step]].x := x;
-        came_from[current_step, came_from_pos[current_step]].y := y;
-        found_cell := true;
-    end
-    else //we are seeing someone else, quit
-    begin
-        step_done[current_step] := true;
-        found_cell := true;
-    end;
-
-    tries := tries + 1;
-end;
-if not found_cell then
-begin
-    last_cell[current_step].x := came_from[current_step, came_from_pos[current_step]].x;
-    last_cell[current_step].y := came_from[current_step, came_from_pos[current_step]].y;
-    came_from_pos[current_step] := came_from_pos[current_step] - 1;
-    if came_from_pos[current_step] >= 0 then see_cell
-    else step_done[current_step] := true;
-end;
-end;
-
-procedure add_vertex(x, y: LongInt);
-var tmp_x, tmp_y: LongInt;
-begin
-if x = NTPX then
-begin
-    if pa.ar[num_vertices - 6].x = NTPX then
-    begin
-        num_vertices := num_vertices - 6;
-    end
-    else
-    begin
-        pa.ar[num_vertices].x := NTPX;
-        pa.ar[num_vertices].y := 0;
-    end
-end
-else
-begin
-    if maze_inverted or (x mod 2 = 0) then tmp_x := cellsize
-    else tmp_x := cellsize * 2 div 3;
-    if maze_inverted or (y mod 2 = 0) then tmp_y := cellsize
-    else tmp_y := cellsize * 2 div 3;
-
-    pa.ar[num_vertices].x := (x-1)*cellsize + tmp_x;
-    pa.ar[num_vertices].y := (y-1)*cellsize + tmp_y + off_y;
-end;
-num_vertices := num_vertices + 1;
-end;
-
-procedure add_edge(x, y: LongInt; dir: direction);
-var i: LongInt;
-begin
-if dir = DIR_N then
-begin
-    dir := DIR_W
-end
-else if dir = DIR_E then
-begin
-    dir := DIR_N
-end
-else if dir = DIR_S then
-begin
-    dir := DIR_E
-end
-else
-begin
-    dir := DIR_S;
-end;
-
-for i := 0 to 3 do
-begin
-        if dir = DIR_N then
-            dir := DIR_E
-        else if dir = DIR_E then
-            dir := DIR_S
-        else if dir = DIR_S then
-            dir := DIR_W
-        else
-            dir := DIR_N;
-
-    if (dir = DIR_N) and is_x_edge(x, y) then
-        begin
-            x_edge_list[x, y] := false;
-            add_vertex(x+1, y);
-            add_edge(x, y-1, DIR_N);
-            break;
-        end;
-
-    if (dir = DIR_E) and is_y_edge(x+1, y) then
-        begin
-            y_edge_list[x+1, y] := false;
-            add_vertex(x+2, y+1);
-            add_edge(x+1, y, DIR_E);
-            break;
-        end;
-
-    if (dir = DIR_S) and is_x_edge(x, y+1) then
-        begin
-            x_edge_list[x, y+1] := false;
-            add_vertex(x+1, y+2);
-            add_edge(x, y+1, DIR_S);
-            break;
-        end;
-
-    if (dir = DIR_W) and is_y_edge(x, y) then
-        begin
-            y_edge_list[x, y] := false;
-            add_vertex(x, y+1);
-            add_edge(x-1, y, DIR_W);
-            break;
-        end;
-end;
-
-end;
-
-begin
-case cTemplateFilter of
-    0: begin
-        cellsize := small_cell_size;
-        maze_inverted := false;
-    end;
-    1: begin
-        cellsize := medium_cell_size;
-        maze_inverted := false;
-    end;
-    2: begin
-        cellsize := large_cell_size;
-        maze_inverted := false;
-    end;
-    3: begin
-        cellsize := small_cell_size;
-        maze_inverted := true;
-    end;
-    4: begin
-        cellsize := medium_cell_size;
-        maze_inverted := true;
-    end;
-    5: begin
-        cellsize := large_cell_size;
-        maze_inverted := true;
-    end;
-end;
-
-num_cells_x := LAND_WIDTH div cellsize;
-if not odd(num_cells_x) then num_cells_x := num_cells_x - 1; //needs to be odd
-num_cells_y := LAND_HEIGHT div cellsize;
-if not odd(num_cells_y) then num_cells_y := num_cells_y - 1;
-num_edges_x := num_cells_x - 1;
-num_edges_y := num_cells_y - 1;
-seen_cells_x := num_cells_x div 2;
-seen_cells_y := num_cells_y div 2;
-
-if maze_inverted then
-    num_steps := 3 //TODO randomize, between 3 and 5?
-else
-    num_steps := 1;
-SetLength(step_done, num_steps);
-SetLength(last_cell, num_steps);
-SetLength(came_from_pos, num_steps);
-SetLength(came_from, num_steps, num_cells_x*num_cells_y);
-done := false;
-for current_step := 0 to num_steps - 1 do
-    step_done[current_step] := false;
-    came_from_pos[current_step] := 0;
-current_step := 0;
-
-SetLength(seen_list, seen_cells_x, seen_cells_y);
-SetLength(xwalls, seen_cells_x, seen_cells_y - 1);
-SetLength(ywalls, seen_cells_x - 1, seen_cells_y);
-SetLength(x_edge_list, num_edges_x, num_cells_y);
-SetLength(y_edge_list, num_cells_x, num_edges_y);
-SetLength(maze, num_cells_x, num_cells_y);
-
-num_vertices := 0;
-
-playHeight := num_cells_y * cellsize;
-playWidth := num_cells_x * cellsize;
-off_y := LAND_HEIGHT - playHeight;
-
-for x := 0 to playWidth do
-    for y := 0 to off_y - 1 do
-        Land[y, x] := 0;
-
-for x := 0 to playWidth do
-    for y := off_y to LAND_HEIGHT - 1 do
-        Land[y, x] := lfBasic;
-
-for y := 0 to num_cells_y - 1 do
-    for x := 0 to num_cells_x - 1 do
-        maze[x, y] := false;
-
-for x := 0 to seen_cells_x - 1 do
-    for y := 0 to seen_cells_y - 2 do
-        xwalls[x, y] := true;
-
-for x := 0 to seen_cells_x - 2 do
-    for y := 0 to seen_cells_y - 1 do
-        ywalls[x, y] := true;
-
-for x := 0 to seen_cells_x - 1 do
-    for y := 0 to seen_cells_y - 1 do
-        seen_list[x, y] := -1;
-
-for x := 0 to num_edges_x - 1 do
-    for y := 0 to num_cells_y - 1 do
-        x_edge_list[x, y] := false;
-
-for x := 0 to num_cells_x - 1 do
-    for y := 0 to num_edges_y - 1 do
-        y_edge_list[x, y] := false;
-
-for current_step := 0 to num_steps-1 do
-begin
-    x := GetRandom(seen_cells_x - 1) div LongWord(num_steps);
-    last_cell[current_step].x := x + current_step * seen_cells_x div num_steps;
-    last_cell[current_step].y := GetRandom(seen_cells_y);
-end;
-
-while not done do
-begin
-    done := true;
-    for current_step := 0 to num_steps-1 do
-    begin
-        if not step_done[current_step] then
-        begin
-            see_cell;
-            done := false;
-        end;
-    end;
-end;
-
-for x := 0 to seen_cells_x - 1 do
-    for y := 0 to seen_cells_y - 1 do
-        if seen_list[x, y] > -1 then
-            maze[(x+1)*2-1, (y+1)*2-1] := true;
-
-for x := 0 to seen_cells_x - 1 do
-    for y := 0 to seen_cells_y - 2 do
-        if not xwalls[x, y] then
-            maze[x*2 + 1, y*2 + 2] := true;
-
-
-for x := 0 to seen_cells_x - 2 do
-     for y := 0 to seen_cells_y - 1 do
-        if not ywalls[x, y] then
-            maze[x*2 + 2, y*2 + 1] := true;
-
-for x := 0 to num_edges_x - 1 do
-    for y := 0 to num_cells_y - 1 do
-        if maze[x, y] xor maze[x+1, y] then
-            x_edge_list[x, y] := true
-        else
-            x_edge_list[x, y] := false;
-
-for x := 0 to num_cells_x - 1 do
-    for y := 0 to num_edges_y - 1 do
-        if maze[x, y] xor maze[x, y+1] then
-            y_edge_list[x, y] := true
-        else
-            y_edge_list[x, y] := false;
-
-for x := 0 to num_edges_x - 1 do
-    for y := 0 to num_cells_y - 1 do
-        if x_edge_list[x, y] then
-        begin
-            x_edge_list[x, y] := false;
-            add_vertex(x+1, y+1);
-            add_vertex(x+1, y);
-            add_edge(x, y-1, DIR_N);
-            add_vertex(NTPX, 0);
-        end;
-
-pa.count := num_vertices;
-
-RandomizePoints(pa);
-BezierizeEdge(pa, _0_25);
-RandomizePoints(pa);
-BezierizeEdge(pa, _0_25);
-
-DrawEdge(pa, 0);
-
-if maze_inverted then
-    FillLand(1, 1+off_y)
-else
-begin
-    x := 0;
-    while Land[cellsize div 2 + cellsize + off_y, x] = lfBasic do
-        x := x + 1;
-    while Land[cellsize div 2 + cellsize + off_y, x] = 0 do
-        x := x + 1;
-    FillLand(x+1, cellsize div 2 + cellsize + off_y);
-end;
-
-MaxHedgehogs:= 32;
-if (GameFlags and gfDisableGirders) <> 0 then hasGirders:= false
-else hasGirders := true;
-leftX:= 0;
-rightX:= playWidth;
-topY:= off_y;
-hasBorder := false;
-end;
 
 procedure GenLandSurface;
 var tmpsurf: PSDL_Surface;
@@ -1076,7 +322,7 @@
                     else if (Land[y, x+1] = lfBasic) and (LandPixels[y, x+1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x+1]
                     else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1, x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y-1, x]
                     else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1, x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y+1, x];
-                    if (((LandPixels[y,x] and AMask) shr AShift) > 10) then LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift)
+                    if (((LandPixels[y,x] and AMask) shr AShift) > 10) then LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (128 shl AShift)
                     end;
                 Land[y,x]:= lfObject
             end
@@ -1096,7 +342,7 @@
                     else if (Land[y, x+1] = lfBasic) and (LandPixels[y,x+1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x+1]
                     else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1,x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y+1, x]
                     else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1,x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y-1, x];
-                    if (((LandPixels[y,x] and AMask) shr AShift) > 10) then LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift)
+                    if (((LandPixels[y,x] and AMask) shr AShift) > 10) then LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (64 shl AShift)
                     end;
                 Land[y,x]:= lfObject
             end;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uLandGenMaze.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,455 @@
+unit uLandGenMaze;
+
+interface
+
+procedure GenMaze;
+
+implementation
+
+uses uRandom, uLandOutline, uLandTemplates, uVariables, uFloat, uConsts;
+
+type direction = record x, y: LongInt; end;
+const DIR_N: direction = (x: 0; y: -1);
+    DIR_E: direction = (x: 1; y: 0);
+    DIR_S: direction = (x: 0; y: 1);
+    DIR_W: direction = (x: -1; y: 0);
+
+
+operator = (const a, b: direction) c: Boolean;
+begin
+    c := (a.x = b.x) and (a.y = b.y);
+end;
+
+const small_cell_size = 128;
+    medium_cell_size = 192;
+    large_cell_size = 256;
+    braidness = 10;
+
+var x, y: LongInt;
+    cellsize: LongInt; //selected by the user in the gui
+    seen_cells_x, seen_cells_y: LongInt; //number of cells that can be visited by the generator, that is every second cell in x and y direction. the cells between there are walls that will be removed when we move from one cell to another
+    num_edges_x, num_edges_y: LongInt; //number of resulting edges that need to be vertexificated
+    num_cells_x, num_cells_y: LongInt; //actual number of cells, depending on cell size
+    seen_list: array of array of LongInt;
+    xwalls: array of array of Boolean;
+    ywalls: array of array of Boolean;
+    x_edge_list: array of array of Boolean;
+    y_edge_list: array of array of Boolean;
+    maze: array of array of Boolean;
+    pa: TPixAr;
+    num_vertices: LongInt;
+    off_y: LongInt;
+    num_steps: LongInt;
+    current_step: LongInt;
+    step_done: array of Boolean;
+    done: Boolean;
+    last_cell: array of record x, y: LongInt; end;
+    came_from: array of array of record x, y: LongInt; end;
+    came_from_pos: array of LongInt;
+    maze_inverted: Boolean;
+
+function when_seen(x: LongInt; y: LongInt): LongInt;
+begin
+if (x < 0) or (x >= seen_cells_x) or (y < 0) or (y >= seen_cells_y) then
+    when_seen := current_step
+else
+    when_seen := seen_list[x, y];
+end;
+
+function is_x_edge(x, y: LongInt): Boolean;
+begin
+if (x < 0) or (x > num_edges_x) or (y < 0) or (y > num_cells_y) then
+    is_x_edge := false
+else
+    is_x_edge := x_edge_list[x, y];
+end;
+
+function is_y_edge(x, y: LongInt): Boolean;
+begin
+if (x < 0) or (x > num_cells_x) or (y < 0) or (y > num_edges_y) then
+    is_y_edge := false
+else
+    is_y_edge := y_edge_list[x, y];
+end;
+
+procedure see_cell;
+var dir: direction;
+    tries: LongInt;
+    x, y: LongInt;
+    found_cell: Boolean;
+    next_dir_clockwise: Boolean;
+
+begin
+x := last_cell[current_step].x;
+y := last_cell[current_step].y;
+seen_list[x, y] := current_step;
+case GetRandom(4) of
+    0: dir := DIR_N;
+    1: dir := DIR_E;
+    2: dir := DIR_S;
+    3: dir := DIR_W;
+end;
+tries := 0;
+found_cell := false;
+if getrandom(2) = 1 then next_dir_clockwise := true
+else next_dir_clockwise := false;
+
+while (tries < 5) and (not found_cell) do
+begin
+    if when_seen(x + dir.x, y + dir.y) = current_step then //we are seeing ourselves, try another direction
+    begin
+        //we have already seen the target cell, decide if we should remove the wall anyway
+        //(or put a wall there if maze_inverted, but we are not doing that right now)
+        if not maze_inverted and (GetRandom(braidness) = 0) then
+        //or just warn that inverted+braid+indestructible terrain != good idea
+        begin
+            case dir.x of
+                -1: if x > 0 then ywalls[x-1, y] := false;
+                1: if x < seen_cells_x - 1 then ywalls[x, y] := false;
+            end;
+            case dir.y of
+                -1: if y > 0 then xwalls[x, y-1] := false;
+                1: if y < seen_cells_y - 1 then xwalls[x, y] := false;
+            end;
+        end;
+        if next_dir_clockwise then
+        begin
+            if dir = DIR_N then
+                dir := DIR_E
+            else if dir = DIR_E then
+                dir := DIR_S
+            else if dir = DIR_S then
+                dir := DIR_W
+            else
+                dir := DIR_N;
+        end
+        else
+        begin
+            if dir = DIR_N then
+                dir := DIR_W
+            else if dir = DIR_E then
+                dir := DIR_N
+            else if dir = DIR_S then
+                dir := DIR_E
+            else
+                dir := DIR_S;
+        end
+    end
+    else if when_seen(x + dir.x, y + dir.y) = -1 then //cell was not seen yet, go there
+    begin
+        case dir.y of
+            -1: xwalls[x, y-1] := false;
+            1: xwalls[x, y] := false;
+        end;
+        case dir.x of
+            -1: ywalls[x-1, y] := false;
+            1: ywalls[x, y] := false;
+        end;
+        last_cell[current_step].x := x+dir.x;
+        last_cell[current_step].y := y+dir.y;
+        came_from_pos[current_step] := came_from_pos[current_step] + 1;
+        came_from[current_step, came_from_pos[current_step]].x := x;
+        came_from[current_step, came_from_pos[current_step]].y := y;
+        found_cell := true;
+    end
+    else //we are seeing someone else, quit
+    begin
+        step_done[current_step] := true;
+        found_cell := true;
+    end;
+
+    tries := tries + 1;
+end;
+if not found_cell then
+begin
+    last_cell[current_step].x := came_from[current_step, came_from_pos[current_step]].x;
+    last_cell[current_step].y := came_from[current_step, came_from_pos[current_step]].y;
+    came_from_pos[current_step] := came_from_pos[current_step] - 1;
+    if came_from_pos[current_step] >= 0 then see_cell
+    else step_done[current_step] := true;
+end;
+end;
+
+procedure add_vertex(x, y: LongInt);
+var tmp_x, tmp_y: LongInt;
+begin
+if x = NTPX then
+begin
+    if pa.ar[num_vertices - 6].x = NTPX then
+    begin
+        num_vertices := num_vertices - 6;
+    end
+    else
+    begin
+        pa.ar[num_vertices].x := NTPX;
+        pa.ar[num_vertices].y := 0;
+    end
+end
+else
+begin
+    if maze_inverted or (x mod 2 = 0) then tmp_x := cellsize
+    else tmp_x := cellsize * 2 div 3;
+    if maze_inverted or (y mod 2 = 0) then tmp_y := cellsize
+    else tmp_y := cellsize * 2 div 3;
+
+    pa.ar[num_vertices].x := (x-1)*cellsize + tmp_x;
+    pa.ar[num_vertices].y := (y-1)*cellsize + tmp_y + off_y;
+end;
+num_vertices := num_vertices + 1;
+end;
+
+procedure add_edge(x, y: LongInt; dir: direction);
+var i: LongInt;
+begin
+if dir = DIR_N then
+begin
+    dir := DIR_W
+end
+else if dir = DIR_E then
+begin
+    dir := DIR_N
+end
+else if dir = DIR_S then
+begin
+    dir := DIR_E
+end
+else
+begin
+    dir := DIR_S;
+end;
+
+for i := 0 to 3 do
+begin
+        if dir = DIR_N then
+            dir := DIR_E
+        else if dir = DIR_E then
+            dir := DIR_S
+        else if dir = DIR_S then
+            dir := DIR_W
+        else
+            dir := DIR_N;
+
+    if (dir = DIR_N) and is_x_edge(x, y) then
+        begin
+            x_edge_list[x, y] := false;
+            add_vertex(x+1, y);
+            add_edge(x, y-1, DIR_N);
+            break;
+        end;
+
+    if (dir = DIR_E) and is_y_edge(x+1, y) then
+        begin
+            y_edge_list[x+1, y] := false;
+            add_vertex(x+2, y+1);
+            add_edge(x+1, y, DIR_E);
+            break;
+        end;
+
+    if (dir = DIR_S) and is_x_edge(x, y+1) then
+        begin
+            x_edge_list[x, y+1] := false;
+            add_vertex(x+1, y+2);
+            add_edge(x, y+1, DIR_S);
+            break;
+        end;
+
+    if (dir = DIR_W) and is_y_edge(x, y) then
+        begin
+            y_edge_list[x, y] := false;
+            add_vertex(x, y+1);
+            add_edge(x-1, y, DIR_W);
+            break;
+        end;
+end;
+
+end;
+
+procedure GenMaze;
+begin
+case cTemplateFilter of
+    0: begin
+        cellsize := small_cell_size;
+        maze_inverted := false;
+    end;
+    1: begin
+        cellsize := medium_cell_size;
+        maze_inverted := false;
+    end;
+    2: begin
+        cellsize := large_cell_size;
+        maze_inverted := false;
+    end;
+    3: begin
+        cellsize := small_cell_size;
+        maze_inverted := true;
+    end;
+    4: begin
+        cellsize := medium_cell_size;
+        maze_inverted := true;
+    end;
+    5: begin
+        cellsize := large_cell_size;
+        maze_inverted := true;
+    end;
+end;
+
+num_cells_x := LAND_WIDTH div cellsize;
+if not odd(num_cells_x) then num_cells_x := num_cells_x - 1; //needs to be odd
+num_cells_y := LAND_HEIGHT div cellsize;
+if not odd(num_cells_y) then num_cells_y := num_cells_y - 1;
+num_edges_x := num_cells_x - 1;
+num_edges_y := num_cells_y - 1;
+seen_cells_x := num_cells_x div 2;
+seen_cells_y := num_cells_y div 2;
+
+if maze_inverted then
+    num_steps := 3 //TODO randomize, between 3 and 5?
+else
+    num_steps := 1;
+SetLength(step_done, num_steps);
+SetLength(last_cell, num_steps);
+SetLength(came_from_pos, num_steps);
+SetLength(came_from, num_steps, num_cells_x*num_cells_y);
+done := false;
+for current_step := 0 to num_steps - 1 do
+    step_done[current_step] := false;
+    came_from_pos[current_step] := 0;
+current_step := 0;
+
+SetLength(seen_list, seen_cells_x, seen_cells_y);
+SetLength(xwalls, seen_cells_x, seen_cells_y - 1);
+SetLength(ywalls, seen_cells_x - 1, seen_cells_y);
+SetLength(x_edge_list, num_edges_x, num_cells_y);
+SetLength(y_edge_list, num_cells_x, num_edges_y);
+SetLength(maze, num_cells_x, num_cells_y);
+
+num_vertices := 0;
+
+playHeight := num_cells_y * cellsize;
+playWidth := num_cells_x * cellsize;
+off_y := LAND_HEIGHT - playHeight;
+
+for x := 0 to playWidth do
+    for y := 0 to off_y - 1 do
+        Land[y, x] := 0;
+
+for x := 0 to playWidth do
+    for y := off_y to LAND_HEIGHT - 1 do
+        Land[y, x] := lfBasic;
+
+for y := 0 to num_cells_y - 1 do
+    for x := 0 to num_cells_x - 1 do
+        maze[x, y] := false;
+
+for x := 0 to seen_cells_x - 1 do
+    for y := 0 to seen_cells_y - 2 do
+        xwalls[x, y] := true;
+
+for x := 0 to seen_cells_x - 2 do
+    for y := 0 to seen_cells_y - 1 do
+        ywalls[x, y] := true;
+
+for x := 0 to seen_cells_x - 1 do
+    for y := 0 to seen_cells_y - 1 do
+        seen_list[x, y] := -1;
+
+for x := 0 to num_edges_x - 1 do
+    for y := 0 to num_cells_y - 1 do
+        x_edge_list[x, y] := false;
+
+for x := 0 to num_cells_x - 1 do
+    for y := 0 to num_edges_y - 1 do
+        y_edge_list[x, y] := false;
+
+for current_step := 0 to num_steps-1 do
+begin
+    x := GetRandom(seen_cells_x - 1) div LongWord(num_steps);
+    last_cell[current_step].x := x + current_step * seen_cells_x div num_steps;
+    last_cell[current_step].y := GetRandom(seen_cells_y);
+end;
+
+while not done do
+begin
+    done := true;
+    for current_step := 0 to num_steps-1 do
+    begin
+        if not step_done[current_step] then
+        begin
+            see_cell;
+            done := false;
+        end;
+    end;
+end;
+
+for x := 0 to seen_cells_x - 1 do
+    for y := 0 to seen_cells_y - 1 do
+        if seen_list[x, y] > -1 then
+            maze[(x+1)*2-1, (y+1)*2-1] := true;
+
+for x := 0 to seen_cells_x - 1 do
+    for y := 0 to seen_cells_y - 2 do
+        if not xwalls[x, y] then
+            maze[x*2 + 1, y*2 + 2] := true;
+
+
+for x := 0 to seen_cells_x - 2 do
+     for y := 0 to seen_cells_y - 1 do
+        if not ywalls[x, y] then
+            maze[x*2 + 2, y*2 + 1] := true;
+
+for x := 0 to num_edges_x - 1 do
+    for y := 0 to num_cells_y - 1 do
+        if maze[x, y] xor maze[x+1, y] then
+            x_edge_list[x, y] := true
+        else
+            x_edge_list[x, y] := false;
+
+for x := 0 to num_cells_x - 1 do
+    for y := 0 to num_edges_y - 1 do
+        if maze[x, y] xor maze[x, y+1] then
+            y_edge_list[x, y] := true
+        else
+            y_edge_list[x, y] := false;
+
+for x := 0 to num_edges_x - 1 do
+    for y := 0 to num_cells_y - 1 do
+        if x_edge_list[x, y] then
+        begin
+            x_edge_list[x, y] := false;
+            add_vertex(x+1, y+1);
+            add_vertex(x+1, y);
+            add_edge(x, y-1, DIR_N);
+            add_vertex(NTPX, 0);
+        end;
+
+pa.count := num_vertices;
+
+RandomizePoints(pa);
+BezierizeEdge(pa, _0_25);
+RandomizePoints(pa);
+BezierizeEdge(pa, _0_25);
+
+DrawEdge(pa, 0);
+
+if maze_inverted then
+    FillLand(1, 1+off_y)
+else
+begin
+    x := 0;
+    while Land[cellsize div 2 + cellsize + off_y, x] = lfBasic do
+        x := x + 1;
+    while Land[cellsize div 2 + cellsize + off_y, x] = 0 do
+        x := x + 1;
+    FillLand(x+1, cellsize div 2 + cellsize + off_y);
+end;
+
+MaxHedgehogs:= 32;
+if (GameFlags and gfDisableGirders) <> 0 then hasGirders:= false
+else hasGirders := true;
+leftX:= 0;
+rightX:= playWidth;
+topY:= off_y;
+hasBorder := false;
+end;
+
+end.
--- a/hedgewars/uLandGraphics.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uLandGraphics.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -38,6 +38,7 @@
 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword);
 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
 function  LandBackPixel(x, y: LongInt): LongWord;
+procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
 
 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
 
@@ -298,7 +299,7 @@
                begin
                by:= t div 2; bx:= i div 2;
                end;
-           if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and not (disableLandBack) then
+           if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then
                begin
                inc(cnt);
                LandPixels[by, bx]:= LandBackPixel(i, t)
@@ -676,7 +677,7 @@
      4: for y:= 0 to Pred(h) do
             begin
             for x:= 0 to Pred(w) do
-                if PLongword(@(p^[x * 4]))^ <> 0 then
+                if (PLongword(@(p^[x * 4]))^) <> 0 then
                    if ((cpY + y) <= Longint(topY)) or
                       ((cpY + y) >= LAND_HEIGHT) or
                       ((cpX + x) <= Longint(leftX)) or
@@ -705,7 +706,7 @@
      4: for y:= 0 to Pred(h) do
             begin
             for x:= 0 to Pred(w) do
-                if PLongword(@(p^[x * 4]))^ <> 0 then
+                if (PLongword(@(p^[x * 4]))^) <> 0 then
                    begin
                    if (cReducedQuality and rqBlurryLand) = 0 then
                        begin
@@ -781,7 +782,7 @@
 
     if c < 4 then // 0-3 neighbours
         begin
-        if ((Land[Y, X] and lfBasic) <> 0) and not disableLandBack then
+        if ((Land[Y, X] and lfBasic) <> 0) and (not disableLandBack) then
             LandPixels[yy, xx]:= LandBackPixel(X, Y)
         else
             LandPixels[yy, xx]:= 0;
@@ -804,7 +805,7 @@
         begin
         if (cReducedQuality and rqBlurryLand) = 0 then
             begin
-            if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (128 shl AShift)
+            if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and (not AMask)) or (128 shl AShift)
             else
                 LandPixels[y,x]:=
                                 (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or
@@ -826,7 +827,7 @@
         begin
         if (cReducedQuality and rqBlurryLand) = 0 then
             begin
-            if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (64 shl AShift)
+            if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and (not AMask)) or (64 shl AShift)
             else
                 LandPixels[y,x]:=
                                 (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or
@@ -962,4 +963,56 @@
 end;
 
 
+procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
+var
+  eX, eY, dX, dY: LongInt;
+  i, sX, sY, x, y, d: LongInt;
+begin
+eX:= 0;
+eY:= 0;
+dX:= X2 - X1;
+dY:= Y2 - Y1;
+
+if (dX > 0) then sX:= 1
+else
+  if (dX < 0) then
+     begin
+     sX:= -1;
+     dX:= -dX
+     end else sX:= dX;
+
+if (dY > 0) then sY:= 1
+  else
+  if (dY < 0) then
+     begin
+     sY:= -1;
+     dY:= -dY
+     end else sY:= dY;
+
+if (dX > dY) then d:= dX
+             else d:= dY;
+
+x:= X1;
+y:= Y1;
+
+for i:= 0 to d do
+    begin
+    inc(eX, dX);
+    inc(eY, dY);
+    if (eX > d) then
+       begin
+       dec(eX, d);
+       inc(x, sX);
+       end;
+    if (eY > d) then
+       begin
+       dec(eY, d);
+       inc(y, sY);
+       end;
+
+    if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
+       Land[y, x]:= Color;
+    end
+end;
+
 end.
--- a/hedgewars/uLandObjects.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uLandObjects.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -151,22 +151,22 @@
 CheckIntersect:= res;
 end;
 
+
+function CountNonZeroz(x, y: LongInt): Longword;
+var i: LongInt;
+    lRes: Longword;
+begin
+    lRes:= 0;
+    for i:= y to y + 15 do
+        if Land[i, x] <> 0 then inc(lRes);
+    CountNonZeroz:= lRes;
+end;
+
 function AddGirder(gX: LongInt): boolean;
 var tmpsurf: PSDL_Surface;
     x1, x2, y, k, i: LongInt;
     rr: TSDL_Rect;
     bRes: boolean;
-
-    function CountNonZeroz(x, y: LongInt): Longword;
-    var i: LongInt;
-        lRes: Longword;
-    begin
-    lRes:= 0;
-    for i:= y to y + 15 do
-        if Land[i, x] <> 0 then inc(lRes);
-    CountNonZeroz:= lRes;
-    end;
-
 begin
 y:= topY+150;
 repeat
@@ -192,7 +192,7 @@
         k:= CountNonZeroz(x2, y)
         until (x2 >= (rightX-150)) or (k = 0) or (k = 16) or (x2 > i) or (x2 - x1 >= 768);
         if (x2 < (rightX - 150)) and (k = 16) and (x2 - x1 > 250) and (x2 - x1 < 768)
-            and not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144) then break;
+            and (not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144)) then break;
         end;
 x1:= 0;
 until y > (LAND_HEIGHT-125);
@@ -345,7 +345,7 @@
         y:= 8;
         repeat
             if CheckLand(r, x, y - 8, lfBasic)
-            and not CheckIntersect(x, y, Width, Height) then
+            and (not CheckIntersect(x, y, Width, Height)) then
             begin
             ar[cnt].x:= x;
             ar[cnt].y:= y;
@@ -376,19 +376,21 @@
 TryPut:= bRes;
 end;
 
+
+procedure CheckRect(Width, Height, x, y, w, h: LongWord);
+begin
+    if (x + w > Width) then 
+        OutError('Object''s rectangle exceeds image: x + w (' + inttostr(x) + ' + ' + inttostr(w) + ') > Width (' + inttostr(Width) + ')', true);
+    if (y + h > Height) then 
+        OutError('Object''s rectangle exceeds image: y + h (' + inttostr(y) + ' + ' + inttostr(h) + ') > Height (' + inttostr(Height) + ')', true);
+end;
+
 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
 var s, key: shortstring;
     f: textfile;
     i: LongInt;
     ii, t: Longword;
     c2: TSDL_Color;
-
-    procedure CheckRect(Width, Height, x, y, w, h: LongWord);
-    begin
-    if (x + w > Width) then OutError('Object''s rectangle exceeds image: x + w (' + inttostr(x) + ' + ' + inttostr(w) + ') > Width (' + inttostr(Width) + ')', true);
-    if (y + h > Height) then OutError('Object''s rectangle exceeds image: y + h (' + inttostr(y) + ' + ' + inttostr(h) + ') > Height (' + inttostr(Height) + ')', true);
-    end;
-
 begin
 
 AddProgress;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uLandOutline.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,292 @@
+unit uLandOutline;
+
+interface
+
+uses uConsts, SDLh, uFloat;
+
+type TPixAr = record
+              Count: Longword;
+              ar: array[0..Pred(cMaxEdgePoints)] of TPoint;
+              end;
+
+procedure DrawEdge(var pa: TPixAr; Color: Longword);
+procedure FillLand(x, y: LongInt);
+procedure BezierizeEdge(var pa: TPixAr; Delta: hwFloat);
+procedure RandomizePoints(var pa: TPixAr);
+
+implementation
+
+uses uLandGraphics, uDebug, uVariables, uLandTemplates, uRandom, uUtils;
+
+
+
+var Stack: record
+           Count: Longword;
+           points: array[0..8192] of record
+                                     xl, xr, y, dir: LongInt;
+                                     end
+           end;
+
+procedure Push(_xl, _xr, _y, _dir: LongInt);
+begin
+    TryDo(Stack.Count <= 8192, 'FillLand: stack overflow', true);
+    _y:= _y + _dir;
+    if (_y < 0) or (_y >= LAND_HEIGHT) then exit;
+    with Stack.points[Stack.Count] do
+            begin
+            xl:= _xl;
+            xr:= _xr;
+            y:= _y;
+            dir:= _dir
+            end;
+    inc(Stack.Count)
+end;
+
+procedure Pop(var _xl, _xr, _y, _dir: LongInt);
+begin
+    dec(Stack.Count);
+    with Stack.points[Stack.Count] do
+        begin
+        _xl:= xl;
+        _xr:= xr;
+        _y:= y;
+        _dir:= dir
+        end
+end;
+
+procedure FillLand(x, y: LongInt);
+var xl, xr, dir: LongInt;
+begin
+    Stack.Count:= 0;
+    xl:= x - 1;
+    xr:= x;
+    Push(xl, xr, y, -1);
+    Push(xl, xr, y,  1);
+    dir:= 0;
+    while Stack.Count > 0 do
+        begin
+        Pop(xl, xr, y, dir);
+        while (xl > 0) and (Land[y, xl] <> 0) do dec(xl);
+        while (xr < LAND_WIDTH - 1) and (Land[y, xr] <> 0) do inc(xr);
+        while (xl < xr) do
+            begin
+            while (xl <= xr) and (Land[y, xl] = 0) do inc(xl);
+            x:= xl;
+            while (xl <= xr) and (Land[y, xl] <> 0) do
+                begin
+                Land[y, xl]:= 0;
+                inc(xl)
+                end;
+            if x < xl then
+                begin
+                Push(x, Pred(xl), y, dir);
+                Push(x, Pred(xl), y,-dir);
+                end;
+            end;
+        end;
+end;
+
+procedure DrawEdge(var pa: TPixAr; Color: Longword);
+var i: LongInt;
+begin
+    i:= 0;
+    with pa do
+        while i < LongInt(Count) - 1 do
+            if (ar[i + 1].X = NTPX) then 
+                inc(i, 2)
+            else 
+                begin
+                DrawLine(ar[i].x, ar[i].y, ar[i + 1].x, ar[i + 1].y, Color);
+                inc(i)
+                end
+end;
+
+
+procedure Vector(p1, p2, p3: TPoint; var Vx, Vy: hwFloat);
+var d1, d2, d: hwFloat;
+begin
+    Vx:= int2hwFloat(p1.X - p3.X);
+    Vy:= int2hwFloat(p1.Y - p3.Y);
+
+    d:= DistanceI(p2.X - p1.X, p2.Y - p1.Y);
+    d1:= DistanceI(p2.X - p3.X, p2.Y - p3.Y);
+    d2:= Distance(Vx, Vy);
+
+    if d1 < d then d:= d1;
+    if d2 < d then d:= d2;
+
+    d:= d * _1div3;
+
+    if d2.QWordValue = 0 then
+        begin
+        Vx:= _0;
+        Vy:= _0
+        end 
+    else
+        begin
+        d2:= _1 / d2;
+        Vx:= Vx * d2;
+        Vy:= Vy * d2;
+
+        Vx:= Vx * d;
+        Vy:= Vy * d
+        end
+end;
+
+procedure AddLoopPoints(var pa, opa: TPixAr; StartI, EndI: LongInt; Delta: hwFloat);
+var i, pi, ni: LongInt;
+    NVx, NVy, PVx, PVy: hwFloat;
+    x1, x2, y1, y2: LongInt;
+    tsq, tcb, t, r1, r2, r3, cx1, cx2, cy1, cy2: hwFloat;
+    X, Y: LongInt;
+begin
+pi:= EndI;
+i:= StartI;
+ni:= Succ(StartI);
+{$HINTS OFF}
+Vector(opa.ar[pi], opa.ar[i], opa.ar[ni], NVx, NVy);
+{$HINTS ON}
+repeat
+    inc(pi);
+    if pi > EndI then pi:= StartI;
+    inc(i);
+    if i > EndI then i:= StartI;
+    inc(ni);
+    if ni > EndI then ni:= StartI;
+    PVx:= NVx;
+    PVy:= NVy;
+    Vector(opa.ar[pi], opa.ar[i], opa.ar[ni], NVx, NVy);
+
+    x1:= opa.ar[pi].x;
+    y1:= opa.ar[pi].y;
+    x2:= opa.ar[i].x;
+    y2:= opa.ar[i].y;
+    cx1:= int2hwFloat(x1) - PVx;
+    cy1:= int2hwFloat(y1) - PVy;
+    cx2:= int2hwFloat(x2) + NVx;
+    cy2:= int2hwFloat(y2) + NVy;
+    t:= _0;
+    while t.Round = 0 do
+          begin
+          tsq:= t * t;
+          tcb:= tsq * t;
+          r1:= (_1 - t*3 + tsq*3 - tcb);
+          r2:= (     t*3 - tsq*6 + tcb*3);
+          r3:= (           tsq*3 - tcb*3);
+          X:= hwRound(r1 * x1 + r2 * cx1 + r3 * cx2 + tcb * x2);
+          Y:= hwRound(r1 * y1 + r2 * cy1 + r3 * cy2 + tcb * y2);
+          t:= t + Delta;
+          pa.ar[pa.Count].x:= X;
+          pa.ar[pa.Count].y:= Y;
+          inc(pa.Count);
+          TryDo(pa.Count <= cMaxEdgePoints, 'Edge points overflow', true)
+          end;
+until i = StartI;
+pa.ar[pa.Count].x:= opa.ar[StartI].X;
+pa.ar[pa.Count].y:= opa.ar[StartI].Y;
+inc(pa.Count)
+end;
+
+procedure BezierizeEdge(var pa: TPixAr; Delta: hwFloat);
+var i, StartLoop: LongInt;
+    opa: TPixAr;
+begin
+opa:= pa;
+pa.Count:= 0;
+i:= 0;
+StartLoop:= 0;
+while i < LongInt(opa.Count) do
+    if (opa.ar[i + 1].X = NTPX) then
+       begin
+       AddLoopPoints(pa, opa, StartLoop, i, Delta);
+       inc(i, 2);
+       StartLoop:= i;
+       pa.ar[pa.Count].X:= NTPX;
+       pa.ar[pa.Count].Y:= 0;
+       inc(pa.Count);
+       end else inc(i)
+end;
+
+
+function CheckIntersect(V1, V2, V3, V4: TPoint): boolean;
+var c1, c2, dm: LongInt;
+begin
+    dm:= (V4.y - V3.y) * (V2.x - V1.x) - (V4.x - V3.x) * (V2.y - V1.y);
+    c1:= (V4.x - V3.x) * (V1.y - V3.y) - (V4.y - V3.y) * (V1.x - V3.x);
+    if dm = 0 then exit(false);
+
+    c2:= (V2.x - V3.x) * (V1.y - V3.y) - (V2.y - V3.y) * (V1.x - V3.x);
+    if dm > 0 then
+        begin
+        if (c1 < 0) or (c1 > dm) then exit(false);
+        if (c2 < 0) or (c2 > dm) then exit(false)
+        end 
+    else
+        begin
+        if (c1 > 0) or (c1 < dm) then exit(false);
+        if (c2 > 0) or (c2 < dm) then exit(false)
+        end;
+
+    //AddFileLog('1  (' + inttostr(V1.x) + ',' + inttostr(V1.y) + ')x(' + inttostr(V2.x) + ',' + inttostr(V2.y) + ')');
+    //AddFileLog('2  (' + inttostr(V3.x) + ',' + inttostr(V3.y) + ')x(' + inttostr(V4.x) + ',' + inttostr(V4.y) + ')');
+    CheckIntersect:= true
+end;
+
+
+function CheckSelfIntersect(var pa: TPixAr; ind: Longword): boolean;
+var i: Longword;
+begin
+    if (ind <= 0) or (ind >= Pred(pa.Count)) then exit(false);
+    for i:= 1 to pa.Count - 3 do
+        if (i <= ind - 1) or (i >= ind + 2) then
+        begin
+        if (i <> ind - 1) and
+            CheckIntersect(pa.ar[ind], pa.ar[ind - 1], pa.ar[i], pa.ar[i - 1]) then exit(true);
+        if (i <> ind + 2) and
+            CheckIntersect(pa.ar[ind], pa.ar[ind + 1], pa.ar[i], pa.ar[i - 1]) then exit(true);
+        end;
+    CheckSelfIntersect:= false
+end;
+
+procedure RandomizePoints(var pa: TPixAr);
+const cEdge = 55;
+      cMinDist = 8;
+var radz: array[0..Pred(cMaxEdgePoints)] of LongInt;
+    i, k, dist, px, py: LongInt;
+begin
+    for i:= 0 to Pred(pa.Count) do
+    begin
+    radz[i]:= 0;
+        with pa.ar[i] do
+            if x <> NTPX then
+            begin
+            radz[i]:= Min(Max(x - cEdge, 0), Max(LAND_WIDTH - cEdge - x, 0));
+            radz[i]:= Min(radz[i], Min(Max(y - cEdge, 0), Max(LAND_HEIGHT - cEdge - y, 0)));
+            if radz[i] > 0 then
+                for k:= 0 to Pred(i) do
+                begin
+                dist:= Max(abs(x - pa.ar[k].x), abs(y - pa.ar[k].y));
+                radz[k]:= Max(0, Min((dist - cMinDist) div 2, radz[k]));
+                radz[i]:= Max(0, Min(dist - radz[k] - cMinDist, radz[i]))
+                end
+            end;
+    end;
+
+    for i:= 0 to Pred(pa.Count) do
+        with pa.ar[i] do
+            if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
+            begin
+            px:= x;
+            py:= y;
+            x:= x + LongInt(GetRandom(7) - 3) * (radz[i] * 5 div 7) div 3;
+            y:= y + LongInt(GetRandom(7) - 3) * (radz[i] * 5 div 7) div 3;
+            if CheckSelfIntersect(pa, i) then
+                begin
+                x:= px;
+                y:= py
+                end;
+            end
+end;
+
+
+end.
\ No newline at end of file
--- a/hedgewars/uLocale.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uLocale.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -58,7 +58,7 @@
        begin
        readln(f, s);
        if Length(s) = 0 then continue;
-       if not (s[1] in ['0'..'9']) then continue;
+       if (s[1] < '0') or (s[1] > '9') then continue;
        TryDo(Length(s) > 6, 'Load locale: empty string', true);
        val(s[1]+s[2], a, c);
        TryDo(c = 0, 'Load locale: numbers should be two-digit: ' + s, true);
--- a/hedgewars/uScript.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uScript.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -45,16 +45,19 @@
 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt;
 function ScriptExists(fname : shortstring) : boolean;
 
+
+function ParseCommandOverride(key, value : shortstring) : shortstring;
+
 procedure initModule;
 procedure freeModule;
 
 implementation
 {$IFNDEF LUA_DISABLED}
-uses LuaPas in 'LuaPas.pas',
+uses LuaPas,
     uConsole,
     uConsts,
     uVisualGears,
-    uGears,
+    uGearsList,
     uFloat,
     uWorld,
     uAmmos,
@@ -1712,7 +1715,7 @@
 
 procedure ScriptCall(fname : shortstring);
 begin
-if not ScriptLoaded or not ScriptExists(fname) then
+if not ScriptLoaded or (not ScriptExists(fname)) then
     exit;
 SetGlobals;
 lua_getglobal(luaState, Str2PChar(fname));
@@ -1724,6 +1727,25 @@
 GetGlobals;
 end;
 
+function ParseCommandOverride(key, value : shortstring) : shortstring;
+begin
+ParseCommandOverride:= value;
+if not ScriptExists('ParseCommandOverride') then exit;
+lua_getglobal(luaState, Str2PChar('ParseCommandOverride'));
+lua_pushstring(luaState, Str2PChar(key));
+lua_pushstring(luaState, Str2PChar(value));
+if lua_pcall(luaState, 2, 1, 0) <> 0 then
+    begin
+    LuaError('Lua: Error while calling ParseCommandOverride: ' + lua_tostring(luaState, -1));
+    lua_pop(luaState, 1)
+    end
+else
+    begin
+    ParseCommandOverride:= lua_tostring(luaState, -1);
+    lua_pop(luaState, 1)
+    end;
+end;
+
 function ScriptCall(fname : shortstring; par1: LongInt) : LongInt;
 begin
 ScriptCall:= ScriptCall(fname, par1, 0, 0, 0)
@@ -1741,7 +1763,7 @@
 
 function ScriptCall(fname : shortstring; par1, par2, par3, par4 : LongInt) : LongInt;
 begin
-if not ScriptLoaded or not ScriptExists(fname) then
+if not ScriptLoaded or (not ScriptExists(fname)) then
     exit;
 SetGlobals;
 lua_getglobal(luaState, Str2PChar(fname));
@@ -2077,6 +2099,15 @@
 ScriptExists:= false
 end;
 
+function ParseCommandOverride(key, value : shortstring) : shortstring;
+begin
+ParseCommandOverride:= value
+end;
+
+procedure ScriptOnScreenResize;
+begin
+end;
+
 procedure initModule;
 begin
 end;
--- a/hedgewars/uSound.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uSound.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -52,6 +52,7 @@
 procedure PauseMusic;
 procedure ResumeMusic;
 procedure ChangeMusic; // Replaces music track with current MusicFN and plays it.
+procedure StopMusic; // Stops and releases the current track
 
 
 // SOUNDS
@@ -148,7 +149,7 @@
     WriteToConsole('Init sound...');
     isSoundEnabled:= SDL_InitSubSystem(SDL_INIT_AUDIO) >= 0;
 
-{$IFDEF IPHONEOS}
+{$IFDEF MOBILE}
     channels:= 1;
 {$ELSE}
     channels:= 2;
@@ -458,7 +459,8 @@
     if (MusicFN = '') or (not isMusicEnabled) then
         exit;
 
-    Mix_PauseMusic(Mus);
+    if Mus <> nil then
+    	Mix_PauseMusic(Mus);
 end;
 
 procedure ResumeMusic;
@@ -466,7 +468,8 @@
     if (MusicFN = '') or (not isMusicEnabled) then
         exit;
 
-    Mix_ResumeMusic(Mus);
+    if Mus <> nil then
+    	Mix_ResumeMusic(Mus);
 end;
 
 procedure ChangeMusic;
@@ -474,11 +477,17 @@
     if (MusicFN = '') or (not isMusicEnabled) then
         exit;
 
-    // get rid of current music
+    StopMusic;
+    PlayMusic;
+end;
+
+procedure StopMusic;
+begin
+    if (MusicFN = '') or (not isMusicEnabled) then
+        exit;
+
     if Mus <> nil then
         Mix_FreeMusic(Mus);
-
-    PlayMusic;
 end;
 
 procedure chVoicepack(var s: shortstring);
--- a/hedgewars/uStats.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uStats.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -130,7 +130,7 @@
     else if AmmoDamagingUsed then
         AddVoice(sndMissed, PreviousTeam^.voicepack)
     else if (AmmoUsedCount > 0) and (not isTurnSkipped) then
-        // nothing ?
+        begin end// nothing ?
     else if isTurnSkipped then
         begin
         AddVoice(sndBoring, PreviousTeam^.voicepack);
--- a/hedgewars/uStore.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uStore.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -118,16 +118,15 @@
 SDL_FreeSurface(tmpsurf)
 end;
 
-procedure StoreLoad(reload: boolean);
-var s: shortstring;
 
-    procedure WriteNames(Font: THWFont);
-    var t: LongInt;
-        i: LongInt;
-        r, rr: TSDL_Rect;
-        drY: LongInt;
-        texsurf, flagsurf, iconsurf: PSDL_Surface;
-    begin
+procedure WriteNames(Font: THWFont);
+var t: LongInt;
+    i: LongInt;
+    r, rr: TSDL_Rect;
+    drY: LongInt;
+    texsurf, flagsurf, iconsurf: PSDL_Surface;
+    s: shortstring;
+begin
     r.x:= 0;
     r.y:= 0;
     drY:= - 4;
@@ -220,11 +219,11 @@
         SDL_FreeSurface(iconsurf);
         iconsurf:= nil;
         end;
-    end;
+end;
 
-    procedure InitHealth;
-    var i, t: LongInt;
-    begin
+procedure InitHealth;
+var i, t: LongInt;
+begin
     for t:= 0 to Pred(TeamsCount) do
         if TeamsArray[t] <> nil then
             with TeamsArray[t]^ do
@@ -233,12 +232,12 @@
                     if Hedgehogs[i].Gear <> nil then
                         RenderHealth(Hedgehogs[i]);
                 end
-    end;
+end;
 
-    procedure LoadGraves;
-    var t: LongInt;
-        texsurf: PSDL_Surface;
-    begin
+procedure LoadGraves;
+var t: LongInt;
+    texsurf: PSDL_Surface;
+begin
     for t:= 0 to Pred(TeamsCount) do
     if TeamsArray[t] <> nil then
         with TeamsArray[t]^ do
@@ -251,9 +250,11 @@
             GraveTex:= Surface2Tex(texsurf, false);
             SDL_FreeSurface(texsurf)
             end
-    end;
+end;
 
-var ii: TSprite;
+procedure StoreLoad(reload: boolean);
+var s: shortstring;
+    ii: TSprite;
     fi: THWFont;
     ai: TAmmoType;
     tmpsurf: PSDL_Surface;
@@ -291,7 +292,7 @@
            ((vobCount > 0) or (ii <> sprFlake)) then
         begin
             if AltPath = ptNone then
-                if ii in [sprHorizont, sprHorizontL, sprHorizontR, sprSky, sprSkyL, sprSkyR, sprChunk] then // FIXME: hack
+                if ii in [sprHorizont, sprHorizontL, sprHorizontR, sprSky, sprSkyL, sprSkyR, sprChunk, sprFireButton] then // FIXME: hack
                     begin
                     if not reload then
                         begin
@@ -413,7 +414,7 @@
         begin
         FreeTexture(SpritesData[ii].Texture);
         SpritesData[ii].Texture:= nil;
-        if (SpritesData[ii].Surface <> nil) and not reload then
+        if (SpritesData[ii].Surface <> nil) and (not reload) then
             begin
             SDL_FreeSurface(SpritesData[ii].Surface);
             SpritesData[ii].Surface:= nil
@@ -955,7 +956,7 @@
     {$IFNDEF DARWIN}ico: PSDL_Surface;{$ENDIF}
     {$IFDEF SDL13}x, y: LongInt;{$ENDIF}
 begin
-    if Length(s) = 0 then cFullScreen:= not cFullScreen
+    if Length(s) = 0 then cFullScreen:= (not cFullScreen)
     else cFullScreen:= s = '1';
 
     AddFileLog('Preparing to change video parameters...');
@@ -1008,7 +1009,7 @@
     y:= SDL_WINDOWPOS_CENTERED_MASK;
     flags:= SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN;
 
-{$IFDEF IPHONEOS}
+{$IFDEF MOBILE}
     // make the sdl window appear on the second monitor when present
     x:= x or (SDL_GetNumVideoDisplays() - 1);
     y:= y or (SDL_GetNumVideoDisplays() - 1);
--- a/hedgewars/uTeams.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uTeams.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -142,7 +142,7 @@
 c:= CurrentTeam^.Clan^.ClanIndex;
 repeat
     with ClansArray[c]^ do
-        if (CurrTeam = TagTeamIndex) and ((GameFlags And gfTagTeam) <> 0) then
+        if (CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0) then
             begin
             TagTeamIndex:= Pred(TagTeamIndex) mod TeamsNumber;
             CurrTeam:= Pred(CurrTeam) mod TeamsNumber;
@@ -150,7 +150,7 @@
             NextClan:= true;
             end;
 
-    if (GameFlags And gfTagTeam) = 0 then inc(c);
+    if (GameFlags and gfTagTeam) = 0 then inc(c);
 
     if c = ClansCount then
         begin
@@ -171,7 +171,7 @@
                     CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
                 until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
                 end
-        until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags And gfTagTeam) <> 0));
+        until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0));
         end
 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil);
 
@@ -243,7 +243,7 @@
     if CurrentHedgehog^.Unplaced then TurnTimeLeft:= 15000
     else TurnTimeLeft:= 0
     end
-else if ((GameFlags And gfTagTeam) <> 0) and not NextClan then
+else if ((GameFlags and gfTagTeam) <> 0) and (not NextClan) then
     begin
     if TagTurnTimeLeft <> 0 then TurnTimeLeft:= TagTurnTimeLeft;
     TagTurnTimeLeft:= 0;
--- a/hedgewars/uTextures.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uTextures.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -119,6 +119,8 @@
     fromP4:= @(fromP4^[Surf^.pitch div 4])
     end;
 end;
+
+
 function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture;
 var tw, th, x, y: Longword;
     tmpp: pointer;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uTouch.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,517 @@
+(*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *)
+
+{$INCLUDE "options.inc"}
+
+unit uTouch;
+
+interface
+
+uses sysutils, math, uConsole, uVariables, SDLh, uTypes, uFloat, uConsts, uIO, uCommands, GLUnit;
+
+// TODO: this type should be Int64
+// TODO: this type should be named TSDL_FingerId
+type SDL_FingerId = LongInt;
+
+type
+    PTouch_Finger = ^Touch_Finger;
+    Touch_Finger = record
+        id                       : SDL_FingerId;
+        x,y                      : LongInt;
+        historicalX, historicalY : LongInt;
+        timeSinceDown            : Longword;
+        end;
+
+procedure initModule;
+
+procedure ProcessTouch;
+procedure onTouchDown(x,y: Longword; pointerId: SDL_FingerId);
+procedure onTouchMotion(x,y: Longword; dx,dy: LongInt; pointerId: SDL_FingerId);
+procedure onTouchUp(x,y: Longword; pointerId: SDL_FingerId);
+function convertToCursor(scale: LongInt; xy: LongInt): LongInt;
+function addFinger(x,y: Longword; id: SDL_FingerId): PTouch_Finger;
+procedure deleteFinger(id: SDL_FingerId);
+procedure onTouchClick(finger: Touch_Finger);
+procedure onTouchDoubleClick(finger: Touch_Finger);
+
+function findFinger(id: SDL_FingerId): PTouch_Finger;
+procedure aim(finger: Touch_Finger);
+function isOnCrosshair(finger: Touch_Finger): boolean;
+function isOnCurrentHog(finger: Touch_Finger): boolean;
+function isOnFireButton(finger: Touch_Finger): boolean;
+procedure convertToWorldCoord(var x,y: hwFloat; finger: Touch_Finger);
+procedure convertToFingerCoord(var x,y: hwFloat; oldX, oldY: hwFloat);
+function fingerHasMoved(finger: Touch_Finger): boolean;
+function calculateDelta(finger1, finger2: Touch_Finger): hwFloat;
+function getSecondFinger(finger: Touch_Finger): PTouch_Finger;
+procedure printFinger(finger: Touch_Finger);
+implementation
+
+const
+    clicktime = 200;
+    nilFingerId = High(SDL_FingerId);
+
+var
+    fireButtonLeft, fireButtonRight, fireButtonTop, fireButtonBottom : LongInt;
+        
+
+
+    leftButtonBoundary  : LongInt;
+    rightButtonBoundary : LongInt;
+    topButtonBoundary   : LongInt;
+    
+    pointerCount : Longword;
+    fingers: array of Touch_Finger;
+    moveCursor : boolean;
+    invertCursor : boolean;
+
+    xTouchClick,yTouchClick : LongInt;
+    timeSinceClick : Longword;
+
+    //Pinch to zoom 
+    pinchSize : hwFloat;
+    baseZoomValue: GLFloat;
+
+
+    //aiming
+    aiming, movingCrosshair: boolean; 
+    crosshairCommand: ShortString;
+    targetAngle: LongInt;
+    stopFiring: boolean;
+
+    //moving
+    stopLeft, stopRight, walkingLeft, walkingRight :  boolean;
+
+
+procedure onTouchDown(x,y: Longword; pointerId: SDL_FingerId);
+var 
+    finger: PTouch_Finger;
+begin
+    finger := addFinger(x,y,pointerId);
+    case pointerCount of
+        1:
+        begin
+            moveCursor:= false;
+            if bShowAmmoMenu then
+            begin
+                moveCursor := true;
+                exit;
+            end;
+
+            if isOnCrosshair(finger^) then
+            begin
+                aiming:= true;
+                exit;
+            end;
+
+            if isOnFireButton(finger^) then
+            begin
+                stopFiring:= false;
+                ParseCommand('+attack', true);
+                exit;
+            end;
+            if (finger^.x < leftButtonBoundary) and (finger^.y < 390) then
+            begin
+                ParseCommand('+left', true);
+                walkingLeft := true;
+                exit;
+            end;
+            if finger^.x > rightButtonBoundary then
+            begin
+                ParseCommand('+right', true);
+                walkingRight:= true;
+                exit;
+            end;
+            if finger^.y < topButtonBoundary then
+            begin
+                ParseCommand('hjump', true);
+                exit;
+            end;
+            moveCursor:= true; 
+        end;
+        2:
+        begin
+            aiming:= false;
+            stopFiring:= true;
+            moveCursor:= false;
+            pinchSize := calculateDelta(finger^, getSecondFinger(finger^)^);
+            baseZoomValue := ZoomValue
+        end;
+    end;//end case pointerCount of
+end;
+
+procedure onTouchMotion(x,y: Longword;dx,dy: LongInt; pointerId: SDL_FingerId);
+var
+    finger, secondFinger: PTouch_Finger;
+    currentPinchDelta, zoom : hwFloat;
+    tmpX, tmpY: LongInt;
+begin
+    x := x;
+    y := y;
+    dx := dx;
+    dy := dy;
+    finger:= findFinger(pointerId);
+    tmpX := convertToCursor(cScreenWidth, x);
+    tmpY := convertToCursor(cScreenHeight, y);
+
+    if moveCursor then
+    begin
+        if invertCursor then
+        begin
+            CursorPoint.X := CursorPoint.X + (finger^.x - tmpX);
+            CursorPoint.Y := CursorPoint.Y - (finger^.y - tmpY);
+        end
+        else
+        begin
+            CursorPoint.X := CursorPoint.X - (finger^.x - tmpX);
+            CursorPoint.Y := CursorPoint.Y + (finger^.y - tmpY);
+        end;
+        finger^.x := tmpX;
+        finger^.y := tmpY;
+        exit //todo change into switch rather than ugly ifs
+    end;
+    
+    finger^.x := tmpX;
+    finger^.y := tmpY;
+    
+    if aiming then 
+    begin
+        aim(finger^);
+        exit
+    end;
+    if pointerCount = 2 then
+    begin
+       secondFinger := getSecondFinger(finger^);
+       currentPinchDelta := calculateDelta(finger^, secondFinger^) - pinchSize;
+       zoom := currentPinchDelta/cScreenWidth;
+       ZoomValue := baseZoomValue - ((hwFloat2Float(zoom) * cMinMaxZoomLevelDelta));
+       if ZoomValue < cMaxZoomLevel then ZoomValue := cMaxZoomLevel;
+       if ZoomValue > cMinZoomLevel then ZoomValue := cMinZoomLevel;
+    end;
+end;
+
+procedure onTouchUp(x,y: Longword; pointerId: SDL_FingerId);
+begin
+    x := x;
+    y := y;
+    aiming:= false;
+    stopFiring:= true;
+    deleteFinger(pointerId);
+
+    if walkingLeft then
+    begin
+        ParseCommand('-left', true);
+        walkingLeft := false;
+    end;
+
+    if walkingRight then
+    begin
+        ParseCommand('-right', true);
+        walkingRight := false;
+    end;
+end;
+
+procedure onTouchDoubleClick(finger: Touch_Finger);
+begin
+    finger := finger;//avoid compiler hint
+    ParseCommand('ljump', true);
+end;
+
+procedure onTouchClick(finger: Touch_Finger);
+begin
+    if (SDL_GetTicks - timeSinceClick < 300) and (DistanceI(finger.X-xTouchClick, finger.Y-yTouchClick) < _30) then
+    begin
+    onTouchDoubleClick(finger);
+    exit; 
+    end
+    else
+    begin
+        xTouchClick := finger.x;
+        yTouchClick := finger.y;
+        timeSinceClick := SDL_GetTicks;
+    end;
+
+    if bShowAmmoMenu then 
+    begin
+        doPut(CursorPoint.X, CursorPoint.Y, false); 
+        exit
+    end;
+
+    if isOnCurrentHog(finger) then
+    begin
+        bShowAmmoMenu := true;
+        exit;
+    end;
+
+    if finger.y < topButtonBoundary then
+    begin
+        ParseCommand('hjump', true);
+        exit;
+    end;
+end;
+
+function addFinger(x,y: Longword; id: SDL_FingerId): PTouch_Finger;
+var 
+    xCursor, yCursor, index : LongInt;
+begin
+    //Check array sizes
+    if length(fingers) < Integer(pointerCount) then 
+    begin
+        setLength(fingers, length(fingers)*2);
+        for index := length(fingers) div 2 to length(fingers) do fingers[index].id := nilFingerId;
+    end;
+    
+    
+    xCursor := convertToCursor(cScreenWidth, x);
+    yCursor := convertToCursor(cScreenHeight, y);
+    
+    //on removing fingers, all fingers are moved to the left
+    //with dynamic arrays being zero based, the new position of the finger is the old pointerCount
+    fingers[pointerCount].id := id;
+    fingers[pointerCount].historicalX := xCursor;
+    fingers[pointerCount].historicalY := yCursor;
+    fingers[pointerCount].x := xCursor;
+    fingers[pointerCount].y := yCursor;
+    fingers[pointerCount].timeSinceDown:= SDL_GetTicks;
+ 
+    addFinger:= @fingers[pointerCount];
+    inc(pointerCount);
+end;
+
+procedure deleteFinger(id: SDL_FingerId);
+var
+    index : Longword;
+begin
+    
+    dec(pointerCount);
+    for index := 0 to pointerCount do
+    begin
+         if fingers[index].id = id then
+         begin
+             //Check for onTouchClick event
+             if ((SDL_GetTicks - fingers[index].timeSinceDown) < clickTime) AND  
+                 not(fingerHasMoved(fingers[index])) then onTouchClick(fingers[index]);
+
+             //put the last finger into the spot of the finger to be removed, 
+             //so that all fingers are packed to the far left
+             if  pointerCount <> index then
+             begin
+                fingers[index].id := fingers[pointerCount].id;    
+                fingers[index].x := fingers[pointerCount].x;    
+                fingers[index].y := fingers[pointerCount].y;    
+                fingers[index].historicalX := fingers[pointerCount].historicalX;    
+                fingers[index].historicalY := fingers[pointerCount].historicalY;    
+                fingers[index].timeSinceDown := fingers[pointerCount].timeSinceDown;
+
+                fingers[pointerCount].id := nilFingerId;
+             end
+             else fingers[index].id := nilFingerId;
+             break;
+         end;
+    end;
+
+end;
+
+procedure ProcessTouch;
+var
+    deltaAngle: LongInt;
+begin
+    invertCursor := not(bShowAmmoMenu);
+    if aiming then
+    begin
+        if CurrentHedgehog^.Gear <> nil then
+        begin
+            deltaAngle:= CurrentHedgehog^.Gear^.Angle - targetAngle;
+            if (deltaAngle <> 0) and not(movingCrosshair) then 
+            begin
+                ParseCommand('+' + crosshairCommand, true);
+                movingCrosshair := true;
+            end
+            else 
+                if movingCrosshair then 
+                begin
+                    ParseCommand('-' + crosshairCommand, true);
+                    movingCrosshair:= false;
+                end;
+        end;
+    end
+    else if movingCrosshair then 
+    begin
+        ParseCommand('-' + crosshairCommand, true);
+        movingCrosshair := false;
+    end;
+
+    if stopFiring then 
+    begin
+        ParseCommand('-attack', true);
+        stopFiring:= false;
+    end;
+    
+    if stopRight then
+    begin
+        stopRight := false;
+        ParseCommand('-right', true);
+    end;
+ 
+    if stopLeft then
+    begin
+        stopLeft := false;
+        ParseCommand('-left', true);
+    end;
+    
+end;
+
+function findFinger(id: SDL_FingerId): PTouch_Finger;
+var
+    index: LongWord;
+begin
+   for index := 0 to High(fingers) do
+       if fingers[index].id = id then 
+       begin
+           findFinger := @fingers[index];
+           break;
+       end;
+end;
+
+procedure aim(finger: Touch_Finger);
+var 
+    hogX, hogY, touchX, touchY, deltaX, deltaY, tmpAngle: hwFloat;
+    tmp: ShortString;
+begin
+    if CurrentHedgehog^.Gear <> nil then
+    begin
+        touchX := _0;//avoid compiler hint
+        touchY := _0;
+        hogX := CurrentHedgehog^.Gear^.X;
+        hogY := CurrentHedgehog^.Gear^.Y;
+
+        convertToWorldCoord(touchX, touchY, finger);
+        deltaX := hwAbs(TouchX-HogX);
+        deltaY := (TouchY-HogY);
+        
+        tmpAngle:= DeltaY / Distance(deltaX, deltaY) *_2048;
+        targetAngle:= (hwRound(tmpAngle) + 2048) div 2;
+
+        tmp := crosshairCommand;
+        if CurrentHedgehog^.Gear^.Angle - targetAngle < 0 then crosshairCommand := 'down'
+        else crosshairCommand:= 'up';
+        if movingCrosshair and (tmp <> crosshairCommand) then 
+        begin
+            ParseCommand('-' + tmp, true);
+            movingCrosshair := false;
+        end;
+
+    end; //if CurrentHedgehog^.Gear <> nil
+end;
+
+function convertToCursor(scale: LongInt; xy: LongInt): LongInt;
+begin
+    convertToCursor := round(xy/32768*scale)
+end;
+
+function isOnFireButton(finger: Touch_Finger): boolean;
+begin
+    isOnFireButton:= (finger.x <= fireButtonRight) and (finger.x >= fireButtonLeft) and (finger.y <= fireButtonBottom) and (finger.y >= fireButtonTop);
+end;
+
+function isOnCrosshair(finger: Touch_Finger): boolean;
+var
+    x,y : hwFloat;
+begin
+    x := _0;//avoid compiler hint
+    y := _0;
+    convertToFingerCoord(x, y, int2hwFloat(CrosshairX), int2hwFloat(CrosshairY));
+    isOnCrosshair:= Distance(int2hwFloat(finger.x)-x, int2hwFloat(finger.y)-y) < _50;
+end;
+
+function isOnCurrentHog(finger: Touch_Finger): boolean;
+var
+    x,y : hwFloat;
+begin
+    x := _0;
+    y := _0;
+    convertToFingerCoord(x, y, CurrentHedgehog^.Gear^.X, CurrentHedgehog^.Gear^.Y);
+    isOnCurrentHog := Distance(int2hwFloat(finger.X)-x, int2hwFloat(finger.Y)-y) < _50;
+end;
+
+procedure convertToFingerCoord(var x,y : hwFloat; oldX, oldY: hwFloat);
+begin
+    x := oldX + int2hwFloat(WorldDx + (cScreenWidth div 2));
+    y := oldY + int2hwFloat(WorldDy);
+end;
+
+procedure convertToWorldCoord(var x,y: hwFloat; finger: Touch_Finger);
+begin
+//if x <> nil then 
+    x := int2hwFloat((finger.x-WorldDx) - (cScreenWidth div 2));
+//if y <> nil then 
+    y := int2hwFloat(finger.y-WorldDy);
+end;
+
+//Method to calculate the distance this finger has moved since the downEvent
+function fingerHasMoved(finger: Touch_Finger): boolean;
+begin
+    fingerHasMoved := trunc(sqrt(Power(finger.X-finger.historicalX,2) + Power(finger.y-finger.historicalY, 2))) > 330;
+end;
+
+function calculateDelta(finger1, finger2: Touch_Finger): hwFloat; inline;
+begin
+    calculateDelta := DistanceI(finger2.x-finger1.x, finger2.y-finger1.y);
+end;
+
+// Under the premise that all pointer ids in pointerIds:SDL_FingerId are packed to the far left.
+// If the pointer to be ignored is not pointerIds[0] the second must be there
+function getSecondFinger(finger: Touch_Finger): PTouch_Finger;
+begin
+    if fingers[0].id = finger.id then getSecondFinger := @fingers[1]
+    else getSecondFinger := @fingers[0];
+end;
+
+procedure printFinger(finger: Touch_Finger);
+begin
+    WriteToConsole(Format('id:%d, (%d,%d), (%d,%d), time: %d', [finger.id, finger.x, finger.y, finger.historicalX, finger.historicalY, finger.timeSinceDown]));
+end;
+
+procedure initModule;
+var
+    index: Longword;
+    //uRenderCoordScaleX, uRenderCoordScaleY: Longword;
+begin
+    movingCrosshair := false;
+    stopFiring:= false;
+    walkingLeft := false;
+    walkingRight := false;
+
+    leftButtonBoundary := cScreenWidth div 4;
+    rightButtonBoundary := cScreenWidth div 4*3;
+    topButtonBoundary := cScreenHeight div 6;
+    
+    setLength(fingers, 4);
+    for index := 0 to High(fingers) do 
+        fingers[index].id := nilFingerId;
+
+
+    //uRenderCoordScaleX := Round(cScreenWidth/0.8 * 2);
+    fireButtonLeft := Round(cScreenWidth*0.01);
+    fireButtonRight := Round(fireButtonLeft + (spritesData[sprFireButton].Width*0.4));
+    fireButtonBottom := Round(cScreenHeight*0.99);
+    fireButtonTop := fireButtonBottom - Round(spritesData[sprFireButton].Height*0.4);
+end;
+
+begin
+end.
--- a/hedgewars/uTypes.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uTypes.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -44,7 +44,7 @@
     // Different files are stored in different folders, this enumeration is used to tell which folder to use
     TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps,
             ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts,
-            ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, ptSuddenDeath);
+            ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, ptSuddenDeath, ptButtons);
 
     // Available sprites for displaying stuff
     TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
@@ -82,7 +82,8 @@
             sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
             sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
             sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
-            sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis
+            sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
+            sprFireButton
             );
 
     // Gears that interact with other Gears and/or Land
@@ -152,7 +153,7 @@
     // Different kind of crates that e.g. hedgehogs can pick up
     TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
 
-    THWFont = (fnt16, fntBig, fntSmall {$IFNDEF IPHONEOS}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF});
+    THWFont = (fnt16, fntBig, fntSmall {$IFNDEF MOBILE}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF});
 
     TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume,
             capgrpMessage, capgrpMessage2, capgrpAmmostate);
@@ -255,7 +256,7 @@
             PortalCounter: LongWord;  // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
             LastDamage: PHedgehog;
         end;
-    TPGearArray = Array of PGear;
+    TPGearArray = array of PGear;
 
     PVisualGear = ^TVisualGear;
     TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword);
@@ -323,7 +324,7 @@
     THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
 
     THedgehog = record
-            Name: string[MAXNAMELEN];
+            Name: string[192];
             Gear: PGear;
             GearHidden: PGear;
             SpeechGear: PVisualGear;
@@ -344,12 +345,12 @@
             King: boolean;  // Flag for a bunch of hedgehog attributes
             Unplaced: boolean;  // Flag for hog placing mode
             Timer: Longword;
-            Effects: Array[THogEffect] of boolean;
+            Effects: array[THogEffect] of boolean;
             end;
 
     TTeam = record
             Clan: PClan;
-            TeamName: string[MAXNAMELEN];
+            TeamName: string[192];
             ExtDriven: boolean;
             Binds: TBinds;
             Hedgehogs: array[0..cMaxHHIndex] of THedgehog;
--- a/hedgewars/uUtils.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uUtils.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -262,7 +262,7 @@
 begin
 s:= s;
 {$IFDEF DEBUGFILE}
-writeln(f, GameTicks: 6, ': ', s);
+writeln(f, GameTicks, ': ', s);
 flush(f)
 {$ENDIF}
 end;
@@ -274,7 +274,7 @@
     tmpstr: array[0..256] of WideChar;
 begin
 
-{$IFNDEF IPHONEOS}
+{$IFNDEF MOBILE}
 // remove chinese fonts for now
 if (font >= CJKfnt16) or (length(s) = 0) then
 {$ENDIF}
@@ -333,12 +333,13 @@
 end;
 
 procedure initModule;
-{$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF}
+{$IFDEF DEBUGFILE}{$IFNDEF MOBILE}var i: LongInt;{$ENDIF}{$ENDIF}
 begin
 {$IFDEF DEBUGFILE}
 {$I-}
-{$IFDEF IPHONEOS}
-    Assign(f,'../Documents/hw-' + cLogfileBase + '.log');
+{$IFDEF MOBILE}
+    {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + cLogfileBase + '.log'); {$ENDIF}
+    {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + cLogfileBase + '.log'); {$ENDIF}
     Rewrite(f);
 {$ELSE}
     if (UserPathPrefix <> '') then
--- a/hedgewars/uVariables.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uVariables.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -16,7 +16,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  *)
 
-{$INCLUDE options.inc}
+{$INCLUDE "options.inc"}
 
 unit uVariables;
 interface
@@ -137,6 +137,8 @@
     bWaterRising    : boolean;
 
     //ShowCrosshair   : boolean;  This variable is inconvenient to set.  Easier to decide when rendering
+    CrosshairX      : LongInt;
+    CrosshairY      : LongInt;
     CursorMovementX : LongInt;
     CursorMovementY : LongInt;
     cDrownSpeed     : hwFloat;
@@ -214,7 +216,8 @@
         'Graphics/Hats',                 // ptHats
         'Graphics/Flags',                // ptFlags
         'Missions/Maps',                 // ptMissionMaps
-        'Graphics/SuddenDeath'           // ptSuddenDeath
+        'Graphics/SuddenDeath',           // ptSuddenDeath
+        'Graphics/Buttons'                // ptButton
     );
 
     cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13);
@@ -244,7 +247,7 @@
             Height: 10;
             style: TTF_STYLE_NORMAL;
             Name: 'DejaVuSans-Bold.ttf')
-            {$IFNDEF IPHONEOS}, // remove chinese fonts for now
+            {$IFNDEF MOBILE}, // remove chinese fonts for now
             (Handle: nil;
             Height: 12;
             style: TTF_STYLE_NORMAL;
@@ -261,7 +264,7 @@
             );
 
     SpritesData: array[TSprite] of record
-            FileName: String[16];
+            FileName: string[16];
             Path, AltPath: TPathType;
             Texture: PTexture;
             Surface: PSDL_Surface;
@@ -622,7 +625,9 @@
             (FileName:  'SDDroplet'; Path: ptCurrTheme; AltPath: ptSuddenDeath; Texture: nil; Surface: nil;
             Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSDDroplet
             (FileName:  'TARDIS'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 79; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true)// sprTardis
+            Width:  0; Height: 0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: true; getImageDimensions: true),// sprTardis
+            (FileName: 'firebutton'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width: 450; Height: 150; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true) // sprFireButton
             );
 
 
@@ -630,7 +635,7 @@
             Sprite: TSprite;
             FramesCount: Longword;
             Interval: Longword;
-            cmd: String[20];
+            cmd: string[20];
             Voice: TSound;
             VoiceDelay: LongWord;
             end = (
@@ -644,7 +649,7 @@
             );
 
     Soundz: array[TSound] of record
-            FileName: String[25];
+            FileName: string[25];
             Path    : TPathType;
             end = (
             (FileName:                         ''; Path: ptNone  ),// sndNone
@@ -759,8 +764,8 @@
             (FileName:            'parachute.ogg'; Path: ptSounds),// sndParachute
             (FileName:                 'bump.ogg'; Path: ptSounds),// sndBump
             (FileName:            'hogchant3.ogg'; Path: ptSounds),// sndResurrector
-            (FileName:                'plane.ogg'; Path: ptSounds), // sndPlane
-            (FileName:                'TARDIS.ogg'; Path: ptSounds) // sndTardis
+            (FileName:                'plane.ogg'; Path: ptSounds),// sndPlane
+            (FileName:               'TARDIS.ogg'; Path: ptSounds) // sndTardis
             );
 
     Ammoz: array [TAmmoType] of record
--- a/hedgewars/uVisualGears.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uVisualGears.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -120,11 +120,11 @@
 begin
 AddVisualGear:= nil;
 if ((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet))) and // we are scrolling now
-   ((Kind <> vgtCloud) and not Critical) then exit;
+   ((Kind <> vgtCloud) and (not Critical)) then exit;
 
 if ((cReducedQuality and rqAntiBoom) <> 0) and
-   not Critical and
-   not (Kind in
+   (not Critical) and
+   (not (Kind in
    [vgtTeamHealthSorter,
     vgtSmallDamageTag,
     vgtSpeechBubble,
@@ -133,7 +133,7 @@
     vgtSmokeTrace,
     vgtEvilTrace,
     vgtNote,
-    vgtSmoothWindBar]) then exit;
+    vgtSmoothWindBar])) then exit;
 
 inc(VGCounter);
 New(gear);
--- a/hedgewars/uWorld.pas	Sat Nov 19 23:34:09 2011 +0100
+++ b/hedgewars/uWorld.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -82,29 +82,30 @@
       cStereo_Water_near    = 0.0025;
       cStereo_Outside       = -0.0400;
 
+
+// helper functions to create the goal/game mode string
+function AddGoal(s: ansistring; gf: longword; si: TGoalStrId; i: LongInt): ansistring;
+var t: ansistring;
+begin
+    if (GameFlags and gf) <> 0 then
+        begin
+        t:= inttostr(i);
+        s:= s + format(trgoal[si], t) + '|'
+        end;
+    AddGoal:= s;
+end;
+
+function AddGoal(s: ansistring; gf: longword; si: TGoalStrId): ansistring;
+begin
+    if (GameFlags and gf) <> 0 then
+        s:= s + trgoal[si] + '|';
+    AddGoal:= s;
+end;
+
 procedure InitWorld;
 var i, t: LongInt;
     cp: PClan;
     g: ansistring;
-
-    // helper functions to create the goal/game mode string
-    function AddGoal(s: ansistring; gf: longword; si: TGoalStrId; i: LongInt): ansistring;
-    var t: ansistring;
-    begin
-        if (GameFlags and gf) <> 0 then
-            begin
-            t:= inttostr(i);
-            s:= s + format(trgoal[si], t) + '|'
-            end;
-        AddGoal:= s;
-    end;
-
-    function AddGoal(s: ansistring; gf: longword; si: TGoalStrId): ansistring;
-    begin
-        if (GameFlags and gf) <> 0 then
-            s:= s + trgoal[si] + '|';
-        AddGoal:= s;
-    end;
 begin
 missionTimer:= 0;
 
@@ -922,7 +923,7 @@
 SetScale(cDefaultZoomLevel);
 
 // Turn time
-{$IFDEF IPHONEOS}
+{$IFDEF MOBILE}
 offsetX:= cScreenHeight - 13;
 {$ELSE}
 offsetX:= 48;
@@ -951,6 +952,10 @@
 // Captions
 DrawCaptions;
 
+{$IFDEF ANDROID}
+// Draw buttons Related to the Touch interface
+DrawTexture(Round(-cScreenWidth*0.5 + cScreenHeight*0.02),Round((cScreenHeight*0.98)-(spritesData[sprFireButton].Height*0.4) ),spritesData[sprFireButton].Texture, 0.4);
+{$ENDIF}
 // Teams Healths
 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
     begin
@@ -1024,7 +1029,7 @@
 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
 
 // Wind bar
-{$IFDEF IPHONEOS}
+{$IFDEF MOBILE}
     offsetX:= cScreenHeight - 13;
     offsetY:= (cScreenWidth shr 1) + 74;
 {$ELSE}
@@ -1076,7 +1081,7 @@
     end;
 
 // fps
-{$IFDEF IPHONEOS}
+{$IFDEF MOBILE}
 offsetX:= 8;
 {$ELSE}
 offsetX:= 10;
@@ -1215,12 +1220,12 @@
 var EdgesDist, wdy, shs,z: LongInt;
     PrevSentPointTime: LongWord = 0;
 begin
-{$IFNDEF IPHONEOS}
-if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus and (GameState <> gsConfirm) then
+{$IFNDEF MOBILE}
+if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu))) and cHasFocus and (GameState <> gsConfirm) then
     uCursor.updatePosition();
 {$ENDIF}
 z:= round(200/zoom);
-if not PlacingHogs and (FollowGear <> nil) and not isCursorVisible and not bShowAmmoMenu and not fastUntilLag then
+if not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) then
     if (not autoCameraOn) or ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then
         begin
         FollowGear:= nil;
@@ -1243,7 +1248,7 @@
 
 if AMxShift < AMWidth then
 begin
-{$IFDEF IPHONEOS}
+{$IFDEF MOBILE}
     if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth;
     if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset;
     if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/Android.mk	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,6 @@
+MISC_DIR   := $(call my-dir)
+LOCAL_PATH := MISC_DIR
+
+include $(MISC_DIR)/libfreetype/Android.mk
+include $(MISC_DIR)/liblua/Android.mk
+include $(MISC_DIR)/libtremor/Android.mk
--- a/misc/hats_js_anim.xhtml	Sat Nov 19 23:34:09 2011 +0100
+++ b/misc/hats_js_anim.xhtml	Mon Dec 05 18:38:07 2011 -0500
@@ -10,7 +10,7 @@
 {
     background: url('http://hedgewars.googlecode.com/hg/share/hedgewars/Data/Themes/Nature/Sky.png') fixed no-repeat bottom left;
     -moz-background-size: 200%;
-    background-size: 200%;
+    background-size: 100% 100%;
     font-family: sans-serif;
 }
 h1 { text-shadow: 0 0 2px white; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libfreetype/Android.mk	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# compile in ARM mode, since the glyph loader/renderer is a hotspot
+# when loading complex pages in the browser
+#
+LOCAL_ARM_MODE := arm
+
+LOCAL_SRC_FILES:= \
+	src/base/ftbbox.c \
+	src/base/ftbitmap.c \
+	src/base/ftglyph.c \
+	src/base/ftstroke.c \
+	src/base/ftxf86.c \
+	src/base/ftbase.c \
+	src/base/ftsystem.c \
+	src/base/ftinit.c \
+	src/base/ftgasp.c \
+	src/raster/raster.c \
+	src/sfnt/sfnt.c \
+	src/smooth/smooth.c \
+	src/autofit/autofit.c \
+	src/truetype/truetype.c \
+	src/cff/cff.c \
+	src/psnames/psnames.c \
+	src/pshinter/pshinter.c
+
+LOCAL_C_INCLUDES += \
+	$(LOCAL_PATH)/builds \
+	$(LOCAL_PATH)/include
+
+LOCAL_CFLAGS += -W -Wall
+LOCAL_CFLAGS += -fPIC -DPIC
+LOCAL_CFLAGS += "-DDARWIN_NO_CARBON"
+LOCAL_CFLAGS += "-DFT2_BUILD_LIBRARY"
+
+# the following is for testing only, and should not be used in final builds
+# of the product
+#LOCAL_CFLAGS += "-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER"
+
+LOCAL_CFLAGS += -O2
+
+LOCAL_MODULE:= freetype
+
+include $(BUILD_STATIC_LIBRARY)
--- a/misc/libfreetype/include/freetype/config/ftconfig.h	Sat Nov 19 23:34:09 2011 +0100
+++ b/misc/libfreetype/include/freetype/config/ftconfig.h	Mon Dec 05 18:38:07 2011 -0500
@@ -340,6 +340,7 @@
 #define FT_MULFIX_ASSEMBLER  FT_MulFix_arm
 
   /* documentation is in freetype.h */
+  // Xeli: Got this snippet from  a 2.4.6 source
 
   static __inline__ FT_Int32
   FT_MulFix_arm( FT_Int32  a,
@@ -347,7 +348,6 @@
   {
     register FT_Int32  t, t2;
 
-<<<<<<< Updated upstream
 
     __asm__ __volatile__ (
       "smull  %1, %2, %4, %3\n\t"       /* (lo=%1,hi=%2) = a*b */
@@ -357,17 +357,6 @@
       "adc    %2, %2, #0\n\t"           /* %2 += carry */
       "mov    %0, %1, lsr #16\n\t"      /* %0  = %1 >> 16 */
       "orr    %0, %0, %2, lsl #16\n\t"  /* %0 |= %2 << 16 */
-=======
-#warning Should this be __asm__ ?
-    asm __volatile__ (
-      "smull  %1, %2, %4, %3\n\t"   /* (lo=%1,hi=%2) = a*b */
-      "mov    %0, %2, asr #31\n\t"  /* %0  = (hi >> 31) */
-      "add    %0, %0, #0x8000\n\t"  /* %0 += 0x8000 */
-      "adds   %1, %1, %0\n\t"       /* %1 += %0 */
-      "adc    %2, %2, #0\n\t"       /* %2 += carry */
-      "mov    %0, %1, lsr #16\n\t"  /* %0  = %1 >> 16 */
-      "orr    %0, %2, lsl #16\n\t"  /* %0 |= %2 << 16 */
->>>>>>> Stashed changes
       : "=r"(a), "=&r"(t2), "=&r"(t)
       : "r"(a), "r"(b) );
     return a;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/liblua/Android.mk	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,13 @@
+LOCAL_PATH      := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := lua5.1
+
+LOCAL_CFLAGS    := -DANDROID
+
+LOCAL_SRC_FILES := lapi.c lauxlib.c lbaselib.c lcode.c ldblib.c ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lundump.c lvm.c lzio.c
+
+include $(BUILD_SHARED_LIBRARY)
+
+
--- a/misc/liblua/llex.c	Sat Nov 19 23:34:09 2011 +0100
+++ b/misc/liblua/llex.c	Mon Dec 05 18:38:07 2011 -0500
@@ -176,9 +176,15 @@
 
 static void trydecpoint (LexState *ls, SemInfo *seminfo) {
   /* format error: try to update decimal point separator */
+#ifndef ANDROID
   struct lconv *cv = localeconv();
+#endif
   char old = ls->decpoint;
+#ifdef ANDROID
+  ls->decpoint = '.';
+#else
   ls->decpoint = (cv ? cv->decimal_point[0] : '.');
+#endif
   buffreplace(ls, old, ls->decpoint);  /* try updated decimal separator */
   if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
     /* format error with correct decimal point: no more options */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/Android.mk	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,27 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := tremor
+
+LOCAL_CFLAGS := -I$(LOCAL_PATH) -DHAVE_ALLOCA_H
+
+LOCAL_SRC_FILES =    \
+        tremor/bitwise.c    \
+        tremor/block.c      \
+        tremor/codebook.c   \
+        tremor/floor0.c     \
+        tremor/floor1.c     \
+        tremor/framing.c    \
+        tremor/info.c       \
+        tremor/mapping0.c   \
+        tremor/mdct.c       \
+        tremor/registry.c   \
+        tremor/res012.c     \
+        tremor/sharedbook.c \
+        tremor/synthesis.c  \
+        tremor/vorbisfile.c \
+        tremor/window.c     
+
+include $(BUILD_STATIC_LIBRARY)
+
--- a/misc/libtremor/CHANGELOG	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-*** 20020517: 1.0.2 ***
-
-  Playback bugfix to floor1; mode mistakenly used for sizing instead
-  of blockflag
-
-*** 20020515: 1.0.1 ***
-
-  Added complete API documentation to source tarball.  No code
-  changes.
-
-*** 20020412: 1.0.1 ***
-
-  Fixed a clipping bug that affected ARM processors; negative
-  overflows were being properly clipped, but then clobbered to
-  positive by the positive overflow chec (asm_arm.h:CLIP_TO_15)
-
-*** 20020403: 1.0.0 ***
-
-  Initial version
\ No newline at end of file
--- a/misc/libtremor/COPYING	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-Copyright (c) 2002, Xiph.org Foundation
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-- Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-- Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-- Neither the name of the Xiph.org Foundation nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- a/misc/libtremor/Makefile.am	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-AUTOMAKE_OPTIONS = foreign
-
-INCLUDES = -I./
-
-lib_LTLIBRARIES = libvorbisidec.la
-
-libvorbisidec_la_SOURCES = mdct.c block.c window.c \
-                        synthesis.c info.c \
-                        floor1.c floor0.c vorbisfile.c \
-                        res012.c mapping0.c registry.c codebook.c \
-			sharedbook.c framing.c bitwise.c \
-                        codebook.h misc.h mdct_lookup.h\
-                        os.h mdct.h block.h ivorbisfile.h lsp_lookup.h\
-                        registry.h window.h window_lookup.h\
-                        codec_internal.h backends.h ogg.h \
-			asm_arm.h ivorbiscodec.h
-libvorbisidec_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
-
-EXTRA_PROGRAMS = ivorbisfile_example
-CLEANFILES = $(EXTRA_PROGRAMS) $(lib_LTLIBRARIES)
-
-ivorbisfile_example_SOURCES = ivorbisfile_example.c
-ivorbisfile_example_LDFLAGS = -static 
-ivorbisfile_example_LDADD = libvorbisidec.la
-
-includedir = $(prefix)/include/tremor
-
-include_HEADERS = ivorbiscodec.h ivorbisfile.h ogg.h os_types.h config_types.h
-
-example:
-	-ln -fs . vorbis
-	$(MAKE) ivorbisfile_example
-
-debug:
-	$(MAKE) all CFLAGS="@DEBUG@" 
-
-profile:
-	$(MAKE) all CFLAGS="@PROFILE@"
--- a/misc/libtremor/README	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-This README covers the Ogg Vorbis 'Tremor' integer playback codec
-source as of date 2002 09 02, version 1.0.0.
-
-                            ******
-
-The C source in this package will build on any ANSI C compiler and
-function completely and properly on any platform.  The included build
-system assumes GNU build system and make tools (m4, automake,
-autoconf, libtool and gmake).  GCC is not required, although GCC is
-the most tested compiler.  To build using GNU tools, type in the
-source directory:
-
-./autogen.sh
-make
-
-Currently, the source implements playback in pure C on all platforms
-except ARM, where a [currently] small amount of assembly (see
-asm_arm.h) is used to implement 64 bit math operations and fast LSP
-computation.  If building on ARM without the benefit of GNU build
-system tools, be sure that '_ARM_ASSEM_' is #defined by the build
-system if this assembly is desired, else the resulting library will
-use whatever 64 bit math builtins the compiler implements.
-
-No math library is required by this source.  No floating point
-operations are used at any point in either setup or decode.  This
-decoder library will properly decode any past, current or future
-Vorbis I file or stream.
-
-                           ********
-
-The build system produces a static and [when supported by the OS]
-dynamic library named 'libvorbisidec'.  This library exposes an API
-nearly identical to the BSD reference library's 'libvorbisfile',
-including all the features familiar to users of vorbisfile.  This API
-is similar enough that the proper header file to include is named
-'ivorbisfile.h' [included in the source build directory].  Lower level
-libvorbis-style headers and structures are in 'ivorbiscodec.h'
-[included in the source build directory]. A simple example program,
-ivorbisfile_example.c, can be built with 'make example'.
-
-                           ********
-
-Detailed Tremor API Documentation begins at doc/index.html
-
-Monty
-xiph.org
--- a/misc/libtremor/Version_script.in	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#
-# Export file for libvorbisidec
-#
-# Only the symbols listed in the global section will be callable from
-# applications linking to libvorbisidec.
-#
-
-@PACKAGE@.so.1
-{
-	global:
-		ov_clear;
-		ov_open;
-		ov_open_callbacks;
-		ov_test;
-		ov_test_callbacks;
-		ov_test_open;
-		ov_bitrate;
-		ov_bitrate_instant;
-		ov_streams;
-		ov_seekable;
-		ov_serialnumber;
-		ov_raw_total;
-		ov_pcm_total;
-		ov_time_total;
-		ov_raw_seek;
-		ov_pcm_seek;
-		ov_pcm_seek_page;
-		ov_time_seek;
-		ov_time_seek_page;
-		ov_raw_tell;
-		ov_pcm_tell;
-		ov_time_tell;
-		ov_info;
-		ov_comment;
-		ov_read;
-
-		vorbis_info_init;
-		vorbis_info_clear;
-		vorbis_info_blocksize;
-		vorbis_comment_init;
-		vorbis_comment_add;
-		vorbis_comment_add_tag;
-		vorbis_comment_query;
-		vorbis_comment_query_count;
-		vorbis_comment_clear;
-
-	local:
-		*;
-};
--- a/misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj	Sat Nov 19 23:34:09 2011 +0100
+++ b/misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj	Mon Dec 05 18:38:07 2011 -0500
@@ -7,77 +7,77 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		61958DC31364B72000B429B6 /* asm_arm.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DA61364B72000B429B6 /* asm_arm.h */; };
-		61958DC41364B72000B429B6 /* backends.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DA71364B72000B429B6 /* backends.h */; };
-		61958DC51364B72000B429B6 /* block.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DA81364B72000B429B6 /* block.c */; };
-		61958DC61364B72000B429B6 /* block.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DA91364B72000B429B6 /* block.h */; };
-		61958DC71364B72000B429B6 /* codebook.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DAA1364B72000B429B6 /* codebook.c */; };
-		61958DC81364B72000B429B6 /* codebook.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DAB1364B72000B429B6 /* codebook.h */; };
-		61958DC91364B72000B429B6 /* codec_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DAC1364B72000B429B6 /* codec_internal.h */; };
-		61958DCA1364B72000B429B6 /* config_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DAD1364B72000B429B6 /* config_types.h */; };
-		61958DCB1364B72000B429B6 /* floor0.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DAE1364B72000B429B6 /* floor0.c */; };
-		61958DCC1364B72000B429B6 /* floor1.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DAF1364B72000B429B6 /* floor1.c */; };
-		61958DCD1364B72000B429B6 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DB01364B72000B429B6 /* info.c */; };
-		61958DCE1364B72000B429B6 /* ivorbiscodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DB11364B72000B429B6 /* ivorbiscodec.h */; };
-		61958DCF1364B72000B429B6 /* ivorbisfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DB21364B72000B429B6 /* ivorbisfile.h */; };
-		61958DD01364B72000B429B6 /* lsp_lookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DB31364B72000B429B6 /* lsp_lookup.h */; };
-		61958DD11364B72000B429B6 /* mapping0.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DB41364B72000B429B6 /* mapping0.c */; };
-		61958DD21364B72000B429B6 /* mdct_lookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DB51364B72000B429B6 /* mdct_lookup.h */; };
-		61958DD31364B72000B429B6 /* mdct.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DB61364B72000B429B6 /* mdct.c */; };
-		61958DD41364B72000B429B6 /* mdct.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DB71364B72000B429B6 /* mdct.h */; };
-		61958DD51364B72000B429B6 /* misc.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DB81364B72000B429B6 /* misc.h */; };
-		61958DD61364B72000B429B6 /* os.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DB91364B72000B429B6 /* os.h */; };
-		61958DD71364B72000B429B6 /* registry.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DBA1364B72000B429B6 /* registry.c */; };
-		61958DD81364B72000B429B6 /* registry.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DBB1364B72000B429B6 /* registry.h */; };
-		61958DD91364B72000B429B6 /* res012.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DBC1364B72000B429B6 /* res012.c */; };
-		61958DDA1364B72000B429B6 /* sharedbook.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DBD1364B72000B429B6 /* sharedbook.c */; };
-		61958DDB1364B72000B429B6 /* synthesis.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DBE1364B72000B429B6 /* synthesis.c */; };
-		61958DDC1364B72000B429B6 /* vorbisfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DBF1364B72000B429B6 /* vorbisfile.c */; };
-		61958DDD1364B72000B429B6 /* window_lookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DC01364B72000B429B6 /* window_lookup.h */; };
-		61958DDE1364B72000B429B6 /* window.c in Sources */ = {isa = PBXBuildFile; fileRef = 61958DC11364B72000B429B6 /* window.c */; };
-		61958DDF1364B72000B429B6 /* window.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DC21364B72000B429B6 /* window.h */; };
-		61958DFC1364B84300B429B6 /* os_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958DFB1364B84300B429B6 /* os_types.h */; };
-		61958E0E1364B89700B429B6 /* ogg.h in Headers */ = {isa = PBXBuildFile; fileRef = 61958E0D1364B89700B429B6 /* ogg.h */; };
-		619598391364BDCC00B429B6 /* framing.c in Sources */ = {isa = PBXBuildFile; fileRef = 619598381364BDCC00B429B6 /* framing.c */; };
-		619598411364BE7F00B429B6 /* bitwise.c in Sources */ = {isa = PBXBuildFile; fileRef = 619598401364BE7F00B429B6 /* bitwise.c */; };
+		61DB1809148BA9A9004A67B8 /* asm_arm.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17E7148BA9A9004A67B8 /* asm_arm.h */; };
+		61DB180A148BA9A9004A67B8 /* backends.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17E8148BA9A9004A67B8 /* backends.h */; };
+		61DB180B148BA9A9004A67B8 /* bitwise.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17E9148BA9A9004A67B8 /* bitwise.c */; };
+		61DB180C148BA9A9004A67B8 /* block.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17EA148BA9A9004A67B8 /* block.c */; };
+		61DB180D148BA9A9004A67B8 /* block.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17EB148BA9A9004A67B8 /* block.h */; };
+		61DB180E148BA9A9004A67B8 /* codebook.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17EC148BA9A9004A67B8 /* codebook.c */; };
+		61DB180F148BA9A9004A67B8 /* codebook.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17ED148BA9A9004A67B8 /* codebook.h */; };
+		61DB1810148BA9A9004A67B8 /* codec_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17EE148BA9A9004A67B8 /* codec_internal.h */; };
+		61DB1811148BA9A9004A67B8 /* config_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17EF148BA9A9004A67B8 /* config_types.h */; };
+		61DB1812148BA9A9004A67B8 /* floor0.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17F0148BA9A9004A67B8 /* floor0.c */; };
+		61DB1813148BA9A9004A67B8 /* floor1.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17F1148BA9A9004A67B8 /* floor1.c */; };
+		61DB1814148BA9A9004A67B8 /* framing.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17F2148BA9A9004A67B8 /* framing.c */; };
+		61DB1815148BA9A9004A67B8 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17F3148BA9A9004A67B8 /* info.c */; };
+		61DB1816148BA9A9004A67B8 /* ivorbiscodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17F4148BA9A9004A67B8 /* ivorbiscodec.h */; };
+		61DB1818148BA9A9004A67B8 /* ivorbisfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17F6148BA9A9004A67B8 /* ivorbisfile.h */; };
+		61DB1819148BA9A9004A67B8 /* lsp_lookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17F7148BA9A9004A67B8 /* lsp_lookup.h */; };
+		61DB181A148BA9A9004A67B8 /* mapping0.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17F8148BA9A9004A67B8 /* mapping0.c */; };
+		61DB181B148BA9A9004A67B8 /* mdct_lookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17F9148BA9A9004A67B8 /* mdct_lookup.h */; };
+		61DB181C148BA9A9004A67B8 /* mdct.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB17FA148BA9A9004A67B8 /* mdct.c */; };
+		61DB181D148BA9A9004A67B8 /* mdct.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17FB148BA9A9004A67B8 /* mdct.h */; };
+		61DB181E148BA9A9004A67B8 /* misc.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17FC148BA9A9004A67B8 /* misc.h */; };
+		61DB181F148BA9A9004A67B8 /* ogg.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17FD148BA9A9004A67B8 /* ogg.h */; };
+		61DB1820148BA9A9004A67B8 /* os_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17FE148BA9A9004A67B8 /* os_types.h */; };
+		61DB1821148BA9A9004A67B8 /* os.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB17FF148BA9A9004A67B8 /* os.h */; };
+		61DB1822148BA9A9004A67B8 /* registry.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB1800148BA9A9004A67B8 /* registry.c */; };
+		61DB1823148BA9A9004A67B8 /* registry.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB1801148BA9A9004A67B8 /* registry.h */; };
+		61DB1824148BA9A9004A67B8 /* res012.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB1802148BA9A9004A67B8 /* res012.c */; };
+		61DB1825148BA9A9004A67B8 /* sharedbook.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB1803148BA9A9004A67B8 /* sharedbook.c */; };
+		61DB1826148BA9A9004A67B8 /* synthesis.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB1804148BA9A9004A67B8 /* synthesis.c */; };
+		61DB1827148BA9A9004A67B8 /* vorbisfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB1805148BA9A9004A67B8 /* vorbisfile.c */; };
+		61DB1828148BA9A9004A67B8 /* window_lookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB1806148BA9A9004A67B8 /* window_lookup.h */; };
+		61DB1829148BA9A9004A67B8 /* window.c in Sources */ = {isa = PBXBuildFile; fileRef = 61DB1807148BA9A9004A67B8 /* window.c */; };
+		61DB182A148BA9A9004A67B8 /* window.h in Headers */ = {isa = PBXBuildFile; fileRef = 61DB1808148BA9A9004A67B8 /* window.h */; };
 		AA747D9F0F9514B9006C5449 /* Tremor_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* Tremor_Prefix.pch */; };
 		AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
-		61958DA61364B72000B429B6 /* asm_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = asm_arm.h; path = ../asm_arm.h; sourceTree = SOURCE_ROOT; };
-		61958DA71364B72000B429B6 /* backends.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = backends.h; path = ../backends.h; sourceTree = SOURCE_ROOT; };
-		61958DA81364B72000B429B6 /* block.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = block.c; path = ../block.c; sourceTree = SOURCE_ROOT; };
-		61958DA91364B72000B429B6 /* block.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = block.h; path = ../block.h; sourceTree = SOURCE_ROOT; };
-		61958DAA1364B72000B429B6 /* codebook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = codebook.c; path = ../codebook.c; sourceTree = SOURCE_ROOT; };
-		61958DAB1364B72000B429B6 /* codebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = codebook.h; path = ../codebook.h; sourceTree = SOURCE_ROOT; };
-		61958DAC1364B72000B429B6 /* codec_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = codec_internal.h; path = ../codec_internal.h; sourceTree = SOURCE_ROOT; };
-		61958DAD1364B72000B429B6 /* config_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config_types.h; path = ../config_types.h; sourceTree = SOURCE_ROOT; };
-		61958DAE1364B72000B429B6 /* floor0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = floor0.c; path = ../floor0.c; sourceTree = SOURCE_ROOT; };
-		61958DAF1364B72000B429B6 /* floor1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = floor1.c; path = ../floor1.c; sourceTree = SOURCE_ROOT; };
-		61958DB01364B72000B429B6 /* info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = info.c; path = ../info.c; sourceTree = SOURCE_ROOT; };
-		61958DB11364B72000B429B6 /* ivorbiscodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ivorbiscodec.h; path = ../ivorbiscodec.h; sourceTree = SOURCE_ROOT; };
-		61958DB21364B72000B429B6 /* ivorbisfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ivorbisfile.h; path = ../ivorbisfile.h; sourceTree = SOURCE_ROOT; };
-		61958DB31364B72000B429B6 /* lsp_lookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lsp_lookup.h; path = ../lsp_lookup.h; sourceTree = SOURCE_ROOT; };
-		61958DB41364B72000B429B6 /* mapping0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mapping0.c; path = ../mapping0.c; sourceTree = SOURCE_ROOT; };
-		61958DB51364B72000B429B6 /* mdct_lookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mdct_lookup.h; path = ../mdct_lookup.h; sourceTree = SOURCE_ROOT; };
-		61958DB61364B72000B429B6 /* mdct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mdct.c; path = ../mdct.c; sourceTree = SOURCE_ROOT; };
-		61958DB71364B72000B429B6 /* mdct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mdct.h; path = ../mdct.h; sourceTree = SOURCE_ROOT; };
-		61958DB81364B72000B429B6 /* misc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = misc.h; path = ../misc.h; sourceTree = SOURCE_ROOT; };
-		61958DB91364B72000B429B6 /* os.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = os.h; path = ../os.h; sourceTree = SOURCE_ROOT; };
-		61958DBA1364B72000B429B6 /* registry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = registry.c; path = ../registry.c; sourceTree = SOURCE_ROOT; };
-		61958DBB1364B72000B429B6 /* registry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = registry.h; path = ../registry.h; sourceTree = SOURCE_ROOT; };
-		61958DBC1364B72000B429B6 /* res012.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = res012.c; path = ../res012.c; sourceTree = SOURCE_ROOT; };
-		61958DBD1364B72000B429B6 /* sharedbook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sharedbook.c; path = ../sharedbook.c; sourceTree = SOURCE_ROOT; };
-		61958DBE1364B72000B429B6 /* synthesis.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = synthesis.c; path = ../synthesis.c; sourceTree = SOURCE_ROOT; };
-		61958DBF1364B72000B429B6 /* vorbisfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vorbisfile.c; path = ../vorbisfile.c; sourceTree = SOURCE_ROOT; };
-		61958DC01364B72000B429B6 /* window_lookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = window_lookup.h; path = ../window_lookup.h; sourceTree = SOURCE_ROOT; };
-		61958DC11364B72000B429B6 /* window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = window.c; path = ../window.c; sourceTree = SOURCE_ROOT; };
-		61958DC21364B72000B429B6 /* window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = window.h; path = ../window.h; sourceTree = SOURCE_ROOT; };
-		61958DFB1364B84300B429B6 /* os_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = os_types.h; path = ../../../../Library/cocos2d/external/Tremor/os_types.h; sourceTree = SOURCE_ROOT; };
-		61958E0D1364B89700B429B6 /* ogg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ogg.h; path = ../ogg.h; sourceTree = SOURCE_ROOT; };
-		619598381364BDCC00B429B6 /* framing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = framing.c; path = ../framing.c; sourceTree = "<group>"; };
-		619598401364BE7F00B429B6 /* bitwise.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bitwise.c; path = ../bitwise.c; sourceTree = "<group>"; };
+		61DB17E7148BA9A9004A67B8 /* asm_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = asm_arm.h; path = ../tremor/asm_arm.h; sourceTree = SOURCE_ROOT; };
+		61DB17E8148BA9A9004A67B8 /* backends.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = backends.h; path = ../tremor/backends.h; sourceTree = SOURCE_ROOT; };
+		61DB17E9148BA9A9004A67B8 /* bitwise.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bitwise.c; path = ../tremor/bitwise.c; sourceTree = SOURCE_ROOT; };
+		61DB17EA148BA9A9004A67B8 /* block.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = block.c; path = ../tremor/block.c; sourceTree = SOURCE_ROOT; };
+		61DB17EB148BA9A9004A67B8 /* block.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = block.h; path = ../tremor/block.h; sourceTree = SOURCE_ROOT; };
+		61DB17EC148BA9A9004A67B8 /* codebook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = codebook.c; path = ../tremor/codebook.c; sourceTree = SOURCE_ROOT; };
+		61DB17ED148BA9A9004A67B8 /* codebook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = codebook.h; path = ../tremor/codebook.h; sourceTree = SOURCE_ROOT; };
+		61DB17EE148BA9A9004A67B8 /* codec_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = codec_internal.h; path = ../tremor/codec_internal.h; sourceTree = SOURCE_ROOT; };
+		61DB17EF148BA9A9004A67B8 /* config_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config_types.h; path = ../tremor/config_types.h; sourceTree = SOURCE_ROOT; };
+		61DB17F0148BA9A9004A67B8 /* floor0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = floor0.c; path = ../tremor/floor0.c; sourceTree = SOURCE_ROOT; };
+		61DB17F1148BA9A9004A67B8 /* floor1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = floor1.c; path = ../tremor/floor1.c; sourceTree = SOURCE_ROOT; };
+		61DB17F2148BA9A9004A67B8 /* framing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = framing.c; path = ../tremor/framing.c; sourceTree = SOURCE_ROOT; };
+		61DB17F3148BA9A9004A67B8 /* info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = info.c; path = ../tremor/info.c; sourceTree = SOURCE_ROOT; };
+		61DB17F4148BA9A9004A67B8 /* ivorbiscodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ivorbiscodec.h; path = ../tremor/ivorbiscodec.h; sourceTree = SOURCE_ROOT; };
+		61DB17F6148BA9A9004A67B8 /* ivorbisfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ivorbisfile.h; path = ../tremor/ivorbisfile.h; sourceTree = SOURCE_ROOT; };
+		61DB17F7148BA9A9004A67B8 /* lsp_lookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lsp_lookup.h; path = ../tremor/lsp_lookup.h; sourceTree = SOURCE_ROOT; };
+		61DB17F8148BA9A9004A67B8 /* mapping0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mapping0.c; path = ../tremor/mapping0.c; sourceTree = SOURCE_ROOT; };
+		61DB17F9148BA9A9004A67B8 /* mdct_lookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mdct_lookup.h; path = ../tremor/mdct_lookup.h; sourceTree = SOURCE_ROOT; };
+		61DB17FA148BA9A9004A67B8 /* mdct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mdct.c; path = ../tremor/mdct.c; sourceTree = SOURCE_ROOT; };
+		61DB17FB148BA9A9004A67B8 /* mdct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mdct.h; path = ../tremor/mdct.h; sourceTree = SOURCE_ROOT; };
+		61DB17FC148BA9A9004A67B8 /* misc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = misc.h; path = ../tremor/misc.h; sourceTree = SOURCE_ROOT; };
+		61DB17FD148BA9A9004A67B8 /* ogg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ogg.h; path = ../tremor/ogg.h; sourceTree = SOURCE_ROOT; };
+		61DB17FE148BA9A9004A67B8 /* os_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = os_types.h; path = ../tremor/os_types.h; sourceTree = SOURCE_ROOT; };
+		61DB17FF148BA9A9004A67B8 /* os.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = os.h; path = ../tremor/os.h; sourceTree = SOURCE_ROOT; };
+		61DB1800148BA9A9004A67B8 /* registry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = registry.c; path = ../tremor/registry.c; sourceTree = SOURCE_ROOT; };
+		61DB1801148BA9A9004A67B8 /* registry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = registry.h; path = ../tremor/registry.h; sourceTree = SOURCE_ROOT; };
+		61DB1802148BA9A9004A67B8 /* res012.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = res012.c; path = ../tremor/res012.c; sourceTree = SOURCE_ROOT; };
+		61DB1803148BA9A9004A67B8 /* sharedbook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sharedbook.c; path = ../tremor/sharedbook.c; sourceTree = SOURCE_ROOT; };
+		61DB1804148BA9A9004A67B8 /* synthesis.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = synthesis.c; path = ../tremor/synthesis.c; sourceTree = SOURCE_ROOT; };
+		61DB1805148BA9A9004A67B8 /* vorbisfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vorbisfile.c; path = ../tremor/vorbisfile.c; sourceTree = SOURCE_ROOT; };
+		61DB1806148BA9A9004A67B8 /* window_lookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = window_lookup.h; path = ../tremor/window_lookup.h; sourceTree = SOURCE_ROOT; };
+		61DB1807148BA9A9004A67B8 /* window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = window.c; path = ../tremor/window.c; sourceTree = SOURCE_ROOT; };
+		61DB1808148BA9A9004A67B8 /* window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = window.h; path = ../tremor/window.h; sourceTree = SOURCE_ROOT; };
 		AA747D9E0F9514B9006C5449 /* Tremor_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tremor_Prefix.pch; sourceTree = SOURCE_ROOT; };
 		AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
 		D2AAC07E0554694100DB518D /* libTremor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTremor.a; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -125,39 +125,39 @@
 		08FB77AEFE84172EC02AAC07 /* Sources */ = {
 			isa = PBXGroup;
 			children = (
-				619598401364BE7F00B429B6 /* bitwise.c */,
-				619598381364BDCC00B429B6 /* framing.c */,
-				61958DA61364B72000B429B6 /* asm_arm.h */,
-				61958DA71364B72000B429B6 /* backends.h */,
-				61958DA81364B72000B429B6 /* block.c */,
-				61958DA91364B72000B429B6 /* block.h */,
-				61958DAA1364B72000B429B6 /* codebook.c */,
-				61958DAB1364B72000B429B6 /* codebook.h */,
-				61958DAC1364B72000B429B6 /* codec_internal.h */,
-				61958DAD1364B72000B429B6 /* config_types.h */,
-				61958DAE1364B72000B429B6 /* floor0.c */,
-				61958DAF1364B72000B429B6 /* floor1.c */,
-				61958DB01364B72000B429B6 /* info.c */,
-				61958DB11364B72000B429B6 /* ivorbiscodec.h */,
-				61958DB21364B72000B429B6 /* ivorbisfile.h */,
-				61958DB31364B72000B429B6 /* lsp_lookup.h */,
-				61958DB41364B72000B429B6 /* mapping0.c */,
-				61958DB51364B72000B429B6 /* mdct_lookup.h */,
-				61958DB61364B72000B429B6 /* mdct.c */,
-				61958DB71364B72000B429B6 /* mdct.h */,
-				61958DB81364B72000B429B6 /* misc.h */,
-				61958E0D1364B89700B429B6 /* ogg.h */,
-				61958DB91364B72000B429B6 /* os.h */,
-				61958DFB1364B84300B429B6 /* os_types.h */,
-				61958DBA1364B72000B429B6 /* registry.c */,
-				61958DBB1364B72000B429B6 /* registry.h */,
-				61958DBC1364B72000B429B6 /* res012.c */,
-				61958DBD1364B72000B429B6 /* sharedbook.c */,
-				61958DBE1364B72000B429B6 /* synthesis.c */,
-				61958DBF1364B72000B429B6 /* vorbisfile.c */,
-				61958DC01364B72000B429B6 /* window_lookup.h */,
-				61958DC11364B72000B429B6 /* window.c */,
-				61958DC21364B72000B429B6 /* window.h */,
+				61DB17E7148BA9A9004A67B8 /* asm_arm.h */,
+				61DB17E8148BA9A9004A67B8 /* backends.h */,
+				61DB17E9148BA9A9004A67B8 /* bitwise.c */,
+				61DB17EA148BA9A9004A67B8 /* block.c */,
+				61DB17EB148BA9A9004A67B8 /* block.h */,
+				61DB17EC148BA9A9004A67B8 /* codebook.c */,
+				61DB17ED148BA9A9004A67B8 /* codebook.h */,
+				61DB17EE148BA9A9004A67B8 /* codec_internal.h */,
+				61DB17EF148BA9A9004A67B8 /* config_types.h */,
+				61DB17F0148BA9A9004A67B8 /* floor0.c */,
+				61DB17F1148BA9A9004A67B8 /* floor1.c */,
+				61DB17F2148BA9A9004A67B8 /* framing.c */,
+				61DB17F3148BA9A9004A67B8 /* info.c */,
+				61DB17F4148BA9A9004A67B8 /* ivorbiscodec.h */,
+				61DB17F6148BA9A9004A67B8 /* ivorbisfile.h */,
+				61DB17F7148BA9A9004A67B8 /* lsp_lookup.h */,
+				61DB17F8148BA9A9004A67B8 /* mapping0.c */,
+				61DB17F9148BA9A9004A67B8 /* mdct_lookup.h */,
+				61DB17FA148BA9A9004A67B8 /* mdct.c */,
+				61DB17FB148BA9A9004A67B8 /* mdct.h */,
+				61DB17FC148BA9A9004A67B8 /* misc.h */,
+				61DB17FD148BA9A9004A67B8 /* ogg.h */,
+				61DB17FE148BA9A9004A67B8 /* os_types.h */,
+				61DB17FF148BA9A9004A67B8 /* os.h */,
+				61DB1800148BA9A9004A67B8 /* registry.c */,
+				61DB1801148BA9A9004A67B8 /* registry.h */,
+				61DB1802148BA9A9004A67B8 /* res012.c */,
+				61DB1803148BA9A9004A67B8 /* sharedbook.c */,
+				61DB1804148BA9A9004A67B8 /* synthesis.c */,
+				61DB1805148BA9A9004A67B8 /* vorbisfile.c */,
+				61DB1806148BA9A9004A67B8 /* window_lookup.h */,
+				61DB1807148BA9A9004A67B8 /* window.c */,
+				61DB1808148BA9A9004A67B8 /* window.h */,
 			);
 			name = Sources;
 			sourceTree = "<group>";
@@ -178,24 +178,24 @@
 			buildActionMask = 2147483647;
 			files = (
 				AA747D9F0F9514B9006C5449 /* Tremor_Prefix.pch in Headers */,
-				61958DC31364B72000B429B6 /* asm_arm.h in Headers */,
-				61958DC41364B72000B429B6 /* backends.h in Headers */,
-				61958DC61364B72000B429B6 /* block.h in Headers */,
-				61958DC81364B72000B429B6 /* codebook.h in Headers */,
-				61958DC91364B72000B429B6 /* codec_internal.h in Headers */,
-				61958DCA1364B72000B429B6 /* config_types.h in Headers */,
-				61958DCE1364B72000B429B6 /* ivorbiscodec.h in Headers */,
-				61958DCF1364B72000B429B6 /* ivorbisfile.h in Headers */,
-				61958DD01364B72000B429B6 /* lsp_lookup.h in Headers */,
-				61958DD21364B72000B429B6 /* mdct_lookup.h in Headers */,
-				61958DD41364B72000B429B6 /* mdct.h in Headers */,
-				61958DD51364B72000B429B6 /* misc.h in Headers */,
-				61958DD61364B72000B429B6 /* os.h in Headers */,
-				61958DD81364B72000B429B6 /* registry.h in Headers */,
-				61958DDD1364B72000B429B6 /* window_lookup.h in Headers */,
-				61958DDF1364B72000B429B6 /* window.h in Headers */,
-				61958DFC1364B84300B429B6 /* os_types.h in Headers */,
-				61958E0E1364B89700B429B6 /* ogg.h in Headers */,
+				61DB1809148BA9A9004A67B8 /* asm_arm.h in Headers */,
+				61DB180A148BA9A9004A67B8 /* backends.h in Headers */,
+				61DB180D148BA9A9004A67B8 /* block.h in Headers */,
+				61DB180F148BA9A9004A67B8 /* codebook.h in Headers */,
+				61DB1810148BA9A9004A67B8 /* codec_internal.h in Headers */,
+				61DB1811148BA9A9004A67B8 /* config_types.h in Headers */,
+				61DB1816148BA9A9004A67B8 /* ivorbiscodec.h in Headers */,
+				61DB1818148BA9A9004A67B8 /* ivorbisfile.h in Headers */,
+				61DB1819148BA9A9004A67B8 /* lsp_lookup.h in Headers */,
+				61DB181B148BA9A9004A67B8 /* mdct_lookup.h in Headers */,
+				61DB181D148BA9A9004A67B8 /* mdct.h in Headers */,
+				61DB181E148BA9A9004A67B8 /* misc.h in Headers */,
+				61DB181F148BA9A9004A67B8 /* ogg.h in Headers */,
+				61DB1820148BA9A9004A67B8 /* os_types.h in Headers */,
+				61DB1821148BA9A9004A67B8 /* os.h in Headers */,
+				61DB1823148BA9A9004A67B8 /* registry.h in Headers */,
+				61DB1828148BA9A9004A67B8 /* window_lookup.h in Headers */,
+				61DB182A148BA9A9004A67B8 /* window.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -249,21 +249,21 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				619598411364BE7F00B429B6 /* bitwise.c in Sources */,
-				61958DC51364B72000B429B6 /* block.c in Sources */,
-				61958DC71364B72000B429B6 /* codebook.c in Sources */,
-				619598391364BDCC00B429B6 /* framing.c in Sources */,
-				61958DCB1364B72000B429B6 /* floor0.c in Sources */,
-				61958DCC1364B72000B429B6 /* floor1.c in Sources */,
-				61958DCD1364B72000B429B6 /* info.c in Sources */,
-				61958DD11364B72000B429B6 /* mapping0.c in Sources */,
-				61958DD31364B72000B429B6 /* mdct.c in Sources */,
-				61958DD71364B72000B429B6 /* registry.c in Sources */,
-				61958DD91364B72000B429B6 /* res012.c in Sources */,
-				61958DDA1364B72000B429B6 /* sharedbook.c in Sources */,
-				61958DDB1364B72000B429B6 /* synthesis.c in Sources */,
-				61958DDC1364B72000B429B6 /* vorbisfile.c in Sources */,
-				61958DDE1364B72000B429B6 /* window.c in Sources */,
+				61DB180B148BA9A9004A67B8 /* bitwise.c in Sources */,
+				61DB180C148BA9A9004A67B8 /* block.c in Sources */,
+				61DB180E148BA9A9004A67B8 /* codebook.c in Sources */,
+				61DB1812148BA9A9004A67B8 /* floor0.c in Sources */,
+				61DB1813148BA9A9004A67B8 /* floor1.c in Sources */,
+				61DB1814148BA9A9004A67B8 /* framing.c in Sources */,
+				61DB1815148BA9A9004A67B8 /* info.c in Sources */,
+				61DB181A148BA9A9004A67B8 /* mapping0.c in Sources */,
+				61DB181C148BA9A9004A67B8 /* mdct.c in Sources */,
+				61DB1822148BA9A9004A67B8 /* registry.c in Sources */,
+				61DB1824148BA9A9004A67B8 /* res012.c in Sources */,
+				61DB1825148BA9A9004A67B8 /* sharedbook.c in Sources */,
+				61DB1826148BA9A9004A67B8 /* synthesis.c in Sources */,
+				61DB1827148BA9A9004A67B8 /* vorbisfile.c in Sources */,
+				61DB1829148BA9A9004A67B8 /* window.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
--- a/misc/libtremor/asm_arm.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: arm7 and later wide math functions
-
- ********************************************************************/
-
-#ifdef _ARM_ASSEM_
-
-#if !defined(_V_WIDE_MATH) && !defined(_LOW_ACCURACY_)
-#define _V_WIDE_MATH
-
-static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
-  int lo,hi;
-  asm volatile("smull\t%0, %1, %2, %3"
-               : "=&r"(lo),"=&r"(hi)
-               : "%r"(x),"r"(y)
-	       : "cc");
-  return(hi);
-}
-
-static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
-  return MULT32(x,y)<<1;
-}
-
-static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
-  int lo,hi;
-  asm volatile("smull	%0, %1, %2, %3\n\t"
-	       "movs	%0, %0, lsr #15\n\t"
-	       "adc	%1, %0, %1, lsl #17\n\t"
-               : "=&r"(lo),"=&r"(hi)
-               : "%r"(x),"r"(y)
-	       : "cc");
-  return(hi);
-}
-
-#define MB() asm volatile ("" : : : "memory")
-
-static inline void XPROD32(ogg_int32_t  a, ogg_int32_t  b,
-			   ogg_int32_t  t, ogg_int32_t  v,
-			   ogg_int32_t *x, ogg_int32_t *y)
-{
-  int x1, y1, l;
-  asm(	"smull	%0, %1, %4, %6\n\t"
-	"smlal	%0, %1, %5, %7\n\t"
-	"rsb	%3, %4, #0\n\t"
-	"smull	%0, %2, %5, %6\n\t"
-	"smlal	%0, %2, %3, %7"
-	: "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
-	: "3" (a), "r" (b), "r" (t), "r" (v)
-	: "cc" );
-  *x = x1;
-  MB();
-  *y = y1;
-}
-
-static inline void XPROD31(ogg_int32_t  a, ogg_int32_t  b,
-			   ogg_int32_t  t, ogg_int32_t  v,
-			   ogg_int32_t *x, ogg_int32_t *y)
-{
-  int x1, y1, l;
-  asm(	"smull	%0, %1, %4, %6\n\t"
-	"smlal	%0, %1, %5, %7\n\t"
-	"rsb	%3, %4, #0\n\t"
-	"smull	%0, %2, %5, %6\n\t"
-	"smlal	%0, %2, %3, %7"
-	: "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
-	: "3" (a), "r" (b), "r" (t), "r" (v)
-	: "cc" );
-  *x = x1 << 1;
-  MB();
-  *y = y1 << 1;
-}
-
-static inline void XNPROD31(ogg_int32_t  a, ogg_int32_t  b,
-			    ogg_int32_t  t, ogg_int32_t  v,
-			    ogg_int32_t *x, ogg_int32_t *y)
-{
-  int x1, y1, l;
-  asm(	"rsb	%2, %4, #0\n\t"
-	"smull	%0, %1, %3, %5\n\t"
-	"smlal	%0, %1, %2, %6\n\t"
-	"smull	%0, %2, %4, %5\n\t"
-	"smlal	%0, %2, %3, %6"
-	: "=&r" (l), "=&r" (x1), "=&r" (y1)
-	: "r" (a), "r" (b), "r" (t), "r" (v)
-	: "cc" );
-  *x = x1 << 1;
-  MB();
-  *y = y1 << 1;
-}
-
-#endif
-
-#ifndef _V_CLIP_MATH
-#define _V_CLIP_MATH
-
-static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
-  int tmp;
-  asm volatile("subs	%1, %0, #32768\n\t"
-	       "movpl	%0, #0x7f00\n\t"
-	       "orrpl	%0, %0, #0xff\n"
-	       "adds	%1, %0, #32768\n\t"
-	       "movmi	%0, #0x8000"
-	       : "+r"(x),"=r"(tmp)
-	       :
-	       : "cc");
-  return(x);
-}
-
-#endif
-
-#ifndef _V_LSP_MATH_ASM
-#define _V_LSP_MATH_ASM
-
-static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
-				ogg_int32_t *qexpp,
-				ogg_int32_t *ilsp,ogg_int32_t wi,
-				ogg_int32_t m){
-  
-  ogg_uint32_t qi=*qip,pi=*pip;
-  ogg_int32_t qexp=*qexpp;
-
-  asm("mov     r0,%3;"
-      "mov     r1,%5,asr#1;"
-      "add     r0,r0,r1,lsl#3;"
-      "1:"
-      
-      "ldmdb   r0!,{r1,r3};"
-      "subs    r1,r1,%4;"          //ilsp[j]-wi
-      "rsbmi   r1,r1,#0;"          //labs(ilsp[j]-wi)
-      "umull   %0,r2,r1,%0;"       //qi*=labs(ilsp[j]-wi)
-      
-      "subs    r1,r3,%4;"          //ilsp[j+1]-wi
-      "rsbmi   r1,r1,#0;"          //labs(ilsp[j+1]-wi)
-      "umull   %1,r3,r1,%1;"       //pi*=labs(ilsp[j+1]-wi)
-      
-      "cmn     r2,r3;"             // shift down 16?
-      "beq     0f;"
-      "add     %2,%2,#16;"
-      "mov     %0,%0,lsr #16;"
-      "orr     %0,%0,r2,lsl #16;"
-      "mov     %1,%1,lsr #16;"
-      "orr     %1,%1,r3,lsl #16;"
-      "0:"
-      "cmp     r0,%3;\n"
-      "bhi     1b;\n"
-      
-      // odd filter assymetry
-      "ands    r0,%5,#1;\n"
-      "beq     2f;\n"
-      "add     r0,%3,%5,lsl#2;\n"
-      
-      "ldr     r1,[r0,#-4];\n"
-      "mov     r0,#0x4000;\n"
-      
-      "subs    r1,r1,%4;\n"          //ilsp[j]-wi
-      "rsbmi   r1,r1,#0;\n"          //labs(ilsp[j]-wi)
-      "umull   %0,r2,r1,%0;\n"       //qi*=labs(ilsp[j]-wi)
-      "umull   %1,r3,r0,%1;\n"       //pi*=labs(ilsp[j+1]-wi)
-      
-      "cmn     r2,r3;\n"             // shift down 16?
-      "beq     2f;\n"
-      "add     %2,%2,#16;\n"
-      "mov     %0,%0,lsr #16;\n"
-      "orr     %0,%0,r2,lsl #16;\n"
-      "mov     %1,%1,lsr #16;\n"
-      "orr     %1,%1,r3,lsl #16;\n"
-      
-      //qi=(pi>>shift)*labs(ilsp[j]-wi);
-      //pi=(qi>>shift)*labs(ilsp[j+1]-wi);
-      //qexp+=shift;
-      
-      //}
-	 
-      /* normalize to max 16 sig figs */
-      "2:"
-      "mov     r2,#0;"
-      "orr     r1,%0,%1;"
-      "tst     r1,#0xff000000;"
-      "addne   r2,r2,#8;"
-      "movne   r1,r1,lsr #8;"
-      "tst     r1,#0x00f00000;"
-      "addne   r2,r2,#4;"
-      "movne   r1,r1,lsr #4;"
-      "tst     r1,#0x000c0000;"
-      "addne   r2,r2,#2;"
-      "movne   r1,r1,lsr #2;"
-      "tst     r1,#0x00020000;"
-      "addne   r2,r2,#1;"
-      "movne   r1,r1,lsr #1;"
-      "tst     r1,#0x00010000;"
-      "addne   r2,r2,#1;"
-      "mov     %0,%0,lsr r2;"
-      "mov     %1,%1,lsr r2;"
-      "add     %2,%2,r2;"
-      
-      : "+r"(qi),"+r"(pi),"+r"(qexp)
-      : "r"(ilsp),"r"(wi),"r"(m)
-      : "r0","r1","r2","r3","cc");
-  
-  *qip=qi;
-  *pip=pi;
-  *qexpp=qexp;
-}
-
-static inline void lsp_norm_asm(ogg_uint32_t *qip,ogg_int32_t *qexpp){
-
-  ogg_uint32_t qi=*qip;
-  ogg_int32_t qexp=*qexpp;
-
-  asm("tst     %0,#0x0000ff00;"
-      "moveq   %0,%0,lsl #8;"
-      "subeq   %1,%1,#8;"
-      "tst     %0,#0x0000f000;"
-      "moveq   %0,%0,lsl #4;"
-      "subeq   %1,%1,#4;"
-      "tst     %0,#0x0000c000;"
-      "moveq   %0,%0,lsl #2;"
-      "subeq   %1,%1,#2;"
-      "tst     %0,#0x00008000;"
-      "moveq   %0,%0,lsl #1;"
-      "subeq   %1,%1,#1;"
-      : "+r"(qi),"+r"(qexp)
-      :
-      : "cc");
-  *qip=qi;
-  *qexpp=qexp;
-}
-
-#endif
-#endif
-
--- a/misc/libtremor/autogen.sh	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-#!/bin/sh
-# Run this to set up the build system: configure, makefiles, etc.
-# (based on the version in enlightenment's cvs)
-
-package="vorbisdec"
-
-olddir=`pwd`
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-cd "$srcdir"
-DIE=0
-
-echo "checking for autoconf... "
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
-        echo
-        echo "You must have autoconf installed to compile $package."
-        echo "Download the appropriate package for your distribution,"
-        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-        DIE=1
-}
-
-VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
-VERSIONMKINT="sed -e s/[^0-9]//"
-                                                                                
-# do we need automake?
-if test -r Makefile.am; then
-  AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
-  AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
-  if test x"$AM_NEEDED" = "x$AM_OPTIONS"; then
-    AM_NEEDED=""
-  fi
-  if test -z $AM_NEEDED; then
-    echo -n "checking for automake... "
-    AUTOMAKE=automake
-    ACLOCAL=aclocal
-    if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
-      echo "yes"
-    else
-      echo "no"
-      AUTOMAKE=
-    fi
-  else
-    echo -n "checking for automake $AM_NEEDED or later... "
-    for am in automake-$AM_NEEDED automake$AM_NEEDED automake; do
-      ($am --version < /dev/null > /dev/null 2>&1) || continue
-      ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
-      verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
-      if test $ver -ge $verneeded; then
-        AUTOMAKE=$am
-        echo $AUTOMAKE
-        break
-      fi
-    done
-    test -z $AUTOMAKE &&  echo "no"
-    echo -n "checking for aclocal $AM_NEEDED or later... "
-    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal; do
-      ($ac --version < /dev/null > /dev/null 2>&1) || continue
-      ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
-      verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
-      if test $ver -ge $verneeded; then
-        ACLOCAL=$ac
-        echo $ACLOCAL
-        break
-      fi
-    done
-    test -z $ACLOCAL && echo "no"
-  fi
-  test -z $AUTOMAKE || test -z $ACLOCAL && {
-        echo
-        echo "You must have automake installed to compile $package."
-        echo "Download the appropriate package for your distribution,"
-        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-        exit 1
-  }
-fi
-
-echo -n "checking for libtool... "
-for LIBTOOLIZE in libtoolize glibtoolize nope; do
-  ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
-done
-if test x$LIBTOOLIZE = xnope; then
-  echo "nope."
-  LIBTOOLIZE=libtoolize
-else
-  echo $LIBTOOLIZE
-fi
-($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
-	echo
-	echo "You must have libtool installed to compile $package."
-	echo "Download the appropriate package for your system,"
-	echo "or get the source from one of the GNU ftp sites"
-	echo "listed in http://www.gnu.org/order/ftp.html"
-	DIE=1
-}
-
-if test "$DIE" -eq 1; then
-        exit 1
-fi
-
-if test -z "$*"; then
-        echo "I am going to run ./configure with no arguments - if you wish "
-        echo "to pass any to it, please specify them on the $0 command line."
-fi
-
-echo "Generating configuration files for $package, please wait...."
-
-echo "  $ACLOCAL $ACLOCAL_FLAGS"
-$ACLOCAL $ACLOCAL_FLAGS || exit 1
-echo "  $LIBTOOLIZE --automake"
-$LIBTOOLIZE --automake || exit 1
-echo "  autoheader"
-autoheader || exit 1
-echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
-$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
-echo "  autoconf"
-autoconf || exit 1
-
-cd $olddir
-$srcdir/configure --enable-maintainer-mode "$@" && echo
--- a/misc/libtremor/backends.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: backend and mapping structures
-
- ********************************************************************/
-
-/* this is exposed up here because we need it for static modes.
-   Lookups for each backend aren't exposed because there's no reason
-   to do so */
-
-#ifndef _vorbis_backend_h_
-#define _vorbis_backend_h_
-
-#include "codec_internal.h"
-
-/* this would all be simpler/shorter with templates, but.... */
-/* Transform backend generic *************************************/
-
-/* only mdct right now.  Flesh it out more if we ever transcend mdct
-   in the transform domain */
-
-/* Floor backend generic *****************************************/
-typedef struct{
-  vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
-  vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
-				   vorbis_info_floor *);
-  void (*free_info) (vorbis_info_floor *);
-  void (*free_look) (vorbis_look_floor *);
-  void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
-  int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
-		     void *buffer,ogg_int32_t *);
-} vorbis_func_floor;
-
-typedef struct{
-  int   order;
-  long  rate;
-  long  barkmap;
-
-  int   ampbits;
-  int   ampdB;
-
-  int   numbooks; /* <= 16 */
-  int   books[16];
-
-} vorbis_info_floor0;
-
-#define VIF_POSIT 63
-#define VIF_CLASS 16
-#define VIF_PARTS 31
-typedef struct{
-  int   partitions;                /* 0 to 31 */
-  int   partitionclass[VIF_PARTS]; /* 0 to 15 */
-
-  int   class_dim[VIF_CLASS];        /* 1 to 8 */
-  int   class_subs[VIF_CLASS];       /* 0,1,2,3 (bits: 1<<n poss) */
-  int   class_book[VIF_CLASS];       /* subs ^ dim entries */
-  int   class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
-
-
-  int   mult;                      /* 1 2 3 or 4 */
-  int   postlist[VIF_POSIT+2];    /* first two implicit */
-
-} vorbis_info_floor1;
-
-/* Residue backend generic *****************************************/
-typedef struct{
-  vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
-  vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
-				 vorbis_info_residue *);
-  void (*free_info)    (vorbis_info_residue *);
-  void (*free_look)    (vorbis_look_residue *);
-  int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
-			ogg_int32_t **,int *,int);
-} vorbis_func_residue;
-
-typedef struct vorbis_info_residue0{
-/* block-partitioned VQ coded straight residue */
-  long  begin;
-  long  end;
-
-  /* first stage (lossless partitioning) */
-  int    grouping;         /* group n vectors per partition */
-  int    partitions;       /* possible codebooks for a partition */
-  int    groupbook;        /* huffbook for partitioning */
-  int    secondstages[64]; /* expanded out to pointers in lookup */
-  int    booklist[256];    /* list of second stage books */
-} vorbis_info_residue0;
-
-/* Mapping backend generic *****************************************/
-typedef struct{
-  vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
-  vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
-				 vorbis_info_mapping *);
-  void (*free_info)    (vorbis_info_mapping *);
-  void (*free_look)    (vorbis_look_mapping *);
-  int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
-} vorbis_func_mapping;
-
-typedef struct vorbis_info_mapping0{
-  int   submaps;  /* <= 16 */
-  int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
-
-  int   floorsubmap[16];   /* [mux] submap to floors */
-  int   residuesubmap[16]; /* [mux] submap to residue */
-
-  int   psy[2]; /* by blocktype; impulse/padding for short,
-                   transition/normal for long */
-
-  int   coupling_steps;
-  int   coupling_mag[256];
-  int   coupling_ang[256];
-} vorbis_info_mapping0;
-
-#endif
-
-
-
-
-
--- a/misc/libtremor/bitwise.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
-  function: packing variable sized words into an octet stream
-
- ********************************************************************/
-
-/* We're 'LSb' endian; if we write a word but read individual bits,
-   then we'll read the lsb first */
-
-#include <string.h>
-#include <stdlib.h>
-#include "ogg.h"
-
-static unsigned long mask[]=
-{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
- 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
- 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
- 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
- 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,
- 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
- 0x3fffffff,0x7fffffff,0xffffffff };
-
-/* mark read process as having run off the end */
-static void _adv_halt(oggpack_buffer *b){
-  b->headptr=b->head->buffer->data+b->head->begin+b->head->length;
-  b->headend=-1;
-  b->headbit=0;
-}
-
-/* spans forward, skipping as many bytes as headend is negative; if
-   headend is zero, simply finds next byte.  If we're up to the end
-   of the buffer, leaves headend at zero.  If we've read past the end,
-   halt the decode process. */
-static void _span(oggpack_buffer *b){
-  while(b->headend<1){
-    if(b->head->next){
-      b->count+=b->head->length;
-      b->head=b->head->next;
-      b->headptr=b->head->buffer->data+b->head->begin-b->headend;
-      b->headend+=b->head->length;
-    }else{
-      /* we've either met the end of decode, or gone past it. halt
-         only if we're past */
-      if(b->headend<0 || b->headbit)
-        /* read has fallen off the end */
-        _adv_halt(b);
-
-      break;
-    }
-  }
-}
-
-void oggpack_readinit(oggpack_buffer *b,ogg_reference *r){
-  memset(b,0,sizeof(*b));
-
-  b->tail=b->head=r;
-  b->count=0;
-  b->headptr=b->head->buffer->data+b->head->begin;
-  b->headend=b->head->length;
-  _span(b);
-}
-
-#define _lookspan()   while(!end){\
-                        head=head->next;\
-                        if(!head) return -1;\
-                        ptr=head->buffer->data + head->begin;\
-                        end=head->length;\
-                      }
-
-/* Read in bits without advancing the bitptr; bits <= 32 */
-long oggpack_look(oggpack_buffer *b,int bits){
-  unsigned long m=mask[bits];
-  unsigned long ret=-1;
-
-  bits+=b->headbit;
-
-  if(bits >= b->headend<<3){
-    int            end=b->headend;
-    unsigned char *ptr=b->headptr;
-    ogg_reference *head=b->head;
-
-    if(end<0)return -1;
-
-    if(bits){
-      _lookspan();
-      ret=*ptr++>>b->headbit;
-      if(bits>8){
-        --end;
-        _lookspan();
-        ret|=*ptr++<<(8-b->headbit);
-        if(bits>16){
-          --end;
-          _lookspan();
-          ret|=*ptr++<<(16-b->headbit);
-          if(bits>24){
-            --end;
-            _lookspan();
-            ret|=*ptr++<<(24-b->headbit);
-            if(bits>32 && b->headbit){
-              --end;
-              _lookspan();
-              ret|=*ptr<<(32-b->headbit);
-            }
-          }
-        }
-      }
-    }
-
-  }else{
-
-    /* make this a switch jump-table */
-    ret=b->headptr[0]>>b->headbit;
-    if(bits>8){
-      ret|=b->headptr[1]<<(8-b->headbit);  
-      if(bits>16){
-        ret|=b->headptr[2]<<(16-b->headbit);  
-        if(bits>24){
-          ret|=b->headptr[3]<<(24-b->headbit);  
-          if(bits>32 && b->headbit)
-            ret|=b->headptr[4]<<(32-b->headbit);
-        }
-      }
-    }
-  }
-
-  ret&=m;
-  return ret;
-}
-
-/* limited to 32 at a time */
-void oggpack_adv(oggpack_buffer *b,int bits){
-  bits+=b->headbit;
-  b->headbit=bits&7;
-  b->headptr+=bits/8;
-  if((b->headend-=bits/8)<1)_span(b);
-}
-
-/* spans forward and finds next byte.  Never halts */
-static void _span_one(oggpack_buffer *b){
-  while(b->headend<1){
-    if(b->head->next){
-      b->count+=b->head->length;
-      b->head=b->head->next;
-      b->headptr=b->head->buffer->data+b->head->begin;
-      b->headend=b->head->length;
-    }else
-      break;
-  }
-}
-
-static int _halt_one(oggpack_buffer *b){
-  if(b->headend<1){
-    _adv_halt(b);
-    return -1;
-  }
-  return 0;
-}
-
-int oggpack_eop(oggpack_buffer *b){
-  if(b->headend<0)return -1;
-  return 0;
-}
-
-/* bits <= 32 */
-long oggpack_read(oggpack_buffer *b,int bits){
-  unsigned long m=mask[bits];
-  ogg_uint32_t ret=-1;
-
-  bits+=b->headbit;
-
-  if(bits >= b->headend<<3){
-
-    if(b->headend<0)return -1;
-
-    if(bits){
-      if (_halt_one(b)) return -1;
-      ret=*b->headptr>>b->headbit;
-
-      if(bits>=8){
-        ++b->headptr;
-        --b->headend;
-        _span_one(b);
-        if(bits>8){
-          if (_halt_one(b)) return -1;
-          ret|=*b->headptr<<(8-b->headbit);
-
-          if(bits>=16){
-            ++b->headptr;
-            --b->headend;
-            _span_one(b);
-            if(bits>16){
-              if (_halt_one(b)) return -1;
-              ret|=*b->headptr<<(16-b->headbit);
-
-              if(bits>=24){
-                ++b->headptr;
-                --b->headend;
-                _span_one(b);
-                if(bits>24){
-                  if (_halt_one(b)) return -1;
-                  ret|=*b->headptr<<(24-b->headbit);
-
-                  if(bits>=32){
-                    ++b->headptr;
-                    --b->headend;
-                    _span_one(b);
-                    if(bits>32){
-                      if (_halt_one(b)) return -1;
-                      if(b->headbit)ret|=*b->headptr<<(32-b->headbit);
-
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }else{
-
-    ret=b->headptr[0]>>b->headbit;
-    if(bits>8){
-      ret|=b->headptr[1]<<(8-b->headbit);
-      if(bits>16){
-        ret|=b->headptr[2]<<(16-b->headbit);
-        if(bits>24){
-          ret|=b->headptr[3]<<(24-b->headbit);
-          if(bits>32 && b->headbit){
-            ret|=b->headptr[4]<<(32-b->headbit);
-          }
-        }
-      }
-    }
-
-    b->headptr+=bits/8;
-    b->headend-=bits/8;
-  }
-
-  ret&=m;
-  b->headbit=bits&7;
-  return ret;
-}
-
-long oggpack_bytes(oggpack_buffer *b){
-  return(b->count+b->headptr-b->head->buffer->data-b->head->begin+
-         (b->headbit+7)/8);
-}
-
-long oggpack_bits(oggpack_buffer *b){
-  return((b->count+b->headptr-b->head->buffer->data-b->head->begin)*8+
-         b->headbit);
-}
-
--- a/misc/libtremor/block.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,453 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: PCM data vector blocking, windowing and dis/reassembly
-
- ********************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-
-#include "window.h"
-#include "registry.h"
-#include "misc.h"
-
-static int ilog(unsigned int v){
-  int ret=0;
-  if(v)--v;
-  while(v){
-    ret++;
-    v>>=1;
-  }
-  return(ret);
-}
-
-/* pcm accumulator examples (not exhaustive):
-
- <-------------- lW ---------------->
-                   <--------------- W ---------------->
-:            .....|.....       _______________         |
-:        .'''     |     '''_---      |       |\        |
-:.....'''         |_____--- '''......|       | \_______|
-:.................|__________________|_______|__|______|
-                  |<------ Sl ------>|      > Sr <     |endW
-                  |beginSl           |endSl  |  |endSr
-                  |beginW            |endlW  |beginSr
-
-
-                      |< lW >|
-                   <--------------- W ---------------->
-                  |   |  ..  ______________            |
-                  |   | '  `/        |     ---_        |
-                  |___.'___/`.       |         ---_____|
-                  |_______|__|_______|_________________|
-                  |      >|Sl|<      |<------ Sr ----->|endW
-                  |       |  |endSl  |beginSr          |endSr
-                  |beginW |  |endlW
-                  mult[0] |beginSl                     mult[n]
-
- <-------------- lW ----------------->
-                          |<--W-->|
-:            ..............  ___  |   |
-:        .'''             |`/   \ |   |
-:.....'''                 |/`....\|...|
-:.........................|___|___|___|
-                          |Sl |Sr |endW
-                          |   |   |endSr
-                          |   |beginSr
-                          |   |endSl
-			  |beginSl
-			  |beginW
-*/
-
-/* block abstraction setup *********************************************/
-
-#ifndef WORD_ALIGN
-#define WORD_ALIGN 8
-#endif
-
-int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
-  memset(vb,0,sizeof(*vb));
-  vb->vd=v;
-  vb->localalloc=0;
-  vb->localstore=NULL;
-
-  return(0);
-}
-
-void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
-  bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1);
-  if(bytes+vb->localtop>vb->localalloc){
-    /* can't just _ogg_realloc... there are outstanding pointers */
-    if(vb->localstore){
-      struct alloc_chain *link=(struct alloc_chain *)_ogg_malloc(sizeof(*link));
-      vb->totaluse+=vb->localtop;
-      link->next=vb->reap;
-      link->ptr=vb->localstore;
-      vb->reap=link;
-    }
-    /* highly conservative */
-    vb->localalloc=bytes;
-    vb->localstore=_ogg_malloc(vb->localalloc);
-    vb->localtop=0;
-  }
-  {
-    void *ret=(void *)(((char *)vb->localstore)+vb->localtop);
-    vb->localtop+=bytes;
-    return ret;
-  }
-}
-
-/* reap the chain, pull the ripcord */
-void _vorbis_block_ripcord(vorbis_block *vb){
-  /* reap the chain */
-  struct alloc_chain *reap=vb->reap;
-  while(reap){
-    struct alloc_chain *next=reap->next;
-    _ogg_free(reap->ptr);
-    memset(reap,0,sizeof(*reap));
-    _ogg_free(reap);
-    reap=next;
-  }
-  /* consolidate storage */
-  if(vb->totaluse){
-    vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc);
-    vb->localalloc+=vb->totaluse;
-    vb->totaluse=0;
-  }
-
-  /* pull the ripcord */
-  vb->localtop=0;
-  vb->reap=NULL;
-}
-
-int vorbis_block_clear(vorbis_block *vb){
-  _vorbis_block_ripcord(vb);
-  if(vb->localstore)_ogg_free(vb->localstore);
-
-  memset(vb,0,sizeof(*vb));
-  return(0);
-}
-
-static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){
-  int i;
-  codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
-  private_state *b=NULL;
-
-  memset(v,0,sizeof(*v));
-  b=(private_state *)(v->backend_state=_ogg_calloc(1,sizeof(*b)));
-
-  v->vi=vi;
-  b->modebits=ilog(ci->modes);
-
-  /* Vorbis I uses only window type 0 */
-  b->window[0]=_vorbis_window(0,ci->blocksizes[0]/2);
-  b->window[1]=_vorbis_window(0,ci->blocksizes[1]/2);
-
-  /* finish the codebooks */
-  if(!ci->fullbooks){
-    ci->fullbooks=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
-    for(i=0;i<ci->books;i++){
-      vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]);
-      /* decode codebooks are now standalone after init */
-      vorbis_staticbook_destroy(ci->book_param[i]);
-      ci->book_param[i]=NULL;
-    }
-  }
-
-  v->pcm_storage=ci->blocksizes[1];
-  v->pcm=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcm));
-  v->pcmret=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmret));
-  for(i=0;i<vi->channels;i++)
-    v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
-
-  /* all 1 (large block) or 0 (small block) */
-  /* explicitly set for the sake of clarity */
-  v->lW=0; /* previous window size */
-  v->W=0;  /* current window size */
-
-  /* initialize all the mapping/backend lookups */
-  b->mode=(vorbis_look_mapping **)_ogg_calloc(ci->modes,sizeof(*b->mode));
-  for(i=0;i<ci->modes;i++){
-    int mapnum=ci->mode_param[i]->mapping;
-    int maptype=ci->map_type[mapnum];
-    b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
-					 ci->map_param[mapnum]);
-  }
-  return(0);
-}
-
-int vorbis_synthesis_restart(vorbis_dsp_state *v){
-  vorbis_info *vi=v->vi;
-  codec_setup_info *ci;
-
-  if(!v->backend_state)return -1;
-  if(!vi)return -1;
-  ci=vi->codec_setup;
-  if(!ci)return -1;
-
-  v->centerW=ci->blocksizes[1]/2;
-  v->pcm_current=v->centerW;
-
-  v->pcm_returned=-1;
-  v->granulepos=-1;
-  v->sequence=-1;
-  ((private_state *)(v->backend_state))->sample_count=-1;
-
-  return(0);
-}
-
-int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
-  _vds_init(v,vi);
-  vorbis_synthesis_restart(v);
-
-  return(0);
-}
-
-void vorbis_dsp_clear(vorbis_dsp_state *v){
-  int i;
-  if(v){
-    vorbis_info *vi=v->vi;
-    codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL);
-    private_state *b=(private_state *)v->backend_state;
-
-    if(v->pcm){
-      for(i=0;i<vi->channels;i++)
-	if(v->pcm[i])_ogg_free(v->pcm[i]);
-      _ogg_free(v->pcm);
-      if(v->pcmret)_ogg_free(v->pcmret);
-    }
-
-    /* free mode lookups; these are actually vorbis_look_mapping structs */
-    if(ci){
-      for(i=0;i<ci->modes;i++){
-	int mapnum=ci->mode_param[i]->mapping;
-	int maptype=ci->map_type[mapnum];
-	if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
-      }
-    }
-
-    if(b){
-      if(b->mode)_ogg_free(b->mode);
-      _ogg_free(b);
-    }
-
-    memset(v,0,sizeof(*v));
-  }
-}
-
-/* Unlike in analysis, the window is only partially applied for each
-   block.  The time domain envelope is not yet handled at the point of
-   calling (as it relies on the previous block). */
-
-int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
-  vorbis_info *vi=v->vi;
-  codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
-  private_state *b=v->backend_state;
-  int i,j;
-
-  if(v->pcm_current>v->pcm_returned  && v->pcm_returned!=-1)return(OV_EINVAL);
-
-  v->lW=v->W;
-  v->W=vb->W;
-  v->nW=-1;
-
-  if((v->sequence==-1)||
-     (v->sequence+1 != vb->sequence)){
-    v->granulepos=-1; /* out of sequence; lose count */
-    b->sample_count=-1;
-  }
-
-  v->sequence=vb->sequence;
-
-  if(vb->pcm){  /* no pcm to process if vorbis_synthesis_trackonly
-                   was called on block */
-    int n=ci->blocksizes[v->W]/2;
-    int n0=ci->blocksizes[0]/2;
-    int n1=ci->blocksizes[1]/2;
-
-    int thisCenter;
-    int prevCenter;
-
-    if(v->centerW){
-      thisCenter=n1;
-      prevCenter=0;
-    }else{
-      thisCenter=0;
-      prevCenter=n1;
-    }
-
-    /* v->pcm is now used like a two-stage double buffer.  We don't want
-       to have to constantly shift *or* adjust memory usage.  Don't
-       accept a new block until the old is shifted out */
-
-    /* overlap/add PCM */
-
-    for(j=0;j<vi->channels;j++){
-      /* the overlap/add section */
-      if(v->lW){
-	if(v->W){
-	  /* large/large */
-	  ogg_int32_t *pcm=v->pcm[j]+prevCenter;
-	  ogg_int32_t *p=vb->pcm[j];
-	  for(i=0;i<n1;i++)
-	    pcm[i]+=p[i];
-	}else{
-	  /* large/small */
-	  ogg_int32_t *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
-	  ogg_int32_t *p=vb->pcm[j];
-	  for(i=0;i<n0;i++)
-	    pcm[i]+=p[i];
-	}
-      }else{
-	if(v->W){
-	  /* small/large */
-	  ogg_int32_t *pcm=v->pcm[j]+prevCenter;
-	  ogg_int32_t *p=vb->pcm[j]+n1/2-n0/2;
-	  for(i=0;i<n0;i++)
-	    pcm[i]+=p[i];
-	  for(;i<n1/2+n0/2;i++)
-	    pcm[i]=p[i];
-	}else{
-	  /* small/small */
-	  ogg_int32_t *pcm=v->pcm[j]+prevCenter;
-	  ogg_int32_t *p=vb->pcm[j];
-	  for(i=0;i<n0;i++)
-	    pcm[i]+=p[i];
-	}
-      }
-
-      /* the copy section */
-      {
-	ogg_int32_t *pcm=v->pcm[j]+thisCenter;
-	ogg_int32_t *p=vb->pcm[j]+n;
-	for(i=0;i<n;i++)
-	  pcm[i]=p[i];
-      }
-    }
-
-    if(v->centerW)
-      v->centerW=0;
-    else
-      v->centerW=n1;
-
-    /* deal with initial packet state; we do this using the explicit
-       pcm_returned==-1 flag otherwise we're sensitive to first block
-       being short or long */
-
-    if(v->pcm_returned==-1){
-      v->pcm_returned=thisCenter;
-      v->pcm_current=thisCenter;
-    }else{
-      v->pcm_returned=prevCenter;
-      v->pcm_current=prevCenter+
-	ci->blocksizes[v->lW]/4+
-	ci->blocksizes[v->W]/4;
-    }
-
-  }
-
-  /* track the frame number... This is for convenience, but also
-     making sure our last packet doesn't end with added padding.  If
-     the last packet is partial, the number of samples we'll have to
-     return will be past the vb->granulepos.
-     
-     This is not foolproof!  It will be confused if we begin
-     decoding at the last page after a seek or hole.  In that case,
-     we don't have a starting point to judge where the last frame
-     is.  For this reason, vorbisfile will always try to make sure
-     it reads the last two marked pages in proper sequence */
-
-  if(b->sample_count==-1){
-    b->sample_count=0;
-  }else{
-    b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
-  }
-
-  if(v->granulepos==-1){
-    if(vb->granulepos!=-1){ /* only set if we have a position to set to */
-
-      v->granulepos=vb->granulepos;
-
-      /* is this a short page? */
-      if(b->sample_count>v->granulepos){
-	/* corner case; if this is both the first and last audio page,
-	   then spec says the end is cut, not beginning */
-	if(vb->eofflag){
-	  /* trim the end */
-	  /* no preceeding granulepos; assume we started at zero (we'd
-	     have to in a short single-page stream) */
-	  /* granulepos could be -1 due to a seek, but that would result
-	     in a long coun`t, not short count */
-
-	  v->pcm_current-=(b->sample_count-v->granulepos);
-	}else{
-	  /* trim the beginning */
-	  v->pcm_returned+=(b->sample_count-v->granulepos);
-	  if(v->pcm_returned>v->pcm_current)
-	    v->pcm_returned=v->pcm_current;
-	}
-
-      }
-
-    }
-  }else{
-    v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
-    if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
-      
-      if(v->granulepos>vb->granulepos){
-	long extra=v->granulepos-vb->granulepos;
-	
-	if(extra)
-	  if(vb->eofflag){
-	    /* partial last frame.  Strip the extra samples off */
-	    v->pcm_current-=extra;
-	  } /* else {Shouldn't happen *unless* the bitstream is out of
-	       spec.  Either way, believe the bitstream } */
-      } /* else {Shouldn't happen *unless* the bitstream is out of
-	   spec.  Either way, believe the bitstream } */
-      v->granulepos=vb->granulepos;
-    }
-  }
-
-  /* Update, cleanup */
-
-  if(vb->eofflag)v->eofflag=1;
-  return(0);
-}
-
-/* pcm==NULL indicates we just want the pending samples, no more */
-int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm){
-  vorbis_info *vi=v->vi;
-  if(v->pcm_returned>-1 && v->pcm_returned<v->pcm_current){
-    if(pcm){
-      int i;
-      for(i=0;i<vi->channels;i++)
-	v->pcmret[i]=v->pcm[i]+v->pcm_returned;
-      *pcm=v->pcmret;
-    }
-    return(v->pcm_current-v->pcm_returned);
-  }
-  return(0);
-}
-
-int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){
-  if(bytes && v->pcm_returned+bytes>v->pcm_current)return(OV_EINVAL);
-  v->pcm_returned+=bytes;
-  return(0);
-}
-
--- a/misc/libtremor/block.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2008    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: shared block functions
-
- ********************************************************************/
-
-#ifndef _V_BLOCK_
-#define _V_BLOCK_
-
-#include "ivorbiscodec.h"
-
-extern void _vorbis_block_ripcord(vorbis_block *vb);
-extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
-
-#endif
--- a/misc/libtremor/codebook.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: basic codebook pack/unpack/code/decode operations
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codebook.h"
-#include "misc.h"
-
-/* unpacks a codebook from the packet buffer into the codebook struct,
-   readies the codebook auxiliary structures for decode *************/
-int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
-  long i,j;
-  memset(s,0,sizeof(*s));
-
-  /* make sure alignment is correct */
-  if(oggpack_read(opb,24)!=0x564342)goto _eofout;
-
-  /* first the basic parameters */
-  s->dim=oggpack_read(opb,16);
-  s->entries=oggpack_read(opb,24);
-  if(s->entries==-1)goto _eofout;
-
-  /* codeword ordering.... length ordered or unordered? */
-  switch((int)oggpack_read(opb,1)){
-  case 0:
-    /* unordered */
-    s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
-
-    /* allocated but unused entries? */
-    if(oggpack_read(opb,1)){
-      /* yes, unused entries */
-
-      for(i=0;i<s->entries;i++){
-	if(oggpack_read(opb,1)){
-	  long num=oggpack_read(opb,5);
-	  if(num==-1)goto _eofout;
-	  s->lengthlist[i]=num+1;
-	}else
-	  s->lengthlist[i]=0;
-      }
-    }else{
-      /* all entries used; no tagging */
-      for(i=0;i<s->entries;i++){
-	long num=oggpack_read(opb,5);
-	if(num==-1)goto _eofout;
-	s->lengthlist[i]=num+1;
-      }
-    }
-    
-    break;
-  case 1:
-    /* ordered */
-    {
-      long length=oggpack_read(opb,5)+1;
-      s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
-
-      for(i=0;i<s->entries;){
-	long num=oggpack_read(opb,_ilog(s->entries-i));
-	if(num==-1)goto _eofout;
-	for(j=0;j<num && i<s->entries;j++,i++)
-	  s->lengthlist[i]=length;
-	length++;
-      }
-    }
-    break;
-  default:
-    /* EOF */
-    return(-1);
-  }
-  
-  /* Do we have a mapping to unpack? */
-  switch((s->maptype=oggpack_read(opb,4))){
-  case 0:
-    /* no mapping */
-    break;
-  case 1: case 2:
-    /* implicitly populated value mapping */
-    /* explicitly populated value mapping */
-
-    s->q_min=oggpack_read(opb,32);
-    s->q_delta=oggpack_read(opb,32);
-    s->q_quant=oggpack_read(opb,4)+1;
-    s->q_sequencep=oggpack_read(opb,1);
-
-    {
-      int quantvals=0;
-      switch(s->maptype){
-      case 1:
-	quantvals=_book_maptype1_quantvals(s);
-	break;
-      case 2:
-	quantvals=s->entries*s->dim;
-	break;
-      }
-      
-      /* quantized values */
-      s->quantlist=(long *)_ogg_malloc(sizeof(*s->quantlist)*quantvals);
-      for(i=0;i<quantvals;i++)
-	s->quantlist[i]=oggpack_read(opb,s->q_quant);
-      
-      if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout;
-    }
-    break;
-  default:
-    goto _errout;
-  }
-
-  /* all set */
-  return(0);
-  
- _errout:
- _eofout:
-  vorbis_staticbook_clear(s);
-  return(-1); 
-}
-
-/* the 'eliminate the decode tree' optimization actually requires the
-   codewords to be MSb first, not LSb.  This is an annoying inelegancy
-   (and one of the first places where carefully thought out design
-   turned out to be wrong; Vorbis II and future Ogg codecs should go
-   to an MSb bitpacker), but not actually the huge hit it appears to
-   be.  The first-stage decode table catches most words so that
-   bitreverse is not in the main execution path. */
-
-static ogg_uint32_t bitreverse(ogg_uint32_t x){
-  x=    ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000);
-  x=    ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00);
-  x=    ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0);
-  x=    ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc);
-  return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa);
-}
-
-STIN long decode_packed_entry_number(codebook *book, 
-					      oggpack_buffer *b){
-  int  read=book->dec_maxlength;
-  long lo,hi;
-  long lok = oggpack_look(b,book->dec_firsttablen);
- 
-  if (lok >= 0) {
-    long entry = book->dec_firsttable[lok];
-    if(entry&0x80000000UL){
-      lo=(entry>>15)&0x7fff;
-      hi=book->used_entries-(entry&0x7fff);
-    }else{
-      oggpack_adv(b, book->dec_codelengths[entry-1]);
-      return(entry-1);
-    }
-  }else{
-    lo=0;
-    hi=book->used_entries;
-  }
-
-  lok = oggpack_look(b, read);
-
-  while(lok<0 && read>1)
-    lok = oggpack_look(b, --read);
-
-  if(lok<0){
-    oggpack_adv(b,1); /* force eop */
-    return -1;
-  }
-
-  /* bisect search for the codeword in the ordered list */
-  {
-    ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok);
-
-    while(hi-lo>1){
-      long p=(hi-lo)>>1;
-      long test=book->codelist[lo+p]>testword;    
-      lo+=p&(test-1);
-      hi-=p&(-test);
-    }
-
-    if(book->dec_codelengths[lo]<=read){
-      oggpack_adv(b, book->dec_codelengths[lo]);
-      return(lo);
-    }
-  }
-  
-  oggpack_adv(b, read+1);
-  return(-1);
-}
-
-/* Decode side is specced and easier, because we don't need to find
-   matches using different criteria; we simply read and map.  There are
-   two things we need to do 'depending':
-   
-   We may need to support interleave.  We don't really, but it's
-   convenient to do it here rather than rebuild the vector later.
-
-   Cascades may be additive or multiplicitive; this is not inherent in
-   the codebook, but set in the code using the codebook.  Like
-   interleaving, it's easiest to do it here.  
-   addmul==0 -> declarative (set the value)
-   addmul==1 -> additive
-   addmul==2 -> multiplicitive */
-
-/* returns the [original, not compacted] entry number or -1 on eof *********/
-long vorbis_book_decode(codebook *book, oggpack_buffer *b){
-  if(book->used_entries>0){
-    long packed_entry=decode_packed_entry_number(book,b);
-    if(packed_entry>=0)
-      return(book->dec_index[packed_entry]);
-  }
-
-  /* if there's no dec_index, the codebook unpacking isn't collapsed */
-  return(-1);
-}
-
-/* returns 0 on OK or -1 on eof *************************************/
-long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a,
-			      oggpack_buffer *b,int n,int point){
-  if(book->used_entries>0){  
-    int step=n/book->dim;
-    long *entry = (long *)alloca(sizeof(*entry)*step);
-    ogg_int32_t **t = (ogg_int32_t **)alloca(sizeof(*t)*step);
-    int i,j,o;
-    int shift=point-book->binarypoint;
-    
-    if(shift>=0){
-      for (i = 0; i < step; i++) {
-	entry[i]=decode_packed_entry_number(book,b);
-	if(entry[i]==-1)return(-1);
-	t[i] = book->valuelist+entry[i]*book->dim;
-      }
-      for(i=0,o=0;i<book->dim;i++,o+=step)
-	for (j=0;j<step;j++)
-	  a[o+j]+=t[j][i]>>shift;
-    }else{
-      for (i = 0; i < step; i++) {
-	entry[i]=decode_packed_entry_number(book,b);
-	if(entry[i]==-1)return(-1);
-	t[i] = book->valuelist+entry[i]*book->dim;
-      }
-      for(i=0,o=0;i<book->dim;i++,o+=step)
-	for (j=0;j<step;j++)
-	  a[o+j]+=t[j][i]<<-shift;
-    }
-  }
-  return(0);
-}
-
-long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
-			     oggpack_buffer *b,int n,int point){
-  if(book->used_entries>0){
-    int i,j,entry;
-    ogg_int32_t *t;
-    int shift=point-book->binarypoint;
-    
-    if(shift>=0){
-      for(i=0;i<n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	t     = book->valuelist+entry*book->dim;
-	for (j=0;j<book->dim;)
-	  a[i++]+=t[j++]>>shift;
-      }
-    }else{
-      for(i=0;i<n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	t     = book->valuelist+entry*book->dim;
-	for (j=0;j<book->dim;)
-	  a[i++]+=t[j++]<<-shift;
-      }
-    }
-  }
-  return(0);
-}
-
-long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a,
-			     oggpack_buffer *b,int n,int point){
-  if(book->used_entries>0){
-    int i,j,entry;
-    ogg_int32_t *t;
-    int shift=point-book->binarypoint;
-    
-    if(shift>=0){
-      
-      for(i=0;i<n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	t     = book->valuelist+entry*book->dim;
-	for (j=0;j<book->dim;){
-	  a[i++]=t[j++]>>shift;
-	}
-      }
-    }else{
-      
-      for(i=0;i<n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	t     = book->valuelist+entry*book->dim;
-	for (j=0;j<book->dim;){
-	  a[i++]=t[j++]<<-shift;
-	}
-      }
-    }
-  }else{
-
-    int i,j;
-    for(i=0;i<n;){
-      for (j=0;j<book->dim;){
-	a[i++]=0;
-      }
-    }
-  }
-  return(0);
-}
-
-long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,\
-			      long offset,int ch,
-			      oggpack_buffer *b,int n,int point){
-  if(book->used_entries>0){
-    long i,j,entry;
-    int chptr=0;
-    int shift=point-book->binarypoint;
-    
-    if(shift>=0){
-      
-      for(i=offset;i<offset+n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	{
-	  const ogg_int32_t *t = book->valuelist+entry*book->dim;
-	  for (j=0;j<book->dim;j++){
-	    a[chptr++][i]+=t[j]>>shift;
-	    if(chptr==ch){
-	      chptr=0;
-	      i++;
-	    }
-	  }
-	}
-      }
-    }else{
-      
-      for(i=offset;i<offset+n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	{
-	  const ogg_int32_t *t = book->valuelist+entry*book->dim;
-	  for (j=0;j<book->dim;j++){
-	    a[chptr++][i]+=t[j]<<-shift;
-	    if(chptr==ch){
-	      chptr=0;
-	      i++;
-	    }
-	  }
-	}
-      }
-    }
-  }
-  return(0);
-}
--- a/misc/libtremor/codebook.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: basic shared codebook operations
-
- ********************************************************************/
-
-#ifndef _V_CODEBOOK_H_
-#define _V_CODEBOOK_H_
-
-#include "ogg.h"
-
-/* This structure encapsulates huffman and VQ style encoding books; it
-   doesn't do anything specific to either.
-
-   valuelist/quantlist are nonNULL (and q_* significant) only if
-   there's entry->value mapping to be done.
-
-   If encode-side mapping must be done (and thus the entry needs to be
-   hunted), the auxiliary encode pointer will point to a decision
-   tree.  This is true of both VQ and huffman, but is mostly useful
-   with VQ.
-
-*/
-
-typedef struct static_codebook{
-  long   dim;            /* codebook dimensions (elements per vector) */
-  long   entries;        /* codebook entries */
-  long  *lengthlist;     /* codeword lengths in bits */
-
-  /* mapping ***************************************************************/
-  int    maptype;        /* 0=none
-			    1=implicitly populated values from map column 
-			    2=listed arbitrary values */
-
-  /* The below does a linear, single monotonic sequence mapping. */
-  long     q_min;       /* packed 32 bit float; quant value 0 maps to minval */
-  long     q_delta;     /* packed 32 bit float; val 1 - val 0 == delta */
-  int      q_quant;     /* bits: 0 < quant <= 16 */
-  int      q_sequencep; /* bitflag */
-
-  long     *quantlist;  /* map == 1: (int)(entries^(1/dim)) element column map
-			   map == 2: list of dim*entries quantized entry vals
-			*/
-} static_codebook;
-
-typedef struct codebook{
-  long dim;           /* codebook dimensions (elements per vector) */
-  long entries;       /* codebook entries */
-  long used_entries;  /* populated codebook entries */
-
-  /* the below are ordered by bitreversed codeword and only used
-     entries are populated */
-  int           binarypoint;
-  ogg_int32_t  *valuelist;  /* list of dim*entries actual entry values */  
-  ogg_uint32_t *codelist;   /* list of bitstream codewords for each entry */
-
-  int          *dec_index;  
-  char         *dec_codelengths;
-  ogg_uint32_t *dec_firsttable;
-  int           dec_firsttablen;
-  int           dec_maxlength;
-
-  long     q_min;       /* packed 32 bit float; quant value 0 maps to minval */
-  long     q_delta;     /* packed 32 bit float; val 1 - val 0 == delta */
-
-} codebook;
-
-extern void vorbis_staticbook_clear(static_codebook *b);
-extern void vorbis_staticbook_destroy(static_codebook *b);
-extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
-
-extern void vorbis_book_clear(codebook *b);
-extern long _book_maptype1_quantvals(const static_codebook *b);
-
-extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
-
-extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
-extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a, 
-				     oggpack_buffer *b,int n,int point);
-extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a, 
-				    oggpack_buffer *b,int n,int point);
-extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a, 
-				    oggpack_buffer *b,int n,int point);
-extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
-				     long off,int ch, 
-				    oggpack_buffer *b,int n,int point);
-
-extern int _ilog(unsigned int v);
-
-
-#endif
--- a/misc/libtremor/codec_internal.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: libvorbis codec headers
-
- ********************************************************************/
-
-#ifndef _V_CODECI_H_
-#define _V_CODECI_H_
-
-#include "codebook.h"
-
-typedef void vorbis_look_mapping;
-typedef void vorbis_look_floor;
-typedef void vorbis_look_residue;
-typedef void vorbis_look_transform;
-
-/* mode ************************************************************/
-typedef struct {
-  int blockflag;
-  int windowtype;
-  int transformtype;
-  int mapping;
-} vorbis_info_mode;
-
-typedef void vorbis_info_floor;
-typedef void vorbis_info_residue;
-typedef void vorbis_info_mapping;
-
-typedef struct private_state {
-  /* local lookup storage */
-  const void             *window[2];
-
-  /* backend lookups are tied to the mode, not the backend or naked mapping */
-  int                     modebits;
-  vorbis_look_mapping   **mode;
-
-  ogg_int64_t sample_count;
-
-} private_state;
-
-/* codec_setup_info contains all the setup information specific to the
-   specific compression/decompression mode in progress (eg,
-   psychoacoustic settings, channel setup, options, codebook
-   etc).  
-*********************************************************************/
-
-typedef struct codec_setup_info {
-
-  /* Vorbis supports only short and long blocks, but allows the
-     encoder to choose the sizes */
-
-  long blocksizes[2];
-
-  /* modes are the primary means of supporting on-the-fly different
-     blocksizes, different channel mappings (LR or M/A),
-     different residue backends, etc.  Each mode consists of a
-     blocksize flag and a mapping (along with the mapping setup */
-
-  int        modes;
-  int        maps;
-  int        times;
-  int        floors;
-  int        residues;
-  int        books;
-
-  vorbis_info_mode       *mode_param[64];
-  int                     map_type[64];
-  vorbis_info_mapping    *map_param[64];
-  int                     time_type[64];
-  int                     floor_type[64];
-  vorbis_info_floor      *floor_param[64];
-  int                     residue_type[64];
-  vorbis_info_residue    *residue_param[64];
-  static_codebook        *book_param[256];
-  codebook               *fullbooks;
-
-  int    passlimit[32];     /* iteration limit per couple/quant pass */
-  int    coupling_passes;
-} codec_setup_info;
-
-#endif
--- a/misc/libtremor/config_types.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: #ifdef jail to whip a few platforms into the UNIX ideal.
-
- ********************************************************************/
-#ifndef _OS_CVTYPES_H
-#define _OS_CVTYPES_H
-
-typedef long long ogg_int64_t;
-typedef int ogg_int32_t;
-typedef unsigned int ogg_uint32_t;
-typedef short ogg_int16_t;
-
-#endif
--- a/misc/libtremor/configure.in	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-dnl Process this file with autoconf to produce a configure script
-
-dnl ------------------------------------------------
-dnl Initialization and Versioning
-dnl ------------------------------------------------
-
-AC_INIT(mdct.c)
-
-AC_CANONICAL_HOST
-AC_CANONICAL_TARGET
-
-AM_CONFIG_HEADER([config.h])
-
-AM_INIT_AUTOMAKE(libvorbisidec,1.2.0)
-
-dnl Library versioning
-
-V_LIB_CURRENT=1
-V_LIB_REVISION=2
-V_LIB_AGE=0
-AC_SUBST(V_LIB_CURRENT)
-AC_SUBST(V_LIB_REVISION)
-AC_SUBST(V_LIB_AGE)
-
-dnl --------------------------------------------------  
-dnl Check for programs
-dnl --------------------------------------------------  
-
-dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
-dnl if $CFLAGS is blank
-cflags_save="$CFLAGS"
-AC_PROG_CC
-AC_PROG_CPP
-CFLAGS="$cflags_save"
-
-AM_PROG_LIBTOOL
-
-dnl --------------------------------------------------
-dnl Set build flags based on environment
-dnl --------------------------------------------------
-
-dnl Set some target options
-
-cflags_save="$CFLAGS"
-ldflags_save="$LDFLAGS"
-if test -z "$GCC"; then
-        case $host in 
-        arm-*-*)
-                DEBUG="-g -D_ARM_ASSEM_" 
-                CFLAGS="-O -D_ARM_ASSEM_"
-                PROFILE="-p -g -O -D_ARM_ASSEM_" ;;
-        *)
-                DEBUG="-g"
-                CFLAGS="-O"
-                PROFILE="-g -p" ;;
-        esac
-else
-
-        case $host in 
-        arm-*-*)
-                DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -D_ARM_ASSEM_"
-                CFLAGS="-O2 -D_ARM_ASSEM_ -fsigned-char"
-                PROFILE="-W -pg -g -O2 -D_ARM_ASSEM_ -fsigned-char -fno-inline-functions";;
-
-        *)
-                DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
-                CFLAGS="-O2 -Wall -fsigned-char"
-                PROFILE="-Wall -pg -g -O2 -fsigned-char -fno-inline-functions";;
-        esac
-fi
-CFLAGS="$CFLAGS $cflags_save -D_REENTRANT"
-LDFLAGS="$LDFLAGS $ldflags_save"
-
-
-# Test whenever ld supports -version-script
-AC_PROG_LD
-AC_PROG_LD_GNU
-if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
-   SHLIB_VERSION_ARG="Wl,--version-script=Version_script"
-
-   dnl Set extra linker options
-   case "$target_os" in
-  linux* | solaris* )
-    SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
-    ;;
-  *)
-    ;;
-   esac
-   LDFLAGS="$LDFLAGS $SHLIB_VERSION_ARG"
-fi
-
-dnl --------------------------------------------------
-dnl Options 
-dnl --------------------------------------------------
-
-AC_ARG_ENABLE(
-   low-accuracy,
-   [  --enable-low-accuracy   enable 32 bit only multiply operations],
-   CFLAGS="$CFLAGS -D_LOW_ACCURACY_"
-)
-
-dnl --------------------------------------------------
-dnl Check for headers
-dnl --------------------------------------------------
-
-AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
-
-dnl --------------------------------------------------
-dnl Check for typedefs, structures, etc
-dnl --------------------------------------------------
-
-dnl none
-
-dnl --------------------------------------------------
-dnl Check for library functions
-dnl --------------------------------------------------
-
-AC_FUNC_ALLOCA
-AC_FUNC_MEMCMP
-
-dnl --------------------------------------------------
-dnl Do substitutions
-dnl --------------------------------------------------
-
-LIBS="$LIBS"
-
-AC_SUBST(LIBS)
-AC_SUBST(DEBUG)
-AC_SUBST(PROFILE)
-
-AC_OUTPUT(Makefile Version_script)
--- a/misc/libtremor/floor0.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,435 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: floor backend 0 implementation
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-#include "registry.h"
-#include "codebook.h"
-#include "misc.h"
-#include "block.h"
-
-#define LSP_FRACBITS 14
-
-typedef struct {
-  long n;
-  int ln;
-  int  m;
-  int *linearmap;
-
-  vorbis_info_floor0 *vi;
-  ogg_int32_t *lsp_look;
-
-} vorbis_look_floor0;
-
-/*************** LSP decode ********************/
-
-#include "lsp_lookup.h"
-
-/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in
-   16.16 format 
-   returns in m.8 format */
-
-static long ADJUST_SQRT2[2]={8192,5792};
-STIN ogg_int32_t vorbis_invsqlook_i(long a,long e){
-  long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1); 
-  long d=a&INVSQ_LOOKUP_I_MASK;                              /*  0.10 */
-  long val=INVSQ_LOOKUP_I[i]-                                /*  1.16 */
-    ((INVSQ_LOOKUP_IDel[i]*d)>>INVSQ_LOOKUP_I_SHIFT);        /* result 1.16 */
-  val*=ADJUST_SQRT2[e&1];
-  e=(e>>1)+21;
-  return(val>>e);
-}
-
-/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
-/* a is in n.12 format */
-STIN ogg_int32_t vorbis_fromdBlook_i(long a){
-  int i=(-a)>>(12-FROMdB2_SHIFT);
-  if(i<0) return 0x7fffffff;
-  if(i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))return 0;
-  
-  return FROMdB_LOOKUP[i>>FROMdB_SHIFT] * FROMdB2_LOOKUP[i&FROMdB2_MASK];
-}
-
-/* interpolated lookup based cos function, domain 0 to PI only */
-/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */
-STIN ogg_int32_t vorbis_coslook_i(long a){
-  int i=a>>COS_LOOKUP_I_SHIFT;
-  int d=a&COS_LOOKUP_I_MASK;
-  return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
-			   COS_LOOKUP_I_SHIFT);
-}
-
-/* interpolated lookup based cos function */
-/* a is in 0.16 format, where 0==0, 2^^16==PI, return .LSP_FRACBITS */
-STIN ogg_int32_t vorbis_coslook2_i(long a){
-  a=a&0x1ffff;
-
-  if(a>0x10000)a=0x20000-a;
-  {               
-    int i=a>>COS_LOOKUP_I_SHIFT;
-    int d=a&COS_LOOKUP_I_MASK;
-    a=((COS_LOOKUP_I[i]<<COS_LOOKUP_I_SHIFT)-
-       d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
-      (COS_LOOKUP_I_SHIFT-LSP_FRACBITS+14);
-  }
-  
-  return(a);
-}
-
-static const int barklook[28]={
-  0,100,200,301,          405,516,635,766,
-  912,1077,1263,1476,     1720,2003,2333,2721,
-  3184,3742,4428,5285,    6376,7791,9662,12181,
-  15624,20397,27087,36554
-};
-
-/* used in init only; interpolate the long way */
-STIN ogg_int32_t toBARK(int n){
-  int i;
-  for(i=0;i<27;i++) 
-    if(n>=barklook[i] && n<barklook[i+1])break;
-  
-  if(i==27){
-    return 27<<15;
-  }else{
-    int gap=barklook[i+1]-barklook[i];
-    int del=n-barklook[i];
-
-    return((i<<15)+((del<<15)/gap));
-  }
-}
-
-static const unsigned char MLOOP_1[64]={
-   0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
-  14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
-  15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
-  15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
-};
-
-static const unsigned char MLOOP_2[64]={
-  0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
-  8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
-  9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
-  9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
-};
-
-static const unsigned char MLOOP_3[8]={0,1,2,2,3,3,3,3};
-
-void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
-			 ogg_int32_t *lsp,int m,
-			 ogg_int32_t amp,
-			 ogg_int32_t ampoffset,
-			 ogg_int32_t *icos){
-
-  /* 0 <= m < 256 */
-
-  /* set up for using all int later */
-  int i;
-  int ampoffseti=ampoffset*4096;
-  int ampi=amp;
-  ogg_int32_t *ilsp=(ogg_int32_t *)alloca(m*sizeof(*ilsp));
-  /* lsp is in 8.24, range 0 to PI; coslook wants it in .16 0 to 1*/
-  for(i=0;i<m;i++){
-#ifndef _LOW_ACCURACY_
-    ogg_int32_t val=MULT32(lsp[i],0x517cc2);
-#else
-    ogg_int32_t val=((lsp[i]>>10)*0x517d)>>14;
-#endif
-
-    /* safeguard against a malicious stream */
-    if(val<0 || (val>>COS_LOOKUP_I_SHIFT)>=COS_LOOKUP_I_SZ){
-      memset(curve,0,sizeof(*curve)*n);
-      return;
-    }
-
-    ilsp[i]=vorbis_coslook_i(val);
-  }
-
-  i=0;
-  while(i<n){
-    int j,k=map[i];
-    ogg_uint32_t pi=46341; /* 2**-.5 in 0.16 */
-    ogg_uint32_t qi=46341;
-    ogg_int32_t qexp=0,shift;
-    ogg_int32_t wi=icos[k];
-
-#ifdef _V_LSP_MATH_ASM
-    lsp_loop_asm(&qi,&pi,&qexp,ilsp,wi,m);
-
-    pi=((pi*pi)>>16);
-    qi=((qi*qi)>>16);
-    
-    if(m&1){
-      qexp= qexp*2-28*((m+1)>>1)+m;	     
-      pi*=(1<<14)-((wi*wi)>>14);
-      qi+=pi>>14;     
-    }else{
-      qexp= qexp*2-13*m;
-      
-      pi*=(1<<14)-wi;
-      qi*=(1<<14)+wi;
-      
-      qi=(qi+pi)>>14;
-    }
-    
-    if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
-      qi>>=1; qexp++; 
-    }else
-      lsp_norm_asm(&qi,&qexp);
-
-#else
-
-    qi*=labs(ilsp[0]-wi);
-    pi*=labs(ilsp[1]-wi);
-
-    for(j=3;j<m;j+=2){
-      if(!(shift=MLOOP_1[(pi|qi)>>25]))
-	if(!(shift=MLOOP_2[(pi|qi)>>19]))
-	  shift=MLOOP_3[(pi|qi)>>16];
-      qi=(qi>>shift)*labs(ilsp[j-1]-wi);
-      pi=(pi>>shift)*labs(ilsp[j]-wi);
-      qexp+=shift;
-    }
-    if(!(shift=MLOOP_1[(pi|qi)>>25]))
-      if(!(shift=MLOOP_2[(pi|qi)>>19]))
-	shift=MLOOP_3[(pi|qi)>>16];
-
-    /* pi,qi normalized collectively, both tracked using qexp */
-
-    if(m&1){
-      /* odd order filter; slightly assymetric */
-      /* the last coefficient */
-      qi=(qi>>shift)*labs(ilsp[j-1]-wi);
-      pi=(pi>>shift)<<14;
-      qexp+=shift;
-
-      if(!(shift=MLOOP_1[(pi|qi)>>25]))
-	if(!(shift=MLOOP_2[(pi|qi)>>19]))
-	  shift=MLOOP_3[(pi|qi)>>16];
-      
-      pi>>=shift;
-      qi>>=shift;
-      qexp+=shift-14*((m+1)>>1);
-
-      pi=((pi*pi)>>16);
-      qi=((qi*qi)>>16);
-      qexp=qexp*2+m;
-
-      pi*=(1<<14)-((wi*wi)>>14);
-      qi+=pi>>14;
-
-    }else{
-      /* even order filter; still symmetric */
-
-      /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
-	 worth tracking step by step */
-      
-      pi>>=shift;
-      qi>>=shift;
-      qexp+=shift-7*m;
-
-      pi=((pi*pi)>>16);
-      qi=((qi*qi)>>16);
-      qexp=qexp*2+m;
-      
-      pi*=(1<<14)-wi;
-      qi*=(1<<14)+wi;
-      qi=(qi+pi)>>14;
-      
-    }
-    
-
-    /* we've let the normalization drift because it wasn't important;
-       however, for the lookup, things must be normalized again.  We
-       need at most one right shift or a number of left shifts */
-
-    if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
-      qi>>=1; qexp++; 
-    }else
-      while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
-	qi<<=1; qexp--; 
-      }
-
-#endif
-
-    amp=vorbis_fromdBlook_i(ampi*                     /*  n.4         */
-			    vorbis_invsqlook_i(qi,qexp)- 
-			                              /*  m.8, m+n<=8 */
-			    ampoffseti);              /*  8.12[0]     */
-    
-#ifdef _LOW_ACCURACY_
-    amp>>=9;
-#endif
-    curve[i]= MULT31_SHIFT15(curve[i],amp);
-    while(map[++i]==k) curve[i]= MULT31_SHIFT15(curve[i],amp);
-  }
-}
-
-/*************** vorbis decode glue ************/
-
-static void floor0_free_info(vorbis_info_floor *i){
-  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
-  if(info){
-    memset(info,0,sizeof(*info));
-    _ogg_free(info);
-  }
-}
-
-static void floor0_free_look(vorbis_look_floor *i){
-  vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
-  if(look){
-
-    if(look->linearmap)_ogg_free(look->linearmap);
-    if(look->lsp_look)_ogg_free(look->lsp_look);
-    memset(look,0,sizeof(*look));
-    _ogg_free(look);
-  }
-}
-
-static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  int j;
-
-  vorbis_info_floor0 *info=(vorbis_info_floor0 *)_ogg_malloc(sizeof(*info));
-  info->order=oggpack_read(opb,8);
-  info->rate=oggpack_read(opb,16);
-  info->barkmap=oggpack_read(opb,16);
-  info->ampbits=oggpack_read(opb,6);
-  info->ampdB=oggpack_read(opb,8);
-  info->numbooks=oggpack_read(opb,4)+1;
-  
-  if(info->order<1)goto err_out;
-  if(info->rate<1)goto err_out;
-  if(info->barkmap<1)goto err_out;
-  if(info->numbooks<1)goto err_out;
-    
-  for(j=0;j<info->numbooks;j++){
-    info->books[j]=oggpack_read(opb,8);
-    if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
-  }
-  return(info);
-
- err_out:
-  floor0_free_info(info);
-  return(NULL);
-}
-
-/* initialize Bark scale and normalization lookups.  We could do this
-   with static tables, but Vorbis allows a number of possible
-   combinations, so it's best to do it computationally.
-
-   The below is authoritative in terms of defining scale mapping.
-   Note that the scale depends on the sampling rate as well as the
-   linear block and mapping sizes */
-
-static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
-                              vorbis_info_floor *i){
-  int j;
-  vorbis_info        *vi=vd->vi;
-  codec_setup_info   *ci=(codec_setup_info *)vi->codec_setup;
-  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
-  vorbis_look_floor0 *look=(vorbis_look_floor0 *)_ogg_calloc(1,sizeof(*look));
-  look->m=info->order;
-  look->n=ci->blocksizes[mi->blockflag]/2;
-  look->ln=info->barkmap;
-  look->vi=info;
-
-  /* the mapping from a linear scale to a smaller bark scale is
-     straightforward.  We do *not* make sure that the linear mapping
-     does not skip bark-scale bins; the decoder simply skips them and
-     the encoder may do what it wishes in filling them.  They're
-     necessary in some mapping combinations to keep the scale spacing
-     accurate */
-  look->linearmap=(int *)_ogg_malloc((look->n+1)*sizeof(*look->linearmap));
-  for(j=0;j<look->n;j++){
-
-    int val=(look->ln*
-	     ((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11;
-
-    if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
-    look->linearmap[j]=val;
-  }
-  look->linearmap[j]=-1;
-
-  look->lsp_look=(ogg_int32_t *)_ogg_malloc(look->ln*sizeof(*look->lsp_look));
-  for(j=0;j<look->ln;j++)
-    look->lsp_look[j]=vorbis_coslook2_i(0x10000*j/look->ln);
-
-  return look;
-}
-
-static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
-  vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
-  vorbis_info_floor0 *info=look->vi;
-  int j,k;
-  
-  int ampraw=oggpack_read(&vb->opb,info->ampbits);
-  if(ampraw>0){ /* also handles the -1 out of data case */
-    long maxval=(1<<info->ampbits)-1;
-    int amp=((ampraw*info->ampdB)<<4)/maxval;
-    int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
-    
-    if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
-      codec_setup_info  *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
-      codebook *b=ci->fullbooks+info->books[booknum];
-      ogg_int32_t last=0;
-      ogg_int32_t *lsp=(ogg_int32_t *)_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+1));
-            
-      for(j=0;j<look->m;j+=b->dim)
-	if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop;
-      for(j=0;j<look->m;){
-	for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
-	last=lsp[j-1];
-      }
-      
-      lsp[look->m]=amp;
-      return(lsp);
-    }
-  }
- eop:
-  return(NULL);
-}
-
-static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
-			   void *memo,ogg_int32_t *out){
-  vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
-  vorbis_info_floor0 *info=look->vi;
-  
-  if(memo){
-    ogg_int32_t *lsp=(ogg_int32_t *)memo;
-    ogg_int32_t amp=lsp[look->m];
-
-    /* take the coefficients back to a spectral envelope curve */
-    vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
-			lsp,look->m,amp,info->ampdB,look->lsp_look);
-    return(1);
-  }
-  memset(out,0,sizeof(*out)*look->n);
-  return(0);
-}
-
-/* export hooks */
-vorbis_func_floor floor0_exportbundle={
-  &floor0_unpack,&floor0_look,&floor0_free_info,
-  &floor0_free_look,&floor0_inverse1,&floor0_inverse2
-};
-
-
--- a/misc/libtremor/floor1.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,441 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: floor backend 1 implementation
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-#include "registry.h"
-#include "codebook.h"
-#include "misc.h"
-#include "block.h"
-
-#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
-
-typedef struct {
-  int forward_index[VIF_POSIT+2];
-  
-  int hineighbor[VIF_POSIT];
-  int loneighbor[VIF_POSIT];
-  int posts;
-
-  int n;
-  int quant_q;
-  vorbis_info_floor1 *vi;
-
-} vorbis_look_floor1;
-
-/***********************************************/
- 
-static void floor1_free_info(vorbis_info_floor *i){
-  vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
-  if(info){
-    memset(info,0,sizeof(*info));
-    _ogg_free(info);
-  }
-}
-
-static void floor1_free_look(vorbis_look_floor *i){
-  vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
-  if(look){
-    memset(look,0,sizeof(*look));
-    _ogg_free(look);
-  }
-}
-
-static int ilog(unsigned int v){
-  int ret=0;
-  while(v){
-    ret++;
-    v>>=1;
-  }
-  return(ret);
-}
-
-static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  int j,k,count=0,maxclass=-1,rangebits;
-
-  vorbis_info_floor1 *info=(vorbis_info_floor1 *)_ogg_calloc(1,sizeof(*info));
-  /* read partitions */
-  info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
-  for(j=0;j<info->partitions;j++){
-    info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */
-    if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
-  }
-
-  /* read partition classes */
-  for(j=0;j<maxclass+1;j++){
-    info->class_dim[j]=oggpack_read(opb,3)+1; /* 1 to 8 */
-    info->class_subs[j]=oggpack_read(opb,2); /* 0,1,2,3 bits */
-    if(info->class_subs[j]<0)
-      goto err_out;
-    if(info->class_subs[j])info->class_book[j]=oggpack_read(opb,8);
-    if(info->class_book[j]<0 || info->class_book[j]>=ci->books)
-      goto err_out;
-    for(k=0;k<(1<<info->class_subs[j]);k++){
-      info->class_subbook[j][k]=oggpack_read(opb,8)-1;
-      if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books)
-	goto err_out;
-    }
-  }
-
-  /* read the post list */
-  info->mult=oggpack_read(opb,2)+1;     /* only 1,2,3,4 legal now */ 
-  rangebits=oggpack_read(opb,4);
-
-  for(j=0,k=0;j<info->partitions;j++){
-    count+=info->class_dim[info->partitionclass[j]]; 
-    for(;k<count;k++){
-      int t=info->postlist[k+2]=oggpack_read(opb,rangebits);
-      if(t<0 || t>=(1<<rangebits))
-	goto err_out;
-    }
-  }
-  info->postlist[0]=0;
-  info->postlist[1]=1<<rangebits;
-
-  return(info);
-  
- err_out:
-  floor1_free_info(info);
-  return(NULL);
-}
-
-static int icomp(const void *a,const void *b){
-  return(**(int **)a-**(int **)b);
-}
-
-static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi,
-                              vorbis_info_floor *in){
-
-  int *sortpointer[VIF_POSIT+2];
-  vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
-  vorbis_look_floor1 *look=(vorbis_look_floor1 *)_ogg_calloc(1,sizeof(*look));
-  int i,j,n=0;
-
-  look->vi=info;
-  look->n=info->postlist[1];
- 
-  /* we drop each position value in-between already decoded values,
-     and use linear interpolation to predict each new value past the
-     edges.  The positions are read in the order of the position
-     list... we precompute the bounding positions in the lookup.  Of
-     course, the neighbors can change (if a position is declined), but
-     this is an initial mapping */
-
-  for(i=0;i<info->partitions;i++)n+=info->class_dim[info->partitionclass[i]];
-  n+=2;
-  look->posts=n;
-
-  /* also store a sorted position index */
-  for(i=0;i<n;i++)sortpointer[i]=info->postlist+i;
-  qsort(sortpointer,n,sizeof(*sortpointer),icomp);
-
-  /* points from sort order back to range number */
-  for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist;
-  
-  /* quantize values to multiplier spec */
-  switch(info->mult){
-  case 1: /* 1024 -> 256 */
-    look->quant_q=256;
-    break;
-  case 2: /* 1024 -> 128 */
-    look->quant_q=128;
-    break;
-  case 3: /* 1024 -> 86 */
-    look->quant_q=86;
-    break;
-  case 4: /* 1024 -> 64 */
-    look->quant_q=64;
-    break;
-  }
-
-  /* discover our neighbors for decode where we don't use fit flags
-     (that would push the neighbors outward) */
-  for(i=0;i<n-2;i++){
-    int lo=0;
-    int hi=1;
-    int lx=0;
-    int hx=look->n;
-    int currentx=info->postlist[i+2];
-    for(j=0;j<i+2;j++){
-      int x=info->postlist[j];
-      if(x>lx && x<currentx){
-	lo=j;
-	lx=x;
-      }
-      if(x<hx && x>currentx){
-	hi=j;
-	hx=x;
-      }
-    }
-    look->loneighbor[i]=lo;
-    look->hineighbor[i]=hi;
-  }
-
-  return(look);
-}
-
-static int render_point(int x0,int x1,int y0,int y1,int x){
-  y0&=0x7fff; /* mask off flag */
-  y1&=0x7fff;
-    
-  {
-    int dy=y1-y0;
-    int adx=x1-x0;
-    int ady=abs(dy);
-    int err=ady*(x-x0);
-    
-    int off=err/adx;
-    if(dy<0)return(y0-off);
-    return(y0+off);
-  }
-}
-
-#ifdef _LOW_ACCURACY_
-#  define XdB(n) ((((n)>>8)+1)>>1)
-#else
-#  define XdB(n) (n)
-#endif
-
-static const ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
-  XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),
-  XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),
-  XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),
-  XdB(0x000001e7), XdB(0x00000206), XdB(0x00000228), XdB(0x0000024c),
-  XdB(0x00000272), XdB(0x0000029b), XdB(0x000002c6), XdB(0x000002f4),
-  XdB(0x00000326), XdB(0x0000035a), XdB(0x00000392), XdB(0x000003cd),
-  XdB(0x0000040c), XdB(0x00000450), XdB(0x00000497), XdB(0x000004e4),
-  XdB(0x00000535), XdB(0x0000058c), XdB(0x000005e8), XdB(0x0000064a),
-  XdB(0x000006b3), XdB(0x00000722), XdB(0x00000799), XdB(0x00000818),
-  XdB(0x0000089e), XdB(0x0000092e), XdB(0x000009c6), XdB(0x00000a69),
-  XdB(0x00000b16), XdB(0x00000bcf), XdB(0x00000c93), XdB(0x00000d64),
-  XdB(0x00000e43), XdB(0x00000f30), XdB(0x0000102d), XdB(0x0000113a),
-  XdB(0x00001258), XdB(0x0000138a), XdB(0x000014cf), XdB(0x00001629),
-  XdB(0x0000179a), XdB(0x00001922), XdB(0x00001ac4), XdB(0x00001c82),
-  XdB(0x00001e5c), XdB(0x00002055), XdB(0x0000226f), XdB(0x000024ac),
-  XdB(0x0000270e), XdB(0x00002997), XdB(0x00002c4b), XdB(0x00002f2c),
-  XdB(0x0000323d), XdB(0x00003581), XdB(0x000038fb), XdB(0x00003caf),
-  XdB(0x000040a0), XdB(0x000044d3), XdB(0x0000494c), XdB(0x00004e10),
-  XdB(0x00005323), XdB(0x0000588a), XdB(0x00005e4b), XdB(0x0000646b),
-  XdB(0x00006af2), XdB(0x000071e5), XdB(0x0000794c), XdB(0x0000812e),
-  XdB(0x00008993), XdB(0x00009283), XdB(0x00009c09), XdB(0x0000a62d),
-  XdB(0x0000b0f9), XdB(0x0000bc79), XdB(0x0000c8b9), XdB(0x0000d5c4),
-  XdB(0x0000e3a9), XdB(0x0000f274), XdB(0x00010235), XdB(0x000112fd),
-  XdB(0x000124dc), XdB(0x000137e4), XdB(0x00014c29), XdB(0x000161bf),
-  XdB(0x000178bc), XdB(0x00019137), XdB(0x0001ab4a), XdB(0x0001c70e),
-  XdB(0x0001e4a1), XdB(0x0002041f), XdB(0x000225aa), XdB(0x00024962),
-  XdB(0x00026f6d), XdB(0x000297f0), XdB(0x0002c316), XdB(0x0002f109),
-  XdB(0x000321f9), XdB(0x00035616), XdB(0x00038d97), XdB(0x0003c8b4),
-  XdB(0x000407a7), XdB(0x00044ab2), XdB(0x00049218), XdB(0x0004de23),
-  XdB(0x00052f1e), XdB(0x0005855c), XdB(0x0005e135), XdB(0x00064306),
-  XdB(0x0006ab33), XdB(0x00071a24), XdB(0x0007904b), XdB(0x00080e20),
-  XdB(0x00089422), XdB(0x000922da), XdB(0x0009bad8), XdB(0x000a5cb6),
-  XdB(0x000b091a), XdB(0x000bc0b1), XdB(0x000c8436), XdB(0x000d5471),
-  XdB(0x000e3233), XdB(0x000f1e5f), XdB(0x001019e4), XdB(0x001125c1),
-  XdB(0x00124306), XdB(0x001372d5), XdB(0x0014b663), XdB(0x00160ef7),
-  XdB(0x00177df0), XdB(0x001904c1), XdB(0x001aa4f9), XdB(0x001c603d),
-  XdB(0x001e384f), XdB(0x00202f0f), XdB(0x0022467a), XdB(0x002480b1),
-  XdB(0x0026dff7), XdB(0x002966b3), XdB(0x002c1776), XdB(0x002ef4fc),
-  XdB(0x0032022d), XdB(0x00354222), XdB(0x0038b828), XdB(0x003c67c2),
-  XdB(0x004054ae), XdB(0x004482e8), XdB(0x0048f6af), XdB(0x004db488),
-  XdB(0x0052c142), XdB(0x005821ff), XdB(0x005ddc33), XdB(0x0063f5b0),
-  XdB(0x006a74a7), XdB(0x00715faf), XdB(0x0078bdce), XdB(0x0080967f),
-  XdB(0x0088f1ba), XdB(0x0091d7f9), XdB(0x009b5247), XdB(0x00a56a41),
-  XdB(0x00b02a27), XdB(0x00bb9ce2), XdB(0x00c7ce12), XdB(0x00d4ca17),
-  XdB(0x00e29e20), XdB(0x00f15835), XdB(0x0101074b), XdB(0x0111bb4e),
-  XdB(0x01238531), XdB(0x01367704), XdB(0x014aa402), XdB(0x016020a7),
-  XdB(0x017702c3), XdB(0x018f6190), XdB(0x01a955cb), XdB(0x01c4f9cf),
-  XdB(0x01e269a8), XdB(0x0201c33b), XdB(0x0223265a), XdB(0x0246b4ea),
-  XdB(0x026c9302), XdB(0x0294e716), XdB(0x02bfda13), XdB(0x02ed9793),
-  XdB(0x031e4e09), XdB(0x03522ee4), XdB(0x03896ed0), XdB(0x03c445e2),
-  XdB(0x0402efd6), XdB(0x0445ac4b), XdB(0x048cbefc), XdB(0x04d87013),
-  XdB(0x05290c67), XdB(0x057ee5ca), XdB(0x05da5364), XdB(0x063bb204),
-  XdB(0x06a36485), XdB(0x0711d42b), XdB(0x0787710e), XdB(0x0804b299),
-  XdB(0x088a17ef), XdB(0x0918287e), XdB(0x09af747c), XdB(0x0a50957e),
-  XdB(0x0afc2f19), XdB(0x0bb2ef7f), XdB(0x0c759034), XdB(0x0d44d6ca),
-  XdB(0x0e2195bc), XdB(0x0f0cad0d), XdB(0x10070b62), XdB(0x1111aeea),
-  XdB(0x122da66c), XdB(0x135c120f), XdB(0x149e24d9), XdB(0x15f525b1),
-  XdB(0x176270e3), XdB(0x18e7794b), XdB(0x1a85c9ae), XdB(0x1c3f06d1),
-  XdB(0x1e14f07d), XdB(0x200963d7), XdB(0x221e5ccd), XdB(0x2455f870),
-  XdB(0x26b2770b), XdB(0x29363e2b), XdB(0x2be3db5c), XdB(0x2ebe06b6),
-  XdB(0x31c7a55b), XdB(0x3503ccd4), XdB(0x3875c5aa), XdB(0x3c210f44),
-  XdB(0x4009632b), XdB(0x4432b8cf), XdB(0x48a149bc), XdB(0x4d59959e),
-  XdB(0x52606733), XdB(0x57bad899), XdB(0x5d6e593a), XdB(0x6380b298),
-  XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
-};
-  
-static void render_line(int n, int x0,int x1,int y0,int y1,ogg_int32_t *d){
-  int dy=y1-y0;
-  int adx=x1-x0;
-  int ady=abs(dy);
-  int base=dy/adx;
-  int sy=(dy<0?base-1:base+1);
-  int x=x0;
-  int y=y0;
-  int err=0;
-
-  if(n>x1)n=x1;
-  ady-=abs(base*adx);
-
-  if(x<n)
-    d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);
-
-  while(++x<n){
-    err=err+ady;
-    if(err>=adx){
-      err-=adx;
-      y+=sy;
-    }else{
-      y+=base;
-    }
-    d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);
-  }
-}
-
-static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
-  vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
-  vorbis_info_floor1 *info=look->vi;
-  codec_setup_info   *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
-  
-  int i,j,k;
-  codebook *books=ci->fullbooks;   
-  
-  /* unpack wrapped/predicted values from stream */
-  if(oggpack_read(&vb->opb,1)==1){
-    int *fit_value=(int *)_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value));
-    
-    fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
-    fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
-    
-    /* partition by partition */
-    /* partition by partition */
-    for(i=0,j=2;i<info->partitions;i++){
-      int classv=info->partitionclass[i];
-      int cdim=info->class_dim[classv];
-      int csubbits=info->class_subs[classv];
-      int csub=1<<csubbits;
-      int cval=0;
-
-      /* decode the partition's first stage cascade value */
-      if(csubbits){
-	cval=vorbis_book_decode(books+info->class_book[classv],&vb->opb);
-
-	if(cval==-1)goto eop;
-      }
-
-      for(k=0;k<cdim;k++){
-	int book=info->class_subbook[classv][cval&(csub-1)];
-	cval>>=csubbits;
-	if(book>=0){
-	  if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
-	    goto eop;
-	}else{
-	  fit_value[j+k]=0;
-	}
-      }
-      j+=cdim;
-    }
-
-    /* unwrap positive values and reconsitute via linear interpolation */
-    for(i=2;i<look->posts;i++){
-      int predicted=render_point(info->postlist[look->loneighbor[i-2]],
-				 info->postlist[look->hineighbor[i-2]],
-				 fit_value[look->loneighbor[i-2]],
-				 fit_value[look->hineighbor[i-2]],
-				 info->postlist[i]);
-      int hiroom=look->quant_q-predicted;
-      int loroom=predicted;
-      int room=(hiroom<loroom?hiroom:loroom)<<1;
-      int val=fit_value[i];
-
-      if(val){
-	if(val>=room){
-	  if(hiroom>loroom){
-	    val = val-loroom;
-	  }else{
-	  val = -1-(val-hiroom);
-	  }
-	}else{
-	  if(val&1){
-	    val= -((val+1)>>1);
-	  }else{
-	    val>>=1;
-	  }
-	}
-
-	fit_value[i]=val+predicted;
-	fit_value[look->loneighbor[i-2]]&=0x7fff;
-	fit_value[look->hineighbor[i-2]]&=0x7fff;
-
-      }else{
-	fit_value[i]=predicted|0x8000;
-      }
-	
-    }
-
-    return(fit_value);
-  }
- eop:
-  return(NULL);
-}
-
-static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
-			  ogg_int32_t *out){
-  vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
-  vorbis_info_floor1 *info=look->vi;
-
-  codec_setup_info   *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
-  int                  n=ci->blocksizes[vb->W]/2;
-  int j;
-
-  if(memo){
-    /* render the lines */
-    int *fit_value=(int *)memo;
-    int hx=0;
-    int lx=0;
-    int ly=fit_value[0]*info->mult;
-    for(j=1;j<look->posts;j++){
-      int current=look->forward_index[j];
-      int hy=fit_value[current]&0x7fff;
-      if(hy==fit_value[current]){
-	
-	hy*=info->mult;
-	hx=info->postlist[current];
-	
-	render_line(n,lx,hx,ly,hy,out);
-	
-	lx=hx;
-	ly=hy;
-      }
-    }
-    for(j=hx;j<n;j++)out[j]*=ly; /* be certain */    
-    return(1);
-  }
-  memset(out,0,sizeof(*out)*n);
-  return(0);
-}
-
-/* export hooks */
-vorbis_func_floor floor1_exportbundle={
-  &floor1_unpack,&floor1_look,&floor1_free_info,
-  &floor1_free_look,&floor1_inverse1,&floor1_inverse2
-};
-
--- a/misc/libtremor/framing.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1126 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: decode Ogg streams back into raw packets
-
- note: The CRC code is directly derived from public domain code by
- Ross Williams (ross@guest.adelaide.edu.au).  See docs/framing.html
- for details.
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include "ogg.h"
-#include "misc.h"
-
-
-/* A complete description of Ogg framing exists in docs/framing.html */
-
-/* basic, centralized Ogg memory management based on linked lists of
-   references to refcounted memory buffers.  References and buffers
-   are both recycled.  Buffers are passed around and consumed in
-   reference form. */
-
-static ogg_buffer_state *ogg_buffer_create(void){
-  ogg_buffer_state *bs=_ogg_calloc(1,sizeof(*bs));
-  return bs;
-}
-
-/* destruction is 'lazy'; there may be memory references outstanding,
-   and yanking the buffer state out from underneath would be
-   antisocial.  Dealloc what is currently unused and have
-   _release_one watch for the stragglers to come in.  When they do,
-   finish destruction. */
-
-/* call the helper while holding lock */
-static void _ogg_buffer_destroy(ogg_buffer_state *bs){
-  ogg_buffer *bt;
-  ogg_reference *rt;
-
-  if(bs->shutdown){
-
-    bt=bs->unused_buffers;
-    rt=bs->unused_references;
-
-    while(bt){
-      ogg_buffer *b=bt;
-      bt=b->ptr.next;
-      if(b->data)_ogg_free(b->data);
-      _ogg_free(b);
-    }
-    bs->unused_buffers=0;
-    while(rt){
-      ogg_reference *r=rt;
-      rt=r->next;
-      _ogg_free(r);
-    }
-    bs->unused_references=0;
-
-    if(!bs->outstanding)
-      _ogg_free(bs);
-
-  }
-}
-
-static void ogg_buffer_destroy(ogg_buffer_state *bs){
-  bs->shutdown=1;
-  _ogg_buffer_destroy(bs);
-}
-
-static ogg_buffer *_fetch_buffer(ogg_buffer_state *bs,long bytes){
-  ogg_buffer    *ob;
-  bs->outstanding++;
-
-  /* do we have an unused buffer sitting in the pool? */
-  if(bs->unused_buffers){
-    ob=bs->unused_buffers;
-    bs->unused_buffers=ob->ptr.next;
-
-    /* if the unused buffer is too small, grow it */
-    if(ob->size<bytes){
-      ob->data=_ogg_realloc(ob->data,bytes);
-      ob->size=bytes;
-    }
-  }else{
-    /* allocate a new buffer */
-    ob=_ogg_malloc(sizeof(*ob));
-    ob->data=_ogg_malloc(bytes<16?16:bytes);
-    ob->size=bytes;
-  }
-
-  ob->refcount=1;
-  ob->ptr.owner=bs;
-  return ob;
-}
-
-static ogg_reference *_fetch_ref(ogg_buffer_state *bs){
-  ogg_reference *or;
-  bs->outstanding++;
-
-  /* do we have an unused reference sitting in the pool? */
-  if(bs->unused_references){
-    or=bs->unused_references;
-    bs->unused_references=or->next;
-  }else{
-    /* allocate a new reference */
-    or=_ogg_malloc(sizeof(*or));
-  }
-
-  or->begin=0;
-  or->length=0;
-  or->next=0;
-  return or;
-}
-
-/* fetch a reference pointing to a fresh, initially continguous buffer
-   of at least [bytes] length */
-static ogg_reference *ogg_buffer_alloc(ogg_buffer_state *bs,long bytes){
-  ogg_buffer    *ob=_fetch_buffer(bs,bytes);
-  ogg_reference *or=_fetch_ref(bs);
-  or->buffer=ob;
-  return or;
-}
-
-/* enlarge the data buffer in the current link */
-static void ogg_buffer_realloc(ogg_reference *or,long bytes){
-  ogg_buffer    *ob=or->buffer;
-  
-  /* if the unused buffer is too small, grow it */
-  if(ob->size<bytes){
-    ob->data=_ogg_realloc(ob->data,bytes);
-    ob->size=bytes;
-  }
-}
-
-static void _ogg_buffer_mark_one(ogg_reference *or){
-  or->buffer->refcount++;
-}
-
-/* increase the refcount of the buffers to which the reference points */
-static void ogg_buffer_mark(ogg_reference *or){
-  while(or){
-    _ogg_buffer_mark_one(or);
-    or=or->next;
-  }
-}
-
-/* duplicate a reference (pointing to the same actual buffer memory)
-   and increment buffer refcount.  If the desired segment begins out
-   of range, NULL is returned; if the desired segment is simply zero
-   length, a zero length ref is returned.  Partial range overlap
-   returns the overlap of the ranges */
-static ogg_reference *ogg_buffer_sub(ogg_reference *or,long begin,long length){
-  ogg_reference *ret=0,*head=0;
-
-  /* walk past any preceeding fragments we don't want */
-  while(or && begin>=or->length){
-    begin-=or->length;
-    or=or->next;
-  }
-
-  /* duplicate the reference chain; increment refcounts */
-  while(or && length){
-    ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);
-    if(head)
-      head->next=temp;
-    else
-      ret=temp;
-    head=temp;
-    head->buffer=or->buffer;    
-    head->begin=or->begin+begin;
-    head->length=length;
-    if(head->length>or->length-begin)
-      head->length=or->length-begin;
-    
-    begin=0;
-    length-=head->length;
-    or=or->next;
-  }
-
-  ogg_buffer_mark(ret);
-  return ret;
-}
-
-ogg_reference *ogg_buffer_dup(ogg_reference *or){
-  ogg_reference *ret=0,*head=0;
-  /* duplicate the reference chain; increment refcounts */
-  while(or){
-    ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);
-    if(head)
-      head->next=temp;
-    else
-      ret=temp;
-    head=temp;
-    head->buffer=or->buffer;    
-    head->begin=or->begin;
-    head->length=or->length;
-    or=or->next;
-  }
-
-  ogg_buffer_mark(ret);
-  return ret;
-}
-
-/* split a reference into two references; 'return' is a reference to
-   the buffer preceeding pos and 'head'/'tail' are the buffer past the
-   split.  If pos is at or past the end of the passed in segment,
-   'head/tail' are NULL */
-static ogg_reference *ogg_buffer_split(ogg_reference **tail,
-                                ogg_reference **head,long pos){
-
-  /* walk past any preceeding fragments to one of:
-     a) the exact boundary that seps two fragments
-     b) the fragment that needs split somewhere in the middle */
-  ogg_reference *ret=*tail;
-  ogg_reference *or=*tail;
-
-  while(or && pos>or->length){
-    pos-=or->length;
-    or=or->next;
-  }
-
-  if(!or || pos==0){
-
-    return 0;
-    
-  }else{
-    
-    if(pos>=or->length){
-      /* exact split, or off the end? */
-      if(or->next){
-        
-        /* a split */
-        *tail=or->next;
-        or->next=0;
-        
-      }else{
-        
-        /* off or at the end */
-        *tail=*head=0;
-        
-      }
-    }else{
-      
-      /* split within a fragment */
-      long lengthA=pos;
-      long beginB=or->begin+pos;
-      long lengthB=or->length-pos;
-      
-      /* make a new reference to tail the second piece */
-      *tail=_fetch_ref(or->buffer->ptr.owner);
-      
-      (*tail)->buffer=or->buffer;
-      (*tail)->begin=beginB;
-      (*tail)->length=lengthB;
-      (*tail)->next=or->next;
-      _ogg_buffer_mark_one(*tail);
-      if(head && or==*head)*head=*tail;    
-      
-      /* update the first piece */
-      or->next=0;
-      or->length=lengthA;
-      
-    }
-  }
-  return ret;
-}
-
-static void ogg_buffer_release_one(ogg_reference *or){
-  ogg_buffer *ob=or->buffer;
-  ogg_buffer_state *bs=ob->ptr.owner;
-
-  ob->refcount--;
-  if(ob->refcount==0){
-    bs->outstanding--; /* for the returned buffer */
-    ob->ptr.next=bs->unused_buffers;
-    bs->unused_buffers=ob;
-  }
-  
-  bs->outstanding--; /* for the returned reference */
-  or->next=bs->unused_references;
-  bs->unused_references=or;
-
-  _ogg_buffer_destroy(bs); /* lazy cleanup (if needed) */
-
-}
-
-/* release the references, decrease the refcounts of buffers to which
-   they point, release any buffers with a refcount that drops to zero */
-static void ogg_buffer_release(ogg_reference *or){
-  while(or){
-    ogg_reference *next=or->next;
-    ogg_buffer_release_one(or);
-    or=next;
-  }
-}
-
-static ogg_reference *ogg_buffer_pretruncate(ogg_reference *or,long pos){
-  /* release preceeding fragments we don't want */
-  while(or && pos>=or->length){
-    ogg_reference *next=or->next;
-    pos-=or->length;
-    ogg_buffer_release_one(or);
-    or=next;
-  }
-  if (or) {
-    or->begin+=pos;
-    or->length-=pos;
-  }
-  return or;
-}
-
-static ogg_reference *ogg_buffer_walk(ogg_reference *or){
-  if(!or)return NULL;
-  while(or->next){
-    or=or->next;
-  }
-  return(or);
-}
-
-/* *head is appended to the front end (head) of *tail; both continue to
-   be valid pointers, with *tail at the tail and *head at the head */
-static ogg_reference *ogg_buffer_cat(ogg_reference *tail, ogg_reference *head){
-  if(!tail)return head;
-
-  while(tail->next){
-    tail=tail->next;
-  }
-  tail->next=head;
-  return ogg_buffer_walk(head);
-}
-
-static void _positionB(oggbyte_buffer *b,int pos){
-  if(pos<b->pos){
-    /* start at beginning, scan forward */
-    b->ref=b->baseref;
-    b->pos=0;
-    b->end=b->pos+b->ref->length;
-    b->ptr=b->ref->buffer->data+b->ref->begin;
-  }
-}
-
-static void _positionF(oggbyte_buffer *b,int pos){
-  /* scan forward for position */
-  while(pos>=b->end){
-    /* just seek forward */
-    b->pos+=b->ref->length;
-    b->ref=b->ref->next;
-    b->end=b->ref->length+b->pos;
-    b->ptr=b->ref->buffer->data+b->ref->begin;
-  }
-}
-
-static int oggbyte_init(oggbyte_buffer *b,ogg_reference *or){
-  memset(b,0,sizeof(*b));
-  if(or){
-    b->ref=b->baseref=or;
-    b->pos=0;
-    b->end=b->ref->length;
-    b->ptr=b->ref->buffer->data+b->ref->begin;  
-    return 0;
-  }else
-    return -1;
-}
-
-static void oggbyte_set4(oggbyte_buffer *b,ogg_uint32_t val,int pos){
-  int i;
-  _positionB(b,pos);
-  for(i=0;i<4;i++){
-    _positionF(b,pos);
-    b->ptr[pos-b->pos]=val;
-    val>>=8;
-    ++pos;
-  }
-}
- 
-static unsigned char oggbyte_read1(oggbyte_buffer *b,int pos){
-  _positionB(b,pos);
-  _positionF(b,pos);
-  return b->ptr[pos-b->pos];
-}
-
-static ogg_uint32_t oggbyte_read4(oggbyte_buffer *b,int pos){
-  ogg_uint32_t ret;
-  _positionB(b,pos);
-  _positionF(b,pos);
-  ret=b->ptr[pos-b->pos];
-  _positionF(b,++pos);
-  ret|=b->ptr[pos-b->pos]<<8;
-  _positionF(b,++pos);
-  ret|=b->ptr[pos-b->pos]<<16;
-  _positionF(b,++pos);
-  ret|=b->ptr[pos-b->pos]<<24;
-  return ret;
-}
-
-static ogg_int64_t oggbyte_read8(oggbyte_buffer *b,int pos){
-  ogg_int64_t ret;
-  unsigned char t[7];
-  int i;
-  _positionB(b,pos);
-  for(i=0;i<7;i++){
-    _positionF(b,pos);
-    t[i]=b->ptr[pos++ -b->pos];
-  }
-
-  _positionF(b,pos);
-  ret=b->ptr[pos-b->pos];
-
-  for(i=6;i>=0;--i)
-    ret= ret<<8 | t[i];
-
-  return ret;
-}
-
-/* Now we get to the actual framing code */
-
-int ogg_page_version(ogg_page *og){
-  oggbyte_buffer ob;
-  oggbyte_init(&ob,og->header);
-  return oggbyte_read1(&ob,4);
-}
-
-int ogg_page_continued(ogg_page *og){
-  oggbyte_buffer ob;
-  oggbyte_init(&ob,og->header);
-  return oggbyte_read1(&ob,5)&0x01;
-}
-
-int ogg_page_bos(ogg_page *og){
-  oggbyte_buffer ob;
-  oggbyte_init(&ob,og->header);
-  return oggbyte_read1(&ob,5)&0x02;
-}
-
-int ogg_page_eos(ogg_page *og){
-  oggbyte_buffer ob;
-  oggbyte_init(&ob,og->header);
-  return oggbyte_read1(&ob,5)&0x04;
-}
-
-ogg_int64_t ogg_page_granulepos(ogg_page *og){
-  oggbyte_buffer ob;
-  oggbyte_init(&ob,og->header);
-  return oggbyte_read8(&ob,6);
-}
-
-ogg_uint32_t ogg_page_serialno(ogg_page *og){
-  oggbyte_buffer ob;
-  oggbyte_init(&ob,og->header);
-  return oggbyte_read4(&ob,14);
-}
- 
-ogg_uint32_t ogg_page_pageno(ogg_page *og){
-  oggbyte_buffer ob;
-  oggbyte_init(&ob,og->header);
-  return oggbyte_read4(&ob,18);
-}
-
-/* returns the number of packets that are completed on this page (if
-   the leading packet is begun on a previous page, but ends on this
-   page, it's counted */
-
-/* NOTE:
-If a page consists of a packet begun on a previous page, and a new
-packet begun (but not completed) on this page, the return will be:
-  ogg_page_packets(page)   ==1, 
-  ogg_page_continued(page) !=0
-
-If a page happens to be a single packet that was begun on a
-previous page, and spans to the next page (in the case of a three or
-more page packet), the return will be: 
-  ogg_page_packets(page)   ==0, 
-  ogg_page_continued(page) !=0
-*/
-
-int ogg_page_packets(ogg_page *og){
-  int i;
-  int n;
-  int count=0;
-  oggbyte_buffer ob;
-  oggbyte_init(&ob,og->header);
-
-  n=oggbyte_read1(&ob,26);
-  for(i=0;i<n;i++)
-    if(oggbyte_read1(&ob,27+i)<255)count++;
-  return(count);
-}
-
-/* Static CRC calculation table.  See older code in CVS for dead
-   run-time initialization code. */
-
-static ogg_uint32_t crc_lookup[256]={
-  0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
-  0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
-  0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
-  0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd,
-  0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,
-  0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75,
-  0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,
-  0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd,
-  0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,
-  0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5,
-  0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,
-  0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d,
-  0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,
-  0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95,
-  0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,
-  0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d,
-  0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,
-  0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072,
-  0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,
-  0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca,
-  0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,
-  0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02,
-  0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,
-  0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba,
-  0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,
-  0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692,
-  0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,
-  0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a,
-  0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,
-  0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2,
-  0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,
-  0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a,
-  0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,
-  0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb,
-  0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,
-  0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53,
-  0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,
-  0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b,
-  0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,
-  0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623,
-  0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,
-  0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b,
-  0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,
-  0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3,
-  0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,
-  0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b,
-  0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,
-  0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3,
-  0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,
-  0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c,
-  0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,
-  0x68860bfd,0x6c47164a,0x61043093,0x65c52d24,
-  0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,
-  0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec,
-  0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,
-  0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654,
-  0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,
-  0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c,
-  0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,
-  0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4,
-  0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,
-  0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c,
-  0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,
-  0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};
-
-ogg_sync_state *ogg_sync_create(void){
-  ogg_sync_state *oy=_ogg_calloc(1,sizeof(*oy));
-  memset(oy,0,sizeof(*oy));
-  oy->bufferpool=ogg_buffer_create();
-  return oy;
-}
-
-int ogg_sync_destroy(ogg_sync_state *oy){
-  if(oy){
-    ogg_sync_reset(oy);
-    ogg_buffer_destroy(oy->bufferpool);
-    memset(oy,0,sizeof(*oy));
-    _ogg_free(oy);
-  }
-  return OGG_SUCCESS;
-}
-
-unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long bytes){
-
-  /* [allocate and] expose a buffer for data submission.
-
-     If there is no head fragment
-       allocate one and expose it
-     else
-       if the current head fragment has sufficient unused space
-         expose it
-       else
-         if the current head fragment is unused
-           resize and expose it
-         else
-           allocate new fragment and expose it
-  */
-
-  /* base case; fifo uninitialized */
-  if(!oy->fifo_head){
-    oy->fifo_head=oy->fifo_tail=ogg_buffer_alloc(oy->bufferpool,bytes);
-    return oy->fifo_head->buffer->data;
-  }
-  
-  /* space left in current fragment case */
-  if(oy->fifo_head->buffer->size-
-     oy->fifo_head->length-
-     oy->fifo_head->begin >= bytes)
-    return oy->fifo_head->buffer->data+
-      oy->fifo_head->length+oy->fifo_head->begin;
-
-  /* current fragment is unused, but too small */
-  if(!oy->fifo_head->length){
-    ogg_buffer_realloc(oy->fifo_head,bytes);
-    return oy->fifo_head->buffer->data+oy->fifo_head->begin;
-  }
-  
-  /* current fragment used/full; get new fragment */
-  {
-    ogg_reference *new=ogg_buffer_alloc(oy->bufferpool,bytes);
-    oy->fifo_head->next=new;
-    oy->fifo_head=new;
-  }
-  return oy->fifo_head->buffer->data;
-}
-
-int ogg_sync_wrote(ogg_sync_state *oy, long bytes){ 
-  if(!oy->fifo_head)return OGG_EINVAL;
-  if(oy->fifo_head->buffer->size-oy->fifo_head->length-oy->fifo_head->begin < 
-     bytes)return OGG_EINVAL;
-  oy->fifo_head->length+=bytes;
-  oy->fifo_fill+=bytes;
-  return OGG_SUCCESS;
-}
-
-static ogg_uint32_t _checksum(ogg_reference *or, int bytes){
-  ogg_uint32_t crc_reg=0;
-  int j,post;
-
-  while(or){
-    unsigned char *data=or->buffer->data+or->begin;
-    post=(bytes<or->length?bytes:or->length);
-    for(j=0;j<post;++j)
-      crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^data[j]];
-    bytes-=j;
-    or=or->next;
-  }
-
-  return crc_reg;
-}
-
-
-/* sync the stream.  This is meant to be useful for finding page
-   boundaries.
-
-   return values for this:
-  -n) skipped n bytes
-   0) page not ready; more data (no bytes skipped)
-   n) page synced at current location; page length n bytes
-   
-*/
-
-long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
-  oggbyte_buffer page;
-  long           bytes,ret=0;
-
-  ogg_page_release(og);
-
-  bytes=oy->fifo_fill;
-  oggbyte_init(&page,oy->fifo_tail);
-
-  if(oy->headerbytes==0){
-    if(bytes<27)goto sync_out; /* not enough for even a minimal header */
-    
-    /* verify capture pattern */
-    if(oggbyte_read1(&page,0)!=(int)'O' ||
-       oggbyte_read1(&page,1)!=(int)'g' ||
-       oggbyte_read1(&page,2)!=(int)'g' ||
-       oggbyte_read1(&page,3)!=(int)'S'    ) goto sync_fail;
-
-    oy->headerbytes=oggbyte_read1(&page,26)+27;
-  }
-  if(bytes<oy->headerbytes)goto sync_out; /* not enough for header +
-                                             seg table */
-  if(oy->bodybytes==0){
-    int i;
-    /* count up body length in the segment table */
-    for(i=0;i<oy->headerbytes-27;i++)
-      oy->bodybytes+=oggbyte_read1(&page,27+i);
-  }
-  
-  if(oy->bodybytes+oy->headerbytes>bytes)goto sync_out;
-
-  /* we have what appears to be a complete page; last test: verify
-     checksum */
-  {
-    ogg_uint32_t chksum=oggbyte_read4(&page,22);
-    oggbyte_set4(&page,0,22);
-
-    /* Compare checksums; memory continues to be common access */
-    if(chksum!=_checksum(oy->fifo_tail,oy->bodybytes+oy->headerbytes)){
-      
-      /* D'oh.  Mismatch! Corrupt page (or miscapture and not a page
-         at all). replace the computed checksum with the one actually
-         read in; remember all the memory is common access */
-      
-      oggbyte_set4(&page,chksum,22);
-      goto sync_fail;
-    }
-    oggbyte_set4(&page,chksum,22);
-  }
-
-  /* We have a page.  Set up page return. */
-  if(og){
-    /* set up page output */
-    og->header=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->headerbytes);
-    og->header_len=oy->headerbytes;
-    og->body=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->bodybytes);
-    og->body_len=oy->bodybytes;
-  }else{
-    /* simply advance */
-    oy->fifo_tail=
-      ogg_buffer_pretruncate(oy->fifo_tail,oy->headerbytes+oy->bodybytes);
-    if(!oy->fifo_tail)oy->fifo_head=0;
-  }
-  
-  ret=oy->headerbytes+oy->bodybytes;
-  oy->unsynced=0;
-  oy->headerbytes=0;
-  oy->bodybytes=0;
-  oy->fifo_fill-=ret;
-
-  return ret;
-  
- sync_fail:
-
-  oy->headerbytes=0;
-  oy->bodybytes=0;
-  oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,1);
-  ret--;
-  
-  /* search forward through fragments for possible capture */
-  while(oy->fifo_tail){
-    /* invariant: fifo_cursor points to a position in fifo_tail */
-    unsigned char *now=oy->fifo_tail->buffer->data+oy->fifo_tail->begin;
-    unsigned char *next=memchr(now, 'O', oy->fifo_tail->length);
-      
-    if(next){
-      /* possible capture in this segment */
-      long bytes=next-now;
-      oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
-      ret-=bytes;
-      break;
-    }else{
-      /* no capture.  advance to next segment */
-      long bytes=oy->fifo_tail->length;
-      ret-=bytes;
-      oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
-    }
-  }
-  if(!oy->fifo_tail)oy->fifo_head=0;
-  oy->fifo_fill+=ret;
-
- sync_out:
-  return ret;
-}
-
-/* sync the stream and get a page.  Keep trying until we find a page.
-   Supress 'sync errors' after reporting the first.
-
-   return values:
-   OGG_HOLE) recapture (hole in data)
-          0) need more data
-          1) page returned
-
-   Returns pointers into buffered data; invalidated by next call to
-   _stream, _clear, _init, or _buffer */
-
-int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
-
-  /* all we need to do is verify a page at the head of the stream
-     buffer.  If it doesn't verify, we look for the next potential
-     frame */
-
-  while(1){
-    long ret=ogg_sync_pageseek(oy,og);
-    if(ret>0){
-      /* have a page */
-      return 1;
-    }
-    if(ret==0){
-      /* need more data */
-      return 0;
-    }
-    
-    /* head did not start a synced page... skipped some bytes */
-    if(!oy->unsynced){
-      oy->unsynced=1;
-      return OGG_HOLE;
-    }
-
-    /* loop. keep looking */
-
-  }
-}
-
-/* clear things to an initial state.  Good to call, eg, before seeking */
-int ogg_sync_reset(ogg_sync_state *oy){
-
-  ogg_buffer_release(oy->fifo_tail);
-  oy->fifo_tail=0;
-  oy->fifo_head=0;
-  oy->fifo_fill=0;
-
-  oy->unsynced=0;
-  oy->headerbytes=0;
-  oy->bodybytes=0;
-  return OGG_SUCCESS;
-}
-
-ogg_stream_state *ogg_stream_create(int serialno){
-  ogg_stream_state *os=_ogg_calloc(1,sizeof(*os));
-  os->serialno=serialno;
-  os->pageno=-1;
-  return os;
-} 
-
-int ogg_stream_destroy(ogg_stream_state *os){
-  if(os){
-    ogg_buffer_release(os->header_tail);
-    ogg_buffer_release(os->body_tail);
-    memset(os,0,sizeof(*os));    
-    _ogg_free(os);
-  }
-  return OGG_SUCCESS;
-} 
-
-
-#define FINFLAG 0x80000000UL
-#define FINMASK 0x7fffffffUL
-
-static void _next_lace(oggbyte_buffer *ob,ogg_stream_state *os){
-  /* search ahead one lace */
-  os->body_fill_next=0;
-  while(os->laceptr<os->lacing_fill){
-    int val=oggbyte_read1(ob,27+os->laceptr++);
-    os->body_fill_next+=val;
-    if(val<255){
-      os->body_fill_next|=FINFLAG;
-      os->clearflag=1;
-      break;
-    }
-  }
-}
-
-static void _span_queued_page(ogg_stream_state *os){ 
-  while( !(os->body_fill&FINFLAG) ){
-    
-    if(!os->header_tail)break;
-
-    /* first flush out preceeding page header (if any).  Body is
-       flushed as it's consumed, so that's not done here. */
-
-    if(os->lacing_fill>=0)
-      os->header_tail=ogg_buffer_pretruncate(os->header_tail,
-                                             os->lacing_fill+27);
-    os->lacing_fill=0;
-    os->laceptr=0;
-    os->clearflag=0;
-
-    if(!os->header_tail){
-      os->header_head=0;
-      break;
-    }else{
-      
-      /* process/prepare next page, if any */
-
-      long pageno;
-      oggbyte_buffer ob;
-      ogg_page og;               /* only for parsing header values */
-      og.header=os->header_tail; /* only for parsing header values */
-      pageno=ogg_page_pageno(&og);
-
-      oggbyte_init(&ob,os->header_tail);
-      os->lacing_fill=oggbyte_read1(&ob,26);
-      
-      /* are we in sequence? */
-      if(pageno!=os->pageno){
-        if(os->pageno==-1) /* indicates seek or reset */
-          os->holeflag=1;  /* set for internal use */
-        else
-          os->holeflag=2;  /* set for external reporting */
-
-        os->body_tail=ogg_buffer_pretruncate(os->body_tail,
-                                             os->body_fill);
-        if(os->body_tail==0)os->body_head=0;
-        os->body_fill=0;
-
-      }
-    
-      if(ogg_page_continued(&og)){
-        if(os->body_fill==0){
-          /* continued packet, but no preceeding data to continue */
-          /* dump the first partial packet on the page */
-          _next_lace(&ob,os);   
-          os->body_tail=
-            ogg_buffer_pretruncate(os->body_tail,os->body_fill_next&FINMASK);
-          if(os->body_tail==0)os->body_head=0;
-          /* set span flag */
-          if(!os->spanflag && !os->holeflag)os->spanflag=2;
-        }
-      }else{
-        if(os->body_fill>0){
-          /* preceeding data to continue, but not a continued page */
-          /* dump body_fill */
-          os->body_tail=ogg_buffer_pretruncate(os->body_tail,
-                                               os->body_fill);
-          if(os->body_tail==0)os->body_head=0;
-          os->body_fill=0;
-
-          /* set espan flag */
-          if(!os->spanflag && !os->holeflag)os->spanflag=2;
-        }
-      }
-
-      if(os->laceptr<os->lacing_fill){
-        os->granulepos=ogg_page_granulepos(&og);
-
-        /* get current packet size & flag */
-        _next_lace(&ob,os);
-        os->body_fill+=os->body_fill_next; /* addition handles the flag fine;
-                                             unsigned on purpose */
-        /* ...and next packet size & flag */
-        _next_lace(&ob,os);
-
-      }
-      
-      os->pageno=pageno+1;
-      os->e_o_s=ogg_page_eos(&og);
-      os->b_o_s=ogg_page_bos(&og);
-    
-    }
-  }
-}
-
-/* add the incoming page to the stream state; we decompose the page
-   into packet segments here as well. */
-
-int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
-
-  int serialno=ogg_page_serialno(og);
-  int version=ogg_page_version(og);
-
-  /* check the serial number */
-  if(serialno!=os->serialno){
-    ogg_page_release(og);
-    return OGG_ESERIAL;
-  }
-  if(version>0){
-    ogg_page_release(og);
-    return OGG_EVERSION;
-  }
-
-  /* add to fifos */
-  if(!os->body_tail){
-    os->body_tail=og->body;
-    os->body_head=ogg_buffer_walk(og->body);
-  }else{
-    os->body_head=ogg_buffer_cat(os->body_head,og->body);
-  }
-  if(!os->header_tail){
-    os->header_tail=og->header;
-    os->header_head=ogg_buffer_walk(og->header);
-    os->lacing_fill=-27;
-  }else{
-    os->header_head=ogg_buffer_cat(os->header_head,og->header);
-  }
-
-  memset(og,0,sizeof(*og));
-  return OGG_SUCCESS;
-}
-
-int ogg_stream_reset(ogg_stream_state *os){
-
-  ogg_buffer_release(os->header_tail);
-  ogg_buffer_release(os->body_tail);
-  os->header_tail=os->header_head=0;
-  os->body_tail=os->body_head=0;
-
-  os->e_o_s=0;
-  os->b_o_s=0;
-  os->pageno=-1;
-  os->packetno=0;
-  os->granulepos=0;
-
-  os->body_fill=0;
-  os->lacing_fill=0;
-
-  os->holeflag=0;
-  os->spanflag=0;
-  os->clearflag=0;
-  os->laceptr=0;
-  os->body_fill_next=0;
-
-  return OGG_SUCCESS;
-}
-
-int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){
-  ogg_stream_reset(os);
-  os->serialno=serialno;
-  return OGG_SUCCESS;
-}
-
-static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){
-
-  ogg_packet_release(op);
-  _span_queued_page(os);
-
-  if(os->holeflag){
-    int temp=os->holeflag;
-    if(os->clearflag)
-      os->holeflag=0;
-    else
-      os->holeflag=1;
-    if(temp==2){
-      os->packetno++;
-      return OGG_HOLE;
-    }
-  }
-  if(os->spanflag){
-    int temp=os->spanflag;
-    if(os->clearflag)
-      os->spanflag=0;
-    else
-      os->spanflag=1;
-    if(temp==2){
-      os->packetno++;
-      return OGG_SPAN;
-    }
-  }
-
-  if(!(os->body_fill&FINFLAG)) return 0;
-  if(!op && !adv)return 1; /* just using peek as an inexpensive way
-                               to ask if there's a whole packet
-                               waiting */
-  if(op){
-    op->b_o_s=os->b_o_s;
-    if(os->e_o_s && os->body_fill_next==0)
-      op->e_o_s=os->e_o_s;
-    else
-      op->e_o_s=0;
-    if( (os->body_fill&FINFLAG) && !(os->body_fill_next&FINFLAG) )
-      op->granulepos=os->granulepos;
-    else
-      op->granulepos=-1;
-    op->packetno=os->packetno;
-  }
-
-  if(adv){
-    oggbyte_buffer ob;
-    oggbyte_init(&ob,os->header_tail);
-
-    /* split the body contents off */
-    if(op){
-      op->packet=ogg_buffer_split(&os->body_tail,&os->body_head,
-				  os->body_fill&FINMASK);
-      op->bytes=os->body_fill&FINMASK;
-    }else{
-      os->body_tail=ogg_buffer_pretruncate(os->body_tail,
-					   os->body_fill&FINMASK);
-      if(os->body_tail==0)os->body_head=0;
-    }
-
-    /* update lacing pointers */
-    os->body_fill=os->body_fill_next;
-    _next_lace(&ob,os);
-  }else{
-    if(op){
-      op->packet=ogg_buffer_sub(os->body_tail,0,os->body_fill&FINMASK);
-      op->bytes=os->body_fill&FINMASK;
-    }
-  }
-  
-  if(adv){
-    os->packetno++;
-    os->b_o_s=0;
-  }
-
-  return 1;
-}
-
-int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){
-  return _packetout(os,op,1);
-}
-
-int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){
-  return _packetout(os,op,0);
-}
-
-int ogg_packet_release(ogg_packet *op) {
-  if(op){
-    ogg_buffer_release(op->packet);
-    memset(op, 0, sizeof(*op));
-  }
-  return OGG_SUCCESS;
-}
-
-int ogg_page_release(ogg_page *og) {
-  if(og){
-    ogg_buffer_release(og->header);
-    ogg_buffer_release(og->body);
-    memset(og, 0, sizeof(*og));
-  }
-  return OGG_SUCCESS;
-}
-
-void ogg_page_dup(ogg_page *dup,ogg_page *orig){
-  dup->header_len=orig->header_len;
-  dup->body_len=orig->body_len;
-  dup->header=ogg_buffer_dup(orig->header);
-  dup->body=ogg_buffer_dup(orig->body);
-}
-
--- a/misc/libtremor/info.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: maintain the info structure, info <-> header packets
-
- ********************************************************************/
-
-/* general handling of the header and the vorbis_info structure (and
-   substructures) */
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-#include "codebook.h"
-#include "registry.h"
-#include "window.h"
-#include "misc.h"
-
-/* helpers */
-static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){
-  while(bytes--){
-    *buf++=oggpack_read(o,8);
-  }
-}
-
-void vorbis_comment_init(vorbis_comment *vc){
-  memset(vc,0,sizeof(*vc));
-}
-
-/* This is more or less the same as strncasecmp - but that doesn't exist
- * everywhere, and this is a fairly trivial function, so we include it */
-static int tagcompare(const char *s1, const char *s2, int n){
-  int c=0;
-  while(c < n){
-    if(toupper(s1[c]) != toupper(s2[c]))
-      return !0;
-    c++;
-  }
-  return 0;
-}
-
-char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
-  long i;
-  int found = 0;
-  int taglen = strlen(tag)+1; /* +1 for the = we append */
-  char *fulltag = (char *)alloca(taglen+ 1);
-
-  strcpy(fulltag, tag);
-  strcat(fulltag, "=");
-  
-  for(i=0;i<vc->comments;i++){
-    if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
-      if(count == found)
-	/* We return a pointer to the data, not a copy */
-      	return vc->user_comments[i] + taglen;
-      else
-	found++;
-    }
-  }
-  return NULL; /* didn't find anything */
-}
-
-int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
-  int i,count=0;
-  int taglen = strlen(tag)+1; /* +1 for the = we append */
-  char *fulltag = (char *)alloca(taglen+1);
-  strcpy(fulltag,tag);
-  strcat(fulltag, "=");
-
-  for(i=0;i<vc->comments;i++){
-    if(!tagcompare(vc->user_comments[i], fulltag, taglen))
-      count++;
-  }
-
-  return count;
-}
-
-void vorbis_comment_clear(vorbis_comment *vc){
-  if(vc){
-    long i;
-    for(i=0;i<vc->comments;i++)
-      if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
-    if(vc->user_comments)_ogg_free(vc->user_comments);
-	if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
-    if(vc->vendor)_ogg_free(vc->vendor);
-    memset(vc,0,sizeof(*vc));
-  }
-}
-
-/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long.
-   They may be equal, but short will never ge greater than long */
-int vorbis_info_blocksize(vorbis_info *vi,int zo){
-  codec_setup_info *ci = (codec_setup_info *)vi->codec_setup;
-  return ci ? ci->blocksizes[zo] : -1;
-}
-
-/* used by synthesis, which has a full, alloced vi */
-void vorbis_info_init(vorbis_info *vi){
-  memset(vi,0,sizeof(*vi));
-  vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info));
-}
-
-void vorbis_info_clear(vorbis_info *vi){
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  int i;
-
-  if(ci){
-
-    for(i=0;i<ci->modes;i++)
-      if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
-
-    for(i=0;i<ci->maps;i++) /* unpack does the range checking */
-      if(ci->map_param[i])
-	_mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
-
-    for(i=0;i<ci->floors;i++) /* unpack does the range checking */
-      if(ci->floor_param[i])
-	_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
-    
-    for(i=0;i<ci->residues;i++) /* unpack does the range checking */
-      if(ci->residue_param[i])
-	_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
-
-    for(i=0;i<ci->books;i++){
-      if(ci->book_param[i]){
-	/* knows if the book was not alloced */
-	vorbis_staticbook_destroy(ci->book_param[i]);
-      }
-      if(ci->fullbooks)
-	vorbis_book_clear(ci->fullbooks+i);
-    }
-    if(ci->fullbooks)
-	_ogg_free(ci->fullbooks);
-    
-    _ogg_free(ci);
-  }
-
-  memset(vi,0,sizeof(*vi));
-}
-
-/* Header packing/unpacking ********************************************/
-
-static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  if(!ci)return(OV_EFAULT);
-
-  vi->version=oggpack_read(opb,32);
-  if(vi->version!=0)return(OV_EVERSION);
-
-  vi->channels=oggpack_read(opb,8);
-  vi->rate=oggpack_read(opb,32);
-
-  vi->bitrate_upper=oggpack_read(opb,32);
-  vi->bitrate_nominal=oggpack_read(opb,32);
-  vi->bitrate_lower=oggpack_read(opb,32);
-
-  ci->blocksizes[0]=1<<oggpack_read(opb,4);
-  ci->blocksizes[1]=1<<oggpack_read(opb,4);
-  
-  if(vi->rate<1)goto err_out;
-  if(vi->channels<1)goto err_out;
-  if(ci->blocksizes[0]<64)goto err_out; 
-  if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
-  if(ci->blocksizes[1]>8192)goto err_out;
-  
-  if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
-
-  return(0);
- err_out:
-  vorbis_info_clear(vi);
-  return(OV_EBADHEADER);
-}
-
-static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
-  int i;
-  int vendorlen=oggpack_read(opb,32);
-  if(vendorlen<0)goto err_out;
-  vc->vendor=(char *)_ogg_calloc(vendorlen+1,1);
-  _v_readstring(opb,vc->vendor,vendorlen);
-  vc->comments=oggpack_read(opb,32);
-  if(vc->comments<0)goto err_out;
-  vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
-  vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
-	    
-  for(i=0;i<vc->comments;i++){
-    int len=oggpack_read(opb,32);
-    if(len<0)goto err_out;
-	vc->comment_lengths[i]=len;
-    vc->user_comments[i]=(char *)_ogg_calloc(len+1,1);
-    _v_readstring(opb,vc->user_comments[i],len);
-  }	  
-  if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
-
-  return(0);
- err_out:
-  vorbis_comment_clear(vc);
-  return(OV_EBADHEADER);
-}
-
-/* all of the real encoding details are here.  The modes, books,
-   everything */
-static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  int i;
-  if(!ci)return(OV_EFAULT);
-
-  /* codebooks */
-  ci->books=oggpack_read(opb,8)+1;
-  /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/
-  for(i=0;i<ci->books;i++){
-    ci->book_param[i]=(static_codebook *)_ogg_calloc(1,sizeof(*ci->book_param[i]));
-    if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
-  }
-
-  /* time backend settings */
-  ci->times=oggpack_read(opb,6)+1;
-  /*ci->time_type=_ogg_malloc(ci->times*sizeof(*ci->time_type));*/
-  /*ci->time_param=_ogg_calloc(ci->times,sizeof(void *));*/
-  for(i=0;i<ci->times;i++){
-    ci->time_type[i]=oggpack_read(opb,16);
-    if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out;
-    /* ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb);
-       Vorbis I has no time backend */
-    /*if(!ci->time_param[i])goto err_out;*/
-  }
-
-  /* floor backend settings */
-  ci->floors=oggpack_read(opb,6)+1;
-  /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/
-  /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
-  for(i=0;i<ci->floors;i++){
-    ci->floor_type[i]=oggpack_read(opb,16);
-    if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
-    ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
-    if(!ci->floor_param[i])goto err_out;
-  }
-
-  /* residue backend settings */
-  ci->residues=oggpack_read(opb,6)+1;
-  /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/
-  /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
-  for(i=0;i<ci->residues;i++){
-    ci->residue_type[i]=oggpack_read(opb,16);
-    if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
-    ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
-    if(!ci->residue_param[i])goto err_out;
-  }
-
-  /* map backend settings */
-  ci->maps=oggpack_read(opb,6)+1;
-  /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/
-  /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
-  for(i=0;i<ci->maps;i++){
-    ci->map_type[i]=oggpack_read(opb,16);
-    if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
-    ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
-    if(!ci->map_param[i])goto err_out;
-  }
-  
-  /* mode settings */
-  ci->modes=oggpack_read(opb,6)+1;
-  /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/
-  for(i=0;i<ci->modes;i++){
-    ci->mode_param[i]=(vorbis_info_mode *)_ogg_calloc(1,sizeof(*ci->mode_param[i]));
-    ci->mode_param[i]->blockflag=oggpack_read(opb,1);
-    ci->mode_param[i]->windowtype=oggpack_read(opb,16);
-    ci->mode_param[i]->transformtype=oggpack_read(opb,16);
-    ci->mode_param[i]->mapping=oggpack_read(opb,8);
-
-    if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
-    if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
-    if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
-  }
-  
-  if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
-
-  return(0);
- err_out:
-  vorbis_info_clear(vi);
-  return(OV_EBADHEADER);
-}
-
-/* The Vorbis header is in three packets; the initial small packet in
-   the first page that identifies basic parameters, a second packet
-   with bitstream comments and a third packet that holds the
-   codebook. */
-
-int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
-  oggpack_buffer opb;
-  
-  if(op){
-    oggpack_readinit(&opb,op->packet);
-
-    /* Which of the three types of header is this? */
-    /* Also verify header-ness, vorbis */
-    {
-      char buffer[6];
-      int packtype=oggpack_read(&opb,8);
-      memset(buffer,0,6);
-      _v_readstring(&opb,buffer,6);
-      if(memcmp(buffer,"vorbis",6)){
-	/* not a vorbis header */
-	return(OV_ENOTVORBIS);
-      }
-      switch(packtype){
-      case 0x01: /* least significant *bit* is read first */
-	if(!op->b_o_s){
-	  /* Not the initial packet */
-	  return(OV_EBADHEADER);
-	}
-	if(vi->rate!=0){
-	  /* previously initialized info header */
-	  return(OV_EBADHEADER);
-	}
-
-	return(_vorbis_unpack_info(vi,&opb));
-
-      case 0x03: /* least significant *bit* is read first */
-	if(vi->rate==0){
-	  /* um... we didn't get the initial header */
-	  return(OV_EBADHEADER);
-	}
-
-	return(_vorbis_unpack_comment(vc,&opb));
-
-      case 0x05: /* least significant *bit* is read first */
-	if(vi->rate==0 || vc->vendor==NULL){
-	  /* um... we didn;t get the initial header or comments yet */
-	  return(OV_EBADHEADER);
-	}
-
-	return(_vorbis_unpack_books(vi,&opb));
-
-      default:
-	/* Not a valid vorbis header type */
-	return(OV_EBADHEADER);
-	break;
-      }
-    }
-  }
-  return(OV_EBADHEADER);
-}
-
--- a/misc/libtremor/ivorbiscodec.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,202 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: libvorbis codec headers
-
- ********************************************************************/
-
-#ifndef _vorbis_codec_h_
-#define _vorbis_codec_h_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#include "ogg.h"
-
-typedef struct vorbis_info{
-  int version;
-  int channels;
-  long rate;
-
-  /* The below bitrate declarations are *hints*.
-     Combinations of the three values carry the following implications:
-     
-     all three set to the same value: 
-       implies a fixed rate bitstream
-     only nominal set: 
-       implies a VBR stream that averages the nominal bitrate.  No hard 
-       upper/lower limit
-     upper and or lower set: 
-       implies a VBR bitstream that obeys the bitrate limits. nominal 
-       may also be set to give a nominal rate.
-     none set:
-       the coder does not care to speculate.
-  */
-
-  long bitrate_upper;
-  long bitrate_nominal;
-  long bitrate_lower;
-  long bitrate_window;
-
-  void *codec_setup;
-} vorbis_info;
-
-/* vorbis_dsp_state buffers the current vorbis audio
-   analysis/synthesis state.  The DSP state belongs to a specific
-   logical bitstream ****************************************************/
-typedef struct vorbis_dsp_state{
-  int analysisp;
-  vorbis_info *vi;
-
-  ogg_int32_t **pcm;
-  ogg_int32_t **pcmret;
-  int      pcm_storage;
-  int      pcm_current;
-  int      pcm_returned;
-
-  int  preextrapolate;
-  int  eofflag;
-
-  long lW;
-  long W;
-  long nW;
-  long centerW;
-
-  ogg_int64_t granulepos;
-  ogg_int64_t sequence;
-
-  void       *backend_state;
-} vorbis_dsp_state;
-
-typedef struct vorbis_block{
-  /* necessary stream state for linking to the framing abstraction */
-  ogg_int32_t  **pcm;       /* this is a pointer into local storage */ 
-  oggpack_buffer opb;
-  
-  long  lW;
-  long  W;
-  long  nW;
-  int   pcmend;
-  int   mode;
-
-  int         eofflag;
-  ogg_int64_t granulepos;
-  ogg_int64_t sequence;
-  vorbis_dsp_state *vd; /* For read-only access of configuration */
-
-  /* local storage to avoid remallocing; it's up to the mapping to
-     structure it */
-  void               *localstore;
-  long                localtop;
-  long                localalloc;
-  long                totaluse;
-  struct alloc_chain *reap;
-
-} vorbis_block;
-
-/* vorbis_block is a single block of data to be processed as part of
-the analysis/synthesis stream; it belongs to a specific logical
-bitstream, but is independant from other vorbis_blocks belonging to
-that logical bitstream. *************************************************/
-
-struct alloc_chain{
-  void *ptr;
-  struct alloc_chain *next;
-};
-
-/* vorbis_info contains all the setup information specific to the
-   specific compression/decompression mode in progress (eg,
-   psychoacoustic settings, channel setup, options, codebook
-   etc). vorbis_info and substructures are in backends.h.
-*********************************************************************/
-
-/* the comments are not part of vorbis_info so that vorbis_info can be
-   static storage */
-typedef struct vorbis_comment{
-  /* unlimited user comment fields.  libvorbis writes 'libvorbis'
-     whatever vendor is set to in encode */
-  char **user_comments;
-  int   *comment_lengths;
-  int    comments;
-  char  *vendor;
-
-} vorbis_comment;
-
-
-/* libvorbis encodes in two abstraction layers; first we perform DSP
-   and produce a packet (see docs/analysis.txt).  The packet is then
-   coded into a framed OggSquish bitstream by the second layer (see
-   docs/framing.txt).  Decode is the reverse process; we sync/frame
-   the bitstream and extract individual packets, then decode the
-   packet back into PCM audio.
-
-   The extra framing/packetizing is used in streaming formats, such as
-   files.  Over the net (such as with UDP), the framing and
-   packetization aren't necessary as they're provided by the transport
-   and the streaming layer is not used */
-
-/* Vorbis PRIMITIVES: general ***************************************/
-
-extern void     vorbis_info_init(vorbis_info *vi);
-extern void     vorbis_info_clear(vorbis_info *vi);
-extern int      vorbis_info_blocksize(vorbis_info *vi,int zo);
-extern void     vorbis_comment_init(vorbis_comment *vc);
-extern void     vorbis_comment_add(vorbis_comment *vc, char *comment); 
-extern void     vorbis_comment_add_tag(vorbis_comment *vc, 
-				       char *tag, char *contents);
-extern char    *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
-extern int      vorbis_comment_query_count(vorbis_comment *vc, char *tag);
-extern void     vorbis_comment_clear(vorbis_comment *vc);
-
-extern int      vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
-extern int      vorbis_block_clear(vorbis_block *vb);
-extern void     vorbis_dsp_clear(vorbis_dsp_state *v);
-
-/* Vorbis PRIMITIVES: synthesis layer *******************************/
-extern int      vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
-					  ogg_packet *op);
-
-extern int      vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
-extern int      vorbis_synthesis_restart(vorbis_dsp_state *v);
-extern int      vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep);
-extern int      vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
-extern int      vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm);
-extern int      vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
-extern long     vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
-
-/* Vorbis ERRORS and return codes ***********************************/
-
-#define OV_FALSE      -1  
-#define OV_EOF        -2
-#define OV_HOLE       -3
-
-#define OV_EREAD      -128
-#define OV_EFAULT     -129
-#define OV_EIMPL      -130
-#define OV_EINVAL     -131
-#define OV_ENOTVORBIS -132
-#define OV_EBADHEADER -133
-#define OV_EVERSION   -134
-#define OV_ENOTAUDIO  -135
-#define OV_EBADPACKET -136
-#define OV_EBADLINK   -137
-#define OV_ENOSEEK    -138
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-
--- a/misc/libtremor/ivorbisfile.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: stdio-based convenience library for opening/seeking/decoding
-
- ********************************************************************/
-
-#ifndef _OV_FILE_H_
-#define _OV_FILE_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#include <stdio.h>
-#include "ivorbiscodec.h"
-
-#define CHUNKSIZE 1024
-/* The function prototypes for the callbacks are basically the same as for
- * the stdio functions fread, fseek, fclose, ftell. 
- * The one difference is that the FILE * arguments have been replaced with
- * a void * - this is to be used as a pointer to whatever internal data these
- * functions might need. In the stdio case, it's just a FILE * cast to a void *
- * 
- * If you use other functions, check the docs for these functions and return
- * the right values. For seek_func(), you *MUST* return -1 if the stream is
- * unseekable
- */
-typedef struct {
-  size_t (*read_func)  (void *ptr, size_t size, size_t nmemb, void *datasource);
-  int    (*seek_func)  (void *datasource, ogg_int64_t offset, int whence);
-  int    (*close_func) (void *datasource);
-  long   (*tell_func)  (void *datasource);
-} ov_callbacks;
-
-#define  NOTOPEN   0
-#define  PARTOPEN  1
-#define  OPENED    2
-#define  STREAMSET 3
-#define  INITSET   4
-
-typedef struct OggVorbis_File {
-  void            *datasource; /* Pointer to a FILE *, etc. */
-  int              seekable;
-  ogg_int64_t      offset;
-  ogg_int64_t      end;
-  ogg_sync_state   *oy; 
-
-  /* If the FILE handle isn't seekable (eg, a pipe), only the current
-     stream appears */
-  int              links;
-  ogg_int64_t     *offsets;
-  ogg_int64_t     *dataoffsets;
-  ogg_uint32_t    *serialnos;
-  ogg_int64_t     *pcmlengths;
-  vorbis_info     *vi;
-  vorbis_comment  *vc;
-
-  /* Decoding working state local storage */
-  ogg_int64_t      pcm_offset;
-  int              ready_state;
-  ogg_uint32_t     current_serialno;
-  int              current_link;
-
-  ogg_int64_t      bittrack;
-  ogg_int64_t      samptrack;
-
-  ogg_stream_state *os; /* take physical pages, weld into a logical
-                          stream of packets */
-  vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
-  vorbis_block     vb; /* local working space for packet->PCM decode */
-
-  ov_callbacks callbacks;
-
-} OggVorbis_File;
-
-extern int ov_clear(OggVorbis_File *vf);
-extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
-extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
-		char *initial, long ibytes, ov_callbacks callbacks);
-
-extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
-extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
-		char *initial, long ibytes, ov_callbacks callbacks);
-extern int ov_test_open(OggVorbis_File *vf);
-
-extern long ov_bitrate(OggVorbis_File *vf,int i);
-extern long ov_bitrate_instant(OggVorbis_File *vf);
-extern long ov_streams(OggVorbis_File *vf);
-extern long ov_seekable(OggVorbis_File *vf);
-extern long ov_serialnumber(OggVorbis_File *vf,int i);
-
-extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
-extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
-extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
-
-extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
-extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
-extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
-extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
-extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
-
-extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
-extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
-extern ogg_int64_t ov_time_tell(OggVorbis_File *vf);
-
-extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
-extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
-
-extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
-		    int *bitstream);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-
-
--- a/misc/libtremor/ivorbisfile_example.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: simple example decoder using vorbisidec
-
- ********************************************************************/
-
-/* Takes a vorbis bitstream from stdin and writes raw stereo PCM to
-   stdout using vorbisfile. Using vorbisfile is much simpler than
-   dealing with libvorbis. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <vorbis/ivorbiscodec.h>
-#include <vorbis/ivorbisfile.h>
-
-#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
-#include <io.h>
-#include <fcntl.h>
-#endif
-
-char pcmout[4096]; /* take 4k out of the data segment, not the stack */
-
-int main(){
-  OggVorbis_File vf;
-  int eof=0;
-  int current_section;
-
-#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
-  /* Beware the evil ifdef. We avoid these where we can, but this one we 
-     cannot. Don't add any more, you'll probably go to hell if you do. */
-  _setmode( _fileno( stdin ), _O_BINARY );
-  _setmode( _fileno( stdout ), _O_BINARY );
-#endif
-
-  if(ov_open(stdin, &vf, NULL, 0) < 0) {
-      fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
-      exit(1);
-  }
-
-  /* Throw the comments plus a few lines about the bitstream we're
-     decoding */
-  {
-    char **ptr=ov_comment(&vf,-1)->user_comments;
-    vorbis_info *vi=ov_info(&vf,-1);
-    while(*ptr){
-      fprintf(stderr,"%s\n",*ptr);
-      ++ptr;
-    }
-    fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
-    fprintf(stderr,"\nDecoded length: %ld samples\n",
-	    (long)ov_pcm_total(&vf,-1));
-    fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
-  }
-  
-  while(!eof){
-    long ret=ov_read(&vf,pcmout,sizeof(pcmout),&current_section);
-    if (ret == 0) {
-      /* EOF */
-      eof=1;
-    } else if (ret < 0) {
-      /* error in the stream.  Not a problem, just reporting it in
-	 case we (the app) cares.  In this case, we don't. */
-    } else {
-      /* we don't bother dealing with sample rate changes, etc, but
-	 you'll have to*/
-      fwrite(pcmout,1,ret,stdout);
-    }
-  }
-
-  /* cleanup */
-  ov_clear(&vf);
-    
-  fprintf(stderr,"Done.\n");
-  return(0);
-}
--- a/misc/libtremor/lsp_lookup.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
-  function: lookup data
-
- ********************************************************************/
-
-#ifndef _V_LOOKUP_DATA_H_
-#define _V_LOOKUP_DATA_H_
-
-#include "os_types.h"
-
-#define FROMdB_LOOKUP_SZ 35
-#define FROMdB2_LOOKUP_SZ 32
-#define FROMdB_SHIFT 5
-#define FROMdB2_SHIFT 3
-#define FROMdB2_MASK 31
-
-static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
-  0x003fffff, 0x0028619b, 0x00197a96, 0x0010137a,
-  0x000a24b0, 0x00066666, 0x000409c3, 0x00028c42,
-  0x00019b8c, 0x000103ab, 0x0000a3d7, 0x00006760,
-  0x0000413a, 0x00002928, 0x000019f8, 0x00001062,
-  0x00000a56, 0x00000686, 0x0000041e, 0x00000299,
-  0x000001a3, 0x00000109, 0x000000a7, 0x00000069,
-  0x00000042, 0x0000002a, 0x0000001a, 0x00000011,
-  0x0000000b, 0x00000007, 0x00000004, 0x00000003,
-  0x00000002, 0x00000001, 0x00000001};
-
-static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
-  0x000001fc, 0x000001f5, 0x000001ee, 0x000001e7,
-  0x000001e0, 0x000001d9, 0x000001d2, 0x000001cc,
-  0x000001c5, 0x000001bf, 0x000001b8, 0x000001b2,
-  0x000001ac, 0x000001a6, 0x000001a0, 0x0000019a,
-  0x00000194, 0x0000018e, 0x00000188, 0x00000183,
-  0x0000017d, 0x00000178, 0x00000172, 0x0000016d,
-  0x00000168, 0x00000163, 0x0000015e, 0x00000159,
-  0x00000154, 0x0000014f, 0x0000014a, 0x00000145,
-};
-
-#define INVSQ_LOOKUP_I_SHIFT 10
-#define INVSQ_LOOKUP_I_MASK 1023
-static const long INVSQ_LOOKUP_I[64+1]={
-	   92682,   91966,   91267,   90583,
-	   89915,   89261,   88621,   87995,
-	   87381,   86781,   86192,   85616,
-	   85051,   84497,   83953,   83420,
-	   82897,   82384,   81880,   81385,
-	   80899,   80422,   79953,   79492,
-	   79039,   78594,   78156,   77726,
-	   77302,   76885,   76475,   76072,
-	   75674,   75283,   74898,   74519,
-	   74146,   73778,   73415,   73058,
-	   72706,   72359,   72016,   71679,
-	   71347,   71019,   70695,   70376,
-	   70061,   69750,   69444,   69141,
-	   68842,   68548,   68256,   67969,
-	   67685,   67405,   67128,   66855,
-	   66585,   66318,   66054,   65794,
-	   65536,
-};
-
-static const long INVSQ_LOOKUP_IDel[64]={
-             716,     699,     684,     668,
-             654,     640,     626,     614,
-             600,     589,     576,     565,
-             554,     544,     533,     523,
-             513,     504,     495,     486,
-             477,     469,     461,     453,
-             445,     438,     430,     424,
-             417,     410,     403,     398,
-             391,     385,     379,     373,
-             368,     363,     357,     352,
-             347,     343,     337,     332,
-             328,     324,     319,     315,
-             311,     306,     303,     299,
-             294,     292,     287,     284,
-             280,     277,     273,     270,
-             267,     264,     260,     258,
-};
-
-#define COS_LOOKUP_I_SHIFT 9
-#define COS_LOOKUP_I_MASK 511
-#define COS_LOOKUP_I_SZ 128
-static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
-	   16384,   16379,   16364,   16340,
-	   16305,   16261,   16207,   16143,
-	   16069,   15986,   15893,   15791,
-	   15679,   15557,   15426,   15286,
-	   15137,   14978,   14811,   14635,
-	   14449,   14256,   14053,   13842,
-	   13623,   13395,   13160,   12916,
-	   12665,   12406,   12140,   11866,
-	   11585,   11297,   11003,   10702,
-	   10394,   10080,    9760,    9434,
-	    9102,    8765,    8423,    8076,
-	    7723,    7366,    7005,    6639,
-	    6270,    5897,    5520,    5139,
-	    4756,    4370,    3981,    3590,
-	    3196,    2801,    2404,    2006,
-	    1606,    1205,     804,     402,
-	       0,    -401,    -803,   -1204,
-	   -1605,   -2005,   -2403,   -2800,
-	   -3195,   -3589,   -3980,   -4369,
-	   -4755,   -5138,   -5519,   -5896,
-	   -6269,   -6638,   -7004,   -7365,
-	   -7722,   -8075,   -8422,   -8764,
-	   -9101,   -9433,   -9759,  -10079,
-	  -10393,  -10701,  -11002,  -11296,
-	  -11584,  -11865,  -12139,  -12405,
-	  -12664,  -12915,  -13159,  -13394,
-	  -13622,  -13841,  -14052,  -14255,
-	  -14448,  -14634,  -14810,  -14977,
-	  -15136,  -15285,  -15425,  -15556,
-	  -15678,  -15790,  -15892,  -15985,
-	  -16068,  -16142,  -16206,  -16260,
-	  -16304,  -16339,  -16363,  -16378,
-	  -16383,
-};
-
-#endif
-
-
-
-
-
--- a/misc/libtremor/mapping0.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: channel mapping 0 implementation
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "mdct.h"
-#include "codec_internal.h"
-#include "codebook.h"
-#include "window.h"
-#include "registry.h"
-#include "misc.h"
-
-/* simplistic, wasteful way of doing this (unique lookup for each
-   mode/submapping); there should be a central repository for
-   identical lookups.  That will require minor work, so I'm putting it
-   off as low priority.
-
-   Why a lookup for each backend in a given mode?  Because the
-   blocksize is set by the mode, and low backend lookups may require
-   parameters from other areas of the mode/mapping */
-
-typedef struct {
-  vorbis_info_mode *mode;
-  vorbis_info_mapping0 *map;
-
-  vorbis_look_floor **floor_look;
-
-  vorbis_look_residue **residue_look;
-
-  vorbis_func_floor **floor_func;
-  vorbis_func_residue **residue_func;
-
-  int ch;
-  long lastframe; /* if a different mode is called, we need to 
-		     invalidate decay */
-} vorbis_look_mapping0;
-
-static void mapping0_free_info(vorbis_info_mapping *i){
-  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
-  if(info){
-    memset(info,0,sizeof(*info));
-    _ogg_free(info);
-  }
-}
-
-static void mapping0_free_look(vorbis_look_mapping *look){
-  int i;
-  vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
-  if(l){
-
-    for(i=0;i<l->map->submaps;i++){
-      l->floor_func[i]->free_look(l->floor_look[i]);
-      l->residue_func[i]->free_look(l->residue_look[i]);
-    }
-
-    _ogg_free(l->floor_func);
-    _ogg_free(l->residue_func);
-    _ogg_free(l->floor_look);
-    _ogg_free(l->residue_look);
-    memset(l,0,sizeof(*l));
-    _ogg_free(l);
-  }
-}
-
-static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
-			  vorbis_info_mapping *m){
-  int i;
-  vorbis_info          *vi=vd->vi;
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)_ogg_calloc(1,sizeof(*look));
-  vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
-  look->mode=vm;
-  
-  look->floor_look=(vorbis_look_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_look));
-
-  look->residue_look=(vorbis_look_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_look));
-
-  look->floor_func=(vorbis_func_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_func));
-  look->residue_func=(vorbis_func_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_func));
-  
-  for(i=0;i<info->submaps;i++){
-    int floornum=info->floorsubmap[i];
-    int resnum=info->residuesubmap[i];
-
-    look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
-    look->floor_look[i]=look->floor_func[i]->
-      look(vd,vm,ci->floor_param[floornum]);
-    look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
-    look->residue_look[i]=look->residue_func[i]->
-      look(vd,vm,ci->residue_param[resnum]);
-    
-  }
-
-  look->ch=vi->channels;
-
-  return(look);
-}
-
-static int ilog(unsigned int v){
-  int ret=0;
-  if(v)--v;
-  while(v){
-    ret++;
-    v>>=1;
-  }
-  return(ret);
-}
-
-/* also responsible for range checking */
-static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
-  int i;
-  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)_ogg_calloc(1,sizeof(*info));
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  memset(info,0,sizeof(*info));
-
-  if(oggpack_read(opb,1))
-    info->submaps=oggpack_read(opb,4)+1;
-  else
-    info->submaps=1;
-
-  if(oggpack_read(opb,1)){
-    info->coupling_steps=oggpack_read(opb,8)+1;
-
-    for(i=0;i<info->coupling_steps;i++){
-      int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
-      int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
-
-      if(testM<0 || 
-	 testA<0 || 
-	 testM==testA || 
-	 testM>=vi->channels ||
-	 testA>=vi->channels) goto err_out;
-    }
-
-  }
-
-  if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */
-    
-  if(info->submaps>1){
-    for(i=0;i<vi->channels;i++){
-      info->chmuxlist[i]=oggpack_read(opb,4);
-      if(info->chmuxlist[i]>=info->submaps)goto err_out;
-    }
-  }
-  for(i=0;i<info->submaps;i++){
-    int temp=oggpack_read(opb,8);
-    if(temp>=ci->times)goto err_out;
-    info->floorsubmap[i]=oggpack_read(opb,8);
-    if(info->floorsubmap[i]>=ci->floors)goto err_out;
-    info->residuesubmap[i]=oggpack_read(opb,8);
-    if(info->residuesubmap[i]>=ci->residues)goto err_out;
-  }
-
-  return info;
-
- err_out:
-  mapping0_free_info(info);
-  return(NULL);
-}
-
-static int seq=0;
-static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
-  vorbis_dsp_state     *vd=vb->vd;
-  vorbis_info          *vi=vd->vi;
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  private_state        *b=(private_state *)vd->backend_state;
-  vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
-  vorbis_info_mapping0 *info=look->map;
-
-  int                   i,j;
-  long                  n=vb->pcmend=ci->blocksizes[vb->W];
-
-  ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels);
-  int    *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels);
-  
-  int   *nonzero  =(int *)alloca(sizeof(*nonzero)*vi->channels);
-  void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels);
-  
-  /* time domain information decode (note that applying the
-     information would have to happen later; we'll probably add a
-     function entry to the harness for that later */
-  /* NOT IMPLEMENTED */
-
-  /* recover the spectral envelope; store it in the PCM vector for now */
-  for(i=0;i<vi->channels;i++){
-    int submap=info->chmuxlist[i];
-    floormemo[i]=look->floor_func[submap]->
-      inverse1(vb,look->floor_look[submap]);
-    if(floormemo[i])
-      nonzero[i]=1;
-    else
-      nonzero[i]=0;      
-    memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
-  }
-
-  /* channel coupling can 'dirty' the nonzero listing */
-  for(i=0;i<info->coupling_steps;i++){
-    if(nonzero[info->coupling_mag[i]] ||
-       nonzero[info->coupling_ang[i]]){
-      nonzero[info->coupling_mag[i]]=1; 
-      nonzero[info->coupling_ang[i]]=1; 
-    }
-  }
-
-  /* recover the residue into our working vectors */
-  for(i=0;i<info->submaps;i++){
-    int ch_in_bundle=0;
-    for(j=0;j<vi->channels;j++){
-      if(info->chmuxlist[j]==i){
-	if(nonzero[j])
-	  zerobundle[ch_in_bundle]=1;
-	else
-	  zerobundle[ch_in_bundle]=0;
-	pcmbundle[ch_in_bundle++]=vb->pcm[j];
-      }
-    }
-    
-    look->residue_func[i]->inverse(vb,look->residue_look[i],
-				   pcmbundle,zerobundle,ch_in_bundle);
-  }
-
-  //for(j=0;j<vi->channels;j++)
-  //_analysis_output("coupled",seq+j,vb->pcm[j],-8,n/2,0,0);
-
-
-  /* channel coupling */
-  for(i=info->coupling_steps-1;i>=0;i--){
-    ogg_int32_t *pcmM=vb->pcm[info->coupling_mag[i]];
-    ogg_int32_t *pcmA=vb->pcm[info->coupling_ang[i]];
-    
-    for(j=0;j<n/2;j++){
-      ogg_int32_t mag=pcmM[j];
-      ogg_int32_t ang=pcmA[j];
-      
-      if(mag>0)
-	if(ang>0){
-	  pcmM[j]=mag;
-	  pcmA[j]=mag-ang;
-	}else{
-	  pcmA[j]=mag;
-	  pcmM[j]=mag+ang;
-	}
-      else
-	if(ang>0){
-	  pcmM[j]=mag;
-	  pcmA[j]=mag+ang;
-	}else{
-	  pcmA[j]=mag;
-	  pcmM[j]=mag-ang;
-	}
-    }
-  }
-
-  //for(j=0;j<vi->channels;j++)
-  //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0);
-
-  /* compute and apply spectral envelope */
-  for(i=0;i<vi->channels;i++){
-    ogg_int32_t *pcm=vb->pcm[i];
-    int submap=info->chmuxlist[i];
-    look->floor_func[submap]->
-      inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
-  }
-
-  //for(j=0;j<vi->channels;j++)
-  //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1);
-
-  /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
-  /* only MDCT right now.... */
-  for(i=0;i<vi->channels;i++){
-    ogg_int32_t *pcm=vb->pcm[i];
-    mdct_backward(n,pcm,pcm);
-  }
-
-  //for(j=0;j<vi->channels;j++)
-  //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0);
-
-  /* window the data */
-  for(i=0;i<vi->channels;i++){
-    ogg_int32_t *pcm=vb->pcm[i];
-    if(nonzero[i])
-      _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
-    else
-      for(j=0;j<n;j++)
-	pcm[j]=0;
-    
-  }
-
-  //for(j=0;j<vi->channels;j++)
-  //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0);
-
-  seq+=vi->channels;
-  /* all done! */
-  return(0);
-}
-
-/* export hooks */
-vorbis_func_mapping mapping0_exportbundle={
-  &mapping0_unpack,
-  &mapping0_look,
-  &mapping0_free_info,
-  &mapping0_free_look,
-  &mapping0_inverse
-};
--- a/misc/libtremor/mdct.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,510 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: normalized modified discrete cosine transform
-           power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.9 2002/10/16 09:17:39 xiphmont Exp $
-
- Original algorithm adapted long ago from _The use of multirate filter
- banks for coding of high quality digital audio_, by T. Sporer,
- K. Brandenburg and B. Edler, collection of the European Signal
- Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp
- 211-214
-
- The below code implements an algorithm that no longer looks much like
- that presented in the paper, but the basic structure remains if you
- dig deep enough to see it.
-
- This module DOES NOT INCLUDE code to generate/apply the window
- function.  Everybody has their own weird favorite including me... I
- happen to like the properties of y=sin(.5PI*sin^2(x)), but others may
- vehemently disagree.
-
- ********************************************************************/
-
-#include "ivorbiscodec.h"
-#include "codebook.h"
-#include "misc.h"
-#include "mdct.h"
-#include "mdct_lookup.h"
-
-
-/* 8 point butterfly (in place) */
-STIN void mdct_butterfly_8(DATA_TYPE *x){
-
-  REG_TYPE r0   = x[4] + x[0];
-  REG_TYPE r1   = x[4] - x[0];
-  REG_TYPE r2   = x[5] + x[1];
-  REG_TYPE r3   = x[5] - x[1];
-  REG_TYPE r4   = x[6] + x[2];
-  REG_TYPE r5   = x[6] - x[2];
-  REG_TYPE r6   = x[7] + x[3];
-  REG_TYPE r7   = x[7] - x[3];
-
-	   x[0] = r5   + r3;
-	   x[1] = r7   - r1;
-	   x[2] = r5   - r3;
-	   x[3] = r7   + r1;
-           x[4] = r4   - r0;
-	   x[5] = r6   - r2;
-           x[6] = r4   + r0;
-	   x[7] = r6   + r2;
-	   MB();
-}
-
-/* 16 point butterfly (in place, 4 register) */
-STIN void mdct_butterfly_16(DATA_TYPE *x){
-
-  REG_TYPE r0, r1;
-
-	   r0 = x[ 0] - x[ 8]; x[ 8] += x[ 0];
-	   r1 = x[ 1] - x[ 9]; x[ 9] += x[ 1];
-	   x[ 0] = MULT31((r0 + r1) , cPI2_8);
-	   x[ 1] = MULT31((r1 - r0) , cPI2_8);
-	   MB();
-
-	   r0 = x[10] - x[ 2]; x[10] += x[ 2];
-	   r1 = x[ 3] - x[11]; x[11] += x[ 3];
-	   x[ 2] = r1; x[ 3] = r0;
-	   MB();
-
-	   r0 = x[12] - x[ 4]; x[12] += x[ 4];
-	   r1 = x[13] - x[ 5]; x[13] += x[ 5];
-	   x[ 4] = MULT31((r0 - r1) , cPI2_8);
-	   x[ 5] = MULT31((r0 + r1) , cPI2_8);
-	   MB();
-
-	   r0 = x[14] - x[ 6]; x[14] += x[ 6];
-	   r1 = x[15] - x[ 7]; x[15] += x[ 7];
-	   x[ 6] = r0; x[ 7] = r1;
-	   MB();
-
-	   mdct_butterfly_8(x);
-	   mdct_butterfly_8(x+8);
-}
-
-/* 32 point butterfly (in place, 4 register) */
-STIN void mdct_butterfly_32(DATA_TYPE *x){
-
-  REG_TYPE r0, r1;
-
-	   r0 = x[30] - x[14]; x[30] += x[14];           
-	   r1 = x[31] - x[15]; x[31] += x[15];
-	   x[14] = r0; x[15] = r1;
-	   MB();
-
-	   r0 = x[28] - x[12]; x[28] += x[12];           
-	   r1 = x[29] - x[13]; x[29] += x[13];
-	   XNPROD31( r0, r1, cPI1_8, cPI3_8, &x[12], &x[13] );
-	   MB();
-
-	   r0 = x[26] - x[10]; x[26] += x[10];
-	   r1 = x[27] - x[11]; x[27] += x[11];
-	   x[10] = MULT31((r0 - r1) , cPI2_8);
-	   x[11] = MULT31((r0 + r1) , cPI2_8);
-	   MB();
-
-	   r0 = x[24] - x[ 8]; x[24] += x[ 8];
-	   r1 = x[25] - x[ 9]; x[25] += x[ 9];
-	   XNPROD31( r0, r1, cPI3_8, cPI1_8, &x[ 8], &x[ 9] );
-	   MB();
-
-	   r0 = x[22] - x[ 6]; x[22] += x[ 6];
-	   r1 = x[ 7] - x[23]; x[23] += x[ 7];
-	   x[ 6] = r1; x[ 7] = r0;
-	   MB();
-
-	   r0 = x[ 4] - x[20]; x[20] += x[ 4];
-	   r1 = x[ 5] - x[21]; x[21] += x[ 5];
-	   XPROD31 ( r0, r1, cPI3_8, cPI1_8, &x[ 4], &x[ 5] );
-	   MB();
-
-	   r0 = x[ 2] - x[18]; x[18] += x[ 2];
-	   r1 = x[ 3] - x[19]; x[19] += x[ 3];
-	   x[ 2] = MULT31((r1 + r0) , cPI2_8);
-	   x[ 3] = MULT31((r1 - r0) , cPI2_8);
-	   MB();
-
-	   r0 = x[ 0] - x[16]; x[16] += x[ 0];
-	   r1 = x[ 1] - x[17]; x[17] += x[ 1];
-	   XPROD31 ( r0, r1, cPI1_8, cPI3_8, &x[ 0], &x[ 1] );
-	   MB();
-
-	   mdct_butterfly_16(x);
-	   mdct_butterfly_16(x+16);
-}
-
-/* N/stage point generic N stage butterfly (in place, 2 register) */
-STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
-
-  LOOKUP_T *T   = sincos_lookup0;
-  DATA_TYPE *x1        = x + points      - 8;
-  DATA_TYPE *x2        = x + (points>>1) - 8;
-  REG_TYPE   r0;
-  REG_TYPE   r1;
-
-  do{
-    r0 = x1[6] - x2[6]; x1[6] += x2[6];
-    r1 = x2[7] - x1[7]; x1[7] += x2[7];
-    XPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T+=step;
-
-    r0 = x1[4] - x2[4]; x1[4] += x2[4];
-    r1 = x2[5] - x1[5]; x1[5] += x2[5];
-    XPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T+=step;
-
-    r0 = x1[2] - x2[2]; x1[2] += x2[2];
-    r1 = x2[3] - x1[3]; x1[3] += x2[3];
-    XPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T+=step;
-
-    r0 = x1[0] - x2[0]; x1[0] += x2[0];
-    r1 = x2[1] - x1[1]; x1[1] += x2[1];
-    XPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T+=step;
-
-    x1-=8; x2-=8;
-  }while(T<sincos_lookup0+1024);
-  do{
-    r0 = x1[6] - x2[6]; x1[6] += x2[6];
-    r1 = x1[7] - x2[7]; x1[7] += x2[7];
-    XNPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T-=step;
-
-    r0 = x1[4] - x2[4]; x1[4] += x2[4];
-    r1 = x1[5] - x2[5]; x1[5] += x2[5];
-    XNPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T-=step;
-
-    r0 = x1[2] - x2[2]; x1[2] += x2[2];
-    r1 = x1[3] - x2[3]; x1[3] += x2[3];
-    XNPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T-=step;
-
-    r0 = x1[0] - x2[0]; x1[0] += x2[0];
-    r1 = x1[1] - x2[1]; x1[1] += x2[1];
-    XNPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T-=step;
-
-    x1-=8; x2-=8;
-  }while(T>sincos_lookup0);
-  do{
-    r0 = x2[6] - x1[6]; x1[6] += x2[6];
-    r1 = x2[7] - x1[7]; x1[7] += x2[7];
-    XPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T+=step;
-
-    r0 = x2[4] - x1[4]; x1[4] += x2[4];
-    r1 = x2[5] - x1[5]; x1[5] += x2[5];
-    XPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T+=step;
-
-    r0 = x2[2] - x1[2]; x1[2] += x2[2];
-    r1 = x2[3] - x1[3]; x1[3] += x2[3];
-    XPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T+=step;
-
-    r0 = x2[0] - x1[0]; x1[0] += x2[0];
-    r1 = x2[1] - x1[1]; x1[1] += x2[1];
-    XPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T+=step;
-
-    x1-=8; x2-=8;
-  }while(T<sincos_lookup0+1024);
-  do{
-    r0 = x1[6] - x2[6]; x1[6] += x2[6];
-    r1 = x2[7] - x1[7]; x1[7] += x2[7];
-    XNPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T-=step;
-
-    r0 = x1[4] - x2[4]; x1[4] += x2[4];
-    r1 = x2[5] - x1[5]; x1[5] += x2[5];
-    XNPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T-=step;
-
-    r0 = x1[2] - x2[2]; x1[2] += x2[2];
-    r1 = x2[3] - x1[3]; x1[3] += x2[3];
-    XNPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T-=step;
-
-    r0 = x1[0] - x2[0]; x1[0] += x2[0];
-    r1 = x2[1] - x1[1]; x1[1] += x2[1];
-    XNPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T-=step;
-
-    x1-=8; x2-=8;
-  }while(T>sincos_lookup0);
-}
-
-STIN void mdct_butterflies(DATA_TYPE *x,int points,int shift){
-
-  int stages=8-shift;
-  int i,j;
-  
-  for(i=0;--stages>0;i++){
-    for(j=0;j<(1<<i);j++)
-      mdct_butterfly_generic(x+(points>>i)*j,points>>i,4<<(i+shift));
-  }
-
-  for(j=0;j<points;j+=32)
-    mdct_butterfly_32(x+j);
-
-}
-
-static unsigned char bitrev[16]={0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
-
-STIN int bitrev12(int x){
-  return bitrev[x>>8]|(bitrev[(x&0x0f0)>>4]<<4)|(((int)bitrev[x&0x00f])<<8);
-}
-
-STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
-
-  int          bit   = 0;
-  DATA_TYPE   *w0    = x;
-  DATA_TYPE   *w1    = x = w0+(n>>1);
-  LOOKUP_T    *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
-  LOOKUP_T    *Ttop  = T+1024;
-  DATA_TYPE    r2;
-
-  do{
-    DATA_TYPE r3     = bitrev12(bit++);
-    DATA_TYPE *x0    = x + ((r3 ^ 0xfff)>>shift) -1;
-    DATA_TYPE *x1    = x + (r3>>shift);
-
-    REG_TYPE  r0     = x0[0]  + x1[0];
-    REG_TYPE  r1     = x1[1]  - x0[1];
-
-	      XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
-
-	      w1    -= 4;
-
-	      r0     = (x0[1] + x1[1])>>1;
-              r1     = (x0[0] - x1[0])>>1;
-	      w0[0]  = r0     + r2;
-	      w0[1]  = r1     + r3;
-	      w1[2]  = r0     - r2;
-	      w1[3]  = r3     - r1;
-
-	      r3     = bitrev12(bit++);
-              x0     = x + ((r3 ^ 0xfff)>>shift) -1;
-              x1     = x + (r3>>shift);
-
-              r0     = x0[0]  + x1[0];
-              r1     = x1[1]  - x0[1];
-
-	      XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
-
-              r0     = (x0[1] + x1[1])>>1;
-              r1     = (x0[0] - x1[0])>>1;
-	      w0[2]  = r0     + r2;
-	      w0[3]  = r1     + r3;
-	      w1[0]  = r0     - r2;
-	      w1[1]  = r3     - r1;
-
-	      w0    += 4;
-  }while(T<Ttop);
-  do{
-    DATA_TYPE r3     = bitrev12(bit++);
-    DATA_TYPE *x0    = x + ((r3 ^ 0xfff)>>shift) -1;
-    DATA_TYPE *x1    = x + (r3>>shift);
-
-    REG_TYPE  r0     = x0[0]  + x1[0];
-    REG_TYPE  r1     = x1[1]  - x0[1];
-
-	      T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
-
-	      w1    -= 4;
-
-	      r0     = (x0[1] + x1[1])>>1;
-              r1     = (x0[0] - x1[0])>>1;
-	      w0[0]  = r0     + r2;
-	      w0[1]  = r1     + r3;
-	      w1[2]  = r0     - r2;
-	      w1[3]  = r3     - r1;
-
-	      r3     = bitrev12(bit++);
-              x0     = x + ((r3 ^ 0xfff)>>shift) -1;
-              x1     = x + (r3>>shift);
-
-              r0     = x0[0]  + x1[0];
-              r1     = x1[1]  - x0[1];
-
-	      T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
-
-              r0     = (x0[1] + x1[1])>>1;
-              r1     = (x0[0] - x1[0])>>1;
-	      w0[2]  = r0     + r2;
-	      w0[3]  = r1     + r3;
-	      w1[0]  = r0     - r2;
-	      w1[1]  = r3     - r1;
-
-	      w0    += 4;
-  }while(w0<w1);
-}
-
-void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
-  int n2=n>>1;
-  int n4=n>>2;
-  DATA_TYPE *iX;
-  DATA_TYPE *oX;
-  LOOKUP_T *T;
-  LOOKUP_T *V;
-  int shift;
-  int step;
-
-  for (shift=6;!(n&(1<<shift));shift++);
-  shift=13-shift;
-  step=2<<shift;
-   
-  /* rotate */
-
-  iX            = in+n2-7;
-  oX            = out+n2+n4;
-  T             = sincos_lookup0;
-
-  do{
-    oX-=4;
-    XPROD31( iX[4], iX[6], T[0], T[1], &oX[2], &oX[3] ); T+=step;
-    XPROD31( iX[0], iX[2], T[0], T[1], &oX[0], &oX[1] ); T+=step;
-    iX-=8;
-  }while(iX>=in+n4);
-  do{
-    oX-=4;
-    XPROD31( iX[4], iX[6], T[1], T[0], &oX[2], &oX[3] ); T-=step;
-    XPROD31( iX[0], iX[2], T[1], T[0], &oX[0], &oX[1] ); T-=step;
-    iX-=8;
-  }while(iX>=in);
-
-  iX            = in+n2-8;
-  oX            = out+n2+n4;
-  T             = sincos_lookup0;
-
-  do{
-    T+=step; XNPROD31( iX[6], iX[4], T[0], T[1], &oX[0], &oX[1] );
-    T+=step; XNPROD31( iX[2], iX[0], T[0], T[1], &oX[2], &oX[3] );
-    iX-=8;
-    oX+=4;
-  }while(iX>=in+n4);
-  do{
-    T-=step; XNPROD31( iX[6], iX[4], T[1], T[0], &oX[0], &oX[1] );
-    T-=step; XNPROD31( iX[2], iX[0], T[1], T[0], &oX[2], &oX[3] );
-    iX-=8;
-    oX+=4;
-  }while(iX>=in);
-
-  mdct_butterflies(out+n2,n2,shift);
-  mdct_bitreverse(out,n,step,shift);
-
-  /* rotate + window */
-
-  step>>=2;
-  {
-    DATA_TYPE *oX1=out+n2+n4;
-    DATA_TYPE *oX2=out+n2+n4;
-    DATA_TYPE *iX =out;
-
-    switch(step) {
-      default: {
-        T=(step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
-        do{
-          oX1-=4;
-	  XPROD31( iX[0], -iX[1], T[0], T[1], &oX1[3], &oX2[0] ); T+=step;
-	  XPROD31( iX[2], -iX[3], T[0], T[1], &oX1[2], &oX2[1] ); T+=step;
-	  XPROD31( iX[4], -iX[5], T[0], T[1], &oX1[1], &oX2[2] ); T+=step;
-	  XPROD31( iX[6], -iX[7], T[0], T[1], &oX1[0], &oX2[3] ); T+=step;
-	  oX2+=4;
-	  iX+=8;
-	}while(iX<oX1);
-	break;
-      }
-
-      case 1: {
-        /* linear interpolation between table values: offset=0.5, step=1 */
-	REG_TYPE  t0,t1,v0,v1;
-        T         = sincos_lookup0;
-        V         = sincos_lookup1;
-	t0        = (*T++)>>1;
-	t1        = (*T++)>>1;
-        do{
-          oX1-=4;
-
-	  t0 += (v0 = (*V++)>>1);
-	  t1 += (v1 = (*V++)>>1);
-	  XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
-	  v0 += (t0 = (*T++)>>1);
-	  v1 += (t1 = (*T++)>>1);
-	  XPROD31( iX[2], -iX[3], v0, v1, &oX1[2], &oX2[1] );
-	  t0 += (v0 = (*V++)>>1);
-	  t1 += (v1 = (*V++)>>1);
-	  XPROD31( iX[4], -iX[5], t0, t1, &oX1[1], &oX2[2] );
-	  v0 += (t0 = (*T++)>>1);
-	  v1 += (t1 = (*T++)>>1);
-	  XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
-
-	  oX2+=4;
-	  iX+=8;
-	}while(iX<oX1);
-	break;
-      }
-
-      case 0: {
-        /* linear interpolation between table values: offset=0.25, step=0.5 */
-	REG_TYPE  t0,t1,v0,v1,q0,q1;
-        T         = sincos_lookup0;
-        V         = sincos_lookup1;
-	t0        = *T++;
-	t1        = *T++;
-        do{
-          oX1-=4;
-
-	  v0  = *V++;
-	  v1  = *V++;
-	  t0 +=  (q0 = (v0-t0)>>2);
-	  t1 +=  (q1 = (v1-t1)>>2);
-	  XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
-	  t0  = v0-q0;
-	  t1  = v1-q1;
-	  XPROD31( iX[2], -iX[3], t0, t1, &oX1[2], &oX2[1] );
-
-	  t0  = *T++;
-	  t1  = *T++;
-	  v0 += (q0 = (t0-v0)>>2);
-	  v1 += (q1 = (t1-v1)>>2);
-	  XPROD31( iX[4], -iX[5], v0, v1, &oX1[1], &oX2[2] );
-	  v0  = t0-q0;
-	  v1  = t1-q1;
-	  XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
-
-	  oX2+=4;
-	  iX+=8;
-	}while(iX<oX1);
-	break;
-      }
-    }
-
-    iX=out+n2+n4;
-    oX1=out+n4;
-    oX2=oX1;
-
-    do{
-      oX1-=4;
-      iX-=4;
-
-      oX2[0] = -(oX1[3] = iX[3]);
-      oX2[1] = -(oX1[2] = iX[2]);
-      oX2[2] = -(oX1[1] = iX[1]);
-      oX2[3] = -(oX1[0] = iX[0]);
-
-      oX2+=4;
-    }while(oX2<iX);
-
-    iX=out+n2+n4;
-    oX1=out+n2+n4;
-    oX2=out+n2;
-
-    do{
-      oX1-=4;
-      oX1[0]= iX[3];
-      oX1[1]= iX[2];
-      oX1[2]= iX[1];
-      oX1[3]= iX[0];
-      iX+=4;
-    }while(oX1>oX2);
-  }
-}
-
--- a/misc/libtremor/mdct.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: modified discrete cosine transform prototypes
-
- ********************************************************************/
-
-#ifndef _OGG_mdct_H_
-#define _OGG_mdct_H_
-
-#include "ivorbiscodec.h"
-#include "misc.h"
-
-#define DATA_TYPE ogg_int32_t
-#define REG_TYPE  register ogg_int32_t
-
-#ifdef _LOW_ACCURACY_
-#define cPI3_8 (0x0062)
-#define cPI2_8 (0x00b5)
-#define cPI1_8 (0x00ed)
-#else
-#define cPI3_8 (0x30fbc54d)
-#define cPI2_8 (0x5a82799a)
-#define cPI1_8 (0x7641af3d)
-#endif
-
-extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out);
-extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out);
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
--- a/misc/libtremor/mdct_lookup.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,540 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: sin,cos lookup tables
-
- ********************************************************************/
-  
-#include "os_types.h"
-
-/* {sin(2*i*PI/4096), cos(2*i*PI/4096)}, with i = 0 to 512 */
-static LOOKUP_T sincos_lookup0[1026] = {
-  X(0x00000000), X(0x7fffffff), X(0x003243f5), X(0x7ffff621),
-  X(0x006487e3), X(0x7fffd886), X(0x0096cbc1), X(0x7fffa72c),
-  X(0x00c90f88), X(0x7fff6216), X(0x00fb5330), X(0x7fff0943),
-  X(0x012d96b1), X(0x7ffe9cb2), X(0x015fda03), X(0x7ffe1c65),
-  X(0x01921d20), X(0x7ffd885a), X(0x01c45ffe), X(0x7ffce093),
-  X(0x01f6a297), X(0x7ffc250f), X(0x0228e4e2), X(0x7ffb55ce),
-  X(0x025b26d7), X(0x7ffa72d1), X(0x028d6870), X(0x7ff97c18),
-  X(0x02bfa9a4), X(0x7ff871a2), X(0x02f1ea6c), X(0x7ff75370),
-  X(0x03242abf), X(0x7ff62182), X(0x03566a96), X(0x7ff4dbd9),
-  X(0x0388a9ea), X(0x7ff38274), X(0x03bae8b2), X(0x7ff21553),
-  X(0x03ed26e6), X(0x7ff09478), X(0x041f6480), X(0x7feeffe1),
-  X(0x0451a177), X(0x7fed5791), X(0x0483ddc3), X(0x7feb9b85),
-  X(0x04b6195d), X(0x7fe9cbc0), X(0x04e8543e), X(0x7fe7e841),
-  X(0x051a8e5c), X(0x7fe5f108), X(0x054cc7b1), X(0x7fe3e616),
-  X(0x057f0035), X(0x7fe1c76b), X(0x05b137df), X(0x7fdf9508),
-  X(0x05e36ea9), X(0x7fdd4eec), X(0x0615a48b), X(0x7fdaf519),
-  X(0x0647d97c), X(0x7fd8878e), X(0x067a0d76), X(0x7fd6064c),
-  X(0x06ac406f), X(0x7fd37153), X(0x06de7262), X(0x7fd0c8a3),
-  X(0x0710a345), X(0x7fce0c3e), X(0x0742d311), X(0x7fcb3c23),
-  X(0x077501be), X(0x7fc85854), X(0x07a72f45), X(0x7fc560cf),
-  X(0x07d95b9e), X(0x7fc25596), X(0x080b86c2), X(0x7fbf36aa),
-  X(0x083db0a7), X(0x7fbc040a), X(0x086fd947), X(0x7fb8bdb8),
-  X(0x08a2009a), X(0x7fb563b3), X(0x08d42699), X(0x7fb1f5fc),
-  X(0x09064b3a), X(0x7fae7495), X(0x09386e78), X(0x7faadf7c),
-  X(0x096a9049), X(0x7fa736b4), X(0x099cb0a7), X(0x7fa37a3c),
-  X(0x09cecf89), X(0x7f9faa15), X(0x0a00ece8), X(0x7f9bc640),
-  X(0x0a3308bd), X(0x7f97cebd), X(0x0a6522fe), X(0x7f93c38c),
-  X(0x0a973ba5), X(0x7f8fa4b0), X(0x0ac952aa), X(0x7f8b7227),
-  X(0x0afb6805), X(0x7f872bf3), X(0x0b2d7baf), X(0x7f82d214),
-  X(0x0b5f8d9f), X(0x7f7e648c), X(0x0b919dcf), X(0x7f79e35a),
-  X(0x0bc3ac35), X(0x7f754e80), X(0x0bf5b8cb), X(0x7f70a5fe),
-  X(0x0c27c389), X(0x7f6be9d4), X(0x0c59cc68), X(0x7f671a05),
-  X(0x0c8bd35e), X(0x7f62368f), X(0x0cbdd865), X(0x7f5d3f75),
-  X(0x0cefdb76), X(0x7f5834b7), X(0x0d21dc87), X(0x7f531655),
-  X(0x0d53db92), X(0x7f4de451), X(0x0d85d88f), X(0x7f489eaa),
-  X(0x0db7d376), X(0x7f434563), X(0x0de9cc40), X(0x7f3dd87c),
-  X(0x0e1bc2e4), X(0x7f3857f6), X(0x0e4db75b), X(0x7f32c3d1),
-  X(0x0e7fa99e), X(0x7f2d1c0e), X(0x0eb199a4), X(0x7f2760af),
-  X(0x0ee38766), X(0x7f2191b4), X(0x0f1572dc), X(0x7f1baf1e),
-  X(0x0f475bff), X(0x7f15b8ee), X(0x0f7942c7), X(0x7f0faf25),
-  X(0x0fab272b), X(0x7f0991c4), X(0x0fdd0926), X(0x7f0360cb),
-  X(0x100ee8ad), X(0x7efd1c3c), X(0x1040c5bb), X(0x7ef6c418),
-  X(0x1072a048), X(0x7ef05860), X(0x10a4784b), X(0x7ee9d914),
-  X(0x10d64dbd), X(0x7ee34636), X(0x11082096), X(0x7edc9fc6),
-  X(0x1139f0cf), X(0x7ed5e5c6), X(0x116bbe60), X(0x7ecf1837),
-  X(0x119d8941), X(0x7ec8371a), X(0x11cf516a), X(0x7ec14270),
-  X(0x120116d5), X(0x7eba3a39), X(0x1232d979), X(0x7eb31e78),
-  X(0x1264994e), X(0x7eabef2c), X(0x1296564d), X(0x7ea4ac58),
-  X(0x12c8106f), X(0x7e9d55fc), X(0x12f9c7aa), X(0x7e95ec1a),
-  X(0x132b7bf9), X(0x7e8e6eb2), X(0x135d2d53), X(0x7e86ddc6),
-  X(0x138edbb1), X(0x7e7f3957), X(0x13c0870a), X(0x7e778166),
-  X(0x13f22f58), X(0x7e6fb5f4), X(0x1423d492), X(0x7e67d703),
-  X(0x145576b1), X(0x7e5fe493), X(0x148715ae), X(0x7e57dea7),
-  X(0x14b8b17f), X(0x7e4fc53e), X(0x14ea4a1f), X(0x7e47985b),
-  X(0x151bdf86), X(0x7e3f57ff), X(0x154d71aa), X(0x7e37042a),
-  X(0x157f0086), X(0x7e2e9cdf), X(0x15b08c12), X(0x7e26221f),
-  X(0x15e21445), X(0x7e1d93ea), X(0x16139918), X(0x7e14f242),
-  X(0x16451a83), X(0x7e0c3d29), X(0x1676987f), X(0x7e0374a0),
-  X(0x16a81305), X(0x7dfa98a8), X(0x16d98a0c), X(0x7df1a942),
-  X(0x170afd8d), X(0x7de8a670), X(0x173c6d80), X(0x7ddf9034),
-  X(0x176dd9de), X(0x7dd6668f), X(0x179f429f), X(0x7dcd2981),
-  X(0x17d0a7bc), X(0x7dc3d90d), X(0x1802092c), X(0x7dba7534),
-  X(0x183366e9), X(0x7db0fdf8), X(0x1864c0ea), X(0x7da77359),
-  X(0x18961728), X(0x7d9dd55a), X(0x18c7699b), X(0x7d9423fc),
-  X(0x18f8b83c), X(0x7d8a5f40), X(0x192a0304), X(0x7d808728),
-  X(0x195b49ea), X(0x7d769bb5), X(0x198c8ce7), X(0x7d6c9ce9),
-  X(0x19bdcbf3), X(0x7d628ac6), X(0x19ef0707), X(0x7d58654d),
-  X(0x1a203e1b), X(0x7d4e2c7f), X(0x1a517128), X(0x7d43e05e),
-  X(0x1a82a026), X(0x7d3980ec), X(0x1ab3cb0d), X(0x7d2f0e2b),
-  X(0x1ae4f1d6), X(0x7d24881b), X(0x1b161479), X(0x7d19eebf),
-  X(0x1b4732ef), X(0x7d0f4218), X(0x1b784d30), X(0x7d048228),
-  X(0x1ba96335), X(0x7cf9aef0), X(0x1bda74f6), X(0x7ceec873),
-  X(0x1c0b826a), X(0x7ce3ceb2), X(0x1c3c8b8c), X(0x7cd8c1ae),
-  X(0x1c6d9053), X(0x7ccda169), X(0x1c9e90b8), X(0x7cc26de5),
-  X(0x1ccf8cb3), X(0x7cb72724), X(0x1d00843d), X(0x7cabcd28),
-  X(0x1d31774d), X(0x7ca05ff1), X(0x1d6265dd), X(0x7c94df83),
-  X(0x1d934fe5), X(0x7c894bde), X(0x1dc4355e), X(0x7c7da505),
-  X(0x1df5163f), X(0x7c71eaf9), X(0x1e25f282), X(0x7c661dbc),
-  X(0x1e56ca1e), X(0x7c5a3d50), X(0x1e879d0d), X(0x7c4e49b7),
-  X(0x1eb86b46), X(0x7c4242f2), X(0x1ee934c3), X(0x7c362904),
-  X(0x1f19f97b), X(0x7c29fbee), X(0x1f4ab968), X(0x7c1dbbb3),
-  X(0x1f7b7481), X(0x7c116853), X(0x1fac2abf), X(0x7c0501d2),
-  X(0x1fdcdc1b), X(0x7bf88830), X(0x200d888d), X(0x7bebfb70),
-  X(0x203e300d), X(0x7bdf5b94), X(0x206ed295), X(0x7bd2a89e),
-  X(0x209f701c), X(0x7bc5e290), X(0x20d0089c), X(0x7bb9096b),
-  X(0x21009c0c), X(0x7bac1d31), X(0x21312a65), X(0x7b9f1de6),
-  X(0x2161b3a0), X(0x7b920b89), X(0x219237b5), X(0x7b84e61f),
-  X(0x21c2b69c), X(0x7b77ada8), X(0x21f3304f), X(0x7b6a6227),
-  X(0x2223a4c5), X(0x7b5d039e), X(0x225413f8), X(0x7b4f920e),
-  X(0x22847de0), X(0x7b420d7a), X(0x22b4e274), X(0x7b3475e5),
-  X(0x22e541af), X(0x7b26cb4f), X(0x23159b88), X(0x7b190dbc),
-  X(0x2345eff8), X(0x7b0b3d2c), X(0x23763ef7), X(0x7afd59a4),
-  X(0x23a6887f), X(0x7aef6323), X(0x23d6cc87), X(0x7ae159ae),
-  X(0x24070b08), X(0x7ad33d45), X(0x243743fa), X(0x7ac50dec),
-  X(0x24677758), X(0x7ab6cba4), X(0x2497a517), X(0x7aa8766f),
-  X(0x24c7cd33), X(0x7a9a0e50), X(0x24f7efa2), X(0x7a8b9348),
-  X(0x25280c5e), X(0x7a7d055b), X(0x2558235f), X(0x7a6e648a),
-  X(0x2588349d), X(0x7a5fb0d8), X(0x25b84012), X(0x7a50ea47),
-  X(0x25e845b6), X(0x7a4210d8), X(0x26184581), X(0x7a332490),
-  X(0x26483f6c), X(0x7a24256f), X(0x26783370), X(0x7a151378),
-  X(0x26a82186), X(0x7a05eead), X(0x26d809a5), X(0x79f6b711),
-  X(0x2707ebc7), X(0x79e76ca7), X(0x2737c7e3), X(0x79d80f6f),
-  X(0x27679df4), X(0x79c89f6e), X(0x27976df1), X(0x79b91ca4),
-  X(0x27c737d3), X(0x79a98715), X(0x27f6fb92), X(0x7999dec4),
-  X(0x2826b928), X(0x798a23b1), X(0x2856708d), X(0x797a55e0),
-  X(0x288621b9), X(0x796a7554), X(0x28b5cca5), X(0x795a820e),
-  X(0x28e5714b), X(0x794a7c12), X(0x29150fa1), X(0x793a6361),
-  X(0x2944a7a2), X(0x792a37fe), X(0x29743946), X(0x7919f9ec),
-  X(0x29a3c485), X(0x7909a92d), X(0x29d34958), X(0x78f945c3),
-  X(0x2a02c7b8), X(0x78e8cfb2), X(0x2a323f9e), X(0x78d846fb),
-  X(0x2a61b101), X(0x78c7aba2), X(0x2a911bdc), X(0x78b6fda8),
-  X(0x2ac08026), X(0x78a63d11), X(0x2aefddd8), X(0x789569df),
-  X(0x2b1f34eb), X(0x78848414), X(0x2b4e8558), X(0x78738bb3),
-  X(0x2b7dcf17), X(0x786280bf), X(0x2bad1221), X(0x7851633b),
-  X(0x2bdc4e6f), X(0x78403329), X(0x2c0b83fa), X(0x782ef08b),
-  X(0x2c3ab2b9), X(0x781d9b65), X(0x2c69daa6), X(0x780c33b8),
-  X(0x2c98fbba), X(0x77fab989), X(0x2cc815ee), X(0x77e92cd9),
-  X(0x2cf72939), X(0x77d78daa), X(0x2d263596), X(0x77c5dc01),
-  X(0x2d553afc), X(0x77b417df), X(0x2d843964), X(0x77a24148),
-  X(0x2db330c7), X(0x7790583e), X(0x2de2211e), X(0x777e5cc3),
-  X(0x2e110a62), X(0x776c4edb), X(0x2e3fec8b), X(0x775a2e89),
-  X(0x2e6ec792), X(0x7747fbce), X(0x2e9d9b70), X(0x7735b6af),
-  X(0x2ecc681e), X(0x77235f2d), X(0x2efb2d95), X(0x7710f54c),
-  X(0x2f29ebcc), X(0x76fe790e), X(0x2f58a2be), X(0x76ebea77),
-  X(0x2f875262), X(0x76d94989), X(0x2fb5fab2), X(0x76c69647),
-  X(0x2fe49ba7), X(0x76b3d0b4), X(0x30133539), X(0x76a0f8d2),
-  X(0x3041c761), X(0x768e0ea6), X(0x30705217), X(0x767b1231),
-  X(0x309ed556), X(0x76680376), X(0x30cd5115), X(0x7654e279),
-  X(0x30fbc54d), X(0x7641af3d), X(0x312a31f8), X(0x762e69c4),
-  X(0x3158970e), X(0x761b1211), X(0x3186f487), X(0x7607a828),
-  X(0x31b54a5e), X(0x75f42c0b), X(0x31e39889), X(0x75e09dbd),
-  X(0x3211df04), X(0x75ccfd42), X(0x32401dc6), X(0x75b94a9c),
-  X(0x326e54c7), X(0x75a585cf), X(0x329c8402), X(0x7591aedd),
-  X(0x32caab6f), X(0x757dc5ca), X(0x32f8cb07), X(0x7569ca99),
-  X(0x3326e2c3), X(0x7555bd4c), X(0x3354f29b), X(0x75419de7),
-  X(0x3382fa88), X(0x752d6c6c), X(0x33b0fa84), X(0x751928e0),
-  X(0x33def287), X(0x7504d345), X(0x340ce28b), X(0x74f06b9e),
-  X(0x343aca87), X(0x74dbf1ef), X(0x3468aa76), X(0x74c7663a),
-  X(0x34968250), X(0x74b2c884), X(0x34c4520d), X(0x749e18cd),
-  X(0x34f219a8), X(0x7489571c), X(0x351fd918), X(0x74748371),
-  X(0x354d9057), X(0x745f9dd1), X(0x357b3f5d), X(0x744aa63f),
-  X(0x35a8e625), X(0x74359cbd), X(0x35d684a6), X(0x74208150),
-  X(0x36041ad9), X(0x740b53fb), X(0x3631a8b8), X(0x73f614c0),
-  X(0x365f2e3b), X(0x73e0c3a3), X(0x368cab5c), X(0x73cb60a8),
-  X(0x36ba2014), X(0x73b5ebd1), X(0x36e78c5b), X(0x73a06522),
-  X(0x3714f02a), X(0x738acc9e), X(0x37424b7b), X(0x73752249),
-  X(0x376f9e46), X(0x735f6626), X(0x379ce885), X(0x73499838),
-  X(0x37ca2a30), X(0x7333b883), X(0x37f76341), X(0x731dc70a),
-  X(0x382493b0), X(0x7307c3d0), X(0x3851bb77), X(0x72f1aed9),
-  X(0x387eda8e), X(0x72db8828), X(0x38abf0ef), X(0x72c54fc1),
-  X(0x38d8fe93), X(0x72af05a7), X(0x39060373), X(0x7298a9dd),
-  X(0x3932ff87), X(0x72823c67), X(0x395ff2c9), X(0x726bbd48),
-  X(0x398cdd32), X(0x72552c85), X(0x39b9bebc), X(0x723e8a20),
-  X(0x39e6975e), X(0x7227d61c), X(0x3a136712), X(0x7211107e),
-  X(0x3a402dd2), X(0x71fa3949), X(0x3a6ceb96), X(0x71e35080),
-  X(0x3a99a057), X(0x71cc5626), X(0x3ac64c0f), X(0x71b54a41),
-  X(0x3af2eeb7), X(0x719e2cd2), X(0x3b1f8848), X(0x7186fdde),
-  X(0x3b4c18ba), X(0x716fbd68), X(0x3b78a007), X(0x71586b74),
-  X(0x3ba51e29), X(0x71410805), X(0x3bd19318), X(0x7129931f),
-  X(0x3bfdfecd), X(0x71120cc5), X(0x3c2a6142), X(0x70fa74fc),
-  X(0x3c56ba70), X(0x70e2cbc6), X(0x3c830a50), X(0x70cb1128),
-  X(0x3caf50da), X(0x70b34525), X(0x3cdb8e09), X(0x709b67c0),
-  X(0x3d07c1d6), X(0x708378ff), X(0x3d33ec39), X(0x706b78e3),
-  X(0x3d600d2c), X(0x70536771), X(0x3d8c24a8), X(0x703b44ad),
-  X(0x3db832a6), X(0x7023109a), X(0x3de4371f), X(0x700acb3c),
-  X(0x3e10320d), X(0x6ff27497), X(0x3e3c2369), X(0x6fda0cae),
-  X(0x3e680b2c), X(0x6fc19385), X(0x3e93e950), X(0x6fa90921),
-  X(0x3ebfbdcd), X(0x6f906d84), X(0x3eeb889c), X(0x6f77c0b3),
-  X(0x3f1749b8), X(0x6f5f02b2), X(0x3f430119), X(0x6f463383),
-  X(0x3f6eaeb8), X(0x6f2d532c), X(0x3f9a5290), X(0x6f1461b0),
-  X(0x3fc5ec98), X(0x6efb5f12), X(0x3ff17cca), X(0x6ee24b57),
-  X(0x401d0321), X(0x6ec92683), X(0x40487f94), X(0x6eaff099),
-  X(0x4073f21d), X(0x6e96a99d), X(0x409f5ab6), X(0x6e7d5193),
-  X(0x40cab958), X(0x6e63e87f), X(0x40f60dfb), X(0x6e4a6e66),
-  X(0x4121589b), X(0x6e30e34a), X(0x414c992f), X(0x6e174730),
-  X(0x4177cfb1), X(0x6dfd9a1c), X(0x41a2fc1a), X(0x6de3dc11),
-  X(0x41ce1e65), X(0x6dca0d14), X(0x41f93689), X(0x6db02d29),
-  X(0x42244481), X(0x6d963c54), X(0x424f4845), X(0x6d7c3a98),
-  X(0x427a41d0), X(0x6d6227fa), X(0x42a5311b), X(0x6d48047e),
-  X(0x42d0161e), X(0x6d2dd027), X(0x42faf0d4), X(0x6d138afb),
-  X(0x4325c135), X(0x6cf934fc), X(0x4350873c), X(0x6cdece2f),
-  X(0x437b42e1), X(0x6cc45698), X(0x43a5f41e), X(0x6ca9ce3b),
-  X(0x43d09aed), X(0x6c8f351c), X(0x43fb3746), X(0x6c748b3f),
-  X(0x4425c923), X(0x6c59d0a9), X(0x4450507e), X(0x6c3f055d),
-  X(0x447acd50), X(0x6c242960), X(0x44a53f93), X(0x6c093cb6),
-  X(0x44cfa740), X(0x6bee3f62), X(0x44fa0450), X(0x6bd3316a),
-  X(0x452456bd), X(0x6bb812d1), X(0x454e9e80), X(0x6b9ce39b),
-  X(0x4578db93), X(0x6b81a3cd), X(0x45a30df0), X(0x6b66536b),
-  X(0x45cd358f), X(0x6b4af279), X(0x45f7526b), X(0x6b2f80fb),
-  X(0x4621647d), X(0x6b13fef5), X(0x464b6bbe), X(0x6af86c6c),
-  X(0x46756828), X(0x6adcc964), X(0x469f59b4), X(0x6ac115e2),
-  X(0x46c9405c), X(0x6aa551e9), X(0x46f31c1a), X(0x6a897d7d),
-  X(0x471cece7), X(0x6a6d98a4), X(0x4746b2bc), X(0x6a51a361),
-  X(0x47706d93), X(0x6a359db9), X(0x479a1d67), X(0x6a1987b0),
-  X(0x47c3c22f), X(0x69fd614a), X(0x47ed5be6), X(0x69e12a8c),
-  X(0x4816ea86), X(0x69c4e37a), X(0x48406e08), X(0x69a88c19),
-  X(0x4869e665), X(0x698c246c), X(0x48935397), X(0x696fac78),
-  X(0x48bcb599), X(0x69532442), X(0x48e60c62), X(0x69368bce),
-  X(0x490f57ee), X(0x6919e320), X(0x49389836), X(0x68fd2a3d),
-  X(0x4961cd33), X(0x68e06129), X(0x498af6df), X(0x68c387e9),
-  X(0x49b41533), X(0x68a69e81), X(0x49dd282a), X(0x6889a4f6),
-  X(0x4a062fbd), X(0x686c9b4b), X(0x4a2f2be6), X(0x684f8186),
-  X(0x4a581c9e), X(0x683257ab), X(0x4a8101de), X(0x68151dbe),
-  X(0x4aa9dba2), X(0x67f7d3c5), X(0x4ad2a9e2), X(0x67da79c3),
-  X(0x4afb6c98), X(0x67bd0fbd), X(0x4b2423be), X(0x679f95b7),
-  X(0x4b4ccf4d), X(0x67820bb7), X(0x4b756f40), X(0x676471c0),
-  X(0x4b9e0390), X(0x6746c7d8), X(0x4bc68c36), X(0x67290e02),
-  X(0x4bef092d), X(0x670b4444), X(0x4c177a6e), X(0x66ed6aa1),
-  X(0x4c3fdff4), X(0x66cf8120), X(0x4c6839b7), X(0x66b187c3),
-  X(0x4c9087b1), X(0x66937e91), X(0x4cb8c9dd), X(0x6675658c),
-  X(0x4ce10034), X(0x66573cbb), X(0x4d092ab0), X(0x66390422),
-  X(0x4d31494b), X(0x661abbc5), X(0x4d595bfe), X(0x65fc63a9),
-  X(0x4d8162c4), X(0x65ddfbd3), X(0x4da95d96), X(0x65bf8447),
-  X(0x4dd14c6e), X(0x65a0fd0b), X(0x4df92f46), X(0x65826622),
-  X(0x4e210617), X(0x6563bf92), X(0x4e48d0dd), X(0x6545095f),
-  X(0x4e708f8f), X(0x6526438f), X(0x4e984229), X(0x65076e25),
-  X(0x4ebfe8a5), X(0x64e88926), X(0x4ee782fb), X(0x64c99498),
-  X(0x4f0f1126), X(0x64aa907f), X(0x4f369320), X(0x648b7ce0),
-  X(0x4f5e08e3), X(0x646c59bf), X(0x4f857269), X(0x644d2722),
-  X(0x4faccfab), X(0x642de50d), X(0x4fd420a4), X(0x640e9386),
-  X(0x4ffb654d), X(0x63ef3290), X(0x50229da1), X(0x63cfc231),
-  X(0x5049c999), X(0x63b0426d), X(0x5070e92f), X(0x6390b34a),
-  X(0x5097fc5e), X(0x637114cc), X(0x50bf031f), X(0x635166f9),
-  X(0x50e5fd6d), X(0x6331a9d4), X(0x510ceb40), X(0x6311dd64),
-  X(0x5133cc94), X(0x62f201ac), X(0x515aa162), X(0x62d216b3),
-  X(0x518169a5), X(0x62b21c7b), X(0x51a82555), X(0x6292130c),
-  X(0x51ced46e), X(0x6271fa69), X(0x51f576ea), X(0x6251d298),
-  X(0x521c0cc2), X(0x62319b9d), X(0x524295f0), X(0x6211557e),
-  X(0x5269126e), X(0x61f1003f), X(0x528f8238), X(0x61d09be5),
-  X(0x52b5e546), X(0x61b02876), X(0x52dc3b92), X(0x618fa5f7),
-  X(0x53028518), X(0x616f146c), X(0x5328c1d0), X(0x614e73da),
-  X(0x534ef1b5), X(0x612dc447), X(0x537514c2), X(0x610d05b7),
-  X(0x539b2af0), X(0x60ec3830), X(0x53c13439), X(0x60cb5bb7),
-  X(0x53e73097), X(0x60aa7050), X(0x540d2005), X(0x60897601),
-  X(0x5433027d), X(0x60686ccf), X(0x5458d7f9), X(0x604754bf),
-  X(0x547ea073), X(0x60262dd6), X(0x54a45be6), X(0x6004f819),
-  X(0x54ca0a4b), X(0x5fe3b38d), X(0x54efab9c), X(0x5fc26038),
-  X(0x55153fd4), X(0x5fa0fe1f), X(0x553ac6ee), X(0x5f7f8d46),
-  X(0x556040e2), X(0x5f5e0db3), X(0x5585adad), X(0x5f3c7f6b),
-  X(0x55ab0d46), X(0x5f1ae274), X(0x55d05faa), X(0x5ef936d1),
-  X(0x55f5a4d2), X(0x5ed77c8a), X(0x561adcb9), X(0x5eb5b3a2),
-  X(0x56400758), X(0x5e93dc1f), X(0x566524aa), X(0x5e71f606),
-  X(0x568a34a9), X(0x5e50015d), X(0x56af3750), X(0x5e2dfe29),
-  X(0x56d42c99), X(0x5e0bec6e), X(0x56f9147e), X(0x5de9cc33),
-  X(0x571deefa), X(0x5dc79d7c), X(0x5742bc06), X(0x5da5604f),
-  X(0x57677b9d), X(0x5d8314b1), X(0x578c2dba), X(0x5d60baa7),
-  X(0x57b0d256), X(0x5d3e5237), X(0x57d5696d), X(0x5d1bdb65),
-  X(0x57f9f2f8), X(0x5cf95638), X(0x581e6ef1), X(0x5cd6c2b5),
-  X(0x5842dd54), X(0x5cb420e0), X(0x58673e1b), X(0x5c9170bf),
-  X(0x588b9140), X(0x5c6eb258), X(0x58afd6bd), X(0x5c4be5b0),
-  X(0x58d40e8c), X(0x5c290acc), X(0x58f838a9), X(0x5c0621b2),
-  X(0x591c550e), X(0x5be32a67), X(0x594063b5), X(0x5bc024f0),
-  X(0x59646498), X(0x5b9d1154), X(0x598857b2), X(0x5b79ef96),
-  X(0x59ac3cfd), X(0x5b56bfbd), X(0x59d01475), X(0x5b3381ce),
-  X(0x59f3de12), X(0x5b1035cf), X(0x5a1799d1), X(0x5aecdbc5),
-  X(0x5a3b47ab), X(0x5ac973b5), X(0x5a5ee79a), X(0x5aa5fda5),
-  X(0x5a82799a), X(0x5a82799a)
-  };
-  
-  /* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */
-static LOOKUP_T sincos_lookup1[1024] = {
-  X(0x001921fb), X(0x7ffffd88), X(0x004b65ee), X(0x7fffe9cb),
-  X(0x007da9d4), X(0x7fffc251), X(0x00afeda8), X(0x7fff8719),
-  X(0x00e23160), X(0x7fff3824), X(0x011474f6), X(0x7ffed572),
-  X(0x0146b860), X(0x7ffe5f03), X(0x0178fb99), X(0x7ffdd4d7),
-  X(0x01ab3e97), X(0x7ffd36ee), X(0x01dd8154), X(0x7ffc8549),
-  X(0x020fc3c6), X(0x7ffbbfe6), X(0x024205e8), X(0x7ffae6c7),
-  X(0x027447b0), X(0x7ff9f9ec), X(0x02a68917), X(0x7ff8f954),
-  X(0x02d8ca16), X(0x7ff7e500), X(0x030b0aa4), X(0x7ff6bcf0),
-  X(0x033d4abb), X(0x7ff58125), X(0x036f8a51), X(0x7ff4319d),
-  X(0x03a1c960), X(0x7ff2ce5b), X(0x03d407df), X(0x7ff1575d),
-  X(0x040645c7), X(0x7fefcca4), X(0x04388310), X(0x7fee2e30),
-  X(0x046abfb3), X(0x7fec7c02), X(0x049cfba7), X(0x7feab61a),
-  X(0x04cf36e5), X(0x7fe8dc78), X(0x05017165), X(0x7fe6ef1c),
-  X(0x0533ab20), X(0x7fe4ee06), X(0x0565e40d), X(0x7fe2d938),
-  X(0x05981c26), X(0x7fe0b0b1), X(0x05ca5361), X(0x7fde7471),
-  X(0x05fc89b8), X(0x7fdc247a), X(0x062ebf22), X(0x7fd9c0ca),
-  X(0x0660f398), X(0x7fd74964), X(0x06932713), X(0x7fd4be46),
-  X(0x06c5598a), X(0x7fd21f72), X(0x06f78af6), X(0x7fcf6ce8),
-  X(0x0729bb4e), X(0x7fcca6a7), X(0x075bea8c), X(0x7fc9ccb2),
-  X(0x078e18a7), X(0x7fc6df08), X(0x07c04598), X(0x7fc3dda9),
-  X(0x07f27157), X(0x7fc0c896), X(0x08249bdd), X(0x7fbd9fd0),
-  X(0x0856c520), X(0x7fba6357), X(0x0888ed1b), X(0x7fb7132b),
-  X(0x08bb13c5), X(0x7fb3af4e), X(0x08ed3916), X(0x7fb037bf),
-  X(0x091f5d06), X(0x7facac7f), X(0x09517f8f), X(0x7fa90d8e),
-  X(0x0983a0a7), X(0x7fa55aee), X(0x09b5c048), X(0x7fa1949e),
-  X(0x09e7de6a), X(0x7f9dbaa0), X(0x0a19fb04), X(0x7f99ccf4),
-  X(0x0a4c1610), X(0x7f95cb9a), X(0x0a7e2f85), X(0x7f91b694),
-  X(0x0ab0475c), X(0x7f8d8de1), X(0x0ae25d8d), X(0x7f895182),
-  X(0x0b147211), X(0x7f850179), X(0x0b4684df), X(0x7f809dc5),
-  X(0x0b7895f0), X(0x7f7c2668), X(0x0baaa53b), X(0x7f779b62),
-  X(0x0bdcb2bb), X(0x7f72fcb4), X(0x0c0ebe66), X(0x7f6e4a5e),
-  X(0x0c40c835), X(0x7f698461), X(0x0c72d020), X(0x7f64aabf),
-  X(0x0ca4d620), X(0x7f5fbd77), X(0x0cd6da2d), X(0x7f5abc8a),
-  X(0x0d08dc3f), X(0x7f55a7fa), X(0x0d3adc4e), X(0x7f507fc7),
-  X(0x0d6cda53), X(0x7f4b43f2), X(0x0d9ed646), X(0x7f45f47b),
-  X(0x0dd0d01f), X(0x7f409164), X(0x0e02c7d7), X(0x7f3b1aad),
-  X(0x0e34bd66), X(0x7f359057), X(0x0e66b0c3), X(0x7f2ff263),
-  X(0x0e98a1e9), X(0x7f2a40d2), X(0x0eca90ce), X(0x7f247ba5),
-  X(0x0efc7d6b), X(0x7f1ea2dc), X(0x0f2e67b8), X(0x7f18b679),
-  X(0x0f604faf), X(0x7f12b67c), X(0x0f923546), X(0x7f0ca2e7),
-  X(0x0fc41876), X(0x7f067bba), X(0x0ff5f938), X(0x7f0040f6),
-  X(0x1027d784), X(0x7ef9f29d), X(0x1059b352), X(0x7ef390ae),
-  X(0x108b8c9b), X(0x7eed1b2c), X(0x10bd6356), X(0x7ee69217),
-  X(0x10ef377d), X(0x7edff570), X(0x11210907), X(0x7ed94538),
-  X(0x1152d7ed), X(0x7ed28171), X(0x1184a427), X(0x7ecbaa1a),
-  X(0x11b66dad), X(0x7ec4bf36), X(0x11e83478), X(0x7ebdc0c6),
-  X(0x1219f880), X(0x7eb6aeca), X(0x124bb9be), X(0x7eaf8943),
-  X(0x127d7829), X(0x7ea85033), X(0x12af33ba), X(0x7ea1039b),
-  X(0x12e0ec6a), X(0x7e99a37c), X(0x1312a230), X(0x7e922fd6),
-  X(0x13445505), X(0x7e8aa8ac), X(0x137604e2), X(0x7e830dff),
-  X(0x13a7b1bf), X(0x7e7b5fce), X(0x13d95b93), X(0x7e739e1d),
-  X(0x140b0258), X(0x7e6bc8eb), X(0x143ca605), X(0x7e63e03b),
-  X(0x146e4694), X(0x7e5be40c), X(0x149fe3fc), X(0x7e53d462),
-  X(0x14d17e36), X(0x7e4bb13c), X(0x1503153a), X(0x7e437a9c),
-  X(0x1534a901), X(0x7e3b3083), X(0x15663982), X(0x7e32d2f4),
-  X(0x1597c6b7), X(0x7e2a61ed), X(0x15c95097), X(0x7e21dd73),
-  X(0x15fad71b), X(0x7e194584), X(0x162c5a3b), X(0x7e109a24),
-  X(0x165dd9f0), X(0x7e07db52), X(0x168f5632), X(0x7dff0911),
-  X(0x16c0cef9), X(0x7df62362), X(0x16f2443e), X(0x7ded2a47),
-  X(0x1723b5f9), X(0x7de41dc0), X(0x17552422), X(0x7ddafdce),
-  X(0x17868eb3), X(0x7dd1ca75), X(0x17b7f5a3), X(0x7dc883b4),
-  X(0x17e958ea), X(0x7dbf298d), X(0x181ab881), X(0x7db5bc02),
-  X(0x184c1461), X(0x7dac3b15), X(0x187d6c82), X(0x7da2a6c6),
-  X(0x18aec0db), X(0x7d98ff17), X(0x18e01167), X(0x7d8f4409),
-  X(0x19115e1c), X(0x7d85759f), X(0x1942a6f3), X(0x7d7b93da),
-  X(0x1973ebe6), X(0x7d719eba), X(0x19a52ceb), X(0x7d679642),
-  X(0x19d669fc), X(0x7d5d7a74), X(0x1a07a311), X(0x7d534b50),
-  X(0x1a38d823), X(0x7d4908d9), X(0x1a6a0929), X(0x7d3eb30f),
-  X(0x1a9b361d), X(0x7d3449f5), X(0x1acc5ef6), X(0x7d29cd8c),
-  X(0x1afd83ad), X(0x7d1f3dd6), X(0x1b2ea43a), X(0x7d149ad5),
-  X(0x1b5fc097), X(0x7d09e489), X(0x1b90d8bb), X(0x7cff1af5),
-  X(0x1bc1ec9e), X(0x7cf43e1a), X(0x1bf2fc3a), X(0x7ce94dfb),
-  X(0x1c240786), X(0x7cde4a98), X(0x1c550e7c), X(0x7cd333f3),
-  X(0x1c861113), X(0x7cc80a0f), X(0x1cb70f43), X(0x7cbcccec),
-  X(0x1ce80906), X(0x7cb17c8d), X(0x1d18fe54), X(0x7ca618f3),
-  X(0x1d49ef26), X(0x7c9aa221), X(0x1d7adb73), X(0x7c8f1817),
-  X(0x1dabc334), X(0x7c837ad8), X(0x1ddca662), X(0x7c77ca65),
-  X(0x1e0d84f5), X(0x7c6c06c0), X(0x1e3e5ee5), X(0x7c602fec),
-  X(0x1e6f342c), X(0x7c5445e9), X(0x1ea004c1), X(0x7c4848ba),
-  X(0x1ed0d09d), X(0x7c3c3860), X(0x1f0197b8), X(0x7c3014de),
-  X(0x1f325a0b), X(0x7c23de35), X(0x1f63178f), X(0x7c179467),
-  X(0x1f93d03c), X(0x7c0b3777), X(0x1fc4840a), X(0x7bfec765),
-  X(0x1ff532f2), X(0x7bf24434), X(0x2025dcec), X(0x7be5ade6),
-  X(0x205681f1), X(0x7bd9047c), X(0x208721f9), X(0x7bcc47fa),
-  X(0x20b7bcfe), X(0x7bbf7860), X(0x20e852f6), X(0x7bb295b0),
-  X(0x2118e3dc), X(0x7ba59fee), X(0x21496fa7), X(0x7b989719),
-  X(0x2179f64f), X(0x7b8b7b36), X(0x21aa77cf), X(0x7b7e4c45),
-  X(0x21daf41d), X(0x7b710a49), X(0x220b6b32), X(0x7b63b543),
-  X(0x223bdd08), X(0x7b564d36), X(0x226c4996), X(0x7b48d225),
-  X(0x229cb0d5), X(0x7b3b4410), X(0x22cd12bd), X(0x7b2da2fa),
-  X(0x22fd6f48), X(0x7b1feee5), X(0x232dc66d), X(0x7b1227d3),
-  X(0x235e1826), X(0x7b044dc7), X(0x238e646a), X(0x7af660c2),
-  X(0x23beab33), X(0x7ae860c7), X(0x23eeec78), X(0x7ada4dd8),
-  X(0x241f2833), X(0x7acc27f7), X(0x244f5e5c), X(0x7abdef25),
-  X(0x247f8eec), X(0x7aafa367), X(0x24afb9da), X(0x7aa144bc),
-  X(0x24dfdf20), X(0x7a92d329), X(0x250ffeb7), X(0x7a844eae),
-  X(0x25401896), X(0x7a75b74f), X(0x25702cb7), X(0x7a670d0d),
-  X(0x25a03b11), X(0x7a584feb), X(0x25d0439f), X(0x7a497feb),
-  X(0x26004657), X(0x7a3a9d0f), X(0x26304333), X(0x7a2ba75a),
-  X(0x26603a2c), X(0x7a1c9ece), X(0x26902b39), X(0x7a0d836d),
-  X(0x26c01655), X(0x79fe5539), X(0x26effb76), X(0x79ef1436),
-  X(0x271fda96), X(0x79dfc064), X(0x274fb3ae), X(0x79d059c8),
-  X(0x277f86b5), X(0x79c0e062), X(0x27af53a6), X(0x79b15435),
-  X(0x27df1a77), X(0x79a1b545), X(0x280edb23), X(0x79920392),
-  X(0x283e95a1), X(0x79823f20), X(0x286e49ea), X(0x797267f2),
-  X(0x289df7f8), X(0x79627e08), X(0x28cd9fc1), X(0x79528167),
-  X(0x28fd4140), X(0x79427210), X(0x292cdc6d), X(0x79325006),
-  X(0x295c7140), X(0x79221b4b), X(0x298bffb2), X(0x7911d3e2),
-  X(0x29bb87bc), X(0x790179cd), X(0x29eb0957), X(0x78f10d0f),
-  X(0x2a1a847b), X(0x78e08dab), X(0x2a49f920), X(0x78cffba3),
-  X(0x2a796740), X(0x78bf56f9), X(0x2aa8ced3), X(0x78ae9fb0),
-  X(0x2ad82fd2), X(0x789dd5cb), X(0x2b078a36), X(0x788cf94c),
-  X(0x2b36ddf7), X(0x787c0a36), X(0x2b662b0e), X(0x786b088c),
-  X(0x2b957173), X(0x7859f44f), X(0x2bc4b120), X(0x7848cd83),
-  X(0x2bf3ea0d), X(0x7837942b), X(0x2c231c33), X(0x78264849),
-  X(0x2c52478a), X(0x7814e9df), X(0x2c816c0c), X(0x780378f1),
-  X(0x2cb089b1), X(0x77f1f581), X(0x2cdfa071), X(0x77e05f91),
-  X(0x2d0eb046), X(0x77ceb725), X(0x2d3db928), X(0x77bcfc3f),
-  X(0x2d6cbb10), X(0x77ab2ee2), X(0x2d9bb5f6), X(0x77994f11),
-  X(0x2dcaa9d5), X(0x77875cce), X(0x2df996a3), X(0x7775581d),
-  X(0x2e287c5a), X(0x776340ff), X(0x2e575af3), X(0x77511778),
-  X(0x2e863267), X(0x773edb8b), X(0x2eb502ae), X(0x772c8d3a),
-  X(0x2ee3cbc1), X(0x771a2c88), X(0x2f128d99), X(0x7707b979),
-  X(0x2f41482e), X(0x76f5340e), X(0x2f6ffb7a), X(0x76e29c4b),
-  X(0x2f9ea775), X(0x76cff232), X(0x2fcd4c19), X(0x76bd35c7),
-  X(0x2ffbe95d), X(0x76aa670d), X(0x302a7f3a), X(0x76978605),
-  X(0x30590dab), X(0x768492b4), X(0x308794a6), X(0x76718d1c),
-  X(0x30b61426), X(0x765e7540), X(0x30e48c22), X(0x764b4b23),
-  X(0x3112fc95), X(0x76380ec8), X(0x31416576), X(0x7624c031),
-  X(0x316fc6be), X(0x76115f63), X(0x319e2067), X(0x75fdec60),
-  X(0x31cc7269), X(0x75ea672a), X(0x31fabcbd), X(0x75d6cfc5),
-  X(0x3228ff5c), X(0x75c32634), X(0x32573a3f), X(0x75af6a7b),
-  X(0x32856d5e), X(0x759b9c9b), X(0x32b398b3), X(0x7587bc98),
-  X(0x32e1bc36), X(0x7573ca75), X(0x330fd7e1), X(0x755fc635),
-  X(0x333debab), X(0x754bafdc), X(0x336bf78f), X(0x7537876c),
-  X(0x3399fb85), X(0x75234ce8), X(0x33c7f785), X(0x750f0054),
-  X(0x33f5eb89), X(0x74faa1b3), X(0x3423d78a), X(0x74e63108),
-  X(0x3451bb81), X(0x74d1ae55), X(0x347f9766), X(0x74bd199f),
-  X(0x34ad6b32), X(0x74a872e8), X(0x34db36df), X(0x7493ba34),
-  X(0x3508fa66), X(0x747eef85), X(0x3536b5be), X(0x746a12df),
-  X(0x356468e2), X(0x74552446), X(0x359213c9), X(0x744023bc),
-  X(0x35bfb66e), X(0x742b1144), X(0x35ed50c9), X(0x7415ece2),
-  X(0x361ae2d3), X(0x7400b69a), X(0x36486c86), X(0x73eb6e6e),
-  X(0x3675edd9), X(0x73d61461), X(0x36a366c6), X(0x73c0a878),
-  X(0x36d0d746), X(0x73ab2ab4), X(0x36fe3f52), X(0x73959b1b),
-  X(0x372b9ee3), X(0x737ff9ae), X(0x3758f5f2), X(0x736a4671),
-  X(0x37864477), X(0x73548168), X(0x37b38a6d), X(0x733eaa96),
-  X(0x37e0c7cc), X(0x7328c1ff), X(0x380dfc8d), X(0x7312c7a5),
-  X(0x383b28a9), X(0x72fcbb8c), X(0x38684c19), X(0x72e69db7),
-  X(0x389566d6), X(0x72d06e2b), X(0x38c278d9), X(0x72ba2cea),
-  X(0x38ef821c), X(0x72a3d9f7), X(0x391c8297), X(0x728d7557),
-  X(0x39497a43), X(0x7276ff0d), X(0x39766919), X(0x7260771b),
-  X(0x39a34f13), X(0x7249dd86), X(0x39d02c2a), X(0x72333251),
-  X(0x39fd0056), X(0x721c7580), X(0x3a29cb91), X(0x7205a716),
-  X(0x3a568dd4), X(0x71eec716), X(0x3a834717), X(0x71d7d585),
-  X(0x3aaff755), X(0x71c0d265), X(0x3adc9e86), X(0x71a9bdba),
-  X(0x3b093ca3), X(0x71929789), X(0x3b35d1a5), X(0x717b5fd3),
-  X(0x3b625d86), X(0x7164169d), X(0x3b8ee03e), X(0x714cbbeb),
-  X(0x3bbb59c7), X(0x71354fc0), X(0x3be7ca1a), X(0x711dd220),
-  X(0x3c143130), X(0x7106430e), X(0x3c408f03), X(0x70eea28e),
-  X(0x3c6ce38a), X(0x70d6f0a4), X(0x3c992ec0), X(0x70bf2d53),
-  X(0x3cc5709e), X(0x70a7589f), X(0x3cf1a91c), X(0x708f728b),
-  X(0x3d1dd835), X(0x70777b1c), X(0x3d49fde1), X(0x705f7255),
-  X(0x3d761a19), X(0x70475839), X(0x3da22cd7), X(0x702f2ccd),
-  X(0x3dce3614), X(0x7016f014), X(0x3dfa35c8), X(0x6ffea212),
-  X(0x3e262bee), X(0x6fe642ca), X(0x3e52187f), X(0x6fcdd241),
-  X(0x3e7dfb73), X(0x6fb5507a), X(0x3ea9d4c3), X(0x6f9cbd79),
-  X(0x3ed5a46b), X(0x6f841942), X(0x3f016a61), X(0x6f6b63d8),
-  X(0x3f2d26a0), X(0x6f529d40), X(0x3f58d921), X(0x6f39c57d),
-  X(0x3f8481dd), X(0x6f20dc92), X(0x3fb020ce), X(0x6f07e285),
-  X(0x3fdbb5ec), X(0x6eeed758), X(0x40074132), X(0x6ed5bb10),
-  X(0x4032c297), X(0x6ebc8db0), X(0x405e3a16), X(0x6ea34f3d),
-  X(0x4089a7a8), X(0x6e89ffb9), X(0x40b50b46), X(0x6e709f2a),
-  X(0x40e064ea), X(0x6e572d93), X(0x410bb48c), X(0x6e3daaf8),
-  X(0x4136fa27), X(0x6e24175c), X(0x416235b2), X(0x6e0a72c5),
-  X(0x418d6729), X(0x6df0bd35), X(0x41b88e84), X(0x6dd6f6b1),
-  X(0x41e3abbc), X(0x6dbd1f3c), X(0x420ebecb), X(0x6da336dc),
-  X(0x4239c7aa), X(0x6d893d93), X(0x4264c653), X(0x6d6f3365),
-  X(0x428fbabe), X(0x6d551858), X(0x42baa4e6), X(0x6d3aec6e),
-  X(0x42e584c3), X(0x6d20afac), X(0x43105a50), X(0x6d066215),
-  X(0x433b2585), X(0x6cec03af), X(0x4365e65b), X(0x6cd1947c),
-  X(0x43909ccd), X(0x6cb71482), X(0x43bb48d4), X(0x6c9c83c3),
-  X(0x43e5ea68), X(0x6c81e245), X(0x44108184), X(0x6c67300b),
-  X(0x443b0e21), X(0x6c4c6d1a), X(0x44659039), X(0x6c319975),
-  X(0x449007c4), X(0x6c16b521), X(0x44ba74bd), X(0x6bfbc021),
-  X(0x44e4d71c), X(0x6be0ba7b), X(0x450f2edb), X(0x6bc5a431),
-  X(0x45397bf4), X(0x6baa7d49), X(0x4563be60), X(0x6b8f45c7),
-  X(0x458df619), X(0x6b73fdae), X(0x45b82318), X(0x6b58a503),
-  X(0x45e24556), X(0x6b3d3bcb), X(0x460c5cce), X(0x6b21c208),
-  X(0x46366978), X(0x6b0637c1), X(0x46606b4e), X(0x6aea9cf8),
-  X(0x468a624a), X(0x6acef1b2), X(0x46b44e65), X(0x6ab335f4),
-  X(0x46de2f99), X(0x6a9769c1), X(0x470805df), X(0x6a7b8d1e),
-  X(0x4731d131), X(0x6a5fa010), X(0x475b9188), X(0x6a43a29a),
-  X(0x478546de), X(0x6a2794c1), X(0x47aef12c), X(0x6a0b7689),
-  X(0x47d8906d), X(0x69ef47f6), X(0x48022499), X(0x69d3090e),
-  X(0x482badab), X(0x69b6b9d3), X(0x48552b9b), X(0x699a5a4c),
-  X(0x487e9e64), X(0x697dea7b), X(0x48a805ff), X(0x69616a65),
-  X(0x48d16265), X(0x6944da10), X(0x48fab391), X(0x6928397e),
-  X(0x4923f97b), X(0x690b88b5), X(0x494d341e), X(0x68eec7b9),
-  X(0x49766373), X(0x68d1f68f), X(0x499f8774), X(0x68b5153a),
-  X(0x49c8a01b), X(0x689823bf), X(0x49f1ad61), X(0x687b2224),
-  X(0x4a1aaf3f), X(0x685e106c), X(0x4a43a5b0), X(0x6840ee9b),
-  X(0x4a6c90ad), X(0x6823bcb7), X(0x4a957030), X(0x68067ac3),
-  X(0x4abe4433), X(0x67e928c5), X(0x4ae70caf), X(0x67cbc6c0),
-  X(0x4b0fc99d), X(0x67ae54ba), X(0x4b387af9), X(0x6790d2b6),
-  X(0x4b6120bb), X(0x677340ba), X(0x4b89badd), X(0x67559eca),
-  X(0x4bb24958), X(0x6737ecea), X(0x4bdacc28), X(0x671a2b20),
-  X(0x4c034345), X(0x66fc596f), X(0x4c2baea9), X(0x66de77dc),
-  X(0x4c540e4e), X(0x66c0866d), X(0x4c7c622d), X(0x66a28524),
-  X(0x4ca4aa41), X(0x66847408), X(0x4ccce684), X(0x6666531d),
-  X(0x4cf516ee), X(0x66482267), X(0x4d1d3b7a), X(0x6629e1ec),
-  X(0x4d455422), X(0x660b91af), X(0x4d6d60df), X(0x65ed31b5),
-  X(0x4d9561ac), X(0x65cec204), X(0x4dbd5682), X(0x65b0429f),
-  X(0x4de53f5a), X(0x6591b38c), X(0x4e0d1c30), X(0x657314cf),
-  X(0x4e34ecfc), X(0x6554666d), X(0x4e5cb1b9), X(0x6535a86b),
-  X(0x4e846a60), X(0x6516dacd), X(0x4eac16eb), X(0x64f7fd98),
-  X(0x4ed3b755), X(0x64d910d1), X(0x4efb4b96), X(0x64ba147d),
-  X(0x4f22d3aa), X(0x649b08a0), X(0x4f4a4f89), X(0x647bed3f),
-  X(0x4f71bf2e), X(0x645cc260), X(0x4f992293), X(0x643d8806),
-  X(0x4fc079b1), X(0x641e3e38), X(0x4fe7c483), X(0x63fee4f8),
-  X(0x500f0302), X(0x63df7c4d), X(0x50363529), X(0x63c0043b),
-  X(0x505d5af1), X(0x63a07cc7), X(0x50847454), X(0x6380e5f6),
-  X(0x50ab814d), X(0x63613fcd), X(0x50d281d5), X(0x63418a50),
-  X(0x50f975e6), X(0x6321c585), X(0x51205d7b), X(0x6301f171),
-  X(0x5147388c), X(0x62e20e17), X(0x516e0715), X(0x62c21b7e),
-  X(0x5194c910), X(0x62a219aa), X(0x51bb7e75), X(0x628208a1),
-  X(0x51e22740), X(0x6261e866), X(0x5208c36a), X(0x6241b8ff),
-  X(0x522f52ee), X(0x62217a72), X(0x5255d5c5), X(0x62012cc2),
-  X(0x527c4bea), X(0x61e0cff5), X(0x52a2b556), X(0x61c06410),
-  X(0x52c91204), X(0x619fe918), X(0x52ef61ee), X(0x617f5f12),
-  X(0x5315a50e), X(0x615ec603), X(0x533bdb5d), X(0x613e1df0),
-  X(0x536204d7), X(0x611d66de), X(0x53882175), X(0x60fca0d2),
-  X(0x53ae3131), X(0x60dbcbd1), X(0x53d43406), X(0x60bae7e1),
-  X(0x53fa29ed), X(0x6099f505), X(0x542012e1), X(0x6078f344),
-  X(0x5445eedb), X(0x6057e2a2), X(0x546bbdd7), X(0x6036c325),
-  X(0x54917fce), X(0x601594d1), X(0x54b734ba), X(0x5ff457ad),
-  X(0x54dcdc96), X(0x5fd30bbc), X(0x5502775c), X(0x5fb1b104),
-  X(0x55280505), X(0x5f90478a), X(0x554d858d), X(0x5f6ecf53),
-  X(0x5572f8ed), X(0x5f4d4865), X(0x55985f20), X(0x5f2bb2c5),
-  X(0x55bdb81f), X(0x5f0a0e77), X(0x55e303e6), X(0x5ee85b82),
-  X(0x5608426e), X(0x5ec699e9), X(0x562d73b2), X(0x5ea4c9b3),
-  X(0x565297ab), X(0x5e82eae5), X(0x5677ae54), X(0x5e60fd84),
-  X(0x569cb7a8), X(0x5e3f0194), X(0x56c1b3a1), X(0x5e1cf71c),
-  X(0x56e6a239), X(0x5dfade20), X(0x570b8369), X(0x5dd8b6a7),
-  X(0x5730572e), X(0x5db680b4), X(0x57551d80), X(0x5d943c4e),
-  X(0x5779d65b), X(0x5d71e979), X(0x579e81b8), X(0x5d4f883b),
-  X(0x57c31f92), X(0x5d2d189a), X(0x57e7afe4), X(0x5d0a9a9a),
-  X(0x580c32a7), X(0x5ce80e41), X(0x5830a7d6), X(0x5cc57394),
-  X(0x58550f6c), X(0x5ca2ca99), X(0x58796962), X(0x5c801354),
-  X(0x589db5b3), X(0x5c5d4dcc), X(0x58c1f45b), X(0x5c3a7a05),
-  X(0x58e62552), X(0x5c179806), X(0x590a4893), X(0x5bf4a7d2),
-  X(0x592e5e19), X(0x5bd1a971), X(0x595265df), X(0x5bae9ce7),
-  X(0x59765fde), X(0x5b8b8239), X(0x599a4c12), X(0x5b68596d),
-  X(0x59be2a74), X(0x5b452288), X(0x59e1faff), X(0x5b21dd90),
-  X(0x5a05bdae), X(0x5afe8a8b), X(0x5a29727b), X(0x5adb297d),
-  X(0x5a4d1960), X(0x5ab7ba6c), X(0x5a70b258), X(0x5a943d5e),
-};
-  
--- a/misc/libtremor/misc.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: miscellaneous math and prototypes
-
- ********************************************************************/
-
-#ifndef _V_RANDOM_H_
-#define _V_RANDOM_H_
-#include "ivorbiscodec.h"
-#include "os.h"
-
-#include "asm_arm.h"
-#include <stdlib.h> /* for abs() */
-  
-#ifndef _V_WIDE_MATH
-#define _V_WIDE_MATH
-  
-#ifndef  _LOW_ACCURACY_
-/* 64 bit multiply */
-
-#if !(defined WIN32 && defined WINCE)
-#include <sys/types.h>
-#endif
-
-#if BYTE_ORDER==LITTLE_ENDIAN
-union magic {
-  struct {
-    ogg_int32_t lo;
-    ogg_int32_t hi;
-  } halves;
-  ogg_int64_t whole;
-};
-#endif 
-
-#if BYTE_ORDER==BIG_ENDIAN
-union magic {
-  struct {
-    ogg_int32_t hi;
-    ogg_int32_t lo;
-  } halves;
-  ogg_int64_t whole;
-};
-#endif
-
-STIN ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
-  union magic magic;
-  magic.whole = (ogg_int64_t)x * y;
-  return magic.halves.hi;
-}
-
-STIN ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
-  return MULT32(x,y)<<1;
-}
-
-STIN ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
-  union magic magic;
-  magic.whole  = (ogg_int64_t)x * y;
-  return ((ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17);
-}
-
-#else
-/* 32 bit multiply, more portable but less accurate */
-
-/*
- * Note: Precision is biased towards the first argument therefore ordering
- * is important.  Shift values were chosen for the best sound quality after
- * many listening tests.
- */
-
-/*
- * For MULT32 and MULT31: The second argument is always a lookup table
- * value already preshifted from 31 to 8 bits.  We therefore take the 
- * opportunity to save on text space and use unsigned char for those
- * tables in this case.
- */
-
-STIN ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
-  return (x >> 9) * y;  /* y preshifted >>23 */
-}
-
-STIN ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
-  return (x >> 8) * y;  /* y preshifted >>23 */
-}
-
-STIN ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
-  return (x >> 6) * y;  /* y preshifted >>9 */
-}
-
-#endif
-
-/*
- * This should be used as a memory barrier, forcing all cached values in
- * registers to wr writen back to memory.  Might or might not be beneficial
- * depending on the architecture and compiler.
- */
-#define MB()
-
-/*
- * The XPROD functions are meant to optimize the cross products found all
- * over the place in mdct.c by forcing memory operation ordering to avoid
- * unnecessary register reloads as soon as memory is being written to.
- * However this is only beneficial on CPUs with a sane number of general
- * purpose registers which exclude the Intel x86.  On Intel, better let the
- * compiler actually reload registers directly from original memory by using
- * macros.
- */
-
-#ifdef __i386__
-
-#define XPROD32(_a, _b, _t, _v, _x, _y)		\
-  { *(_x)=MULT32(_a,_t)+MULT32(_b,_v);		\
-    *(_y)=MULT32(_b,_t)-MULT32(_a,_v); }
-#define XPROD31(_a, _b, _t, _v, _x, _y)		\
-  { *(_x)=MULT31(_a,_t)+MULT31(_b,_v);		\
-    *(_y)=MULT31(_b,_t)-MULT31(_a,_v); }
-#define XNPROD31(_a, _b, _t, _v, _x, _y)	\
-  { *(_x)=MULT31(_a,_t)-MULT31(_b,_v);		\
-    *(_y)=MULT31(_b,_t)+MULT31(_a,_v); }
-
-#else
-
-STIN void XPROD32(ogg_int32_t  a, ogg_int32_t  b,
-			   ogg_int32_t  t, ogg_int32_t  v,
-			   ogg_int32_t *x, ogg_int32_t *y)
-{
-  *x = MULT32(a, t) + MULT32(b, v);
-  *y = MULT32(b, t) - MULT32(a, v);
-}
-
-STIN void XPROD31(ogg_int32_t  a, ogg_int32_t  b,
-			   ogg_int32_t  t, ogg_int32_t  v,
-			   ogg_int32_t *x, ogg_int32_t *y)
-{
-  *x = MULT31(a, t) + MULT31(b, v);
-  *y = MULT31(b, t) - MULT31(a, v);
-}
-
-STIN void XNPROD31(ogg_int32_t  a, ogg_int32_t  b,
-			    ogg_int32_t  t, ogg_int32_t  v,
-			    ogg_int32_t *x, ogg_int32_t *y)
-{
-  *x = MULT31(a, t) - MULT31(b, v);
-  *y = MULT31(b, t) + MULT31(a, v);
-}
-
-#endif
-
-#endif
-
-#ifndef _V_CLIP_MATH
-#define _V_CLIP_MATH
-
-STIN ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
-  int ret=x;
-  ret-= ((x<=32767)-1)&(x-32767);
-  ret-= ((x>=-32768)-1)&(x+32768);
-  return(ret);
-}
-
-#endif
-
-STIN ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap,
-				      ogg_int32_t b,ogg_int32_t bp,
-				      ogg_int32_t *p){
-  if(a && b){
-#ifndef _LOW_ACCURACY_
-    *p=ap+bp+32;
-    return MULT32(a,b);
-#else
-    *p=ap+bp+31;
-    return (a>>15)*(b>>16); 
-#endif
-  }else
-    return 0;
-}
-
-int _ilog(unsigned int);
-
-STIN ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap,
-				      ogg_int32_t i,
-				      ogg_int32_t *p){
-
-  int ip=_ilog(abs(i))-31;
-  return VFLOAT_MULT(a,ap,i<<-ip,ip,p);
-}
-
-STIN ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap,
-				      ogg_int32_t b,ogg_int32_t bp,
-				      ogg_int32_t *p){
-
-  if(!a){
-    *p=bp;
-    return b;
-  }else if(!b){
-    *p=ap;
-    return a;
-  }
-
-  /* yes, this can leak a bit. */
-  if(ap>bp){
-    int shift=ap-bp+1;
-    *p=ap+1;
-    a>>=1;
-    if(shift<32){
-      b=(b+(1<<(shift-1)))>>shift;
-    }else{
-      b=0;
-    }
-  }else{
-    int shift=bp-ap+1;
-    *p=bp+1;
-    b>>=1;
-    if(shift<32){
-      a=(a+(1<<(shift-1)))>>shift;
-    }else{
-      a=0;
-    }
-  }
-
-  a+=b;
-  if((a&0xc0000000)==0xc0000000 || 
-     (a&0xc0000000)==0){
-    a<<=1;
-    (*p)--;
-  }
-  return(a);
-}
-
-#endif
-
-
-
-
--- a/misc/libtremor/ogg.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: subsumed libogg includes
-
- ********************************************************************/
-#ifndef _OGG_H
-#define _OGG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "os_types.h"
-
-typedef struct ogg_buffer_state{
-  struct ogg_buffer    *unused_buffers;
-  struct ogg_reference *unused_references;
-  int                   outstanding;
-  int                   shutdown;
-} ogg_buffer_state;
-
-typedef struct ogg_buffer {
-  unsigned char      *data;
-  long                size;
-  int                 refcount;
-  
-  union {
-    ogg_buffer_state  *owner;
-    struct ogg_buffer *next;
-  } ptr;
-} ogg_buffer;
-
-typedef struct ogg_reference {
-  ogg_buffer    *buffer;
-  long           begin;
-  long           length;
-
-  struct ogg_reference *next;
-} ogg_reference;
-
-typedef struct oggpack_buffer {
-  int            headbit;
-  unsigned char *headptr;
-  long           headend;
-
-  /* memory management */
-  ogg_reference *head;
-  ogg_reference *tail;
-
-  /* render the byte/bit counter API constant time */
-  long              count; /* doesn't count the tail */
-} oggpack_buffer;
-
-typedef struct oggbyte_buffer {
-  ogg_reference *baseref;
-
-  ogg_reference *ref;
-  unsigned char *ptr;
-  long           pos;
-  long           end;
-} oggbyte_buffer;
-
-typedef struct ogg_sync_state {
-  /* decode memory management pool */
-  ogg_buffer_state *bufferpool;
-
-  /* stream buffers */
-  ogg_reference    *fifo_head;
-  ogg_reference    *fifo_tail;
-  long              fifo_fill;
-
-  /* stream sync management */
-  int               unsynced;
-  int               headerbytes;
-  int               bodybytes;
-
-} ogg_sync_state;
-
-typedef struct ogg_stream_state {
-  ogg_reference *header_head;
-  ogg_reference *header_tail;
-  ogg_reference *body_head;
-  ogg_reference *body_tail;
-
-  int            e_o_s;    /* set when we have buffered the last
-                              packet in the logical bitstream */
-  int            b_o_s;    /* set after we've written the initial page
-                              of a logical bitstream */
-  long           serialno;
-  long           pageno;
-  ogg_int64_t    packetno; /* sequence number for decode; the framing
-                              knows where there's a hole in the data,
-                              but we need coupling so that the codec
-                              (which is in a seperate abstraction
-                              layer) also knows about the gap */
-  ogg_int64_t    granulepos;
-
-  int            lacing_fill;
-  ogg_uint32_t   body_fill;
-
-  /* decode-side state data */
-  int            holeflag;
-  int            spanflag;
-  int            clearflag;
-  int            laceptr;
-  ogg_uint32_t   body_fill_next;
-  
-} ogg_stream_state;
-
-typedef struct {
-  ogg_reference *packet;
-  long           bytes;
-  long           b_o_s;
-  long           e_o_s;
-  ogg_int64_t    granulepos;
-  ogg_int64_t    packetno;     /* sequence number for decode; the framing
-                                  knows where there's a hole in the data,
-                                  but we need coupling so that the codec
-                                  (which is in a seperate abstraction
-                                  layer) also knows about the gap */
-} ogg_packet;
-
-typedef struct {
-  ogg_reference *header;
-  int            header_len;
-  ogg_reference *body;
-  long           body_len;
-} ogg_page;
-
-/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
-
-extern void  oggpack_readinit(oggpack_buffer *b,ogg_reference *r);
-extern long  oggpack_look(oggpack_buffer *b,int bits);
-extern void  oggpack_adv(oggpack_buffer *b,int bits);
-extern long  oggpack_read(oggpack_buffer *b,int bits);
-extern long  oggpack_bytes(oggpack_buffer *b);
-extern long  oggpack_bits(oggpack_buffer *b);
-extern int   oggpack_eop(oggpack_buffer *b);
-
-/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
-
-extern ogg_sync_state *ogg_sync_create(void);
-extern int      ogg_sync_destroy(ogg_sync_state *oy);
-extern int      ogg_sync_reset(ogg_sync_state *oy);
-
-extern unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long size);
-extern int      ogg_sync_wrote(ogg_sync_state *oy, long bytes);
-extern long     ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
-extern int      ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
-extern int      ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
-extern int      ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
-extern int      ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
-
-/* Ogg BITSTREAM PRIMITIVES: general ***************************/
-
-extern ogg_stream_state *ogg_stream_create(int serialno);
-extern int      ogg_stream_destroy(ogg_stream_state *os);
-extern int      ogg_stream_reset(ogg_stream_state *os);
-extern int      ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
-extern int      ogg_stream_eos(ogg_stream_state *os);
-
-extern int      ogg_page_checksum_set(ogg_page *og);
-
-extern int      ogg_page_version(ogg_page *og);
-extern int      ogg_page_continued(ogg_page *og);
-extern int      ogg_page_bos(ogg_page *og);
-extern int      ogg_page_eos(ogg_page *og);
-extern ogg_int64_t  ogg_page_granulepos(ogg_page *og);
-extern ogg_uint32_t ogg_page_serialno(ogg_page *og);
-extern ogg_uint32_t ogg_page_pageno(ogg_page *og);
-extern int      ogg_page_packets(ogg_page *og);
-extern int      ogg_page_getbuffer(ogg_page *og, unsigned char **buffer);
-
-extern int      ogg_packet_release(ogg_packet *op);
-extern int      ogg_page_release(ogg_page *og);
-
-extern void     ogg_page_dup(ogg_page *d, ogg_page *s);
-
-/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/
-
-#define  OGG_SUCCESS   0
-
-#define  OGG_HOLE     -10
-#define  OGG_SPAN     -11
-#define  OGG_EVERSION -12
-#define  OGG_ESERIAL  -13
-#define  OGG_EINVAL   -14
-#define  OGG_EEOS     -15
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* _OGG_H */
--- a/misc/libtremor/os.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#ifndef _OS_H
-#define _OS_H
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: #ifdef jail to whip a few platforms into the UNIX ideal.
-
- ********************************************************************/
-
-#include <math.h>
-#include "os_types.h"
-
-#ifndef _V_IFDEFJAIL_H_
-#  define _V_IFDEFJAIL_H_
-
-#  ifdef __GNUC__
-#    define STIN static __inline__
-#  elif _WIN32
-#    define STIN static __inline
-#  endif
-#else
-#  define STIN static
-#endif
-
-#ifndef M_PI
-#  define M_PI (3.1415926536f)
-#endif
-
-#ifdef _WIN32
-#  include <malloc.h>
-#  define rint(x)   (floor((x)+0.5f)) 
-#  define NO_FLOAT_MATH_LIB
-#  define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
-#  define LITTLE_ENDIAN 1
-#  define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
-#ifdef HAVE_ALLOCA_H
-#  include <alloca.h>
-#endif
-
-#ifdef USE_MEMORY_H
-#  include <memory.h>
-#endif
-
-#ifndef min
-#  define min(x,y)  ((x)>(y)?(y):(x))
-#endif
-
-#ifndef max
-#  define max(x,y)  ((x)<(y)?(y):(x))
-#endif
-
-#endif /* _OS_H */
--- a/misc/libtremor/os_types.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: #ifdef jail to whip a few platforms into the UNIX ideal.
-
- ********************************************************************/
-#ifndef _OS_TYPES_H
-#define _OS_TYPES_H
-
-#ifdef _LOW_ACCURACY_
-#  define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
-#  define LOOKUP_T const unsigned char
-#else
-#  define X(n) (n)
-#  define LOOKUP_T const ogg_int32_t
-#endif
-
-/* make it easy on the folks that want to compile the libs with a
-   different malloc than stdlib */
-#define _ogg_malloc  malloc
-#define _ogg_calloc  calloc
-#define _ogg_realloc realloc
-#define _ogg_free    free
-
-#ifdef _WIN32 
-
-#  ifndef __GNUC__
-   /* MSVC/Borland */
-   typedef __int64 ogg_int64_t;
-   typedef __int32 ogg_int32_t;
-   typedef unsigned __int32 ogg_uint32_t;
-   typedef __int16 ogg_int16_t;
-#  else
-   /* Cygwin */
-   #include <_G_config.h>
-   typedef _G_int64_t ogg_int64_t;
-   typedef _G_int32_t ogg_int32_t;
-   typedef _G_uint32_t ogg_uint32_t;
-   typedef _G_int16_t ogg_int16_t;
-#  endif
-
-#elif defined(__MACOS__)
-
-#  include <sys/types.h>
-   typedef SInt16 ogg_int16_t;
-   typedef SInt32 ogg_int32_t;
-   typedef UInt32 ogg_uint32_t;
-   typedef SInt64 ogg_int64_t;
-
-#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
-
-#  include <sys/types.h>
-   typedef int16_t ogg_int16_t;
-   typedef int32_t ogg_int32_t;
-   typedef u_int32_t ogg_uint32_t;
-   typedef int64_t ogg_int64_t;
-
-#elif defined(__BEOS__)
-
-   /* Be */
-#  include <inttypes.h>
-
-#elif defined (__EMX__)
-
-   /* OS/2 GCC */
-   typedef short ogg_int16_t;
-   typedef int ogg_int32_t;
-   typedef unsigned int ogg_uint32_t;
-   typedef long long ogg_int64_t;
-
-#else
-
-#  include <sys/types.h>
-#  include "config_types.h"
-
-#endif
-
-#endif  /* _OS_TYPES_H */
--- a/misc/libtremor/registry.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: registry for floor, res backends and channel mappings
-
- ********************************************************************/
-
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-#include "registry.h"
-#include "misc.h"
-
-
-/* seems like major overkill now; the backend numbers will grow into
-   the infrastructure soon enough */
-
-extern vorbis_func_floor     floor0_exportbundle;
-extern vorbis_func_floor     floor1_exportbundle;
-extern vorbis_func_residue   residue0_exportbundle;
-extern vorbis_func_residue   residue1_exportbundle;
-extern vorbis_func_residue   residue2_exportbundle;
-extern vorbis_func_mapping   mapping0_exportbundle;
-
-vorbis_func_floor     *_floor_P[]={
-  &floor0_exportbundle,
-  &floor1_exportbundle,
-};
-
-vorbis_func_residue   *_residue_P[]={
-  &residue0_exportbundle,
-  &residue1_exportbundle,
-  &residue2_exportbundle,
-};
-
-vorbis_func_mapping   *_mapping_P[]={
-  &mapping0_exportbundle,
-};
-
-
-
--- a/misc/libtremor/registry.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: registry for time, floor, res backends and channel mappings
-
- ********************************************************************/
-
-#ifndef _V_REG_H_
-#define _V_REG_H_
-
-#define VI_TRANSFORMB 1
-#define VI_WINDOWB 1
-#define VI_TIMEB 1
-#define VI_FLOORB 2
-#define VI_RESB 3
-#define VI_MAPB 1
-
-#include "backends.h"
-
-#if defined(_WIN32) && defined(VORBISDLL_IMPORT)
-# define EXTERN __declspec(dllimport) extern
-#else
-# define EXTERN extern
-#endif
-
-EXTERN vorbis_func_floor     *_floor_P[];
-EXTERN vorbis_func_residue   *_residue_P[];
-EXTERN vorbis_func_mapping   *_mapping_P[];
-
-#endif
--- a/misc/libtremor/res012.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,342 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: residue backend 0, 1 and 2 implementation
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-#include "registry.h"
-#include "codebook.h"
-#include "misc.h"
-#include "os.h"
-#include "block.h"
-
-typedef struct {
-  vorbis_info_residue0 *info;
-  int         map;
-  
-  int         parts;
-  int         stages;
-  codebook   *fullbooks;
-  codebook   *phrasebook;
-  codebook ***partbooks;
-
-  int         partvals;
-  int       **decodemap;
-
-} vorbis_look_residue0;
-
-void res0_free_info(vorbis_info_residue *i){
-  vorbis_info_residue0 *info=(vorbis_info_residue0 *)i;
-  if(info){
-    memset(info,0,sizeof(*info));
-    _ogg_free(info);
-  }
-}
-
-void res0_free_look(vorbis_look_residue *i){
-  int j;
-  if(i){
-
-    vorbis_look_residue0 *look=(vorbis_look_residue0 *)i;
-
-    for(j=0;j<look->parts;j++)
-      if(look->partbooks[j])_ogg_free(look->partbooks[j]);
-    _ogg_free(look->partbooks);
-    for(j=0;j<look->partvals;j++)
-      _ogg_free(look->decodemap[j]);
-    _ogg_free(look->decodemap);
-
-    memset(look,0,sizeof(*look));
-    _ogg_free(look);
-  }
-}
-
-static int ilog(unsigned int v){
-  int ret=0;
-  while(v){
-    ret++;
-    v>>=1;
-  }
-  return(ret);
-}
-
-static int icount(unsigned int v){
-  int ret=0;
-  while(v){
-    ret+=v&1;
-    v>>=1;
-  }
-  return(ret);
-}
-
-/* vorbis_info is for range checking */
-vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
-  int j,acc=0;
-  vorbis_info_residue0 *info=(vorbis_info_residue0 *)_ogg_calloc(1,sizeof(*info));
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-
-  info->begin=oggpack_read(opb,24);
-  info->end=oggpack_read(opb,24);
-  info->grouping=oggpack_read(opb,24)+1;
-  info->partitions=oggpack_read(opb,6)+1;
-  info->groupbook=oggpack_read(opb,8);
-
-  for(j=0;j<info->partitions;j++){
-    int cascade=oggpack_read(opb,3);
-    if(oggpack_read(opb,1))
-      cascade|=(oggpack_read(opb,5)<<3);
-    info->secondstages[j]=cascade;
-
-    acc+=icount(cascade);
-  }
-  for(j=0;j<acc;j++)
-    info->booklist[j]=oggpack_read(opb,8);
-
-  if(info->groupbook>=ci->books)goto errout;
-  for(j=0;j<acc;j++)
-    if(info->booklist[j]>=ci->books)goto errout;
-
-  return(info);
- errout:
-  res0_free_info(info);
-  return(NULL);
-}
-
-vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
-			  vorbis_info_residue *vr){
-  vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
-  vorbis_look_residue0 *look=(vorbis_look_residue0 *)_ogg_calloc(1,sizeof(*look));
-  codec_setup_info     *ci=(codec_setup_info *)vd->vi->codec_setup;
-
-  int j,k,acc=0;
-  int dim;
-  int maxstage=0;
-  look->info=info;
-  look->map=vm->mapping;
-
-  look->parts=info->partitions;
-  look->fullbooks=ci->fullbooks;
-  look->phrasebook=ci->fullbooks+info->groupbook;
-  dim=look->phrasebook->dim;
-
-  look->partbooks=(codebook ***)_ogg_calloc(look->parts,sizeof(*look->partbooks));
-
-  for(j=0;j<look->parts;j++){
-    int stages=ilog(info->secondstages[j]);
-    if(stages){
-      if(stages>maxstage)maxstage=stages;
-      look->partbooks[j]=(codebook **)_ogg_calloc(stages,sizeof(*look->partbooks[j]));
-      for(k=0;k<stages;k++)
-	if(info->secondstages[j]&(1<<k)){
-	  look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++];
-#ifdef TRAIN_RES
-	  look->training_data[k][j]=calloc(look->partbooks[j][k]->entries,
-					   sizeof(***look->training_data));
-#endif
-	}
-    }
-  }
-
-  look->partvals=look->parts;
-  for(j=1;j<dim;j++)look->partvals*=look->parts;
-  look->stages=maxstage;
-  look->decodemap=(int **)_ogg_malloc(look->partvals*sizeof(*look->decodemap));
-  for(j=0;j<look->partvals;j++){
-    long val=j;
-    long mult=look->partvals/look->parts;
-    look->decodemap[j]=(int *)_ogg_malloc(dim*sizeof(*look->decodemap[j]));
-    for(k=0;k<dim;k++){
-      long deco=val/mult;
-      val-=deco*mult;
-      mult/=look->parts;
-      look->decodemap[j][k]=deco;
-    }
-  }
-
-  return(look);
-}
-
-
-/* a truncated packet here just means 'stop working'; it's not an error */
-static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
-		      ogg_int32_t **in,int ch,
-		      long (*decodepart)(codebook *, ogg_int32_t *, 
-					 oggpack_buffer *,int,int)){
-
-  long i,j,k,l,s;
-  vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
-  vorbis_info_residue0 *info=look->info;
-
-  /* move all this setup out later */
-  int samples_per_partition=info->grouping;
-  int partitions_per_word=look->phrasebook->dim;
-  int max=vb->pcmend>>1;
-  int end=(info->end<max?info->end:max);
-  int n=end-info->begin;
-
-  if(n>0){
-    int partvals=n/samples_per_partition;
-    int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
-    int ***partword=(int ***)alloca(ch*sizeof(*partword));
-    
-    for(j=0;j<ch;j++)
-      partword[j]=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
-    
-    for(s=0;s<look->stages;s++){
-      
-      /* each loop decodes on partition codeword containing 
-	 partitions_pre_word partitions */
-      for(i=0,l=0;i<partvals;l++){
-	if(s==0){
-	  /* fetch the partition word for each channel */
-	  for(j=0;j<ch;j++){
-	    int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
-	    if(temp==-1)goto eopbreak;
-	    partword[j][l]=look->decodemap[temp];
-	    if(partword[j][l]==NULL)goto errout;
-	  }
-	}
-	
-	/* now we decode residual values for the partitions */
-	for(k=0;k<partitions_per_word && i<partvals;k++,i++)
-	  for(j=0;j<ch;j++){
-	    long offset=info->begin+i*samples_per_partition;
-	    if(info->secondstages[partword[j][l][k]]&(1<<s)){
-	      codebook *stagebook=look->partbooks[partword[j][l][k]][s];
-	      if(stagebook){
-		if(decodepart(stagebook,in[j]+offset,&vb->opb,
-			      samples_per_partition,-8)==-1)goto eopbreak;
-	      }
-	    }
-	  }
-      } 
-    }
-  }
- errout:
- eopbreak:
-  return(0);
-}
-
-int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
-		 ogg_int32_t **in,int *nonzero,int ch){
-  int i,used=0;
-  for(i=0;i<ch;i++)
-    if(nonzero[i])
-      in[used++]=in[i];
-  if(used)
-    return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
-  else
-    return(0);
-}
-
-int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
-		 ogg_int32_t **in,int *nonzero,int ch){
-  int i,used=0;
-  for(i=0;i<ch;i++)
-    if(nonzero[i])
-      in[used++]=in[i];
-  if(used)
-    return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
-  else
-    return(0);
-}
-
-/* duplicate code here as speed is somewhat more important */
-int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
-		 ogg_int32_t **in,int *nonzero,int ch){
-  long i,k,l,s;
-  vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
-  vorbis_info_residue0 *info=look->info;
-
-  /* move all this setup out later */
-  int samples_per_partition=info->grouping;
-  int partitions_per_word=look->phrasebook->dim;
-  int max=(vb->pcmend*ch)>>1;
-  int end=(info->end<max?info->end:max);
-  int n=end-info->begin;
-
-  if(n>0){
-    
-    int partvals=n/samples_per_partition;
-    int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
-    int **partword=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword));
-    int beginoff=info->begin/ch;
-    
-    for(i=0;i<ch;i++)if(nonzero[i])break;
-    if(i==ch)return(0); /* no nonzero vectors */
-    
-    samples_per_partition/=ch;
-    
-    for(s=0;s<look->stages;s++){
-      for(i=0,l=0;i<partvals;l++){
-	
-	if(s==0){
-	  /* fetch the partition word */
-	  int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
-	  if(temp==-1)goto eopbreak;
-	  partword[l]=look->decodemap[temp];
-	  if(partword[l]==NULL)goto errout;
-	}
-
-	/* now we decode residual values for the partitions */
-	for(k=0;k<partitions_per_word && i<partvals;k++,i++)
-	  if(info->secondstages[partword[l][k]]&(1<<s)){
-	    codebook *stagebook=look->partbooks[partword[l][k]][s];
-	    
-	    if(stagebook){
-	      if(vorbis_book_decodevv_add(stagebook,in,
-					  i*samples_per_partition+beginoff,ch,
-					  &vb->opb,
-					  samples_per_partition,-8)==-1)
-		goto eopbreak;
-	    }
-	  }
-      } 
-    }
-  }
- errout:
- eopbreak:
-  return(0);
-}
-
-
-vorbis_func_residue residue0_exportbundle={
-  &res0_unpack,
-  &res0_look,
-  &res0_free_info,
-  &res0_free_look,
-  &res0_inverse
-};
-
-vorbis_func_residue residue1_exportbundle={
-  &res0_unpack,
-  &res0_look,
-  &res0_free_info,
-  &res0_free_look,
-  &res1_inverse
-};
-
-vorbis_func_residue residue2_exportbundle={
-  &res0_unpack,
-  &res0_look,
-  &res0_free_info,
-  &res0_free_look,
-  &res2_inverse
-};
--- a/misc/libtremor/sharedbook.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,439 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: basic shared codebook operations
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include "ogg.h"
-#include "misc.h"
-#include "ivorbiscodec.h"
-#include "codebook.h"
-
-/**** pack/unpack helpers ******************************************/
-int _ilog(unsigned int v){
-  int ret=0;
-  while(v){
-    ret++;
-    v>>=1;
-  }
-  return(ret);
-}
-
-/* 32 bit float (not IEEE; nonnormalized mantissa +
-   biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm 
-   Why not IEEE?  It's just not that important here. */
-
-#define VQ_FEXP 10
-#define VQ_FMAN 21
-#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */
-
-static ogg_int32_t _float32_unpack(long val,int *point){
-  long   mant=val&0x1fffff;
-  int    sign=val&0x80000000;
-  long   exp =(val&0x7fe00000L)>>VQ_FMAN;
-
-  exp-=(VQ_FMAN-1)+VQ_FEXP_BIAS;
-
-  if(mant){
-    while(!(mant&0x40000000)){
-      mant<<=1;
-      exp-=1;
-    }
-
-    if(sign)mant= -mant;
-  }else{
-    sign=0;
-    exp=-9999;
-  }
-
-  *point=exp;
-  return mant;
-}
-
-/* given a list of word lengths, generate a list of codewords.  Works
-   for length ordered or unordered, always assigns the lowest valued
-   codewords first.  Extended to handle unused entries (length 0) */
-ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
-  long i,j,count=0;
-  ogg_uint32_t marker[33];
-  ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r));
-  memset(marker,0,sizeof(marker));
-
-  for(i=0;i<n;i++){
-    long length=l[i];
-    if(length>0){
-      ogg_uint32_t entry=marker[length];
-      
-      /* when we claim a node for an entry, we also claim the nodes
-	 below it (pruning off the imagined tree that may have dangled
-	 from it) as well as blocking the use of any nodes directly
-	 above for leaves */
-      
-      /* update ourself */
-      if(length<32 && (entry>>length)){
-	/* error condition; the lengths must specify an overpopulated tree */
-	_ogg_free(r);
-	return(NULL);
-      }
-      r[count++]=entry;
-    
-      /* Look to see if the next shorter marker points to the node
-	 above. if so, update it and repeat.  */
-      {
-	for(j=length;j>0;j--){
-	  
-	  if(marker[j]&1){
-	    /* have to jump branches */
-	    if(j==1)
-	      marker[1]++;
-	    else
-	      marker[j]=marker[j-1]<<1;
-	    break; /* invariant says next upper marker would already
-		      have been moved if it was on the same path */
-	  }
-	  marker[j]++;
-	}
-      }
-      
-      /* prune the tree; the implicit invariant says all the longer
-	 markers were dangling from our just-taken node.  Dangle them
-	 from our *new* node. */
-      for(j=length+1;j<33;j++)
-	if((marker[j]>>1) == entry){
-	  entry=marker[j];
-	  marker[j]=marker[j-1]<<1;
-	}else
-	  break;
-    }else
-      if(sparsecount==0)count++;
-  }
-    
-  /* bitreverse the words because our bitwise packer/unpacker is LSb
-     endian */
-  for(i=0,count=0;i<n;i++){
-    ogg_uint32_t temp=0;
-    for(j=0;j<l[i];j++){
-      temp<<=1;
-      temp|=(r[count]>>j)&1;
-    }
-
-    if(sparsecount){
-      if(l[i])
-	r[count++]=temp;
-    }else
-      r[count++]=temp;
-  }
-
-  return(r);
-}
-
-/* there might be a straightforward one-line way to do the below
-   that's portable and totally safe against roundoff, but I haven't
-   thought of it.  Therefore, we opt on the side of caution */
-long _book_maptype1_quantvals(const static_codebook *b){
-  /* get us a starting hint, we'll polish it below */
-  int bits=_ilog(b->entries);
-  int vals=b->entries>>((bits-1)*(b->dim-1)/b->dim);
-
-  while(1){
-    long acc=1;
-    long acc1=1;
-    int i;
-    for(i=0;i<b->dim;i++){
-      acc*=vals;
-      acc1*=vals+1;
-    }
-    if(acc<=b->entries && acc1>b->entries){
-      return(vals);
-    }else{
-      if(acc>b->entries){
-	vals--;
-      }else{
-	vals++;
-      }
-    }
-  }
-}
-
-/* different than what _book_unquantize does for mainline:
-   we repack the book in a fixed point format that shares the same
-   binary point.  Upon first use, we can shift point if needed */
-
-/* we need to deal with two map types: in map type 1, the values are
-   generated algorithmically (each column of the vector counts through
-   the values in the quant vector). in map type 2, all the values came
-   in in an explicit list.  Both value lists must be unpacked */
-
-ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
-			      int *maxpoint){
-  long j,k,count=0;
-  if(b->maptype==1 || b->maptype==2){
-    int quantvals;
-    int minpoint,delpoint;
-    ogg_int32_t mindel=_float32_unpack(b->q_min,&minpoint);
-    ogg_int32_t delta=_float32_unpack(b->q_delta,&delpoint);
-    ogg_int32_t *r=(ogg_int32_t *)_ogg_calloc(n*b->dim,sizeof(*r));
-    int *rp=(int *)_ogg_calloc(n*b->dim,sizeof(*rp));
-
-    *maxpoint=minpoint;
-
-    /* maptype 1 and 2 both use a quantized value vector, but
-       different sizes */
-    switch(b->maptype){
-    case 1:
-      /* most of the time, entries%dimensions == 0, but we need to be
-	 well defined.  We define that the possible vales at each
-	 scalar is values == entries/dim.  If entries%dim != 0, we'll
-	 have 'too few' values (values*dim<entries), which means that
-	 we'll have 'left over' entries; left over entries use zeroed
-	 values (and are wasted).  So don't generate codebooks like
-	 that */
-      quantvals=_book_maptype1_quantvals(b);
-      for(j=0;j<b->entries;j++){
-	if((sparsemap && b->lengthlist[j]) || !sparsemap){
-	  ogg_int32_t last=0;
-	  int lastpoint=0;
-	  int indexdiv=1;
-	  for(k=0;k<b->dim;k++){
-	    int index= (j/indexdiv)%quantvals;
-	    int point=0;
-	    int val=VFLOAT_MULTI(delta,delpoint,
-				 abs(b->quantlist[index]),&point);
-
-	    val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
-	    val=VFLOAT_ADD(last,lastpoint,val,point,&point);
-	    
-	    if(b->q_sequencep){
-	      last=val;	  
-	      lastpoint=point;
-	    }
-	    
-	    if(sparsemap){
-	      r[sparsemap[count]*b->dim+k]=val;
-	      rp[sparsemap[count]*b->dim+k]=point;
-	    }else{
-	      r[count*b->dim+k]=val;
-	      rp[count*b->dim+k]=point;
-	    }
-	    if(*maxpoint<point)*maxpoint=point;
-	    indexdiv*=quantvals;
-	  }
-	  count++;
-	}
-
-      }
-      break;
-    case 2:
-      for(j=0;j<b->entries;j++){
-	if((sparsemap && b->lengthlist[j]) || !sparsemap){
-	  ogg_int32_t last=0;
-	  int         lastpoint=0;
-
-	  for(k=0;k<b->dim;k++){
-	    int point=0;
-	    int val=VFLOAT_MULTI(delta,delpoint,
-				 abs(b->quantlist[j*b->dim+k]),&point);
-
-	    val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
-	    val=VFLOAT_ADD(last,lastpoint,val,point,&point);
-	    
-	    if(b->q_sequencep){
-	      last=val;	  
-	      lastpoint=point;
-	    }
-
-	    if(sparsemap){
-	      r[sparsemap[count]*b->dim+k]=val;
-	      rp[sparsemap[count]*b->dim+k]=point;
-	    }else{
-	      r[count*b->dim+k]=val;
-	      rp[count*b->dim+k]=point;
-	    }
-	    if(*maxpoint<point)*maxpoint=point;
-	  }
-	  count++;
-	}
-      }
-      break;
-    }
-
-    for(j=0;j<n*b->dim;j++)
-      if(rp[j]<*maxpoint)
-	r[j]>>=*maxpoint-rp[j];
-	    
-    _ogg_free(rp);
-    return(r);
-  }
-  return(NULL);
-}
-
-void vorbis_staticbook_clear(static_codebook *b){
-  if(b->quantlist)_ogg_free(b->quantlist);
-  if(b->lengthlist)_ogg_free(b->lengthlist);
-  memset(b,0,sizeof(*b));
-
-}
-
-void vorbis_staticbook_destroy(static_codebook *b){
-  vorbis_staticbook_clear(b);
-  _ogg_free(b);
-}
-
-void vorbis_book_clear(codebook *b){
-  /* static book is not cleared; we're likely called on the lookup and
-     the static codebook belongs to the info struct */
-  if(b->valuelist)_ogg_free(b->valuelist);
-  if(b->codelist)_ogg_free(b->codelist);
-
-  if(b->dec_index)_ogg_free(b->dec_index);
-  if(b->dec_codelengths)_ogg_free(b->dec_codelengths);
-  if(b->dec_firsttable)_ogg_free(b->dec_firsttable);
-
-  memset(b,0,sizeof(*b));
-}
-
-static ogg_uint32_t bitreverse(ogg_uint32_t x){
-  x=    ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
-  x=    ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
-  x=    ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
-  x=    ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
-  return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
-}
-
-static int sort32a(const void *a,const void *b){
-  return (**(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
-    (**(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
-}
-
-/* decode codebook arrangement is more heavily optimized than encode */
-int vorbis_book_init_decode(codebook *c,const static_codebook *s){
-  int i,j,n=0,tabn;
-  int *sortindex;
-  memset(c,0,sizeof(*c));
-  
-  /* count actually used entries */
-  for(i=0;i<s->entries;i++)
-    if(s->lengthlist[i]>0)
-      n++;
-
-  c->entries=s->entries;
-  c->used_entries=n;
-  c->dim=s->dim;
-
-  if(n>0){
-    /* two different remappings go on here.  
-       
-       First, we collapse the likely sparse codebook down only to
-       actually represented values/words.  This collapsing needs to be
-       indexed as map-valueless books are used to encode original entry
-       positions as integers.
-       
-       Second, we reorder all vectors, including the entry index above,
-       by sorted bitreversed codeword to allow treeless decode. */
-    
-    /* perform sort */
-    ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
-    ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
-    
-    if(codes==NULL)goto err_out;
-
-    for(i=0;i<n;i++){
-      codes[i]=bitreverse(codes[i]);
-      codep[i]=codes+i;
-    }
-
-    qsort(codep,n,sizeof(*codep),sort32a);
-
-    sortindex=(int *)alloca(n*sizeof(*sortindex));
-    c->codelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
-    /* the index is a reverse index */
-    for(i=0;i<n;i++){
-      int position=codep[i]-codes;
-      sortindex[position]=i;
-    }
-
-    for(i=0;i<n;i++)
-      c->codelist[sortindex[i]]=codes[i];
-    _ogg_free(codes);
-    
-    
-    
-    c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
-    c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
-    
-    for(n=0,i=0;i<s->entries;i++)
-      if(s->lengthlist[i]>0)
-	c->dec_index[sortindex[n++]]=i;
-    
-    c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
-    for(n=0,i=0;i<s->entries;i++)
-      if(s->lengthlist[i]>0)
-	c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
-    
-    c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
-    if(c->dec_firsttablen<5)c->dec_firsttablen=5;
-    if(c->dec_firsttablen>8)c->dec_firsttablen=8;
-    
-    tabn=1<<c->dec_firsttablen;
-    c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
-    c->dec_maxlength=0;
-    
-    for(i=0;i<n;i++){
-      if(c->dec_maxlength<c->dec_codelengths[i])
-	c->dec_maxlength=c->dec_codelengths[i];
-      if(c->dec_codelengths[i]<=c->dec_firsttablen){
-	ogg_uint32_t orig=bitreverse(c->codelist[i]);
-	for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
-	  c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
-      }
-    }
-    
-    /* now fill in 'unused' entries in the firsttable with hi/lo search
-       hints for the non-direct-hits */
-    {
-      ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
-      long lo=0,hi=0;
-      
-      for(i=0;i<tabn;i++){
-	ogg_uint32_t word=i<<(32-c->dec_firsttablen);
-	if(c->dec_firsttable[bitreverse(word)]==0){
-	  while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
-	  while(    hi<n && word>=(c->codelist[hi]&mask))hi++;
-	  
-	  /* we only actually have 15 bits per hint to play with here.
-	     In order to overflow gracefully (nothing breaks, efficiency
-	     just drops), encode as the difference from the extremes. */
-	  {
-	    unsigned long loval=lo;
-	    unsigned long hival=n-hi;
-	    
-	    if(loval>0x7fff)loval=0x7fff;
-	    if(hival>0x7fff)hival=0x7fff;
-	    c->dec_firsttable[bitreverse(word)]=
-	      0x80000000UL | (loval<<15) | hival;
-	  }
-	}
-      }
-    }
-  }
-
-  return(0);
- err_out:
-  vorbis_book_clear(c);
-  return(-1);
-}
-
--- a/misc/libtremor/synthesis.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.4 2003/03/29 03:07:21 xiphmont Exp $
-
- ********************************************************************/
-
-#include <stdio.h>
-#include "ogg.h"
-#include "ivorbiscodec.h"
-#include "codec_internal.h"
-#include "registry.h"
-#include "misc.h"
-#include "block.h"
-
-int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){
-  vorbis_dsp_state     *vd=vb->vd;
-  private_state        *b=(private_state *)vd->backend_state;
-  vorbis_info          *vi=vd->vi;
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  oggpack_buffer       *opb=&vb->opb;
-  int                   type,mode,i;
- 
-  /* first things first.  Make sure decode is ready */
-  _vorbis_block_ripcord(vb);
-  oggpack_readinit(opb,op->packet);
-
-  /* Check the packet type */
-  if(oggpack_read(opb,1)!=0){
-    /* Oops.  This is not an audio data packet */
-    return(OV_ENOTAUDIO);
-  }
-
-  /* read our mode and pre/post windowsize */
-  mode=oggpack_read(opb,b->modebits);
-  if(mode==-1)return(OV_EBADPACKET);
-  
-  vb->mode=mode;
-  vb->W=ci->mode_param[mode]->blockflag;
-  if(vb->W){
-    vb->lW=oggpack_read(opb,1);
-    vb->nW=oggpack_read(opb,1);
-    if(vb->nW==-1)   return(OV_EBADPACKET);
-  }else{
-    vb->lW=0;
-    vb->nW=0;
-  }
-  
-  /* more setup */
-  vb->granulepos=op->granulepos;
-  vb->sequence=op->packetno-3; /* first block is third packet */
-  vb->eofflag=op->e_o_s;
-
-  if(decodep){
-    /* alloc pcm passback storage */
-    vb->pcmend=ci->blocksizes[vb->W];
-    vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
-    for(i=0;i<vi->channels;i++)
-      vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
-    
-    /* unpack_header enforces range checking */
-    type=ci->map_type[ci->mode_param[mode]->mapping];
-    
-    return(_mapping_P[type]->inverse(vb,b->mode[mode]));
-  }else{
-    /* no pcm */
-    vb->pcmend=0;
-    vb->pcm=NULL;
-    
-    return(0);
-  }
-}
-
-long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
-  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
-  oggpack_buffer       opb;
-  int                  mode;
- 
-  oggpack_readinit(&opb,op->packet);
-
-  /* Check the packet type */
-  if(oggpack_read(&opb,1)!=0){
-    /* Oops.  This is not an audio data packet */
-    return(OV_ENOTAUDIO);
-  }
-
-  {
-    int modebits=0;
-    int v=ci->modes;
-    while(v>1){
-      modebits++;
-      v>>=1;
-    }
-
-    /* read our mode and pre/post windowsize */
-    mode=oggpack_read(&opb,modebits);
-  }
-  if(mode==-1)return(OV_EBADPACKET);
-  return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
-}
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/CHANGELOG	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,19 @@
+*** 20020517: 1.0.2 ***
+
+  Playback bugfix to floor1; mode mistakenly used for sizing instead
+  of blockflag
+
+*** 20020515: 1.0.1 ***
+
+  Added complete API documentation to source tarball.  No code
+  changes.
+
+*** 20020412: 1.0.1 ***
+
+  Fixed a clipping bug that affected ARM processors; negative
+  overflows were being properly clipped, but then clobbered to
+  positive by the positive overflow chec (asm_arm.h:CLIP_TO_15)
+
+*** 20020403: 1.0.0 ***
+
+  Initial version
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/COPYING	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,28 @@
+Copyright (c) 2002, Xiph.org Foundation
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+- Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+- Neither the name of the Xiph.org Foundation nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/Makefile.am	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,38 @@
+AUTOMAKE_OPTIONS = foreign
+
+INCLUDES = -I./
+
+lib_LTLIBRARIES = libvorbisidec.la
+
+libvorbisidec_la_SOURCES = mdct.c block.c window.c \
+                        synthesis.c info.c \
+                        floor1.c floor0.c vorbisfile.c \
+                        res012.c mapping0.c registry.c codebook.c \
+			sharedbook.c framing.c bitwise.c \
+                        codebook.h misc.h mdct_lookup.h\
+                        os.h mdct.h block.h ivorbisfile.h lsp_lookup.h\
+                        registry.h window.h window_lookup.h\
+                        codec_internal.h backends.h ogg.h \
+			asm_arm.h ivorbiscodec.h
+libvorbisidec_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
+
+EXTRA_PROGRAMS = ivorbisfile_example
+CLEANFILES = $(EXTRA_PROGRAMS) $(lib_LTLIBRARIES)
+
+ivorbisfile_example_SOURCES = ivorbisfile_example.c
+ivorbisfile_example_LDFLAGS = -static 
+ivorbisfile_example_LDADD = libvorbisidec.la
+
+includedir = $(prefix)/include/tremor
+
+include_HEADERS = ivorbiscodec.h ivorbisfile.h ogg.h os_types.h config_types.h
+
+example:
+	-ln -fs . vorbis
+	$(MAKE) ivorbisfile_example
+
+debug:
+	$(MAKE) all CFLAGS="@DEBUG@" 
+
+profile:
+	$(MAKE) all CFLAGS="@PROFILE@"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/README	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,46 @@
+This README covers the Ogg Vorbis 'Tremor' integer playback codec
+source as of date 2002 09 02, version 1.0.0.
+
+                            ******
+
+The C source in this package will build on any ANSI C compiler and
+function completely and properly on any platform.  The included build
+system assumes GNU build system and make tools (m4, automake,
+autoconf, libtool and gmake).  GCC is not required, although GCC is
+the most tested compiler.  To build using GNU tools, type in the
+source directory:
+
+./autogen.sh
+make
+
+Currently, the source implements playback in pure C on all platforms
+except ARM, where a [currently] small amount of assembly (see
+asm_arm.h) is used to implement 64 bit math operations and fast LSP
+computation.  If building on ARM without the benefit of GNU build
+system tools, be sure that '_ARM_ASSEM_' is #defined by the build
+system if this assembly is desired, else the resulting library will
+use whatever 64 bit math builtins the compiler implements.
+
+No math library is required by this source.  No floating point
+operations are used at any point in either setup or decode.  This
+decoder library will properly decode any past, current or future
+Vorbis I file or stream.
+
+                           ********
+
+The build system produces a static and [when supported by the OS]
+dynamic library named 'libvorbisidec'.  This library exposes an API
+nearly identical to the BSD reference library's 'libvorbisfile',
+including all the features familiar to users of vorbisfile.  This API
+is similar enough that the proper header file to include is named
+'ivorbisfile.h' [included in the source build directory].  Lower level
+libvorbis-style headers and structures are in 'ivorbiscodec.h'
+[included in the source build directory]. A simple example program,
+ivorbisfile_example.c, can be built with 'make example'.
+
+                           ********
+
+Detailed Tremor API Documentation begins at doc/index.html
+
+Monty
+xiph.org
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/Version_script.in	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,49 @@
+#
+# Export file for libvorbisidec
+#
+# Only the symbols listed in the global section will be callable from
+# applications linking to libvorbisidec.
+#
+
+@PACKAGE@.so.1
+{
+	global:
+		ov_clear;
+		ov_open;
+		ov_open_callbacks;
+		ov_test;
+		ov_test_callbacks;
+		ov_test_open;
+		ov_bitrate;
+		ov_bitrate_instant;
+		ov_streams;
+		ov_seekable;
+		ov_serialnumber;
+		ov_raw_total;
+		ov_pcm_total;
+		ov_time_total;
+		ov_raw_seek;
+		ov_pcm_seek;
+		ov_pcm_seek_page;
+		ov_time_seek;
+		ov_time_seek_page;
+		ov_raw_tell;
+		ov_pcm_tell;
+		ov_time_tell;
+		ov_info;
+		ov_comment;
+		ov_read;
+
+		vorbis_info_init;
+		vorbis_info_clear;
+		vorbis_info_blocksize;
+		vorbis_comment_init;
+		vorbis_comment_add;
+		vorbis_comment_add_tag;
+		vorbis_comment_query;
+		vorbis_comment_query_count;
+		vorbis_comment_clear;
+
+	local:
+		*;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/asm_arm.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,243 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: arm7 and later wide math functions
+
+ ********************************************************************/
+
+#ifdef _ARM_ASSEM_
+
+#if !defined(_V_WIDE_MATH) && !defined(_LOW_ACCURACY_)
+#define _V_WIDE_MATH
+
+static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
+  int lo,hi;
+  asm volatile("smull\t%0, %1, %2, %3"
+               : "=&r"(lo),"=&r"(hi)
+               : "%r"(x),"r"(y)
+	       : "cc");
+  return(hi);
+}
+
+static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
+  return MULT32(x,y)<<1;
+}
+
+static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
+  int lo,hi;
+  asm volatile("smull	%0, %1, %2, %3\n\t"
+	       "movs	%0, %0, lsr #15\n\t"
+	       "adc	%1, %0, %1, lsl #17\n\t"
+               : "=&r"(lo),"=&r"(hi)
+               : "%r"(x),"r"(y)
+	       : "cc");
+  return(hi);
+}
+
+#define MB() asm volatile ("" : : : "memory")
+
+static inline void XPROD32(ogg_int32_t  a, ogg_int32_t  b,
+			   ogg_int32_t  t, ogg_int32_t  v,
+			   ogg_int32_t *x, ogg_int32_t *y)
+{
+  int x1, y1, l;
+  asm(	"smull	%0, %1, %4, %6\n\t"
+	"smlal	%0, %1, %5, %7\n\t"
+	"rsb	%3, %4, #0\n\t"
+	"smull	%0, %2, %5, %6\n\t"
+	"smlal	%0, %2, %3, %7"
+	: "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
+	: "3" (a), "r" (b), "r" (t), "r" (v)
+	: "cc" );
+  *x = x1;
+  MB();
+  *y = y1;
+}
+
+static inline void XPROD31(ogg_int32_t  a, ogg_int32_t  b,
+			   ogg_int32_t  t, ogg_int32_t  v,
+			   ogg_int32_t *x, ogg_int32_t *y)
+{
+  int x1, y1, l;
+  asm(	"smull	%0, %1, %4, %6\n\t"
+	"smlal	%0, %1, %5, %7\n\t"
+	"rsb	%3, %4, #0\n\t"
+	"smull	%0, %2, %5, %6\n\t"
+	"smlal	%0, %2, %3, %7"
+	: "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
+	: "3" (a), "r" (b), "r" (t), "r" (v)
+	: "cc" );
+  *x = x1 << 1;
+  MB();
+  *y = y1 << 1;
+}
+
+static inline void XNPROD31(ogg_int32_t  a, ogg_int32_t  b,
+			    ogg_int32_t  t, ogg_int32_t  v,
+			    ogg_int32_t *x, ogg_int32_t *y)
+{
+  int x1, y1, l;
+  asm(	"rsb	%2, %4, #0\n\t"
+	"smull	%0, %1, %3, %5\n\t"
+	"smlal	%0, %1, %2, %6\n\t"
+	"smull	%0, %2, %4, %5\n\t"
+	"smlal	%0, %2, %3, %6"
+	: "=&r" (l), "=&r" (x1), "=&r" (y1)
+	: "r" (a), "r" (b), "r" (t), "r" (v)
+	: "cc" );
+  *x = x1 << 1;
+  MB();
+  *y = y1 << 1;
+}
+
+#endif
+
+#ifndef _V_CLIP_MATH
+#define _V_CLIP_MATH
+
+static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
+  int tmp;
+  asm volatile("subs	%1, %0, #32768\n\t"
+	       "movpl	%0, #0x7f00\n\t"
+	       "orrpl	%0, %0, #0xff\n"
+	       "adds	%1, %0, #32768\n\t"
+	       "movmi	%0, #0x8000"
+	       : "+r"(x),"=r"(tmp)
+	       :
+	       : "cc");
+  return(x);
+}
+
+#endif
+
+#ifndef _V_LSP_MATH_ASM
+#define _V_LSP_MATH_ASM
+
+static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
+				ogg_int32_t *qexpp,
+				ogg_int32_t *ilsp,ogg_int32_t wi,
+				ogg_int32_t m){
+  
+  ogg_uint32_t qi=*qip,pi=*pip;
+  ogg_int32_t qexp=*qexpp;
+
+  asm("mov     r0,%3;"
+      "mov     r1,%5,asr#1;"
+      "add     r0,r0,r1,lsl#3;"
+      "1:"
+      
+      "ldmdb   r0!,{r1,r3};"
+      "subs    r1,r1,%4;"          //ilsp[j]-wi
+      "rsbmi   r1,r1,#0;"          //labs(ilsp[j]-wi)
+      "umull   %0,r2,r1,%0;"       //qi*=labs(ilsp[j]-wi)
+      
+      "subs    r1,r3,%4;"          //ilsp[j+1]-wi
+      "rsbmi   r1,r1,#0;"          //labs(ilsp[j+1]-wi)
+      "umull   %1,r3,r1,%1;"       //pi*=labs(ilsp[j+1]-wi)
+      
+      "cmn     r2,r3;"             // shift down 16?
+      "beq     0f;"
+      "add     %2,%2,#16;"
+      "mov     %0,%0,lsr #16;"
+      "orr     %0,%0,r2,lsl #16;"
+      "mov     %1,%1,lsr #16;"
+      "orr     %1,%1,r3,lsl #16;"
+      "0:"
+      "cmp     r0,%3;\n"
+      "bhi     1b;\n"
+      
+      // odd filter assymetry
+      "ands    r0,%5,#1;\n"
+      "beq     2f;\n"
+      "add     r0,%3,%5,lsl#2;\n"
+      
+      "ldr     r1,[r0,#-4];\n"
+      "mov     r0,#0x4000;\n"
+      
+      "subs    r1,r1,%4;\n"          //ilsp[j]-wi
+      "rsbmi   r1,r1,#0;\n"          //labs(ilsp[j]-wi)
+      "umull   %0,r2,r1,%0;\n"       //qi*=labs(ilsp[j]-wi)
+      "umull   %1,r3,r0,%1;\n"       //pi*=labs(ilsp[j+1]-wi)
+      
+      "cmn     r2,r3;\n"             // shift down 16?
+      "beq     2f;\n"
+      "add     %2,%2,#16;\n"
+      "mov     %0,%0,lsr #16;\n"
+      "orr     %0,%0,r2,lsl #16;\n"
+      "mov     %1,%1,lsr #16;\n"
+      "orr     %1,%1,r3,lsl #16;\n"
+      
+      //qi=(pi>>shift)*labs(ilsp[j]-wi);
+      //pi=(qi>>shift)*labs(ilsp[j+1]-wi);
+      //qexp+=shift;
+      
+      //}
+	 
+      /* normalize to max 16 sig figs */
+      "2:"
+      "mov     r2,#0;"
+      "orr     r1,%0,%1;"
+      "tst     r1,#0xff000000;"
+      "addne   r2,r2,#8;"
+      "movne   r1,r1,lsr #8;"
+      "tst     r1,#0x00f00000;"
+      "addne   r2,r2,#4;"
+      "movne   r1,r1,lsr #4;"
+      "tst     r1,#0x000c0000;"
+      "addne   r2,r2,#2;"
+      "movne   r1,r1,lsr #2;"
+      "tst     r1,#0x00020000;"
+      "addne   r2,r2,#1;"
+      "movne   r1,r1,lsr #1;"
+      "tst     r1,#0x00010000;"
+      "addne   r2,r2,#1;"
+      "mov     %0,%0,lsr r2;"
+      "mov     %1,%1,lsr r2;"
+      "add     %2,%2,r2;"
+      
+      : "+r"(qi),"+r"(pi),"+r"(qexp)
+      : "r"(ilsp),"r"(wi),"r"(m)
+      : "r0","r1","r2","r3","cc");
+  
+  *qip=qi;
+  *pip=pi;
+  *qexpp=qexp;
+}
+
+static inline void lsp_norm_asm(ogg_uint32_t *qip,ogg_int32_t *qexpp){
+
+  ogg_uint32_t qi=*qip;
+  ogg_int32_t qexp=*qexpp;
+
+  asm("tst     %0,#0x0000ff00;"
+      "moveq   %0,%0,lsl #8;"
+      "subeq   %1,%1,#8;"
+      "tst     %0,#0x0000f000;"
+      "moveq   %0,%0,lsl #4;"
+      "subeq   %1,%1,#4;"
+      "tst     %0,#0x0000c000;"
+      "moveq   %0,%0,lsl #2;"
+      "subeq   %1,%1,#2;"
+      "tst     %0,#0x00008000;"
+      "moveq   %0,%0,lsl #1;"
+      "subeq   %1,%1,#1;"
+      : "+r"(qi),"+r"(qexp)
+      :
+      : "cc");
+  *qip=qi;
+  *qexpp=qexp;
+}
+
+#endif
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/autogen.sh	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,120 @@
+#!/bin/sh
+# Run this to set up the build system: configure, makefiles, etc.
+# (based on the version in enlightenment's cvs)
+
+package="vorbisdec"
+
+olddir=`pwd`
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+cd "$srcdir"
+DIE=0
+
+echo "checking for autoconf... "
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have autoconf installed to compile $package."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+        DIE=1
+}
+
+VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
+VERSIONMKINT="sed -e s/[^0-9]//"
+                                                                                
+# do we need automake?
+if test -r Makefile.am; then
+  AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
+  AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
+  if test x"$AM_NEEDED" = "x$AM_OPTIONS"; then
+    AM_NEEDED=""
+  fi
+  if test -z $AM_NEEDED; then
+    echo -n "checking for automake... "
+    AUTOMAKE=automake
+    ACLOCAL=aclocal
+    if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
+      echo "yes"
+    else
+      echo "no"
+      AUTOMAKE=
+    fi
+  else
+    echo -n "checking for automake $AM_NEEDED or later... "
+    for am in automake-$AM_NEEDED automake$AM_NEEDED automake; do
+      ($am --version < /dev/null > /dev/null 2>&1) || continue
+      ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
+      verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
+      if test $ver -ge $verneeded; then
+        AUTOMAKE=$am
+        echo $AUTOMAKE
+        break
+      fi
+    done
+    test -z $AUTOMAKE &&  echo "no"
+    echo -n "checking for aclocal $AM_NEEDED or later... "
+    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal; do
+      ($ac --version < /dev/null > /dev/null 2>&1) || continue
+      ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
+      verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
+      if test $ver -ge $verneeded; then
+        ACLOCAL=$ac
+        echo $ACLOCAL
+        break
+      fi
+    done
+    test -z $ACLOCAL && echo "no"
+  fi
+  test -z $AUTOMAKE || test -z $ACLOCAL && {
+        echo
+        echo "You must have automake installed to compile $package."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+        exit 1
+  }
+fi
+
+echo -n "checking for libtool... "
+for LIBTOOLIZE in libtoolize glibtoolize nope; do
+  ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
+done
+if test x$LIBTOOLIZE = xnope; then
+  echo "nope."
+  LIBTOOLIZE=libtoolize
+else
+  echo $LIBTOOLIZE
+fi
+($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+	echo "You must have libtool installed to compile $package."
+	echo "Download the appropriate package for your system,"
+	echo "or get the source from one of the GNU ftp sites"
+	echo "listed in http://www.gnu.org/order/ftp.html"
+	DIE=1
+}
+
+if test "$DIE" -eq 1; then
+        exit 1
+fi
+
+if test -z "$*"; then
+        echo "I am going to run ./configure with no arguments - if you wish "
+        echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+echo "Generating configuration files for $package, please wait...."
+
+echo "  $ACLOCAL $ACLOCAL_FLAGS"
+$ACLOCAL $ACLOCAL_FLAGS || exit 1
+echo "  $LIBTOOLIZE --automake"
+$LIBTOOLIZE --automake || exit 1
+echo "  autoheader"
+autoheader || exit 1
+echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
+$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
+echo "  autoconf"
+autoconf || exit 1
+
+cd $olddir
+$srcdir/configure --enable-maintainer-mode "$@" && echo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/backends.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,130 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: backend and mapping structures
+
+ ********************************************************************/
+
+/* this is exposed up here because we need it for static modes.
+   Lookups for each backend aren't exposed because there's no reason
+   to do so */
+
+#ifndef _vorbis_backend_h_
+#define _vorbis_backend_h_
+
+#include "codec_internal.h"
+
+/* this would all be simpler/shorter with templates, but.... */
+/* Transform backend generic *************************************/
+
+/* only mdct right now.  Flesh it out more if we ever transcend mdct
+   in the transform domain */
+
+/* Floor backend generic *****************************************/
+typedef struct{
+  vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
+  vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
+				   vorbis_info_floor *);
+  void (*free_info) (vorbis_info_floor *);
+  void (*free_look) (vorbis_look_floor *);
+  void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
+  int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
+		     void *buffer,ogg_int32_t *);
+} vorbis_func_floor;
+
+typedef struct{
+  int   order;
+  long  rate;
+  long  barkmap;
+
+  int   ampbits;
+  int   ampdB;
+
+  int   numbooks; /* <= 16 */
+  int   books[16];
+
+} vorbis_info_floor0;
+
+#define VIF_POSIT 63
+#define VIF_CLASS 16
+#define VIF_PARTS 31
+typedef struct{
+  int   partitions;                /* 0 to 31 */
+  int   partitionclass[VIF_PARTS]; /* 0 to 15 */
+
+  int   class_dim[VIF_CLASS];        /* 1 to 8 */
+  int   class_subs[VIF_CLASS];       /* 0,1,2,3 (bits: 1<<n poss) */
+  int   class_book[VIF_CLASS];       /* subs ^ dim entries */
+  int   class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
+
+
+  int   mult;                      /* 1 2 3 or 4 */
+  int   postlist[VIF_POSIT+2];    /* first two implicit */
+
+} vorbis_info_floor1;
+
+/* Residue backend generic *****************************************/
+typedef struct{
+  vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
+  vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
+				 vorbis_info_residue *);
+  void (*free_info)    (vorbis_info_residue *);
+  void (*free_look)    (vorbis_look_residue *);
+  int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
+			ogg_int32_t **,int *,int);
+} vorbis_func_residue;
+
+typedef struct vorbis_info_residue0{
+/* block-partitioned VQ coded straight residue */
+  long  begin;
+  long  end;
+
+  /* first stage (lossless partitioning) */
+  int    grouping;         /* group n vectors per partition */
+  int    partitions;       /* possible codebooks for a partition */
+  int    groupbook;        /* huffbook for partitioning */
+  int    secondstages[64]; /* expanded out to pointers in lookup */
+  int    booklist[256];    /* list of second stage books */
+} vorbis_info_residue0;
+
+/* Mapping backend generic *****************************************/
+typedef struct{
+  vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
+  vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
+				 vorbis_info_mapping *);
+  void (*free_info)    (vorbis_info_mapping *);
+  void (*free_look)    (vorbis_look_mapping *);
+  int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
+} vorbis_func_mapping;
+
+typedef struct vorbis_info_mapping0{
+  int   submaps;  /* <= 16 */
+  int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
+
+  int   floorsubmap[16];   /* [mux] submap to floors */
+  int   residuesubmap[16]; /* [mux] submap to residue */
+
+  int   psy[2]; /* by blocktype; impulse/padding for short,
+                   transition/normal for long */
+
+  int   coupling_steps;
+  int   coupling_mag[256];
+  int   coupling_ang[256];
+} vorbis_info_mapping0;
+
+#endif
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/bitwise.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,265 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function: packing variable sized words into an octet stream
+
+ ********************************************************************/
+
+/* We're 'LSb' endian; if we write a word but read individual bits,
+   then we'll read the lsb first */
+
+#include <string.h>
+#include <stdlib.h>
+#include "ogg.h"
+
+static unsigned long mask[]=
+{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
+ 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
+ 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
+ 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
+ 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,
+ 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
+ 0x3fffffff,0x7fffffff,0xffffffff };
+
+/* mark read process as having run off the end */
+static void _adv_halt(oggpack_buffer *b){
+  b->headptr=b->head->buffer->data+b->head->begin+b->head->length;
+  b->headend=-1;
+  b->headbit=0;
+}
+
+/* spans forward, skipping as many bytes as headend is negative; if
+   headend is zero, simply finds next byte.  If we're up to the end
+   of the buffer, leaves headend at zero.  If we've read past the end,
+   halt the decode process. */
+static void _span(oggpack_buffer *b){
+  while(b->headend<1){
+    if(b->head->next){
+      b->count+=b->head->length;
+      b->head=b->head->next;
+      b->headptr=b->head->buffer->data+b->head->begin-b->headend;
+      b->headend+=b->head->length;
+    }else{
+      /* we've either met the end of decode, or gone past it. halt
+         only if we're past */
+      if(b->headend<0 || b->headbit)
+        /* read has fallen off the end */
+        _adv_halt(b);
+
+      break;
+    }
+  }
+}
+
+void oggpack_readinit(oggpack_buffer *b,ogg_reference *r){
+  memset(b,0,sizeof(*b));
+
+  b->tail=b->head=r;
+  b->count=0;
+  b->headptr=b->head->buffer->data+b->head->begin;
+  b->headend=b->head->length;
+  _span(b);
+}
+
+#define _lookspan()   while(!end){\
+                        head=head->next;\
+                        if(!head) return -1;\
+                        ptr=head->buffer->data + head->begin;\
+                        end=head->length;\
+                      }
+
+/* Read in bits without advancing the bitptr; bits <= 32 */
+long oggpack_look(oggpack_buffer *b,int bits){
+  unsigned long m=mask[bits];
+  unsigned long ret=-1;
+
+  bits+=b->headbit;
+
+  if(bits >= b->headend<<3){
+    int            end=b->headend;
+    unsigned char *ptr=b->headptr;
+    ogg_reference *head=b->head;
+
+    if(end<0)return -1;
+
+    if(bits){
+      _lookspan();
+      ret=*ptr++>>b->headbit;
+      if(bits>8){
+        --end;
+        _lookspan();
+        ret|=*ptr++<<(8-b->headbit);
+        if(bits>16){
+          --end;
+          _lookspan();
+          ret|=*ptr++<<(16-b->headbit);
+          if(bits>24){
+            --end;
+            _lookspan();
+            ret|=*ptr++<<(24-b->headbit);
+            if(bits>32 && b->headbit){
+              --end;
+              _lookspan();
+              ret|=*ptr<<(32-b->headbit);
+            }
+          }
+        }
+      }
+    }
+
+  }else{
+
+    /* make this a switch jump-table */
+    ret=b->headptr[0]>>b->headbit;
+    if(bits>8){
+      ret|=b->headptr[1]<<(8-b->headbit);  
+      if(bits>16){
+        ret|=b->headptr[2]<<(16-b->headbit);  
+        if(bits>24){
+          ret|=b->headptr[3]<<(24-b->headbit);  
+          if(bits>32 && b->headbit)
+            ret|=b->headptr[4]<<(32-b->headbit);
+        }
+      }
+    }
+  }
+
+  ret&=m;
+  return ret;
+}
+
+/* limited to 32 at a time */
+void oggpack_adv(oggpack_buffer *b,int bits){
+  bits+=b->headbit;
+  b->headbit=bits&7;
+  b->headptr+=bits/8;
+  if((b->headend-=bits/8)<1)_span(b);
+}
+
+/* spans forward and finds next byte.  Never halts */
+static void _span_one(oggpack_buffer *b){
+  while(b->headend<1){
+    if(b->head->next){
+      b->count+=b->head->length;
+      b->head=b->head->next;
+      b->headptr=b->head->buffer->data+b->head->begin;
+      b->headend=b->head->length;
+    }else
+      break;
+  }
+}
+
+static int _halt_one(oggpack_buffer *b){
+  if(b->headend<1){
+    _adv_halt(b);
+    return -1;
+  }
+  return 0;
+}
+
+int oggpack_eop(oggpack_buffer *b){
+  if(b->headend<0)return -1;
+  return 0;
+}
+
+/* bits <= 32 */
+long oggpack_read(oggpack_buffer *b,int bits){
+  unsigned long m=mask[bits];
+  ogg_uint32_t ret=-1;
+
+  bits+=b->headbit;
+
+  if(bits >= b->headend<<3){
+
+    if(b->headend<0)return -1;
+
+    if(bits){
+      if (_halt_one(b)) return -1;
+      ret=*b->headptr>>b->headbit;
+
+      if(bits>=8){
+        ++b->headptr;
+        --b->headend;
+        _span_one(b);
+        if(bits>8){
+          if (_halt_one(b)) return -1;
+          ret|=*b->headptr<<(8-b->headbit);
+
+          if(bits>=16){
+            ++b->headptr;
+            --b->headend;
+            _span_one(b);
+            if(bits>16){
+              if (_halt_one(b)) return -1;
+              ret|=*b->headptr<<(16-b->headbit);
+
+              if(bits>=24){
+                ++b->headptr;
+                --b->headend;
+                _span_one(b);
+                if(bits>24){
+                  if (_halt_one(b)) return -1;
+                  ret|=*b->headptr<<(24-b->headbit);
+
+                  if(bits>=32){
+                    ++b->headptr;
+                    --b->headend;
+                    _span_one(b);
+                    if(bits>32){
+                      if (_halt_one(b)) return -1;
+                      if(b->headbit)ret|=*b->headptr<<(32-b->headbit);
+
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }else{
+
+    ret=b->headptr[0]>>b->headbit;
+    if(bits>8){
+      ret|=b->headptr[1]<<(8-b->headbit);
+      if(bits>16){
+        ret|=b->headptr[2]<<(16-b->headbit);
+        if(bits>24){
+          ret|=b->headptr[3]<<(24-b->headbit);
+          if(bits>32 && b->headbit){
+            ret|=b->headptr[4]<<(32-b->headbit);
+          }
+        }
+      }
+    }
+
+    b->headptr+=bits/8;
+    b->headend-=bits/8;
+  }
+
+  ret&=m;
+  b->headbit=bits&7;
+  return ret;
+}
+
+long oggpack_bytes(oggpack_buffer *b){
+  return(b->count+b->headptr-b->head->buffer->data-b->head->begin+
+         (b->headbit+7)/8);
+}
+
+long oggpack_bits(oggpack_buffer *b){
+  return((b->count+b->headptr-b->head->buffer->data-b->head->begin)*8+
+         b->headbit);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/block.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,453 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: PCM data vector blocking, windowing and dis/reassembly
+
+ ********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "ogg.h"
+#include "ivorbiscodec.h"
+#include "codec_internal.h"
+
+#include "window.h"
+#include "registry.h"
+#include "misc.h"
+
+static int ilog(unsigned int v){
+  int ret=0;
+  if(v)--v;
+  while(v){
+    ret++;
+    v>>=1;
+  }
+  return(ret);
+}
+
+/* pcm accumulator examples (not exhaustive):
+
+ <-------------- lW ---------------->
+                   <--------------- W ---------------->
+:            .....|.....       _______________         |
+:        .'''     |     '''_---      |       |\        |
+:.....'''         |_____--- '''......|       | \_______|
+:.................|__________________|_______|__|______|
+                  |<------ Sl ------>|      > Sr <     |endW
+                  |beginSl           |endSl  |  |endSr
+                  |beginW            |endlW  |beginSr
+
+
+                      |< lW >|
+                   <--------------- W ---------------->
+                  |   |  ..  ______________            |
+                  |   | '  `/        |     ---_        |
+                  |___.'___/`.       |         ---_____|
+                  |_______|__|_______|_________________|
+                  |      >|Sl|<      |<------ Sr ----->|endW
+                  |       |  |endSl  |beginSr          |endSr
+                  |beginW |  |endlW
+                  mult[0] |beginSl                     mult[n]
+
+ <-------------- lW ----------------->
+                          |<--W-->|
+:            ..............  ___  |   |
+:        .'''             |`/   \ |   |
+:.....'''                 |/`....\|...|
+:.........................|___|___|___|
+                          |Sl |Sr |endW
+                          |   |   |endSr
+                          |   |beginSr
+                          |   |endSl
+			  |beginSl
+			  |beginW
+*/
+
+/* block abstraction setup *********************************************/
+
+#ifndef WORD_ALIGN
+#define WORD_ALIGN 8
+#endif
+
+int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
+  memset(vb,0,sizeof(*vb));
+  vb->vd=v;
+  vb->localalloc=0;
+  vb->localstore=NULL;
+
+  return(0);
+}
+
+void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
+  bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1);
+  if(bytes+vb->localtop>vb->localalloc){
+    /* can't just _ogg_realloc... there are outstanding pointers */
+    if(vb->localstore){
+      struct alloc_chain *link=(struct alloc_chain *)_ogg_malloc(sizeof(*link));
+      vb->totaluse+=vb->localtop;
+      link->next=vb->reap;
+      link->ptr=vb->localstore;
+      vb->reap=link;
+    }
+    /* highly conservative */
+    vb->localalloc=bytes;
+    vb->localstore=_ogg_malloc(vb->localalloc);
+    vb->localtop=0;
+  }
+  {
+    void *ret=(void *)(((char *)vb->localstore)+vb->localtop);
+    vb->localtop+=bytes;
+    return ret;
+  }
+}
+
+/* reap the chain, pull the ripcord */
+void _vorbis_block_ripcord(vorbis_block *vb){
+  /* reap the chain */
+  struct alloc_chain *reap=vb->reap;
+  while(reap){
+    struct alloc_chain *next=reap->next;
+    _ogg_free(reap->ptr);
+    memset(reap,0,sizeof(*reap));
+    _ogg_free(reap);
+    reap=next;
+  }
+  /* consolidate storage */
+  if(vb->totaluse){
+    vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc);
+    vb->localalloc+=vb->totaluse;
+    vb->totaluse=0;
+  }
+
+  /* pull the ripcord */
+  vb->localtop=0;
+  vb->reap=NULL;
+}
+
+int vorbis_block_clear(vorbis_block *vb){
+  _vorbis_block_ripcord(vb);
+  if(vb->localstore)_ogg_free(vb->localstore);
+
+  memset(vb,0,sizeof(*vb));
+  return(0);
+}
+
+static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){
+  int i;
+  codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
+  private_state *b=NULL;
+
+  memset(v,0,sizeof(*v));
+  b=(private_state *)(v->backend_state=_ogg_calloc(1,sizeof(*b)));
+
+  v->vi=vi;
+  b->modebits=ilog(ci->modes);
+
+  /* Vorbis I uses only window type 0 */
+  b->window[0]=_vorbis_window(0,ci->blocksizes[0]/2);
+  b->window[1]=_vorbis_window(0,ci->blocksizes[1]/2);
+
+  /* finish the codebooks */
+  if(!ci->fullbooks){
+    ci->fullbooks=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
+    for(i=0;i<ci->books;i++){
+      vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]);
+      /* decode codebooks are now standalone after init */
+      vorbis_staticbook_destroy(ci->book_param[i]);
+      ci->book_param[i]=NULL;
+    }
+  }
+
+  v->pcm_storage=ci->blocksizes[1];
+  v->pcm=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcm));
+  v->pcmret=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmret));
+  for(i=0;i<vi->channels;i++)
+    v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
+
+  /* all 1 (large block) or 0 (small block) */
+  /* explicitly set for the sake of clarity */
+  v->lW=0; /* previous window size */
+  v->W=0;  /* current window size */
+
+  /* initialize all the mapping/backend lookups */
+  b->mode=(vorbis_look_mapping **)_ogg_calloc(ci->modes,sizeof(*b->mode));
+  for(i=0;i<ci->modes;i++){
+    int mapnum=ci->mode_param[i]->mapping;
+    int maptype=ci->map_type[mapnum];
+    b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
+					 ci->map_param[mapnum]);
+  }
+  return(0);
+}
+
+int vorbis_synthesis_restart(vorbis_dsp_state *v){
+  vorbis_info *vi=v->vi;
+  codec_setup_info *ci;
+
+  if(!v->backend_state)return -1;
+  if(!vi)return -1;
+  ci=vi->codec_setup;
+  if(!ci)return -1;
+
+  v->centerW=ci->blocksizes[1]/2;
+  v->pcm_current=v->centerW;
+
+  v->pcm_returned=-1;
+  v->granulepos=-1;
+  v->sequence=-1;
+  ((private_state *)(v->backend_state))->sample_count=-1;
+
+  return(0);
+}
+
+int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
+  _vds_init(v,vi);
+  vorbis_synthesis_restart(v);
+
+  return(0);
+}
+
+void vorbis_dsp_clear(vorbis_dsp_state *v){
+  int i;
+  if(v){
+    vorbis_info *vi=v->vi;
+    codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL);
+    private_state *b=(private_state *)v->backend_state;
+
+    if(v->pcm){
+      for(i=0;i<vi->channels;i++)
+	if(v->pcm[i])_ogg_free(v->pcm[i]);
+      _ogg_free(v->pcm);
+      if(v->pcmret)_ogg_free(v->pcmret);
+    }
+
+    /* free mode lookups; these are actually vorbis_look_mapping structs */
+    if(ci){
+      for(i=0;i<ci->modes;i++){
+	int mapnum=ci->mode_param[i]->mapping;
+	int maptype=ci->map_type[mapnum];
+	if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
+      }
+    }
+
+    if(b){
+      if(b->mode)_ogg_free(b->mode);
+      _ogg_free(b);
+    }
+
+    memset(v,0,sizeof(*v));
+  }
+}
+
+/* Unlike in analysis, the window is only partially applied for each
+   block.  The time domain envelope is not yet handled at the point of
+   calling (as it relies on the previous block). */
+
+int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
+  vorbis_info *vi=v->vi;
+  codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
+  private_state *b=v->backend_state;
+  int i,j;
+
+  if(v->pcm_current>v->pcm_returned  && v->pcm_returned!=-1)return(OV_EINVAL);
+
+  v->lW=v->W;
+  v->W=vb->W;
+  v->nW=-1;
+
+  if((v->sequence==-1)||
+     (v->sequence+1 != vb->sequence)){
+    v->granulepos=-1; /* out of sequence; lose count */
+    b->sample_count=-1;
+  }
+
+  v->sequence=vb->sequence;
+
+  if(vb->pcm){  /* no pcm to process if vorbis_synthesis_trackonly
+                   was called on block */
+    int n=ci->blocksizes[v->W]/2;
+    int n0=ci->blocksizes[0]/2;
+    int n1=ci->blocksizes[1]/2;
+
+    int thisCenter;
+    int prevCenter;
+
+    if(v->centerW){
+      thisCenter=n1;
+      prevCenter=0;
+    }else{
+      thisCenter=0;
+      prevCenter=n1;
+    }
+
+    /* v->pcm is now used like a two-stage double buffer.  We don't want
+       to have to constantly shift *or* adjust memory usage.  Don't
+       accept a new block until the old is shifted out */
+
+    /* overlap/add PCM */
+
+    for(j=0;j<vi->channels;j++){
+      /* the overlap/add section */
+      if(v->lW){
+	if(v->W){
+	  /* large/large */
+	  ogg_int32_t *pcm=v->pcm[j]+prevCenter;
+	  ogg_int32_t *p=vb->pcm[j];
+	  for(i=0;i<n1;i++)
+	    pcm[i]+=p[i];
+	}else{
+	  /* large/small */
+	  ogg_int32_t *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
+	  ogg_int32_t *p=vb->pcm[j];
+	  for(i=0;i<n0;i++)
+	    pcm[i]+=p[i];
+	}
+      }else{
+	if(v->W){
+	  /* small/large */
+	  ogg_int32_t *pcm=v->pcm[j]+prevCenter;
+	  ogg_int32_t *p=vb->pcm[j]+n1/2-n0/2;
+	  for(i=0;i<n0;i++)
+	    pcm[i]+=p[i];
+	  for(;i<n1/2+n0/2;i++)
+	    pcm[i]=p[i];
+	}else{
+	  /* small/small */
+	  ogg_int32_t *pcm=v->pcm[j]+prevCenter;
+	  ogg_int32_t *p=vb->pcm[j];
+	  for(i=0;i<n0;i++)
+	    pcm[i]+=p[i];
+	}
+      }
+
+      /* the copy section */
+      {
+	ogg_int32_t *pcm=v->pcm[j]+thisCenter;
+	ogg_int32_t *p=vb->pcm[j]+n;
+	for(i=0;i<n;i++)
+	  pcm[i]=p[i];
+      }
+    }
+
+    if(v->centerW)
+      v->centerW=0;
+    else
+      v->centerW=n1;
+
+    /* deal with initial packet state; we do this using the explicit
+       pcm_returned==-1 flag otherwise we're sensitive to first block
+       being short or long */
+
+    if(v->pcm_returned==-1){
+      v->pcm_returned=thisCenter;
+      v->pcm_current=thisCenter;
+    }else{
+      v->pcm_returned=prevCenter;
+      v->pcm_current=prevCenter+
+	ci->blocksizes[v->lW]/4+
+	ci->blocksizes[v->W]/4;
+    }
+
+  }
+
+  /* track the frame number... This is for convenience, but also
+     making sure our last packet doesn't end with added padding.  If
+     the last packet is partial, the number of samples we'll have to
+     return will be past the vb->granulepos.
+     
+     This is not foolproof!  It will be confused if we begin
+     decoding at the last page after a seek or hole.  In that case,
+     we don't have a starting point to judge where the last frame
+     is.  For this reason, vorbisfile will always try to make sure
+     it reads the last two marked pages in proper sequence */
+
+  if(b->sample_count==-1){
+    b->sample_count=0;
+  }else{
+    b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
+  }
+
+  if(v->granulepos==-1){
+    if(vb->granulepos!=-1){ /* only set if we have a position to set to */
+
+      v->granulepos=vb->granulepos;
+
+      /* is this a short page? */
+      if(b->sample_count>v->granulepos){
+	/* corner case; if this is both the first and last audio page,
+	   then spec says the end is cut, not beginning */
+	if(vb->eofflag){
+	  /* trim the end */
+	  /* no preceeding granulepos; assume we started at zero (we'd
+	     have to in a short single-page stream) */
+	  /* granulepos could be -1 due to a seek, but that would result
+	     in a long coun`t, not short count */
+
+	  v->pcm_current-=(b->sample_count-v->granulepos);
+	}else{
+	  /* trim the beginning */
+	  v->pcm_returned+=(b->sample_count-v->granulepos);
+	  if(v->pcm_returned>v->pcm_current)
+	    v->pcm_returned=v->pcm_current;
+	}
+
+      }
+
+    }
+  }else{
+    v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
+    if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
+      
+      if(v->granulepos>vb->granulepos){
+	long extra=v->granulepos-vb->granulepos;
+	
+	if(extra)
+	  if(vb->eofflag){
+	    /* partial last frame.  Strip the extra samples off */
+	    v->pcm_current-=extra;
+	  } /* else {Shouldn't happen *unless* the bitstream is out of
+	       spec.  Either way, believe the bitstream } */
+      } /* else {Shouldn't happen *unless* the bitstream is out of
+	   spec.  Either way, believe the bitstream } */
+      v->granulepos=vb->granulepos;
+    }
+  }
+
+  /* Update, cleanup */
+
+  if(vb->eofflag)v->eofflag=1;
+  return(0);
+}
+
+/* pcm==NULL indicates we just want the pending samples, no more */
+int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm){
+  vorbis_info *vi=v->vi;
+  if(v->pcm_returned>-1 && v->pcm_returned<v->pcm_current){
+    if(pcm){
+      int i;
+      for(i=0;i<vi->channels;i++)
+	v->pcmret[i]=v->pcm[i]+v->pcm_returned;
+      *pcm=v->pcmret;
+    }
+    return(v->pcm_current-v->pcm_returned);
+  }
+  return(0);
+}
+
+int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){
+  if(bytes && v->pcm_returned+bytes>v->pcm_current)return(OV_EINVAL);
+  v->pcm_returned+=bytes;
+  return(0);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/block.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,26 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2008    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: shared block functions
+
+ ********************************************************************/
+
+#ifndef _V_BLOCK_
+#define _V_BLOCK_
+
+#include "ivorbiscodec.h"
+
+extern void _vorbis_block_ripcord(vorbis_block *vb);
+extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/codebook.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,371 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: basic codebook pack/unpack/code/decode operations
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "ogg.h"
+#include "ivorbiscodec.h"
+#include "codebook.h"
+#include "misc.h"
+
+/* unpacks a codebook from the packet buffer into the codebook struct,
+   readies the codebook auxiliary structures for decode *************/
+int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
+  long i,j;
+  memset(s,0,sizeof(*s));
+
+  /* make sure alignment is correct */
+  if(oggpack_read(opb,24)!=0x564342)goto _eofout;
+
+  /* first the basic parameters */
+  s->dim=oggpack_read(opb,16);
+  s->entries=oggpack_read(opb,24);
+  if(s->entries==-1)goto _eofout;
+
+  /* codeword ordering.... length ordered or unordered? */
+  switch((int)oggpack_read(opb,1)){
+  case 0:
+    /* unordered */
+    s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
+
+    /* allocated but unused entries? */
+    if(oggpack_read(opb,1)){
+      /* yes, unused entries */
+
+      for(i=0;i<s->entries;i++){
+	if(oggpack_read(opb,1)){
+	  long num=oggpack_read(opb,5);
+	  if(num==-1)goto _eofout;
+	  s->lengthlist[i]=num+1;
+	}else
+	  s->lengthlist[i]=0;
+      }
+    }else{
+      /* all entries used; no tagging */
+      for(i=0;i<s->entries;i++){
+	long num=oggpack_read(opb,5);
+	if(num==-1)goto _eofout;
+	s->lengthlist[i]=num+1;
+      }
+    }
+    
+    break;
+  case 1:
+    /* ordered */
+    {
+      long length=oggpack_read(opb,5)+1;
+      s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
+
+      for(i=0;i<s->entries;){
+	long num=oggpack_read(opb,_ilog(s->entries-i));
+	if(num==-1)goto _eofout;
+	for(j=0;j<num && i<s->entries;j++,i++)
+	  s->lengthlist[i]=length;
+	length++;
+      }
+    }
+    break;
+  default:
+    /* EOF */
+    return(-1);
+  }
+  
+  /* Do we have a mapping to unpack? */
+  switch((s->maptype=oggpack_read(opb,4))){
+  case 0:
+    /* no mapping */
+    break;
+  case 1: case 2:
+    /* implicitly populated value mapping */
+    /* explicitly populated value mapping */
+
+    s->q_min=oggpack_read(opb,32);
+    s->q_delta=oggpack_read(opb,32);
+    s->q_quant=oggpack_read(opb,4)+1;
+    s->q_sequencep=oggpack_read(opb,1);
+
+    {
+      int quantvals=0;
+      switch(s->maptype){
+      case 1:
+	quantvals=_book_maptype1_quantvals(s);
+	break;
+      case 2:
+	quantvals=s->entries*s->dim;
+	break;
+      }
+      
+      /* quantized values */
+      s->quantlist=(long *)_ogg_malloc(sizeof(*s->quantlist)*quantvals);
+      for(i=0;i<quantvals;i++)
+	s->quantlist[i]=oggpack_read(opb,s->q_quant);
+      
+      if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout;
+    }
+    break;
+  default:
+    goto _errout;
+  }
+
+  /* all set */
+  return(0);
+  
+ _errout:
+ _eofout:
+  vorbis_staticbook_clear(s);
+  return(-1); 
+}
+
+/* the 'eliminate the decode tree' optimization actually requires the
+   codewords to be MSb first, not LSb.  This is an annoying inelegancy
+   (and one of the first places where carefully thought out design
+   turned out to be wrong; Vorbis II and future Ogg codecs should go
+   to an MSb bitpacker), but not actually the huge hit it appears to
+   be.  The first-stage decode table catches most words so that
+   bitreverse is not in the main execution path. */
+
+static ogg_uint32_t bitreverse(ogg_uint32_t x){
+  x=    ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000);
+  x=    ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00);
+  x=    ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0);
+  x=    ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc);
+  return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa);
+}
+
+STIN long decode_packed_entry_number(codebook *book, 
+					      oggpack_buffer *b){
+  int  read=book->dec_maxlength;
+  long lo,hi;
+  long lok = oggpack_look(b,book->dec_firsttablen);
+ 
+  if (lok >= 0) {
+    long entry = book->dec_firsttable[lok];
+    if(entry&0x80000000UL){
+      lo=(entry>>15)&0x7fff;
+      hi=book->used_entries-(entry&0x7fff);
+    }else{
+      oggpack_adv(b, book->dec_codelengths[entry-1]);
+      return(entry-1);
+    }
+  }else{
+    lo=0;
+    hi=book->used_entries;
+  }
+
+  lok = oggpack_look(b, read);
+
+  while(lok<0 && read>1)
+    lok = oggpack_look(b, --read);
+
+  if(lok<0){
+    oggpack_adv(b,1); /* force eop */
+    return -1;
+  }
+
+  /* bisect search for the codeword in the ordered list */
+  {
+    ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok);
+
+    while(hi-lo>1){
+      long p=(hi-lo)>>1;
+      long test=book->codelist[lo+p]>testword;    
+      lo+=p&(test-1);
+      hi-=p&(-test);
+    }
+
+    if(book->dec_codelengths[lo]<=read){
+      oggpack_adv(b, book->dec_codelengths[lo]);
+      return(lo);
+    }
+  }
+  
+  oggpack_adv(b, read+1);
+  return(-1);
+}
+
+/* Decode side is specced and easier, because we don't need to find
+   matches using different criteria; we simply read and map.  There are
+   two things we need to do 'depending':
+   
+   We may need to support interleave.  We don't really, but it's
+   convenient to do it here rather than rebuild the vector later.
+
+   Cascades may be additive or multiplicitive; this is not inherent in
+   the codebook, but set in the code using the codebook.  Like
+   interleaving, it's easiest to do it here.  
+   addmul==0 -> declarative (set the value)
+   addmul==1 -> additive
+   addmul==2 -> multiplicitive */
+
+/* returns the [original, not compacted] entry number or -1 on eof *********/
+long vorbis_book_decode(codebook *book, oggpack_buffer *b){
+  if(book->used_entries>0){
+    long packed_entry=decode_packed_entry_number(book,b);
+    if(packed_entry>=0)
+      return(book->dec_index[packed_entry]);
+  }
+
+  /* if there's no dec_index, the codebook unpacking isn't collapsed */
+  return(-1);
+}
+
+/* returns 0 on OK or -1 on eof *************************************/
+long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a,
+			      oggpack_buffer *b,int n,int point){
+  if(book->used_entries>0){  
+    int step=n/book->dim;
+    long *entry = (long *)alloca(sizeof(*entry)*step);
+    ogg_int32_t **t = (ogg_int32_t **)alloca(sizeof(*t)*step);
+    int i,j,o;
+    int shift=point-book->binarypoint;
+    
+    if(shift>=0){
+      for (i = 0; i < step; i++) {
+	entry[i]=decode_packed_entry_number(book,b);
+	if(entry[i]==-1)return(-1);
+	t[i] = book->valuelist+entry[i]*book->dim;
+      }
+      for(i=0,o=0;i<book->dim;i++,o+=step)
+	for (j=0;j<step;j++)
+	  a[o+j]+=t[j][i]>>shift;
+    }else{
+      for (i = 0; i < step; i++) {
+	entry[i]=decode_packed_entry_number(book,b);
+	if(entry[i]==-1)return(-1);
+	t[i] = book->valuelist+entry[i]*book->dim;
+      }
+      for(i=0,o=0;i<book->dim;i++,o+=step)
+	for (j=0;j<step;j++)
+	  a[o+j]+=t[j][i]<<-shift;
+    }
+  }
+  return(0);
+}
+
+long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
+			     oggpack_buffer *b,int n,int point){
+  if(book->used_entries>0){
+    int i,j,entry;
+    ogg_int32_t *t;
+    int shift=point-book->binarypoint;
+    
+    if(shift>=0){
+      for(i=0;i<n;){
+	entry = decode_packed_entry_number(book,b);
+	if(entry==-1)return(-1);
+	t     = book->valuelist+entry*book->dim;
+	for (j=0;j<book->dim;)
+	  a[i++]+=t[j++]>>shift;
+      }
+    }else{
+      for(i=0;i<n;){
+	entry = decode_packed_entry_number(book,b);
+	if(entry==-1)return(-1);
+	t     = book->valuelist+entry*book->dim;
+	for (j=0;j<book->dim;)
+	  a[i++]+=t[j++]<<-shift;
+      }
+    }
+  }
+  return(0);
+}
+
+long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a,
+			     oggpack_buffer *b,int n,int point){
+  if(book->used_entries>0){
+    int i,j,entry;
+    ogg_int32_t *t;
+    int shift=point-book->binarypoint;
+    
+    if(shift>=0){
+      
+      for(i=0;i<n;){
+	entry = decode_packed_entry_number(book,b);
+	if(entry==-1)return(-1);
+	t     = book->valuelist+entry*book->dim;
+	for (j=0;j<book->dim;){
+	  a[i++]=t[j++]>>shift;
+	}
+      }
+    }else{
+      
+      for(i=0;i<n;){
+	entry = decode_packed_entry_number(book,b);
+	if(entry==-1)return(-1);
+	t     = book->valuelist+entry*book->dim;
+	for (j=0;j<book->dim;){
+	  a[i++]=t[j++]<<-shift;
+	}
+      }
+    }
+  }else{
+
+    int i,j;
+    for(i=0;i<n;){
+      for (j=0;j<book->dim;){
+	a[i++]=0;
+      }
+    }
+  }
+  return(0);
+}
+
+long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,\
+			      long offset,int ch,
+			      oggpack_buffer *b,int n,int point){
+  if(book->used_entries>0){
+    long i,j,entry;
+    int chptr=0;
+    int shift=point-book->binarypoint;
+    
+    if(shift>=0){
+      
+      for(i=offset;i<offset+n;){
+	entry = decode_packed_entry_number(book,b);
+	if(entry==-1)return(-1);
+	{
+	  const ogg_int32_t *t = book->valuelist+entry*book->dim;
+	  for (j=0;j<book->dim;j++){
+	    a[chptr++][i]+=t[j]>>shift;
+	    if(chptr==ch){
+	      chptr=0;
+	      i++;
+	    }
+	  }
+	}
+      }
+    }else{
+      
+      for(i=offset;i<offset+n;){
+	entry = decode_packed_entry_number(book,b);
+	if(entry==-1)return(-1);
+	{
+	  const ogg_int32_t *t = book->valuelist+entry*book->dim;
+	  for (j=0;j<book->dim;j++){
+	    a[chptr++][i]+=t[j]<<-shift;
+	    if(chptr==ch){
+	      chptr=0;
+	      i++;
+	    }
+	  }
+	}
+      }
+    }
+  }
+  return(0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/codebook.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,102 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: basic shared codebook operations
+
+ ********************************************************************/
+
+#ifndef _V_CODEBOOK_H_
+#define _V_CODEBOOK_H_
+
+#include "ogg.h"
+
+/* This structure encapsulates huffman and VQ style encoding books; it
+   doesn't do anything specific to either.
+
+   valuelist/quantlist are nonNULL (and q_* significant) only if
+   there's entry->value mapping to be done.
+
+   If encode-side mapping must be done (and thus the entry needs to be
+   hunted), the auxiliary encode pointer will point to a decision
+   tree.  This is true of both VQ and huffman, but is mostly useful
+   with VQ.
+
+*/
+
+typedef struct static_codebook{
+  long   dim;            /* codebook dimensions (elements per vector) */
+  long   entries;        /* codebook entries */
+  long  *lengthlist;     /* codeword lengths in bits */
+
+  /* mapping ***************************************************************/
+  int    maptype;        /* 0=none
+			    1=implicitly populated values from map column 
+			    2=listed arbitrary values */
+
+  /* The below does a linear, single monotonic sequence mapping. */
+  long     q_min;       /* packed 32 bit float; quant value 0 maps to minval */
+  long     q_delta;     /* packed 32 bit float; val 1 - val 0 == delta */
+  int      q_quant;     /* bits: 0 < quant <= 16 */
+  int      q_sequencep; /* bitflag */
+
+  long     *quantlist;  /* map == 1: (int)(entries^(1/dim)) element column map
+			   map == 2: list of dim*entries quantized entry vals
+			*/
+} static_codebook;
+
+typedef struct codebook{
+  long dim;           /* codebook dimensions (elements per vector) */
+  long entries;       /* codebook entries */
+  long used_entries;  /* populated codebook entries */
+
+  /* the below are ordered by bitreversed codeword and only used
+     entries are populated */
+  int           binarypoint;
+  ogg_int32_t  *valuelist;  /* list of dim*entries actual entry values */  
+  ogg_uint32_t *codelist;   /* list of bitstream codewords for each entry */
+
+  int          *dec_index;  
+  char         *dec_codelengths;
+  ogg_uint32_t *dec_firsttable;
+  int           dec_firsttablen;
+  int           dec_maxlength;
+
+  long     q_min;       /* packed 32 bit float; quant value 0 maps to minval */
+  long     q_delta;     /* packed 32 bit float; val 1 - val 0 == delta */
+
+} codebook;
+
+extern void vorbis_staticbook_clear(static_codebook *b);
+extern void vorbis_staticbook_destroy(static_codebook *b);
+extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
+
+extern void vorbis_book_clear(codebook *b);
+extern long _book_maptype1_quantvals(const static_codebook *b);
+
+extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
+
+extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
+extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a, 
+				     oggpack_buffer *b,int n,int point);
+extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a, 
+				    oggpack_buffer *b,int n,int point);
+extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a, 
+				    oggpack_buffer *b,int n,int point);
+extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
+				     long off,int ch, 
+				    oggpack_buffer *b,int n,int point);
+
+extern int _ilog(unsigned int v);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/codec_internal.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,92 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: libvorbis codec headers
+
+ ********************************************************************/
+
+#ifndef _V_CODECI_H_
+#define _V_CODECI_H_
+
+#include "codebook.h"
+
+typedef void vorbis_look_mapping;
+typedef void vorbis_look_floor;
+typedef void vorbis_look_residue;
+typedef void vorbis_look_transform;
+
+/* mode ************************************************************/
+typedef struct {
+  int blockflag;
+  int windowtype;
+  int transformtype;
+  int mapping;
+} vorbis_info_mode;
+
+typedef void vorbis_info_floor;
+typedef void vorbis_info_residue;
+typedef void vorbis_info_mapping;
+
+typedef struct private_state {
+  /* local lookup storage */
+  const void             *window[2];
+
+  /* backend lookups are tied to the mode, not the backend or naked mapping */
+  int                     modebits;
+  vorbis_look_mapping   **mode;
+
+  ogg_int64_t sample_count;
+
+} private_state;
+
+/* codec_setup_info contains all the setup information specific to the
+   specific compression/decompression mode in progress (eg,
+   psychoacoustic settings, channel setup, options, codebook
+   etc).  
+*********************************************************************/
+
+typedef struct codec_setup_info {
+
+  /* Vorbis supports only short and long blocks, but allows the
+     encoder to choose the sizes */
+
+  long blocksizes[2];
+
+  /* modes are the primary means of supporting on-the-fly different
+     blocksizes, different channel mappings (LR or M/A),
+     different residue backends, etc.  Each mode consists of a
+     blocksize flag and a mapping (along with the mapping setup */
+
+  int        modes;
+  int        maps;
+  int        times;
+  int        floors;
+  int        residues;
+  int        books;
+
+  vorbis_info_mode       *mode_param[64];
+  int                     map_type[64];
+  vorbis_info_mapping    *map_param[64];
+  int                     time_type[64];
+  int                     floor_type[64];
+  vorbis_info_floor      *floor_param[64];
+  int                     residue_type[64];
+  vorbis_info_residue    *residue_param[64];
+  static_codebook        *book_param[256];
+  codebook               *fullbooks;
+
+  int    passlimit[32];     /* iteration limit per couple/quant pass */
+  int    coupling_passes;
+} codec_setup_info;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/config_types.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,25 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: #ifdef jail to whip a few platforms into the UNIX ideal.
+
+ ********************************************************************/
+#ifndef _OS_CVTYPES_H
+#define _OS_CVTYPES_H
+
+typedef long long ogg_int64_t;
+typedef int ogg_int32_t;
+typedef unsigned int ogg_uint32_t;
+typedef short ogg_int16_t;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/configure.in	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,131 @@
+dnl Process this file with autoconf to produce a configure script
+
+dnl ------------------------------------------------
+dnl Initialization and Versioning
+dnl ------------------------------------------------
+
+AC_INIT(mdct.c)
+
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+AM_CONFIG_HEADER([config.h])
+
+AM_INIT_AUTOMAKE(libvorbisidec,1.2.0)
+
+dnl Library versioning
+
+V_LIB_CURRENT=1
+V_LIB_REVISION=2
+V_LIB_AGE=0
+AC_SUBST(V_LIB_CURRENT)
+AC_SUBST(V_LIB_REVISION)
+AC_SUBST(V_LIB_AGE)
+
+dnl --------------------------------------------------  
+dnl Check for programs
+dnl --------------------------------------------------  
+
+dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
+dnl if $CFLAGS is blank
+cflags_save="$CFLAGS"
+AC_PROG_CC
+AC_PROG_CPP
+CFLAGS="$cflags_save"
+
+AM_PROG_LIBTOOL
+
+dnl --------------------------------------------------
+dnl Set build flags based on environment
+dnl --------------------------------------------------
+
+dnl Set some target options
+
+cflags_save="$CFLAGS"
+ldflags_save="$LDFLAGS"
+if test -z "$GCC"; then
+        case $host in 
+        arm-*-*)
+                DEBUG="-g -D_ARM_ASSEM_" 
+                CFLAGS="-O -D_ARM_ASSEM_"
+                PROFILE="-p -g -O -D_ARM_ASSEM_" ;;
+        *)
+                DEBUG="-g"
+                CFLAGS="-O"
+                PROFILE="-g -p" ;;
+        esac
+else
+
+        case $host in 
+        arm-*-*)
+                DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -D_ARM_ASSEM_"
+                CFLAGS="-O2 -D_ARM_ASSEM_ -fsigned-char"
+                PROFILE="-W -pg -g -O2 -D_ARM_ASSEM_ -fsigned-char -fno-inline-functions";;
+
+        *)
+                DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
+                CFLAGS="-O2 -Wall -fsigned-char"
+                PROFILE="-Wall -pg -g -O2 -fsigned-char -fno-inline-functions";;
+        esac
+fi
+CFLAGS="$CFLAGS $cflags_save -D_REENTRANT"
+LDFLAGS="$LDFLAGS $ldflags_save"
+
+
+# Test whenever ld supports -version-script
+AC_PROG_LD
+AC_PROG_LD_GNU
+if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
+   SHLIB_VERSION_ARG="Wl,--version-script=Version_script"
+
+   dnl Set extra linker options
+   case "$target_os" in
+  linux* | solaris* )
+    SHLIB_VERSION_ARG="-Wl,--version-script=Version_script"
+    ;;
+  *)
+    ;;
+   esac
+   LDFLAGS="$LDFLAGS $SHLIB_VERSION_ARG"
+fi
+
+dnl --------------------------------------------------
+dnl Options 
+dnl --------------------------------------------------
+
+AC_ARG_ENABLE(
+   low-accuracy,
+   [  --enable-low-accuracy   enable 32 bit only multiply operations],
+   CFLAGS="$CFLAGS -D_LOW_ACCURACY_"
+)
+
+dnl --------------------------------------------------
+dnl Check for headers
+dnl --------------------------------------------------
+
+AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
+
+dnl --------------------------------------------------
+dnl Check for typedefs, structures, etc
+dnl --------------------------------------------------
+
+dnl none
+
+dnl --------------------------------------------------
+dnl Check for library functions
+dnl --------------------------------------------------
+
+AC_FUNC_ALLOCA
+AC_FUNC_MEMCMP
+
+dnl --------------------------------------------------
+dnl Do substitutions
+dnl --------------------------------------------------
+
+LIBS="$LIBS"
+
+AC_SUBST(LIBS)
+AC_SUBST(DEBUG)
+AC_SUBST(PROFILE)
+
+AC_OUTPUT(Makefile Version_script)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/floor0.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,435 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: floor backend 0 implementation
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "ogg.h"
+#include "ivorbiscodec.h"
+#include "codec_internal.h"
+#include "registry.h"
+#include "codebook.h"
+#include "misc.h"
+#include "block.h"
+
+#define LSP_FRACBITS 14
+
+typedef struct {
+  long n;
+  int ln;
+  int  m;
+  int *linearmap;
+
+  vorbis_info_floor0 *vi;
+  ogg_int32_t *lsp_look;
+
+} vorbis_look_floor0;
+
+/*************** LSP decode ********************/
+
+#include "lsp_lookup.h"
+
+/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in
+   16.16 format 
+   returns in m.8 format */
+
+static long ADJUST_SQRT2[2]={8192,5792};
+STIN ogg_int32_t vorbis_invsqlook_i(long a,long e){
+  long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1); 
+  long d=a&INVSQ_LOOKUP_I_MASK;                              /*  0.10 */
+  long val=INVSQ_LOOKUP_I[i]-                                /*  1.16 */
+    ((INVSQ_LOOKUP_IDel[i]*d)>>INVSQ_LOOKUP_I_SHIFT);        /* result 1.16 */
+  val*=ADJUST_SQRT2[e&1];
+  e=(e>>1)+21;
+  return(val>>e);
+}
+
+/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
+/* a is in n.12 format */
+STIN ogg_int32_t vorbis_fromdBlook_i(long a){
+  int i=(-a)>>(12-FROMdB2_SHIFT);
+  if(i<0) return 0x7fffffff;
+  if(i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))return 0;
+  
+  return FROMdB_LOOKUP[i>>FROMdB_SHIFT] * FROMdB2_LOOKUP[i&FROMdB2_MASK];
+}
+
+/* interpolated lookup based cos function, domain 0 to PI only */
+/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */
+STIN ogg_int32_t vorbis_coslook_i(long a){
+  int i=a>>COS_LOOKUP_I_SHIFT;
+  int d=a&COS_LOOKUP_I_MASK;
+  return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
+			   COS_LOOKUP_I_SHIFT);
+}
+
+/* interpolated lookup based cos function */
+/* a is in 0.16 format, where 0==0, 2^^16==PI, return .LSP_FRACBITS */
+STIN ogg_int32_t vorbis_coslook2_i(long a){
+  a=a&0x1ffff;
+
+  if(a>0x10000)a=0x20000-a;
+  {               
+    int i=a>>COS_LOOKUP_I_SHIFT;
+    int d=a&COS_LOOKUP_I_MASK;
+    a=((COS_LOOKUP_I[i]<<COS_LOOKUP_I_SHIFT)-
+       d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
+      (COS_LOOKUP_I_SHIFT-LSP_FRACBITS+14);
+  }
+  
+  return(a);
+}
+
+static const int barklook[28]={
+  0,100,200,301,          405,516,635,766,
+  912,1077,1263,1476,     1720,2003,2333,2721,
+  3184,3742,4428,5285,    6376,7791,9662,12181,
+  15624,20397,27087,36554
+};
+
+/* used in init only; interpolate the long way */
+STIN ogg_int32_t toBARK(int n){
+  int i;
+  for(i=0;i<27;i++) 
+    if(n>=barklook[i] && n<barklook[i+1])break;
+  
+  if(i==27){
+    return 27<<15;
+  }else{
+    int gap=barklook[i+1]-barklook[i];
+    int del=n-barklook[i];
+
+    return((i<<15)+((del<<15)/gap));
+  }
+}
+
+static const unsigned char MLOOP_1[64]={
+   0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
+  14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
+  15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+  15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+};
+
+static const unsigned char MLOOP_2[64]={
+  0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
+  8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
+  9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
+  9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
+};
+
+static const unsigned char MLOOP_3[8]={0,1,2,2,3,3,3,3};
+
+void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
+			 ogg_int32_t *lsp,int m,
+			 ogg_int32_t amp,
+			 ogg_int32_t ampoffset,
+			 ogg_int32_t *icos){
+
+  /* 0 <= m < 256 */
+
+  /* set up for using all int later */
+  int i;
+  int ampoffseti=ampoffset*4096;
+  int ampi=amp;
+  ogg_int32_t *ilsp=(ogg_int32_t *)alloca(m*sizeof(*ilsp));
+  /* lsp is in 8.24, range 0 to PI; coslook wants it in .16 0 to 1*/
+  for(i=0;i<m;i++){
+#ifndef _LOW_ACCURACY_
+    ogg_int32_t val=MULT32(lsp[i],0x517cc2);
+#else
+    ogg_int32_t val=((lsp[i]>>10)*0x517d)>>14;
+#endif
+
+    /* safeguard against a malicious stream */
+    if(val<0 || (val>>COS_LOOKUP_I_SHIFT)>=COS_LOOKUP_I_SZ){
+      memset(curve,0,sizeof(*curve)*n);
+      return;
+    }
+
+    ilsp[i]=vorbis_coslook_i(val);
+  }
+
+  i=0;
+  while(i<n){
+    int j,k=map[i];
+    ogg_uint32_t pi=46341; /* 2**-.5 in 0.16 */
+    ogg_uint32_t qi=46341;
+    ogg_int32_t qexp=0,shift;
+    ogg_int32_t wi=icos[k];
+
+#ifdef _V_LSP_MATH_ASM
+    lsp_loop_asm(&qi,&pi,&qexp,ilsp,wi,m);
+
+    pi=((pi*pi)>>16);
+    qi=((qi*qi)>>16);
+    
+    if(m&1){
+      qexp= qexp*2-28*((m+1)>>1)+m;	     
+      pi*=(1<<14)-((wi*wi)>>14);
+      qi+=pi>>14;     
+    }else{
+      qexp= qexp*2-13*m;
+      
+      pi*=(1<<14)-wi;
+      qi*=(1<<14)+wi;
+      
+      qi=(qi+pi)>>14;
+    }
+    
+    if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
+      qi>>=1; qexp++; 
+    }else
+      lsp_norm_asm(&qi,&qexp);
+
+#else
+
+    qi*=labs(ilsp[0]-wi);
+    pi*=labs(ilsp[1]-wi);
+
+    for(j=3;j<m;j+=2){
+      if(!(shift=MLOOP_1[(pi|qi)>>25]))
+	if(!(shift=MLOOP_2[(pi|qi)>>19]))
+	  shift=MLOOP_3[(pi|qi)>>16];
+      qi=(qi>>shift)*labs(ilsp[j-1]-wi);
+      pi=(pi>>shift)*labs(ilsp[j]-wi);
+      qexp+=shift;
+    }
+    if(!(shift=MLOOP_1[(pi|qi)>>25]))
+      if(!(shift=MLOOP_2[(pi|qi)>>19]))
+	shift=MLOOP_3[(pi|qi)>>16];
+
+    /* pi,qi normalized collectively, both tracked using qexp */
+
+    if(m&1){
+      /* odd order filter; slightly assymetric */
+      /* the last coefficient */
+      qi=(qi>>shift)*labs(ilsp[j-1]-wi);
+      pi=(pi>>shift)<<14;
+      qexp+=shift;
+
+      if(!(shift=MLOOP_1[(pi|qi)>>25]))
+	if(!(shift=MLOOP_2[(pi|qi)>>19]))
+	  shift=MLOOP_3[(pi|qi)>>16];
+      
+      pi>>=shift;
+      qi>>=shift;
+      qexp+=shift-14*((m+1)>>1);
+
+      pi=((pi*pi)>>16);
+      qi=((qi*qi)>>16);
+      qexp=qexp*2+m;
+
+      pi*=(1<<14)-((wi*wi)>>14);
+      qi+=pi>>14;
+
+    }else{
+      /* even order filter; still symmetric */
+
+      /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
+	 worth tracking step by step */
+      
+      pi>>=shift;
+      qi>>=shift;
+      qexp+=shift-7*m;
+
+      pi=((pi*pi)>>16);
+      qi=((qi*qi)>>16);
+      qexp=qexp*2+m;
+      
+      pi*=(1<<14)-wi;
+      qi*=(1<<14)+wi;
+      qi=(qi+pi)>>14;
+      
+    }
+    
+
+    /* we've let the normalization drift because it wasn't important;
+       however, for the lookup, things must be normalized again.  We
+       need at most one right shift or a number of left shifts */
+
+    if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
+      qi>>=1; qexp++; 
+    }else
+      while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
+	qi<<=1; qexp--; 
+      }
+
+#endif
+
+    amp=vorbis_fromdBlook_i(ampi*                     /*  n.4         */
+			    vorbis_invsqlook_i(qi,qexp)- 
+			                              /*  m.8, m+n<=8 */
+			    ampoffseti);              /*  8.12[0]     */
+    
+#ifdef _LOW_ACCURACY_
+    amp>>=9;
+#endif
+    curve[i]= MULT31_SHIFT15(curve[i],amp);
+    while(map[++i]==k) curve[i]= MULT31_SHIFT15(curve[i],amp);
+  }
+}
+
+/*************** vorbis decode glue ************/
+
+static void floor0_free_info(vorbis_info_floor *i){
+  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+  if(info){
+    memset(info,0,sizeof(*info));
+    _ogg_free(info);
+  }
+}
+
+static void floor0_free_look(vorbis_look_floor *i){
+  vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+  if(look){
+
+    if(look->linearmap)_ogg_free(look->linearmap);
+    if(look->lsp_look)_ogg_free(look->lsp_look);
+    memset(look,0,sizeof(*look));
+    _ogg_free(look);
+  }
+}
+
+static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  int j;
+
+  vorbis_info_floor0 *info=(vorbis_info_floor0 *)_ogg_malloc(sizeof(*info));
+  info->order=oggpack_read(opb,8);
+  info->rate=oggpack_read(opb,16);
+  info->barkmap=oggpack_read(opb,16);
+  info->ampbits=oggpack_read(opb,6);
+  info->ampdB=oggpack_read(opb,8);
+  info->numbooks=oggpack_read(opb,4)+1;
+  
+  if(info->order<1)goto err_out;
+  if(info->rate<1)goto err_out;
+  if(info->barkmap<1)goto err_out;
+  if(info->numbooks<1)goto err_out;
+    
+  for(j=0;j<info->numbooks;j++){
+    info->books[j]=oggpack_read(opb,8);
+    if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
+  }
+  return(info);
+
+ err_out:
+  floor0_free_info(info);
+  return(NULL);
+}
+
+/* initialize Bark scale and normalization lookups.  We could do this
+   with static tables, but Vorbis allows a number of possible
+   combinations, so it's best to do it computationally.
+
+   The below is authoritative in terms of defining scale mapping.
+   Note that the scale depends on the sampling rate as well as the
+   linear block and mapping sizes */
+
+static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
+                              vorbis_info_floor *i){
+  int j;
+  vorbis_info        *vi=vd->vi;
+  codec_setup_info   *ci=(codec_setup_info *)vi->codec_setup;
+  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+  vorbis_look_floor0 *look=(vorbis_look_floor0 *)_ogg_calloc(1,sizeof(*look));
+  look->m=info->order;
+  look->n=ci->blocksizes[mi->blockflag]/2;
+  look->ln=info->barkmap;
+  look->vi=info;
+
+  /* the mapping from a linear scale to a smaller bark scale is
+     straightforward.  We do *not* make sure that the linear mapping
+     does not skip bark-scale bins; the decoder simply skips them and
+     the encoder may do what it wishes in filling them.  They're
+     necessary in some mapping combinations to keep the scale spacing
+     accurate */
+  look->linearmap=(int *)_ogg_malloc((look->n+1)*sizeof(*look->linearmap));
+  for(j=0;j<look->n;j++){
+
+    int val=(look->ln*
+	     ((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11;
+
+    if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
+    look->linearmap[j]=val;
+  }
+  look->linearmap[j]=-1;
+
+  look->lsp_look=(ogg_int32_t *)_ogg_malloc(look->ln*sizeof(*look->lsp_look));
+  for(j=0;j<look->ln;j++)
+    look->lsp_look[j]=vorbis_coslook2_i(0x10000*j/look->ln);
+
+  return look;
+}
+
+static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
+  vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+  vorbis_info_floor0 *info=look->vi;
+  int j,k;
+  
+  int ampraw=oggpack_read(&vb->opb,info->ampbits);
+  if(ampraw>0){ /* also handles the -1 out of data case */
+    long maxval=(1<<info->ampbits)-1;
+    int amp=((ampraw*info->ampdB)<<4)/maxval;
+    int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
+    
+    if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
+      codec_setup_info  *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
+      codebook *b=ci->fullbooks+info->books[booknum];
+      ogg_int32_t last=0;
+      ogg_int32_t *lsp=(ogg_int32_t *)_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+1));
+            
+      for(j=0;j<look->m;j+=b->dim)
+	if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop;
+      for(j=0;j<look->m;){
+	for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
+	last=lsp[j-1];
+      }
+      
+      lsp[look->m]=amp;
+      return(lsp);
+    }
+  }
+ eop:
+  return(NULL);
+}
+
+static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
+			   void *memo,ogg_int32_t *out){
+  vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+  vorbis_info_floor0 *info=look->vi;
+  
+  if(memo){
+    ogg_int32_t *lsp=(ogg_int32_t *)memo;
+    ogg_int32_t amp=lsp[look->m];
+
+    /* take the coefficients back to a spectral envelope curve */
+    vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
+			lsp,look->m,amp,info->ampdB,look->lsp_look);
+    return(1);
+  }
+  memset(out,0,sizeof(*out)*look->n);
+  return(0);
+}
+
+/* export hooks */
+vorbis_func_floor floor0_exportbundle={
+  &floor0_unpack,&floor0_look,&floor0_free_info,
+  &floor0_free_look,&floor0_inverse1,&floor0_inverse2
+};
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/floor1.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,441 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: floor backend 1 implementation
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "ogg.h"
+#include "ivorbiscodec.h"
+#include "codec_internal.h"
+#include "registry.h"
+#include "codebook.h"
+#include "misc.h"
+#include "block.h"
+
+#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
+
+typedef struct {
+  int forward_index[VIF_POSIT+2];
+  
+  int hineighbor[VIF_POSIT];
+  int loneighbor[VIF_POSIT];
+  int posts;
+
+  int n;
+  int quant_q;
+  vorbis_info_floor1 *vi;
+
+} vorbis_look_floor1;
+
+/***********************************************/
+ 
+static void floor1_free_info(vorbis_info_floor *i){
+  vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
+  if(info){
+    memset(info,0,sizeof(*info));
+    _ogg_free(info);
+  }
+}
+
+static void floor1_free_look(vorbis_look_floor *i){
+  vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
+  if(look){
+    memset(look,0,sizeof(*look));
+    _ogg_free(look);
+  }
+}
+
+static int ilog(unsigned int v){
+  int ret=0;
+  while(v){
+    ret++;
+    v>>=1;
+  }
+  return(ret);
+}
+
+static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  int j,k,count=0,maxclass=-1,rangebits;
+
+  vorbis_info_floor1 *info=(vorbis_info_floor1 *)_ogg_calloc(1,sizeof(*info));
+  /* read partitions */
+  info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
+  for(j=0;j<info->partitions;j++){
+    info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */
+    if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
+  }
+
+  /* read partition classes */
+  for(j=0;j<maxclass+1;j++){
+    info->class_dim[j]=oggpack_read(opb,3)+1; /* 1 to 8 */
+    info->class_subs[j]=oggpack_read(opb,2); /* 0,1,2,3 bits */
+    if(info->class_subs[j]<0)
+      goto err_out;
+    if(info->class_subs[j])info->class_book[j]=oggpack_read(opb,8);
+    if(info->class_book[j]<0 || info->class_book[j]>=ci->books)
+      goto err_out;
+    for(k=0;k<(1<<info->class_subs[j]);k++){
+      info->class_subbook[j][k]=oggpack_read(opb,8)-1;
+      if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books)
+	goto err_out;
+    }
+  }
+
+  /* read the post list */
+  info->mult=oggpack_read(opb,2)+1;     /* only 1,2,3,4 legal now */ 
+  rangebits=oggpack_read(opb,4);
+
+  for(j=0,k=0;j<info->partitions;j++){
+    count+=info->class_dim[info->partitionclass[j]]; 
+    for(;k<count;k++){
+      int t=info->postlist[k+2]=oggpack_read(opb,rangebits);
+      if(t<0 || t>=(1<<rangebits))
+	goto err_out;
+    }
+  }
+  info->postlist[0]=0;
+  info->postlist[1]=1<<rangebits;
+
+  return(info);
+  
+ err_out:
+  floor1_free_info(info);
+  return(NULL);
+}
+
+static int icomp(const void *a,const void *b){
+  return(**(int **)a-**(int **)b);
+}
+
+static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi,
+                              vorbis_info_floor *in){
+
+  int *sortpointer[VIF_POSIT+2];
+  vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
+  vorbis_look_floor1 *look=(vorbis_look_floor1 *)_ogg_calloc(1,sizeof(*look));
+  int i,j,n=0;
+
+  look->vi=info;
+  look->n=info->postlist[1];
+ 
+  /* we drop each position value in-between already decoded values,
+     and use linear interpolation to predict each new value past the
+     edges.  The positions are read in the order of the position
+     list... we precompute the bounding positions in the lookup.  Of
+     course, the neighbors can change (if a position is declined), but
+     this is an initial mapping */
+
+  for(i=0;i<info->partitions;i++)n+=info->class_dim[info->partitionclass[i]];
+  n+=2;
+  look->posts=n;
+
+  /* also store a sorted position index */
+  for(i=0;i<n;i++)sortpointer[i]=info->postlist+i;
+  qsort(sortpointer,n,sizeof(*sortpointer),icomp);
+
+  /* points from sort order back to range number */
+  for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist;
+  
+  /* quantize values to multiplier spec */
+  switch(info->mult){
+  case 1: /* 1024 -> 256 */
+    look->quant_q=256;
+    break;
+  case 2: /* 1024 -> 128 */
+    look->quant_q=128;
+    break;
+  case 3: /* 1024 -> 86 */
+    look->quant_q=86;
+    break;
+  case 4: /* 1024 -> 64 */
+    look->quant_q=64;
+    break;
+  }
+
+  /* discover our neighbors for decode where we don't use fit flags
+     (that would push the neighbors outward) */
+  for(i=0;i<n-2;i++){
+    int lo=0;
+    int hi=1;
+    int lx=0;
+    int hx=look->n;
+    int currentx=info->postlist[i+2];
+    for(j=0;j<i+2;j++){
+      int x=info->postlist[j];
+      if(x>lx && x<currentx){
+	lo=j;
+	lx=x;
+      }
+      if(x<hx && x>currentx){
+	hi=j;
+	hx=x;
+      }
+    }
+    look->loneighbor[i]=lo;
+    look->hineighbor[i]=hi;
+  }
+
+  return(look);
+}
+
+static int render_point(int x0,int x1,int y0,int y1,int x){
+  y0&=0x7fff; /* mask off flag */
+  y1&=0x7fff;
+    
+  {
+    int dy=y1-y0;
+    int adx=x1-x0;
+    int ady=abs(dy);
+    int err=ady*(x-x0);
+    
+    int off=err/adx;
+    if(dy<0)return(y0-off);
+    return(y0+off);
+  }
+}
+
+#ifdef _LOW_ACCURACY_
+#  define XdB(n) ((((n)>>8)+1)>>1)
+#else
+#  define XdB(n) (n)
+#endif
+
+static const ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
+  XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),
+  XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),
+  XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),
+  XdB(0x000001e7), XdB(0x00000206), XdB(0x00000228), XdB(0x0000024c),
+  XdB(0x00000272), XdB(0x0000029b), XdB(0x000002c6), XdB(0x000002f4),
+  XdB(0x00000326), XdB(0x0000035a), XdB(0x00000392), XdB(0x000003cd),
+  XdB(0x0000040c), XdB(0x00000450), XdB(0x00000497), XdB(0x000004e4),
+  XdB(0x00000535), XdB(0x0000058c), XdB(0x000005e8), XdB(0x0000064a),
+  XdB(0x000006b3), XdB(0x00000722), XdB(0x00000799), XdB(0x00000818),
+  XdB(0x0000089e), XdB(0x0000092e), XdB(0x000009c6), XdB(0x00000a69),
+  XdB(0x00000b16), XdB(0x00000bcf), XdB(0x00000c93), XdB(0x00000d64),
+  XdB(0x00000e43), XdB(0x00000f30), XdB(0x0000102d), XdB(0x0000113a),
+  XdB(0x00001258), XdB(0x0000138a), XdB(0x000014cf), XdB(0x00001629),
+  XdB(0x0000179a), XdB(0x00001922), XdB(0x00001ac4), XdB(0x00001c82),
+  XdB(0x00001e5c), XdB(0x00002055), XdB(0x0000226f), XdB(0x000024ac),
+  XdB(0x0000270e), XdB(0x00002997), XdB(0x00002c4b), XdB(0x00002f2c),
+  XdB(0x0000323d), XdB(0x00003581), XdB(0x000038fb), XdB(0x00003caf),
+  XdB(0x000040a0), XdB(0x000044d3), XdB(0x0000494c), XdB(0x00004e10),
+  XdB(0x00005323), XdB(0x0000588a), XdB(0x00005e4b), XdB(0x0000646b),
+  XdB(0x00006af2), XdB(0x000071e5), XdB(0x0000794c), XdB(0x0000812e),
+  XdB(0x00008993), XdB(0x00009283), XdB(0x00009c09), XdB(0x0000a62d),
+  XdB(0x0000b0f9), XdB(0x0000bc79), XdB(0x0000c8b9), XdB(0x0000d5c4),
+  XdB(0x0000e3a9), XdB(0x0000f274), XdB(0x00010235), XdB(0x000112fd),
+  XdB(0x000124dc), XdB(0x000137e4), XdB(0x00014c29), XdB(0x000161bf),
+  XdB(0x000178bc), XdB(0x00019137), XdB(0x0001ab4a), XdB(0x0001c70e),
+  XdB(0x0001e4a1), XdB(0x0002041f), XdB(0x000225aa), XdB(0x00024962),
+  XdB(0x00026f6d), XdB(0x000297f0), XdB(0x0002c316), XdB(0x0002f109),
+  XdB(0x000321f9), XdB(0x00035616), XdB(0x00038d97), XdB(0x0003c8b4),
+  XdB(0x000407a7), XdB(0x00044ab2), XdB(0x00049218), XdB(0x0004de23),
+  XdB(0x00052f1e), XdB(0x0005855c), XdB(0x0005e135), XdB(0x00064306),
+  XdB(0x0006ab33), XdB(0x00071a24), XdB(0x0007904b), XdB(0x00080e20),
+  XdB(0x00089422), XdB(0x000922da), XdB(0x0009bad8), XdB(0x000a5cb6),
+  XdB(0x000b091a), XdB(0x000bc0b1), XdB(0x000c8436), XdB(0x000d5471),
+  XdB(0x000e3233), XdB(0x000f1e5f), XdB(0x001019e4), XdB(0x001125c1),
+  XdB(0x00124306), XdB(0x001372d5), XdB(0x0014b663), XdB(0x00160ef7),
+  XdB(0x00177df0), XdB(0x001904c1), XdB(0x001aa4f9), XdB(0x001c603d),
+  XdB(0x001e384f), XdB(0x00202f0f), XdB(0x0022467a), XdB(0x002480b1),
+  XdB(0x0026dff7), XdB(0x002966b3), XdB(0x002c1776), XdB(0x002ef4fc),
+  XdB(0x0032022d), XdB(0x00354222), XdB(0x0038b828), XdB(0x003c67c2),
+  XdB(0x004054ae), XdB(0x004482e8), XdB(0x0048f6af), XdB(0x004db488),
+  XdB(0x0052c142), XdB(0x005821ff), XdB(0x005ddc33), XdB(0x0063f5b0),
+  XdB(0x006a74a7), XdB(0x00715faf), XdB(0x0078bdce), XdB(0x0080967f),
+  XdB(0x0088f1ba), XdB(0x0091d7f9), XdB(0x009b5247), XdB(0x00a56a41),
+  XdB(0x00b02a27), XdB(0x00bb9ce2), XdB(0x00c7ce12), XdB(0x00d4ca17),
+  XdB(0x00e29e20), XdB(0x00f15835), XdB(0x0101074b), XdB(0x0111bb4e),
+  XdB(0x01238531), XdB(0x01367704), XdB(0x014aa402), XdB(0x016020a7),
+  XdB(0x017702c3), XdB(0x018f6190), XdB(0x01a955cb), XdB(0x01c4f9cf),
+  XdB(0x01e269a8), XdB(0x0201c33b), XdB(0x0223265a), XdB(0x0246b4ea),
+  XdB(0x026c9302), XdB(0x0294e716), XdB(0x02bfda13), XdB(0x02ed9793),
+  XdB(0x031e4e09), XdB(0x03522ee4), XdB(0x03896ed0), XdB(0x03c445e2),
+  XdB(0x0402efd6), XdB(0x0445ac4b), XdB(0x048cbefc), XdB(0x04d87013),
+  XdB(0x05290c67), XdB(0x057ee5ca), XdB(0x05da5364), XdB(0x063bb204),
+  XdB(0x06a36485), XdB(0x0711d42b), XdB(0x0787710e), XdB(0x0804b299),
+  XdB(0x088a17ef), XdB(0x0918287e), XdB(0x09af747c), XdB(0x0a50957e),
+  XdB(0x0afc2f19), XdB(0x0bb2ef7f), XdB(0x0c759034), XdB(0x0d44d6ca),
+  XdB(0x0e2195bc), XdB(0x0f0cad0d), XdB(0x10070b62), XdB(0x1111aeea),
+  XdB(0x122da66c), XdB(0x135c120f), XdB(0x149e24d9), XdB(0x15f525b1),
+  XdB(0x176270e3), XdB(0x18e7794b), XdB(0x1a85c9ae), XdB(0x1c3f06d1),
+  XdB(0x1e14f07d), XdB(0x200963d7), XdB(0x221e5ccd), XdB(0x2455f870),
+  XdB(0x26b2770b), XdB(0x29363e2b), XdB(0x2be3db5c), XdB(0x2ebe06b6),
+  XdB(0x31c7a55b), XdB(0x3503ccd4), XdB(0x3875c5aa), XdB(0x3c210f44),
+  XdB(0x4009632b), XdB(0x4432b8cf), XdB(0x48a149bc), XdB(0x4d59959e),
+  XdB(0x52606733), XdB(0x57bad899), XdB(0x5d6e593a), XdB(0x6380b298),
+  XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
+};
+  
+static void render_line(int n, int x0,int x1,int y0,int y1,ogg_int32_t *d){
+  int dy=y1-y0;
+  int adx=x1-x0;
+  int ady=abs(dy);
+  int base=dy/adx;
+  int sy=(dy<0?base-1:base+1);
+  int x=x0;
+  int y=y0;
+  int err=0;
+
+  if(n>x1)n=x1;
+  ady-=abs(base*adx);
+
+  if(x<n)
+    d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);
+
+  while(++x<n){
+    err=err+ady;
+    if(err>=adx){
+      err-=adx;
+      y+=sy;
+    }else{
+      y+=base;
+    }
+    d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);
+  }
+}
+
+static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
+  vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
+  vorbis_info_floor1 *info=look->vi;
+  codec_setup_info   *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
+  
+  int i,j,k;
+  codebook *books=ci->fullbooks;   
+  
+  /* unpack wrapped/predicted values from stream */
+  if(oggpack_read(&vb->opb,1)==1){
+    int *fit_value=(int *)_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value));
+    
+    fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
+    fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
+    
+    /* partition by partition */
+    /* partition by partition */
+    for(i=0,j=2;i<info->partitions;i++){
+      int classv=info->partitionclass[i];
+      int cdim=info->class_dim[classv];
+      int csubbits=info->class_subs[classv];
+      int csub=1<<csubbits;
+      int cval=0;
+
+      /* decode the partition's first stage cascade value */
+      if(csubbits){
+	cval=vorbis_book_decode(books+info->class_book[classv],&vb->opb);
+
+	if(cval==-1)goto eop;
+      }
+
+      for(k=0;k<cdim;k++){
+	int book=info->class_subbook[classv][cval&(csub-1)];
+	cval>>=csubbits;
+	if(book>=0){
+	  if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
+	    goto eop;
+	}else{
+	  fit_value[j+k]=0;
+	}
+      }
+      j+=cdim;
+    }
+
+    /* unwrap positive values and reconsitute via linear interpolation */
+    for(i=2;i<look->posts;i++){
+      int predicted=render_point(info->postlist[look->loneighbor[i-2]],
+				 info->postlist[look->hineighbor[i-2]],
+				 fit_value[look->loneighbor[i-2]],
+				 fit_value[look->hineighbor[i-2]],
+				 info->postlist[i]);
+      int hiroom=look->quant_q-predicted;
+      int loroom=predicted;
+      int room=(hiroom<loroom?hiroom:loroom)<<1;
+      int val=fit_value[i];
+
+      if(val){
+	if(val>=room){
+	  if(hiroom>loroom){
+	    val = val-loroom;
+	  }else{
+	  val = -1-(val-hiroom);
+	  }
+	}else{
+	  if(val&1){
+	    val= -((val+1)>>1);
+	  }else{
+	    val>>=1;
+	  }
+	}
+
+	fit_value[i]=val+predicted;
+	fit_value[look->loneighbor[i-2]]&=0x7fff;
+	fit_value[look->hineighbor[i-2]]&=0x7fff;
+
+      }else{
+	fit_value[i]=predicted|0x8000;
+      }
+	
+    }
+
+    return(fit_value);
+  }
+ eop:
+  return(NULL);
+}
+
+static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
+			  ogg_int32_t *out){
+  vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
+  vorbis_info_floor1 *info=look->vi;
+
+  codec_setup_info   *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
+  int                  n=ci->blocksizes[vb->W]/2;
+  int j;
+
+  if(memo){
+    /* render the lines */
+    int *fit_value=(int *)memo;
+    int hx=0;
+    int lx=0;
+    int ly=fit_value[0]*info->mult;
+    for(j=1;j<look->posts;j++){
+      int current=look->forward_index[j];
+      int hy=fit_value[current]&0x7fff;
+      if(hy==fit_value[current]){
+	
+	hy*=info->mult;
+	hx=info->postlist[current];
+	
+	render_line(n,lx,hx,ly,hy,out);
+	
+	lx=hx;
+	ly=hy;
+      }
+    }
+    for(j=hx;j<n;j++)out[j]*=ly; /* be certain */    
+    return(1);
+  }
+  memset(out,0,sizeof(*out)*n);
+  return(0);
+}
+
+/* export hooks */
+vorbis_func_floor floor1_exportbundle={
+  &floor1_unpack,&floor1_look,&floor1_free_info,
+  &floor1_free_look,&floor1_inverse1,&floor1_inverse2
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/framing.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,1126 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: decode Ogg streams back into raw packets
+
+ note: The CRC code is directly derived from public domain code by
+ Ross Williams (ross@guest.adelaide.edu.au).  See docs/framing.html
+ for details.
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include "ogg.h"
+#include "misc.h"
+
+
+/* A complete description of Ogg framing exists in docs/framing.html */
+
+/* basic, centralized Ogg memory management based on linked lists of
+   references to refcounted memory buffers.  References and buffers
+   are both recycled.  Buffers are passed around and consumed in
+   reference form. */
+
+static ogg_buffer_state *ogg_buffer_create(void){
+  ogg_buffer_state *bs=_ogg_calloc(1,sizeof(*bs));
+  return bs;
+}
+
+/* destruction is 'lazy'; there may be memory references outstanding,
+   and yanking the buffer state out from underneath would be
+   antisocial.  Dealloc what is currently unused and have
+   _release_one watch for the stragglers to come in.  When they do,
+   finish destruction. */
+
+/* call the helper while holding lock */
+static void _ogg_buffer_destroy(ogg_buffer_state *bs){
+  ogg_buffer *bt;
+  ogg_reference *rt;
+
+  if(bs->shutdown){
+
+    bt=bs->unused_buffers;
+    rt=bs->unused_references;
+
+    while(bt){
+      ogg_buffer *b=bt;
+      bt=b->ptr.next;
+      if(b->data)_ogg_free(b->data);
+      _ogg_free(b);
+    }
+    bs->unused_buffers=0;
+    while(rt){
+      ogg_reference *r=rt;
+      rt=r->next;
+      _ogg_free(r);
+    }
+    bs->unused_references=0;
+
+    if(!bs->outstanding)
+      _ogg_free(bs);
+
+  }
+}
+
+static void ogg_buffer_destroy(ogg_buffer_state *bs){
+  bs->shutdown=1;
+  _ogg_buffer_destroy(bs);
+}
+
+static ogg_buffer *_fetch_buffer(ogg_buffer_state *bs,long bytes){
+  ogg_buffer    *ob;
+  bs->outstanding++;
+
+  /* do we have an unused buffer sitting in the pool? */
+  if(bs->unused_buffers){
+    ob=bs->unused_buffers;
+    bs->unused_buffers=ob->ptr.next;
+
+    /* if the unused buffer is too small, grow it */
+    if(ob->size<bytes){
+      ob->data=_ogg_realloc(ob->data,bytes);
+      ob->size=bytes;
+    }
+  }else{
+    /* allocate a new buffer */
+    ob=_ogg_malloc(sizeof(*ob));
+    ob->data=_ogg_malloc(bytes<16?16:bytes);
+    ob->size=bytes;
+  }
+
+  ob->refcount=1;
+  ob->ptr.owner=bs;
+  return ob;
+}
+
+static ogg_reference *_fetch_ref(ogg_buffer_state *bs){
+  ogg_reference *or;
+  bs->outstanding++;
+
+  /* do we have an unused reference sitting in the pool? */
+  if(bs->unused_references){
+    or=bs->unused_references;
+    bs->unused_references=or->next;
+  }else{
+    /* allocate a new reference */
+    or=_ogg_malloc(sizeof(*or));
+  }
+
+  or->begin=0;
+  or->length=0;
+  or->next=0;
+  return or;
+}
+
+/* fetch a reference pointing to a fresh, initially continguous buffer
+   of at least [bytes] length */
+static ogg_reference *ogg_buffer_alloc(ogg_buffer_state *bs,long bytes){
+  ogg_buffer    *ob=_fetch_buffer(bs,bytes);
+  ogg_reference *or=_fetch_ref(bs);
+  or->buffer=ob;
+  return or;
+}
+
+/* enlarge the data buffer in the current link */
+static void ogg_buffer_realloc(ogg_reference *or,long bytes){
+  ogg_buffer    *ob=or->buffer;
+  
+  /* if the unused buffer is too small, grow it */
+  if(ob->size<bytes){
+    ob->data=_ogg_realloc(ob->data,bytes);
+    ob->size=bytes;
+  }
+}
+
+static void _ogg_buffer_mark_one(ogg_reference *or){
+  or->buffer->refcount++;
+}
+
+/* increase the refcount of the buffers to which the reference points */
+static void ogg_buffer_mark(ogg_reference *or){
+  while(or){
+    _ogg_buffer_mark_one(or);
+    or=or->next;
+  }
+}
+
+/* duplicate a reference (pointing to the same actual buffer memory)
+   and increment buffer refcount.  If the desired segment begins out
+   of range, NULL is returned; if the desired segment is simply zero
+   length, a zero length ref is returned.  Partial range overlap
+   returns the overlap of the ranges */
+static ogg_reference *ogg_buffer_sub(ogg_reference *or,long begin,long length){
+  ogg_reference *ret=0,*head=0;
+
+  /* walk past any preceeding fragments we don't want */
+  while(or && begin>=or->length){
+    begin-=or->length;
+    or=or->next;
+  }
+
+  /* duplicate the reference chain; increment refcounts */
+  while(or && length){
+    ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);
+    if(head)
+      head->next=temp;
+    else
+      ret=temp;
+    head=temp;
+    head->buffer=or->buffer;    
+    head->begin=or->begin+begin;
+    head->length=length;
+    if(head->length>or->length-begin)
+      head->length=or->length-begin;
+    
+    begin=0;
+    length-=head->length;
+    or=or->next;
+  }
+
+  ogg_buffer_mark(ret);
+  return ret;
+}
+
+ogg_reference *ogg_buffer_dup(ogg_reference *or){
+  ogg_reference *ret=0,*head=0;
+  /* duplicate the reference chain; increment refcounts */
+  while(or){
+    ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);
+    if(head)
+      head->next=temp;
+    else
+      ret=temp;
+    head=temp;
+    head->buffer=or->buffer;    
+    head->begin=or->begin;
+    head->length=or->length;
+    or=or->next;
+  }
+
+  ogg_buffer_mark(ret);
+  return ret;
+}
+
+/* split a reference into two references; 'return' is a reference to
+   the buffer preceeding pos and 'head'/'tail' are the buffer past the
+   split.  If pos is at or past the end of the passed in segment,
+   'head/tail' are NULL */
+static ogg_reference *ogg_buffer_split(ogg_reference **tail,
+                                ogg_reference **head,long pos){
+
+  /* walk past any preceeding fragments to one of:
+     a) the exact boundary that seps two fragments
+     b) the fragment that needs split somewhere in the middle */
+  ogg_reference *ret=*tail;
+  ogg_reference *or=*tail;
+
+  while(or && pos>or->length){
+    pos-=or->length;
+    or=or->next;
+  }
+
+  if(!or || pos==0){
+
+    return 0;
+    
+  }else{
+    
+    if(pos>=or->length){
+      /* exact split, or off the end? */
+      if(or->next){
+        
+        /* a split */
+        *tail=or->next;
+        or->next=0;
+        
+      }else{
+        
+        /* off or at the end */
+        *tail=*head=0;
+        
+      }
+    }else{
+      
+      /* split within a fragment */
+      long lengthA=pos;
+      long beginB=or->begin+pos;
+      long lengthB=or->length-pos;
+      
+      /* make a new reference to tail the second piece */
+      *tail=_fetch_ref(or->buffer->ptr.owner);
+      
+      (*tail)->buffer=or->buffer;
+      (*tail)->begin=beginB;
+      (*tail)->length=lengthB;
+      (*tail)->next=or->next;
+      _ogg_buffer_mark_one(*tail);
+      if(head && or==*head)*head=*tail;    
+      
+      /* update the first piece */
+      or->next=0;
+      or->length=lengthA;
+      
+    }
+  }
+  return ret;
+}
+
+static void ogg_buffer_release_one(ogg_reference *or){
+  ogg_buffer *ob=or->buffer;
+  ogg_buffer_state *bs=ob->ptr.owner;
+
+  ob->refcount--;
+  if(ob->refcount==0){
+    bs->outstanding--; /* for the returned buffer */
+    ob->ptr.next=bs->unused_buffers;
+    bs->unused_buffers=ob;
+  }
+  
+  bs->outstanding--; /* for the returned reference */
+  or->next=bs->unused_references;
+  bs->unused_references=or;
+
+  _ogg_buffer_destroy(bs); /* lazy cleanup (if needed) */
+
+}
+
+/* release the references, decrease the refcounts of buffers to which
+   they point, release any buffers with a refcount that drops to zero */
+static void ogg_buffer_release(ogg_reference *or){
+  while(or){
+    ogg_reference *next=or->next;
+    ogg_buffer_release_one(or);
+    or=next;
+  }
+}
+
+static ogg_reference *ogg_buffer_pretruncate(ogg_reference *or,long pos){
+  /* release preceeding fragments we don't want */
+  while(or && pos>=or->length){
+    ogg_reference *next=or->next;
+    pos-=or->length;
+    ogg_buffer_release_one(or);
+    or=next;
+  }
+  if (or) {
+    or->begin+=pos;
+    or->length-=pos;
+  }
+  return or;
+}
+
+static ogg_reference *ogg_buffer_walk(ogg_reference *or){
+  if(!or)return NULL;
+  while(or->next){
+    or=or->next;
+  }
+  return(or);
+}
+
+/* *head is appended to the front end (head) of *tail; both continue to
+   be valid pointers, with *tail at the tail and *head at the head */
+static ogg_reference *ogg_buffer_cat(ogg_reference *tail, ogg_reference *head){
+  if(!tail)return head;
+
+  while(tail->next){
+    tail=tail->next;
+  }
+  tail->next=head;
+  return ogg_buffer_walk(head);
+}
+
+static void _positionB(oggbyte_buffer *b,int pos){
+  if(pos<b->pos){
+    /* start at beginning, scan forward */
+    b->ref=b->baseref;
+    b->pos=0;
+    b->end=b->pos+b->ref->length;
+    b->ptr=b->ref->buffer->data+b->ref->begin;
+  }
+}
+
+static void _positionF(oggbyte_buffer *b,int pos){
+  /* scan forward for position */
+  while(pos>=b->end){
+    /* just seek forward */
+    b->pos+=b->ref->length;
+    b->ref=b->ref->next;
+    b->end=b->ref->length+b->pos;
+    b->ptr=b->ref->buffer->data+b->ref->begin;
+  }
+}
+
+static int oggbyte_init(oggbyte_buffer *b,ogg_reference *or){
+  memset(b,0,sizeof(*b));
+  if(or){
+    b->ref=b->baseref=or;
+    b->pos=0;
+    b->end=b->ref->length;
+    b->ptr=b->ref->buffer->data+b->ref->begin;  
+    return 0;
+  }else
+    return -1;
+}
+
+static void oggbyte_set4(oggbyte_buffer *b,ogg_uint32_t val,int pos){
+  int i;
+  _positionB(b,pos);
+  for(i=0;i<4;i++){
+    _positionF(b,pos);
+    b->ptr[pos-b->pos]=val;
+    val>>=8;
+    ++pos;
+  }
+}
+ 
+static unsigned char oggbyte_read1(oggbyte_buffer *b,int pos){
+  _positionB(b,pos);
+  _positionF(b,pos);
+  return b->ptr[pos-b->pos];
+}
+
+static ogg_uint32_t oggbyte_read4(oggbyte_buffer *b,int pos){
+  ogg_uint32_t ret;
+  _positionB(b,pos);
+  _positionF(b,pos);
+  ret=b->ptr[pos-b->pos];
+  _positionF(b,++pos);
+  ret|=b->ptr[pos-b->pos]<<8;
+  _positionF(b,++pos);
+  ret|=b->ptr[pos-b->pos]<<16;
+  _positionF(b,++pos);
+  ret|=b->ptr[pos-b->pos]<<24;
+  return ret;
+}
+
+static ogg_int64_t oggbyte_read8(oggbyte_buffer *b,int pos){
+  ogg_int64_t ret;
+  unsigned char t[7];
+  int i;
+  _positionB(b,pos);
+  for(i=0;i<7;i++){
+    _positionF(b,pos);
+    t[i]=b->ptr[pos++ -b->pos];
+  }
+
+  _positionF(b,pos);
+  ret=b->ptr[pos-b->pos];
+
+  for(i=6;i>=0;--i)
+    ret= ret<<8 | t[i];
+
+  return ret;
+}
+
+/* Now we get to the actual framing code */
+
+int ogg_page_version(ogg_page *og){
+  oggbyte_buffer ob;
+  oggbyte_init(&ob,og->header);
+  return oggbyte_read1(&ob,4);
+}
+
+int ogg_page_continued(ogg_page *og){
+  oggbyte_buffer ob;
+  oggbyte_init(&ob,og->header);
+  return oggbyte_read1(&ob,5)&0x01;
+}
+
+int ogg_page_bos(ogg_page *og){
+  oggbyte_buffer ob;
+  oggbyte_init(&ob,og->header);
+  return oggbyte_read1(&ob,5)&0x02;
+}
+
+int ogg_page_eos(ogg_page *og){
+  oggbyte_buffer ob;
+  oggbyte_init(&ob,og->header);
+  return oggbyte_read1(&ob,5)&0x04;
+}
+
+ogg_int64_t ogg_page_granulepos(ogg_page *og){
+  oggbyte_buffer ob;
+  oggbyte_init(&ob,og->header);
+  return oggbyte_read8(&ob,6);
+}
+
+ogg_uint32_t ogg_page_serialno(ogg_page *og){
+  oggbyte_buffer ob;
+  oggbyte_init(&ob,og->header);
+  return oggbyte_read4(&ob,14);
+}
+ 
+ogg_uint32_t ogg_page_pageno(ogg_page *og){
+  oggbyte_buffer ob;
+  oggbyte_init(&ob,og->header);
+  return oggbyte_read4(&ob,18);
+}
+
+/* returns the number of packets that are completed on this page (if
+   the leading packet is begun on a previous page, but ends on this
+   page, it's counted */
+
+/* NOTE:
+If a page consists of a packet begun on a previous page, and a new
+packet begun (but not completed) on this page, the return will be:
+  ogg_page_packets(page)   ==1, 
+  ogg_page_continued(page) !=0
+
+If a page happens to be a single packet that was begun on a
+previous page, and spans to the next page (in the case of a three or
+more page packet), the return will be: 
+  ogg_page_packets(page)   ==0, 
+  ogg_page_continued(page) !=0
+*/
+
+int ogg_page_packets(ogg_page *og){
+  int i;
+  int n;
+  int count=0;
+  oggbyte_buffer ob;
+  oggbyte_init(&ob,og->header);
+
+  n=oggbyte_read1(&ob,26);
+  for(i=0;i<n;i++)
+    if(oggbyte_read1(&ob,27+i)<255)count++;
+  return(count);
+}
+
+/* Static CRC calculation table.  See older code in CVS for dead
+   run-time initialization code. */
+
+static ogg_uint32_t crc_lookup[256]={
+  0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
+  0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
+  0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
+  0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd,
+  0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,
+  0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75,
+  0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,
+  0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd,
+  0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,
+  0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5,
+  0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,
+  0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d,
+  0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,
+  0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95,
+  0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,
+  0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d,
+  0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,
+  0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072,
+  0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,
+  0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca,
+  0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,
+  0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02,
+  0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,
+  0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba,
+  0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,
+  0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692,
+  0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,
+  0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a,
+  0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,
+  0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2,
+  0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,
+  0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a,
+  0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,
+  0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb,
+  0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,
+  0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53,
+  0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,
+  0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b,
+  0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,
+  0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623,
+  0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,
+  0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b,
+  0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,
+  0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3,
+  0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,
+  0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b,
+  0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,
+  0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3,
+  0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,
+  0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c,
+  0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,
+  0x68860bfd,0x6c47164a,0x61043093,0x65c52d24,
+  0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,
+  0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec,
+  0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,
+  0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654,
+  0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,
+  0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c,
+  0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,
+  0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4,
+  0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,
+  0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c,
+  0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,
+  0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};
+
+ogg_sync_state *ogg_sync_create(void){
+  ogg_sync_state *oy=_ogg_calloc(1,sizeof(*oy));
+  memset(oy,0,sizeof(*oy));
+  oy->bufferpool=ogg_buffer_create();
+  return oy;
+}
+
+int ogg_sync_destroy(ogg_sync_state *oy){
+  if(oy){
+    ogg_sync_reset(oy);
+    ogg_buffer_destroy(oy->bufferpool);
+    memset(oy,0,sizeof(*oy));
+    _ogg_free(oy);
+  }
+  return OGG_SUCCESS;
+}
+
+unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long bytes){
+
+  /* [allocate and] expose a buffer for data submission.
+
+     If there is no head fragment
+       allocate one and expose it
+     else
+       if the current head fragment has sufficient unused space
+         expose it
+       else
+         if the current head fragment is unused
+           resize and expose it
+         else
+           allocate new fragment and expose it
+  */
+
+  /* base case; fifo uninitialized */
+  if(!oy->fifo_head){
+    oy->fifo_head=oy->fifo_tail=ogg_buffer_alloc(oy->bufferpool,bytes);
+    return oy->fifo_head->buffer->data;
+  }
+  
+  /* space left in current fragment case */
+  if(oy->fifo_head->buffer->size-
+     oy->fifo_head->length-
+     oy->fifo_head->begin >= bytes)
+    return oy->fifo_head->buffer->data+
+      oy->fifo_head->length+oy->fifo_head->begin;
+
+  /* current fragment is unused, but too small */
+  if(!oy->fifo_head->length){
+    ogg_buffer_realloc(oy->fifo_head,bytes);
+    return oy->fifo_head->buffer->data+oy->fifo_head->begin;
+  }
+  
+  /* current fragment used/full; get new fragment */
+  {
+    ogg_reference *new=ogg_buffer_alloc(oy->bufferpool,bytes);
+    oy->fifo_head->next=new;
+    oy->fifo_head=new;
+  }
+  return oy->fifo_head->buffer->data;
+}
+
+int ogg_sync_wrote(ogg_sync_state *oy, long bytes){ 
+  if(!oy->fifo_head)return OGG_EINVAL;
+  if(oy->fifo_head->buffer->size-oy->fifo_head->length-oy->fifo_head->begin < 
+     bytes)return OGG_EINVAL;
+  oy->fifo_head->length+=bytes;
+  oy->fifo_fill+=bytes;
+  return OGG_SUCCESS;
+}
+
+static ogg_uint32_t _checksum(ogg_reference *or, int bytes){
+  ogg_uint32_t crc_reg=0;
+  int j,post;
+
+  while(or){
+    unsigned char *data=or->buffer->data+or->begin;
+    post=(bytes<or->length?bytes:or->length);
+    for(j=0;j<post;++j)
+      crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^data[j]];
+    bytes-=j;
+    or=or->next;
+  }
+
+  return crc_reg;
+}
+
+
+/* sync the stream.  This is meant to be useful for finding page
+   boundaries.
+
+   return values for this:
+  -n) skipped n bytes
+   0) page not ready; more data (no bytes skipped)
+   n) page synced at current location; page length n bytes
+   
+*/
+
+long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
+  oggbyte_buffer page;
+  long           bytes,ret=0;
+
+  ogg_page_release(og);
+
+  bytes=oy->fifo_fill;
+  oggbyte_init(&page,oy->fifo_tail);
+
+  if(oy->headerbytes==0){
+    if(bytes<27)goto sync_out; /* not enough for even a minimal header */
+    
+    /* verify capture pattern */
+    if(oggbyte_read1(&page,0)!=(int)'O' ||
+       oggbyte_read1(&page,1)!=(int)'g' ||
+       oggbyte_read1(&page,2)!=(int)'g' ||
+       oggbyte_read1(&page,3)!=(int)'S'    ) goto sync_fail;
+
+    oy->headerbytes=oggbyte_read1(&page,26)+27;
+  }
+  if(bytes<oy->headerbytes)goto sync_out; /* not enough for header +
+                                             seg table */
+  if(oy->bodybytes==0){
+    int i;
+    /* count up body length in the segment table */
+    for(i=0;i<oy->headerbytes-27;i++)
+      oy->bodybytes+=oggbyte_read1(&page,27+i);
+  }
+  
+  if(oy->bodybytes+oy->headerbytes>bytes)goto sync_out;
+
+  /* we have what appears to be a complete page; last test: verify
+     checksum */
+  {
+    ogg_uint32_t chksum=oggbyte_read4(&page,22);
+    oggbyte_set4(&page,0,22);
+
+    /* Compare checksums; memory continues to be common access */
+    if(chksum!=_checksum(oy->fifo_tail,oy->bodybytes+oy->headerbytes)){
+      
+      /* D'oh.  Mismatch! Corrupt page (or miscapture and not a page
+         at all). replace the computed checksum with the one actually
+         read in; remember all the memory is common access */
+      
+      oggbyte_set4(&page,chksum,22);
+      goto sync_fail;
+    }
+    oggbyte_set4(&page,chksum,22);
+  }
+
+  /* We have a page.  Set up page return. */
+  if(og){
+    /* set up page output */
+    og->header=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->headerbytes);
+    og->header_len=oy->headerbytes;
+    og->body=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->bodybytes);
+    og->body_len=oy->bodybytes;
+  }else{
+    /* simply advance */
+    oy->fifo_tail=
+      ogg_buffer_pretruncate(oy->fifo_tail,oy->headerbytes+oy->bodybytes);
+    if(!oy->fifo_tail)oy->fifo_head=0;
+  }
+  
+  ret=oy->headerbytes+oy->bodybytes;
+  oy->unsynced=0;
+  oy->headerbytes=0;
+  oy->bodybytes=0;
+  oy->fifo_fill-=ret;
+
+  return ret;
+  
+ sync_fail:
+
+  oy->headerbytes=0;
+  oy->bodybytes=0;
+  oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,1);
+  ret--;
+  
+  /* search forward through fragments for possible capture */
+  while(oy->fifo_tail){
+    /* invariant: fifo_cursor points to a position in fifo_tail */
+    unsigned char *now=oy->fifo_tail->buffer->data+oy->fifo_tail->begin;
+    unsigned char *next=memchr(now, 'O', oy->fifo_tail->length);
+      
+    if(next){
+      /* possible capture in this segment */
+      long bytes=next-now;
+      oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
+      ret-=bytes;
+      break;
+    }else{
+      /* no capture.  advance to next segment */
+      long bytes=oy->fifo_tail->length;
+      ret-=bytes;
+      oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
+    }
+  }
+  if(!oy->fifo_tail)oy->fifo_head=0;
+  oy->fifo_fill+=ret;
+
+ sync_out:
+  return ret;
+}
+
+/* sync the stream and get a page.  Keep trying until we find a page.
+   Supress 'sync errors' after reporting the first.
+
+   return values:
+   OGG_HOLE) recapture (hole in data)
+          0) need more data
+          1) page returned
+
+   Returns pointers into buffered data; invalidated by next call to
+   _stream, _clear, _init, or _buffer */
+
+int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
+
+  /* all we need to do is verify a page at the head of the stream
+     buffer.  If it doesn't verify, we look for the next potential
+     frame */
+
+  while(1){
+    long ret=ogg_sync_pageseek(oy,og);
+    if(ret>0){
+      /* have a page */
+      return 1;
+    }
+    if(ret==0){
+      /* need more data */
+      return 0;
+    }
+    
+    /* head did not start a synced page... skipped some bytes */
+    if(!oy->unsynced){
+      oy->unsynced=1;
+      return OGG_HOLE;
+    }
+
+    /* loop. keep looking */
+
+  }
+}
+
+/* clear things to an initial state.  Good to call, eg, before seeking */
+int ogg_sync_reset(ogg_sync_state *oy){
+
+  ogg_buffer_release(oy->fifo_tail);
+  oy->fifo_tail=0;
+  oy->fifo_head=0;
+  oy->fifo_fill=0;
+
+  oy->unsynced=0;
+  oy->headerbytes=0;
+  oy->bodybytes=0;
+  return OGG_SUCCESS;
+}
+
+ogg_stream_state *ogg_stream_create(int serialno){
+  ogg_stream_state *os=_ogg_calloc(1,sizeof(*os));
+  os->serialno=serialno;
+  os->pageno=-1;
+  return os;
+} 
+
+int ogg_stream_destroy(ogg_stream_state *os){
+  if(os){
+    ogg_buffer_release(os->header_tail);
+    ogg_buffer_release(os->body_tail);
+    memset(os,0,sizeof(*os));    
+    _ogg_free(os);
+  }
+  return OGG_SUCCESS;
+} 
+
+
+#define FINFLAG 0x80000000UL
+#define FINMASK 0x7fffffffUL
+
+static void _next_lace(oggbyte_buffer *ob,ogg_stream_state *os){
+  /* search ahead one lace */
+  os->body_fill_next=0;
+  while(os->laceptr<os->lacing_fill){
+    int val=oggbyte_read1(ob,27+os->laceptr++);
+    os->body_fill_next+=val;
+    if(val<255){
+      os->body_fill_next|=FINFLAG;
+      os->clearflag=1;
+      break;
+    }
+  }
+}
+
+static void _span_queued_page(ogg_stream_state *os){ 
+  while( !(os->body_fill&FINFLAG) ){
+    
+    if(!os->header_tail)break;
+
+    /* first flush out preceeding page header (if any).  Body is
+       flushed as it's consumed, so that's not done here. */
+
+    if(os->lacing_fill>=0)
+      os->header_tail=ogg_buffer_pretruncate(os->header_tail,
+                                             os->lacing_fill+27);
+    os->lacing_fill=0;
+    os->laceptr=0;
+    os->clearflag=0;
+
+    if(!os->header_tail){
+      os->header_head=0;
+      break;
+    }else{
+      
+      /* process/prepare next page, if any */
+
+      long pageno;
+      oggbyte_buffer ob;
+      ogg_page og;               /* only for parsing header values */
+      og.header=os->header_tail; /* only for parsing header values */
+      pageno=ogg_page_pageno(&og);
+
+      oggbyte_init(&ob,os->header_tail);
+      os->lacing_fill=oggbyte_read1(&ob,26);
+      
+      /* are we in sequence? */
+      if(pageno!=os->pageno){
+        if(os->pageno==-1) /* indicates seek or reset */
+          os->holeflag=1;  /* set for internal use */
+        else
+          os->holeflag=2;  /* set for external reporting */
+
+        os->body_tail=ogg_buffer_pretruncate(os->body_tail,
+                                             os->body_fill);
+        if(os->body_tail==0)os->body_head=0;
+        os->body_fill=0;
+
+      }
+    
+      if(ogg_page_continued(&og)){
+        if(os->body_fill==0){
+          /* continued packet, but no preceeding data to continue */
+          /* dump the first partial packet on the page */
+          _next_lace(&ob,os);   
+          os->body_tail=
+            ogg_buffer_pretruncate(os->body_tail,os->body_fill_next&FINMASK);
+          if(os->body_tail==0)os->body_head=0;
+          /* set span flag */
+          if(!os->spanflag && !os->holeflag)os->spanflag=2;
+        }
+      }else{
+        if(os->body_fill>0){
+          /* preceeding data to continue, but not a continued page */
+          /* dump body_fill */
+          os->body_tail=ogg_buffer_pretruncate(os->body_tail,
+                                               os->body_fill);
+          if(os->body_tail==0)os->body_head=0;
+          os->body_fill=0;
+
+          /* set espan flag */
+          if(!os->spanflag && !os->holeflag)os->spanflag=2;
+        }
+      }
+
+      if(os->laceptr<os->lacing_fill){
+        os->granulepos=ogg_page_granulepos(&og);
+
+        /* get current packet size & flag */
+        _next_lace(&ob,os);
+        os->body_fill+=os->body_fill_next; /* addition handles the flag fine;
+                                             unsigned on purpose */
+        /* ...and next packet size & flag */
+        _next_lace(&ob,os);
+
+      }
+      
+      os->pageno=pageno+1;
+      os->e_o_s=ogg_page_eos(&og);
+      os->b_o_s=ogg_page_bos(&og);
+    
+    }
+  }
+}
+
+/* add the incoming page to the stream state; we decompose the page
+   into packet segments here as well. */
+
+int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
+
+  int serialno=ogg_page_serialno(og);
+  int version=ogg_page_version(og);
+
+  /* check the serial number */
+  if(serialno!=os->serialno){
+    ogg_page_release(og);
+    return OGG_ESERIAL;
+  }
+  if(version>0){
+    ogg_page_release(og);
+    return OGG_EVERSION;
+  }
+
+  /* add to fifos */
+  if(!os->body_tail){
+    os->body_tail=og->body;
+    os->body_head=ogg_buffer_walk(og->body);
+  }else{
+    os->body_head=ogg_buffer_cat(os->body_head,og->body);
+  }
+  if(!os->header_tail){
+    os->header_tail=og->header;
+    os->header_head=ogg_buffer_walk(og->header);
+    os->lacing_fill=-27;
+  }else{
+    os->header_head=ogg_buffer_cat(os->header_head,og->header);
+  }
+
+  memset(og,0,sizeof(*og));
+  return OGG_SUCCESS;
+}
+
+int ogg_stream_reset(ogg_stream_state *os){
+
+  ogg_buffer_release(os->header_tail);
+  ogg_buffer_release(os->body_tail);
+  os->header_tail=os->header_head=0;
+  os->body_tail=os->body_head=0;
+
+  os->e_o_s=0;
+  os->b_o_s=0;
+  os->pageno=-1;
+  os->packetno=0;
+  os->granulepos=0;
+
+  os->body_fill=0;
+  os->lacing_fill=0;
+
+  os->holeflag=0;
+  os->spanflag=0;
+  os->clearflag=0;
+  os->laceptr=0;
+  os->body_fill_next=0;
+
+  return OGG_SUCCESS;
+}
+
+int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){
+  ogg_stream_reset(os);
+  os->serialno=serialno;
+  return OGG_SUCCESS;
+}
+
+static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){
+
+  ogg_packet_release(op);
+  _span_queued_page(os);
+
+  if(os->holeflag){
+    int temp=os->holeflag;
+    if(os->clearflag)
+      os->holeflag=0;
+    else
+      os->holeflag=1;
+    if(temp==2){
+      os->packetno++;
+      return OGG_HOLE;
+    }
+  }
+  if(os->spanflag){
+    int temp=os->spanflag;
+    if(os->clearflag)
+      os->spanflag=0;
+    else
+      os->spanflag=1;
+    if(temp==2){
+      os->packetno++;
+      return OGG_SPAN;
+    }
+  }
+
+  if(!(os->body_fill&FINFLAG)) return 0;
+  if(!op && !adv)return 1; /* just using peek as an inexpensive way
+                               to ask if there's a whole packet
+                               waiting */
+  if(op){
+    op->b_o_s=os->b_o_s;
+    if(os->e_o_s && os->body_fill_next==0)
+      op->e_o_s=os->e_o_s;
+    else
+      op->e_o_s=0;
+    if( (os->body_fill&FINFLAG) && !(os->body_fill_next&FINFLAG) )
+      op->granulepos=os->granulepos;
+    else
+      op->granulepos=-1;
+    op->packetno=os->packetno;
+  }
+
+  if(adv){
+    oggbyte_buffer ob;
+    oggbyte_init(&ob,os->header_tail);
+
+    /* split the body contents off */
+    if(op){
+      op->packet=ogg_buffer_split(&os->body_tail,&os->body_head,
+				  os->body_fill&FINMASK);
+      op->bytes=os->body_fill&FINMASK;
+    }else{
+      os->body_tail=ogg_buffer_pretruncate(os->body_tail,
+					   os->body_fill&FINMASK);
+      if(os->body_tail==0)os->body_head=0;
+    }
+
+    /* update lacing pointers */
+    os->body_fill=os->body_fill_next;
+    _next_lace(&ob,os);
+  }else{
+    if(op){
+      op->packet=ogg_buffer_sub(os->body_tail,0,os->body_fill&FINMASK);
+      op->bytes=os->body_fill&FINMASK;
+    }
+  }
+  
+  if(adv){
+    os->packetno++;
+    os->b_o_s=0;
+  }
+
+  return 1;
+}
+
+int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){
+  return _packetout(os,op,1);
+}
+
+int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){
+  return _packetout(os,op,0);
+}
+
+int ogg_packet_release(ogg_packet *op) {
+  if(op){
+    ogg_buffer_release(op->packet);
+    memset(op, 0, sizeof(*op));
+  }
+  return OGG_SUCCESS;
+}
+
+int ogg_page_release(ogg_page *og) {
+  if(og){
+    ogg_buffer_release(og->header);
+    ogg_buffer_release(og->body);
+    memset(og, 0, sizeof(*og));
+  }
+  return OGG_SUCCESS;
+}
+
+void ogg_page_dup(ogg_page *dup,ogg_page *orig){
+  dup->header_len=orig->header_len;
+  dup->body_len=orig->body_len;
+  dup->header=ogg_buffer_dup(orig->header);
+  dup->body=ogg_buffer_dup(orig->body);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/info.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,356 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: maintain the info structure, info <-> header packets
+
+ ********************************************************************/
+
+/* general handling of the header and the vorbis_info structure (and
+   substructures) */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "ogg.h"
+#include "ivorbiscodec.h"
+#include "codec_internal.h"
+#include "codebook.h"
+#include "registry.h"
+#include "window.h"
+#include "misc.h"
+
+/* helpers */
+static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){
+  while(bytes--){
+    *buf++=oggpack_read(o,8);
+  }
+}
+
+void vorbis_comment_init(vorbis_comment *vc){
+  memset(vc,0,sizeof(*vc));
+}
+
+/* This is more or less the same as strncasecmp - but that doesn't exist
+ * everywhere, and this is a fairly trivial function, so we include it */
+static int tagcompare(const char *s1, const char *s2, int n){
+  int c=0;
+  while(c < n){
+    if(toupper(s1[c]) != toupper(s2[c]))
+      return !0;
+    c++;
+  }
+  return 0;
+}
+
+char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
+  long i;
+  int found = 0;
+  int taglen = strlen(tag)+1; /* +1 for the = we append */
+  char *fulltag = (char *)alloca(taglen+ 1);
+
+  strcpy(fulltag, tag);
+  strcat(fulltag, "=");
+  
+  for(i=0;i<vc->comments;i++){
+    if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
+      if(count == found)
+	/* We return a pointer to the data, not a copy */
+      	return vc->user_comments[i] + taglen;
+      else
+	found++;
+    }
+  }
+  return NULL; /* didn't find anything */
+}
+
+int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
+  int i,count=0;
+  int taglen = strlen(tag)+1; /* +1 for the = we append */
+  char *fulltag = (char *)alloca(taglen+1);
+  strcpy(fulltag,tag);
+  strcat(fulltag, "=");
+
+  for(i=0;i<vc->comments;i++){
+    if(!tagcompare(vc->user_comments[i], fulltag, taglen))
+      count++;
+  }
+
+  return count;
+}
+
+void vorbis_comment_clear(vorbis_comment *vc){
+  if(vc){
+    long i;
+    for(i=0;i<vc->comments;i++)
+      if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
+    if(vc->user_comments)_ogg_free(vc->user_comments);
+	if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
+    if(vc->vendor)_ogg_free(vc->vendor);
+    memset(vc,0,sizeof(*vc));
+  }
+}
+
+/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long.
+   They may be equal, but short will never ge greater than long */
+int vorbis_info_blocksize(vorbis_info *vi,int zo){
+  codec_setup_info *ci = (codec_setup_info *)vi->codec_setup;
+  return ci ? ci->blocksizes[zo] : -1;
+}
+
+/* used by synthesis, which has a full, alloced vi */
+void vorbis_info_init(vorbis_info *vi){
+  memset(vi,0,sizeof(*vi));
+  vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info));
+}
+
+void vorbis_info_clear(vorbis_info *vi){
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  int i;
+
+  if(ci){
+
+    for(i=0;i<ci->modes;i++)
+      if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
+
+    for(i=0;i<ci->maps;i++) /* unpack does the range checking */
+      if(ci->map_param[i])
+	_mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
+
+    for(i=0;i<ci->floors;i++) /* unpack does the range checking */
+      if(ci->floor_param[i])
+	_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
+    
+    for(i=0;i<ci->residues;i++) /* unpack does the range checking */
+      if(ci->residue_param[i])
+	_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
+
+    for(i=0;i<ci->books;i++){
+      if(ci->book_param[i]){
+	/* knows if the book was not alloced */
+	vorbis_staticbook_destroy(ci->book_param[i]);
+      }
+      if(ci->fullbooks)
+	vorbis_book_clear(ci->fullbooks+i);
+    }
+    if(ci->fullbooks)
+	_ogg_free(ci->fullbooks);
+    
+    _ogg_free(ci);
+  }
+
+  memset(vi,0,sizeof(*vi));
+}
+
+/* Header packing/unpacking ********************************************/
+
+static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  if(!ci)return(OV_EFAULT);
+
+  vi->version=oggpack_read(opb,32);
+  if(vi->version!=0)return(OV_EVERSION);
+
+  vi->channels=oggpack_read(opb,8);
+  vi->rate=oggpack_read(opb,32);
+
+  vi->bitrate_upper=oggpack_read(opb,32);
+  vi->bitrate_nominal=oggpack_read(opb,32);
+  vi->bitrate_lower=oggpack_read(opb,32);
+
+  ci->blocksizes[0]=1<<oggpack_read(opb,4);
+  ci->blocksizes[1]=1<<oggpack_read(opb,4);
+  
+  if(vi->rate<1)goto err_out;
+  if(vi->channels<1)goto err_out;
+  if(ci->blocksizes[0]<64)goto err_out; 
+  if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
+  if(ci->blocksizes[1]>8192)goto err_out;
+  
+  if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
+
+  return(0);
+ err_out:
+  vorbis_info_clear(vi);
+  return(OV_EBADHEADER);
+}
+
+static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
+  int i;
+  int vendorlen=oggpack_read(opb,32);
+  if(vendorlen<0)goto err_out;
+  vc->vendor=(char *)_ogg_calloc(vendorlen+1,1);
+  _v_readstring(opb,vc->vendor,vendorlen);
+  vc->comments=oggpack_read(opb,32);
+  if(vc->comments<0)goto err_out;
+  vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
+  vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
+	    
+  for(i=0;i<vc->comments;i++){
+    int len=oggpack_read(opb,32);
+    if(len<0)goto err_out;
+	vc->comment_lengths[i]=len;
+    vc->user_comments[i]=(char *)_ogg_calloc(len+1,1);
+    _v_readstring(opb,vc->user_comments[i],len);
+  }	  
+  if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
+
+  return(0);
+ err_out:
+  vorbis_comment_clear(vc);
+  return(OV_EBADHEADER);
+}
+
+/* all of the real encoding details are here.  The modes, books,
+   everything */
+static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  int i;
+  if(!ci)return(OV_EFAULT);
+
+  /* codebooks */
+  ci->books=oggpack_read(opb,8)+1;
+  /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/
+  for(i=0;i<ci->books;i++){
+    ci->book_param[i]=(static_codebook *)_ogg_calloc(1,sizeof(*ci->book_param[i]));
+    if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
+  }
+
+  /* time backend settings */
+  ci->times=oggpack_read(opb,6)+1;
+  /*ci->time_type=_ogg_malloc(ci->times*sizeof(*ci->time_type));*/
+  /*ci->time_param=_ogg_calloc(ci->times,sizeof(void *));*/
+  for(i=0;i<ci->times;i++){
+    ci->time_type[i]=oggpack_read(opb,16);
+    if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out;
+    /* ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb);
+       Vorbis I has no time backend */
+    /*if(!ci->time_param[i])goto err_out;*/
+  }
+
+  /* floor backend settings */
+  ci->floors=oggpack_read(opb,6)+1;
+  /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/
+  /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
+  for(i=0;i<ci->floors;i++){
+    ci->floor_type[i]=oggpack_read(opb,16);
+    if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
+    ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
+    if(!ci->floor_param[i])goto err_out;
+  }
+
+  /* residue backend settings */
+  ci->residues=oggpack_read(opb,6)+1;
+  /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/
+  /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
+  for(i=0;i<ci->residues;i++){
+    ci->residue_type[i]=oggpack_read(opb,16);
+    if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
+    ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
+    if(!ci->residue_param[i])goto err_out;
+  }
+
+  /* map backend settings */
+  ci->maps=oggpack_read(opb,6)+1;
+  /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/
+  /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
+  for(i=0;i<ci->maps;i++){
+    ci->map_type[i]=oggpack_read(opb,16);
+    if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
+    ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
+    if(!ci->map_param[i])goto err_out;
+  }
+  
+  /* mode settings */
+  ci->modes=oggpack_read(opb,6)+1;
+  /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/
+  for(i=0;i<ci->modes;i++){
+    ci->mode_param[i]=(vorbis_info_mode *)_ogg_calloc(1,sizeof(*ci->mode_param[i]));
+    ci->mode_param[i]->blockflag=oggpack_read(opb,1);
+    ci->mode_param[i]->windowtype=oggpack_read(opb,16);
+    ci->mode_param[i]->transformtype=oggpack_read(opb,16);
+    ci->mode_param[i]->mapping=oggpack_read(opb,8);
+
+    if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
+    if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
+    if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
+  }
+  
+  if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
+
+  return(0);
+ err_out:
+  vorbis_info_clear(vi);
+  return(OV_EBADHEADER);
+}
+
+/* The Vorbis header is in three packets; the initial small packet in
+   the first page that identifies basic parameters, a second packet
+   with bitstream comments and a third packet that holds the
+   codebook. */
+
+int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
+  oggpack_buffer opb;
+  
+  if(op){
+    oggpack_readinit(&opb,op->packet);
+
+    /* Which of the three types of header is this? */
+    /* Also verify header-ness, vorbis */
+    {
+      char buffer[6];
+      int packtype=oggpack_read(&opb,8);
+      memset(buffer,0,6);
+      _v_readstring(&opb,buffer,6);
+      if(memcmp(buffer,"vorbis",6)){
+	/* not a vorbis header */
+	return(OV_ENOTVORBIS);
+      }
+      switch(packtype){
+      case 0x01: /* least significant *bit* is read first */
+	if(!op->b_o_s){
+	  /* Not the initial packet */
+	  return(OV_EBADHEADER);
+	}
+	if(vi->rate!=0){
+	  /* previously initialized info header */
+	  return(OV_EBADHEADER);
+	}
+
+	return(_vorbis_unpack_info(vi,&opb));
+
+      case 0x03: /* least significant *bit* is read first */
+	if(vi->rate==0){
+	  /* um... we didn't get the initial header */
+	  return(OV_EBADHEADER);
+	}
+
+	return(_vorbis_unpack_comment(vc,&opb));
+
+      case 0x05: /* least significant *bit* is read first */
+	if(vi->rate==0 || vc->vendor==NULL){
+	  /* um... we didn;t get the initial header or comments yet */
+	  return(OV_EBADHEADER);
+	}
+
+	return(_vorbis_unpack_books(vi,&opb));
+
+      default:
+	/* Not a valid vorbis header type */
+	return(OV_EBADHEADER);
+	break;
+      }
+    }
+  }
+  return(OV_EBADHEADER);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/ivorbiscodec.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,202 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: libvorbis codec headers
+
+ ********************************************************************/
+
+#ifndef _vorbis_codec_h_
+#define _vorbis_codec_h_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include "ogg.h"
+
+typedef struct vorbis_info{
+  int version;
+  int channels;
+  long rate;
+
+  /* The below bitrate declarations are *hints*.
+     Combinations of the three values carry the following implications:
+     
+     all three set to the same value: 
+       implies a fixed rate bitstream
+     only nominal set: 
+       implies a VBR stream that averages the nominal bitrate.  No hard 
+       upper/lower limit
+     upper and or lower set: 
+       implies a VBR bitstream that obeys the bitrate limits. nominal 
+       may also be set to give a nominal rate.
+     none set:
+       the coder does not care to speculate.
+  */
+
+  long bitrate_upper;
+  long bitrate_nominal;
+  long bitrate_lower;
+  long bitrate_window;
+
+  void *codec_setup;
+} vorbis_info;
+
+/* vorbis_dsp_state buffers the current vorbis audio
+   analysis/synthesis state.  The DSP state belongs to a specific
+   logical bitstream ****************************************************/
+typedef struct vorbis_dsp_state{
+  int analysisp;
+  vorbis_info *vi;
+
+  ogg_int32_t **pcm;
+  ogg_int32_t **pcmret;
+  int      pcm_storage;
+  int      pcm_current;
+  int      pcm_returned;
+
+  int  preextrapolate;
+  int  eofflag;
+
+  long lW;
+  long W;
+  long nW;
+  long centerW;
+
+  ogg_int64_t granulepos;
+  ogg_int64_t sequence;
+
+  void       *backend_state;
+} vorbis_dsp_state;
+
+typedef struct vorbis_block{
+  /* necessary stream state for linking to the framing abstraction */
+  ogg_int32_t  **pcm;       /* this is a pointer into local storage */ 
+  oggpack_buffer opb;
+  
+  long  lW;
+  long  W;
+  long  nW;
+  int   pcmend;
+  int   mode;
+
+  int         eofflag;
+  ogg_int64_t granulepos;
+  ogg_int64_t sequence;
+  vorbis_dsp_state *vd; /* For read-only access of configuration */
+
+  /* local storage to avoid remallocing; it's up to the mapping to
+     structure it */
+  void               *localstore;
+  long                localtop;
+  long                localalloc;
+  long                totaluse;
+  struct alloc_chain *reap;
+
+} vorbis_block;
+
+/* vorbis_block is a single block of data to be processed as part of
+the analysis/synthesis stream; it belongs to a specific logical
+bitstream, but is independant from other vorbis_blocks belonging to
+that logical bitstream. *************************************************/
+
+struct alloc_chain{
+  void *ptr;
+  struct alloc_chain *next;
+};
+
+/* vorbis_info contains all the setup information specific to the
+   specific compression/decompression mode in progress (eg,
+   psychoacoustic settings, channel setup, options, codebook
+   etc). vorbis_info and substructures are in backends.h.
+*********************************************************************/
+
+/* the comments are not part of vorbis_info so that vorbis_info can be
+   static storage */
+typedef struct vorbis_comment{
+  /* unlimited user comment fields.  libvorbis writes 'libvorbis'
+     whatever vendor is set to in encode */
+  char **user_comments;
+  int   *comment_lengths;
+  int    comments;
+  char  *vendor;
+
+} vorbis_comment;
+
+
+/* libvorbis encodes in two abstraction layers; first we perform DSP
+   and produce a packet (see docs/analysis.txt).  The packet is then
+   coded into a framed OggSquish bitstream by the second layer (see
+   docs/framing.txt).  Decode is the reverse process; we sync/frame
+   the bitstream and extract individual packets, then decode the
+   packet back into PCM audio.
+
+   The extra framing/packetizing is used in streaming formats, such as
+   files.  Over the net (such as with UDP), the framing and
+   packetization aren't necessary as they're provided by the transport
+   and the streaming layer is not used */
+
+/* Vorbis PRIMITIVES: general ***************************************/
+
+extern void     vorbis_info_init(vorbis_info *vi);
+extern void     vorbis_info_clear(vorbis_info *vi);
+extern int      vorbis_info_blocksize(vorbis_info *vi,int zo);
+extern void     vorbis_comment_init(vorbis_comment *vc);
+extern void     vorbis_comment_add(vorbis_comment *vc, char *comment); 
+extern void     vorbis_comment_add_tag(vorbis_comment *vc, 
+				       char *tag, char *contents);
+extern char    *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
+extern int      vorbis_comment_query_count(vorbis_comment *vc, char *tag);
+extern void     vorbis_comment_clear(vorbis_comment *vc);
+
+extern int      vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
+extern int      vorbis_block_clear(vorbis_block *vb);
+extern void     vorbis_dsp_clear(vorbis_dsp_state *v);
+
+/* Vorbis PRIMITIVES: synthesis layer *******************************/
+extern int      vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
+					  ogg_packet *op);
+
+extern int      vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
+extern int      vorbis_synthesis_restart(vorbis_dsp_state *v);
+extern int      vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep);
+extern int      vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
+extern int      vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm);
+extern int      vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
+extern long     vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
+
+/* Vorbis ERRORS and return codes ***********************************/
+
+#define OV_FALSE      -1  
+#define OV_EOF        -2
+#define OV_HOLE       -3
+
+#define OV_EREAD      -128
+#define OV_EFAULT     -129
+#define OV_EIMPL      -130
+#define OV_EINVAL     -131
+#define OV_ENOTVORBIS -132
+#define OV_EBADHEADER -133
+#define OV_EVERSION   -134
+#define OV_ENOTAUDIO  -135
+#define OV_EBADPACKET -136
+#define OV_EBADLINK   -137
+#define OV_ENOSEEK    -138
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/ivorbisfile.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,130 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: stdio-based convenience library for opening/seeking/decoding
+
+ ********************************************************************/
+
+#ifndef _OV_FILE_H_
+#define _OV_FILE_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include <stdio.h>
+#include "ivorbiscodec.h"
+
+#define CHUNKSIZE 1024
+/* The function prototypes for the callbacks are basically the same as for
+ * the stdio functions fread, fseek, fclose, ftell. 
+ * The one difference is that the FILE * arguments have been replaced with
+ * a void * - this is to be used as a pointer to whatever internal data these
+ * functions might need. In the stdio case, it's just a FILE * cast to a void *
+ * 
+ * If you use other functions, check the docs for these functions and return
+ * the right values. For seek_func(), you *MUST* return -1 if the stream is
+ * unseekable
+ */
+typedef struct {
+  size_t (*read_func)  (void *ptr, size_t size, size_t nmemb, void *datasource);
+  int    (*seek_func)  (void *datasource, ogg_int64_t offset, int whence);
+  int    (*close_func) (void *datasource);
+  long   (*tell_func)  (void *datasource);
+} ov_callbacks;
+
+#define  NOTOPEN   0
+#define  PARTOPEN  1
+#define  OPENED    2
+#define  STREAMSET 3
+#define  INITSET   4
+
+typedef struct OggVorbis_File {
+  void            *datasource; /* Pointer to a FILE *, etc. */
+  int              seekable;
+  ogg_int64_t      offset;
+  ogg_int64_t      end;
+  ogg_sync_state   *oy; 
+
+  /* If the FILE handle isn't seekable (eg, a pipe), only the current
+     stream appears */
+  int              links;
+  ogg_int64_t     *offsets;
+  ogg_int64_t     *dataoffsets;
+  ogg_uint32_t    *serialnos;
+  ogg_int64_t     *pcmlengths;
+  vorbis_info     *vi;
+  vorbis_comment  *vc;
+
+  /* Decoding working state local storage */
+  ogg_int64_t      pcm_offset;
+  int              ready_state;
+  ogg_uint32_t     current_serialno;
+  int              current_link;
+
+  ogg_int64_t      bittrack;
+  ogg_int64_t      samptrack;
+
+  ogg_stream_state *os; /* take physical pages, weld into a logical
+                          stream of packets */
+  vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
+  vorbis_block     vb; /* local working space for packet->PCM decode */
+
+  ov_callbacks callbacks;
+
+} OggVorbis_File;
+
+extern int ov_clear(OggVorbis_File *vf);
+extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
+extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
+		char *initial, long ibytes, ov_callbacks callbacks);
+
+extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
+extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
+		char *initial, long ibytes, ov_callbacks callbacks);
+extern int ov_test_open(OggVorbis_File *vf);
+
+extern long ov_bitrate(OggVorbis_File *vf,int i);
+extern long ov_bitrate_instant(OggVorbis_File *vf);
+extern long ov_streams(OggVorbis_File *vf);
+extern long ov_seekable(OggVorbis_File *vf);
+extern long ov_serialnumber(OggVorbis_File *vf,int i);
+
+extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
+extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
+extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
+
+extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
+
+extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
+extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
+extern ogg_int64_t ov_time_tell(OggVorbis_File *vf);
+
+extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
+extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
+
+extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
+		    int *bitstream);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/ivorbisfile_example.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,86 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: simple example decoder using vorbisidec
+
+ ********************************************************************/
+
+/* Takes a vorbis bitstream from stdin and writes raw stereo PCM to
+   stdout using vorbisfile. Using vorbisfile is much simpler than
+   dealing with libvorbis. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <vorbis/ivorbiscodec.h>
+#include <vorbis/ivorbisfile.h>
+
+#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+char pcmout[4096]; /* take 4k out of the data segment, not the stack */
+
+int main(){
+  OggVorbis_File vf;
+  int eof=0;
+  int current_section;
+
+#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
+  /* Beware the evil ifdef. We avoid these where we can, but this one we 
+     cannot. Don't add any more, you'll probably go to hell if you do. */
+  _setmode( _fileno( stdin ), _O_BINARY );
+  _setmode( _fileno( stdout ), _O_BINARY );
+#endif
+
+  if(ov_open(stdin, &vf, NULL, 0) < 0) {
+      fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
+      exit(1);
+  }
+
+  /* Throw the comments plus a few lines about the bitstream we're
+     decoding */
+  {
+    char **ptr=ov_comment(&vf,-1)->user_comments;
+    vorbis_info *vi=ov_info(&vf,-1);
+    while(*ptr){
+      fprintf(stderr,"%s\n",*ptr);
+      ++ptr;
+    }
+    fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
+    fprintf(stderr,"\nDecoded length: %ld samples\n",
+	    (long)ov_pcm_total(&vf,-1));
+    fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
+  }
+  
+  while(!eof){
+    long ret=ov_read(&vf,pcmout,sizeof(pcmout),&current_section);
+    if (ret == 0) {
+      /* EOF */
+      eof=1;
+    } else if (ret < 0) {
+      /* error in the stream.  Not a problem, just reporting it in
+	 case we (the app) cares.  In this case, we don't. */
+    } else {
+      /* we don't bother dealing with sample rate changes, etc, but
+	 you'll have to*/
+      fwrite(pcmout,1,ret,stdout);
+    }
+  }
+
+  /* cleanup */
+  ov_clear(&vf);
+    
+  fprintf(stderr,"Done.\n");
+  return(0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/lsp_lookup.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,136 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function: lookup data
+
+ ********************************************************************/
+
+#ifndef _V_LOOKUP_DATA_H_
+#define _V_LOOKUP_DATA_H_
+
+#include "os_types.h"
+
+#define FROMdB_LOOKUP_SZ 35
+#define FROMdB2_LOOKUP_SZ 32
+#define FROMdB_SHIFT 5
+#define FROMdB2_SHIFT 3
+#define FROMdB2_MASK 31
+
+static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
+  0x003fffff, 0x0028619b, 0x00197a96, 0x0010137a,
+  0x000a24b0, 0x00066666, 0x000409c3, 0x00028c42,
+  0x00019b8c, 0x000103ab, 0x0000a3d7, 0x00006760,
+  0x0000413a, 0x00002928, 0x000019f8, 0x00001062,
+  0x00000a56, 0x00000686, 0x0000041e, 0x00000299,
+  0x000001a3, 0x00000109, 0x000000a7, 0x00000069,
+  0x00000042, 0x0000002a, 0x0000001a, 0x00000011,
+  0x0000000b, 0x00000007, 0x00000004, 0x00000003,
+  0x00000002, 0x00000001, 0x00000001};
+
+static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
+  0x000001fc, 0x000001f5, 0x000001ee, 0x000001e7,
+  0x000001e0, 0x000001d9, 0x000001d2, 0x000001cc,
+  0x000001c5, 0x000001bf, 0x000001b8, 0x000001b2,
+  0x000001ac, 0x000001a6, 0x000001a0, 0x0000019a,
+  0x00000194, 0x0000018e, 0x00000188, 0x00000183,
+  0x0000017d, 0x00000178, 0x00000172, 0x0000016d,
+  0x00000168, 0x00000163, 0x0000015e, 0x00000159,
+  0x00000154, 0x0000014f, 0x0000014a, 0x00000145,
+};
+
+#define INVSQ_LOOKUP_I_SHIFT 10
+#define INVSQ_LOOKUP_I_MASK 1023
+static const long INVSQ_LOOKUP_I[64+1]={
+	   92682,   91966,   91267,   90583,
+	   89915,   89261,   88621,   87995,
+	   87381,   86781,   86192,   85616,
+	   85051,   84497,   83953,   83420,
+	   82897,   82384,   81880,   81385,
+	   80899,   80422,   79953,   79492,
+	   79039,   78594,   78156,   77726,
+	   77302,   76885,   76475,   76072,
+	   75674,   75283,   74898,   74519,
+	   74146,   73778,   73415,   73058,
+	   72706,   72359,   72016,   71679,
+	   71347,   71019,   70695,   70376,
+	   70061,   69750,   69444,   69141,
+	   68842,   68548,   68256,   67969,
+	   67685,   67405,   67128,   66855,
+	   66585,   66318,   66054,   65794,
+	   65536,
+};
+
+static const long INVSQ_LOOKUP_IDel[64]={
+             716,     699,     684,     668,
+             654,     640,     626,     614,
+             600,     589,     576,     565,
+             554,     544,     533,     523,
+             513,     504,     495,     486,
+             477,     469,     461,     453,
+             445,     438,     430,     424,
+             417,     410,     403,     398,
+             391,     385,     379,     373,
+             368,     363,     357,     352,
+             347,     343,     337,     332,
+             328,     324,     319,     315,
+             311,     306,     303,     299,
+             294,     292,     287,     284,
+             280,     277,     273,     270,
+             267,     264,     260,     258,
+};
+
+#define COS_LOOKUP_I_SHIFT 9
+#define COS_LOOKUP_I_MASK 511
+#define COS_LOOKUP_I_SZ 128
+static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
+	   16384,   16379,   16364,   16340,
+	   16305,   16261,   16207,   16143,
+	   16069,   15986,   15893,   15791,
+	   15679,   15557,   15426,   15286,
+	   15137,   14978,   14811,   14635,
+	   14449,   14256,   14053,   13842,
+	   13623,   13395,   13160,   12916,
+	   12665,   12406,   12140,   11866,
+	   11585,   11297,   11003,   10702,
+	   10394,   10080,    9760,    9434,
+	    9102,    8765,    8423,    8076,
+	    7723,    7366,    7005,    6639,
+	    6270,    5897,    5520,    5139,
+	    4756,    4370,    3981,    3590,
+	    3196,    2801,    2404,    2006,
+	    1606,    1205,     804,     402,
+	       0,    -401,    -803,   -1204,
+	   -1605,   -2005,   -2403,   -2800,
+	   -3195,   -3589,   -3980,   -4369,
+	   -4755,   -5138,   -5519,   -5896,
+	   -6269,   -6638,   -7004,   -7365,
+	   -7722,   -8075,   -8422,   -8764,
+	   -9101,   -9433,   -9759,  -10079,
+	  -10393,  -10701,  -11002,  -11296,
+	  -11584,  -11865,  -12139,  -12405,
+	  -12664,  -12915,  -13159,  -13394,
+	  -13622,  -13841,  -14052,  -14255,
+	  -14448,  -14634,  -14810,  -14977,
+	  -15136,  -15285,  -15425,  -15556,
+	  -15678,  -15790,  -15892,  -15985,
+	  -16068,  -16142,  -16206,  -16260,
+	  -16304,  -16339,  -16363,  -16378,
+	  -16383,
+};
+
+#endif
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/mapping0.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,322 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: channel mapping 0 implementation
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "ogg.h"
+#include "ivorbiscodec.h"
+#include "mdct.h"
+#include "codec_internal.h"
+#include "codebook.h"
+#include "window.h"
+#include "registry.h"
+#include "misc.h"
+
+/* simplistic, wasteful way of doing this (unique lookup for each
+   mode/submapping); there should be a central repository for
+   identical lookups.  That will require minor work, so I'm putting it
+   off as low priority.
+
+   Why a lookup for each backend in a given mode?  Because the
+   blocksize is set by the mode, and low backend lookups may require
+   parameters from other areas of the mode/mapping */
+
+typedef struct {
+  vorbis_info_mode *mode;
+  vorbis_info_mapping0 *map;
+
+  vorbis_look_floor **floor_look;
+
+  vorbis_look_residue **residue_look;
+
+  vorbis_func_floor **floor_func;
+  vorbis_func_residue **residue_func;
+
+  int ch;
+  long lastframe; /* if a different mode is called, we need to 
+		     invalidate decay */
+} vorbis_look_mapping0;
+
+static void mapping0_free_info(vorbis_info_mapping *i){
+  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
+  if(info){
+    memset(info,0,sizeof(*info));
+    _ogg_free(info);
+  }
+}
+
+static void mapping0_free_look(vorbis_look_mapping *look){
+  int i;
+  vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
+  if(l){
+
+    for(i=0;i<l->map->submaps;i++){
+      l->floor_func[i]->free_look(l->floor_look[i]);
+      l->residue_func[i]->free_look(l->residue_look[i]);
+    }
+
+    _ogg_free(l->floor_func);
+    _ogg_free(l->residue_func);
+    _ogg_free(l->floor_look);
+    _ogg_free(l->residue_look);
+    memset(l,0,sizeof(*l));
+    _ogg_free(l);
+  }
+}
+
+static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
+			  vorbis_info_mapping *m){
+  int i;
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)_ogg_calloc(1,sizeof(*look));
+  vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
+  look->mode=vm;
+  
+  look->floor_look=(vorbis_look_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_look));
+
+  look->residue_look=(vorbis_look_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_look));
+
+  look->floor_func=(vorbis_func_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_func));
+  look->residue_func=(vorbis_func_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_func));
+  
+  for(i=0;i<info->submaps;i++){
+    int floornum=info->floorsubmap[i];
+    int resnum=info->residuesubmap[i];
+
+    look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
+    look->floor_look[i]=look->floor_func[i]->
+      look(vd,vm,ci->floor_param[floornum]);
+    look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
+    look->residue_look[i]=look->residue_func[i]->
+      look(vd,vm,ci->residue_param[resnum]);
+    
+  }
+
+  look->ch=vi->channels;
+
+  return(look);
+}
+
+static int ilog(unsigned int v){
+  int ret=0;
+  if(v)--v;
+  while(v){
+    ret++;
+    v>>=1;
+  }
+  return(ret);
+}
+
+/* also responsible for range checking */
+static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
+  int i;
+  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)_ogg_calloc(1,sizeof(*info));
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  memset(info,0,sizeof(*info));
+
+  if(oggpack_read(opb,1))
+    info->submaps=oggpack_read(opb,4)+1;
+  else
+    info->submaps=1;
+
+  if(oggpack_read(opb,1)){
+    info->coupling_steps=oggpack_read(opb,8)+1;
+
+    for(i=0;i<info->coupling_steps;i++){
+      int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
+      int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
+
+      if(testM<0 || 
+	 testA<0 || 
+	 testM==testA || 
+	 testM>=vi->channels ||
+	 testA>=vi->channels) goto err_out;
+    }
+
+  }
+
+  if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */
+    
+  if(info->submaps>1){
+    for(i=0;i<vi->channels;i++){
+      info->chmuxlist[i]=oggpack_read(opb,4);
+      if(info->chmuxlist[i]>=info->submaps)goto err_out;
+    }
+  }
+  for(i=0;i<info->submaps;i++){
+    int temp=oggpack_read(opb,8);
+    if(temp>=ci->times)goto err_out;
+    info->floorsubmap[i]=oggpack_read(opb,8);
+    if(info->floorsubmap[i]>=ci->floors)goto err_out;
+    info->residuesubmap[i]=oggpack_read(opb,8);
+    if(info->residuesubmap[i]>=ci->residues)goto err_out;
+  }
+
+  return info;
+
+ err_out:
+  mapping0_free_info(info);
+  return(NULL);
+}
+
+static int seq=0;
+static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
+  vorbis_dsp_state     *vd=vb->vd;
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  private_state        *b=(private_state *)vd->backend_state;
+  vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
+  vorbis_info_mapping0 *info=look->map;
+
+  int                   i,j;
+  long                  n=vb->pcmend=ci->blocksizes[vb->W];
+
+  ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels);
+  int    *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels);
+  
+  int   *nonzero  =(int *)alloca(sizeof(*nonzero)*vi->channels);
+  void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels);
+  
+  /* time domain information decode (note that applying the
+     information would have to happen later; we'll probably add a
+     function entry to the harness for that later */
+  /* NOT IMPLEMENTED */
+
+  /* recover the spectral envelope; store it in the PCM vector for now */
+  for(i=0;i<vi->channels;i++){
+    int submap=info->chmuxlist[i];
+    floormemo[i]=look->floor_func[submap]->
+      inverse1(vb,look->floor_look[submap]);
+    if(floormemo[i])
+      nonzero[i]=1;
+    else
+      nonzero[i]=0;      
+    memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
+  }
+
+  /* channel coupling can 'dirty' the nonzero listing */
+  for(i=0;i<info->coupling_steps;i++){
+    if(nonzero[info->coupling_mag[i]] ||
+       nonzero[info->coupling_ang[i]]){
+      nonzero[info->coupling_mag[i]]=1; 
+      nonzero[info->coupling_ang[i]]=1; 
+    }
+  }
+
+  /* recover the residue into our working vectors */
+  for(i=0;i<info->submaps;i++){
+    int ch_in_bundle=0;
+    for(j=0;j<vi->channels;j++){
+      if(info->chmuxlist[j]==i){
+	if(nonzero[j])
+	  zerobundle[ch_in_bundle]=1;
+	else
+	  zerobundle[ch_in_bundle]=0;
+	pcmbundle[ch_in_bundle++]=vb->pcm[j];
+      }
+    }
+    
+    look->residue_func[i]->inverse(vb,look->residue_look[i],
+				   pcmbundle,zerobundle,ch_in_bundle);
+  }
+
+  //for(j=0;j<vi->channels;j++)
+  //_analysis_output("coupled",seq+j,vb->pcm[j],-8,n/2,0,0);
+
+
+  /* channel coupling */
+  for(i=info->coupling_steps-1;i>=0;i--){
+    ogg_int32_t *pcmM=vb->pcm[info->coupling_mag[i]];
+    ogg_int32_t *pcmA=vb->pcm[info->coupling_ang[i]];
+    
+    for(j=0;j<n/2;j++){
+      ogg_int32_t mag=pcmM[j];
+      ogg_int32_t ang=pcmA[j];
+      
+      if(mag>0)
+	if(ang>0){
+	  pcmM[j]=mag;
+	  pcmA[j]=mag-ang;
+	}else{
+	  pcmA[j]=mag;
+	  pcmM[j]=mag+ang;
+	}
+      else
+	if(ang>0){
+	  pcmM[j]=mag;
+	  pcmA[j]=mag+ang;
+	}else{
+	  pcmA[j]=mag;
+	  pcmM[j]=mag-ang;
+	}
+    }
+  }
+
+  //for(j=0;j<vi->channels;j++)
+  //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0);
+
+  /* compute and apply spectral envelope */
+  for(i=0;i<vi->channels;i++){
+    ogg_int32_t *pcm=vb->pcm[i];
+    int submap=info->chmuxlist[i];
+    look->floor_func[submap]->
+      inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
+  }
+
+  //for(j=0;j<vi->channels;j++)
+  //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1);
+
+  /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
+  /* only MDCT right now.... */
+  for(i=0;i<vi->channels;i++){
+    ogg_int32_t *pcm=vb->pcm[i];
+    mdct_backward(n,pcm,pcm);
+  }
+
+  //for(j=0;j<vi->channels;j++)
+  //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0);
+
+  /* window the data */
+  for(i=0;i<vi->channels;i++){
+    ogg_int32_t *pcm=vb->pcm[i];
+    if(nonzero[i])
+      _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
+    else
+      for(j=0;j<n;j++)
+	pcm[j]=0;
+    
+  }
+
+  //for(j=0;j<vi->channels;j++)
+  //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0);
+
+  seq+=vi->channels;
+  /* all done! */
+  return(0);
+}
+
+/* export hooks */
+vorbis_func_mapping mapping0_exportbundle={
+  &mapping0_unpack,
+  &mapping0_look,
+  &mapping0_free_info,
+  &mapping0_free_look,
+  &mapping0_inverse
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/mdct.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,510 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: normalized modified discrete cosine transform
+           power of two length transform only [64 <= n ]
+ last mod: $Id: mdct.c,v 1.9 2002/10/16 09:17:39 xiphmont Exp $
+
+ Original algorithm adapted long ago from _The use of multirate filter
+ banks for coding of high quality digital audio_, by T. Sporer,
+ K. Brandenburg and B. Edler, collection of the European Signal
+ Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp
+ 211-214
+
+ The below code implements an algorithm that no longer looks much like
+ that presented in the paper, but the basic structure remains if you
+ dig deep enough to see it.
+
+ This module DOES NOT INCLUDE code to generate/apply the window
+ function.  Everybody has their own weird favorite including me... I
+ happen to like the properties of y=sin(.5PI*sin^2(x)), but others may
+ vehemently disagree.
+
+ ********************************************************************/
+
+#include "ivorbiscodec.h"
+#include "codebook.h"
+#include "misc.h"
+#include "mdct.h"
+#include "mdct_lookup.h"
+
+
+/* 8 point butterfly (in place) */
+STIN void mdct_butterfly_8(DATA_TYPE *x){
+
+  REG_TYPE r0   = x[4] + x[0];
+  REG_TYPE r1   = x[4] - x[0];
+  REG_TYPE r2   = x[5] + x[1];
+  REG_TYPE r3   = x[5] - x[1];
+  REG_TYPE r4   = x[6] + x[2];
+  REG_TYPE r5   = x[6] - x[2];
+  REG_TYPE r6   = x[7] + x[3];
+  REG_TYPE r7   = x[7] - x[3];
+
+	   x[0] = r5   + r3;
+	   x[1] = r7   - r1;
+	   x[2] = r5   - r3;
+	   x[3] = r7   + r1;
+           x[4] = r4   - r0;
+	   x[5] = r6   - r2;
+           x[6] = r4   + r0;
+	   x[7] = r6   + r2;
+	   MB();
+}
+
+/* 16 point butterfly (in place, 4 register) */
+STIN void mdct_butterfly_16(DATA_TYPE *x){
+
+  REG_TYPE r0, r1;
+
+	   r0 = x[ 0] - x[ 8]; x[ 8] += x[ 0];
+	   r1 = x[ 1] - x[ 9]; x[ 9] += x[ 1];
+	   x[ 0] = MULT31((r0 + r1) , cPI2_8);
+	   x[ 1] = MULT31((r1 - r0) , cPI2_8);
+	   MB();
+
+	   r0 = x[10] - x[ 2]; x[10] += x[ 2];
+	   r1 = x[ 3] - x[11]; x[11] += x[ 3];
+	   x[ 2] = r1; x[ 3] = r0;
+	   MB();
+
+	   r0 = x[12] - x[ 4]; x[12] += x[ 4];
+	   r1 = x[13] - x[ 5]; x[13] += x[ 5];
+	   x[ 4] = MULT31((r0 - r1) , cPI2_8);
+	   x[ 5] = MULT31((r0 + r1) , cPI2_8);
+	   MB();
+
+	   r0 = x[14] - x[ 6]; x[14] += x[ 6];
+	   r1 = x[15] - x[ 7]; x[15] += x[ 7];
+	   x[ 6] = r0; x[ 7] = r1;
+	   MB();
+
+	   mdct_butterfly_8(x);
+	   mdct_butterfly_8(x+8);
+}
+
+/* 32 point butterfly (in place, 4 register) */
+STIN void mdct_butterfly_32(DATA_TYPE *x){
+
+  REG_TYPE r0, r1;
+
+	   r0 = x[30] - x[14]; x[30] += x[14];           
+	   r1 = x[31] - x[15]; x[31] += x[15];
+	   x[14] = r0; x[15] = r1;
+	   MB();
+
+	   r0 = x[28] - x[12]; x[28] += x[12];           
+	   r1 = x[29] - x[13]; x[29] += x[13];
+	   XNPROD31( r0, r1, cPI1_8, cPI3_8, &x[12], &x[13] );
+	   MB();
+
+	   r0 = x[26] - x[10]; x[26] += x[10];
+	   r1 = x[27] - x[11]; x[27] += x[11];
+	   x[10] = MULT31((r0 - r1) , cPI2_8);
+	   x[11] = MULT31((r0 + r1) , cPI2_8);
+	   MB();
+
+	   r0 = x[24] - x[ 8]; x[24] += x[ 8];
+	   r1 = x[25] - x[ 9]; x[25] += x[ 9];
+	   XNPROD31( r0, r1, cPI3_8, cPI1_8, &x[ 8], &x[ 9] );
+	   MB();
+
+	   r0 = x[22] - x[ 6]; x[22] += x[ 6];
+	   r1 = x[ 7] - x[23]; x[23] += x[ 7];
+	   x[ 6] = r1; x[ 7] = r0;
+	   MB();
+
+	   r0 = x[ 4] - x[20]; x[20] += x[ 4];
+	   r1 = x[ 5] - x[21]; x[21] += x[ 5];
+	   XPROD31 ( r0, r1, cPI3_8, cPI1_8, &x[ 4], &x[ 5] );
+	   MB();
+
+	   r0 = x[ 2] - x[18]; x[18] += x[ 2];
+	   r1 = x[ 3] - x[19]; x[19] += x[ 3];
+	   x[ 2] = MULT31((r1 + r0) , cPI2_8);
+	   x[ 3] = MULT31((r1 - r0) , cPI2_8);
+	   MB();
+
+	   r0 = x[ 0] - x[16]; x[16] += x[ 0];
+	   r1 = x[ 1] - x[17]; x[17] += x[ 1];
+	   XPROD31 ( r0, r1, cPI1_8, cPI3_8, &x[ 0], &x[ 1] );
+	   MB();
+
+	   mdct_butterfly_16(x);
+	   mdct_butterfly_16(x+16);
+}
+
+/* N/stage point generic N stage butterfly (in place, 2 register) */
+STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
+
+  LOOKUP_T *T   = sincos_lookup0;
+  DATA_TYPE *x1        = x + points      - 8;
+  DATA_TYPE *x2        = x + (points>>1) - 8;
+  REG_TYPE   r0;
+  REG_TYPE   r1;
+
+  do{
+    r0 = x1[6] - x2[6]; x1[6] += x2[6];
+    r1 = x2[7] - x1[7]; x1[7] += x2[7];
+    XPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T+=step;
+
+    r0 = x1[4] - x2[4]; x1[4] += x2[4];
+    r1 = x2[5] - x1[5]; x1[5] += x2[5];
+    XPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T+=step;
+
+    r0 = x1[2] - x2[2]; x1[2] += x2[2];
+    r1 = x2[3] - x1[3]; x1[3] += x2[3];
+    XPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T+=step;
+
+    r0 = x1[0] - x2[0]; x1[0] += x2[0];
+    r1 = x2[1] - x1[1]; x1[1] += x2[1];
+    XPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T+=step;
+
+    x1-=8; x2-=8;
+  }while(T<sincos_lookup0+1024);
+  do{
+    r0 = x1[6] - x2[6]; x1[6] += x2[6];
+    r1 = x1[7] - x2[7]; x1[7] += x2[7];
+    XNPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T-=step;
+
+    r0 = x1[4] - x2[4]; x1[4] += x2[4];
+    r1 = x1[5] - x2[5]; x1[5] += x2[5];
+    XNPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T-=step;
+
+    r0 = x1[2] - x2[2]; x1[2] += x2[2];
+    r1 = x1[3] - x2[3]; x1[3] += x2[3];
+    XNPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T-=step;
+
+    r0 = x1[0] - x2[0]; x1[0] += x2[0];
+    r1 = x1[1] - x2[1]; x1[1] += x2[1];
+    XNPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T-=step;
+
+    x1-=8; x2-=8;
+  }while(T>sincos_lookup0);
+  do{
+    r0 = x2[6] - x1[6]; x1[6] += x2[6];
+    r1 = x2[7] - x1[7]; x1[7] += x2[7];
+    XPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T+=step;
+
+    r0 = x2[4] - x1[4]; x1[4] += x2[4];
+    r1 = x2[5] - x1[5]; x1[5] += x2[5];
+    XPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T+=step;
+
+    r0 = x2[2] - x1[2]; x1[2] += x2[2];
+    r1 = x2[3] - x1[3]; x1[3] += x2[3];
+    XPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T+=step;
+
+    r0 = x2[0] - x1[0]; x1[0] += x2[0];
+    r1 = x2[1] - x1[1]; x1[1] += x2[1];
+    XPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T+=step;
+
+    x1-=8; x2-=8;
+  }while(T<sincos_lookup0+1024);
+  do{
+    r0 = x1[6] - x2[6]; x1[6] += x2[6];
+    r1 = x2[7] - x1[7]; x1[7] += x2[7];
+    XNPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T-=step;
+
+    r0 = x1[4] - x2[4]; x1[4] += x2[4];
+    r1 = x2[5] - x1[5]; x1[5] += x2[5];
+    XNPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T-=step;
+
+    r0 = x1[2] - x2[2]; x1[2] += x2[2];
+    r1 = x2[3] - x1[3]; x1[3] += x2[3];
+    XNPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T-=step;
+
+    r0 = x1[0] - x2[0]; x1[0] += x2[0];
+    r1 = x2[1] - x1[1]; x1[1] += x2[1];
+    XNPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T-=step;
+
+    x1-=8; x2-=8;
+  }while(T>sincos_lookup0);
+}
+
+STIN void mdct_butterflies(DATA_TYPE *x,int points,int shift){
+
+  int stages=8-shift;
+  int i,j;
+  
+  for(i=0;--stages>0;i++){
+    for(j=0;j<(1<<i);j++)
+      mdct_butterfly_generic(x+(points>>i)*j,points>>i,4<<(i+shift));
+  }
+
+  for(j=0;j<points;j+=32)
+    mdct_butterfly_32(x+j);
+
+}
+
+static unsigned char bitrev[16]={0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
+
+STIN int bitrev12(int x){
+  return bitrev[x>>8]|(bitrev[(x&0x0f0)>>4]<<4)|(((int)bitrev[x&0x00f])<<8);
+}
+
+STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
+
+  int          bit   = 0;
+  DATA_TYPE   *w0    = x;
+  DATA_TYPE   *w1    = x = w0+(n>>1);
+  LOOKUP_T    *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
+  LOOKUP_T    *Ttop  = T+1024;
+  DATA_TYPE    r2;
+
+  do{
+    DATA_TYPE r3     = bitrev12(bit++);
+    DATA_TYPE *x0    = x + ((r3 ^ 0xfff)>>shift) -1;
+    DATA_TYPE *x1    = x + (r3>>shift);
+
+    REG_TYPE  r0     = x0[0]  + x1[0];
+    REG_TYPE  r1     = x1[1]  - x0[1];
+
+	      XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
+
+	      w1    -= 4;
+
+	      r0     = (x0[1] + x1[1])>>1;
+              r1     = (x0[0] - x1[0])>>1;
+	      w0[0]  = r0     + r2;
+	      w0[1]  = r1     + r3;
+	      w1[2]  = r0     - r2;
+	      w1[3]  = r3     - r1;
+
+	      r3     = bitrev12(bit++);
+              x0     = x + ((r3 ^ 0xfff)>>shift) -1;
+              x1     = x + (r3>>shift);
+
+              r0     = x0[0]  + x1[0];
+              r1     = x1[1]  - x0[1];
+
+	      XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
+
+              r0     = (x0[1] + x1[1])>>1;
+              r1     = (x0[0] - x1[0])>>1;
+	      w0[2]  = r0     + r2;
+	      w0[3]  = r1     + r3;
+	      w1[0]  = r0     - r2;
+	      w1[1]  = r3     - r1;
+
+	      w0    += 4;
+  }while(T<Ttop);
+  do{
+    DATA_TYPE r3     = bitrev12(bit++);
+    DATA_TYPE *x0    = x + ((r3 ^ 0xfff)>>shift) -1;
+    DATA_TYPE *x1    = x + (r3>>shift);
+
+    REG_TYPE  r0     = x0[0]  + x1[0];
+    REG_TYPE  r1     = x1[1]  - x0[1];
+
+	      T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
+
+	      w1    -= 4;
+
+	      r0     = (x0[1] + x1[1])>>1;
+              r1     = (x0[0] - x1[0])>>1;
+	      w0[0]  = r0     + r2;
+	      w0[1]  = r1     + r3;
+	      w1[2]  = r0     - r2;
+	      w1[3]  = r3     - r1;
+
+	      r3     = bitrev12(bit++);
+              x0     = x + ((r3 ^ 0xfff)>>shift) -1;
+              x1     = x + (r3>>shift);
+
+              r0     = x0[0]  + x1[0];
+              r1     = x1[1]  - x0[1];
+
+	      T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
+
+              r0     = (x0[1] + x1[1])>>1;
+              r1     = (x0[0] - x1[0])>>1;
+	      w0[2]  = r0     + r2;
+	      w0[3]  = r1     + r3;
+	      w1[0]  = r0     - r2;
+	      w1[1]  = r3     - r1;
+
+	      w0    += 4;
+  }while(w0<w1);
+}
+
+void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
+  int n2=n>>1;
+  int n4=n>>2;
+  DATA_TYPE *iX;
+  DATA_TYPE *oX;
+  LOOKUP_T *T;
+  LOOKUP_T *V;
+  int shift;
+  int step;
+
+  for (shift=6;!(n&(1<<shift));shift++);
+  shift=13-shift;
+  step=2<<shift;
+   
+  /* rotate */
+
+  iX            = in+n2-7;
+  oX            = out+n2+n4;
+  T             = sincos_lookup0;
+
+  do{
+    oX-=4;
+    XPROD31( iX[4], iX[6], T[0], T[1], &oX[2], &oX[3] ); T+=step;
+    XPROD31( iX[0], iX[2], T[0], T[1], &oX[0], &oX[1] ); T+=step;
+    iX-=8;
+  }while(iX>=in+n4);
+  do{
+    oX-=4;
+    XPROD31( iX[4], iX[6], T[1], T[0], &oX[2], &oX[3] ); T-=step;
+    XPROD31( iX[0], iX[2], T[1], T[0], &oX[0], &oX[1] ); T-=step;
+    iX-=8;
+  }while(iX>=in);
+
+  iX            = in+n2-8;
+  oX            = out+n2+n4;
+  T             = sincos_lookup0;
+
+  do{
+    T+=step; XNPROD31( iX[6], iX[4], T[0], T[1], &oX[0], &oX[1] );
+    T+=step; XNPROD31( iX[2], iX[0], T[0], T[1], &oX[2], &oX[3] );
+    iX-=8;
+    oX+=4;
+  }while(iX>=in+n4);
+  do{
+    T-=step; XNPROD31( iX[6], iX[4], T[1], T[0], &oX[0], &oX[1] );
+    T-=step; XNPROD31( iX[2], iX[0], T[1], T[0], &oX[2], &oX[3] );
+    iX-=8;
+    oX+=4;
+  }while(iX>=in);
+
+  mdct_butterflies(out+n2,n2,shift);
+  mdct_bitreverse(out,n,step,shift);
+
+  /* rotate + window */
+
+  step>>=2;
+  {
+    DATA_TYPE *oX1=out+n2+n4;
+    DATA_TYPE *oX2=out+n2+n4;
+    DATA_TYPE *iX =out;
+
+    switch(step) {
+      default: {
+        T=(step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
+        do{
+          oX1-=4;
+	  XPROD31( iX[0], -iX[1], T[0], T[1], &oX1[3], &oX2[0] ); T+=step;
+	  XPROD31( iX[2], -iX[3], T[0], T[1], &oX1[2], &oX2[1] ); T+=step;
+	  XPROD31( iX[4], -iX[5], T[0], T[1], &oX1[1], &oX2[2] ); T+=step;
+	  XPROD31( iX[6], -iX[7], T[0], T[1], &oX1[0], &oX2[3] ); T+=step;
+	  oX2+=4;
+	  iX+=8;
+	}while(iX<oX1);
+	break;
+      }
+
+      case 1: {
+        /* linear interpolation between table values: offset=0.5, step=1 */
+	REG_TYPE  t0,t1,v0,v1;
+        T         = sincos_lookup0;
+        V         = sincos_lookup1;
+	t0        = (*T++)>>1;
+	t1        = (*T++)>>1;
+        do{
+          oX1-=4;
+
+	  t0 += (v0 = (*V++)>>1);
+	  t1 += (v1 = (*V++)>>1);
+	  XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
+	  v0 += (t0 = (*T++)>>1);
+	  v1 += (t1 = (*T++)>>1);
+	  XPROD31( iX[2], -iX[3], v0, v1, &oX1[2], &oX2[1] );
+	  t0 += (v0 = (*V++)>>1);
+	  t1 += (v1 = (*V++)>>1);
+	  XPROD31( iX[4], -iX[5], t0, t1, &oX1[1], &oX2[2] );
+	  v0 += (t0 = (*T++)>>1);
+	  v1 += (t1 = (*T++)>>1);
+	  XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
+
+	  oX2+=4;
+	  iX+=8;
+	}while(iX<oX1);
+	break;
+      }
+
+      case 0: {
+        /* linear interpolation between table values: offset=0.25, step=0.5 */
+	REG_TYPE  t0,t1,v0,v1,q0,q1;
+        T         = sincos_lookup0;
+        V         = sincos_lookup1;
+	t0        = *T++;
+	t1        = *T++;
+        do{
+          oX1-=4;
+
+	  v0  = *V++;
+	  v1  = *V++;
+	  t0 +=  (q0 = (v0-t0)>>2);
+	  t1 +=  (q1 = (v1-t1)>>2);
+	  XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
+	  t0  = v0-q0;
+	  t1  = v1-q1;
+	  XPROD31( iX[2], -iX[3], t0, t1, &oX1[2], &oX2[1] );
+
+	  t0  = *T++;
+	  t1  = *T++;
+	  v0 += (q0 = (t0-v0)>>2);
+	  v1 += (q1 = (t1-v1)>>2);
+	  XPROD31( iX[4], -iX[5], v0, v1, &oX1[1], &oX2[2] );
+	  v0  = t0-q0;
+	  v1  = t1-q1;
+	  XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
+
+	  oX2+=4;
+	  iX+=8;
+	}while(iX<oX1);
+	break;
+      }
+    }
+
+    iX=out+n2+n4;
+    oX1=out+n4;
+    oX2=oX1;
+
+    do{
+      oX1-=4;
+      iX-=4;
+
+      oX2[0] = -(oX1[3] = iX[3]);
+      oX2[1] = -(oX1[2] = iX[2]);
+      oX2[2] = -(oX1[1] = iX[1]);
+      oX2[3] = -(oX1[0] = iX[0]);
+
+      oX2+=4;
+    }while(oX2<iX);
+
+    iX=out+n2+n4;
+    oX1=out+n2+n4;
+    oX2=out+n2;
+
+    do{
+      oX1-=4;
+      oX1[0]= iX[3];
+      oX1[1]= iX[2];
+      oX1[2]= iX[1];
+      oX1[3]= iX[0];
+      iX+=4;
+    }while(oX1>oX2);
+  }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/mdct.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,52 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: modified discrete cosine transform prototypes
+
+ ********************************************************************/
+
+#ifndef _OGG_mdct_H_
+#define _OGG_mdct_H_
+
+#include "ivorbiscodec.h"
+#include "misc.h"
+
+#define DATA_TYPE ogg_int32_t
+#define REG_TYPE  register ogg_int32_t
+
+#ifdef _LOW_ACCURACY_
+#define cPI3_8 (0x0062)
+#define cPI2_8 (0x00b5)
+#define cPI1_8 (0x00ed)
+#else
+#define cPI3_8 (0x30fbc54d)
+#define cPI2_8 (0x5a82799a)
+#define cPI1_8 (0x7641af3d)
+#endif
+
+extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out);
+extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out);
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/mdct_lookup.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,540 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: sin,cos lookup tables
+
+ ********************************************************************/
+  
+#include "os_types.h"
+
+/* {sin(2*i*PI/4096), cos(2*i*PI/4096)}, with i = 0 to 512 */
+static LOOKUP_T sincos_lookup0[1026] = {
+  X(0x00000000), X(0x7fffffff), X(0x003243f5), X(0x7ffff621),
+  X(0x006487e3), X(0x7fffd886), X(0x0096cbc1), X(0x7fffa72c),
+  X(0x00c90f88), X(0x7fff6216), X(0x00fb5330), X(0x7fff0943),
+  X(0x012d96b1), X(0x7ffe9cb2), X(0x015fda03), X(0x7ffe1c65),
+  X(0x01921d20), X(0x7ffd885a), X(0x01c45ffe), X(0x7ffce093),
+  X(0x01f6a297), X(0x7ffc250f), X(0x0228e4e2), X(0x7ffb55ce),
+  X(0x025b26d7), X(0x7ffa72d1), X(0x028d6870), X(0x7ff97c18),
+  X(0x02bfa9a4), X(0x7ff871a2), X(0x02f1ea6c), X(0x7ff75370),
+  X(0x03242abf), X(0x7ff62182), X(0x03566a96), X(0x7ff4dbd9),
+  X(0x0388a9ea), X(0x7ff38274), X(0x03bae8b2), X(0x7ff21553),
+  X(0x03ed26e6), X(0x7ff09478), X(0x041f6480), X(0x7feeffe1),
+  X(0x0451a177), X(0x7fed5791), X(0x0483ddc3), X(0x7feb9b85),
+  X(0x04b6195d), X(0x7fe9cbc0), X(0x04e8543e), X(0x7fe7e841),
+  X(0x051a8e5c), X(0x7fe5f108), X(0x054cc7b1), X(0x7fe3e616),
+  X(0x057f0035), X(0x7fe1c76b), X(0x05b137df), X(0x7fdf9508),
+  X(0x05e36ea9), X(0x7fdd4eec), X(0x0615a48b), X(0x7fdaf519),
+  X(0x0647d97c), X(0x7fd8878e), X(0x067a0d76), X(0x7fd6064c),
+  X(0x06ac406f), X(0x7fd37153), X(0x06de7262), X(0x7fd0c8a3),
+  X(0x0710a345), X(0x7fce0c3e), X(0x0742d311), X(0x7fcb3c23),
+  X(0x077501be), X(0x7fc85854), X(0x07a72f45), X(0x7fc560cf),
+  X(0x07d95b9e), X(0x7fc25596), X(0x080b86c2), X(0x7fbf36aa),
+  X(0x083db0a7), X(0x7fbc040a), X(0x086fd947), X(0x7fb8bdb8),
+  X(0x08a2009a), X(0x7fb563b3), X(0x08d42699), X(0x7fb1f5fc),
+  X(0x09064b3a), X(0x7fae7495), X(0x09386e78), X(0x7faadf7c),
+  X(0x096a9049), X(0x7fa736b4), X(0x099cb0a7), X(0x7fa37a3c),
+  X(0x09cecf89), X(0x7f9faa15), X(0x0a00ece8), X(0x7f9bc640),
+  X(0x0a3308bd), X(0x7f97cebd), X(0x0a6522fe), X(0x7f93c38c),
+  X(0x0a973ba5), X(0x7f8fa4b0), X(0x0ac952aa), X(0x7f8b7227),
+  X(0x0afb6805), X(0x7f872bf3), X(0x0b2d7baf), X(0x7f82d214),
+  X(0x0b5f8d9f), X(0x7f7e648c), X(0x0b919dcf), X(0x7f79e35a),
+  X(0x0bc3ac35), X(0x7f754e80), X(0x0bf5b8cb), X(0x7f70a5fe),
+  X(0x0c27c389), X(0x7f6be9d4), X(0x0c59cc68), X(0x7f671a05),
+  X(0x0c8bd35e), X(0x7f62368f), X(0x0cbdd865), X(0x7f5d3f75),
+  X(0x0cefdb76), X(0x7f5834b7), X(0x0d21dc87), X(0x7f531655),
+  X(0x0d53db92), X(0x7f4de451), X(0x0d85d88f), X(0x7f489eaa),
+  X(0x0db7d376), X(0x7f434563), X(0x0de9cc40), X(0x7f3dd87c),
+  X(0x0e1bc2e4), X(0x7f3857f6), X(0x0e4db75b), X(0x7f32c3d1),
+  X(0x0e7fa99e), X(0x7f2d1c0e), X(0x0eb199a4), X(0x7f2760af),
+  X(0x0ee38766), X(0x7f2191b4), X(0x0f1572dc), X(0x7f1baf1e),
+  X(0x0f475bff), X(0x7f15b8ee), X(0x0f7942c7), X(0x7f0faf25),
+  X(0x0fab272b), X(0x7f0991c4), X(0x0fdd0926), X(0x7f0360cb),
+  X(0x100ee8ad), X(0x7efd1c3c), X(0x1040c5bb), X(0x7ef6c418),
+  X(0x1072a048), X(0x7ef05860), X(0x10a4784b), X(0x7ee9d914),
+  X(0x10d64dbd), X(0x7ee34636), X(0x11082096), X(0x7edc9fc6),
+  X(0x1139f0cf), X(0x7ed5e5c6), X(0x116bbe60), X(0x7ecf1837),
+  X(0x119d8941), X(0x7ec8371a), X(0x11cf516a), X(0x7ec14270),
+  X(0x120116d5), X(0x7eba3a39), X(0x1232d979), X(0x7eb31e78),
+  X(0x1264994e), X(0x7eabef2c), X(0x1296564d), X(0x7ea4ac58),
+  X(0x12c8106f), X(0x7e9d55fc), X(0x12f9c7aa), X(0x7e95ec1a),
+  X(0x132b7bf9), X(0x7e8e6eb2), X(0x135d2d53), X(0x7e86ddc6),
+  X(0x138edbb1), X(0x7e7f3957), X(0x13c0870a), X(0x7e778166),
+  X(0x13f22f58), X(0x7e6fb5f4), X(0x1423d492), X(0x7e67d703),
+  X(0x145576b1), X(0x7e5fe493), X(0x148715ae), X(0x7e57dea7),
+  X(0x14b8b17f), X(0x7e4fc53e), X(0x14ea4a1f), X(0x7e47985b),
+  X(0x151bdf86), X(0x7e3f57ff), X(0x154d71aa), X(0x7e37042a),
+  X(0x157f0086), X(0x7e2e9cdf), X(0x15b08c12), X(0x7e26221f),
+  X(0x15e21445), X(0x7e1d93ea), X(0x16139918), X(0x7e14f242),
+  X(0x16451a83), X(0x7e0c3d29), X(0x1676987f), X(0x7e0374a0),
+  X(0x16a81305), X(0x7dfa98a8), X(0x16d98a0c), X(0x7df1a942),
+  X(0x170afd8d), X(0x7de8a670), X(0x173c6d80), X(0x7ddf9034),
+  X(0x176dd9de), X(0x7dd6668f), X(0x179f429f), X(0x7dcd2981),
+  X(0x17d0a7bc), X(0x7dc3d90d), X(0x1802092c), X(0x7dba7534),
+  X(0x183366e9), X(0x7db0fdf8), X(0x1864c0ea), X(0x7da77359),
+  X(0x18961728), X(0x7d9dd55a), X(0x18c7699b), X(0x7d9423fc),
+  X(0x18f8b83c), X(0x7d8a5f40), X(0x192a0304), X(0x7d808728),
+  X(0x195b49ea), X(0x7d769bb5), X(0x198c8ce7), X(0x7d6c9ce9),
+  X(0x19bdcbf3), X(0x7d628ac6), X(0x19ef0707), X(0x7d58654d),
+  X(0x1a203e1b), X(0x7d4e2c7f), X(0x1a517128), X(0x7d43e05e),
+  X(0x1a82a026), X(0x7d3980ec), X(0x1ab3cb0d), X(0x7d2f0e2b),
+  X(0x1ae4f1d6), X(0x7d24881b), X(0x1b161479), X(0x7d19eebf),
+  X(0x1b4732ef), X(0x7d0f4218), X(0x1b784d30), X(0x7d048228),
+  X(0x1ba96335), X(0x7cf9aef0), X(0x1bda74f6), X(0x7ceec873),
+  X(0x1c0b826a), X(0x7ce3ceb2), X(0x1c3c8b8c), X(0x7cd8c1ae),
+  X(0x1c6d9053), X(0x7ccda169), X(0x1c9e90b8), X(0x7cc26de5),
+  X(0x1ccf8cb3), X(0x7cb72724), X(0x1d00843d), X(0x7cabcd28),
+  X(0x1d31774d), X(0x7ca05ff1), X(0x1d6265dd), X(0x7c94df83),
+  X(0x1d934fe5), X(0x7c894bde), X(0x1dc4355e), X(0x7c7da505),
+  X(0x1df5163f), X(0x7c71eaf9), X(0x1e25f282), X(0x7c661dbc),
+  X(0x1e56ca1e), X(0x7c5a3d50), X(0x1e879d0d), X(0x7c4e49b7),
+  X(0x1eb86b46), X(0x7c4242f2), X(0x1ee934c3), X(0x7c362904),
+  X(0x1f19f97b), X(0x7c29fbee), X(0x1f4ab968), X(0x7c1dbbb3),
+  X(0x1f7b7481), X(0x7c116853), X(0x1fac2abf), X(0x7c0501d2),
+  X(0x1fdcdc1b), X(0x7bf88830), X(0x200d888d), X(0x7bebfb70),
+  X(0x203e300d), X(0x7bdf5b94), X(0x206ed295), X(0x7bd2a89e),
+  X(0x209f701c), X(0x7bc5e290), X(0x20d0089c), X(0x7bb9096b),
+  X(0x21009c0c), X(0x7bac1d31), X(0x21312a65), X(0x7b9f1de6),
+  X(0x2161b3a0), X(0x7b920b89), X(0x219237b5), X(0x7b84e61f),
+  X(0x21c2b69c), X(0x7b77ada8), X(0x21f3304f), X(0x7b6a6227),
+  X(0x2223a4c5), X(0x7b5d039e), X(0x225413f8), X(0x7b4f920e),
+  X(0x22847de0), X(0x7b420d7a), X(0x22b4e274), X(0x7b3475e5),
+  X(0x22e541af), X(0x7b26cb4f), X(0x23159b88), X(0x7b190dbc),
+  X(0x2345eff8), X(0x7b0b3d2c), X(0x23763ef7), X(0x7afd59a4),
+  X(0x23a6887f), X(0x7aef6323), X(0x23d6cc87), X(0x7ae159ae),
+  X(0x24070b08), X(0x7ad33d45), X(0x243743fa), X(0x7ac50dec),
+  X(0x24677758), X(0x7ab6cba4), X(0x2497a517), X(0x7aa8766f),
+  X(0x24c7cd33), X(0x7a9a0e50), X(0x24f7efa2), X(0x7a8b9348),
+  X(0x25280c5e), X(0x7a7d055b), X(0x2558235f), X(0x7a6e648a),
+  X(0x2588349d), X(0x7a5fb0d8), X(0x25b84012), X(0x7a50ea47),
+  X(0x25e845b6), X(0x7a4210d8), X(0x26184581), X(0x7a332490),
+  X(0x26483f6c), X(0x7a24256f), X(0x26783370), X(0x7a151378),
+  X(0x26a82186), X(0x7a05eead), X(0x26d809a5), X(0x79f6b711),
+  X(0x2707ebc7), X(0x79e76ca7), X(0x2737c7e3), X(0x79d80f6f),
+  X(0x27679df4), X(0x79c89f6e), X(0x27976df1), X(0x79b91ca4),
+  X(0x27c737d3), X(0x79a98715), X(0x27f6fb92), X(0x7999dec4),
+  X(0x2826b928), X(0x798a23b1), X(0x2856708d), X(0x797a55e0),
+  X(0x288621b9), X(0x796a7554), X(0x28b5cca5), X(0x795a820e),
+  X(0x28e5714b), X(0x794a7c12), X(0x29150fa1), X(0x793a6361),
+  X(0x2944a7a2), X(0x792a37fe), X(0x29743946), X(0x7919f9ec),
+  X(0x29a3c485), X(0x7909a92d), X(0x29d34958), X(0x78f945c3),
+  X(0x2a02c7b8), X(0x78e8cfb2), X(0x2a323f9e), X(0x78d846fb),
+  X(0x2a61b101), X(0x78c7aba2), X(0x2a911bdc), X(0x78b6fda8),
+  X(0x2ac08026), X(0x78a63d11), X(0x2aefddd8), X(0x789569df),
+  X(0x2b1f34eb), X(0x78848414), X(0x2b4e8558), X(0x78738bb3),
+  X(0x2b7dcf17), X(0x786280bf), X(0x2bad1221), X(0x7851633b),
+  X(0x2bdc4e6f), X(0x78403329), X(0x2c0b83fa), X(0x782ef08b),
+  X(0x2c3ab2b9), X(0x781d9b65), X(0x2c69daa6), X(0x780c33b8),
+  X(0x2c98fbba), X(0x77fab989), X(0x2cc815ee), X(0x77e92cd9),
+  X(0x2cf72939), X(0x77d78daa), X(0x2d263596), X(0x77c5dc01),
+  X(0x2d553afc), X(0x77b417df), X(0x2d843964), X(0x77a24148),
+  X(0x2db330c7), X(0x7790583e), X(0x2de2211e), X(0x777e5cc3),
+  X(0x2e110a62), X(0x776c4edb), X(0x2e3fec8b), X(0x775a2e89),
+  X(0x2e6ec792), X(0x7747fbce), X(0x2e9d9b70), X(0x7735b6af),
+  X(0x2ecc681e), X(0x77235f2d), X(0x2efb2d95), X(0x7710f54c),
+  X(0x2f29ebcc), X(0x76fe790e), X(0x2f58a2be), X(0x76ebea77),
+  X(0x2f875262), X(0x76d94989), X(0x2fb5fab2), X(0x76c69647),
+  X(0x2fe49ba7), X(0x76b3d0b4), X(0x30133539), X(0x76a0f8d2),
+  X(0x3041c761), X(0x768e0ea6), X(0x30705217), X(0x767b1231),
+  X(0x309ed556), X(0x76680376), X(0x30cd5115), X(0x7654e279),
+  X(0x30fbc54d), X(0x7641af3d), X(0x312a31f8), X(0x762e69c4),
+  X(0x3158970e), X(0x761b1211), X(0x3186f487), X(0x7607a828),
+  X(0x31b54a5e), X(0x75f42c0b), X(0x31e39889), X(0x75e09dbd),
+  X(0x3211df04), X(0x75ccfd42), X(0x32401dc6), X(0x75b94a9c),
+  X(0x326e54c7), X(0x75a585cf), X(0x329c8402), X(0x7591aedd),
+  X(0x32caab6f), X(0x757dc5ca), X(0x32f8cb07), X(0x7569ca99),
+  X(0x3326e2c3), X(0x7555bd4c), X(0x3354f29b), X(0x75419de7),
+  X(0x3382fa88), X(0x752d6c6c), X(0x33b0fa84), X(0x751928e0),
+  X(0x33def287), X(0x7504d345), X(0x340ce28b), X(0x74f06b9e),
+  X(0x343aca87), X(0x74dbf1ef), X(0x3468aa76), X(0x74c7663a),
+  X(0x34968250), X(0x74b2c884), X(0x34c4520d), X(0x749e18cd),
+  X(0x34f219a8), X(0x7489571c), X(0x351fd918), X(0x74748371),
+  X(0x354d9057), X(0x745f9dd1), X(0x357b3f5d), X(0x744aa63f),
+  X(0x35a8e625), X(0x74359cbd), X(0x35d684a6), X(0x74208150),
+  X(0x36041ad9), X(0x740b53fb), X(0x3631a8b8), X(0x73f614c0),
+  X(0x365f2e3b), X(0x73e0c3a3), X(0x368cab5c), X(0x73cb60a8),
+  X(0x36ba2014), X(0x73b5ebd1), X(0x36e78c5b), X(0x73a06522),
+  X(0x3714f02a), X(0x738acc9e), X(0x37424b7b), X(0x73752249),
+  X(0x376f9e46), X(0x735f6626), X(0x379ce885), X(0x73499838),
+  X(0x37ca2a30), X(0x7333b883), X(0x37f76341), X(0x731dc70a),
+  X(0x382493b0), X(0x7307c3d0), X(0x3851bb77), X(0x72f1aed9),
+  X(0x387eda8e), X(0x72db8828), X(0x38abf0ef), X(0x72c54fc1),
+  X(0x38d8fe93), X(0x72af05a7), X(0x39060373), X(0x7298a9dd),
+  X(0x3932ff87), X(0x72823c67), X(0x395ff2c9), X(0x726bbd48),
+  X(0x398cdd32), X(0x72552c85), X(0x39b9bebc), X(0x723e8a20),
+  X(0x39e6975e), X(0x7227d61c), X(0x3a136712), X(0x7211107e),
+  X(0x3a402dd2), X(0x71fa3949), X(0x3a6ceb96), X(0x71e35080),
+  X(0x3a99a057), X(0x71cc5626), X(0x3ac64c0f), X(0x71b54a41),
+  X(0x3af2eeb7), X(0x719e2cd2), X(0x3b1f8848), X(0x7186fdde),
+  X(0x3b4c18ba), X(0x716fbd68), X(0x3b78a007), X(0x71586b74),
+  X(0x3ba51e29), X(0x71410805), X(0x3bd19318), X(0x7129931f),
+  X(0x3bfdfecd), X(0x71120cc5), X(0x3c2a6142), X(0x70fa74fc),
+  X(0x3c56ba70), X(0x70e2cbc6), X(0x3c830a50), X(0x70cb1128),
+  X(0x3caf50da), X(0x70b34525), X(0x3cdb8e09), X(0x709b67c0),
+  X(0x3d07c1d6), X(0x708378ff), X(0x3d33ec39), X(0x706b78e3),
+  X(0x3d600d2c), X(0x70536771), X(0x3d8c24a8), X(0x703b44ad),
+  X(0x3db832a6), X(0x7023109a), X(0x3de4371f), X(0x700acb3c),
+  X(0x3e10320d), X(0x6ff27497), X(0x3e3c2369), X(0x6fda0cae),
+  X(0x3e680b2c), X(0x6fc19385), X(0x3e93e950), X(0x6fa90921),
+  X(0x3ebfbdcd), X(0x6f906d84), X(0x3eeb889c), X(0x6f77c0b3),
+  X(0x3f1749b8), X(0x6f5f02b2), X(0x3f430119), X(0x6f463383),
+  X(0x3f6eaeb8), X(0x6f2d532c), X(0x3f9a5290), X(0x6f1461b0),
+  X(0x3fc5ec98), X(0x6efb5f12), X(0x3ff17cca), X(0x6ee24b57),
+  X(0x401d0321), X(0x6ec92683), X(0x40487f94), X(0x6eaff099),
+  X(0x4073f21d), X(0x6e96a99d), X(0x409f5ab6), X(0x6e7d5193),
+  X(0x40cab958), X(0x6e63e87f), X(0x40f60dfb), X(0x6e4a6e66),
+  X(0x4121589b), X(0x6e30e34a), X(0x414c992f), X(0x6e174730),
+  X(0x4177cfb1), X(0x6dfd9a1c), X(0x41a2fc1a), X(0x6de3dc11),
+  X(0x41ce1e65), X(0x6dca0d14), X(0x41f93689), X(0x6db02d29),
+  X(0x42244481), X(0x6d963c54), X(0x424f4845), X(0x6d7c3a98),
+  X(0x427a41d0), X(0x6d6227fa), X(0x42a5311b), X(0x6d48047e),
+  X(0x42d0161e), X(0x6d2dd027), X(0x42faf0d4), X(0x6d138afb),
+  X(0x4325c135), X(0x6cf934fc), X(0x4350873c), X(0x6cdece2f),
+  X(0x437b42e1), X(0x6cc45698), X(0x43a5f41e), X(0x6ca9ce3b),
+  X(0x43d09aed), X(0x6c8f351c), X(0x43fb3746), X(0x6c748b3f),
+  X(0x4425c923), X(0x6c59d0a9), X(0x4450507e), X(0x6c3f055d),
+  X(0x447acd50), X(0x6c242960), X(0x44a53f93), X(0x6c093cb6),
+  X(0x44cfa740), X(0x6bee3f62), X(0x44fa0450), X(0x6bd3316a),
+  X(0x452456bd), X(0x6bb812d1), X(0x454e9e80), X(0x6b9ce39b),
+  X(0x4578db93), X(0x6b81a3cd), X(0x45a30df0), X(0x6b66536b),
+  X(0x45cd358f), X(0x6b4af279), X(0x45f7526b), X(0x6b2f80fb),
+  X(0x4621647d), X(0x6b13fef5), X(0x464b6bbe), X(0x6af86c6c),
+  X(0x46756828), X(0x6adcc964), X(0x469f59b4), X(0x6ac115e2),
+  X(0x46c9405c), X(0x6aa551e9), X(0x46f31c1a), X(0x6a897d7d),
+  X(0x471cece7), X(0x6a6d98a4), X(0x4746b2bc), X(0x6a51a361),
+  X(0x47706d93), X(0x6a359db9), X(0x479a1d67), X(0x6a1987b0),
+  X(0x47c3c22f), X(0x69fd614a), X(0x47ed5be6), X(0x69e12a8c),
+  X(0x4816ea86), X(0x69c4e37a), X(0x48406e08), X(0x69a88c19),
+  X(0x4869e665), X(0x698c246c), X(0x48935397), X(0x696fac78),
+  X(0x48bcb599), X(0x69532442), X(0x48e60c62), X(0x69368bce),
+  X(0x490f57ee), X(0x6919e320), X(0x49389836), X(0x68fd2a3d),
+  X(0x4961cd33), X(0x68e06129), X(0x498af6df), X(0x68c387e9),
+  X(0x49b41533), X(0x68a69e81), X(0x49dd282a), X(0x6889a4f6),
+  X(0x4a062fbd), X(0x686c9b4b), X(0x4a2f2be6), X(0x684f8186),
+  X(0x4a581c9e), X(0x683257ab), X(0x4a8101de), X(0x68151dbe),
+  X(0x4aa9dba2), X(0x67f7d3c5), X(0x4ad2a9e2), X(0x67da79c3),
+  X(0x4afb6c98), X(0x67bd0fbd), X(0x4b2423be), X(0x679f95b7),
+  X(0x4b4ccf4d), X(0x67820bb7), X(0x4b756f40), X(0x676471c0),
+  X(0x4b9e0390), X(0x6746c7d8), X(0x4bc68c36), X(0x67290e02),
+  X(0x4bef092d), X(0x670b4444), X(0x4c177a6e), X(0x66ed6aa1),
+  X(0x4c3fdff4), X(0x66cf8120), X(0x4c6839b7), X(0x66b187c3),
+  X(0x4c9087b1), X(0x66937e91), X(0x4cb8c9dd), X(0x6675658c),
+  X(0x4ce10034), X(0x66573cbb), X(0x4d092ab0), X(0x66390422),
+  X(0x4d31494b), X(0x661abbc5), X(0x4d595bfe), X(0x65fc63a9),
+  X(0x4d8162c4), X(0x65ddfbd3), X(0x4da95d96), X(0x65bf8447),
+  X(0x4dd14c6e), X(0x65a0fd0b), X(0x4df92f46), X(0x65826622),
+  X(0x4e210617), X(0x6563bf92), X(0x4e48d0dd), X(0x6545095f),
+  X(0x4e708f8f), X(0x6526438f), X(0x4e984229), X(0x65076e25),
+  X(0x4ebfe8a5), X(0x64e88926), X(0x4ee782fb), X(0x64c99498),
+  X(0x4f0f1126), X(0x64aa907f), X(0x4f369320), X(0x648b7ce0),
+  X(0x4f5e08e3), X(0x646c59bf), X(0x4f857269), X(0x644d2722),
+  X(0x4faccfab), X(0x642de50d), X(0x4fd420a4), X(0x640e9386),
+  X(0x4ffb654d), X(0x63ef3290), X(0x50229da1), X(0x63cfc231),
+  X(0x5049c999), X(0x63b0426d), X(0x5070e92f), X(0x6390b34a),
+  X(0x5097fc5e), X(0x637114cc), X(0x50bf031f), X(0x635166f9),
+  X(0x50e5fd6d), X(0x6331a9d4), X(0x510ceb40), X(0x6311dd64),
+  X(0x5133cc94), X(0x62f201ac), X(0x515aa162), X(0x62d216b3),
+  X(0x518169a5), X(0x62b21c7b), X(0x51a82555), X(0x6292130c),
+  X(0x51ced46e), X(0x6271fa69), X(0x51f576ea), X(0x6251d298),
+  X(0x521c0cc2), X(0x62319b9d), X(0x524295f0), X(0x6211557e),
+  X(0x5269126e), X(0x61f1003f), X(0x528f8238), X(0x61d09be5),
+  X(0x52b5e546), X(0x61b02876), X(0x52dc3b92), X(0x618fa5f7),
+  X(0x53028518), X(0x616f146c), X(0x5328c1d0), X(0x614e73da),
+  X(0x534ef1b5), X(0x612dc447), X(0x537514c2), X(0x610d05b7),
+  X(0x539b2af0), X(0x60ec3830), X(0x53c13439), X(0x60cb5bb7),
+  X(0x53e73097), X(0x60aa7050), X(0x540d2005), X(0x60897601),
+  X(0x5433027d), X(0x60686ccf), X(0x5458d7f9), X(0x604754bf),
+  X(0x547ea073), X(0x60262dd6), X(0x54a45be6), X(0x6004f819),
+  X(0x54ca0a4b), X(0x5fe3b38d), X(0x54efab9c), X(0x5fc26038),
+  X(0x55153fd4), X(0x5fa0fe1f), X(0x553ac6ee), X(0x5f7f8d46),
+  X(0x556040e2), X(0x5f5e0db3), X(0x5585adad), X(0x5f3c7f6b),
+  X(0x55ab0d46), X(0x5f1ae274), X(0x55d05faa), X(0x5ef936d1),
+  X(0x55f5a4d2), X(0x5ed77c8a), X(0x561adcb9), X(0x5eb5b3a2),
+  X(0x56400758), X(0x5e93dc1f), X(0x566524aa), X(0x5e71f606),
+  X(0x568a34a9), X(0x5e50015d), X(0x56af3750), X(0x5e2dfe29),
+  X(0x56d42c99), X(0x5e0bec6e), X(0x56f9147e), X(0x5de9cc33),
+  X(0x571deefa), X(0x5dc79d7c), X(0x5742bc06), X(0x5da5604f),
+  X(0x57677b9d), X(0x5d8314b1), X(0x578c2dba), X(0x5d60baa7),
+  X(0x57b0d256), X(0x5d3e5237), X(0x57d5696d), X(0x5d1bdb65),
+  X(0x57f9f2f8), X(0x5cf95638), X(0x581e6ef1), X(0x5cd6c2b5),
+  X(0x5842dd54), X(0x5cb420e0), X(0x58673e1b), X(0x5c9170bf),
+  X(0x588b9140), X(0x5c6eb258), X(0x58afd6bd), X(0x5c4be5b0),
+  X(0x58d40e8c), X(0x5c290acc), X(0x58f838a9), X(0x5c0621b2),
+  X(0x591c550e), X(0x5be32a67), X(0x594063b5), X(0x5bc024f0),
+  X(0x59646498), X(0x5b9d1154), X(0x598857b2), X(0x5b79ef96),
+  X(0x59ac3cfd), X(0x5b56bfbd), X(0x59d01475), X(0x5b3381ce),
+  X(0x59f3de12), X(0x5b1035cf), X(0x5a1799d1), X(0x5aecdbc5),
+  X(0x5a3b47ab), X(0x5ac973b5), X(0x5a5ee79a), X(0x5aa5fda5),
+  X(0x5a82799a), X(0x5a82799a)
+  };
+  
+  /* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */
+static LOOKUP_T sincos_lookup1[1024] = {
+  X(0x001921fb), X(0x7ffffd88), X(0x004b65ee), X(0x7fffe9cb),
+  X(0x007da9d4), X(0x7fffc251), X(0x00afeda8), X(0x7fff8719),
+  X(0x00e23160), X(0x7fff3824), X(0x011474f6), X(0x7ffed572),
+  X(0x0146b860), X(0x7ffe5f03), X(0x0178fb99), X(0x7ffdd4d7),
+  X(0x01ab3e97), X(0x7ffd36ee), X(0x01dd8154), X(0x7ffc8549),
+  X(0x020fc3c6), X(0x7ffbbfe6), X(0x024205e8), X(0x7ffae6c7),
+  X(0x027447b0), X(0x7ff9f9ec), X(0x02a68917), X(0x7ff8f954),
+  X(0x02d8ca16), X(0x7ff7e500), X(0x030b0aa4), X(0x7ff6bcf0),
+  X(0x033d4abb), X(0x7ff58125), X(0x036f8a51), X(0x7ff4319d),
+  X(0x03a1c960), X(0x7ff2ce5b), X(0x03d407df), X(0x7ff1575d),
+  X(0x040645c7), X(0x7fefcca4), X(0x04388310), X(0x7fee2e30),
+  X(0x046abfb3), X(0x7fec7c02), X(0x049cfba7), X(0x7feab61a),
+  X(0x04cf36e5), X(0x7fe8dc78), X(0x05017165), X(0x7fe6ef1c),
+  X(0x0533ab20), X(0x7fe4ee06), X(0x0565e40d), X(0x7fe2d938),
+  X(0x05981c26), X(0x7fe0b0b1), X(0x05ca5361), X(0x7fde7471),
+  X(0x05fc89b8), X(0x7fdc247a), X(0x062ebf22), X(0x7fd9c0ca),
+  X(0x0660f398), X(0x7fd74964), X(0x06932713), X(0x7fd4be46),
+  X(0x06c5598a), X(0x7fd21f72), X(0x06f78af6), X(0x7fcf6ce8),
+  X(0x0729bb4e), X(0x7fcca6a7), X(0x075bea8c), X(0x7fc9ccb2),
+  X(0x078e18a7), X(0x7fc6df08), X(0x07c04598), X(0x7fc3dda9),
+  X(0x07f27157), X(0x7fc0c896), X(0x08249bdd), X(0x7fbd9fd0),
+  X(0x0856c520), X(0x7fba6357), X(0x0888ed1b), X(0x7fb7132b),
+  X(0x08bb13c5), X(0x7fb3af4e), X(0x08ed3916), X(0x7fb037bf),
+  X(0x091f5d06), X(0x7facac7f), X(0x09517f8f), X(0x7fa90d8e),
+  X(0x0983a0a7), X(0x7fa55aee), X(0x09b5c048), X(0x7fa1949e),
+  X(0x09e7de6a), X(0x7f9dbaa0), X(0x0a19fb04), X(0x7f99ccf4),
+  X(0x0a4c1610), X(0x7f95cb9a), X(0x0a7e2f85), X(0x7f91b694),
+  X(0x0ab0475c), X(0x7f8d8de1), X(0x0ae25d8d), X(0x7f895182),
+  X(0x0b147211), X(0x7f850179), X(0x0b4684df), X(0x7f809dc5),
+  X(0x0b7895f0), X(0x7f7c2668), X(0x0baaa53b), X(0x7f779b62),
+  X(0x0bdcb2bb), X(0x7f72fcb4), X(0x0c0ebe66), X(0x7f6e4a5e),
+  X(0x0c40c835), X(0x7f698461), X(0x0c72d020), X(0x7f64aabf),
+  X(0x0ca4d620), X(0x7f5fbd77), X(0x0cd6da2d), X(0x7f5abc8a),
+  X(0x0d08dc3f), X(0x7f55a7fa), X(0x0d3adc4e), X(0x7f507fc7),
+  X(0x0d6cda53), X(0x7f4b43f2), X(0x0d9ed646), X(0x7f45f47b),
+  X(0x0dd0d01f), X(0x7f409164), X(0x0e02c7d7), X(0x7f3b1aad),
+  X(0x0e34bd66), X(0x7f359057), X(0x0e66b0c3), X(0x7f2ff263),
+  X(0x0e98a1e9), X(0x7f2a40d2), X(0x0eca90ce), X(0x7f247ba5),
+  X(0x0efc7d6b), X(0x7f1ea2dc), X(0x0f2e67b8), X(0x7f18b679),
+  X(0x0f604faf), X(0x7f12b67c), X(0x0f923546), X(0x7f0ca2e7),
+  X(0x0fc41876), X(0x7f067bba), X(0x0ff5f938), X(0x7f0040f6),
+  X(0x1027d784), X(0x7ef9f29d), X(0x1059b352), X(0x7ef390ae),
+  X(0x108b8c9b), X(0x7eed1b2c), X(0x10bd6356), X(0x7ee69217),
+  X(0x10ef377d), X(0x7edff570), X(0x11210907), X(0x7ed94538),
+  X(0x1152d7ed), X(0x7ed28171), X(0x1184a427), X(0x7ecbaa1a),
+  X(0x11b66dad), X(0x7ec4bf36), X(0x11e83478), X(0x7ebdc0c6),
+  X(0x1219f880), X(0x7eb6aeca), X(0x124bb9be), X(0x7eaf8943),
+  X(0x127d7829), X(0x7ea85033), X(0x12af33ba), X(0x7ea1039b),
+  X(0x12e0ec6a), X(0x7e99a37c), X(0x1312a230), X(0x7e922fd6),
+  X(0x13445505), X(0x7e8aa8ac), X(0x137604e2), X(0x7e830dff),
+  X(0x13a7b1bf), X(0x7e7b5fce), X(0x13d95b93), X(0x7e739e1d),
+  X(0x140b0258), X(0x7e6bc8eb), X(0x143ca605), X(0x7e63e03b),
+  X(0x146e4694), X(0x7e5be40c), X(0x149fe3fc), X(0x7e53d462),
+  X(0x14d17e36), X(0x7e4bb13c), X(0x1503153a), X(0x7e437a9c),
+  X(0x1534a901), X(0x7e3b3083), X(0x15663982), X(0x7e32d2f4),
+  X(0x1597c6b7), X(0x7e2a61ed), X(0x15c95097), X(0x7e21dd73),
+  X(0x15fad71b), X(0x7e194584), X(0x162c5a3b), X(0x7e109a24),
+  X(0x165dd9f0), X(0x7e07db52), X(0x168f5632), X(0x7dff0911),
+  X(0x16c0cef9), X(0x7df62362), X(0x16f2443e), X(0x7ded2a47),
+  X(0x1723b5f9), X(0x7de41dc0), X(0x17552422), X(0x7ddafdce),
+  X(0x17868eb3), X(0x7dd1ca75), X(0x17b7f5a3), X(0x7dc883b4),
+  X(0x17e958ea), X(0x7dbf298d), X(0x181ab881), X(0x7db5bc02),
+  X(0x184c1461), X(0x7dac3b15), X(0x187d6c82), X(0x7da2a6c6),
+  X(0x18aec0db), X(0x7d98ff17), X(0x18e01167), X(0x7d8f4409),
+  X(0x19115e1c), X(0x7d85759f), X(0x1942a6f3), X(0x7d7b93da),
+  X(0x1973ebe6), X(0x7d719eba), X(0x19a52ceb), X(0x7d679642),
+  X(0x19d669fc), X(0x7d5d7a74), X(0x1a07a311), X(0x7d534b50),
+  X(0x1a38d823), X(0x7d4908d9), X(0x1a6a0929), X(0x7d3eb30f),
+  X(0x1a9b361d), X(0x7d3449f5), X(0x1acc5ef6), X(0x7d29cd8c),
+  X(0x1afd83ad), X(0x7d1f3dd6), X(0x1b2ea43a), X(0x7d149ad5),
+  X(0x1b5fc097), X(0x7d09e489), X(0x1b90d8bb), X(0x7cff1af5),
+  X(0x1bc1ec9e), X(0x7cf43e1a), X(0x1bf2fc3a), X(0x7ce94dfb),
+  X(0x1c240786), X(0x7cde4a98), X(0x1c550e7c), X(0x7cd333f3),
+  X(0x1c861113), X(0x7cc80a0f), X(0x1cb70f43), X(0x7cbcccec),
+  X(0x1ce80906), X(0x7cb17c8d), X(0x1d18fe54), X(0x7ca618f3),
+  X(0x1d49ef26), X(0x7c9aa221), X(0x1d7adb73), X(0x7c8f1817),
+  X(0x1dabc334), X(0x7c837ad8), X(0x1ddca662), X(0x7c77ca65),
+  X(0x1e0d84f5), X(0x7c6c06c0), X(0x1e3e5ee5), X(0x7c602fec),
+  X(0x1e6f342c), X(0x7c5445e9), X(0x1ea004c1), X(0x7c4848ba),
+  X(0x1ed0d09d), X(0x7c3c3860), X(0x1f0197b8), X(0x7c3014de),
+  X(0x1f325a0b), X(0x7c23de35), X(0x1f63178f), X(0x7c179467),
+  X(0x1f93d03c), X(0x7c0b3777), X(0x1fc4840a), X(0x7bfec765),
+  X(0x1ff532f2), X(0x7bf24434), X(0x2025dcec), X(0x7be5ade6),
+  X(0x205681f1), X(0x7bd9047c), X(0x208721f9), X(0x7bcc47fa),
+  X(0x20b7bcfe), X(0x7bbf7860), X(0x20e852f6), X(0x7bb295b0),
+  X(0x2118e3dc), X(0x7ba59fee), X(0x21496fa7), X(0x7b989719),
+  X(0x2179f64f), X(0x7b8b7b36), X(0x21aa77cf), X(0x7b7e4c45),
+  X(0x21daf41d), X(0x7b710a49), X(0x220b6b32), X(0x7b63b543),
+  X(0x223bdd08), X(0x7b564d36), X(0x226c4996), X(0x7b48d225),
+  X(0x229cb0d5), X(0x7b3b4410), X(0x22cd12bd), X(0x7b2da2fa),
+  X(0x22fd6f48), X(0x7b1feee5), X(0x232dc66d), X(0x7b1227d3),
+  X(0x235e1826), X(0x7b044dc7), X(0x238e646a), X(0x7af660c2),
+  X(0x23beab33), X(0x7ae860c7), X(0x23eeec78), X(0x7ada4dd8),
+  X(0x241f2833), X(0x7acc27f7), X(0x244f5e5c), X(0x7abdef25),
+  X(0x247f8eec), X(0x7aafa367), X(0x24afb9da), X(0x7aa144bc),
+  X(0x24dfdf20), X(0x7a92d329), X(0x250ffeb7), X(0x7a844eae),
+  X(0x25401896), X(0x7a75b74f), X(0x25702cb7), X(0x7a670d0d),
+  X(0x25a03b11), X(0x7a584feb), X(0x25d0439f), X(0x7a497feb),
+  X(0x26004657), X(0x7a3a9d0f), X(0x26304333), X(0x7a2ba75a),
+  X(0x26603a2c), X(0x7a1c9ece), X(0x26902b39), X(0x7a0d836d),
+  X(0x26c01655), X(0x79fe5539), X(0x26effb76), X(0x79ef1436),
+  X(0x271fda96), X(0x79dfc064), X(0x274fb3ae), X(0x79d059c8),
+  X(0x277f86b5), X(0x79c0e062), X(0x27af53a6), X(0x79b15435),
+  X(0x27df1a77), X(0x79a1b545), X(0x280edb23), X(0x79920392),
+  X(0x283e95a1), X(0x79823f20), X(0x286e49ea), X(0x797267f2),
+  X(0x289df7f8), X(0x79627e08), X(0x28cd9fc1), X(0x79528167),
+  X(0x28fd4140), X(0x79427210), X(0x292cdc6d), X(0x79325006),
+  X(0x295c7140), X(0x79221b4b), X(0x298bffb2), X(0x7911d3e2),
+  X(0x29bb87bc), X(0x790179cd), X(0x29eb0957), X(0x78f10d0f),
+  X(0x2a1a847b), X(0x78e08dab), X(0x2a49f920), X(0x78cffba3),
+  X(0x2a796740), X(0x78bf56f9), X(0x2aa8ced3), X(0x78ae9fb0),
+  X(0x2ad82fd2), X(0x789dd5cb), X(0x2b078a36), X(0x788cf94c),
+  X(0x2b36ddf7), X(0x787c0a36), X(0x2b662b0e), X(0x786b088c),
+  X(0x2b957173), X(0x7859f44f), X(0x2bc4b120), X(0x7848cd83),
+  X(0x2bf3ea0d), X(0x7837942b), X(0x2c231c33), X(0x78264849),
+  X(0x2c52478a), X(0x7814e9df), X(0x2c816c0c), X(0x780378f1),
+  X(0x2cb089b1), X(0x77f1f581), X(0x2cdfa071), X(0x77e05f91),
+  X(0x2d0eb046), X(0x77ceb725), X(0x2d3db928), X(0x77bcfc3f),
+  X(0x2d6cbb10), X(0x77ab2ee2), X(0x2d9bb5f6), X(0x77994f11),
+  X(0x2dcaa9d5), X(0x77875cce), X(0x2df996a3), X(0x7775581d),
+  X(0x2e287c5a), X(0x776340ff), X(0x2e575af3), X(0x77511778),
+  X(0x2e863267), X(0x773edb8b), X(0x2eb502ae), X(0x772c8d3a),
+  X(0x2ee3cbc1), X(0x771a2c88), X(0x2f128d99), X(0x7707b979),
+  X(0x2f41482e), X(0x76f5340e), X(0x2f6ffb7a), X(0x76e29c4b),
+  X(0x2f9ea775), X(0x76cff232), X(0x2fcd4c19), X(0x76bd35c7),
+  X(0x2ffbe95d), X(0x76aa670d), X(0x302a7f3a), X(0x76978605),
+  X(0x30590dab), X(0x768492b4), X(0x308794a6), X(0x76718d1c),
+  X(0x30b61426), X(0x765e7540), X(0x30e48c22), X(0x764b4b23),
+  X(0x3112fc95), X(0x76380ec8), X(0x31416576), X(0x7624c031),
+  X(0x316fc6be), X(0x76115f63), X(0x319e2067), X(0x75fdec60),
+  X(0x31cc7269), X(0x75ea672a), X(0x31fabcbd), X(0x75d6cfc5),
+  X(0x3228ff5c), X(0x75c32634), X(0x32573a3f), X(0x75af6a7b),
+  X(0x32856d5e), X(0x759b9c9b), X(0x32b398b3), X(0x7587bc98),
+  X(0x32e1bc36), X(0x7573ca75), X(0x330fd7e1), X(0x755fc635),
+  X(0x333debab), X(0x754bafdc), X(0x336bf78f), X(0x7537876c),
+  X(0x3399fb85), X(0x75234ce8), X(0x33c7f785), X(0x750f0054),
+  X(0x33f5eb89), X(0x74faa1b3), X(0x3423d78a), X(0x74e63108),
+  X(0x3451bb81), X(0x74d1ae55), X(0x347f9766), X(0x74bd199f),
+  X(0x34ad6b32), X(0x74a872e8), X(0x34db36df), X(0x7493ba34),
+  X(0x3508fa66), X(0x747eef85), X(0x3536b5be), X(0x746a12df),
+  X(0x356468e2), X(0x74552446), X(0x359213c9), X(0x744023bc),
+  X(0x35bfb66e), X(0x742b1144), X(0x35ed50c9), X(0x7415ece2),
+  X(0x361ae2d3), X(0x7400b69a), X(0x36486c86), X(0x73eb6e6e),
+  X(0x3675edd9), X(0x73d61461), X(0x36a366c6), X(0x73c0a878),
+  X(0x36d0d746), X(0x73ab2ab4), X(0x36fe3f52), X(0x73959b1b),
+  X(0x372b9ee3), X(0x737ff9ae), X(0x3758f5f2), X(0x736a4671),
+  X(0x37864477), X(0x73548168), X(0x37b38a6d), X(0x733eaa96),
+  X(0x37e0c7cc), X(0x7328c1ff), X(0x380dfc8d), X(0x7312c7a5),
+  X(0x383b28a9), X(0x72fcbb8c), X(0x38684c19), X(0x72e69db7),
+  X(0x389566d6), X(0x72d06e2b), X(0x38c278d9), X(0x72ba2cea),
+  X(0x38ef821c), X(0x72a3d9f7), X(0x391c8297), X(0x728d7557),
+  X(0x39497a43), X(0x7276ff0d), X(0x39766919), X(0x7260771b),
+  X(0x39a34f13), X(0x7249dd86), X(0x39d02c2a), X(0x72333251),
+  X(0x39fd0056), X(0x721c7580), X(0x3a29cb91), X(0x7205a716),
+  X(0x3a568dd4), X(0x71eec716), X(0x3a834717), X(0x71d7d585),
+  X(0x3aaff755), X(0x71c0d265), X(0x3adc9e86), X(0x71a9bdba),
+  X(0x3b093ca3), X(0x71929789), X(0x3b35d1a5), X(0x717b5fd3),
+  X(0x3b625d86), X(0x7164169d), X(0x3b8ee03e), X(0x714cbbeb),
+  X(0x3bbb59c7), X(0x71354fc0), X(0x3be7ca1a), X(0x711dd220),
+  X(0x3c143130), X(0x7106430e), X(0x3c408f03), X(0x70eea28e),
+  X(0x3c6ce38a), X(0x70d6f0a4), X(0x3c992ec0), X(0x70bf2d53),
+  X(0x3cc5709e), X(0x70a7589f), X(0x3cf1a91c), X(0x708f728b),
+  X(0x3d1dd835), X(0x70777b1c), X(0x3d49fde1), X(0x705f7255),
+  X(0x3d761a19), X(0x70475839), X(0x3da22cd7), X(0x702f2ccd),
+  X(0x3dce3614), X(0x7016f014), X(0x3dfa35c8), X(0x6ffea212),
+  X(0x3e262bee), X(0x6fe642ca), X(0x3e52187f), X(0x6fcdd241),
+  X(0x3e7dfb73), X(0x6fb5507a), X(0x3ea9d4c3), X(0x6f9cbd79),
+  X(0x3ed5a46b), X(0x6f841942), X(0x3f016a61), X(0x6f6b63d8),
+  X(0x3f2d26a0), X(0x6f529d40), X(0x3f58d921), X(0x6f39c57d),
+  X(0x3f8481dd), X(0x6f20dc92), X(0x3fb020ce), X(0x6f07e285),
+  X(0x3fdbb5ec), X(0x6eeed758), X(0x40074132), X(0x6ed5bb10),
+  X(0x4032c297), X(0x6ebc8db0), X(0x405e3a16), X(0x6ea34f3d),
+  X(0x4089a7a8), X(0x6e89ffb9), X(0x40b50b46), X(0x6e709f2a),
+  X(0x40e064ea), X(0x6e572d93), X(0x410bb48c), X(0x6e3daaf8),
+  X(0x4136fa27), X(0x6e24175c), X(0x416235b2), X(0x6e0a72c5),
+  X(0x418d6729), X(0x6df0bd35), X(0x41b88e84), X(0x6dd6f6b1),
+  X(0x41e3abbc), X(0x6dbd1f3c), X(0x420ebecb), X(0x6da336dc),
+  X(0x4239c7aa), X(0x6d893d93), X(0x4264c653), X(0x6d6f3365),
+  X(0x428fbabe), X(0x6d551858), X(0x42baa4e6), X(0x6d3aec6e),
+  X(0x42e584c3), X(0x6d20afac), X(0x43105a50), X(0x6d066215),
+  X(0x433b2585), X(0x6cec03af), X(0x4365e65b), X(0x6cd1947c),
+  X(0x43909ccd), X(0x6cb71482), X(0x43bb48d4), X(0x6c9c83c3),
+  X(0x43e5ea68), X(0x6c81e245), X(0x44108184), X(0x6c67300b),
+  X(0x443b0e21), X(0x6c4c6d1a), X(0x44659039), X(0x6c319975),
+  X(0x449007c4), X(0x6c16b521), X(0x44ba74bd), X(0x6bfbc021),
+  X(0x44e4d71c), X(0x6be0ba7b), X(0x450f2edb), X(0x6bc5a431),
+  X(0x45397bf4), X(0x6baa7d49), X(0x4563be60), X(0x6b8f45c7),
+  X(0x458df619), X(0x6b73fdae), X(0x45b82318), X(0x6b58a503),
+  X(0x45e24556), X(0x6b3d3bcb), X(0x460c5cce), X(0x6b21c208),
+  X(0x46366978), X(0x6b0637c1), X(0x46606b4e), X(0x6aea9cf8),
+  X(0x468a624a), X(0x6acef1b2), X(0x46b44e65), X(0x6ab335f4),
+  X(0x46de2f99), X(0x6a9769c1), X(0x470805df), X(0x6a7b8d1e),
+  X(0x4731d131), X(0x6a5fa010), X(0x475b9188), X(0x6a43a29a),
+  X(0x478546de), X(0x6a2794c1), X(0x47aef12c), X(0x6a0b7689),
+  X(0x47d8906d), X(0x69ef47f6), X(0x48022499), X(0x69d3090e),
+  X(0x482badab), X(0x69b6b9d3), X(0x48552b9b), X(0x699a5a4c),
+  X(0x487e9e64), X(0x697dea7b), X(0x48a805ff), X(0x69616a65),
+  X(0x48d16265), X(0x6944da10), X(0x48fab391), X(0x6928397e),
+  X(0x4923f97b), X(0x690b88b5), X(0x494d341e), X(0x68eec7b9),
+  X(0x49766373), X(0x68d1f68f), X(0x499f8774), X(0x68b5153a),
+  X(0x49c8a01b), X(0x689823bf), X(0x49f1ad61), X(0x687b2224),
+  X(0x4a1aaf3f), X(0x685e106c), X(0x4a43a5b0), X(0x6840ee9b),
+  X(0x4a6c90ad), X(0x6823bcb7), X(0x4a957030), X(0x68067ac3),
+  X(0x4abe4433), X(0x67e928c5), X(0x4ae70caf), X(0x67cbc6c0),
+  X(0x4b0fc99d), X(0x67ae54ba), X(0x4b387af9), X(0x6790d2b6),
+  X(0x4b6120bb), X(0x677340ba), X(0x4b89badd), X(0x67559eca),
+  X(0x4bb24958), X(0x6737ecea), X(0x4bdacc28), X(0x671a2b20),
+  X(0x4c034345), X(0x66fc596f), X(0x4c2baea9), X(0x66de77dc),
+  X(0x4c540e4e), X(0x66c0866d), X(0x4c7c622d), X(0x66a28524),
+  X(0x4ca4aa41), X(0x66847408), X(0x4ccce684), X(0x6666531d),
+  X(0x4cf516ee), X(0x66482267), X(0x4d1d3b7a), X(0x6629e1ec),
+  X(0x4d455422), X(0x660b91af), X(0x4d6d60df), X(0x65ed31b5),
+  X(0x4d9561ac), X(0x65cec204), X(0x4dbd5682), X(0x65b0429f),
+  X(0x4de53f5a), X(0x6591b38c), X(0x4e0d1c30), X(0x657314cf),
+  X(0x4e34ecfc), X(0x6554666d), X(0x4e5cb1b9), X(0x6535a86b),
+  X(0x4e846a60), X(0x6516dacd), X(0x4eac16eb), X(0x64f7fd98),
+  X(0x4ed3b755), X(0x64d910d1), X(0x4efb4b96), X(0x64ba147d),
+  X(0x4f22d3aa), X(0x649b08a0), X(0x4f4a4f89), X(0x647bed3f),
+  X(0x4f71bf2e), X(0x645cc260), X(0x4f992293), X(0x643d8806),
+  X(0x4fc079b1), X(0x641e3e38), X(0x4fe7c483), X(0x63fee4f8),
+  X(0x500f0302), X(0x63df7c4d), X(0x50363529), X(0x63c0043b),
+  X(0x505d5af1), X(0x63a07cc7), X(0x50847454), X(0x6380e5f6),
+  X(0x50ab814d), X(0x63613fcd), X(0x50d281d5), X(0x63418a50),
+  X(0x50f975e6), X(0x6321c585), X(0x51205d7b), X(0x6301f171),
+  X(0x5147388c), X(0x62e20e17), X(0x516e0715), X(0x62c21b7e),
+  X(0x5194c910), X(0x62a219aa), X(0x51bb7e75), X(0x628208a1),
+  X(0x51e22740), X(0x6261e866), X(0x5208c36a), X(0x6241b8ff),
+  X(0x522f52ee), X(0x62217a72), X(0x5255d5c5), X(0x62012cc2),
+  X(0x527c4bea), X(0x61e0cff5), X(0x52a2b556), X(0x61c06410),
+  X(0x52c91204), X(0x619fe918), X(0x52ef61ee), X(0x617f5f12),
+  X(0x5315a50e), X(0x615ec603), X(0x533bdb5d), X(0x613e1df0),
+  X(0x536204d7), X(0x611d66de), X(0x53882175), X(0x60fca0d2),
+  X(0x53ae3131), X(0x60dbcbd1), X(0x53d43406), X(0x60bae7e1),
+  X(0x53fa29ed), X(0x6099f505), X(0x542012e1), X(0x6078f344),
+  X(0x5445eedb), X(0x6057e2a2), X(0x546bbdd7), X(0x6036c325),
+  X(0x54917fce), X(0x601594d1), X(0x54b734ba), X(0x5ff457ad),
+  X(0x54dcdc96), X(0x5fd30bbc), X(0x5502775c), X(0x5fb1b104),
+  X(0x55280505), X(0x5f90478a), X(0x554d858d), X(0x5f6ecf53),
+  X(0x5572f8ed), X(0x5f4d4865), X(0x55985f20), X(0x5f2bb2c5),
+  X(0x55bdb81f), X(0x5f0a0e77), X(0x55e303e6), X(0x5ee85b82),
+  X(0x5608426e), X(0x5ec699e9), X(0x562d73b2), X(0x5ea4c9b3),
+  X(0x565297ab), X(0x5e82eae5), X(0x5677ae54), X(0x5e60fd84),
+  X(0x569cb7a8), X(0x5e3f0194), X(0x56c1b3a1), X(0x5e1cf71c),
+  X(0x56e6a239), X(0x5dfade20), X(0x570b8369), X(0x5dd8b6a7),
+  X(0x5730572e), X(0x5db680b4), X(0x57551d80), X(0x5d943c4e),
+  X(0x5779d65b), X(0x5d71e979), X(0x579e81b8), X(0x5d4f883b),
+  X(0x57c31f92), X(0x5d2d189a), X(0x57e7afe4), X(0x5d0a9a9a),
+  X(0x580c32a7), X(0x5ce80e41), X(0x5830a7d6), X(0x5cc57394),
+  X(0x58550f6c), X(0x5ca2ca99), X(0x58796962), X(0x5c801354),
+  X(0x589db5b3), X(0x5c5d4dcc), X(0x58c1f45b), X(0x5c3a7a05),
+  X(0x58e62552), X(0x5c179806), X(0x590a4893), X(0x5bf4a7d2),
+  X(0x592e5e19), X(0x5bd1a971), X(0x595265df), X(0x5bae9ce7),
+  X(0x59765fde), X(0x5b8b8239), X(0x599a4c12), X(0x5b68596d),
+  X(0x59be2a74), X(0x5b452288), X(0x59e1faff), X(0x5b21dd90),
+  X(0x5a05bdae), X(0x5afe8a8b), X(0x5a29727b), X(0x5adb297d),
+  X(0x5a4d1960), X(0x5ab7ba6c), X(0x5a70b258), X(0x5a943d5e),
+};
+  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/misc.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,244 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: miscellaneous math and prototypes
+
+ ********************************************************************/
+
+#ifndef _V_RANDOM_H_
+#define _V_RANDOM_H_
+#include "ivorbiscodec.h"
+#include "os.h"
+
+#include "asm_arm.h"
+#include <stdlib.h> /* for abs() */
+  
+#ifndef _V_WIDE_MATH
+#define _V_WIDE_MATH
+  
+#ifndef  _LOW_ACCURACY_
+/* 64 bit multiply */
+
+#if !(defined WIN32 && defined WINCE)
+#include <sys/types.h>
+#endif
+
+#if BYTE_ORDER==LITTLE_ENDIAN
+union magic {
+  struct {
+    ogg_int32_t lo;
+    ogg_int32_t hi;
+  } halves;
+  ogg_int64_t whole;
+};
+#endif 
+
+#if BYTE_ORDER==BIG_ENDIAN
+/*union magic {
+  struct {
+    ogg_int32_t hi;
+    ogg_int32_t lo;
+  } halves;
+  ogg_int64_t whole;
+};*/
+#endif
+
+STIN ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
+  union magic magic;
+  magic.whole = (ogg_int64_t)x * y;
+  return magic.halves.hi;
+}
+
+STIN ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
+  return MULT32(x,y)<<1;
+}
+
+STIN ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
+  union magic magic;
+  magic.whole  = (ogg_int64_t)x * y;
+  return ((ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17);
+}
+
+#else
+/* 32 bit multiply, more portable but less accurate */
+
+/*
+ * Note: Precision is biased towards the first argument therefore ordering
+ * is important.  Shift values were chosen for the best sound quality after
+ * many listening tests.
+ */
+
+/*
+ * For MULT32 and MULT31: The second argument is always a lookup table
+ * value already preshifted from 31 to 8 bits.  We therefore take the 
+ * opportunity to save on text space and use unsigned char for those
+ * tables in this case.
+ */
+
+STIN ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
+  return (x >> 9) * y;  /* y preshifted >>23 */
+}
+
+STIN ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
+  return (x >> 8) * y;  /* y preshifted >>23 */
+}
+
+STIN ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
+  return (x >> 6) * y;  /* y preshifted >>9 */
+}
+
+#endif
+
+/*
+ * This should be used as a memory barrier, forcing all cached values in
+ * registers to wr writen back to memory.  Might or might not be beneficial
+ * depending on the architecture and compiler.
+ */
+#define MB()
+
+/*
+ * The XPROD functions are meant to optimize the cross products found all
+ * over the place in mdct.c by forcing memory operation ordering to avoid
+ * unnecessary register reloads as soon as memory is being written to.
+ * However this is only beneficial on CPUs with a sane number of general
+ * purpose registers which exclude the Intel x86.  On Intel, better let the
+ * compiler actually reload registers directly from original memory by using
+ * macros.
+ */
+
+#ifdef __i386__
+
+#define XPROD32(_a, _b, _t, _v, _x, _y)		\
+  { *(_x)=MULT32(_a,_t)+MULT32(_b,_v);		\
+    *(_y)=MULT32(_b,_t)-MULT32(_a,_v); }
+#define XPROD31(_a, _b, _t, _v, _x, _y)		\
+  { *(_x)=MULT31(_a,_t)+MULT31(_b,_v);		\
+    *(_y)=MULT31(_b,_t)-MULT31(_a,_v); }
+#define XNPROD31(_a, _b, _t, _v, _x, _y)	\
+  { *(_x)=MULT31(_a,_t)-MULT31(_b,_v);		\
+    *(_y)=MULT31(_b,_t)+MULT31(_a,_v); }
+
+#else
+
+STIN void XPROD32(ogg_int32_t  a, ogg_int32_t  b,
+			   ogg_int32_t  t, ogg_int32_t  v,
+			   ogg_int32_t *x, ogg_int32_t *y)
+{
+  *x = MULT32(a, t) + MULT32(b, v);
+  *y = MULT32(b, t) - MULT32(a, v);
+}
+
+STIN void XPROD31(ogg_int32_t  a, ogg_int32_t  b,
+			   ogg_int32_t  t, ogg_int32_t  v,
+			   ogg_int32_t *x, ogg_int32_t *y)
+{
+  *x = MULT31(a, t) + MULT31(b, v);
+  *y = MULT31(b, t) - MULT31(a, v);
+}
+
+STIN void XNPROD31(ogg_int32_t  a, ogg_int32_t  b,
+			    ogg_int32_t  t, ogg_int32_t  v,
+			    ogg_int32_t *x, ogg_int32_t *y)
+{
+  *x = MULT31(a, t) - MULT31(b, v);
+  *y = MULT31(b, t) + MULT31(a, v);
+}
+
+#endif
+
+#endif
+
+#ifndef _V_CLIP_MATH
+#define _V_CLIP_MATH
+
+STIN ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
+  int ret=x;
+  ret-= ((x<=32767)-1)&(x-32767);
+  ret-= ((x>=-32768)-1)&(x+32768);
+  return(ret);
+}
+
+#endif
+
+STIN ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap,
+				      ogg_int32_t b,ogg_int32_t bp,
+				      ogg_int32_t *p){
+  if(a && b){
+#ifndef _LOW_ACCURACY_
+    *p=ap+bp+32;
+    return MULT32(a,b);
+#else
+    *p=ap+bp+31;
+    return (a>>15)*(b>>16); 
+#endif
+  }else
+    return 0;
+}
+
+int _ilog(unsigned int);
+
+STIN ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap,
+				      ogg_int32_t i,
+				      ogg_int32_t *p){
+
+  int ip=_ilog(abs(i))-31;
+  return VFLOAT_MULT(a,ap,i<<-ip,ip,p);
+}
+
+STIN ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap,
+				      ogg_int32_t b,ogg_int32_t bp,
+				      ogg_int32_t *p){
+
+  if(!a){
+    *p=bp;
+    return b;
+  }else if(!b){
+    *p=ap;
+    return a;
+  }
+
+  /* yes, this can leak a bit. */
+  if(ap>bp){
+    int shift=ap-bp+1;
+    *p=ap+1;
+    a>>=1;
+    if(shift<32){
+      b=(b+(1<<(shift-1)))>>shift;
+    }else{
+      b=0;
+    }
+  }else{
+    int shift=bp-ap+1;
+    *p=bp+1;
+    b>>=1;
+    if(shift<32){
+      a=(a+(1<<(shift-1)))>>shift;
+    }else{
+      a=0;
+    }
+  }
+
+  a+=b;
+  if((a&0xc0000000)==0xc0000000 || 
+     (a&0xc0000000)==0){
+    a<<=1;
+    (*p)--;
+  }
+  return(a);
+}
+
+#endif
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/ogg.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,206 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: subsumed libogg includes
+
+ ********************************************************************/
+#ifndef _OGG_H
+#define _OGG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "os_types.h"
+
+typedef struct ogg_buffer_state{
+  struct ogg_buffer    *unused_buffers;
+  struct ogg_reference *unused_references;
+  int                   outstanding;
+  int                   shutdown;
+} ogg_buffer_state;
+
+typedef struct ogg_buffer {
+  unsigned char      *data;
+  long                size;
+  int                 refcount;
+  
+  union {
+    ogg_buffer_state  *owner;
+    struct ogg_buffer *next;
+  } ptr;
+} ogg_buffer;
+
+typedef struct ogg_reference {
+  ogg_buffer    *buffer;
+  long           begin;
+  long           length;
+
+  struct ogg_reference *next;
+} ogg_reference;
+
+typedef struct oggpack_buffer {
+  int            headbit;
+  unsigned char *headptr;
+  long           headend;
+
+  /* memory management */
+  ogg_reference *head;
+  ogg_reference *tail;
+
+  /* render the byte/bit counter API constant time */
+  long              count; /* doesn't count the tail */
+} oggpack_buffer;
+
+typedef struct oggbyte_buffer {
+  ogg_reference *baseref;
+
+  ogg_reference *ref;
+  unsigned char *ptr;
+  long           pos;
+  long           end;
+} oggbyte_buffer;
+
+typedef struct ogg_sync_state {
+  /* decode memory management pool */
+  ogg_buffer_state *bufferpool;
+
+  /* stream buffers */
+  ogg_reference    *fifo_head;
+  ogg_reference    *fifo_tail;
+  long              fifo_fill;
+
+  /* stream sync management */
+  int               unsynced;
+  int               headerbytes;
+  int               bodybytes;
+
+} ogg_sync_state;
+
+typedef struct ogg_stream_state {
+  ogg_reference *header_head;
+  ogg_reference *header_tail;
+  ogg_reference *body_head;
+  ogg_reference *body_tail;
+
+  int            e_o_s;    /* set when we have buffered the last
+                              packet in the logical bitstream */
+  int            b_o_s;    /* set after we've written the initial page
+                              of a logical bitstream */
+  long           serialno;
+  long           pageno;
+  ogg_int64_t    packetno; /* sequence number for decode; the framing
+                              knows where there's a hole in the data,
+                              but we need coupling so that the codec
+                              (which is in a seperate abstraction
+                              layer) also knows about the gap */
+  ogg_int64_t    granulepos;
+
+  int            lacing_fill;
+  ogg_uint32_t   body_fill;
+
+  /* decode-side state data */
+  int            holeflag;
+  int            spanflag;
+  int            clearflag;
+  int            laceptr;
+  ogg_uint32_t   body_fill_next;
+  
+} ogg_stream_state;
+
+typedef struct {
+  ogg_reference *packet;
+  long           bytes;
+  long           b_o_s;
+  long           e_o_s;
+  ogg_int64_t    granulepos;
+  ogg_int64_t    packetno;     /* sequence number for decode; the framing
+                                  knows where there's a hole in the data,
+                                  but we need coupling so that the codec
+                                  (which is in a seperate abstraction
+                                  layer) also knows about the gap */
+} ogg_packet;
+
+typedef struct {
+  ogg_reference *header;
+  int            header_len;
+  ogg_reference *body;
+  long           body_len;
+} ogg_page;
+
+/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
+
+extern void  oggpack_readinit(oggpack_buffer *b,ogg_reference *r);
+extern long  oggpack_look(oggpack_buffer *b,int bits);
+extern void  oggpack_adv(oggpack_buffer *b,int bits);
+extern long  oggpack_read(oggpack_buffer *b,int bits);
+extern long  oggpack_bytes(oggpack_buffer *b);
+extern long  oggpack_bits(oggpack_buffer *b);
+extern int   oggpack_eop(oggpack_buffer *b);
+
+/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
+
+extern ogg_sync_state *ogg_sync_create(void);
+extern int      ogg_sync_destroy(ogg_sync_state *oy);
+extern int      ogg_sync_reset(ogg_sync_state *oy);
+
+extern unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long size);
+extern int      ogg_sync_wrote(ogg_sync_state *oy, long bytes);
+extern long     ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
+extern int      ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
+extern int      ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
+extern int      ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
+extern int      ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
+
+/* Ogg BITSTREAM PRIMITIVES: general ***************************/
+
+extern ogg_stream_state *ogg_stream_create(int serialno);
+extern int      ogg_stream_destroy(ogg_stream_state *os);
+extern int      ogg_stream_reset(ogg_stream_state *os);
+extern int      ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
+extern int      ogg_stream_eos(ogg_stream_state *os);
+
+extern int      ogg_page_checksum_set(ogg_page *og);
+
+extern int      ogg_page_version(ogg_page *og);
+extern int      ogg_page_continued(ogg_page *og);
+extern int      ogg_page_bos(ogg_page *og);
+extern int      ogg_page_eos(ogg_page *og);
+extern ogg_int64_t  ogg_page_granulepos(ogg_page *og);
+extern ogg_uint32_t ogg_page_serialno(ogg_page *og);
+extern ogg_uint32_t ogg_page_pageno(ogg_page *og);
+extern int      ogg_page_packets(ogg_page *og);
+extern int      ogg_page_getbuffer(ogg_page *og, unsigned char **buffer);
+
+extern int      ogg_packet_release(ogg_packet *op);
+extern int      ogg_page_release(ogg_page *og);
+
+extern void     ogg_page_dup(ogg_page *d, ogg_page *s);
+
+/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/
+
+#define  OGG_SUCCESS   0
+
+#define  OGG_HOLE     -10
+#define  OGG_SPAN     -11
+#define  OGG_EVERSION -12
+#define  OGG_ESERIAL  -13
+#define  OGG_EINVAL   -14
+#define  OGG_EEOS     -15
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _OGG_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/os.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,64 @@
+#ifndef _OS_H
+#define _OS_H
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: #ifdef jail to whip a few platforms into the UNIX ideal.
+
+ ********************************************************************/
+
+#include <math.h>
+#include "os_types.h"
+
+#ifndef _V_IFDEFJAIL_H_
+#  define _V_IFDEFJAIL_H_
+
+#  ifdef __GNUC__
+#    define STIN static __inline__
+#  elif _WIN32
+#    define STIN static __inline
+#  endif
+#else
+#  define STIN static
+#endif
+
+#ifndef M_PI
+#  define M_PI (3.1415926536f)
+#endif
+
+#ifdef _WIN32
+#  include <malloc.h>
+#  define rint(x)   (floor((x)+0.5f)) 
+#  define NO_FLOAT_MATH_LIB
+#  define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
+#  define LITTLE_ENDIAN 1
+#  define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
+#ifdef HAVE_ALLOCA_H
+#  include <alloca.h>
+#endif
+
+#ifdef USE_MEMORY_H
+#  include <memory.h>
+#endif
+
+#ifndef min
+#  define min(x,y)  ((x)>(y)?(y):(x))
+#endif
+
+#ifndef max
+#  define max(x,y)  ((x)<(y)?(y):(x))
+#endif
+
+#endif /* _OS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/os_types.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,88 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: #ifdef jail to whip a few platforms into the UNIX ideal.
+
+ ********************************************************************/
+#ifndef _OS_TYPES_H
+#define _OS_TYPES_H
+
+#ifdef _LOW_ACCURACY_
+#  define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
+#  define LOOKUP_T const unsigned char
+#else
+#  define X(n) (n)
+#  define LOOKUP_T const ogg_int32_t
+#endif
+
+/* make it easy on the folks that want to compile the libs with a
+   different malloc than stdlib */
+#define _ogg_malloc  malloc
+#define _ogg_calloc  calloc
+#define _ogg_realloc realloc
+#define _ogg_free    free
+
+#ifdef _WIN32 
+
+#  ifndef __GNUC__
+   /* MSVC/Borland */
+   typedef __int64 ogg_int64_t;
+   typedef __int32 ogg_int32_t;
+   typedef unsigned __int32 ogg_uint32_t;
+   typedef __int16 ogg_int16_t;
+#  else
+   /* Cygwin */
+   #include <_G_config.h>
+   typedef _G_int64_t ogg_int64_t;
+   typedef _G_int32_t ogg_int32_t;
+   typedef _G_uint32_t ogg_uint32_t;
+   typedef _G_int16_t ogg_int16_t;
+#  endif
+
+#elif defined(__MACOS__)
+
+#  include <sys/types.h>
+   typedef SInt16 ogg_int16_t;
+   typedef SInt32 ogg_int32_t;
+   typedef UInt32 ogg_uint32_t;
+   typedef SInt64 ogg_int64_t;
+
+#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
+
+#  include <sys/types.h>
+   typedef int16_t ogg_int16_t;
+   typedef int32_t ogg_int32_t;
+   typedef u_int32_t ogg_uint32_t;
+   typedef int64_t ogg_int64_t;
+
+#elif defined(__BEOS__)
+
+   /* Be */
+#  include <inttypes.h>
+
+#elif defined (__EMX__)
+
+   /* OS/2 GCC */
+   typedef short ogg_int16_t;
+   typedef int ogg_int32_t;
+   typedef unsigned int ogg_uint32_t;
+   typedef long long ogg_int64_t;
+
+#else
+
+#  include <sys/types.h>
+#  include "config_types.h"
+
+#endif
+
+#endif  /* _OS_TYPES_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/registry.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,50 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: registry for floor, res backends and channel mappings
+
+ ********************************************************************/
+
+#include "ivorbiscodec.h"
+#include "codec_internal.h"
+#include "registry.h"
+#include "misc.h"
+
+
+/* seems like major overkill now; the backend numbers will grow into
+   the infrastructure soon enough */
+
+extern vorbis_func_floor     floor0_exportbundle;
+extern vorbis_func_floor     floor1_exportbundle;
+extern vorbis_func_residue   residue0_exportbundle;
+extern vorbis_func_residue   residue1_exportbundle;
+extern vorbis_func_residue   residue2_exportbundle;
+extern vorbis_func_mapping   mapping0_exportbundle;
+
+vorbis_func_floor     *_floor_P[]={
+  &floor0_exportbundle,
+  &floor1_exportbundle,
+};
+
+vorbis_func_residue   *_residue_P[]={
+  &residue0_exportbundle,
+  &residue1_exportbundle,
+  &residue2_exportbundle,
+};
+
+vorbis_func_mapping   *_mapping_P[]={
+  &mapping0_exportbundle,
+};
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/registry.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,40 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: registry for time, floor, res backends and channel mappings
+
+ ********************************************************************/
+
+#ifndef _V_REG_H_
+#define _V_REG_H_
+
+#define VI_TRANSFORMB 1
+#define VI_WINDOWB 1
+#define VI_TIMEB 1
+#define VI_FLOORB 2
+#define VI_RESB 3
+#define VI_MAPB 1
+
+#include "backends.h"
+
+#if defined(_WIN32) && defined(VORBISDLL_IMPORT)
+# define EXTERN __declspec(dllimport) extern
+#else
+# define EXTERN extern
+#endif
+
+EXTERN vorbis_func_floor     *_floor_P[];
+EXTERN vorbis_func_residue   *_residue_P[];
+EXTERN vorbis_func_mapping   *_mapping_P[];
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/res012.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,342 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: residue backend 0, 1 and 2 implementation
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "ogg.h"
+#include "ivorbiscodec.h"
+#include "codec_internal.h"
+#include "registry.h"
+#include "codebook.h"
+#include "misc.h"
+#include "os.h"
+#include "block.h"
+
+typedef struct {
+  vorbis_info_residue0 *info;
+  int         map;
+  
+  int         parts;
+  int         stages;
+  codebook   *fullbooks;
+  codebook   *phrasebook;
+  codebook ***partbooks;
+
+  int         partvals;
+  int       **decodemap;
+
+} vorbis_look_residue0;
+
+void res0_free_info(vorbis_info_residue *i){
+  vorbis_info_residue0 *info=(vorbis_info_residue0 *)i;
+  if(info){
+    memset(info,0,sizeof(*info));
+    _ogg_free(info);
+  }
+}
+
+void res0_free_look(vorbis_look_residue *i){
+  int j;
+  if(i){
+
+    vorbis_look_residue0 *look=(vorbis_look_residue0 *)i;
+
+    for(j=0;j<look->parts;j++)
+      if(look->partbooks[j])_ogg_free(look->partbooks[j]);
+    _ogg_free(look->partbooks);
+    for(j=0;j<look->partvals;j++)
+      _ogg_free(look->decodemap[j]);
+    _ogg_free(look->decodemap);
+
+    memset(look,0,sizeof(*look));
+    _ogg_free(look);
+  }
+}
+
+static int ilog(unsigned int v){
+  int ret=0;
+  while(v){
+    ret++;
+    v>>=1;
+  }
+  return(ret);
+}
+
+static int icount(unsigned int v){
+  int ret=0;
+  while(v){
+    ret+=v&1;
+    v>>=1;
+  }
+  return(ret);
+}
+
+/* vorbis_info is for range checking */
+vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
+  int j,acc=0;
+  vorbis_info_residue0 *info=(vorbis_info_residue0 *)_ogg_calloc(1,sizeof(*info));
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+
+  info->begin=oggpack_read(opb,24);
+  info->end=oggpack_read(opb,24);
+  info->grouping=oggpack_read(opb,24)+1;
+  info->partitions=oggpack_read(opb,6)+1;
+  info->groupbook=oggpack_read(opb,8);
+
+  for(j=0;j<info->partitions;j++){
+    int cascade=oggpack_read(opb,3);
+    if(oggpack_read(opb,1))
+      cascade|=(oggpack_read(opb,5)<<3);
+    info->secondstages[j]=cascade;
+
+    acc+=icount(cascade);
+  }
+  for(j=0;j<acc;j++)
+    info->booklist[j]=oggpack_read(opb,8);
+
+  if(info->groupbook>=ci->books)goto errout;
+  for(j=0;j<acc;j++)
+    if(info->booklist[j]>=ci->books)goto errout;
+
+  return(info);
+ errout:
+  res0_free_info(info);
+  return(NULL);
+}
+
+vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
+			  vorbis_info_residue *vr){
+  vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
+  vorbis_look_residue0 *look=(vorbis_look_residue0 *)_ogg_calloc(1,sizeof(*look));
+  codec_setup_info     *ci=(codec_setup_info *)vd->vi->codec_setup;
+
+  int j,k,acc=0;
+  int dim;
+  int maxstage=0;
+  look->info=info;
+  look->map=vm->mapping;
+
+  look->parts=info->partitions;
+  look->fullbooks=ci->fullbooks;
+  look->phrasebook=ci->fullbooks+info->groupbook;
+  dim=look->phrasebook->dim;
+
+  look->partbooks=(codebook ***)_ogg_calloc(look->parts,sizeof(*look->partbooks));
+
+  for(j=0;j<look->parts;j++){
+    int stages=ilog(info->secondstages[j]);
+    if(stages){
+      if(stages>maxstage)maxstage=stages;
+      look->partbooks[j]=(codebook **)_ogg_calloc(stages,sizeof(*look->partbooks[j]));
+      for(k=0;k<stages;k++)
+	if(info->secondstages[j]&(1<<k)){
+	  look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++];
+#ifdef TRAIN_RES
+	  look->training_data[k][j]=calloc(look->partbooks[j][k]->entries,
+					   sizeof(***look->training_data));
+#endif
+	}
+    }
+  }
+
+  look->partvals=look->parts;
+  for(j=1;j<dim;j++)look->partvals*=look->parts;
+  look->stages=maxstage;
+  look->decodemap=(int **)_ogg_malloc(look->partvals*sizeof(*look->decodemap));
+  for(j=0;j<look->partvals;j++){
+    long val=j;
+    long mult=look->partvals/look->parts;
+    look->decodemap[j]=(int *)_ogg_malloc(dim*sizeof(*look->decodemap[j]));
+    for(k=0;k<dim;k++){
+      long deco=val/mult;
+      val-=deco*mult;
+      mult/=look->parts;
+      look->decodemap[j][k]=deco;
+    }
+  }
+
+  return(look);
+}
+
+
+/* a truncated packet here just means 'stop working'; it's not an error */
+static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
+		      ogg_int32_t **in,int ch,
+		      long (*decodepart)(codebook *, ogg_int32_t *, 
+					 oggpack_buffer *,int,int)){
+
+  long i,j,k,l,s;
+  vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+  vorbis_info_residue0 *info=look->info;
+
+  /* move all this setup out later */
+  int samples_per_partition=info->grouping;
+  int partitions_per_word=look->phrasebook->dim;
+  int max=vb->pcmend>>1;
+  int end=(info->end<max?info->end:max);
+  int n=end-info->begin;
+
+  if(n>0){
+    int partvals=n/samples_per_partition;
+    int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
+    int ***partword=(int ***)alloca(ch*sizeof(*partword));
+    
+    for(j=0;j<ch;j++)
+      partword[j]=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
+    
+    for(s=0;s<look->stages;s++){
+      
+      /* each loop decodes on partition codeword containing 
+	 partitions_pre_word partitions */
+      for(i=0,l=0;i<partvals;l++){
+	if(s==0){
+	  /* fetch the partition word for each channel */
+	  for(j=0;j<ch;j++){
+	    int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
+	    if(temp==-1)goto eopbreak;
+	    partword[j][l]=look->decodemap[temp];
+	    if(partword[j][l]==NULL)goto errout;
+	  }
+	}
+	
+	/* now we decode residual values for the partitions */
+	for(k=0;k<partitions_per_word && i<partvals;k++,i++)
+	  for(j=0;j<ch;j++){
+	    long offset=info->begin+i*samples_per_partition;
+	    if(info->secondstages[partword[j][l][k]]&(1<<s)){
+	      codebook *stagebook=look->partbooks[partword[j][l][k]][s];
+	      if(stagebook){
+		if(decodepart(stagebook,in[j]+offset,&vb->opb,
+			      samples_per_partition,-8)==-1)goto eopbreak;
+	      }
+	    }
+	  }
+      } 
+    }
+  }
+ errout:
+ eopbreak:
+  return(0);
+}
+
+int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
+		 ogg_int32_t **in,int *nonzero,int ch){
+  int i,used=0;
+  for(i=0;i<ch;i++)
+    if(nonzero[i])
+      in[used++]=in[i];
+  if(used)
+    return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
+  else
+    return(0);
+}
+
+int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
+		 ogg_int32_t **in,int *nonzero,int ch){
+  int i,used=0;
+  for(i=0;i<ch;i++)
+    if(nonzero[i])
+      in[used++]=in[i];
+  if(used)
+    return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
+  else
+    return(0);
+}
+
+/* duplicate code here as speed is somewhat more important */
+int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
+		 ogg_int32_t **in,int *nonzero,int ch){
+  long i,k,l,s;
+  vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+  vorbis_info_residue0 *info=look->info;
+
+  /* move all this setup out later */
+  int samples_per_partition=info->grouping;
+  int partitions_per_word=look->phrasebook->dim;
+  int max=(vb->pcmend*ch)>>1;
+  int end=(info->end<max?info->end:max);
+  int n=end-info->begin;
+
+  if(n>0){
+    
+    int partvals=n/samples_per_partition;
+    int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
+    int **partword=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword));
+    int beginoff=info->begin/ch;
+    
+    for(i=0;i<ch;i++)if(nonzero[i])break;
+    if(i==ch)return(0); /* no nonzero vectors */
+    
+    samples_per_partition/=ch;
+    
+    for(s=0;s<look->stages;s++){
+      for(i=0,l=0;i<partvals;l++){
+	
+	if(s==0){
+	  /* fetch the partition word */
+	  int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
+	  if(temp==-1)goto eopbreak;
+	  partword[l]=look->decodemap[temp];
+	  if(partword[l]==NULL)goto errout;
+	}
+
+	/* now we decode residual values for the partitions */
+	for(k=0;k<partitions_per_word && i<partvals;k++,i++)
+	  if(info->secondstages[partword[l][k]]&(1<<s)){
+	    codebook *stagebook=look->partbooks[partword[l][k]][s];
+	    
+	    if(stagebook){
+	      if(vorbis_book_decodevv_add(stagebook,in,
+					  i*samples_per_partition+beginoff,ch,
+					  &vb->opb,
+					  samples_per_partition,-8)==-1)
+		goto eopbreak;
+	    }
+	  }
+      } 
+    }
+  }
+ errout:
+ eopbreak:
+  return(0);
+}
+
+
+vorbis_func_residue residue0_exportbundle={
+  &res0_unpack,
+  &res0_look,
+  &res0_free_info,
+  &res0_free_look,
+  &res0_inverse
+};
+
+vorbis_func_residue residue1_exportbundle={
+  &res0_unpack,
+  &res0_look,
+  &res0_free_info,
+  &res0_free_look,
+  &res1_inverse
+};
+
+vorbis_func_residue residue2_exportbundle={
+  &res0_unpack,
+  &res0_look,
+  &res0_free_info,
+  &res0_free_look,
+  &res2_inverse
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/sharedbook.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,439 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: basic shared codebook operations
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include "ogg.h"
+#include "misc.h"
+#include "ivorbiscodec.h"
+#include "codebook.h"
+
+/**** pack/unpack helpers ******************************************/
+int _ilog(unsigned int v){
+  int ret=0;
+  while(v){
+    ret++;
+    v>>=1;
+  }
+  return(ret);
+}
+
+/* 32 bit float (not IEEE; nonnormalized mantissa +
+   biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm 
+   Why not IEEE?  It's just not that important here. */
+
+#define VQ_FEXP 10
+#define VQ_FMAN 21
+#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */
+
+static ogg_int32_t _float32_unpack(long val,int *point){
+  long   mant=val&0x1fffff;
+  int    sign=val&0x80000000;
+  long   exp =(val&0x7fe00000L)>>VQ_FMAN;
+
+  exp-=(VQ_FMAN-1)+VQ_FEXP_BIAS;
+
+  if(mant){
+    while(!(mant&0x40000000)){
+      mant<<=1;
+      exp-=1;
+    }
+
+    if(sign)mant= -mant;
+  }else{
+    sign=0;
+    exp=-9999;
+  }
+
+  *point=exp;
+  return mant;
+}
+
+/* given a list of word lengths, generate a list of codewords.  Works
+   for length ordered or unordered, always assigns the lowest valued
+   codewords first.  Extended to handle unused entries (length 0) */
+ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
+  long i,j,count=0;
+  ogg_uint32_t marker[33];
+  ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r));
+  memset(marker,0,sizeof(marker));
+
+  for(i=0;i<n;i++){
+    long length=l[i];
+    if(length>0){
+      ogg_uint32_t entry=marker[length];
+      
+      /* when we claim a node for an entry, we also claim the nodes
+	 below it (pruning off the imagined tree that may have dangled
+	 from it) as well as blocking the use of any nodes directly
+	 above for leaves */
+      
+      /* update ourself */
+      if(length<32 && (entry>>length)){
+	/* error condition; the lengths must specify an overpopulated tree */
+	_ogg_free(r);
+	return(NULL);
+      }
+      r[count++]=entry;
+    
+      /* Look to see if the next shorter marker points to the node
+	 above. if so, update it and repeat.  */
+      {
+	for(j=length;j>0;j--){
+	  
+	  if(marker[j]&1){
+	    /* have to jump branches */
+	    if(j==1)
+	      marker[1]++;
+	    else
+	      marker[j]=marker[j-1]<<1;
+	    break; /* invariant says next upper marker would already
+		      have been moved if it was on the same path */
+	  }
+	  marker[j]++;
+	}
+      }
+      
+      /* prune the tree; the implicit invariant says all the longer
+	 markers were dangling from our just-taken node.  Dangle them
+	 from our *new* node. */
+      for(j=length+1;j<33;j++)
+	if((marker[j]>>1) == entry){
+	  entry=marker[j];
+	  marker[j]=marker[j-1]<<1;
+	}else
+	  break;
+    }else
+      if(sparsecount==0)count++;
+  }
+    
+  /* bitreverse the words because our bitwise packer/unpacker is LSb
+     endian */
+  for(i=0,count=0;i<n;i++){
+    ogg_uint32_t temp=0;
+    for(j=0;j<l[i];j++){
+      temp<<=1;
+      temp|=(r[count]>>j)&1;
+    }
+
+    if(sparsecount){
+      if(l[i])
+	r[count++]=temp;
+    }else
+      r[count++]=temp;
+  }
+
+  return(r);
+}
+
+/* there might be a straightforward one-line way to do the below
+   that's portable and totally safe against roundoff, but I haven't
+   thought of it.  Therefore, we opt on the side of caution */
+long _book_maptype1_quantvals(const static_codebook *b){
+  /* get us a starting hint, we'll polish it below */
+  int bits=_ilog(b->entries);
+  int vals=b->entries>>((bits-1)*(b->dim-1)/b->dim);
+
+  while(1){
+    long acc=1;
+    long acc1=1;
+    int i;
+    for(i=0;i<b->dim;i++){
+      acc*=vals;
+      acc1*=vals+1;
+    }
+    if(acc<=b->entries && acc1>b->entries){
+      return(vals);
+    }else{
+      if(acc>b->entries){
+	vals--;
+      }else{
+	vals++;
+      }
+    }
+  }
+}
+
+/* different than what _book_unquantize does for mainline:
+   we repack the book in a fixed point format that shares the same
+   binary point.  Upon first use, we can shift point if needed */
+
+/* we need to deal with two map types: in map type 1, the values are
+   generated algorithmically (each column of the vector counts through
+   the values in the quant vector). in map type 2, all the values came
+   in in an explicit list.  Both value lists must be unpacked */
+
+ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
+			      int *maxpoint){
+  long j,k,count=0;
+  if(b->maptype==1 || b->maptype==2){
+    int quantvals;
+    int minpoint,delpoint;
+    ogg_int32_t mindel=_float32_unpack(b->q_min,&minpoint);
+    ogg_int32_t delta=_float32_unpack(b->q_delta,&delpoint);
+    ogg_int32_t *r=(ogg_int32_t *)_ogg_calloc(n*b->dim,sizeof(*r));
+    int *rp=(int *)_ogg_calloc(n*b->dim,sizeof(*rp));
+
+    *maxpoint=minpoint;
+
+    /* maptype 1 and 2 both use a quantized value vector, but
+       different sizes */
+    switch(b->maptype){
+    case 1:
+      /* most of the time, entries%dimensions == 0, but we need to be
+	 well defined.  We define that the possible vales at each
+	 scalar is values == entries/dim.  If entries%dim != 0, we'll
+	 have 'too few' values (values*dim<entries), which means that
+	 we'll have 'left over' entries; left over entries use zeroed
+	 values (and are wasted).  So don't generate codebooks like
+	 that */
+      quantvals=_book_maptype1_quantvals(b);
+      for(j=0;j<b->entries;j++){
+	if((sparsemap && b->lengthlist[j]) || !sparsemap){
+	  ogg_int32_t last=0;
+	  int lastpoint=0;
+	  int indexdiv=1;
+	  for(k=0;k<b->dim;k++){
+	    int index= (j/indexdiv)%quantvals;
+	    int point=0;
+	    int val=VFLOAT_MULTI(delta,delpoint,
+				 abs(b->quantlist[index]),&point);
+
+	    val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
+	    val=VFLOAT_ADD(last,lastpoint,val,point,&point);
+	    
+	    if(b->q_sequencep){
+	      last=val;	  
+	      lastpoint=point;
+	    }
+	    
+	    if(sparsemap){
+	      r[sparsemap[count]*b->dim+k]=val;
+	      rp[sparsemap[count]*b->dim+k]=point;
+	    }else{
+	      r[count*b->dim+k]=val;
+	      rp[count*b->dim+k]=point;
+	    }
+	    if(*maxpoint<point)*maxpoint=point;
+	    indexdiv*=quantvals;
+	  }
+	  count++;
+	}
+
+      }
+      break;
+    case 2:
+      for(j=0;j<b->entries;j++){
+	if((sparsemap && b->lengthlist[j]) || !sparsemap){
+	  ogg_int32_t last=0;
+	  int         lastpoint=0;
+
+	  for(k=0;k<b->dim;k++){
+	    int point=0;
+	    int val=VFLOAT_MULTI(delta,delpoint,
+				 abs(b->quantlist[j*b->dim+k]),&point);
+
+	    val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
+	    val=VFLOAT_ADD(last,lastpoint,val,point,&point);
+	    
+	    if(b->q_sequencep){
+	      last=val;	  
+	      lastpoint=point;
+	    }
+
+	    if(sparsemap){
+	      r[sparsemap[count]*b->dim+k]=val;
+	      rp[sparsemap[count]*b->dim+k]=point;
+	    }else{
+	      r[count*b->dim+k]=val;
+	      rp[count*b->dim+k]=point;
+	    }
+	    if(*maxpoint<point)*maxpoint=point;
+	  }
+	  count++;
+	}
+      }
+      break;
+    }
+
+    for(j=0;j<n*b->dim;j++)
+      if(rp[j]<*maxpoint)
+	r[j]>>=*maxpoint-rp[j];
+	    
+    _ogg_free(rp);
+    return(r);
+  }
+  return(NULL);
+}
+
+void vorbis_staticbook_clear(static_codebook *b){
+  if(b->quantlist)_ogg_free(b->quantlist);
+  if(b->lengthlist)_ogg_free(b->lengthlist);
+  memset(b,0,sizeof(*b));
+
+}
+
+void vorbis_staticbook_destroy(static_codebook *b){
+  vorbis_staticbook_clear(b);
+  _ogg_free(b);
+}
+
+void vorbis_book_clear(codebook *b){
+  /* static book is not cleared; we're likely called on the lookup and
+     the static codebook belongs to the info struct */
+  if(b->valuelist)_ogg_free(b->valuelist);
+  if(b->codelist)_ogg_free(b->codelist);
+
+  if(b->dec_index)_ogg_free(b->dec_index);
+  if(b->dec_codelengths)_ogg_free(b->dec_codelengths);
+  if(b->dec_firsttable)_ogg_free(b->dec_firsttable);
+
+  memset(b,0,sizeof(*b));
+}
+
+static ogg_uint32_t bitreverse(ogg_uint32_t x){
+  x=    ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
+  x=    ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
+  x=    ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
+  x=    ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
+  return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
+}
+
+static int sort32a(const void *a,const void *b){
+  return (**(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
+    (**(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
+}
+
+/* decode codebook arrangement is more heavily optimized than encode */
+int vorbis_book_init_decode(codebook *c,const static_codebook *s){
+  int i,j,n=0,tabn;
+  int *sortindex;
+  memset(c,0,sizeof(*c));
+  
+  /* count actually used entries */
+  for(i=0;i<s->entries;i++)
+    if(s->lengthlist[i]>0)
+      n++;
+
+  c->entries=s->entries;
+  c->used_entries=n;
+  c->dim=s->dim;
+
+  if(n>0){
+    /* two different remappings go on here.  
+       
+       First, we collapse the likely sparse codebook down only to
+       actually represented values/words.  This collapsing needs to be
+       indexed as map-valueless books are used to encode original entry
+       positions as integers.
+       
+       Second, we reorder all vectors, including the entry index above,
+       by sorted bitreversed codeword to allow treeless decode. */
+    
+    /* perform sort */
+    ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
+    ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
+    
+    if(codes==NULL)goto err_out;
+
+    for(i=0;i<n;i++){
+      codes[i]=bitreverse(codes[i]);
+      codep[i]=codes+i;
+    }
+
+    qsort(codep,n,sizeof(*codep),sort32a);
+
+    sortindex=(int *)alloca(n*sizeof(*sortindex));
+    c->codelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
+    /* the index is a reverse index */
+    for(i=0;i<n;i++){
+      int position=codep[i]-codes;
+      sortindex[position]=i;
+    }
+
+    for(i=0;i<n;i++)
+      c->codelist[sortindex[i]]=codes[i];
+    _ogg_free(codes);
+    
+    
+    
+    c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
+    c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
+    
+    for(n=0,i=0;i<s->entries;i++)
+      if(s->lengthlist[i]>0)
+	c->dec_index[sortindex[n++]]=i;
+    
+    c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
+    for(n=0,i=0;i<s->entries;i++)
+      if(s->lengthlist[i]>0)
+	c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
+    
+    c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
+    if(c->dec_firsttablen<5)c->dec_firsttablen=5;
+    if(c->dec_firsttablen>8)c->dec_firsttablen=8;
+    
+    tabn=1<<c->dec_firsttablen;
+    c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
+    c->dec_maxlength=0;
+    
+    for(i=0;i<n;i++){
+      if(c->dec_maxlength<c->dec_codelengths[i])
+	c->dec_maxlength=c->dec_codelengths[i];
+      if(c->dec_codelengths[i]<=c->dec_firsttablen){
+	ogg_uint32_t orig=bitreverse(c->codelist[i]);
+	for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
+	  c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
+      }
+    }
+    
+    /* now fill in 'unused' entries in the firsttable with hi/lo search
+       hints for the non-direct-hits */
+    {
+      ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
+      long lo=0,hi=0;
+      
+      for(i=0;i<tabn;i++){
+	ogg_uint32_t word=i<<(32-c->dec_firsttablen);
+	if(c->dec_firsttable[bitreverse(word)]==0){
+	  while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
+	  while(    hi<n && word>=(c->codelist[hi]&mask))hi++;
+	  
+	  /* we only actually have 15 bits per hint to play with here.
+	     In order to overflow gracefully (nothing breaks, efficiency
+	     just drops), encode as the difference from the extremes. */
+	  {
+	    unsigned long loval=lo;
+	    unsigned long hival=n-hi;
+	    
+	    if(loval>0x7fff)loval=0x7fff;
+	    if(hival>0x7fff)hival=0x7fff;
+	    c->dec_firsttable[bitreverse(word)]=
+	      0x80000000UL | (loval<<15) | hival;
+	  }
+	}
+      }
+    }
+  }
+
+  return(0);
+ err_out:
+  vorbis_book_clear(c);
+  return(-1);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/synthesis.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,113 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: single-block PCM synthesis
+ last mod: $Id: synthesis.c,v 1.4 2003/03/29 03:07:21 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdio.h>
+#include "ogg.h"
+#include "ivorbiscodec.h"
+#include "codec_internal.h"
+#include "registry.h"
+#include "misc.h"
+#include "block.h"
+
+int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){
+  vorbis_dsp_state     *vd=vb->vd;
+  private_state        *b=(private_state *)vd->backend_state;
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  oggpack_buffer       *opb=&vb->opb;
+  int                   type,mode,i;
+ 
+  /* first things first.  Make sure decode is ready */
+  _vorbis_block_ripcord(vb);
+  oggpack_readinit(opb,op->packet);
+
+  /* Check the packet type */
+  if(oggpack_read(opb,1)!=0){
+    /* Oops.  This is not an audio data packet */
+    return(OV_ENOTAUDIO);
+  }
+
+  /* read our mode and pre/post windowsize */
+  mode=oggpack_read(opb,b->modebits);
+  if(mode==-1)return(OV_EBADPACKET);
+  
+  vb->mode=mode;
+  vb->W=ci->mode_param[mode]->blockflag;
+  if(vb->W){
+    vb->lW=oggpack_read(opb,1);
+    vb->nW=oggpack_read(opb,1);
+    if(vb->nW==-1)   return(OV_EBADPACKET);
+  }else{
+    vb->lW=0;
+    vb->nW=0;
+  }
+  
+  /* more setup */
+  vb->granulepos=op->granulepos;
+  vb->sequence=op->packetno-3; /* first block is third packet */
+  vb->eofflag=op->e_o_s;
+
+  if(decodep){
+    /* alloc pcm passback storage */
+    vb->pcmend=ci->blocksizes[vb->W];
+    vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
+    for(i=0;i<vi->channels;i++)
+      vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
+    
+    /* unpack_header enforces range checking */
+    type=ci->map_type[ci->mode_param[mode]->mapping];
+    
+    return(_mapping_P[type]->inverse(vb,b->mode[mode]));
+  }else{
+    /* no pcm */
+    vb->pcmend=0;
+    vb->pcm=NULL;
+    
+    return(0);
+  }
+}
+
+long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
+  codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
+  oggpack_buffer       opb;
+  int                  mode;
+ 
+  oggpack_readinit(&opb,op->packet);
+
+  /* Check the packet type */
+  if(oggpack_read(&opb,1)!=0){
+    /* Oops.  This is not an audio data packet */
+    return(OV_ENOTAUDIO);
+  }
+
+  {
+    int modebits=0;
+    int v=ci->modes;
+    while(v>1){
+      modebits++;
+      v>>=1;
+    }
+
+    /* read our mode and pre/post windowsize */
+    mode=oggpack_read(&opb,modebits);
+  }
+  if(mode==-1)return(OV_EBADPACKET);
+  return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/vorbisfile.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,1586 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: stdio-based convenience library for opening/seeking/decoding
+ last mod: $Id: vorbisfile.c,v 1.6 2003/03/30 23:40:56 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <math.h>
+
+#include "ivorbiscodec.h"
+#include "ivorbisfile.h"
+
+#include "misc.h"
+
+/* A 'chained bitstream' is a Vorbis bitstream that contains more than
+   one logical bitstream arranged end to end (the only form of Ogg
+   multiplexing allowed in a Vorbis bitstream; grouping [parallel
+   multiplexing] is not allowed in Vorbis) */
+
+/* A Vorbis file can be played beginning to end (streamed) without
+   worrying ahead of time about chaining (see decoder_example.c).  If
+   we have the whole file, however, and want random access
+   (seeking/scrubbing) or desire to know the total length/time of a
+   file, we need to account for the possibility of chaining. */
+
+/* We can handle things a number of ways; we can determine the entire
+   bitstream structure right off the bat, or find pieces on demand.
+   This example determines and caches structure for the entire
+   bitstream, but builds a virtual decoder on the fly when moving
+   between links in the chain. */
+
+/* There are also different ways to implement seeking.  Enough
+   information exists in an Ogg bitstream to seek to
+   sample-granularity positions in the output.  Or, one can seek by
+   picking some portion of the stream roughly in the desired area if
+   we only want coarse navigation through the stream. */
+
+/*************************************************************************
+ * Many, many internal helpers.  The intention is not to be confusing; 
+ * rampant duplication and monolithic function implementation would be 
+ * harder to understand anyway.  The high level functions are last.  Begin
+ * grokking near the end of the file */
+
+
+/* read a little more data from the file/pipe into the ogg_sync framer */
+static long _get_data(OggVorbis_File *vf){
+  errno=0;
+  if(vf->datasource){
+    unsigned char *buffer=ogg_sync_bufferin(vf->oy,CHUNKSIZE);
+    long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
+    if(bytes>0)ogg_sync_wrote(vf->oy,bytes);
+    if(bytes==0 && errno)return(-1);
+    return(bytes);
+  }else
+    return(0);
+}
+
+/* save a tiny smidge of verbosity to make the code more readable */
+static void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){
+  if(vf->datasource){ 
+    (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET);
+    vf->offset=offset;
+    ogg_sync_reset(vf->oy);
+  }else{
+    /* shouldn't happen unless someone writes a broken callback */
+    return;
+  }
+}
+
+/* The read/seek functions track absolute position within the stream */
+
+/* from the head of the stream, get the next page.  boundary specifies
+   if the function is allowed to fetch more data from the stream (and
+   how much) or only use internally buffered data.
+
+   boundary: -1) unbounded search
+              0) read no additional data; use cached only
+	      n) search for a new page beginning for n bytes
+
+   return:   <0) did not find a page (OV_FALSE, OV_EOF, OV_EREAD)
+              n) found a page at absolute offset n 
+
+              produces a refcounted page */
+
+static ogg_int64_t _get_next_page(OggVorbis_File *vf,ogg_page *og,
+				  ogg_int64_t boundary){
+  if(boundary>0)boundary+=vf->offset;
+  while(1){
+    long more;
+
+    if(boundary>0 && vf->offset>=boundary)return(OV_FALSE);
+    more=ogg_sync_pageseek(vf->oy,og);
+    
+    if(more<0){
+      /* skipped n bytes */
+      vf->offset-=more;
+    }else{
+      if(more==0){
+	/* send more paramedics */
+	if(!boundary)return(OV_FALSE);
+	{
+	  long ret=_get_data(vf);
+	  if(ret==0)return(OV_EOF);
+	  if(ret<0)return(OV_EREAD);
+	}
+      }else{
+	/* got a page.  Return the offset at the page beginning,
+           advance the internal offset past the page end */
+	ogg_int64_t ret=vf->offset;
+	vf->offset+=more;
+	return(ret);
+	
+      }
+    }
+  }
+}
+
+/* find the latest page beginning before the current stream cursor
+   position. Much dirtier than the above as Ogg doesn't have any
+   backward search linkage.  no 'readp' as it will certainly have to
+   read. */
+/* returns offset or OV_EREAD, OV_FAULT and produces a refcounted page */
+
+static ogg_int64_t _get_prev_page(OggVorbis_File *vf,ogg_page *og){
+  ogg_int64_t begin=vf->offset;
+  ogg_int64_t end=begin;
+  ogg_int64_t ret;
+  ogg_int64_t offset=-1;
+
+  while(offset==-1){
+    begin-=CHUNKSIZE;
+    if(begin<0)
+      begin=0;
+    _seek_helper(vf,begin);
+    while(vf->offset<end){
+      ret=_get_next_page(vf,og,end-vf->offset);
+      if(ret==OV_EREAD)return(OV_EREAD);
+      if(ret<0){
+	break;
+      }else{
+	offset=ret;
+      }
+    }
+  }
+
+  /* we have the offset.  Actually snork and hold the page now */
+  _seek_helper(vf,offset);
+  ret=_get_next_page(vf,og,CHUNKSIZE);
+  if(ret<0)
+    /* this shouldn't be possible */
+    return(OV_EFAULT);
+
+  return(offset);
+}
+
+/* finds each bitstream link one at a time using a bisection search
+   (has to begin by knowing the offset of the lb's initial page).
+   Recurses for each link so it can alloc the link storage after
+   finding them all, then unroll and fill the cache at the same time */
+static int _bisect_forward_serialno(OggVorbis_File *vf,
+				    ogg_int64_t begin,
+				    ogg_int64_t searched,
+				    ogg_int64_t end,
+				    ogg_uint32_t currentno,
+				    long m){
+  ogg_int64_t endsearched=end;
+  ogg_int64_t next=end;
+  ogg_page og={0,0,0,0};
+  ogg_int64_t ret;
+  
+  /* the below guards against garbage seperating the last and
+     first pages of two links. */
+  while(searched<endsearched){
+    ogg_int64_t bisect;
+    
+    if(endsearched-searched<CHUNKSIZE){
+      bisect=searched;
+    }else{
+      bisect=(searched+endsearched)/2;
+    }
+    
+    _seek_helper(vf,bisect);
+    ret=_get_next_page(vf,&og,-1);
+    if(ret==OV_EREAD)return(OV_EREAD);
+    if(ret<0 || ogg_page_serialno(&og)!=currentno){
+      endsearched=bisect;
+      if(ret>=0)next=ret;
+    }else{
+      searched=ret+og.header_len+og.body_len;
+    }
+    ogg_page_release(&og);
+  }
+
+  _seek_helper(vf,next);
+  ret=_get_next_page(vf,&og,-1);
+  if(ret==OV_EREAD)return(OV_EREAD);
+  
+  if(searched>=end || ret<0){
+    ogg_page_release(&og);
+    vf->links=m+1;
+    vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets));
+    vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));
+    vf->offsets[m+1]=searched;
+  }else{
+    ret=_bisect_forward_serialno(vf,next,vf->offset,
+				 end,ogg_page_serialno(&og),m+1);
+    ogg_page_release(&og);
+    if(ret==OV_EREAD)return(OV_EREAD);
+  }
+  
+  vf->offsets[m]=begin;
+  vf->serialnos[m]=currentno;
+  return(0);
+}
+
+/* uses the local ogg_stream storage in vf; this is important for
+   non-streaming input sources */
+/* consumes the page that's passed in (if any) */
+
+static int _fetch_headers(OggVorbis_File *vf,
+			  vorbis_info *vi,
+			  vorbis_comment *vc,
+			  ogg_uint32_t *serialno,
+			  ogg_page *og_ptr){
+  ogg_page og={0,0,0,0};
+  ogg_packet op={0,0,0,0,0,0};
+  int i,ret;
+  
+  if(!og_ptr){
+    ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE);
+    if(llret==OV_EREAD)return(OV_EREAD);
+    if(llret<0)return OV_ENOTVORBIS;
+    og_ptr=&og;
+  }
+
+  ogg_stream_reset_serialno(vf->os,ogg_page_serialno(og_ptr));
+  if(serialno)*serialno=vf->os->serialno;
+  vf->ready_state=STREAMSET;
+  
+  /* extract the initial header from the first page and verify that the
+     Ogg bitstream is in fact Vorbis data */
+  
+  vorbis_info_init(vi);
+  vorbis_comment_init(vc);
+  
+  i=0;
+  while(i<3){
+    ogg_stream_pagein(vf->os,og_ptr);
+    while(i<3){
+      int result=ogg_stream_packetout(vf->os,&op);
+      if(result==0)break;
+      if(result==-1){
+	ret=OV_EBADHEADER;
+	goto bail_header;
+      }
+      if((ret=vorbis_synthesis_headerin(vi,vc,&op))){
+	goto bail_header;
+      }
+      i++;
+    }
+    if(i<3)
+      if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){
+	ret=OV_EBADHEADER;
+	goto bail_header;
+      }
+  }
+
+  ogg_packet_release(&op);
+  ogg_page_release(&og);
+  return 0; 
+
+ bail_header:
+  ogg_packet_release(&op);
+  ogg_page_release(&og);
+  vorbis_info_clear(vi);
+  vorbis_comment_clear(vc);
+  vf->ready_state=OPENED;
+
+  return ret;
+}
+
+/* last step of the OggVorbis_File initialization; get all the
+   vorbis_info structs and PCM positions.  Only called by the seekable
+   initialization (local stream storage is hacked slightly; pay
+   attention to how that's done) */
+
+/* this is void and does not propogate errors up because we want to be
+   able to open and use damaged bitstreams as well as we can.  Just
+   watch out for missing information for links in the OggVorbis_File
+   struct */
+static void _prefetch_all_headers(OggVorbis_File *vf, ogg_int64_t dataoffset){
+  ogg_page og={0,0,0,0};
+  int i;
+  ogg_int64_t ret;
+  
+  vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi));
+  vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc));
+  vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets));
+  vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths));
+  
+  for(i=0;i<vf->links;i++){
+    if(i==0){
+      /* we already grabbed the initial header earlier.  Just set the offset */
+      vf->dataoffsets[i]=dataoffset;
+      _seek_helper(vf,dataoffset);
+
+    }else{
+
+      /* seek to the location of the initial header */
+
+      _seek_helper(vf,vf->offsets[i]);
+      if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){
+    	vf->dataoffsets[i]=-1;
+      }else{
+	vf->dataoffsets[i]=vf->offset;
+      }
+    }
+
+    /* fetch beginning PCM offset */
+
+    if(vf->dataoffsets[i]!=-1){
+      ogg_int64_t accumulated=0,pos;
+      long        lastblock=-1;
+      int         result;
+
+      ogg_stream_reset_serialno(vf->os,vf->serialnos[i]);
+
+      while(1){
+	ogg_packet op={0,0,0,0,0,0};
+
+	ret=_get_next_page(vf,&og,-1);
+	if(ret<0)
+	  /* this should not be possible unless the file is
+             truncated/mangled */
+	  break;
+       
+	if(ogg_page_serialno(&og)!=vf->serialnos[i])
+	  break;
+	
+	pos=ogg_page_granulepos(&og);
+
+	/* count blocksizes of all frames in the page */
+	ogg_stream_pagein(vf->os,&og);
+	while((result=ogg_stream_packetout(vf->os,&op))){
+	  if(result>0){ /* ignore holes */
+	    long thisblock=vorbis_packet_blocksize(vf->vi+i,&op);
+	    if(lastblock!=-1)
+	      accumulated+=(lastblock+thisblock)>>2;
+	    lastblock=thisblock;
+	  }
+	}
+	ogg_packet_release(&op);
+
+	if(pos!=-1){
+	  /* pcm offset of last packet on the first audio page */
+	  accumulated= pos-accumulated;
+	  break;
+	}
+      }
+
+      /* less than zero?  This is a stream with samples trimmed off
+         the beginning, a normal occurrence; set the offset to zero */
+      if(accumulated<0)accumulated=0;
+
+      vf->pcmlengths[i*2]=accumulated;
+    }
+
+    /* get the PCM length of this link. To do this,
+       get the last page of the stream */
+    {
+      ogg_int64_t end=vf->offsets[i+1];
+      _seek_helper(vf,end);
+
+      while(1){
+	ret=_get_prev_page(vf,&og);
+	if(ret<0){
+	  /* this should not be possible */
+	  vorbis_info_clear(vf->vi+i);
+	  vorbis_comment_clear(vf->vc+i);
+	  break;
+	}
+	if(ogg_page_granulepos(&og)!=-1){
+	  vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2];
+	  break;
+	}
+	vf->offset=ret;
+      }
+    }
+  }
+  ogg_page_release(&og);
+}
+
+static void _make_decode_ready(OggVorbis_File *vf){
+  if(vf->ready_state!=STREAMSET)return;
+  if(vf->seekable){
+    vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link);
+  }else{
+    vorbis_synthesis_init(&vf->vd,vf->vi);
+  }    
+  vorbis_block_init(&vf->vd,&vf->vb);
+  vf->ready_state=INITSET;
+  vf->bittrack=0;
+  vf->samptrack=0;
+  return;
+}
+
+static int _open_seekable2(OggVorbis_File *vf){
+  ogg_uint32_t serialno=vf->current_serialno;
+  ogg_uint32_t tempserialno;
+  ogg_int64_t dataoffset=vf->offset, end;
+  ogg_page og={0,0,0,0};
+
+  /* we're partially open and have a first link header state in
+     storage in vf */
+  /* we can seek, so set out learning all about this file */
+  (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
+  vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
+  
+  /* We get the offset for the last page of the physical bitstream.
+     Most OggVorbis files will contain a single logical bitstream */
+  end=_get_prev_page(vf,&og);
+  if(end<0)return(end);
+
+  /* more than one logical bitstream? */
+  tempserialno=ogg_page_serialno(&og);
+  ogg_page_release(&og);
+
+  if(tempserialno!=serialno){
+
+    /* Chained bitstream. Bisect-search each logical bitstream
+       section.  Do so based on serial number only */
+    if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0)return(OV_EREAD);
+
+  }else{
+
+    /* Only one logical bitstream */
+    if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0))return(OV_EREAD);
+
+  }
+
+  /* the initial header memory is referenced by vf after; don't free it */
+  _prefetch_all_headers(vf,dataoffset);
+  return(ov_raw_seek(vf,0));
+}
+
+/* clear out the current logical bitstream decoder */ 
+static void _decode_clear(OggVorbis_File *vf){
+  vorbis_dsp_clear(&vf->vd);
+  vorbis_block_clear(&vf->vb);
+  vf->ready_state=OPENED;
+}
+
+/* fetch and process a packet.  Handles the case where we're at a
+   bitstream boundary and dumps the decoding machine.  If the decoding
+   machine is unloaded, it loads it.  It also keeps pcm_offset up to
+   date (seek and read both use this.  seek uses a special hack with
+   readp). 
+
+   return: <0) error, OV_HOLE (lost packet) or OV_EOF
+            0) need more data (only if readp==0)
+	    1) got a packet 
+*/
+
+static int _fetch_and_process_packet(OggVorbis_File *vf,
+				     int readp,
+				     int spanp){
+  ogg_page og={0,0,0,0};
+  ogg_packet op={0,0,0,0,0,0};
+  int ret=0;
+
+  /* handle one packet.  Try to fetch it from current stream state */
+  /* extract packets from page */
+  while(1){
+    
+    /* process a packet if we can.  If the machine isn't loaded,
+       neither is a page */
+    if(vf->ready_state==INITSET){
+      while(1) {
+	int result=ogg_stream_packetout(vf->os,&op);
+	ogg_int64_t granulepos;
+
+	if(result<0){
+	  ret=OV_HOLE; /* hole in the data. */
+	  goto cleanup;
+	}
+	if(result>0){
+	  /* got a packet.  process it */
+	  granulepos=op.granulepos;
+	  if(!vorbis_synthesis(&vf->vb,&op,1)){ /* lazy check for lazy
+						      header handling.  The
+						      header packets aren't
+						      audio, so if/when we
+						      submit them,
+						      vorbis_synthesis will
+						      reject them */
+
+	    /* suck in the synthesis data and track bitrate */
+	    {
+	      int oldsamples=vorbis_synthesis_pcmout(&vf->vd,NULL);
+	      /* for proper use of libvorbis within libvorbisfile,
+                 oldsamples will always be zero. */
+	      if(oldsamples){
+		ret=OV_EFAULT;
+		goto cleanup;
+	      }
+
+	      vorbis_synthesis_blockin(&vf->vd,&vf->vb);
+	      vf->samptrack+=vorbis_synthesis_pcmout(&vf->vd,NULL)-oldsamples;
+	      vf->bittrack+=op.bytes*8;
+	    }
+	  
+	    /* update the pcm offset. */
+	    if(granulepos!=-1 && !op.e_o_s){
+	      int link=(vf->seekable?vf->current_link:0);
+	      int i,samples;
+	    
+	      /* this packet has a pcm_offset on it (the last packet
+	         completed on a page carries the offset) After processing
+	         (above), we know the pcm position of the *last* sample
+	         ready to be returned. Find the offset of the *first*
+
+	         As an aside, this trick is inaccurate if we begin
+	         reading anew right at the last page; the end-of-stream
+	         granulepos declares the last frame in the stream, and the
+	         last packet of the last page may be a partial frame.
+	         So, we need a previous granulepos from an in-sequence page
+	         to have a reference point.  Thus the !op.e_o_s clause
+	         above */
+
+	      if(vf->seekable && link>0)
+		granulepos-=vf->pcmlengths[link*2];
+	      if(granulepos<0)granulepos=0; /* actually, this
+					       shouldn't be possible
+					       here unless the stream
+					       is very broken */
+
+	      samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
+	    
+	      granulepos-=samples;
+	      for(i=0;i<link;i++)
+	        granulepos+=vf->pcmlengths[i*2+1];
+	      vf->pcm_offset=granulepos;
+	    }
+	    ret=1;
+	    goto cleanup;
+	  }
+	}
+	else 
+	  break;
+      }
+    }
+
+    if(vf->ready_state>=OPENED){
+      int ret;
+      if(!readp){
+	ret=0;
+	goto cleanup;
+      }
+      if((ret=_get_next_page(vf,&og,-1))<0){
+	ret=OV_EOF; /* eof. leave unitialized */
+	goto cleanup;
+      }
+
+	/* bitrate tracking; add the header's bytes here, the body bytes
+	   are done by packet above */
+      vf->bittrack+=og.header_len*8;
+      
+      /* has our decoding just traversed a bitstream boundary? */
+      if(vf->ready_state==INITSET){
+	if(vf->current_serialno!=ogg_page_serialno(&og)){
+	  if(!spanp){
+	    ret=OV_EOF;
+	    goto cleanup;
+	  }
+
+	  _decode_clear(vf);
+	  
+	  if(!vf->seekable){
+	    vorbis_info_clear(vf->vi);
+	    vorbis_comment_clear(vf->vc);
+	  }
+	}
+      }
+    }
+
+    /* Do we need to load a new machine before submitting the page? */
+    /* This is different in the seekable and non-seekable cases.  
+
+       In the seekable case, we already have all the header
+       information loaded and cached; we just initialize the machine
+       with it and continue on our merry way.
+
+       In the non-seekable (streaming) case, we'll only be at a
+       boundary if we just left the previous logical bitstream and
+       we're now nominally at the header of the next bitstream
+    */
+
+    if(vf->ready_state!=INITSET){ 
+      int link;
+
+      if(vf->ready_state<STREAMSET){
+	if(vf->seekable){
+	  vf->current_serialno=ogg_page_serialno(&og);
+	  
+	  /* match the serialno to bitstream section.  We use this rather than
+	     offset positions to avoid problems near logical bitstream
+	     boundaries */
+	  for(link=0;link<vf->links;link++)
+	    if(vf->serialnos[link]==vf->current_serialno)break;
+	  if(link==vf->links){
+	    ret=OV_EBADLINK; /* sign of a bogus stream.  error out,
+				leave machine uninitialized */
+	    goto cleanup;
+	  }
+	  
+	  vf->current_link=link;
+	  
+	  ogg_stream_reset_serialno(vf->os,vf->current_serialno);
+	  vf->ready_state=STREAMSET;
+	  
+	}else{
+	  /* we're streaming */
+	  /* fetch the three header packets, build the info struct */
+	  
+	  int ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,&og);
+	  if(ret) goto cleanup;
+	  vf->current_link++;
+	  link=0;
+	}
+      }
+      
+      _make_decode_ready(vf);
+    }
+    ogg_stream_pagein(vf->os,&og);
+  }
+ cleanup:
+  ogg_packet_release(&op);
+  ogg_page_release(&og);
+  return ret;
+}
+
+/* if, eg, 64 bit stdio is configured by default, this will build with
+   fseek64 */
+static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){
+  if(f==NULL)return(-1);
+  return fseek(f,off,whence);
+}
+
+static int _ov_open1(void *f,OggVorbis_File *vf,char *initial,
+		     long ibytes, ov_callbacks callbacks){
+  int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1);
+  int ret;
+
+  memset(vf,0,sizeof(*vf));
+  vf->datasource=f;
+  vf->callbacks = callbacks;
+
+  /* init the framing state */
+  vf->oy=ogg_sync_create();
+
+  /* perhaps some data was previously read into a buffer for testing
+     against other stream types.  Allow initialization from this
+     previously read data (as we may be reading from a non-seekable
+     stream) */
+  if(initial){
+    unsigned char *buffer=ogg_sync_bufferin(vf->oy,ibytes);
+    memcpy(buffer,initial,ibytes);
+    ogg_sync_wrote(vf->oy,ibytes);
+  }
+
+  /* can we seek? Stevens suggests the seek test was portable */
+  if(offsettest!=-1)vf->seekable=1;
+
+  /* No seeking yet; Set up a 'single' (current) logical bitstream
+     entry for partial open */
+  vf->links=1;
+  vf->vi=_ogg_calloc(vf->links,sizeof(*vf->vi));
+  vf->vc=_ogg_calloc(vf->links,sizeof(*vf->vc));
+  vf->os=ogg_stream_create(-1); /* fill in the serialno later */
+
+  /* Try to fetch the headers, maintaining all the storage */
+  if((ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL))<0){
+    vf->datasource=NULL;
+    ov_clear(vf);
+  }else if(vf->ready_state < PARTOPEN)
+    vf->ready_state=PARTOPEN;
+  return(ret);
+}
+
+static int _ov_open2(OggVorbis_File *vf){
+  if(vf->ready_state < OPENED)
+    vf->ready_state=OPENED;
+  if(vf->seekable){
+    int ret=_open_seekable2(vf);
+    if(ret){
+      vf->datasource=NULL;
+      ov_clear(vf);
+    }
+    return(ret);
+  }
+  return 0;
+}
+
+
+/* clear out the OggVorbis_File struct */
+int ov_clear(OggVorbis_File *vf){
+  if(vf){
+    vorbis_block_clear(&vf->vb);
+    vorbis_dsp_clear(&vf->vd);
+    ogg_stream_destroy(vf->os);
+    
+    if(vf->vi && vf->links){
+      int i;
+      for(i=0;i<vf->links;i++){
+	vorbis_info_clear(vf->vi+i);
+	vorbis_comment_clear(vf->vc+i);
+      }
+      _ogg_free(vf->vi);
+      _ogg_free(vf->vc);
+    }
+    if(vf->dataoffsets)_ogg_free(vf->dataoffsets);
+    if(vf->pcmlengths)_ogg_free(vf->pcmlengths);
+    if(vf->serialnos)_ogg_free(vf->serialnos);
+    if(vf->offsets)_ogg_free(vf->offsets);
+    ogg_sync_destroy(vf->oy);
+
+    if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
+    memset(vf,0,sizeof(*vf));
+  }
+#ifdef DEBUG_LEAKS
+  _VDBG_dump();
+#endif
+  return(0);
+}
+
+/* inspects the OggVorbis file and finds/documents all the logical
+   bitstreams contained in it.  Tries to be tolerant of logical
+   bitstream sections that are truncated/woogie. 
+
+   return: -1) error
+            0) OK
+*/
+
+int ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
+    ov_callbacks callbacks){
+  int ret=_ov_open1(f,vf,initial,ibytes,callbacks);
+  if(ret)return ret;
+  return _ov_open2(vf);
+}
+
+int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
+  ov_callbacks callbacks = {
+    (size_t (*)(void *, size_t, size_t, void *))  fread,
+    (int (*)(void *, ogg_int64_t, int))              _fseek64_wrap,
+    (int (*)(void *))                             fclose,
+    (long (*)(void *))                            ftell
+  };
+
+  return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
+}
+  
+/* Only partially open the vorbis file; test for Vorbisness, and load
+   the headers for the first chain.  Do not seek (although test for
+   seekability).  Use ov_test_open to finish opening the file, else
+   ov_clear to close/free it. Same return codes as open. */
+
+int ov_test_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
+    ov_callbacks callbacks)
+{
+  return _ov_open1(f,vf,initial,ibytes,callbacks);
+}
+
+int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
+  ov_callbacks callbacks = {
+    (size_t (*)(void *, size_t, size_t, void *))  fread,
+    (int (*)(void *, ogg_int64_t, int))              _fseek64_wrap,
+    (int (*)(void *))                             fclose,
+    (long (*)(void *))                            ftell
+  };
+
+  return ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks);
+}
+  
+int ov_test_open(OggVorbis_File *vf){
+  if(vf->ready_state!=PARTOPEN)return(OV_EINVAL);
+  return _ov_open2(vf);
+}
+
+/* How many logical bitstreams in this physical bitstream? */
+long ov_streams(OggVorbis_File *vf){
+  return vf->links;
+}
+
+/* Is the FILE * associated with vf seekable? */
+long ov_seekable(OggVorbis_File *vf){
+  return vf->seekable;
+}
+
+/* returns the bitrate for a given logical bitstream or the entire
+   physical bitstream.  If the file is open for random access, it will
+   find the *actual* average bitrate.  If the file is streaming, it
+   returns the nominal bitrate (if set) else the average of the
+   upper/lower bounds (if set) else -1 (unset).
+
+   If you want the actual bitrate field settings, get them from the
+   vorbis_info structs */
+
+long ov_bitrate(OggVorbis_File *vf,int i){
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(i>=vf->links)return(OV_EINVAL);
+  if(!vf->seekable && i!=0)return(ov_bitrate(vf,0));
+  if(i<0){
+    ogg_int64_t bits=0;
+    int i;
+    for(i=0;i<vf->links;i++)
+      bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;
+    /* This once read: return(rint(bits/ov_time_total(vf,-1)));
+     * gcc 3.x on x86 miscompiled this at optimisation level 2 and above,
+     * so this is slightly transformed to make it work.
+     */
+    return(bits*1000/ov_time_total(vf,-1));
+  }else{
+    if(vf->seekable){
+      /* return the actual bitrate */
+      return((vf->offsets[i+1]-vf->dataoffsets[i])*8000/ov_time_total(vf,i));
+    }else{
+      /* return nominal if set */
+      if(vf->vi[i].bitrate_nominal>0){
+	return vf->vi[i].bitrate_nominal;
+      }else{
+	if(vf->vi[i].bitrate_upper>0){
+	  if(vf->vi[i].bitrate_lower>0){
+	    return (vf->vi[i].bitrate_upper+vf->vi[i].bitrate_lower)/2;
+	  }else{
+	    return vf->vi[i].bitrate_upper;
+	  }
+	}
+	return(OV_FALSE);
+      }
+    }
+  }
+}
+
+/* returns the actual bitrate since last call.  returns -1 if no
+   additional data to offer since last call (or at beginning of stream),
+   EINVAL if stream is only partially open 
+*/
+long ov_bitrate_instant(OggVorbis_File *vf){
+  int link=(vf->seekable?vf->current_link:0);
+  long ret;
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(vf->samptrack==0)return(OV_FALSE);
+  ret=vf->bittrack/vf->samptrack*vf->vi[link].rate;
+  vf->bittrack=0;
+  vf->samptrack=0;
+  return(ret);
+}
+
+/* Guess */
+long ov_serialnumber(OggVorbis_File *vf,int i){
+  if(i>=vf->links)return(ov_serialnumber(vf,vf->links-1));
+  if(!vf->seekable && i>=0)return(ov_serialnumber(vf,-1));
+  if(i<0){
+    return(vf->current_serialno);
+  }else{
+    return(vf->serialnos[i]);
+  }
+}
+
+/* returns: total raw (compressed) length of content if i==-1
+            raw (compressed) length of that logical bitstream for i==0 to n
+	    OV_EINVAL if the stream is not seekable (we can't know the length)
+	    or if stream is only partially open
+*/
+ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
+  if(i<0){
+    ogg_int64_t acc=0;
+    int i;
+    for(i=0;i<vf->links;i++)
+      acc+=ov_raw_total(vf,i);
+    return(acc);
+  }else{
+    return(vf->offsets[i+1]-vf->offsets[i]);
+  }
+}
+
+/* returns: total PCM length (samples) of content if i==-1 PCM length
+	    (samples) of that logical bitstream for i==0 to n
+	    OV_EINVAL if the stream is not seekable (we can't know the
+	    length) or only partially open 
+*/
+ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
+  if(i<0){
+    ogg_int64_t acc=0;
+    int i;
+    for(i=0;i<vf->links;i++)
+      acc+=ov_pcm_total(vf,i);
+    return(acc);
+  }else{
+    return(vf->pcmlengths[i*2+1]);
+  }
+}
+
+/* returns: total milliseconds of content if i==-1
+            milliseconds in that logical bitstream for i==0 to n
+	    OV_EINVAL if the stream is not seekable (we can't know the
+	    length) or only partially open 
+*/
+ogg_int64_t ov_time_total(OggVorbis_File *vf,int i){
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
+  if(i<0){
+    ogg_int64_t acc=0;
+    int i;
+    for(i=0;i<vf->links;i++)
+      acc+=ov_time_total(vf,i);
+    return(acc);
+  }else{
+    return(((ogg_int64_t)vf->pcmlengths[i*2+1])*1000/vf->vi[i].rate);
+  }
+}
+
+/* seek to an offset relative to the *compressed* data. This also
+   scans packets to update the PCM cursor. It will cross a logical
+   bitstream boundary, but only if it can't get any packets out of the
+   tail of the bitstream we seek to (so no surprises).
+
+   returns zero on success, nonzero on failure */
+
+int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
+  ogg_stream_state *work_os=NULL;
+  ogg_page og={0,0,0,0};
+  ogg_packet op={0,0,0,0,0,0};
+  
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(!vf->seekable)
+    return(OV_ENOSEEK); /* don't dump machine if we can't seek */
+
+  if(pos<0 || pos>vf->end)return(OV_EINVAL);
+
+  /* don't yet clear out decoding machine (if it's initialized), in
+     the case we're in the same link.  Restart the decode lapping, and
+     let _fetch_and_process_packet deal with a potential bitstream
+     boundary */
+  vf->pcm_offset=-1;
+  ogg_stream_reset_serialno(vf->os,
+			    vf->current_serialno); /* must set serialno */
+  vorbis_synthesis_restart(&vf->vd);
+    
+  _seek_helper(vf,pos);
+
+  /* we need to make sure the pcm_offset is set, but we don't want to
+     advance the raw cursor past good packets just to get to the first
+     with a granulepos.  That's not equivalent behavior to beginning
+     decoding as immediately after the seek position as possible.
+
+     So, a hack.  We use two stream states; a local scratch state and
+     the shared vf->os stream state.  We use the local state to
+     scan, and the shared state as a buffer for later decode. 
+
+     Unfortuantely, on the last page we still advance to last packet
+     because the granulepos on the last page is not necessarily on a
+     packet boundary, and we need to make sure the granpos is
+     correct. 
+  */
+
+  {
+    int lastblock=0;
+    int accblock=0;
+    int thisblock;
+    int eosflag=0;
+
+    work_os=ogg_stream_create(vf->current_serialno); /* get the memory ready */
+    while(1){
+      if(vf->ready_state>=STREAMSET){
+	/* snarf/scan a packet if we can */
+	int result=ogg_stream_packetout(work_os,&op);
+      
+	if(result>0){
+
+	  if(vf->vi[vf->current_link].codec_setup){
+	    thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
+	    if(thisblock<0){
+	      ogg_stream_packetout(vf->os,NULL);
+	      thisblock=0;
+	    }else{
+	      
+	      if(eosflag)
+		ogg_stream_packetout(vf->os,NULL);
+	      else
+		if(lastblock)accblock+=(lastblock+thisblock)>>2;
+	    }	    
+
+	    if(op.granulepos!=-1){
+	      int i,link=vf->current_link;
+	      ogg_int64_t granulepos=op.granulepos-vf->pcmlengths[link*2];
+	      if(granulepos<0)granulepos=0;
+	      
+	      for(i=0;i<link;i++)
+		granulepos+=vf->pcmlengths[i*2+1];
+	      vf->pcm_offset=granulepos-accblock;
+	      break;
+	    }
+	    lastblock=thisblock;
+	    continue;
+	  }else
+	    ogg_stream_packetout(vf->os,NULL);
+	}
+      }
+      
+      if(!lastblock){
+	if(_get_next_page(vf,&og,-1)<0){
+	  vf->pcm_offset=ov_pcm_total(vf,-1);
+	  break;
+	}
+      }else{
+	/* huh?  Bogus stream with packets but no granulepos */
+	vf->pcm_offset=-1;
+	break;
+      }
+      
+      /* has our decoding just traversed a bitstream boundary? */
+      if(vf->ready_state>=STREAMSET)
+	if(vf->current_serialno!=ogg_page_serialno(&og)){
+	  _decode_clear(vf); /* clear out stream state */
+	  ogg_stream_destroy(work_os);
+	}
+
+      if(vf->ready_state<STREAMSET){
+	int link;
+	
+	vf->current_serialno=ogg_page_serialno(&og);
+	for(link=0;link<vf->links;link++)
+	  if(vf->serialnos[link]==vf->current_serialno)break;
+	if(link==vf->links)
+	  goto seek_error; /* sign of a bogus stream.  error out,
+			      leave machine uninitialized */
+ 
+	vf->current_link=link;
+	
+	ogg_stream_reset_serialno(vf->os,vf->current_serialno);
+	ogg_stream_reset_serialno(work_os,vf->current_serialno); 
+	vf->ready_state=STREAMSET;
+	
+      }
+    
+      {
+	ogg_page dup;
+	ogg_page_dup(&dup,&og);
+	eosflag=ogg_page_eos(&og);
+	ogg_stream_pagein(vf->os,&og);
+	ogg_stream_pagein(work_os,&dup);
+      }
+    }
+  }
+
+  ogg_packet_release(&op);
+  ogg_page_release(&og);
+  ogg_stream_destroy(work_os);
+  vf->bittrack=0;
+  vf->samptrack=0;
+  return(0);
+
+ seek_error:
+  ogg_packet_release(&op);
+  ogg_page_release(&og);
+
+  /* dump the machine so we're in a known state */
+  vf->pcm_offset=-1;
+  ogg_stream_destroy(work_os);
+  _decode_clear(vf);
+  return OV_EBADLINK;
+}
+
+/* Page granularity seek (faster than sample granularity because we
+   don't do the last bit of decode to find a specific sample).
+
+   Seek to the last [granule marked] page preceeding the specified pos
+   location, such that decoding past the returned point will quickly
+   arrive at the requested position. */
+int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
+  int link=-1;
+  ogg_int64_t result=0;
+  ogg_int64_t total=ov_pcm_total(vf,-1);
+  ogg_page og={0,0,0,0};
+  ogg_packet op={0,0,0,0,0,0};
+
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(!vf->seekable)return(OV_ENOSEEK);
+  if(pos<0 || pos>total)return(OV_EINVAL);
+ 
+  /* which bitstream section does this pcm offset occur in? */
+  for(link=vf->links-1;link>=0;link--){
+    total-=vf->pcmlengths[link*2+1];
+    if(pos>=total)break;
+  }
+
+  /* search within the logical bitstream for the page with the highest
+     pcm_pos preceeding (or equal to) pos.  There is a danger here;
+     missing pages or incorrect frame number information in the
+     bitstream could make our task impossible.  Account for that (it
+     would be an error condition) */
+
+  /* new search algorithm by HB (Nicholas Vinen) */
+  {
+    ogg_int64_t end=vf->offsets[link+1];
+    ogg_int64_t begin=vf->offsets[link];
+    ogg_int64_t begintime = vf->pcmlengths[link*2];
+    ogg_int64_t endtime = vf->pcmlengths[link*2+1]+begintime;
+    ogg_int64_t target=pos-total+begintime;
+    ogg_int64_t best=begin;
+    
+    while(begin<end){
+      ogg_int64_t bisect;
+      
+      if(end-begin<CHUNKSIZE){
+	bisect=begin;
+      }else{
+	/* take a (pretty decent) guess. */
+	bisect=begin + 
+	  (target-begintime)*(end-begin)/(endtime-begintime) - CHUNKSIZE;
+	if(bisect<=begin)
+	  bisect=begin+1;
+      }
+      
+      _seek_helper(vf,bisect);
+    
+      while(begin<end){
+	result=_get_next_page(vf,&og,end-vf->offset);
+	if(result==OV_EREAD) goto seek_error;
+	if(result<0){
+	  if(bisect<=begin+1)
+	    end=begin; /* found it */
+	  else{
+	    if(bisect==0) goto seek_error;
+	    bisect-=CHUNKSIZE;
+	    if(bisect<=begin)bisect=begin+1;
+	    _seek_helper(vf,bisect);
+	  }
+	}else{
+	  ogg_int64_t granulepos=ogg_page_granulepos(&og);
+	  if(granulepos==-1)continue;
+	  if(granulepos<target){
+	    best=result;  /* raw offset of packet with granulepos */ 
+	    begin=vf->offset; /* raw offset of next page */
+	    begintime=granulepos;
+	    
+	    if(target-begintime>44100)break;
+	    bisect=begin; /* *not* begin + 1 */
+	  }else{
+	    if(bisect<=begin+1)
+	      end=begin;  /* found it */
+	    else{
+	      if(end==vf->offset){ /* we're pretty close - we'd be stuck in */
+		end=result;
+		bisect-=CHUNKSIZE; /* an endless loop otherwise. */
+		if(bisect<=begin)bisect=begin+1;
+		_seek_helper(vf,bisect);
+	      }else{
+		end=result;
+		endtime=granulepos;
+		break;
+	      }
+	    }
+	  }
+	}
+      }
+    }
+
+    /* found our page. seek to it, update pcm offset. Easier case than
+       raw_seek, don't keep packets preceeding granulepos. */
+    {
+      
+      /* seek */
+      _seek_helper(vf,best);
+      vf->pcm_offset=-1;
+      
+      if(_get_next_page(vf,&og,-1)<0){
+	ogg_page_release(&og);
+	return(OV_EOF); /* shouldn't happen */
+      }
+
+      if(link!=vf->current_link){
+	/* Different link; dump entire decode machine */
+	_decode_clear(vf);  
+	
+	vf->current_link=link;
+	vf->current_serialno=ogg_page_serialno(&og);
+	vf->ready_state=STREAMSET;
+	
+      }else{
+	vorbis_synthesis_restart(&vf->vd);
+      }
+
+      ogg_stream_reset_serialno(vf->os,vf->current_serialno);
+      ogg_stream_pagein(vf->os,&og);
+
+      /* pull out all but last packet; the one with granulepos */
+      while(1){
+	result=ogg_stream_packetpeek(vf->os,&op);
+	if(result==0){
+	  /* !!! the packet finishing this page originated on a
+             preceeding page. Keep fetching previous pages until we
+             get one with a granulepos or without the 'continued' flag
+             set.  Then just use raw_seek for simplicity. */
+	  
+	  _seek_helper(vf,best);
+	  
+	  while(1){
+	    result=_get_prev_page(vf,&og);
+	    if(result<0) goto seek_error;
+	    if(ogg_page_granulepos(&og)>-1 ||
+	       !ogg_page_continued(&og)){
+	      return ov_raw_seek(vf,result);
+	    }
+	    vf->offset=result;
+	  }
+	}
+	if(result<0){
+	  result = OV_EBADPACKET; 
+	  goto seek_error;
+	}
+	if(op.granulepos!=-1){
+	  vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
+	  if(vf->pcm_offset<0)vf->pcm_offset=0;
+	  vf->pcm_offset+=total;
+	  break;
+	}else
+	  result=ogg_stream_packetout(vf->os,NULL);
+      }
+    }
+  }
+  
+  /* verify result */
+  if(vf->pcm_offset>pos || pos>ov_pcm_total(vf,-1)){
+    result=OV_EFAULT;
+    goto seek_error;
+  }
+  vf->bittrack=0;
+  vf->samptrack=0;
+
+  ogg_page_release(&og);
+  ogg_packet_release(&op);
+  return(0);
+  
+ seek_error:
+
+  ogg_page_release(&og);
+  ogg_packet_release(&op);
+
+  /* dump machine so we're in a known state */
+  vf->pcm_offset=-1;
+  _decode_clear(vf);
+  return (int)result;
+}
+
+/* seek to a sample offset relative to the decompressed pcm stream 
+   returns zero on success, nonzero on failure */
+
+int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
+  ogg_packet op={0,0,0,0,0,0};
+  ogg_page og={0,0,0,0};
+  int thisblock,lastblock=0;
+  int ret=ov_pcm_seek_page(vf,pos);
+  if(ret<0)return(ret);
+  _make_decode_ready(vf);
+
+  /* discard leading packets we don't need for the lapping of the
+     position we want; don't decode them */
+
+  while(1){
+
+    int ret=ogg_stream_packetpeek(vf->os,&op);
+    if(ret>0){
+      thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
+      if(thisblock<0){
+	ogg_stream_packetout(vf->os,NULL);
+	continue; /* non audio packet */
+      }
+      if(lastblock)vf->pcm_offset+=(lastblock+thisblock)>>2;
+      
+      if(vf->pcm_offset+((thisblock+
+			  vorbis_info_blocksize(vf->vi,1))>>2)>=pos)break;
+      
+      /* remove the packet from packet queue and track its granulepos */
+      ogg_stream_packetout(vf->os,NULL);
+      vorbis_synthesis(&vf->vb,&op,0);  /* set up a vb with
+					   only tracking, no
+					   pcm_decode */
+      vorbis_synthesis_blockin(&vf->vd,&vf->vb); 
+      
+      /* end of logical stream case is hard, especially with exact
+	 length positioning. */
+      
+      if(op.granulepos>-1){
+	int i;
+	/* always believe the stream markers */
+	vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
+	if(vf->pcm_offset<0)vf->pcm_offset=0;
+	for(i=0;i<vf->current_link;i++)
+	  vf->pcm_offset+=vf->pcmlengths[i*2+1];
+      }
+	
+      lastblock=thisblock;
+      
+    }else{
+      if(ret<0 && ret!=OV_HOLE)break;
+      
+      /* suck in a new page */
+      if(_get_next_page(vf,&og,-1)<0)break;
+      if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf);
+      
+      if(vf->ready_state<STREAMSET){
+	int link;
+	
+	vf->current_serialno=ogg_page_serialno(&og);
+	for(link=0;link<vf->links;link++)
+	  if(vf->serialnos[link]==vf->current_serialno)break;
+	if(link==vf->links){
+	  ogg_page_release(&og);
+	  ogg_packet_release(&op);
+	  return(OV_EBADLINK);
+	}
+	vf->current_link=link;
+	
+	ogg_stream_reset_serialno(vf->os,vf->current_serialno); 
+	vf->ready_state=STREAMSET;      
+	_make_decode_ready(vf);
+	lastblock=0;
+      }
+
+      ogg_stream_pagein(vf->os,&og);
+    }
+  }
+
+  vf->bittrack=0;
+  vf->samptrack=0;
+  /* discard samples until we reach the desired position. Crossing a
+     logical bitstream boundary with abandon is OK. */
+  while(vf->pcm_offset<pos){
+    ogg_int64_t target=pos-vf->pcm_offset;
+    long samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
+
+    if(samples>target)samples=target;
+    vorbis_synthesis_read(&vf->vd,samples);
+    vf->pcm_offset+=samples;
+    
+    if(samples<target)
+      if(_fetch_and_process_packet(vf,1,1)<=0)
+	vf->pcm_offset=ov_pcm_total(vf,-1); /* eof */
+  }
+
+  ogg_page_release(&og);
+  ogg_packet_release(&op);
+  return 0;
+}
+
+/* seek to a playback time relative to the decompressed pcm stream 
+   returns zero on success, nonzero on failure */
+int ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
+  /* translate time to PCM position and call ov_pcm_seek */
+
+  int link=-1;
+  ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
+  ogg_int64_t time_total=ov_time_total(vf,-1);
+
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(!vf->seekable)return(OV_ENOSEEK);
+  if(milliseconds<0 || milliseconds>time_total)return(OV_EINVAL);
+  
+  /* which bitstream section does this time offset occur in? */
+  for(link=vf->links-1;link>=0;link--){
+    pcm_total-=vf->pcmlengths[link*2+1];
+    time_total-=ov_time_total(vf,link);
+    if(milliseconds>=time_total)break;
+  }
+
+  /* enough information to convert time offset to pcm offset */
+  {
+    ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
+    return(ov_pcm_seek(vf,target));
+  }
+}
+
+/* page-granularity version of ov_time_seek 
+   returns zero on success, nonzero on failure */
+int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){
+  /* translate time to PCM position and call ov_pcm_seek */
+
+  int link=-1;
+  ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
+  ogg_int64_t time_total=ov_time_total(vf,-1);
+
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(!vf->seekable)return(OV_ENOSEEK);
+  if(milliseconds<0 || milliseconds>time_total)return(OV_EINVAL);
+  
+  /* which bitstream section does this time offset occur in? */
+  for(link=vf->links-1;link>=0;link--){
+    pcm_total-=vf->pcmlengths[link*2+1];
+    time_total-=ov_time_total(vf,link);
+    if(milliseconds>=time_total)break;
+  }
+
+  /* enough information to convert time offset to pcm offset */
+  {
+    ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
+    return(ov_pcm_seek_page(vf,target));
+  }
+}
+
+/* tell the current stream offset cursor.  Note that seek followed by
+   tell will likely not give the set offset due to caching */
+ogg_int64_t ov_raw_tell(OggVorbis_File *vf){
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  return(vf->offset);
+}
+
+/* return PCM offset (sample) of next PCM sample to be read */
+ogg_int64_t ov_pcm_tell(OggVorbis_File *vf){
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  return(vf->pcm_offset);
+}
+
+/* return time offset (milliseconds) of next PCM sample to be read */
+ogg_int64_t ov_time_tell(OggVorbis_File *vf){
+  int link=0;
+  ogg_int64_t pcm_total=0;
+  ogg_int64_t time_total=0;
+  
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+  if(vf->seekable){
+    pcm_total=ov_pcm_total(vf,-1);
+    time_total=ov_time_total(vf,-1);
+  
+    /* which bitstream section does this time offset occur in? */
+    for(link=vf->links-1;link>=0;link--){
+      pcm_total-=vf->pcmlengths[link*2+1];
+      time_total-=ov_time_total(vf,link);
+      if(vf->pcm_offset>=pcm_total)break;
+    }
+  }
+
+  return(time_total+(1000*vf->pcm_offset-pcm_total)/vf->vi[link].rate);
+}
+
+/*  link:   -1) return the vorbis_info struct for the bitstream section
+                currently being decoded
+           0-n) to request information for a specific bitstream section
+    
+    In the case of a non-seekable bitstream, any call returns the
+    current bitstream.  NULL in the case that the machine is not
+    initialized */
+
+vorbis_info *ov_info(OggVorbis_File *vf,int link){
+  if(vf->seekable){
+    if(link<0)
+      if(vf->ready_state>=STREAMSET)
+	return vf->vi+vf->current_link;
+      else
+      return vf->vi;
+    else
+      if(link>=vf->links)
+	return NULL;
+      else
+	return vf->vi+link;
+  }else{
+    return vf->vi;
+  }
+}
+
+/* grr, strong typing, grr, no templates/inheritence, grr */
+vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
+  if(vf->seekable){
+    if(link<0)
+      if(vf->ready_state>=STREAMSET)
+	return vf->vc+vf->current_link;
+      else
+	return vf->vc;
+    else
+      if(link>=vf->links)
+	return NULL;
+      else
+	return vf->vc+link;
+  }else{
+    return vf->vc;
+  }
+}
+
+/* up to this point, everything could more or less hide the multiple
+   logical bitstream nature of chaining from the toplevel application
+   if the toplevel application didn't particularly care.  However, at
+   the point that we actually read audio back, the multiple-section
+   nature must surface: Multiple bitstream sections do not necessarily
+   have to have the same number of channels or sampling rate.
+
+   ov_read returns the sequential logical bitstream number currently
+   being decoded along with the PCM data in order that the toplevel
+   application can take action on channel/sample rate changes.  This
+   number will be incremented even for streamed (non-seekable) streams
+   (for seekable streams, it represents the actual logical bitstream
+   index within the physical bitstream.  Note that the accessor
+   functions above are aware of this dichotomy).
+
+   input values: buffer) a buffer to hold packed PCM data for return
+		 length) the byte length requested to be placed into buffer
+
+   return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL)
+                   0) EOF
+		   n) number of bytes of PCM actually returned.  The
+		   below works on a packet-by-packet basis, so the
+		   return length is not related to the 'length' passed
+		   in, just guaranteed to fit.
+
+	    *section) set to the logical bitstream number */
+
+long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
+  int i,j;
+
+  ogg_int32_t **pcm;
+  long samples;
+
+  if(vf->ready_state<OPENED)return(OV_EINVAL);
+
+  while(1){
+    if(vf->ready_state==INITSET){
+      samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
+      if(samples)break;
+    }
+
+    /* suck in another packet */
+    {
+      int ret=_fetch_and_process_packet(vf,1,1);
+      if(ret==OV_EOF)
+	return(0);
+      if(ret<=0)
+	return(ret);
+    }
+
+  }
+
+  if(samples>0){
+  
+    /* yay! proceed to pack data into the byte buffer */
+    
+    long channels=ov_info(vf,-1)->channels;
+
+    if(samples>(bytes_req/(2*channels)))
+      samples=bytes_req/(2*channels);      
+    
+    for(i=0;i<channels;i++) { /* It's faster in this order */
+      ogg_int32_t *src=pcm[i];
+      short *dest=((short *)buffer)+i;
+      for(j=0;j<samples;j++) {
+        *dest=CLIP_TO_15(src[j]>>9);
+        dest+=channels;
+      }
+    }
+    
+    vorbis_synthesis_read(&vf->vd,samples);
+    vf->pcm_offset+=samples;
+    if(bitstream)*bitstream=vf->current_link;
+    return(samples*2*channels);
+  }else{
+    return(samples);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/window.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,83 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: window functions
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <math.h>
+#include "misc.h"
+#include "window.h"
+#include "window_lookup.h"
+
+const void *_vorbis_window(int type, int left){
+
+  switch(type){
+  case 0:
+
+    switch(left){
+    case 32:
+      return vwin64;
+    case 64:
+      return vwin128;
+    case 128:
+      return vwin256;
+    case 256:
+      return vwin512;
+    case 512:
+      return vwin1024;
+    case 1024:
+      return vwin2048;
+    case 2048:
+      return vwin4096;
+    case 4096:
+      return vwin8192;
+    default:
+      return(0);
+    }
+    break;
+  default:
+    return(0);
+  }
+}
+
+void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
+			  long *blocksizes,
+			  int lW,int W,int nW){
+  
+  LOOKUP_T *window[2]={window_p[0],window_p[1]};
+  long n=blocksizes[W];
+  long ln=blocksizes[lW];
+  long rn=blocksizes[nW];
+
+  long leftbegin=n/4-ln/4;
+  long leftend=leftbegin+ln/2;
+
+  long rightbegin=n/2+n/4-rn/4;
+  long rightend=rightbegin+rn/2;
+  
+  int i,p;
+
+  for(i=0;i<leftbegin;i++)
+    d[i]=0;
+
+  for(p=0;i<leftend;i++,p++)
+    d[i]=MULT31(d[i],window[lW][p]);
+
+  for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--)
+    d[i]=MULT31(d[i],window[nW][p]);
+
+  for(;i<n;i++)
+    d[i]=0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/window.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,27 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: window functions
+
+ ********************************************************************/
+
+#ifndef _V_WINDOW_
+#define _V_WINDOW_
+
+extern const void *_vorbis_window(int type,int left);
+extern void _vorbis_apply_window(ogg_int32_t *d,const void *window[2],
+				 long *blocksizes,
+				 int lW,int W,int nW);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/libtremor/tremor/window_lookup.h	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,2084 @@
+/********************************************************************
+ *                                                   *
+ * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
+ *                                                                  *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
+ * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: window lookup tables
+
+ ********************************************************************/
+
+
+#include "os_types.h"
+
+static LOOKUP_T vwin64[32] = {
+  X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4),
+  X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676),
+  X(0x20a74d83), X(0x27f7137c), X(0x2fabb05a), X(0x37a1105a),
+  X(0x3fb0ab28), X(0x47b2dcd1), X(0x4f807bc6), X(0x56f48e70),
+  X(0x5dedfc79), X(0x64511653), X(0x6a08cfff), X(0x6f079328),
+  X(0x734796f4), X(0x76cab7f2), X(0x7999d6e8), X(0x7bc3cf9f),
+  X(0x7d5c20c1), X(0x7e7961df), X(0x7f33a567), X(0x7fa2e1d0),
+  X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f),
+};
+
+static LOOKUP_T vwin128[64] = {
+  X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294),
+  X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f),
+  X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd),
+  X(0x12469488), X(0x152e0c7a), X(0x1842a81c), X(0x1b81686d),
+  X(0x1ee705d9), X(0x226ff15d), X(0x26185705), X(0x29dc21cc),
+  X(0x2db700fe), X(0x31a46f08), X(0x359fb9c1), X(0x39a40c0c),
+  X(0x3dac78b6), X(0x41b40674), X(0x45b5bcb0), X(0x49acb109),
+  X(0x4d94152b), X(0x516744bd), X(0x5521d320), X(0x58bf98a5),
+  X(0x5c3cbef4), X(0x5f95cc5d), X(0x62c7add7), X(0x65cfbf64),
+  X(0x68abd2ba), X(0x6b5a3405), X(0x6dd9acab), X(0x7029840d),
+  X(0x72497e38), X(0x7439d8ac), X(0x75fb4532), X(0x778ee30a),
+  X(0x78f6367e), X(0x7a331f1a), X(0x7b47cccd), X(0x7c36b416),
+  X(0x7d028192), X(0x7dae0d18), X(0x7e3c4caa), X(0x7eb04763),
+  X(0x7f0d08a7), X(0x7f5593b7), X(0x7f8cd7d5), X(0x7fb5a513),
+  X(0x7fd2a1fc), X(0x7fe64212), X(0x7ff2bd4c), X(0x7ffa0890),
+  X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4),
+};
+
+static LOOKUP_T vwin256[128] = {
+  X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1),
+  X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f),
+  X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f),
+  X(0x04b17167), X(0x05776b90), X(0x064bfcdc), X(0x072efedd),
+  X(0x082047b4), X(0x091fa9f1), X(0x0a2cf477), X(0x0b47f25d),
+  X(0x0c706ad2), X(0x0da620ff), X(0x0ee8d3ef), X(0x10383e75),
+  X(0x11941716), X(0x12fc0ff6), X(0x146fd6c8), X(0x15ef14c2),
+  X(0x17796e8e), X(0x190e844f), X(0x1aadf196), X(0x1c574d6e),
+  X(0x1e0a2a62), X(0x1fc61688), X(0x218a9b9c), X(0x23573f12),
+  X(0x252b823d), X(0x2706e269), X(0x28e8d913), X(0x2ad0dc0e),
+  X(0x2cbe5dc1), X(0x2eb0cd60), X(0x30a79733), X(0x32a224d5),
+  X(0x349fdd8b), X(0x36a02690), X(0x38a2636f), X(0x3aa5f65e),
+  X(0x3caa409e), X(0x3eaea2df), X(0x40b27da6), X(0x42b531b8),
+  X(0x44b62086), X(0x46b4ac99), X(0x48b03a05), X(0x4aa82ed5),
+  X(0x4c9bf37d), X(0x4e8af349), X(0x50749ccb), X(0x52586246),
+  X(0x5435ba1c), X(0x560c1f31), X(0x57db1152), X(0x59a21591),
+  X(0x5b60b6a3), X(0x5d168535), X(0x5ec31839), X(0x60660d36),
+  X(0x61ff0886), X(0x638db595), X(0x6511c717), X(0x668af734),
+  X(0x67f907b0), X(0x695bc207), X(0x6ab2f787), X(0x6bfe815a),
+  X(0x6d3e4090), X(0x6e721e16), X(0x6f9a0ab5), X(0x70b5fef8),
+  X(0x71c5fb16), X(0x72ca06cd), X(0x73c2313d), X(0x74ae90b2),
+  X(0x758f4275), X(0x76646a85), X(0x772e335c), X(0x77eccda0),
+  X(0x78a06fd7), X(0x79495613), X(0x79e7c19c), X(0x7a7bf894),
+  X(0x7b064596), X(0x7b86f757), X(0x7bfe6044), X(0x7c6cd615),
+  X(0x7cd2b16e), X(0x7d304d71), X(0x7d860756), X(0x7dd43e06),
+  X(0x7e1b51ad), X(0x7e5ba355), X(0x7e95947e), X(0x7ec986bb),
+  X(0x7ef7db4a), X(0x7f20f2b9), X(0x7f452c7f), X(0x7f64e6a7),
+  X(0x7f807d71), X(0x7f984aff), X(0x7faca700), X(0x7fbde662),
+  X(0x7fcc5b04), X(0x7fd85372), X(0x7fe21a99), X(0x7fe9f791),
+  X(0x7ff02d58), X(0x7ff4fa9e), X(0x7ff89990), X(0x7ffb3faa),
+  X(0x7ffd1d8b), X(0x7ffe5ecc), X(0x7fff29e0), X(0x7fff9ff3),
+  X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc),
+};
+
+static LOOKUP_T vwin512[256] = {
+  X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c),
+  X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7),
+  X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc),
+  X(0x012e32b6), X(0x01605df5), X(0x01965b85), X(0x01d02939),
+  X(0x020dc4ba), X(0x024f2b83), X(0x02945ae6), X(0x02dd5004),
+  X(0x032a07d3), X(0x037a7f19), X(0x03ceb26e), X(0x04269e37),
+  X(0x04823eab), X(0x04e18fcc), X(0x05448d6d), X(0x05ab3329),
+  X(0x06157c68), X(0x0683645e), X(0x06f4e607), X(0x0769fc25),
+  X(0x07e2a146), X(0x085ecfbc), X(0x08de819f), X(0x0961b0cc),
+  X(0x09e856e3), X(0x0a726d46), X(0x0affed1d), X(0x0b90cf4c),
+  X(0x0c250c79), X(0x0cbc9d0b), X(0x0d577926), X(0x0df598aa),
+  X(0x0e96f337), X(0x0f3b8026), X(0x0fe3368f), X(0x108e0d42),
+  X(0x113bfaca), X(0x11ecf56b), X(0x12a0f324), X(0x1357e9ac),
+  X(0x1411ce70), X(0x14ce9698), X(0x158e3702), X(0x1650a444),
+  X(0x1715d2aa), X(0x17ddb638), X(0x18a842aa), X(0x19756b72),
+  X(0x1a4523b9), X(0x1b175e62), X(0x1bec0e04), X(0x1cc324f0),
+  X(0x1d9c9532), X(0x1e78508a), X(0x1f564876), X(0x20366e2e),
+  X(0x2118b2a2), X(0x21fd0681), X(0x22e35a37), X(0x23cb9dee),
+  X(0x24b5c18e), X(0x25a1b4c0), X(0x268f66f1), X(0x277ec74e),
+  X(0x286fc4cc), X(0x29624e23), X(0x2a5651d7), X(0x2b4bbe34),
+  X(0x2c428150), X(0x2d3a8913), X(0x2e33c332), X(0x2f2e1d35),
+  X(0x30298478), X(0x3125e62d), X(0x32232f61), X(0x33214cfc),
+  X(0x34202bc2), X(0x351fb85a), X(0x361fdf4f), X(0x37208d10),
+  X(0x3821adf7), X(0x39232e49), X(0x3a24fa3c), X(0x3b26fdf6),
+  X(0x3c292593), X(0x3d2b5d29), X(0x3e2d90c8), X(0x3f2fac7f),
+  X(0x40319c5f), X(0x41334c81), X(0x4234a905), X(0x43359e16),
+  X(0x443617f3), X(0x453602eb), X(0x46354b65), X(0x4733dde1),
+  X(0x4831a6ff), X(0x492e937f), X(0x4a2a9045), X(0x4b258a5f),
+  X(0x4c1f6f06), X(0x4d182ba2), X(0x4e0fadce), X(0x4f05e35b),
+  X(0x4ffaba53), X(0x50ee20fd), X(0x51e005e1), X(0x52d057ca),
+  X(0x53bf05ca), X(0x54abff3b), X(0x559733c7), X(0x56809365),
+  X(0x57680e62), X(0x584d955d), X(0x59311952), X(0x5a128b96),
+  X(0x5af1dddd), X(0x5bcf023a), X(0x5ca9eb27), X(0x5d828b81),
+  X(0x5e58d68d), X(0x5f2cbffc), X(0x5ffe3be9), X(0x60cd3edf),
+  X(0x6199bdda), X(0x6263ae45), X(0x632b0602), X(0x63efbb66),
+  X(0x64b1c53f), X(0x65711ad0), X(0x662db3d7), X(0x66e7888d),
+  X(0x679e91a5), X(0x6852c84e), X(0x69042635), X(0x69b2a582),
+  X(0x6a5e40dd), X(0x6b06f36c), X(0x6bacb8d2), X(0x6c4f8d30),
+  X(0x6cef6d26), X(0x6d8c55d4), X(0x6e2644d4), X(0x6ebd3840),
+  X(0x6f512ead), X(0x6fe2272e), X(0x7070214f), X(0x70fb1d17),
+  X(0x71831b06), X(0x72081c16), X(0x728a21b5), X(0x73092dc8),
+  X(0x738542a6), X(0x73fe631b), X(0x74749261), X(0x74e7d421),
+  X(0x75582c72), X(0x75c59fd5), X(0x76303333), X(0x7697ebdd),
+  X(0x76fccf85), X(0x775ee443), X(0x77be308a), X(0x781abb2e),
+  X(0x78748b59), X(0x78cba88e), X(0x79201aa7), X(0x7971e9cd),
+  X(0x79c11e79), X(0x7a0dc170), X(0x7a57dbc2), X(0x7a9f76c1),
+  X(0x7ae49c07), X(0x7b27556b), X(0x7b67ad02), X(0x7ba5ad1b),
+  X(0x7be1603a), X(0x7c1ad118), X(0x7c520a9e), X(0x7c8717e1),
+  X(0x7cba0421), X(0x7ceadac3), X(0x7d19a74f), X(0x7d46756e),
+  X(0x7d7150e5), X(0x7d9a4592), X(0x7dc15f69), X(0x7de6aa71),
+  X(0x7e0a32c0), X(0x7e2c0479), X(0x7e4c2bc7), X(0x7e6ab4db),
+  X(0x7e87abe9), X(0x7ea31d24), X(0x7ebd14be), X(0x7ed59edd),
+  X(0x7eecc7a3), X(0x7f029b21), X(0x7f17255a), X(0x7f2a723f),
+  X(0x7f3c8daa), X(0x7f4d835d), X(0x7f5d5f00), X(0x7f6c2c1b),
+  X(0x7f79f617), X(0x7f86c83a), X(0x7f92ada2), X(0x7f9db146),
+  X(0x7fa7ddf3), X(0x7fb13e46), X(0x7fb9dcb0), X(0x7fc1c36c),
+  X(0x7fc8fc83), X(0x7fcf91c7), X(0x7fd58cd2), X(0x7fdaf702),
+  X(0x7fdfd979), X(0x7fe43d1c), X(0x7fe82a8b), X(0x7febaa29),
+  X(0x7feec412), X(0x7ff1801c), X(0x7ff3e5d6), X(0x7ff5fc86),
+  X(0x7ff7cb29), X(0x7ff9586f), X(0x7ffaaaba), X(0x7ffbc81e),
+  X(0x7ffcb660), X(0x7ffd7af3), X(0x7ffe1afa), X(0x7ffe9b42),
+  X(0x7fff0047), X(0x7fff4e2f), X(0x7fff88c9), X(0x7fffb390),
+  X(0x7fffd1a6), X(0x7fffe5d7), X(0x7ffff296), X(0x7ffff9fd),
+  X(0x7ffffdcd), X(0x7fffff6d), X(0x7fffffed), X(0x7fffffff),
+};
+
+static LOOKUP_T vwin1024[512] = {
+  X(0x00001f02), X(0x0001170e), X(0x00030724), X(0x0005ef40),
+  X(0x0009cf59), X(0x000ea767), X(0x0014775e), X(0x001b3f2e),
+  X(0x0022fec8), X(0x002bb618), X(0x00356508), X(0x00400b81),
+  X(0x004ba968), X(0x00583ea0), X(0x0065cb0a), X(0x00744e84),
+  X(0x0083c8ea), X(0x00943a14), X(0x00a5a1da), X(0x00b80010),
+  X(0x00cb5488), X(0x00df9f10), X(0x00f4df76), X(0x010b1584),
+  X(0x01224101), X(0x013a61b2), X(0x01537759), X(0x016d81b6),
+  X(0x01888087), X(0x01a47385), X(0x01c15a69), X(0x01df34e6),
+  X(0x01fe02b1), X(0x021dc377), X(0x023e76e7), X(0x02601ca9),
+  X(0x0282b466), X(0x02a63dc1), X(0x02cab85d), X(0x02f023d6),
+  X(0x03167fcb), X(0x033dcbd3), X(0x03660783), X(0x038f3270),
+  X(0x03b94c29), X(0x03e4543a), X(0x04104a2e), X(0x043d2d8b),
+  X(0x046afdd5), X(0x0499ba8c), X(0x04c9632d), X(0x04f9f734),
+  X(0x052b7615), X(0x055ddf46), X(0x05913237), X(0x05c56e53),
+  X(0x05fa9306), X(0x06309fb6), X(0x066793c5), X(0x069f6e93),
+  X(0x06d82f7c), X(0x0711d5d9), X(0x074c60fe), X(0x0787d03d),
+  X(0x07c422e4), X(0x0801583e), X(0x083f6f91), X(0x087e681f),
+  X(0x08be4129), X(0x08fef9ea), X(0x0940919a), X(0x0983076d),
+  X(0x09c65a92), X(0x0a0a8a38), X(0x0a4f9585), X(0x0a957b9f),
+  X(0x0adc3ba7), X(0x0b23d4b9), X(0x0b6c45ee), X(0x0bb58e5a),
+  X(0x0bffad0f), X(0x0c4aa11a), X(0x0c966982), X(0x0ce3054d),
+  X(0x0d30737b), X(0x0d7eb308), X(0x0dcdc2eb), X(0x0e1da21a),
+  X(0x0e6e4f83), X(0x0ebfca11), X(0x0f1210ad), X(0x0f652238),
+  X(0x0fb8fd91), X(0x100da192), X(0x10630d11), X(0x10b93ee0),
+  X(0x111035cb), X(0x1167f09a), X(0x11c06e13), X(0x1219acf5),
+  X(0x1273abfb), X(0x12ce69db), X(0x1329e54a), X(0x13861cf3),
+  X(0x13e30f80), X(0x1440bb97), X(0x149f1fd8), X(0x14fe3ade),
+  X(0x155e0b40), X(0x15be8f92), X(0x161fc662), X(0x1681ae38),
+  X(0x16e4459b), X(0x17478b0b), X(0x17ab7d03), X(0x181019fb),
+  X(0x18756067), X(0x18db4eb3), X(0x1941e34a), X(0x19a91c92),
+  X(0x1a10f8ea), X(0x1a7976af), X(0x1ae29439), X(0x1b4c4fda),
+  X(0x1bb6a7e2), X(0x1c219a9a), X(0x1c8d2649), X(0x1cf9492e),
+  X(0x1d660188), X(0x1dd34d8e), X(0x1e412b74), X(0x1eaf996a),
+  X(0x1f1e959b), X(0x1f8e1e2f), X(0x1ffe3146), X(0x206ecd01),
+  X(0x20dfef78), X(0x215196c2), X(0x21c3c0f0), X(0x22366c10),
+  X(0x22a9962a), X(0x231d3d45), X(0x23915f60), X(0x2405fa7a),
+  X(0x247b0c8c), X(0x24f09389), X(0x25668d65), X(0x25dcf80c),
+  X(0x2653d167), X(0x26cb175e), X(0x2742c7d0), X(0x27bae09e),
+  X(0x28335fa2), X(0x28ac42b3), X(0x292587a5), X(0x299f2c48),
+  X(0x2a192e69), X(0x2a938bd1), X(0x2b0e4247), X(0x2b894f8d),
+  X(0x2c04b164), X(0x2c806588), X(0x2cfc69b2), X(0x2d78bb9a),
+  X(0x2df558f4), X(0x2e723f6f), X(0x2eef6cbb), X(0x2f6cde83),
+  X(0x2fea9270), X(0x30688627), X(0x30e6b74e), X(0x31652385),
+  X(0x31e3c86b), X(0x3262a39e), X(0x32e1b2b8), X(0x3360f352),
+  X(0x33e06303), X(0x345fff5e), X(0x34dfc5f8), X(0x355fb462),
+  X(0x35dfc82a), X(0x365ffee0), X(0x36e0560f), X(0x3760cb43),
+  X(0x37e15c05), X(0x386205df), X(0x38e2c657), X(0x39639af5),
+  X(0x39e4813e), X(0x3a6576b6), X(0x3ae678e3), X(0x3b678547),
+  X(0x3be89965), X(0x3c69b2c1), X(0x3ceacedc), X(0x3d6beb37),
+  X(0x3ded0557), X(0x3e6e1abb), X(0x3eef28e6), X(0x3f702d5a),
+  X(0x3ff1259a), X(0x40720f29), X(0x40f2e789), X(0x4173ac3f),
+  X(0x41f45ad0), X(0x4274f0c2), X(0x42f56b9a), X(0x4375c8e0),
+  X(0x43f6061d), X(0x447620db), X(0x44f616a5), X(0x4575e509),
+  X(0x45f58994), X(0x467501d6), X(0x46f44b62), X(0x477363cb),
+  X(0x47f248a6), X(0x4870f78e), X(0x48ef6e1a), X(0x496da9e8),
+  X(0x49eba897), X(0x4a6967c8), X(0x4ae6e521), X(0x4b641e47),
+  X(0x4be110e5), X(0x4c5dbaa7), X(0x4cda193f), X(0x4d562a5f),
+  X(0x4dd1ebbd), X(0x4e4d5b15), X(0x4ec87623), X(0x4f433aa9),
+  X(0x4fbda66c), X(0x5037b734), X(0x50b16acf), X(0x512abf0e),
+  X(0x51a3b1c5), X(0x521c40ce), X(0x52946a06), X(0x530c2b50),
+  X(0x53838292), X(0x53fa6db8), X(0x5470eab3), X(0x54e6f776),
+  X(0x555c91fc), X(0x55d1b844), X(0x56466851), X(0x56baa02f),
+  X(0x572e5deb), X(0x57a19f98), X(0x58146352), X(0x5886a737),
+  X(0x58f8696d), X(0x5969a81c), X(0x59da6177), X(0x5a4a93b4),
+  X(0x5aba3d0f), X(0x5b295bcb), X(0x5b97ee30), X(0x5c05f28d),
+  X(0x5c736738), X(0x5ce04a8d), X(0x5d4c9aed), X(0x5db856c1),
+  X(0x5e237c78), X(0x5e8e0a89), X(0x5ef7ff6f), X(0x5f6159b0),
+  X(0x5fca17d4), X(0x6032386e), X(0x6099ba15), X(0x61009b69),
+  X(0x6166db11), X(0x61cc77b9), X(0x62317017), X(0x6295c2e7),
+  X(0x62f96eec), X(0x635c72f1), X(0x63becdc8), X(0x64207e4b),
+  X(0x6481835a), X(0x64e1dbde), X(0x654186c8), X(0x65a0830e),
+  X(0x65fecfb1), X(0x665c6bb7), X(0x66b95630), X(0x67158e30),
+  X(0x677112d7), X(0x67cbe34b), X(0x6825feb9), X(0x687f6456),
+  X(0x68d81361), X(0x69300b1e), X(0x69874ada), X(0x69ddd1ea),
+  X(0x6a339fab), X(0x6a88b382), X(0x6add0cdb), X(0x6b30ab2a),
+  X(0x6b838dec), X(0x6bd5b4a6), X(0x6c271ee2), X(0x6c77cc36),
+  X(0x6cc7bc3d), X(0x6d16ee9b), X(0x6d6562fb), X(0x6db31911),
+  X(0x6e001099), X(0x6e4c4955), X(0x6e97c311), X(0x6ee27d9f),
+  X(0x6f2c78d9), X(0x6f75b4a2), X(0x6fbe30e4), X(0x7005ed91),
+  X(0x704ceaa1), X(0x70932816), X(0x70d8a5f8), X(0x711d6457),
+  X(0x7161634b), X(0x71a4a2f3), X(0x71e72375), X(0x7228e500),
+  X(0x7269e7c8), X(0x72aa2c0a), X(0x72e9b209), X(0x73287a12),
+  X(0x73668476), X(0x73a3d18f), X(0x73e061bc), X(0x741c3566),
+  X(0x74574cfa), X(0x7491a8ee), X(0x74cb49be), X(0x75042fec),
+  X(0x753c5c03), X(0x7573ce92), X(0x75aa882f), X(0x75e08979),
+  X(0x7615d313), X(0x764a65a7), X(0x767e41e5), X(0x76b16884),
+  X(0x76e3da40), X(0x771597dc), X(0x7746a221), X(0x7776f9dd),
+  X(0x77a69fe6), X(0x77d59514), X(0x7803da49), X(0x7831706a),
+  X(0x785e5861), X(0x788a9320), X(0x78b6219c), X(0x78e104cf),
+  X(0x790b3dbb), X(0x7934cd64), X(0x795db4d5), X(0x7985f51d),
+  X(0x79ad8f50), X(0x79d48486), X(0x79fad5de), X(0x7a208478),
+  X(0x7a45917b), X(0x7a69fe12), X(0x7a8dcb6c), X(0x7ab0fabb),
+  X(0x7ad38d36), X(0x7af5841a), X(0x7b16e0a3), X(0x7b37a416),
+  X(0x7b57cfb8), X(0x7b7764d4), X(0x7b9664b6), X(0x7bb4d0b0),
+  X(0x7bd2aa14), X(0x7beff23b), X(0x7c0caa7f), X(0x7c28d43c),
+  X(0x7c4470d2), X(0x7c5f81a5), X(0x7c7a081a), X(0x7c940598),
+  X(0x7cad7b8b), X(0x7cc66b5e), X(0x7cded680), X(0x7cf6be64),
+  X(0x7d0e247b), X(0x7d250a3c), X(0x7d3b711c), X(0x7d515a95),
+  X(0x7d66c822), X(0x7d7bbb3c), X(0x7d903563), X(0x7da43814),
+  X(0x7db7c4d0), X(0x7dcadd16), X(0x7ddd826a), X(0x7defb64d),
+  X(0x7e017a44), X(0x7e12cfd3), X(0x7e23b87f), X(0x7e3435cc),
+  X(0x7e444943), X(0x7e53f467), X(0x7e6338c0), X(0x7e7217d5),
+  X(0x7e80932b), X(0x7e8eac49), X(0x7e9c64b7), X(0x7ea9bdf8),
+  X(0x7eb6b994), X(0x7ec35910), X(0x7ecf9def), X(0x7edb89b6),
+  X(0x7ee71de9), X(0x7ef25c09), X(0x7efd4598), X(0x7f07dc16),
+  X(0x7f122103), X(0x7f1c15dc), X(0x7f25bc1f), X(0x7f2f1547),
+  X(0x7f3822cd), X(0x7f40e62b), X(0x7f4960d6), X(0x7f519443),
+  X(0x7f5981e7), X(0x7f612b31), X(0x7f689191), X(0x7f6fb674),
+  X(0x7f769b45), X(0x7f7d416c), X(0x7f83aa51), X(0x7f89d757),
+  X(0x7f8fc9df), X(0x7f958348), X(0x7f9b04ef), X(0x7fa0502e),
+  X(0x7fa56659), X(0x7faa48c7), X(0x7faef8c7), X(0x7fb377a7),
+  X(0x7fb7c6b3), X(0x7fbbe732), X(0x7fbfda67), X(0x7fc3a196),
+  X(0x7fc73dfa), X(0x7fcab0ce), X(0x7fcdfb4a), X(0x7fd11ea0),
+  X(0x7fd41c00), X(0x7fd6f496), X(0x7fd9a989), X(0x7fdc3bff),
+  X(0x7fdead17), X(0x7fe0fdee), X(0x7fe32f9d), X(0x7fe54337),
+  X(0x7fe739ce), X(0x7fe9146c), X(0x7fead41b), X(0x7fec79dd),
+  X(0x7fee06b2), X(0x7fef7b94), X(0x7ff0d97b), X(0x7ff22158),
+  X(0x7ff35417), X(0x7ff472a3), X(0x7ff57de0), X(0x7ff676ac),
+  X(0x7ff75de3), X(0x7ff8345a), X(0x7ff8fae4), X(0x7ff9b24b),
+  X(0x7ffa5b58), X(0x7ffaf6cd), X(0x7ffb8568), X(0x7ffc07e2),
+  X(0x7ffc7eed), X(0x7ffceb38), X(0x7ffd4d6d), X(0x7ffda631),
+  X(0x7ffdf621), X(0x7ffe3dd8), X(0x7ffe7dea), X(0x7ffeb6e7),
+  X(0x7ffee959), X(0x7fff15c4), X(0x7fff3ca9), X(0x7fff5e80),
+  X(0x7fff7bc0), X(0x7fff94d6), X(0x7fffaa2d), X(0x7fffbc29),
+  X(0x7fffcb29), X(0x7fffd786), X(0x7fffe195), X(0x7fffe9a3),
+  X(0x7fffeffa), X(0x7ffff4dd), X(0x7ffff889), X(0x7ffffb37),
+  X(0x7ffffd1a), X(0x7ffffe5d), X(0x7fffff29), X(0x7fffffa0),
+  X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff),
+};
+
+static LOOKUP_T vwin2048[1024] = {
+  X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3),
+  X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007),
+  X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),
+  X(0x0012ec23), X(0x00161216), X(0x001975fe), X(0x001d17da),
+  X(0x0020f7a8), X(0x00251564), X(0x0029710c), X(0x002e0a9e),
+  X(0x0032e217), X(0x0037f773), X(0x003d4ab0), X(0x0042dbca),
+  X(0x0048aabe), X(0x004eb788), X(0x00550224), X(0x005b8a8f),
+  X(0x006250c5), X(0x006954c1), X(0x0070967e), X(0x007815f9),
+  X(0x007fd32c), X(0x0087ce13), X(0x009006a9), X(0x00987ce9),
+  X(0x00a130cc), X(0x00aa224f), X(0x00b3516b), X(0x00bcbe1a),
+  X(0x00c66856), X(0x00d0501a), X(0x00da755f), X(0x00e4d81f),
+  X(0x00ef7853), X(0x00fa55f4), X(0x010570fc), X(0x0110c963),
+  X(0x011c5f22), X(0x01283232), X(0x0134428c), X(0x01409027),
+  X(0x014d1afb), X(0x0159e302), X(0x0166e831), X(0x01742a82),
+  X(0x0181a9ec), X(0x018f6665), X(0x019d5fe5), X(0x01ab9663),
+  X(0x01ba09d6), X(0x01c8ba34), X(0x01d7a775), X(0x01e6d18d),
+  X(0x01f63873), X(0x0205dc1e), X(0x0215bc82), X(0x0225d997),
+  X(0x02363350), X(0x0246c9a3), X(0x02579c86), X(0x0268abed),
+  X(0x0279f7cc), X(0x028b801a), X(0x029d44c9), X(0x02af45ce),
+  X(0x02c1831d), X(0x02d3fcaa), X(0x02e6b269), X(0x02f9a44c),
+  X(0x030cd248), X(0x03203c4f), X(0x0333e255), X(0x0347c44b),
+  X(0x035be225), X(0x03703bd5), X(0x0384d14d), X(0x0399a280),
+  X(0x03aeaf5e), X(0x03c3f7d9), X(0x03d97be4), X(0x03ef3b6e),
+  X(0x0405366a), X(0x041b6cc8), X(0x0431de78), X(0x04488b6c),
+  X(0x045f7393), X(0x047696dd), X(0x048df53b), X(0x04a58e9b),
+  X(0x04bd62ee), X(0x04d57223), X(0x04edbc28), X(0x050640ed),
+  X(0x051f0060), X(0x0537fa70), X(0x05512f0a), X(0x056a9e1e),
+  X(0x05844798), X(0x059e2b67), X(0x05b84978), X(0x05d2a1b8),
+  X(0x05ed3414), X(0x06080079), X(0x062306d3), X(0x063e470f),
+  X(0x0659c119), X(0x067574dd), X(0x06916247), X(0x06ad8941),
+  X(0x06c9e9b8), X(0x06e68397), X(0x070356c8), X(0x07206336),
+  X(0x073da8cb), X(0x075b2772), X(0x0778df15), X(0x0796cf9c),
+  X(0x07b4f8f3), X(0x07d35b01), X(0x07f1f5b1), X(0x0810c8eb),
+  X(0x082fd497), X(0x084f189e), X(0x086e94e9), X(0x088e495e),
+  X(0x08ae35e6), X(0x08ce5a68), X(0x08eeb6cc), X(0x090f4af8),
+  X(0x093016d3), X(0x09511a44), X(0x09725530), X(0x0993c77f),
+  X(0x09b57115), X(0x09d751d8), X(0x09f969ae), X(0x0a1bb87c),
+  X(0x0a3e3e26), X(0x0a60fa91), X(0x0a83eda2), X(0x0aa7173c),
+  X(0x0aca7743), X(0x0aee0d9b), X(0x0b11da28), X(0x0b35dccc),
+  X(0x0b5a156a), X(0x0b7e83e5), X(0x0ba3281f), X(0x0bc801fa),
+  X(0x0bed1159), X(0x0c12561c), X(0x0c37d025), X(0x0c5d7f55),
+  X(0x0c83638d), X(0x0ca97cae), X(0x0ccfca97), X(0x0cf64d2a),
+  X(0x0d1d0444), X(0x0d43efc7), X(0x0d6b0f92), X(0x0d926383),
+  X(0x0db9eb79), X(0x0de1a752), X(0x0e0996ee), X(0x0e31ba29),
+  X(0x0e5a10e2), X(0x0e829af6), X(0x0eab5841), X(0x0ed448a2),
+  X(0x0efd6bf4), X(0x0f26c214), X(0x0f504ade), X(0x0f7a062e),
+  X(0x0fa3f3df), X(0x0fce13cd), X(0x0ff865d2), X(0x1022e9ca),
+  X(0x104d9f8e), X(0x107886f9), X(0x10a39fe5), X(0x10ceea2c),
+  X(0x10fa65a6), X(0x1126122d), X(0x1151ef9a), X(0x117dfdc5),
+  X(0x11aa3c87), X(0x11d6abb6), X(0x12034b2c), X(0x12301ac0),
+  X(0x125d1a48), X(0x128a499b), X(0x12b7a891), X(0x12e536ff),
+  X(0x1312f4bb), X(0x1340e19c), X(0x136efd75), X(0x139d481e),
+  X(0x13cbc16a), X(0x13fa692f), X(0x14293f40), X(0x14584371),
+  X(0x14877597), X(0x14b6d585), X(0x14e6630d), X(0x15161e04),
+  X(0x1546063b), X(0x15761b85), X(0x15a65db3), X(0x15d6cc99),
+  X(0x16076806), X(0x16382fcd), X(0x166923bf), X(0x169a43ab),
+  X(0x16cb8f62), X(0x16fd06b5), X(0x172ea973), X(0x1760776b),
+  X(0x1792706e), X(0x17c49449), X(0x17f6e2cb), X(0x18295bc3),
+  X(0x185bfeff), X(0x188ecc4c), X(0x18c1c379), X(0x18f4e452),
+  X(0x19282ea4), X(0x195ba23c), X(0x198f3ee6), X(0x19c3046e),
+  X(0x19f6f2a1), X(0x1a2b094a), X(0x1a5f4833), X(0x1a93af28),
+  X(0x1ac83df3), X(0x1afcf460), X(0x1b31d237), X(0x1b66d744),
+  X(0x1b9c034e), X(0x1bd15621), X(0x1c06cf84), X(0x1c3c6f40),
+  X(0x1c72351e), X(0x1ca820e6), X(0x1cde3260), X(0x1d146953),
+  X(0x1d4ac587), X(0x1d8146c3), X(0x1db7eccd), X(0x1deeb76c),
+  X(0x1e25a667), X(0x1e5cb982), X(0x1e93f085), X(0x1ecb4b33),
+  X(0x1f02c953), X(0x1f3a6aaa), X(0x1f722efb), X(0x1faa160b),
+  X(0x1fe21f9e), X(0x201a4b79), X(0x2052995d), X(0x208b0910),
+  X(0x20c39a53), X(0x20fc4cea), X(0x21352097), X(0x216e151c),
+  X(0x21a72a3a), X(0x21e05fb5), X(0x2219b54d), X(0x22532ac3),
+  X(0x228cbfd8), X(0x22c6744d), X(0x230047e2), X(0x233a3a58),
+  X(0x23744b6d), X(0x23ae7ae3), X(0x23e8c878), X(0x242333ec),
+  X(0x245dbcfd), X(0x24986369), X(0x24d326f1), X(0x250e0750),
+  X(0x25490446), X(0x25841d90), X(0x25bf52ec), X(0x25faa417),
+  X(0x263610cd), X(0x267198cc), X(0x26ad3bcf), X(0x26e8f994),
+  X(0x2724d1d6), X(0x2760c451), X(0x279cd0c0), X(0x27d8f6e0),
+  X(0x2815366a), X(0x28518f1b), X(0x288e00ac), X(0x28ca8ad8),
+  X(0x29072d5a), X(0x2943e7eb), X(0x2980ba45), X(0x29bda422),
+  X(0x29faa53c), X(0x2a37bd4a), X(0x2a74ec07), X(0x2ab2312b),
+  X(0x2aef8c6f), X(0x2b2cfd8b), X(0x2b6a8437), X(0x2ba8202c),
+  X(0x2be5d120), X(0x2c2396cc), X(0x2c6170e7), X(0x2c9f5f29),
+  X(0x2cdd6147), X(0x2d1b76fa), X(0x2d599ff7), X(0x2d97dbf5),
+  X(0x2dd62aab), X(0x2e148bcf), X(0x2e52ff16), X(0x2e918436),
+  X(0x2ed01ae5), X(0x2f0ec2d9), X(0x2f4d7bc6), X(0x2f8c4562),
+  X(0x2fcb1f62), X(0x300a097a), X(0x3049035f), X(0x30880cc6),
+  X(0x30c72563), X(0x31064cea), X(0x3145830f), X(0x3184c786),
+  X(0x31c41a03), X(0x32037a39), X(0x3242e7dc), X(0x3282629f),
+  X(0x32c1ea36), X(0x33017e53), X(0x33411ea9), X(0x3380caec),
+  X(0x33c082ce), X(0x34004602), X(0x34401439), X(0x347fed27),
+  X(0x34bfd07e), X(0x34ffbdf0), X(0x353fb52e), X(0x357fb5ec),
+  X(0x35bfbfda), X(0x35ffd2aa), X(0x363fee0f), X(0x368011b9),
+  X(0x36c03d5a), X(0x370070a4), X(0x3740ab48), X(0x3780ecf7),
+  X(0x37c13562), X(0x3801843a), X(0x3841d931), X(0x388233f7),
+  X(0x38c2943d), X(0x3902f9b4), X(0x3943640d), X(0x3983d2f8),
+  X(0x39c44626), X(0x3a04bd48), X(0x3a45380e), X(0x3a85b62a),
+  X(0x3ac6374a), X(0x3b06bb20), X(0x3b47415c), X(0x3b87c9ae),
+  X(0x3bc853c7), X(0x3c08df57), X(0x3c496c0f), X(0x3c89f99f),
+  X(0x3cca87b6), X(0x3d0b1605), X(0x3d4ba43d), X(0x3d8c320e),
+  X(0x3dccbf27), X(0x3e0d4b3a), X(0x3e4dd5f6), X(0x3e8e5f0c),
+  X(0x3ecee62b), X(0x3f0f6b05), X(0x3f4fed49), X(0x3f906ca8),
+  X(0x3fd0e8d2), X(0x40116177), X(0x4051d648), X(0x409246f6),
+  X(0x40d2b330), X(0x41131aa7), X(0x41537d0c), X(0x4193da10),
+  X(0x41d43162), X(0x421482b4), X(0x4254cdb7), X(0x4295121b),
+  X(0x42d54f91), X(0x431585ca), X(0x4355b477), X(0x4395db49),
+  X(0x43d5f9f1), X(0x44161021), X(0x44561d8a), X(0x449621dd),
+  X(0x44d61ccc), X(0x45160e08), X(0x4555f544), X(0x4595d230),
+  X(0x45d5a47f), X(0x46156be3), X(0x4655280e), X(0x4694d8b2),
+  X(0x46d47d82), X(0x4714162f), X(0x4753a26d), X(0x479321ef),
+  X(0x47d29466), X(0x4811f987), X(0x48515104), X(0x48909a91),
+  X(0x48cfd5e1), X(0x490f02a7), X(0x494e2098), X(0x498d2f66),
+  X(0x49cc2ec7), X(0x4a0b1e6f), X(0x4a49fe11), X(0x4a88cd62),
+  X(0x4ac78c18), X(0x4b0639e6), X(0x4b44d683), X(0x4b8361a2),
+  X(0x4bc1dafa), X(0x4c004241), X(0x4c3e972c), X(0x4c7cd970),
+  X(0x4cbb08c5), X(0x4cf924e1), X(0x4d372d7a), X(0x4d752247),
+  X(0x4db30300), X(0x4df0cf5a), X(0x4e2e870f), X(0x4e6c29d6),
+  X(0x4ea9b766), X(0x4ee72f78), X(0x4f2491c4), X(0x4f61de02),
+  X(0x4f9f13ec), X(0x4fdc333b), X(0x50193ba8), X(0x50562ced),
+  X(0x509306c3), X(0x50cfc8e5), X(0x510c730d), X(0x514904f6),
+  X(0x51857e5a), X(0x51c1def5), X(0x51fe2682), X(0x523a54bc),
+  X(0x52766961), X(0x52b2642c), X(0x52ee44d9), X(0x532a0b26),
+  X(0x5365b6d0), X(0x53a14793), X(0x53dcbd2f), X(0x54181760),
+  X(0x545355e5), X(0x548e787d), X(0x54c97ee6), X(0x550468e1),
+  X(0x553f362c), X(0x5579e687), X(0x55b479b3), X(0x55eeef70),
+  X(0x5629477f), X(0x566381a1), X(0x569d9d97), X(0x56d79b24),
+  X(0x57117a0a), X(0x574b3a0a), X(0x5784dae9), X(0x57be5c69),
+  X(0x57f7be4d), X(0x5831005a), X(0x586a2254), X(0x58a32400),
+  X(0x58dc0522), X(0x5914c57f), X(0x594d64de), X(0x5985e305),
+  X(0x59be3fba), X(0x59f67ac3), X(0x5a2e93e9), X(0x5a668af2),
+  X(0x5a9e5fa6), X(0x5ad611ce), X(0x5b0da133), X(0x5b450d9d),
+  X(0x5b7c56d7), X(0x5bb37ca9), X(0x5bea7ede), X(0x5c215d41),
+  X(0x5c58179d), X(0x5c8eadbe), X(0x5cc51f6f), X(0x5cfb6c7c),
+  X(0x5d3194b2), X(0x5d6797de), X(0x5d9d75cf), X(0x5dd32e51),
+  X(0x5e08c132), X(0x5e3e2e43), X(0x5e737551), X(0x5ea8962d),
+  X(0x5edd90a7), X(0x5f12648e), X(0x5f4711b4), X(0x5f7b97ea),
+  X(0x5faff702), X(0x5fe42ece), X(0x60183f20), X(0x604c27cc),
+  X(0x607fe8a6), X(0x60b38180), X(0x60e6f22f), X(0x611a3a89),
+  X(0x614d5a62), X(0x61805190), X(0x61b31fe9), X(0x61e5c545),
+  X(0x62184179), X(0x624a945d), X(0x627cbdca), X(0x62aebd98),
+  X(0x62e0939f), X(0x63123fba), X(0x6343c1c1), X(0x6375198f),
+  X(0x63a646ff), X(0x63d749ec), X(0x64082232), X(0x6438cfad),
+  X(0x64695238), X(0x6499a9b3), X(0x64c9d5f9), X(0x64f9d6ea),
+  X(0x6529ac63), X(0x65595643), X(0x6588d46a), X(0x65b826b8),
+  X(0x65e74d0e), X(0x6616474b), X(0x66451552), X(0x6673b704),
+  X(0x66a22c44), X(0x66d074f4), X(0x66fe90f8), X(0x672c8033),
+  X(0x675a428a), X(0x6787d7e1), X(0x67b5401f), X(0x67e27b27),
+  X(0x680f88e1), X(0x683c6934), X(0x68691c05), X(0x6895a13e),
+  X(0x68c1f8c7), X(0x68ee2287), X(0x691a1e68), X(0x6945ec54),
+  X(0x69718c35), X(0x699cfdf5), X(0x69c8417f), X(0x69f356c0),
+  X(0x6a1e3da3), X(0x6a48f615), X(0x6a738002), X(0x6a9ddb5a),
+  X(0x6ac80808), X(0x6af205fd), X(0x6b1bd526), X(0x6b457575),
+  X(0x6b6ee6d8), X(0x6b982940), X(0x6bc13c9f), X(0x6bea20e5),
+  X(0x6c12d605), X(0x6c3b5bf1), X(0x6c63b29c), X(0x6c8bd9fb),
+  X(0x6cb3d200), X(0x6cdb9aa0), X(0x6d0333d0), X(0x6d2a9d86),
+  X(0x6d51d7b7), X(0x6d78e25a), X(0x6d9fbd67), X(0x6dc668d3),
+  X(0x6dece498), X(0x6e1330ad), X(0x6e394d0c), X(0x6e5f39ae),
+  X(0x6e84f68d), X(0x6eaa83a2), X(0x6ecfe0ea), X(0x6ef50e5e),
+  X(0x6f1a0bfc), X(0x6f3ed9bf), X(0x6f6377a4), X(0x6f87e5a8),
+  X(0x6fac23c9), X(0x6fd03206), X(0x6ff4105c), X(0x7017becc),
+  X(0x703b3d54), X(0x705e8bf5), X(0x7081aaaf), X(0x70a49984),
+  X(0x70c75874), X(0x70e9e783), X(0x710c46b2), X(0x712e7605),
+  X(0x7150757f), X(0x71724523), X(0x7193e4f6), X(0x71b554fd),
+  X(0x71d6953e), X(0x71f7a5bd), X(0x72188681), X(0x72393792),
+  X(0x7259b8f5), X(0x727a0ab2), X(0x729a2cd2), X(0x72ba1f5d),
+  X(0x72d9e25c), X(0x72f975d8), X(0x7318d9db), X(0x73380e6f),
+  X(0x735713a0), X(0x7375e978), X(0x73949003), X(0x73b3074c),
+  X(0x73d14f61), X(0x73ef684f), X(0x740d5222), X(0x742b0ce9),
+  X(0x744898b1), X(0x7465f589), X(0x74832381), X(0x74a022a8),
+  X(0x74bcf30e), X(0x74d994c3), X(0x74f607d8), X(0x75124c5f),
+  X(0x752e6268), X(0x754a4a05), X(0x7566034b), X(0x75818e4a),
+  X(0x759ceb16), X(0x75b819c4), X(0x75d31a66), X(0x75eded12),
+  X(0x760891dc), X(0x762308da), X(0x763d5221), X(0x76576dc8),
+  X(0x76715be4), X(0x768b1c8c), X(0x76a4afd9), X(0x76be15e0),
+  X(0x76d74ebb), X(0x76f05a82), X(0x7709394d), X(0x7721eb35),
+  X(0x773a7054), X(0x7752c8c4), X(0x776af49f), X(0x7782f400),
+  X(0x779ac701), X(0x77b26dbd), X(0x77c9e851), X(0x77e136d8),
+  X(0x77f8596f), X(0x780f5032), X(0x78261b3f), X(0x783cbab2),
+  X(0x78532eaa), X(0x78697745), X(0x787f94a0), X(0x789586db),
+  X(0x78ab4e15), X(0x78c0ea6d), X(0x78d65c03), X(0x78eba2f7),
+  X(0x7900bf68), X(0x7915b179), X(0x792a7949), X(0x793f16fb),
+  X(0x79538aaf), X(0x7967d488), X(0x797bf4a8), X(0x798feb31),
+  X(0x79a3b846), X(0x79b75c0a), X(0x79cad6a1), X(0x79de282e),
+  X(0x79f150d5), X(0x7a0450bb), X(0x7a172803), X(0x7a29d6d3),
+  X(0x7a3c5d50), X(0x7a4ebb9f), X(0x7a60f1e6), X(0x7a73004a),
+  X(0x7a84e6f2), X(0x7a96a604), X(0x7aa83da7), X(0x7ab9ae01),
+  X(0x7acaf73a), X(0x7adc1979), X(0x7aed14e6), X(0x7afde9a8),
+  X(0x7b0e97e8), X(0x7b1f1fcd), X(0x7b2f8182), X(0x7b3fbd2d),
+  X(0x7b4fd2f9), X(0x7b5fc30f), X(0x7b6f8d98), X(0x7b7f32bd),
+  X(0x7b8eb2a9), X(0x7b9e0d85), X(0x7bad437d), X(0x7bbc54b9),
+  X(0x7bcb4166), X(0x7bda09ae), X(0x7be8adbc), X(0x7bf72dbc),
+  X(0x7c0589d8), X(0x7c13c23d), X(0x7c21d716), X(0x7c2fc88f),
+  X(0x7c3d96d5), X(0x7c4b4214), X(0x7c58ca78), X(0x7c66302d),
+  X(0x7c737362), X(0x7c809443), X(0x7c8d92fc), X(0x7c9a6fbc),
+  X(0x7ca72aaf), X(0x7cb3c404), X(0x7cc03be8), X(0x7ccc9288),
+  X(0x7cd8c814), X(0x7ce4dcb9), X(0x7cf0d0a5), X(0x7cfca406),
+  X(0x7d08570c), X(0x7d13e9e5), X(0x7d1f5cbf), X(0x7d2aafca),
+  X(0x7d35e335), X(0x7d40f72e), X(0x7d4bebe4), X(0x7d56c188),
+  X(0x7d617848), X(0x7d6c1054), X(0x7d7689db), X(0x7d80e50e),
+  X(0x7d8b221b), X(0x7d954133), X(0x7d9f4286), X(0x7da92643),
+  X(0x7db2ec9b), X(0x7dbc95bd), X(0x7dc621da), X(0x7dcf9123),
+  X(0x7dd8e3c6), X(0x7de219f6), X(0x7deb33e2), X(0x7df431ba),
+  X(0x7dfd13af), X(0x7e05d9f2), X(0x7e0e84b4), X(0x7e171424),
+  X(0x7e1f8874), X(0x7e27e1d4), X(0x7e302074), X(0x7e384487),
+  X(0x7e404e3c), X(0x7e483dc4), X(0x7e501350), X(0x7e57cf11),
+  X(0x7e5f7138), X(0x7e66f9f4), X(0x7e6e6979), X(0x7e75bff5),
+  X(0x7e7cfd9a), X(0x7e842298), X(0x7e8b2f22), X(0x7e922366),
+  X(0x7e98ff97), X(0x7e9fc3e4), X(0x7ea6707f), X(0x7ead0598),
+  X(0x7eb38360), X(0x7eb9ea07), X(0x7ec039bf), X(0x7ec672b7),
+  X(0x7ecc9521), X(0x7ed2a12c), X(0x7ed8970a), X(0x7ede76ea),
+  X(0x7ee440fd), X(0x7ee9f573), X(0x7eef947d), X(0x7ef51e4b),
+  X(0x7efa930d), X(0x7efff2f2), X(0x7f053e2b), X(0x7f0a74e8),
+  X(0x7f0f9758), X(0x7f14a5ac), X(0x7f19a013), X(0x7f1e86bc),
+  X(0x7f2359d8), X(0x7f281995), X(0x7f2cc623), X(0x7f315fb1),
+  X(0x7f35e66e), X(0x7f3a5a8a), X(0x7f3ebc33), X(0x7f430b98),
+  X(0x7f4748e7), X(0x7f4b7450), X(0x7f4f8e01), X(0x7f539629),
+  X(0x7f578cf5), X(0x7f5b7293), X(0x7f5f4732), X(0x7f630b00),
+  X(0x7f66be2b), X(0x7f6a60df), X(0x7f6df34b), X(0x7f71759b),
+  X(0x7f74e7fe), X(0x7f784aa0), X(0x7f7b9daf), X(0x7f7ee156),
+  X(0x7f8215c3), X(0x7f853b22), X(0x7f88519f), X(0x7f8b5967),
+  X(0x7f8e52a6), X(0x7f913d87), X(0x7f941a36), X(0x7f96e8df),
+  X(0x7f99a9ad), X(0x7f9c5ccb), X(0x7f9f0265), X(0x7fa19aa5),
+  X(0x7fa425b5), X(0x7fa6a3c1), X(0x7fa914f3), X(0x7fab7974),
+  X(0x7fadd16f), X(0x7fb01d0d), X(0x7fb25c78), X(0x7fb48fd9),
+  X(0x7fb6b75a), X(0x7fb8d323), X(0x7fbae35d), X(0x7fbce831),
+  X(0x7fbee1c7), X(0x7fc0d047), X(0x7fc2b3d9), X(0x7fc48ca5),
+  X(0x7fc65ad3), X(0x7fc81e88), X(0x7fc9d7ee), X(0x7fcb872a),
+  X(0x7fcd2c63), X(0x7fcec7bf), X(0x7fd05966), X(0x7fd1e17c),
+  X(0x7fd36027), X(0x7fd4d58d), X(0x7fd641d3), X(0x7fd7a51e),
+  X(0x7fd8ff94), X(0x7fda5157), X(0x7fdb9a8e), X(0x7fdcdb5b),
+  X(0x7fde13e2), X(0x7fdf4448), X(0x7fe06caf), X(0x7fe18d3b),
+  X(0x7fe2a60e), X(0x7fe3b74b), X(0x7fe4c114), X(0x7fe5c38b),
+  X(0x7fe6bed2), X(0x7fe7b30a), X(0x7fe8a055), X(0x7fe986d4),
+  X(0x7fea66a7), X(0x7feb3ff0), X(0x7fec12cd), X(0x7fecdf5f),
+  X(0x7feda5c5), X(0x7fee6620), X(0x7fef208d), X(0x7fefd52c),
+  X(0x7ff0841c), X(0x7ff12d7a), X(0x7ff1d164), X(0x7ff26ff9),
+  X(0x7ff30955), X(0x7ff39d96), X(0x7ff42cd9), X(0x7ff4b739),
+  X(0x7ff53cd4), X(0x7ff5bdc5), X(0x7ff63a28), X(0x7ff6b217),
+  X(0x7ff725af), X(0x7ff7950a), X(0x7ff80043), X(0x7ff86773),
+  X(0x7ff8cab4), X(0x7ff92a21), X(0x7ff985d1), X(0x7ff9dddf),
+  X(0x7ffa3262), X(0x7ffa8374), X(0x7ffad12c), X(0x7ffb1ba1),
+  X(0x7ffb62ec), X(0x7ffba723), X(0x7ffbe85c), X(0x7ffc26b0),
+  X(0x7ffc6233), X(0x7ffc9afb), X(0x7ffcd11e), X(0x7ffd04b1),
+  X(0x7ffd35c9), X(0x7ffd647b), X(0x7ffd90da), X(0x7ffdbafa),
+  X(0x7ffde2f0), X(0x7ffe08ce), X(0x7ffe2ca7), X(0x7ffe4e8e),
+  X(0x7ffe6e95), X(0x7ffe8cce), X(0x7ffea94a), X(0x7ffec41b),
+  X(0x7ffedd52), X(0x7ffef4ff), X(0x7fff0b33), X(0x7fff1ffd),
+  X(0x7fff336e), X(0x7fff4593), X(0x7fff567d), X(0x7fff663a),
+  X(0x7fff74d8), X(0x7fff8265), X(0x7fff8eee), X(0x7fff9a81),
+  X(0x7fffa52b), X(0x7fffaef8), X(0x7fffb7f5), X(0x7fffc02d),
+  X(0x7fffc7ab), X(0x7fffce7c), X(0x7fffd4a9), X(0x7fffda3e),
+  X(0x7fffdf44), X(0x7fffe3c6), X(0x7fffe7cc), X(0x7fffeb60),
+  X(0x7fffee8a), X(0x7ffff153), X(0x7ffff3c4), X(0x7ffff5e3),
+  X(0x7ffff7b8), X(0x7ffff94b), X(0x7ffffaa1), X(0x7ffffbc1),
+  X(0x7ffffcb2), X(0x7ffffd78), X(0x7ffffe19), X(0x7ffffe9a),
+  X(0x7ffffeff), X(0x7fffff4e), X(0x7fffff89), X(0x7fffffb3),
+  X(0x7fffffd2), X(0x7fffffe6), X(0x7ffffff3), X(0x7ffffffa),
+  X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
+};
+
+static LOOKUP_T vwin4096[2048] = {
+  X(0x000001f0), X(0x00001171), X(0x00003072), X(0x00005ef5),
+  X(0x00009cf8), X(0x0000ea7c), X(0x00014780), X(0x0001b405),
+  X(0x0002300b), X(0x0002bb91), X(0x00035698), X(0x0004011e),
+  X(0x0004bb25), X(0x000584ac), X(0x00065db3), X(0x0007463a),
+  X(0x00083e41), X(0x000945c7), X(0x000a5ccc), X(0x000b8350),
+  X(0x000cb954), X(0x000dfed7), X(0x000f53d8), X(0x0010b857),
+  X(0x00122c55), X(0x0013afd1), X(0x001542ca), X(0x0016e541),
+  X(0x00189735), X(0x001a58a7), X(0x001c2995), X(0x001e09ff),
+  X(0x001ff9e6), X(0x0021f948), X(0x00240826), X(0x00262680),
+  X(0x00285454), X(0x002a91a3), X(0x002cde6c), X(0x002f3aaf),
+  X(0x0031a66b), X(0x003421a0), X(0x0036ac4f), X(0x00394675),
+  X(0x003bf014), X(0x003ea92a), X(0x004171b7), X(0x004449bb),
+  X(0x00473135), X(0x004a2824), X(0x004d2e8a), X(0x00504463),
+  X(0x005369b2), X(0x00569e74), X(0x0059e2aa), X(0x005d3652),
+  X(0x0060996d), X(0x00640bf9), X(0x00678df7), X(0x006b1f66),
+  X(0x006ec045), X(0x00727093), X(0x00763051), X(0x0079ff7d),
+  X(0x007dde16), X(0x0081cc1d), X(0x0085c991), X(0x0089d671),
+  X(0x008df2bc), X(0x00921e71), X(0x00965991), X(0x009aa41a),
+  X(0x009efe0c), X(0x00a36766), X(0x00a7e028), X(0x00ac6850),
+  X(0x00b0ffde), X(0x00b5a6d1), X(0x00ba5d28), X(0x00bf22e4),
+  X(0x00c3f802), X(0x00c8dc83), X(0x00cdd065), X(0x00d2d3a8),
+  X(0x00d7e64a), X(0x00dd084c), X(0x00e239ac), X(0x00e77a69),
+  X(0x00ecca83), X(0x00f229f9), X(0x00f798ca), X(0x00fd16f5),
+  X(0x0102a479), X(0x01084155), X(0x010ded89), X(0x0113a913),
+  X(0x011973f3), X(0x011f4e27), X(0x012537af), X(0x012b308a),
+  X(0x013138b7), X(0x01375035), X(0x013d7702), X(0x0143ad1f),
+  X(0x0149f289), X(0x01504741), X(0x0156ab44), X(0x015d1e92),
+  X(0x0163a12a), X(0x016a330b), X(0x0170d433), X(0x017784a3),
+  X(0x017e4458), X(0x01851351), X(0x018bf18e), X(0x0192df0d),
+  X(0x0199dbcd), X(0x01a0e7cd), X(0x01a8030c), X(0x01af2d89),
+  X(0x01b66743), X(0x01bdb038), X(0x01c50867), X(0x01cc6fd0),
+  X(0x01d3e670), X(0x01db6c47), X(0x01e30153), X(0x01eaa593),
+  X(0x01f25907), X(0x01fa1bac), X(0x0201ed81), X(0x0209ce86),
+  X(0x0211beb8), X(0x0219be17), X(0x0221cca2), X(0x0229ea56),
+  X(0x02321733), X(0x023a5337), X(0x02429e60), X(0x024af8af),
+  X(0x02536220), X(0x025bdab3), X(0x02646267), X(0x026cf93a),
+  X(0x02759f2a), X(0x027e5436), X(0x0287185d), X(0x028feb9d),
+  X(0x0298cdf4), X(0x02a1bf62), X(0x02aabfe5), X(0x02b3cf7b),
+  X(0x02bcee23), X(0x02c61bdb), X(0x02cf58a2), X(0x02d8a475),
+  X(0x02e1ff55), X(0x02eb693e), X(0x02f4e230), X(0x02fe6a29),
+  X(0x03080127), X(0x0311a729), X(0x031b5c2d), X(0x03252031),
+  X(0x032ef334), X(0x0338d534), X(0x0342c630), X(0x034cc625),
+  X(0x0356d512), X(0x0360f2f6), X(0x036b1fce), X(0x03755b99),
+  X(0x037fa655), X(0x038a0001), X(0x0394689a), X(0x039ee020),
+  X(0x03a9668f), X(0x03b3fbe6), X(0x03bea024), X(0x03c95347),
+  X(0x03d4154d), X(0x03dee633), X(0x03e9c5f9), X(0x03f4b49b),
+  X(0x03ffb219), X(0x040abe71), X(0x0415d9a0), X(0x042103a5),
+  X(0x042c3c7d), X(0x04378428), X(0x0442daa2), X(0x044e3fea),
+  X(0x0459b3fd), X(0x046536db), X(0x0470c880), X(0x047c68eb),
+  X(0x0488181a), X(0x0493d60b), X(0x049fa2bc), X(0x04ab7e2a),
+  X(0x04b76854), X(0x04c36137), X(0x04cf68d1), X(0x04db7f21),
+  X(0x04e7a424), X(0x04f3d7d8), X(0x05001a3b), X(0x050c6b4a),
+  X(0x0518cb04), X(0x05253966), X(0x0531b66e), X(0x053e421a),
+  X(0x054adc68), X(0x05578555), X(0x05643cdf), X(0x05710304),
+  X(0x057dd7c1), X(0x058abb15), X(0x0597acfd), X(0x05a4ad76),
+  X(0x05b1bc7f), X(0x05beda14), X(0x05cc0635), X(0x05d940dd),
+  X(0x05e68a0b), X(0x05f3e1bd), X(0x060147f0), X(0x060ebca1),
+  X(0x061c3fcf), X(0x0629d176), X(0x06377194), X(0x06452027),
+  X(0x0652dd2c), X(0x0660a8a2), X(0x066e8284), X(0x067c6ad1),
+  X(0x068a6186), X(0x069866a1), X(0x06a67a1e), X(0x06b49bfc),
+  X(0x06c2cc38), X(0x06d10acf), X(0x06df57bf), X(0x06edb304),
+  X(0x06fc1c9d), X(0x070a9487), X(0x07191abe), X(0x0727af40),
+  X(0x0736520b), X(0x0745031c), X(0x0753c270), X(0x07629004),
+  X(0x07716bd6), X(0x078055e2), X(0x078f4e26), X(0x079e549f),
+  X(0x07ad694b), X(0x07bc8c26), X(0x07cbbd2e), X(0x07dafc5f),
+  X(0x07ea49b7), X(0x07f9a533), X(0x08090ed1), X(0x0818868c),
+  X(0x08280c62), X(0x0837a051), X(0x08474255), X(0x0856f26b),
+  X(0x0866b091), X(0x08767cc3), X(0x088656fe), X(0x08963f3f),
+  X(0x08a63584), X(0x08b639c8), X(0x08c64c0a), X(0x08d66c45),
+  X(0x08e69a77), X(0x08f6d69d), X(0x090720b3), X(0x091778b7),
+  X(0x0927dea5), X(0x0938527a), X(0x0948d433), X(0x095963cc),
+  X(0x096a0143), X(0x097aac94), X(0x098b65bb), X(0x099c2cb6),
+  X(0x09ad0182), X(0x09bde41a), X(0x09ced47d), X(0x09dfd2a5),
+  X(0x09f0de90), X(0x0a01f83b), X(0x0a131fa3), X(0x0a2454c3),
+  X(0x0a359798), X(0x0a46e820), X(0x0a584656), X(0x0a69b237),
+  X(0x0a7b2bc0), X(0x0a8cb2ec), X(0x0a9e47ba), X(0x0aafea24),
+  X(0x0ac19a29), X(0x0ad357c3), X(0x0ae522ef), X(0x0af6fbab),
+  X(0x0b08e1f1), X(0x0b1ad5c0), X(0x0b2cd712), X(0x0b3ee5e5),
+  X(0x0b510234), X(0x0b632bfd), X(0x0b75633b), X(0x0b87a7eb),
+  X(0x0b99fa08), X(0x0bac5990), X(0x0bbec67e), X(0x0bd140cf),
+  X(0x0be3c87e), X(0x0bf65d89), X(0x0c08ffeb), X(0x0c1bafa1),
+  X(0x0c2e6ca6), X(0x0c4136f6), X(0x0c540e8f), X(0x0c66f36c),
+  X(0x0c79e588), X(0x0c8ce4e1), X(0x0c9ff172), X(0x0cb30b37),
+  X(0x0cc6322c), X(0x0cd9664d), X(0x0ceca797), X(0x0cfff605),
+  X(0x0d135193), X(0x0d26ba3d), X(0x0d3a2fff), X(0x0d4db2d5),
+  X(0x0d6142ba), X(0x0d74dfac), X(0x0d8889a5), X(0x0d9c40a1),
+  X(0x0db0049d), X(0x0dc3d593), X(0x0dd7b380), X(0x0deb9e60),
+  X(0x0dff962f), X(0x0e139ae7), X(0x0e27ac85), X(0x0e3bcb05),
+  X(0x0e4ff662), X(0x0e642e98), X(0x0e7873a2), X(0x0e8cc57d),
+  X(0x0ea12423), X(0x0eb58f91), X(0x0eca07c2), X(0x0ede8cb1),
+  X(0x0ef31e5b), X(0x0f07bcba), X(0x0f1c67cb), X(0x0f311f88),
+  X(0x0f45e3ee), X(0x0f5ab4f7), X(0x0f6f92a0), X(0x0f847ce3),
+  X(0x0f9973bc), X(0x0fae7726), X(0x0fc3871e), X(0x0fd8a39d),
+  X(0x0fedcca1), X(0x10030223), X(0x1018441f), X(0x102d9291),
+  X(0x1042ed74), X(0x105854c3), X(0x106dc879), X(0x10834892),
+  X(0x1098d508), X(0x10ae6dd8), X(0x10c412fc), X(0x10d9c46f),
+  X(0x10ef822d), X(0x11054c30), X(0x111b2274), X(0x113104f5),
+  X(0x1146f3ac), X(0x115cee95), X(0x1172f5ab), X(0x118908e9),
+  X(0x119f284a), X(0x11b553ca), X(0x11cb8b62), X(0x11e1cf0f),
+  X(0x11f81ecb), X(0x120e7a90), X(0x1224e25a), X(0x123b5624),
+  X(0x1251d5e9), X(0x126861a3), X(0x127ef94e), X(0x12959ce3),
+  X(0x12ac4c5f), X(0x12c307bb), X(0x12d9cef2), X(0x12f0a200),
+  X(0x130780df), X(0x131e6b8a), X(0x133561fa), X(0x134c642c),
+  X(0x1363721a), X(0x137a8bbe), X(0x1391b113), X(0x13a8e214),
+  X(0x13c01eba), X(0x13d76702), X(0x13eebae5), X(0x14061a5e),
+  X(0x141d8567), X(0x1434fbfb), X(0x144c7e14), X(0x14640bae),
+  X(0x147ba4c1), X(0x14934949), X(0x14aaf941), X(0x14c2b4a2),
+  X(0x14da7b67), X(0x14f24d8a), X(0x150a2b06), X(0x152213d5),
+  X(0x153a07f1), X(0x15520755), X(0x156a11fb), X(0x158227dd),
+  X(0x159a48f5), X(0x15b2753d), X(0x15caacb1), X(0x15e2ef49),
+  X(0x15fb3d01), X(0x161395d2), X(0x162bf9b6), X(0x164468a8),
+  X(0x165ce2a1), X(0x1675679c), X(0x168df793), X(0x16a69280),
+  X(0x16bf385c), X(0x16d7e922), X(0x16f0a4cc), X(0x17096b54),
+  X(0x17223cb4), X(0x173b18e5), X(0x1753ffe2), X(0x176cf1a5),
+  X(0x1785ee27), X(0x179ef562), X(0x17b80750), X(0x17d123eb),
+  X(0x17ea4b2d), X(0x18037d10), X(0x181cb98d), X(0x1836009e),
+  X(0x184f523c), X(0x1868ae63), X(0x1882150a), X(0x189b862c),
+  X(0x18b501c4), X(0x18ce87c9), X(0x18e81836), X(0x1901b305),
+  X(0x191b582f), X(0x193507ad), X(0x194ec17a), X(0x1968858f),
+  X(0x198253e5), X(0x199c2c75), X(0x19b60f3a), X(0x19cffc2d),
+  X(0x19e9f347), X(0x1a03f482), X(0x1a1dffd7), X(0x1a381540),
+  X(0x1a5234b5), X(0x1a6c5e31), X(0x1a8691ac), X(0x1aa0cf21),
+  X(0x1abb1687), X(0x1ad567da), X(0x1aefc311), X(0x1b0a2826),
+  X(0x1b249712), X(0x1b3f0fd0), X(0x1b599257), X(0x1b741ea1),
+  X(0x1b8eb4a7), X(0x1ba95462), X(0x1bc3fdcd), X(0x1bdeb0de),
+  X(0x1bf96d91), X(0x1c1433dd), X(0x1c2f03bc), X(0x1c49dd27),
+  X(0x1c64c017), X(0x1c7fac85), X(0x1c9aa269), X(0x1cb5a1be),
+  X(0x1cd0aa7c), X(0x1cebbc9c), X(0x1d06d816), X(0x1d21fce4),
+  X(0x1d3d2aff), X(0x1d586260), X(0x1d73a2fe), X(0x1d8eecd4),
+  X(0x1daa3fda), X(0x1dc59c09), X(0x1de1015a), X(0x1dfc6fc5),
+  X(0x1e17e743), X(0x1e3367cd), X(0x1e4ef15b), X(0x1e6a83e7),
+  X(0x1e861f6a), X(0x1ea1c3da), X(0x1ebd7133), X(0x1ed9276b),
+  X(0x1ef4e67c), X(0x1f10ae5e), X(0x1f2c7f0a), X(0x1f485879),
+  X(0x1f643aa2), X(0x1f80257f), X(0x1f9c1908), X(0x1fb81536),
+  X(0x1fd41a00), X(0x1ff02761), X(0x200c3d4f), X(0x20285bc3),
+  X(0x204482b7), X(0x2060b221), X(0x207ce9fb), X(0x20992a3e),
+  X(0x20b572e0), X(0x20d1c3dc), X(0x20ee1d28), X(0x210a7ebe),
+  X(0x2126e895), X(0x21435aa6), X(0x215fd4ea), X(0x217c5757),
+  X(0x2198e1e8), X(0x21b57493), X(0x21d20f51), X(0x21eeb21b),
+  X(0x220b5ce7), X(0x22280fb0), X(0x2244ca6c), X(0x22618d13),
+  X(0x227e579f), X(0x229b2a06), X(0x22b80442), X(0x22d4e649),
+  X(0x22f1d015), X(0x230ec19d), X(0x232bbad9), X(0x2348bbc1),
+  X(0x2365c44c), X(0x2382d474), X(0x239fec30), X(0x23bd0b78),
+  X(0x23da3244), X(0x23f7608b), X(0x24149646), X(0x2431d36c),
+  X(0x244f17f5), X(0x246c63da), X(0x2489b711), X(0x24a71193),
+  X(0x24c47358), X(0x24e1dc57), X(0x24ff4c88), X(0x251cc3e2),
+  X(0x253a425e), X(0x2557c7f4), X(0x2575549a), X(0x2592e848),
+  X(0x25b082f7), X(0x25ce249e), X(0x25ebcd34), X(0x26097cb2),
+  X(0x2627330e), X(0x2644f040), X(0x2662b441), X(0x26807f07),
+  X(0x269e5089), X(0x26bc28c1), X(0x26da07a4), X(0x26f7ed2b),
+  X(0x2715d94d), X(0x2733cc02), X(0x2751c540), X(0x276fc500),
+  X(0x278dcb39), X(0x27abd7e2), X(0x27c9eaf3), X(0x27e80463),
+  X(0x28062429), X(0x28244a3e), X(0x28427697), X(0x2860a92d),
+  X(0x287ee1f7), X(0x289d20eb), X(0x28bb6603), X(0x28d9b134),
+  X(0x28f80275), X(0x291659c0), X(0x2934b709), X(0x29531a49),
+  X(0x29718378), X(0x298ff28b), X(0x29ae677b), X(0x29cce23e),
+  X(0x29eb62cb), X(0x2a09e91b), X(0x2a287523), X(0x2a4706dc),
+  X(0x2a659e3c), X(0x2a843b39), X(0x2aa2ddcd), X(0x2ac185ec),
+  X(0x2ae0338f), X(0x2afee6ad), X(0x2b1d9f3c), X(0x2b3c5d33),
+  X(0x2b5b208b), X(0x2b79e939), X(0x2b98b734), X(0x2bb78a74),
+  X(0x2bd662ef), X(0x2bf5409d), X(0x2c142374), X(0x2c330b6b),
+  X(0x2c51f87a), X(0x2c70ea97), X(0x2c8fe1b9), X(0x2caeddd6),
+  X(0x2ccddee7), X(0x2cece4e1), X(0x2d0befbb), X(0x2d2aff6d),
+  X(0x2d4a13ec), X(0x2d692d31), X(0x2d884b32), X(0x2da76de4),
+  X(0x2dc69540), X(0x2de5c13d), X(0x2e04f1d0), X(0x2e2426f0),
+  X(0x2e436095), X(0x2e629eb4), X(0x2e81e146), X(0x2ea1283f),
+  X(0x2ec07398), X(0x2edfc347), X(0x2eff1742), X(0x2f1e6f80),
+  X(0x2f3dcbf8), X(0x2f5d2ca0), X(0x2f7c916f), X(0x2f9bfa5c),
+  X(0x2fbb675d), X(0x2fdad869), X(0x2ffa4d76), X(0x3019c67b),
+  X(0x3039436f), X(0x3058c448), X(0x307848fc), X(0x3097d183),
+  X(0x30b75dd3), X(0x30d6ede2), X(0x30f681a6), X(0x31161917),
+  X(0x3135b42b), X(0x315552d8), X(0x3174f514), X(0x31949ad7),
+  X(0x31b44417), X(0x31d3f0ca), X(0x31f3a0e6), X(0x32135462),
+  X(0x32330b35), X(0x3252c555), X(0x327282b7), X(0x32924354),
+  X(0x32b20720), X(0x32d1ce13), X(0x32f19823), X(0x33116546),
+  X(0x33313573), X(0x3351089f), X(0x3370dec2), X(0x3390b7d1),
+  X(0x33b093c3), X(0x33d0728f), X(0x33f05429), X(0x3410388a),
+  X(0x34301fa7), X(0x34500977), X(0x346ff5ef), X(0x348fe506),
+  X(0x34afd6b3), X(0x34cfcaeb), X(0x34efc1a5), X(0x350fbad7),
+  X(0x352fb678), X(0x354fb47d), X(0x356fb4dd), X(0x358fb78e),
+  X(0x35afbc86), X(0x35cfc3bc), X(0x35efcd25), X(0x360fd8b8),
+  X(0x362fe66c), X(0x364ff636), X(0x3670080c), X(0x36901be5),
+  X(0x36b031b7), X(0x36d04978), X(0x36f0631e), X(0x37107ea0),
+  X(0x37309bf3), X(0x3750bb0e), X(0x3770dbe6), X(0x3790fe73),
+  X(0x37b122aa), X(0x37d14881), X(0x37f16fee), X(0x381198e8),
+  X(0x3831c365), X(0x3851ef5a), X(0x38721cbe), X(0x38924b87),
+  X(0x38b27bac), X(0x38d2ad21), X(0x38f2dfde), X(0x391313d8),
+  X(0x39334906), X(0x39537f5d), X(0x3973b6d4), X(0x3993ef60),
+  X(0x39b428f9), X(0x39d46393), X(0x39f49f25), X(0x3a14dba6),
+  X(0x3a35190a), X(0x3a555748), X(0x3a759657), X(0x3a95d62c),
+  X(0x3ab616be), X(0x3ad65801), X(0x3af699ed), X(0x3b16dc78),
+  X(0x3b371f97), X(0x3b576341), X(0x3b77a76c), X(0x3b97ec0d),
+  X(0x3bb8311b), X(0x3bd8768b), X(0x3bf8bc55), X(0x3c19026d),
+  X(0x3c3948ca), X(0x3c598f62), X(0x3c79d62b), X(0x3c9a1d1b),
+  X(0x3cba6428), X(0x3cdaab48), X(0x3cfaf271), X(0x3d1b3999),
+  X(0x3d3b80b6), X(0x3d5bc7be), X(0x3d7c0ea8), X(0x3d9c5569),
+  X(0x3dbc9bf7), X(0x3ddce248), X(0x3dfd2852), X(0x3e1d6e0c),
+  X(0x3e3db36c), X(0x3e5df866), X(0x3e7e3cf2), X(0x3e9e8106),
+  X(0x3ebec497), X(0x3edf079b), X(0x3eff4a09), X(0x3f1f8bd7),
+  X(0x3f3fccfa), X(0x3f600d69), X(0x3f804d1a), X(0x3fa08c02),
+  X(0x3fc0ca19), X(0x3fe10753), X(0x400143a7), X(0x40217f0a),
+  X(0x4041b974), X(0x4061f2da), X(0x40822b32), X(0x40a26272),
+  X(0x40c29891), X(0x40e2cd83), X(0x41030140), X(0x412333bd),
+  X(0x414364f1), X(0x416394d2), X(0x4183c355), X(0x41a3f070),
+  X(0x41c41c1b), X(0x41e4464a), X(0x42046ef4), X(0x42249610),
+  X(0x4244bb92), X(0x4264df72), X(0x428501a5), X(0x42a52222),
+  X(0x42c540de), X(0x42e55dd0), X(0x430578ed), X(0x4325922d),
+  X(0x4345a985), X(0x4365beeb), X(0x4385d255), X(0x43a5e3ba),
+  X(0x43c5f30f), X(0x43e6004b), X(0x44060b65), X(0x44261451),
+  X(0x44461b07), X(0x44661f7c), X(0x448621a7), X(0x44a6217d),
+  X(0x44c61ef6), X(0x44e61a07), X(0x450612a6), X(0x452608ca),
+  X(0x4545fc69), X(0x4565ed79), X(0x4585dbf1), X(0x45a5c7c6),
+  X(0x45c5b0ef), X(0x45e59761), X(0x46057b15), X(0x46255bfe),
+  X(0x46453a15), X(0x4665154f), X(0x4684eda2), X(0x46a4c305),
+  X(0x46c4956e), X(0x46e464d3), X(0x4704312b), X(0x4723fa6c),
+  X(0x4743c08d), X(0x47638382), X(0x47834344), X(0x47a2ffc9),
+  X(0x47c2b906), X(0x47e26ef2), X(0x48022183), X(0x4821d0b1),
+  X(0x48417c71), X(0x486124b9), X(0x4880c981), X(0x48a06abe),
+  X(0x48c00867), X(0x48dfa272), X(0x48ff38d6), X(0x491ecb8a),
+  X(0x493e5a84), X(0x495de5b9), X(0x497d6d22), X(0x499cf0b4),
+  X(0x49bc7066), X(0x49dbec2e), X(0x49fb6402), X(0x4a1ad7db),
+  X(0x4a3a47ad), X(0x4a59b370), X(0x4a791b1a), X(0x4a987ea1),
+  X(0x4ab7ddfd), X(0x4ad73924), X(0x4af6900c), X(0x4b15e2ad),
+  X(0x4b3530fc), X(0x4b547af1), X(0x4b73c082), X(0x4b9301a6),
+  X(0x4bb23e53), X(0x4bd17681), X(0x4bf0aa25), X(0x4c0fd937),
+  X(0x4c2f03ae), X(0x4c4e297f), X(0x4c6d4aa3), X(0x4c8c670f),
+  X(0x4cab7eba), X(0x4cca919c), X(0x4ce99fab), X(0x4d08a8de),
+  X(0x4d27ad2c), X(0x4d46ac8b), X(0x4d65a6f3), X(0x4d849c5a),
+  X(0x4da38cb7), X(0x4dc27802), X(0x4de15e31), X(0x4e003f3a),
+  X(0x4e1f1b16), X(0x4e3df1ba), X(0x4e5cc31e), X(0x4e7b8f3a),
+  X(0x4e9a5603), X(0x4eb91771), X(0x4ed7d37b), X(0x4ef68a18),
+  X(0x4f153b3f), X(0x4f33e6e7), X(0x4f528d08), X(0x4f712d97),
+  X(0x4f8fc88e), X(0x4fae5de1), X(0x4fcced8a), X(0x4feb777f),
+  X(0x5009fbb6), X(0x50287a28), X(0x5046f2cc), X(0x50656598),
+  X(0x5083d284), X(0x50a23988), X(0x50c09a9a), X(0x50def5b1),
+  X(0x50fd4ac7), X(0x511b99d0), X(0x5139e2c5), X(0x5158259e),
+  X(0x51766251), X(0x519498d6), X(0x51b2c925), X(0x51d0f334),
+  X(0x51ef16fb), X(0x520d3473), X(0x522b4b91), X(0x52495c4e),
+  X(0x526766a2), X(0x52856a83), X(0x52a367e9), X(0x52c15ecd),
+  X(0x52df4f24), X(0x52fd38e8), X(0x531b1c10), X(0x5338f892),
+  X(0x5356ce68), X(0x53749d89), X(0x539265eb), X(0x53b02788),
+  X(0x53cde257), X(0x53eb964f), X(0x54094369), X(0x5426e99c),
+  X(0x544488df), X(0x5462212c), X(0x547fb279), X(0x549d3cbe),
+  X(0x54babff4), X(0x54d83c12), X(0x54f5b110), X(0x55131ee7),
+  X(0x5530858d), X(0x554de4fc), X(0x556b3d2a), X(0x55888e11),
+  X(0x55a5d7a8), X(0x55c319e7), X(0x55e054c7), X(0x55fd883f),
+  X(0x561ab447), X(0x5637d8d8), X(0x5654f5ea), X(0x56720b75),
+  X(0x568f1971), X(0x56ac1fd7), X(0x56c91e9e), X(0x56e615c0),
+  X(0x57030534), X(0x571fecf2), X(0x573cccf3), X(0x5759a530),
+  X(0x577675a0), X(0x57933e3c), X(0x57affefd), X(0x57ccb7db),
+  X(0x57e968ce), X(0x580611cf), X(0x5822b2d6), X(0x583f4bdd),
+  X(0x585bdcdb), X(0x587865c9), X(0x5894e69f), X(0x58b15f57),
+  X(0x58cdcfe9), X(0x58ea384e), X(0x5906987d), X(0x5922f071),
+  X(0x593f4022), X(0x595b8788), X(0x5977c69c), X(0x5993fd57),
+  X(0x59b02bb2), X(0x59cc51a6), X(0x59e86f2c), X(0x5a04843c),
+  X(0x5a2090d0), X(0x5a3c94e0), X(0x5a589065), X(0x5a748359),
+  X(0x5a906db4), X(0x5aac4f70), X(0x5ac82884), X(0x5ae3f8ec),
+  X(0x5affc09f), X(0x5b1b7f97), X(0x5b3735cd), X(0x5b52e33a),
+  X(0x5b6e87d8), X(0x5b8a239f), X(0x5ba5b689), X(0x5bc1408f),
+  X(0x5bdcc1aa), X(0x5bf839d5), X(0x5c13a907), X(0x5c2f0f3b),
+  X(0x5c4a6c6a), X(0x5c65c08d), X(0x5c810b9e), X(0x5c9c4d97),
+  X(0x5cb78670), X(0x5cd2b623), X(0x5ceddcaa), X(0x5d08f9ff),
+  X(0x5d240e1b), X(0x5d3f18f8), X(0x5d5a1a8f), X(0x5d7512da),
+  X(0x5d9001d3), X(0x5daae773), X(0x5dc5c3b5), X(0x5de09692),
+  X(0x5dfb6004), X(0x5e162004), X(0x5e30d68d), X(0x5e4b8399),
+  X(0x5e662721), X(0x5e80c11f), X(0x5e9b518e), X(0x5eb5d867),
+  X(0x5ed055a4), X(0x5eeac940), X(0x5f053334), X(0x5f1f937b),
+  X(0x5f39ea0f), X(0x5f5436ea), X(0x5f6e7a06), X(0x5f88b35d),
+  X(0x5fa2e2e9), X(0x5fbd08a6), X(0x5fd7248d), X(0x5ff13698),
+  X(0x600b3ec2), X(0x60253d05), X(0x603f315b), X(0x60591bc0),
+  X(0x6072fc2d), X(0x608cd29e), X(0x60a69f0b), X(0x60c06171),
+  X(0x60da19ca), X(0x60f3c80f), X(0x610d6c3d), X(0x6127064d),
+  X(0x6140963a), X(0x615a1bff), X(0x61739797), X(0x618d08fc),
+  X(0x61a67029), X(0x61bfcd1a), X(0x61d91fc8), X(0x61f2682f),
+  X(0x620ba64a), X(0x6224da13), X(0x623e0386), X(0x6257229d),
+  X(0x62703754), X(0x628941a6), X(0x62a2418e), X(0x62bb3706),
+  X(0x62d4220a), X(0x62ed0296), X(0x6305d8a3), X(0x631ea42f),
+  X(0x63376533), X(0x63501bab), X(0x6368c793), X(0x638168e5),
+  X(0x6399ff9e), X(0x63b28bb8), X(0x63cb0d2f), X(0x63e383ff),
+  X(0x63fbf022), X(0x64145195), X(0x642ca853), X(0x6444f457),
+  X(0x645d359e), X(0x64756c22), X(0x648d97e0), X(0x64a5b8d3),
+  X(0x64bdcef6), X(0x64d5da47), X(0x64eddabf), X(0x6505d05c),
+  X(0x651dbb19), X(0x65359af2), X(0x654d6fe3), X(0x656539e7),
+  X(0x657cf8fb), X(0x6594ad1b), X(0x65ac5643), X(0x65c3f46e),
+  X(0x65db8799), X(0x65f30fc0), X(0x660a8ce0), X(0x6621fef3),
+  X(0x663965f7), X(0x6650c1e7), X(0x666812c1), X(0x667f5880),
+  X(0x66969320), X(0x66adc29e), X(0x66c4e6f7), X(0x66dc0026),
+  X(0x66f30e28), X(0x670a10fa), X(0x67210898), X(0x6737f4ff),
+  X(0x674ed62b), X(0x6765ac19), X(0x677c76c5), X(0x6793362c),
+  X(0x67a9ea4b), X(0x67c0931f), X(0x67d730a3), X(0x67edc2d6),
+  X(0x680449b3), X(0x681ac538), X(0x68313562), X(0x68479a2d),
+  X(0x685df396), X(0x6874419b), X(0x688a8438), X(0x68a0bb6a),
+  X(0x68b6e72e), X(0x68cd0782), X(0x68e31c63), X(0x68f925cd),
+  X(0x690f23be), X(0x69251633), X(0x693afd29), X(0x6950d89e),
+  X(0x6966a88f), X(0x697c6cf8), X(0x699225d9), X(0x69a7d32d),
+  X(0x69bd74f3), X(0x69d30b27), X(0x69e895c8), X(0x69fe14d2),
+  X(0x6a138844), X(0x6a28f01b), X(0x6a3e4c54), X(0x6a539ced),
+  X(0x6a68e1e4), X(0x6a7e1b37), X(0x6a9348e3), X(0x6aa86ae6),
+  X(0x6abd813d), X(0x6ad28be7), X(0x6ae78ae2), X(0x6afc7e2b),
+  X(0x6b1165c0), X(0x6b26419f), X(0x6b3b11c7), X(0x6b4fd634),
+  X(0x6b648ee6), X(0x6b793bda), X(0x6b8ddd0e), X(0x6ba27281),
+  X(0x6bb6fc31), X(0x6bcb7a1b), X(0x6bdfec3e), X(0x6bf45299),
+  X(0x6c08ad29), X(0x6c1cfbed), X(0x6c313ee4), X(0x6c45760a),
+  X(0x6c59a160), X(0x6c6dc0e4), X(0x6c81d493), X(0x6c95dc6d),
+  X(0x6ca9d86f), X(0x6cbdc899), X(0x6cd1acea), X(0x6ce5855f),
+  X(0x6cf951f7), X(0x6d0d12b1), X(0x6d20c78c), X(0x6d347087),
+  X(0x6d480da0), X(0x6d5b9ed6), X(0x6d6f2427), X(0x6d829d94),
+  X(0x6d960b1a), X(0x6da96cb9), X(0x6dbcc270), X(0x6dd00c3c),
+  X(0x6de34a1f), X(0x6df67c16), X(0x6e09a221), X(0x6e1cbc3f),
+  X(0x6e2fca6e), X(0x6e42ccaf), X(0x6e55c300), X(0x6e68ad60),
+  X(0x6e7b8bd0), X(0x6e8e5e4d), X(0x6ea124d8), X(0x6eb3df70),
+  X(0x6ec68e13), X(0x6ed930c3), X(0x6eebc77d), X(0x6efe5242),
+  X(0x6f10d111), X(0x6f2343e9), X(0x6f35aacb), X(0x6f4805b5),
+  X(0x6f5a54a8), X(0x6f6c97a2), X(0x6f7ecea4), X(0x6f90f9ae),
+  X(0x6fa318be), X(0x6fb52bd6), X(0x6fc732f4), X(0x6fd92e19),
+  X(0x6feb1d44), X(0x6ffd0076), X(0x700ed7ad), X(0x7020a2eb),
+  X(0x7032622f), X(0x7044157a), X(0x7055bcca), X(0x70675821),
+  X(0x7078e77e), X(0x708a6ae2), X(0x709be24c), X(0x70ad4dbd),
+  X(0x70bead36), X(0x70d000b5), X(0x70e1483d), X(0x70f283cc),
+  X(0x7103b363), X(0x7114d704), X(0x7125eead), X(0x7136fa60),
+  X(0x7147fa1c), X(0x7158ede4), X(0x7169d5b6), X(0x717ab193),
+  X(0x718b817d), X(0x719c4573), X(0x71acfd76), X(0x71bda988),
+  X(0x71ce49a8), X(0x71deddd7), X(0x71ef6617), X(0x71ffe267),
+  X(0x721052ca), X(0x7220b73e), X(0x72310fc6), X(0x72415c62),
+  X(0x72519d14), X(0x7261d1db), X(0x7271faba), X(0x728217b1),
+  X(0x729228c0), X(0x72a22dea), X(0x72b22730), X(0x72c21491),
+  X(0x72d1f611), X(0x72e1cbaf), X(0x72f1956c), X(0x7301534c),
+  X(0x7311054d), X(0x7320ab72), X(0x733045bc), X(0x733fd42d),
+  X(0x734f56c5), X(0x735ecd86), X(0x736e3872), X(0x737d9789),
+  X(0x738ceacf), X(0x739c3243), X(0x73ab6de7), X(0x73ba9dbe),
+  X(0x73c9c1c8), X(0x73d8da08), X(0x73e7e67f), X(0x73f6e72e),
+  X(0x7405dc17), X(0x7414c53c), X(0x7423a29f), X(0x74327442),
+  X(0x74413a26), X(0x744ff44d), X(0x745ea2b9), X(0x746d456c),
+  X(0x747bdc68), X(0x748a67ae), X(0x7498e741), X(0x74a75b23),
+  X(0x74b5c356), X(0x74c41fdb), X(0x74d270b6), X(0x74e0b5e7),
+  X(0x74eeef71), X(0x74fd1d57), X(0x750b3f9a), X(0x7519563c),
+  X(0x75276140), X(0x753560a8), X(0x75435477), X(0x75513cae),
+  X(0x755f1951), X(0x756cea60), X(0x757aafdf), X(0x758869d1),
+  X(0x75961837), X(0x75a3bb14), X(0x75b1526a), X(0x75bede3c),
+  X(0x75cc5e8d), X(0x75d9d35f), X(0x75e73cb5), X(0x75f49a91),
+  X(0x7601ecf6), X(0x760f33e6), X(0x761c6f65), X(0x76299f74),
+  X(0x7636c417), X(0x7643dd51), X(0x7650eb24), X(0x765ded93),
+  X(0x766ae4a0), X(0x7677d050), X(0x7684b0a4), X(0x7691859f),
+  X(0x769e4f45), X(0x76ab0d98), X(0x76b7c09c), X(0x76c46852),
+  X(0x76d104bf), X(0x76dd95e6), X(0x76ea1bc9), X(0x76f6966b),
+  X(0x770305d0), X(0x770f69fb), X(0x771bc2ef), X(0x772810af),
+  X(0x7734533e), X(0x77408aa0), X(0x774cb6d7), X(0x7758d7e8),
+  X(0x7764edd5), X(0x7770f8a2), X(0x777cf852), X(0x7788ece8),
+  X(0x7794d668), X(0x77a0b4d5), X(0x77ac8833), X(0x77b85085),
+  X(0x77c40dce), X(0x77cfc013), X(0x77db6756), X(0x77e7039b),
+  X(0x77f294e6), X(0x77fe1b3b), X(0x7809969c), X(0x7815070e),
+  X(0x78206c93), X(0x782bc731), X(0x783716ea), X(0x78425bc3),
+  X(0x784d95be), X(0x7858c4e1), X(0x7863e92d), X(0x786f02a8),
+  X(0x787a1156), X(0x78851539), X(0x78900e56), X(0x789afcb1),
+  X(0x78a5e04d), X(0x78b0b92f), X(0x78bb875b), X(0x78c64ad4),
+  X(0x78d1039e), X(0x78dbb1be), X(0x78e65537), X(0x78f0ee0e),
+  X(0x78fb7c46), X(0x7905ffe4), X(0x791078ec), X(0x791ae762),
+  X(0x79254b4a), X(0x792fa4a7), X(0x7939f380), X(0x794437d7),
+  X(0x794e71b0), X(0x7958a111), X(0x7962c5fd), X(0x796ce078),
+  X(0x7976f087), X(0x7980f62f), X(0x798af173), X(0x7994e258),
+  X(0x799ec8e2), X(0x79a8a515), X(0x79b276f7), X(0x79bc3e8b),
+  X(0x79c5fbd6), X(0x79cfaedc), X(0x79d957a2), X(0x79e2f62c),
+  X(0x79ec8a7f), X(0x79f6149f), X(0x79ff9492), X(0x7a090a5a),
+  X(0x7a1275fe), X(0x7a1bd781), X(0x7a252ee9), X(0x7a2e7c39),
+  X(0x7a37bf77), X(0x7a40f8a7), X(0x7a4a27ce), X(0x7a534cf0),
+  X(0x7a5c6813), X(0x7a65793b), X(0x7a6e806d), X(0x7a777dad),
+  X(0x7a807100), X(0x7a895a6b), X(0x7a9239f4), X(0x7a9b0f9e),
+  X(0x7aa3db6f), X(0x7aac9d6b), X(0x7ab55597), X(0x7abe03f9),
+  X(0x7ac6a895), X(0x7acf4370), X(0x7ad7d48f), X(0x7ae05bf6),
+  X(0x7ae8d9ac), X(0x7af14db5), X(0x7af9b815), X(0x7b0218d2),
+  X(0x7b0a6ff2), X(0x7b12bd78), X(0x7b1b016a), X(0x7b233bce),
+  X(0x7b2b6ca7), X(0x7b3393fc), X(0x7b3bb1d1), X(0x7b43c62c),
+  X(0x7b4bd111), X(0x7b53d286), X(0x7b5bca90), X(0x7b63b935),
+  X(0x7b6b9e78), X(0x7b737a61), X(0x7b7b4cf3), X(0x7b831634),
+  X(0x7b8ad629), X(0x7b928cd8), X(0x7b9a3a45), X(0x7ba1de77),
+  X(0x7ba97972), X(0x7bb10b3c), X(0x7bb893d9), X(0x7bc01350),
+  X(0x7bc789a6), X(0x7bcef6e0), X(0x7bd65b03), X(0x7bddb616),
+  X(0x7be5081c), X(0x7bec511c), X(0x7bf3911b), X(0x7bfac81f),
+  X(0x7c01f62c), X(0x7c091b49), X(0x7c10377b), X(0x7c174ac7),
+  X(0x7c1e5532), X(0x7c2556c4), X(0x7c2c4f80), X(0x7c333f6c),
+  X(0x7c3a268e), X(0x7c4104ec), X(0x7c47da8a), X(0x7c4ea76f),
+  X(0x7c556ba1), X(0x7c5c2724), X(0x7c62d9fe), X(0x7c698435),
+  X(0x7c7025cf), X(0x7c76bed0), X(0x7c7d4f40), X(0x7c83d723),
+  X(0x7c8a567f), X(0x7c90cd5a), X(0x7c973bb9), X(0x7c9da1a2),
+  X(0x7ca3ff1b), X(0x7caa542a), X(0x7cb0a0d3), X(0x7cb6e51e),
+  X(0x7cbd210f), X(0x7cc354ac), X(0x7cc97ffc), X(0x7ccfa304),
+  X(0x7cd5bdc9), X(0x7cdbd051), X(0x7ce1daa3), X(0x7ce7dcc3),
+  X(0x7cedd6b8), X(0x7cf3c888), X(0x7cf9b238), X(0x7cff93cf),
+  X(0x7d056d51), X(0x7d0b3ec5), X(0x7d110830), X(0x7d16c99a),
+  X(0x7d1c8306), X(0x7d22347c), X(0x7d27de00), X(0x7d2d7f9a),
+  X(0x7d33194f), X(0x7d38ab24), X(0x7d3e351f), X(0x7d43b748),
+  X(0x7d4931a2), X(0x7d4ea435), X(0x7d540f06), X(0x7d59721b),
+  X(0x7d5ecd7b), X(0x7d64212a), X(0x7d696d2f), X(0x7d6eb190),
+  X(0x7d73ee53), X(0x7d79237e), X(0x7d7e5117), X(0x7d837723),
+  X(0x7d8895a9), X(0x7d8dacae), X(0x7d92bc3a), X(0x7d97c451),
+  X(0x7d9cc4f9), X(0x7da1be39), X(0x7da6b017), X(0x7dab9a99),
+  X(0x7db07dc4), X(0x7db5599e), X(0x7dba2e2f), X(0x7dbefb7b),
+  X(0x7dc3c189), X(0x7dc8805e), X(0x7dcd3802), X(0x7dd1e879),
+  X(0x7dd691ca), X(0x7ddb33fb), X(0x7ddfcf12), X(0x7de46315),
+  X(0x7de8f00a), X(0x7ded75f8), X(0x7df1f4e3), X(0x7df66cd3),
+  X(0x7dfaddcd), X(0x7dff47d7), X(0x7e03aaf8), X(0x7e080735),
+  X(0x7e0c5c95), X(0x7e10ab1e), X(0x7e14f2d5), X(0x7e1933c1),
+  X(0x7e1d6de8), X(0x7e21a150), X(0x7e25cdff), X(0x7e29f3fc),
+  X(0x7e2e134c), X(0x7e322bf5), X(0x7e363dfd), X(0x7e3a496b),
+  X(0x7e3e4e45), X(0x7e424c90), X(0x7e464454), X(0x7e4a3595),
+  X(0x7e4e205a), X(0x7e5204aa), X(0x7e55e289), X(0x7e59b9ff),
+  X(0x7e5d8b12), X(0x7e6155c7), X(0x7e651a24), X(0x7e68d831),
+  X(0x7e6c8ff2), X(0x7e70416e), X(0x7e73ecac), X(0x7e7791b0),
+  X(0x7e7b3082), X(0x7e7ec927), X(0x7e825ba6), X(0x7e85e804),
+  X(0x7e896e48), X(0x7e8cee77), X(0x7e906899), X(0x7e93dcb2),
+  X(0x7e974aca), X(0x7e9ab2e5), X(0x7e9e150b), X(0x7ea17141),
+  X(0x7ea4c78e), X(0x7ea817f7), X(0x7eab6283), X(0x7eaea737),
+  X(0x7eb1e61a), X(0x7eb51f33), X(0x7eb85285), X(0x7ebb8019),
+  X(0x7ebea7f4), X(0x7ec1ca1d), X(0x7ec4e698), X(0x7ec7fd6d),
+  X(0x7ecb0ea1), X(0x7ece1a3a), X(0x7ed1203f), X(0x7ed420b6),
+  X(0x7ed71ba4), X(0x7eda110f), X(0x7edd00ff), X(0x7edfeb78),
+  X(0x7ee2d081), X(0x7ee5b01f), X(0x7ee88a5a), X(0x7eeb5f36),
+  X(0x7eee2eba), X(0x7ef0f8ed), X(0x7ef3bdd3), X(0x7ef67d73),
+  X(0x7ef937d3), X(0x7efbecf9), X(0x7efe9ceb), X(0x7f0147ae),
+  X(0x7f03ed4a), X(0x7f068dc4), X(0x7f092922), X(0x7f0bbf69),
+  X(0x7f0e50a1), X(0x7f10dcce), X(0x7f1363f7), X(0x7f15e622),
+  X(0x7f186355), X(0x7f1adb95), X(0x7f1d4ee9), X(0x7f1fbd57),
+  X(0x7f2226e4), X(0x7f248b96), X(0x7f26eb74), X(0x7f294683),
+  X(0x7f2b9cc9), X(0x7f2dee4d), X(0x7f303b13), X(0x7f328322),
+  X(0x7f34c680), X(0x7f370533), X(0x7f393f40), X(0x7f3b74ad),
+  X(0x7f3da581), X(0x7f3fd1c1), X(0x7f41f972), X(0x7f441c9c),
+  X(0x7f463b43), X(0x7f48556d), X(0x7f4a6b21), X(0x7f4c7c64),
+  X(0x7f4e893c), X(0x7f5091ae), X(0x7f5295c1), X(0x7f54957a),
+  X(0x7f5690e0), X(0x7f5887f7), X(0x7f5a7ac5), X(0x7f5c6951),
+  X(0x7f5e53a0), X(0x7f6039b8), X(0x7f621b9e), X(0x7f63f958),
+  X(0x7f65d2ed), X(0x7f67a861), X(0x7f6979ba), X(0x7f6b46ff),
+  X(0x7f6d1034), X(0x7f6ed560), X(0x7f709687), X(0x7f7253b1),
+  X(0x7f740ce1), X(0x7f75c21f), X(0x7f777370), X(0x7f7920d8),
+  X(0x7f7aca5f), X(0x7f7c7008), X(0x7f7e11db), X(0x7f7fafdd),
+  X(0x7f814a13), X(0x7f82e082), X(0x7f847331), X(0x7f860224),
+  X(0x7f878d62), X(0x7f8914f0), X(0x7f8a98d4), X(0x7f8c1912),
+  X(0x7f8d95b0), X(0x7f8f0eb5), X(0x7f908425), X(0x7f91f605),
+  X(0x7f93645c), X(0x7f94cf2f), X(0x7f963683), X(0x7f979a5d),
+  X(0x7f98fac4), X(0x7f9a57bb), X(0x7f9bb14a), X(0x7f9d0775),
+  X(0x7f9e5a41), X(0x7f9fa9b4), X(0x7fa0f5d3), X(0x7fa23ea4),
+  X(0x7fa3842b), X(0x7fa4c66f), X(0x7fa60575), X(0x7fa74141),
+  X(0x7fa879d9), X(0x7fa9af42), X(0x7faae182), X(0x7fac109e),
+  X(0x7fad3c9a), X(0x7fae657d), X(0x7faf8b4c), X(0x7fb0ae0b),
+  X(0x7fb1cdc0), X(0x7fb2ea70), X(0x7fb40420), X(0x7fb51ad5),
+  X(0x7fb62e95), X(0x7fb73f64), X(0x7fb84d48), X(0x7fb95846),
+  X(0x7fba6062), X(0x7fbb65a2), X(0x7fbc680c), X(0x7fbd67a3),
+  X(0x7fbe646d), X(0x7fbf5e70), X(0x7fc055af), X(0x7fc14a31),
+  X(0x7fc23bf9), X(0x7fc32b0d), X(0x7fc41773), X(0x7fc5012e),
+  X(0x7fc5e844), X(0x7fc6ccba), X(0x7fc7ae94), X(0x7fc88dd8),
+  X(0x7fc96a8a), X(0x7fca44af), X(0x7fcb1c4c), X(0x7fcbf167),
+  X(0x7fccc403), X(0x7fcd9425), X(0x7fce61d3), X(0x7fcf2d11),
+  X(0x7fcff5e3), X(0x7fd0bc4f), X(0x7fd1805a), X(0x7fd24207),
+  X(0x7fd3015c), X(0x7fd3be5d), X(0x7fd47910), X(0x7fd53178),
+  X(0x7fd5e79b), X(0x7fd69b7c), X(0x7fd74d21), X(0x7fd7fc8e),
+  X(0x7fd8a9c8), X(0x7fd954d4), X(0x7fd9fdb5), X(0x7fdaa471),
+  X(0x7fdb490b), X(0x7fdbeb89), X(0x7fdc8bef), X(0x7fdd2a42),
+  X(0x7fddc685), X(0x7fde60be), X(0x7fdef8f0), X(0x7fdf8f20),
+  X(0x7fe02353), X(0x7fe0b58d), X(0x7fe145d3), X(0x7fe1d428),
+  X(0x7fe26091), X(0x7fe2eb12), X(0x7fe373b0), X(0x7fe3fa6f),
+  X(0x7fe47f53), X(0x7fe50260), X(0x7fe5839b), X(0x7fe60308),
+  X(0x7fe680ab), X(0x7fe6fc88), X(0x7fe776a4), X(0x7fe7ef02),
+  X(0x7fe865a7), X(0x7fe8da97), X(0x7fe94dd6), X(0x7fe9bf68),
+  X(0x7fea2f51), X(0x7fea9d95), X(0x7feb0a39), X(0x7feb7540),
+  X(0x7febdeae), X(0x7fec4687), X(0x7fecaccf), X(0x7fed118b),
+  X(0x7fed74be), X(0x7fedd66c), X(0x7fee3698), X(0x7fee9548),
+  X(0x7feef27e), X(0x7fef4e3f), X(0x7fefa88e), X(0x7ff0016f),
+  X(0x7ff058e7), X(0x7ff0aef8), X(0x7ff103a6), X(0x7ff156f6),
+  X(0x7ff1a8eb), X(0x7ff1f988), X(0x7ff248d2), X(0x7ff296cc),
+  X(0x7ff2e37a), X(0x7ff32edf), X(0x7ff378ff), X(0x7ff3c1de),
+  X(0x7ff4097e), X(0x7ff44fe5), X(0x7ff49515), X(0x7ff4d911),
+  X(0x7ff51bde), X(0x7ff55d7f), X(0x7ff59df7), X(0x7ff5dd4a),
+  X(0x7ff61b7b), X(0x7ff6588d), X(0x7ff69485), X(0x7ff6cf65),
+  X(0x7ff70930), X(0x7ff741eb), X(0x7ff77998), X(0x7ff7b03b),
+  X(0x7ff7e5d7), X(0x7ff81a6f), X(0x7ff84e06), X(0x7ff880a1),
+  X(0x7ff8b241), X(0x7ff8e2ea), X(0x7ff912a0), X(0x7ff94165),
+  X(0x7ff96f3d), X(0x7ff99c2b), X(0x7ff9c831), X(0x7ff9f354),
+  X(0x7ffa1d95), X(0x7ffa46f9), X(0x7ffa6f81), X(0x7ffa9731),
+  X(0x7ffabe0d), X(0x7ffae416), X(0x7ffb0951), X(0x7ffb2dbf),
+  X(0x7ffb5164), X(0x7ffb7442), X(0x7ffb965d), X(0x7ffbb7b8),
+  X(0x7ffbd854), X(0x7ffbf836), X(0x7ffc175f), X(0x7ffc35d3),
+  X(0x7ffc5394), X(0x7ffc70a5), X(0x7ffc8d09), X(0x7ffca8c2),
+  X(0x7ffcc3d4), X(0x7ffcde3f), X(0x7ffcf809), X(0x7ffd1132),
+  X(0x7ffd29be), X(0x7ffd41ae), X(0x7ffd5907), X(0x7ffd6fc9),
+  X(0x7ffd85f9), X(0x7ffd9b97), X(0x7ffdb0a7), X(0x7ffdc52b),
+  X(0x7ffdd926), X(0x7ffdec99), X(0x7ffdff88), X(0x7ffe11f4),
+  X(0x7ffe23e0), X(0x7ffe354f), X(0x7ffe4642), X(0x7ffe56bc),
+  X(0x7ffe66bf), X(0x7ffe764e), X(0x7ffe856a), X(0x7ffe9416),
+  X(0x7ffea254), X(0x7ffeb026), X(0x7ffebd8e), X(0x7ffeca8f),
+  X(0x7ffed72a), X(0x7ffee362), X(0x7ffeef38), X(0x7ffefaaf),
+  X(0x7fff05c9), X(0x7fff1087), X(0x7fff1aec), X(0x7fff24f9),
+  X(0x7fff2eb1), X(0x7fff3816), X(0x7fff4128), X(0x7fff49eb),
+  X(0x7fff5260), X(0x7fff5a88), X(0x7fff6266), X(0x7fff69fc),
+  X(0x7fff714b), X(0x7fff7854), X(0x7fff7f1a), X(0x7fff859f),
+  X(0x7fff8be3), X(0x7fff91ea), X(0x7fff97b3), X(0x7fff9d41),
+  X(0x7fffa296), X(0x7fffa7b3), X(0x7fffac99), X(0x7fffb14b),
+  X(0x7fffb5c9), X(0x7fffba15), X(0x7fffbe31), X(0x7fffc21d),
+  X(0x7fffc5dc), X(0x7fffc96f), X(0x7fffccd8), X(0x7fffd016),
+  X(0x7fffd32d), X(0x7fffd61c), X(0x7fffd8e7), X(0x7fffdb8d),
+  X(0x7fffde0f), X(0x7fffe071), X(0x7fffe2b1), X(0x7fffe4d2),
+  X(0x7fffe6d5), X(0x7fffe8bb), X(0x7fffea85), X(0x7fffec34),
+  X(0x7fffedc9), X(0x7fffef45), X(0x7ffff0aa), X(0x7ffff1f7),
+  X(0x7ffff330), X(0x7ffff453), X(0x7ffff562), X(0x7ffff65f),
+  X(0x7ffff749), X(0x7ffff823), X(0x7ffff8ec), X(0x7ffff9a6),
+  X(0x7ffffa51), X(0x7ffffaee), X(0x7ffffb7e), X(0x7ffffc02),
+  X(0x7ffffc7a), X(0x7ffffce7), X(0x7ffffd4a), X(0x7ffffda3),
+  X(0x7ffffdf4), X(0x7ffffe3c), X(0x7ffffe7c), X(0x7ffffeb6),
+  X(0x7ffffee8), X(0x7fffff15), X(0x7fffff3c), X(0x7fffff5e),
+  X(0x7fffff7b), X(0x7fffff95), X(0x7fffffaa), X(0x7fffffbc),
+  X(0x7fffffcb), X(0x7fffffd7), X(0x7fffffe2), X(0x7fffffea),
+  X(0x7ffffff0), X(0x7ffffff5), X(0x7ffffff9), X(0x7ffffffb),
+  X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff),
+  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
+};
+
+static LOOKUP_T vwin8192[4096] = {
+  X(0x0000007c), X(0x0000045c), X(0x00000c1d), X(0x000017bd),
+  X(0x0000273e), X(0x00003a9f), X(0x000051e0), X(0x00006d02),
+  X(0x00008c03), X(0x0000aee5), X(0x0000d5a7), X(0x00010049),
+  X(0x00012ecb), X(0x0001612d), X(0x00019770), X(0x0001d193),
+  X(0x00020f96), X(0x00025178), X(0x0002973c), X(0x0002e0df),
+  X(0x00032e62), X(0x00037fc5), X(0x0003d509), X(0x00042e2c),
+  X(0x00048b30), X(0x0004ec13), X(0x000550d7), X(0x0005b97a),
+  X(0x000625fe), X(0x00069661), X(0x00070aa4), X(0x000782c8),
+  X(0x0007fecb), X(0x00087eae), X(0x00090271), X(0x00098a14),
+  X(0x000a1597), X(0x000aa4f9), X(0x000b383b), X(0x000bcf5d),
+  X(0x000c6a5f), X(0x000d0941), X(0x000dac02), X(0x000e52a3),
+  X(0x000efd23), X(0x000fab84), X(0x00105dc3), X(0x001113e3),
+  X(0x0011cde2), X(0x00128bc0), X(0x00134d7e), X(0x0014131b),
+  X(0x0014dc98), X(0x0015a9f4), X(0x00167b30), X(0x0017504a),
+  X(0x00182945), X(0x0019061e), X(0x0019e6d7), X(0x001acb6f),
+  X(0x001bb3e6), X(0x001ca03c), X(0x001d9071), X(0x001e8485),
+  X(0x001f7c79), X(0x0020784b), X(0x002177fc), X(0x00227b8c),
+  X(0x002382fb), X(0x00248e49), X(0x00259d76), X(0x0026b081),
+  X(0x0027c76b), X(0x0028e234), X(0x002a00dc), X(0x002b2361),
+  X(0x002c49c6), X(0x002d7409), X(0x002ea22a), X(0x002fd42a),
+  X(0x00310a08), X(0x003243c5), X(0x00338160), X(0x0034c2d9),
+  X(0x00360830), X(0x00375165), X(0x00389e78), X(0x0039ef6a),
+  X(0x003b4439), X(0x003c9ce6), X(0x003df971), X(0x003f59da),
+  X(0x0040be20), X(0x00422645), X(0x00439247), X(0x00450226),
+  X(0x004675e3), X(0x0047ed7e), X(0x004968f5), X(0x004ae84b),
+  X(0x004c6b7d), X(0x004df28d), X(0x004f7d7a), X(0x00510c44),
+  X(0x00529eeb), X(0x00543570), X(0x0055cfd1), X(0x00576e0f),
+  X(0x00591029), X(0x005ab621), X(0x005c5ff5), X(0x005e0da6),
+  X(0x005fbf33), X(0x0061749d), X(0x00632de4), X(0x0064eb06),
+  X(0x0066ac05), X(0x006870e0), X(0x006a3998), X(0x006c062b),
+  X(0x006dd69b), X(0x006faae6), X(0x0071830d), X(0x00735f10),
+  X(0x00753eef), X(0x007722a9), X(0x00790a3f), X(0x007af5b1),
+  X(0x007ce4fe), X(0x007ed826), X(0x0080cf29), X(0x0082ca08),
+  X(0x0084c8c2), X(0x0086cb57), X(0x0088d1c7), X(0x008adc11),
+  X(0x008cea37), X(0x008efc37), X(0x00911212), X(0x00932bc7),
+  X(0x00954957), X(0x00976ac2), X(0x00999006), X(0x009bb925),
+  X(0x009de61e), X(0x00a016f1), X(0x00a24b9e), X(0x00a48425),
+  X(0x00a6c086), X(0x00a900c0), X(0x00ab44d4), X(0x00ad8cc2),
+  X(0x00afd889), X(0x00b22829), X(0x00b47ba2), X(0x00b6d2f5),
+  X(0x00b92e21), X(0x00bb8d26), X(0x00bdf004), X(0x00c056ba),
+  X(0x00c2c149), X(0x00c52fb1), X(0x00c7a1f1), X(0x00ca180a),
+  X(0x00cc91fb), X(0x00cf0fc5), X(0x00d19166), X(0x00d416df),
+  X(0x00d6a031), X(0x00d92d5a), X(0x00dbbe5b), X(0x00de5333),
+  X(0x00e0ebe3), X(0x00e3886b), X(0x00e628c9), X(0x00e8ccff),
+  X(0x00eb750c), X(0x00ee20f0), X(0x00f0d0ab), X(0x00f3843d),
+  X(0x00f63ba5), X(0x00f8f6e4), X(0x00fbb5fa), X(0x00fe78e5),
+  X(0x01013fa7), X(0x01040a3f), X(0x0106d8ae), X(0x0109aaf2),
+  X(0x010c810c), X(0x010f5afb), X(0x011238c0), X(0x01151a5b),
+  X(0x0117ffcb), X(0x011ae910), X(0x011dd62a), X(0x0120c719),
+  X(0x0123bbdd), X(0x0126b476), X(0x0129b0e4), X(0x012cb126),
+  X(0x012fb53c), X(0x0132bd27), X(0x0135c8e6), X(0x0138d879),
+  X(0x013bebdf), X(0x013f031a), X(0x01421e28), X(0x01453d0a),
+  X(0x01485fbf), X(0x014b8648), X(0x014eb0a4), X(0x0151ded2),
+  X(0x015510d4), X(0x015846a8), X(0x015b8050), X(0x015ebdc9),
+  X(0x0161ff15), X(0x01654434), X(0x01688d24), X(0x016bd9e6),
+  X(0x016f2a7b), X(0x01727ee1), X(0x0175d718), X(0x01793321),
+  X(0x017c92fc), X(0x017ff6a7), X(0x01835e24), X(0x0186c972),
+  X(0x018a3890), X(0x018dab7f), X(0x0191223f), X(0x01949ccf),
+  X(0x01981b2f), X(0x019b9d5f), X(0x019f235f), X(0x01a2ad2f),
+  X(0x01a63acf), X(0x01a9cc3e), X(0x01ad617c), X(0x01b0fa8a),
+  X(0x01b49767), X(0x01b83813), X(0x01bbdc8d), X(0x01bf84d6),
+  X(0x01c330ee), X(0x01c6e0d4), X(0x01ca9488), X(0x01ce4c0b),
+  X(0x01d2075b), X(0x01d5c679), X(0x01d98964), X(0x01dd501d),
+  X(0x01e11aa3), X(0x01e4e8f6), X(0x01e8bb17), X(0x01ec9104),
+  X(0x01f06abd), X(0x01f44844), X(0x01f82996), X(0x01fc0eb5),
+  X(0x01fff7a0), X(0x0203e456), X(0x0207d4d9), X(0x020bc926),
+  X(0x020fc140), X(0x0213bd24), X(0x0217bcd4), X(0x021bc04e),
+  X(0x021fc793), X(0x0223d2a3), X(0x0227e17d), X(0x022bf421),
+  X(0x02300a90), X(0x023424c8), X(0x023842ca), X(0x023c6495),
+  X(0x02408a2a), X(0x0244b389), X(0x0248e0b0), X(0x024d11a0),
+  X(0x02514659), X(0x02557eda), X(0x0259bb24), X(0x025dfb35),
+  X(0x02623f0f), X(0x026686b1), X(0x026ad21a), X(0x026f214b),
+  X(0x02737443), X(0x0277cb02), X(0x027c2588), X(0x028083d5),
+  X(0x0284e5e9), X(0x02894bc2), X(0x028db562), X(0x029222c8),
+  X(0x029693f4), X(0x029b08e6), X(0x029f819d), X(0x02a3fe19),
+  X(0x02a87e5b), X(0x02ad0261), X(0x02b18a2c), X(0x02b615bb),
+  X(0x02baa50f), X(0x02bf3827), X(0x02c3cf03), X(0x02c869a3),
+  X(0x02cd0807), X(0x02d1aa2d), X(0x02d65017), X(0x02daf9c4),
+  X(0x02dfa734), X(0x02e45866), X(0x02e90d5b), X(0x02edc612),
+  X(0x02f2828b), X(0x02f742c6), X(0x02fc06c3), X(0x0300ce80),
+  X(0x030599ff), X(0x030a6940), X(0x030f3c40), X(0x03141302),
+  X(0x0318ed84), X(0x031dcbc6), X(0x0322adc8), X(0x0327938a),
+  X(0x032c7d0c), X(0x03316a4c), X(0x03365b4d), X(0x033b500c),
+  X(0x03404889), X(0x034544c6), X(0x034a44c0), X(0x034f4879),
+  X(0x03544ff0), X(0x03595b24), X(0x035e6a16), X(0x03637cc5),
+  X(0x03689331), X(0x036dad5a), X(0x0372cb40), X(0x0377ece2),
+  X(0x037d1240), X(0x03823b5a), X(0x03876830), X(0x038c98c1),
+  X(0x0391cd0e), X(0x03970516), X(0x039c40d8), X(0x03a18055),
+  X(0x03a6c38d), X(0x03ac0a7f), X(0x03b1552b), X(0x03b6a390),
+  X(0x03bbf5af), X(0x03c14b88), X(0x03c6a519), X(0x03cc0263),
+  X(0x03d16366), X(0x03d6c821), X(0x03dc3094), X(0x03e19cc0),
+  X(0x03e70ca2), X(0x03ec803d), X(0x03f1f78e), X(0x03f77296),
+  X(0x03fcf155), X(0x040273cb), X(0x0407f9f7), X(0x040d83d9),
+  X(0x04131170), X(0x0418a2bd), X(0x041e37c0), X(0x0423d077),
+  X(0x04296ce4), X(0x042f0d04), X(0x0434b0da), X(0x043a5863),
+  X(0x044003a0), X(0x0445b290), X(0x044b6534), X(0x04511b8b),
+  X(0x0456d595), X(0x045c9352), X(0x046254c1), X(0x046819e1),
+  X(0x046de2b4), X(0x0473af39), X(0x04797f6e), X(0x047f5355),
+  X(0x04852aec), X(0x048b0635), X(0x0490e52d), X(0x0496c7d6),
+  X(0x049cae2e), X(0x04a29836), X(0x04a885ed), X(0x04ae7753),
+  X(0x04b46c68), X(0x04ba652b), X(0x04c0619d), X(0x04c661bc),
+  X(0x04cc658a), X(0x04d26d04), X(0x04d8782c), X(0x04de8701),
+  X(0x04e49983), X(0x04eaafb0), X(0x04f0c98a), X(0x04f6e710),
+  X(0x04fd0842), X(0x05032d1e), X(0x050955a6), X(0x050f81d8),
+  X(0x0515b1b5), X(0x051be53d), X(0x05221c6e), X(0x05285748),
+  X(0x052e95cd), X(0x0534d7fa), X(0x053b1dd0), X(0x0541674e),
+  X(0x0547b475), X(0x054e0544), X(0x055459bb), X(0x055ab1d9),
+  X(0x05610d9e), X(0x05676d0a), X(0x056dd01c), X(0x057436d5),
+  X(0x057aa134), X(0x05810f38), X(0x058780e2), X(0x058df631),
+  X(0x05946f25), X(0x059aebbe), X(0x05a16bfa), X(0x05a7efdb),
+  X(0x05ae775f), X(0x05b50287), X(0x05bb9152), X(0x05c223c0),
+  X(0x05c8b9d0), X(0x05cf5382), X(0x05d5f0d6), X(0x05dc91cc),
+  X(0x05e33663), X(0x05e9de9c), X(0x05f08a75), X(0x05f739ee),
+  X(0x05fded07), X(0x0604a3c0), X(0x060b5e19), X(0x06121c11),
+  X(0x0618dda8), X(0x061fa2dd), X(0x06266bb1), X(0x062d3822),
+  X(0x06340831), X(0x063adbde), X(0x0641b328), X(0x06488e0e),
+  X(0x064f6c91), X(0x06564eaf), X(0x065d346a), X(0x06641dc0),
+  X(0x066b0ab1), X(0x0671fb3d), X(0x0678ef64), X(0x067fe724),
+  X(0x0686e27f), X(0x068de173), X(0x0694e400), X(0x069bea27),
+  X(0x06a2f3e6), X(0x06aa013d), X(0x06b1122c), X(0x06b826b3),
+  X(0x06bf3ed1), X(0x06c65a86), X(0x06cd79d1), X(0x06d49cb3),
+  X(0x06dbc32b), X(0x06e2ed38), X(0x06ea1adb), X(0x06f14c13),
+  X(0x06f880df), X(0x06ffb940), X(0x0706f535), X(0x070e34bd),
+  X(0x071577d9), X(0x071cbe88), X(0x072408c9), X(0x072b569d),
+  X(0x0732a802), X(0x0739fcf9), X(0x07415582), X(0x0748b19b),
+  X(0x07501145), X(0x0757747f), X(0x075edb49), X(0x076645a3),
+  X(0x076db38c), X(0x07752503), X(0x077c9a09), X(0x0784129e),
+  X(0x078b8ec0), X(0x07930e70), X(0x079a91ac), X(0x07a21876),
+  X(0x07a9a2cc), X(0x07b130ad), X(0x07b8c21b), X(0x07c05714),
+  X(0x07c7ef98), X(0x07cf8ba6), X(0x07d72b3f), X(0x07dece62),
+  X(0x07e6750e), X(0x07ee1f43), X(0x07f5cd01), X(0x07fd7e48),
+  X(0x08053316), X(0x080ceb6d), X(0x0814a74a), X(0x081c66af),
+  X(0x0824299a), X(0x082bf00c), X(0x0833ba03), X(0x083b8780),
+  X(0x08435882), X(0x084b2d09), X(0x08530514), X(0x085ae0a3),
+  X(0x0862bfb6), X(0x086aa24c), X(0x08728865), X(0x087a7201),
+  X(0x08825f1e), X(0x088a4fbe), X(0x089243de), X(0x089a3b80),
+  X(0x08a236a2), X(0x08aa3545), X(0x08b23767), X(0x08ba3d09),
+  X(0x08c2462a), X(0x08ca52c9), X(0x08d262e7), X(0x08da7682),
+  X(0x08e28d9c), X(0x08eaa832), X(0x08f2c645), X(0x08fae7d4),
+  X(0x09030cdf), X(0x090b3566), X(0x09136168), X(0x091b90e5),
+  X(0x0923c3dc), X(0x092bfa4d), X(0x09343437), X(0x093c719b),
+  X(0x0944b277), X(0x094cf6cc), X(0x09553e99), X(0x095d89dd),
+  X(0x0965d899), X(0x096e2acb), X(0x09768073), X(0x097ed991),
+  X(0x09873625), X(0x098f962e), X(0x0997f9ac), X(0x09a0609e),
+  X(0x09a8cb04), X(0x09b138dd), X(0x09b9aa29), X(0x09c21ee8),
+  X(0x09ca9719), X(0x09d312bc), X(0x09db91d0), X(0x09e41456),
+  X(0x09ec9a4b), X(0x09f523b1), X(0x09fdb087), X(0x0a0640cc),
+  X(0x0a0ed47f), X(0x0a176ba2), X(0x0a200632), X(0x0a28a42f),
+  X(0x0a31459a), X(0x0a39ea72), X(0x0a4292b5), X(0x0a4b3e65),
+  X(0x0a53ed80), X(0x0a5ca006), X(0x0a6555f7), X(0x0a6e0f51),
+  X(0x0a76cc16), X(0x0a7f8c44), X(0x0a884fda), X(0x0a9116d9),
+  X(0x0a99e140), X(0x0aa2af0e), X(0x0aab8043), X(0x0ab454df),
+  X(0x0abd2ce1), X(0x0ac60849), X(0x0acee716), X(0x0ad7c948),
+  X(0x0ae0aedf), X(0x0ae997d9), X(0x0af28437), X(0x0afb73f7),
+  X(0x0b04671b), X(0x0b0d5da0), X(0x0b165788), X(0x0b1f54d0),
+  X(0x0b285579), X(0x0b315983), X(0x0b3a60ec), X(0x0b436bb5),
+  X(0x0b4c79dd), X(0x0b558b63), X(0x0b5ea048), X(0x0b67b88a),
+  X(0x0b70d429), X(0x0b79f324), X(0x0b83157c), X(0x0b8c3b30),
+  X(0x0b95643f), X(0x0b9e90a8), X(0x0ba7c06c), X(0x0bb0f38a),
+  X(0x0bba2a01), X(0x0bc363d1), X(0x0bcca0f9), X(0x0bd5e17a),
+  X(0x0bdf2552), X(0x0be86c81), X(0x0bf1b706), X(0x0bfb04e2),
+  X(0x0c045613), X(0x0c0daa99), X(0x0c170274), X(0x0c205da3),
+  X(0x0c29bc25), X(0x0c331dfb), X(0x0c3c8323), X(0x0c45eb9e),
+  X(0x0c4f576a), X(0x0c58c688), X(0x0c6238f6), X(0x0c6baeb5),
+  X(0x0c7527c3), X(0x0c7ea421), X(0x0c8823cd), X(0x0c91a6c8),
+  X(0x0c9b2d10), X(0x0ca4b6a6), X(0x0cae4389), X(0x0cb7d3b8),
+  X(0x0cc16732), X(0x0ccafdf8), X(0x0cd49809), X(0x0cde3564),
+  X(0x0ce7d609), X(0x0cf179f7), X(0x0cfb212e), X(0x0d04cbad),
+  X(0x0d0e7974), X(0x0d182a83), X(0x0d21ded8), X(0x0d2b9673),
+  X(0x0d355154), X(0x0d3f0f7b), X(0x0d48d0e6), X(0x0d529595),
+  X(0x0d5c5d88), X(0x0d6628be), X(0x0d6ff737), X(0x0d79c8f2),
+  X(0x0d839dee), X(0x0d8d762c), X(0x0d9751aa), X(0x0da13068),
+  X(0x0dab1266), X(0x0db4f7a3), X(0x0dbee01e), X(0x0dc8cbd8),
+  X(0x0dd2bace), X(0x0ddcad02), X(0x0de6a272), X(0x0df09b1e),
+  X(0x0dfa9705), X(0x0e049627), X(0x0e0e9883), X(0x0e189e19),
+  X(0x0e22a6e8), X(0x0e2cb2f0), X(0x0e36c230), X(0x0e40d4a8),
+  X(0x0e4aea56), X(0x0e55033b), X(0x0e5f1f56), X(0x0e693ea7),
+  X(0x0e73612c), X(0x0e7d86e5), X(0x0e87afd3), X(0x0e91dbf3),
+  X(0x0e9c0b47), X(0x0ea63dcc), X(0x0eb07383), X(0x0ebaac6b),
+  X(0x0ec4e883), X(0x0ecf27cc), X(0x0ed96a44), X(0x0ee3afea),
+  X(0x0eedf8bf), X(0x0ef844c2), X(0x0f0293f2), X(0x0f0ce64e),
+  X(0x0f173bd6), X(0x0f21948a), X(0x0f2bf069), X(0x0f364f72),
+  X(0x0f40b1a5), X(0x0f4b1701), X(0x0f557f86), X(0x0f5feb32),
+  X(0x0f6a5a07), X(0x0f74cc02), X(0x0f7f4124), X(0x0f89b96b),
+  X(0x0f9434d8), X(0x0f9eb369), X(0x0fa9351e), X(0x0fb3b9f7),
+  X(0x0fbe41f3), X(0x0fc8cd11), X(0x0fd35b51), X(0x0fddecb2),
+  X(0x0fe88134), X(0x0ff318d6), X(0x0ffdb397), X(0x10085177),
+  X(0x1012f275), X(0x101d9691), X(0x10283dca), X(0x1032e81f),
+  X(0x103d9591), X(0x1048461e), X(0x1052f9c5), X(0x105db087),
+  X(0x10686a62), X(0x10732756), X(0x107de763), X(0x1088aa87),
+  X(0x109370c2), X(0x109e3a14), X(0x10a9067c), X(0x10b3d5f9),
+  X(0x10bea88b), X(0x10c97e31), X(0x10d456eb), X(0x10df32b8),
+  X(0x10ea1197), X(0x10f4f387), X(0x10ffd889), X(0x110ac09b),
+  X(0x1115abbe), X(0x112099ef), X(0x112b8b2f), X(0x11367f7d),
+  X(0x114176d9), X(0x114c7141), X(0x11576eb6), X(0x11626f36),
+  X(0x116d72c1), X(0x11787957), X(0x118382f6), X(0x118e8f9e),
+  X(0x11999f4f), X(0x11a4b208), X(0x11afc7c7), X(0x11bae08e),
+  X(0x11c5fc5a), X(0x11d11b2c), X(0x11dc3d02), X(0x11e761dd),
+  X(0x11f289ba), X(0x11fdb49b), X(0x1208e27e), X(0x12141362),
+  X(0x121f4748), X(0x122a7e2d), X(0x1235b812), X(0x1240f4f6),
+  X(0x124c34d9), X(0x125777b9), X(0x1262bd96), X(0x126e0670),
+  X(0x12795245), X(0x1284a115), X(0x128ff2e0), X(0x129b47a5),
+  X(0x12a69f63), X(0x12b1fa19), X(0x12bd57c7), X(0x12c8b86c),
+  X(0x12d41c08), X(0x12df829a), X(0x12eaec21), X(0x12f6589d),
+  X(0x1301c80c), X(0x130d3a6f), X(0x1318afc4), X(0x1324280b),
+  X(0x132fa344), X(0x133b216d), X(0x1346a286), X(0x1352268e),
+  X(0x135dad85), X(0x1369376a), X(0x1374c43c), X(0x138053fb),
+  X(0x138be6a5), X(0x13977c3b), X(0x13a314bc), X(0x13aeb026),
+  X(0x13ba4e79), X(0x13c5efb5), X(0x13d193d9), X(0x13dd3ae4),
+  X(0x13e8e4d6), X(0x13f491ad), X(0x1400416a), X(0x140bf40b),
+  X(0x1417a98f), X(0x142361f7), X(0x142f1d41), X(0x143adb6d),
+  X(0x14469c7a), X(0x14526067), X(0x145e2734), X(0x1469f0df),
+  X(0x1475bd69), X(0x14818cd0), X(0x148d5f15), X(0x14993435),
+  X(0x14a50c31), X(0x14b0e708), X(0x14bcc4b8), X(0x14c8a542),
+  X(0x14d488a5), X(0x14e06edf), X(0x14ec57f1), X(0x14f843d9),
+  X(0x15043297), X(0x1510242b), X(0x151c1892), X(0x15280fcd),
+  X(0x153409dc), X(0x154006bc), X(0x154c066e), X(0x155808f1),
+  X(0x15640e44), X(0x15701666), X(0x157c2157), X(0x15882f16),
+  X(0x15943fa2), X(0x15a052fb), X(0x15ac691f), X(0x15b8820f),
+  X(0x15c49dc8), X(0x15d0bc4c), X(0x15dcdd98), X(0x15e901ad),
+  X(0x15f52888), X(0x1601522b), X(0x160d7e93), X(0x1619adc1),
+  X(0x1625dfb3), X(0x16321469), X(0x163e4be2), X(0x164a861d),
+  X(0x1656c31a), X(0x166302d8), X(0x166f4555), X(0x167b8a92),
+  X(0x1687d28e), X(0x16941d47), X(0x16a06abe), X(0x16acbaf0),
+  X(0x16b90ddf), X(0x16c56388), X(0x16d1bbeb), X(0x16de1708),
+  X(0x16ea74dd), X(0x16f6d56a), X(0x170338ae), X(0x170f9ea8),
+  X(0x171c0758), X(0x172872bd), X(0x1734e0d6), X(0x174151a2),
+  X(0x174dc520), X(0x175a3b51), X(0x1766b432), X(0x17732fc4),
+  X(0x177fae05), X(0x178c2ef4), X(0x1798b292), X(0x17a538dd),
+  X(0x17b1c1d4), X(0x17be4d77), X(0x17cadbc5), X(0x17d76cbc),
+  X(0x17e4005e), X(0x17f096a7), X(0x17fd2f98), X(0x1809cb31),
+  X(0x1816696f), X(0x18230a53), X(0x182faddc), X(0x183c5408),
+  X(0x1848fcd8), X(0x1855a849), X(0x1862565d), X(0x186f0711),
+  X(0x187bba64), X(0x18887057), X(0x189528e9), X(0x18a1e418),
+  X(0x18aea1e3), X(0x18bb624b), X(0x18c8254e), X(0x18d4eaeb),
+  X(0x18e1b321), X(0x18ee7df1), X(0x18fb4b58), X(0x19081b57),
+  X(0x1914edec), X(0x1921c317), X(0x192e9ad6), X(0x193b7529),
+  X(0x19485210), X(0x19553189), X(0x19621393), X(0x196ef82e),
+  X(0x197bdf59), X(0x1988c913), X(0x1995b55c), X(0x19a2a432),
+  X(0x19af9595), X(0x19bc8983), X(0x19c97ffd), X(0x19d67900),
+  X(0x19e3748e), X(0x19f072a3), X(0x19fd7341), X(0x1a0a7665),
+  X(0x1a177c10), X(0x1a248440), X(0x1a318ef4), X(0x1a3e9c2c),
+  X(0x1a4babe7), X(0x1a58be24), X(0x1a65d2e2), X(0x1a72ea20),
+  X(0x1a8003de), X(0x1a8d201a), X(0x1a9a3ed5), X(0x1aa7600c),
+  X(0x1ab483bf), X(0x1ac1a9ee), X(0x1aced297), X(0x1adbfdba),
+  X(0x1ae92b56), X(0x1af65b69), X(0x1b038df4), X(0x1b10c2f5),
+  X(0x1b1dfa6b), X(0x1b2b3456), X(0x1b3870b5), X(0x1b45af87),
+  X(0x1b52f0ca), X(0x1b60347f), X(0x1b6d7aa4), X(0x1b7ac339),
+  X(0x1b880e3c), X(0x1b955bad), X(0x1ba2ab8b), X(0x1baffdd5),
+  X(0x1bbd528a), X(0x1bcaa9a9), X(0x1bd80332), X(0x1be55f24),
+  X(0x1bf2bd7d), X(0x1c001e3d), X(0x1c0d8164), X(0x1c1ae6ef),
+  X(0x1c284edf), X(0x1c35b932), X(0x1c4325e7), X(0x1c5094fe),
+  X(0x1c5e0677), X(0x1c6b7a4f), X(0x1c78f086), X(0x1c86691b),
+  X(0x1c93e40d), X(0x1ca1615c), X(0x1caee107), X(0x1cbc630c),
+  X(0x1cc9e76b), X(0x1cd76e23), X(0x1ce4f733), X(0x1cf2829a),
+  X(0x1d001057), X(0x1d0da06a), X(0x1d1b32d1), X(0x1d28c78c),
+  X(0x1d365e9a), X(0x1d43f7f9), X(0x1d5193a9), X(0x1d5f31aa),
+  X(0x1d6cd1f9), X(0x1d7a7497), X(0x1d881982), X(0x1d95c0ba),
+  X(0x1da36a3d), X(0x1db1160a), X(0x1dbec422), X(0x1dcc7482),
+  X(0x1dda272b), X(0x1de7dc1a), X(0x1df59350), X(0x1e034ccb),
+  X(0x1e11088a), X(0x1e1ec68c), X(0x1e2c86d1), X(0x1e3a4958),
+  X(0x1e480e20), X(0x1e55d527), X(0x1e639e6d), X(0x1e7169f1),
+  X(0x1e7f37b2), X(0x1e8d07b0), X(0x1e9ad9e8), X(0x1ea8ae5b),
+  X(0x1eb68507), X(0x1ec45dec), X(0x1ed23908), X(0x1ee0165b),
+  X(0x1eedf5e4), X(0x1efbd7a1), X(0x1f09bb92), X(0x1f17a1b6),
+  X(0x1f258a0d), X(0x1f337494), X(0x1f41614b), X(0x1f4f5032),
+  X(0x1f5d4147), X(0x1f6b3489), X(0x1f7929f7), X(0x1f872192),
+  X(0x1f951b56), X(0x1fa31744), X(0x1fb1155b), X(0x1fbf159a),
+  X(0x1fcd17ff), X(0x1fdb1c8b), X(0x1fe9233b), X(0x1ff72c0f),
+  X(0x20053706), X(0x20134420), X(0x2021535a), X(0x202f64b4),
+  X(0x203d782e), X(0x204b8dc6), X(0x2059a57c), X(0x2067bf4e),
+  X(0x2075db3b), X(0x2083f943), X(0x20921964), X(0x20a03b9e),
+  X(0x20ae5fef), X(0x20bc8657), X(0x20caaed5), X(0x20d8d967),
+  X(0x20e7060e), X(0x20f534c7), X(0x21036592), X(0x2111986e),
+  X(0x211fcd59), X(0x212e0454), X(0x213c3d5d), X(0x214a7873),
+  X(0x2158b594), X(0x2166f4c1), X(0x217535f8), X(0x21837938),
+  X(0x2191be81), X(0x21a005d0), X(0x21ae4f26), X(0x21bc9a81),
+  X(0x21cae7e0), X(0x21d93743), X(0x21e788a8), X(0x21f5dc0e),
+  X(0x22043174), X(0x221288da), X(0x2220e23e), X(0x222f3da0),
+  X(0x223d9afe), X(0x224bfa58), X(0x225a5bac), X(0x2268bef9),
+  X(0x2277243f), X(0x22858b7d), X(0x2293f4b0), X(0x22a25fda),
+  X(0x22b0ccf8), X(0x22bf3c09), X(0x22cdad0d), X(0x22dc2002),
+  X(0x22ea94e8), X(0x22f90bbe), X(0x23078482), X(0x2315ff33),
+  X(0x23247bd1), X(0x2332fa5b), X(0x23417acf), X(0x234ffd2c),
+  X(0x235e8173), X(0x236d07a0), X(0x237b8fb4), X(0x238a19ae),
+  X(0x2398a58c), X(0x23a7334d), X(0x23b5c2f1), X(0x23c45477),
+  X(0x23d2e7dd), X(0x23e17d22), X(0x23f01446), X(0x23fead47),
+  X(0x240d4825), X(0x241be4dd), X(0x242a8371), X(0x243923dd),
+  X(0x2447c622), X(0x24566a3e), X(0x24651031), X(0x2473b7f8),
+  X(0x24826194), X(0x24910d03), X(0x249fba44), X(0x24ae6957),
+  X(0x24bd1a39), X(0x24cbccea), X(0x24da816a), X(0x24e937b7),
+  X(0x24f7efcf), X(0x2506a9b3), X(0x25156560), X(0x252422d6),
+  X(0x2532e215), X(0x2541a31a), X(0x255065e4), X(0x255f2a74),
+  X(0x256df0c7), X(0x257cb8dd), X(0x258b82b4), X(0x259a4e4c),
+  X(0x25a91ba4), X(0x25b7eaba), X(0x25c6bb8e), X(0x25d58e1e),
+  X(0x25e46269), X(0x25f3386e), X(0x2602102d), X(0x2610e9a4),
+  X(0x261fc4d3), X(0x262ea1b7), X(0x263d8050), X(0x264c609e),
+  X(0x265b429e), X(0x266a2650), X(0x26790bb3), X(0x2687f2c6),
+  X(0x2696db88), X(0x26a5c5f7), X(0x26b4b213), X(0x26c39fda),
+  X(0x26d28f4c), X(0x26e18067), X(0x26f0732b), X(0x26ff6796),
+  X(0x270e5da7), X(0x271d555d), X(0x272c4eb7), X(0x273b49b5),
+  X(0x274a4654), X(0x27594495), X(0x27684475), X(0x277745f4),
+  X(0x27864910), X(0x27954dc9), X(0x27a4541e), X(0x27b35c0d),
+  X(0x27c26596), X(0x27d170b7), X(0x27e07d6f), X(0x27ef8bbd),
+  X(0x27fe9ba0), X(0x280dad18), X(0x281cc022), X(0x282bd4be),
+  X(0x283aeaeb), X(0x284a02a7), X(0x28591bf2), X(0x286836cb),
+  X(0x28775330), X(0x28867120), X(0x2895909b), X(0x28a4b19e),
+  X(0x28b3d42a), X(0x28c2f83d), X(0x28d21dd5), X(0x28e144f3),
+  X(0x28f06d94), X(0x28ff97b8), X(0x290ec35d), X(0x291df082),
+  X(0x292d1f27), X(0x293c4f4a), X(0x294b80eb), X(0x295ab407),
+  X(0x2969e89e), X(0x29791eaf), X(0x29885639), X(0x29978f3b),
+  X(0x29a6c9b3), X(0x29b605a0), X(0x29c54302), X(0x29d481d7),
+  X(0x29e3c21e), X(0x29f303d6), X(0x2a0246fd), X(0x2a118b94),
+  X(0x2a20d198), X(0x2a301909), X(0x2a3f61e6), X(0x2a4eac2c),
+  X(0x2a5df7dc), X(0x2a6d44f4), X(0x2a7c9374), X(0x2a8be359),
+  X(0x2a9b34a2), X(0x2aaa8750), X(0x2ab9db60), X(0x2ac930d1),
+  X(0x2ad887a3), X(0x2ae7dfd3), X(0x2af73962), X(0x2b06944e),
+  X(0x2b15f096), X(0x2b254e38), X(0x2b34ad34), X(0x2b440d89),
+  X(0x2b536f34), X(0x2b62d236), X(0x2b72368d), X(0x2b819c38),
+  X(0x2b910336), X(0x2ba06b86), X(0x2bafd526), X(0x2bbf4015),
+  X(0x2bceac53), X(0x2bde19de), X(0x2bed88b5), X(0x2bfcf8d7),
+  X(0x2c0c6a43), X(0x2c1bdcf7), X(0x2c2b50f3), X(0x2c3ac635),
+  X(0x2c4a3cbd), X(0x2c59b488), X(0x2c692d97), X(0x2c78a7e7),
+  X(0x2c882378), X(0x2c97a049), X(0x2ca71e58), X(0x2cb69da4),
+  X(0x2cc61e2c), X(0x2cd59ff0), X(0x2ce522ed), X(0x2cf4a723),
+  X(0x2d042c90), X(0x2d13b334), X(0x2d233b0d), X(0x2d32c41a),
+  X(0x2d424e5a), X(0x2d51d9cc), X(0x2d61666e), X(0x2d70f440),
+  X(0x2d808340), X(0x2d90136e), X(0x2d9fa4c7), X(0x2daf374c),
+  X(0x2dbecafa), X(0x2dce5fd1), X(0x2dddf5cf), X(0x2ded8cf4),
+  X(0x2dfd253d), X(0x2e0cbeab), X(0x2e1c593b), X(0x2e2bf4ed),
+  X(0x2e3b91c0), X(0x2e4b2fb1), X(0x2e5acec1), X(0x2e6a6eee),
+  X(0x2e7a1037), X(0x2e89b29b), X(0x2e995618), X(0x2ea8faad),
+  X(0x2eb8a05a), X(0x2ec8471c), X(0x2ed7eef4), X(0x2ee797df),
+  X(0x2ef741dc), X(0x2f06eceb), X(0x2f16990a), X(0x2f264639),
+  X(0x2f35f475), X(0x2f45a3bd), X(0x2f555412), X(0x2f650570),
+  X(0x2f74b7d8), X(0x2f846b48), X(0x2f941fbe), X(0x2fa3d53a),
+  X(0x2fb38bbb), X(0x2fc3433f), X(0x2fd2fbc5), X(0x2fe2b54c),
+  X(0x2ff26fd3), X(0x30022b58), X(0x3011e7db), X(0x3021a55a),
+  X(0x303163d4), X(0x30412348), X(0x3050e3b5), X(0x3060a519),
+  X(0x30706773), X(0x30802ac3), X(0x308fef06), X(0x309fb43d),
+  X(0x30af7a65), X(0x30bf417d), X(0x30cf0985), X(0x30ded27a),
+  X(0x30ee9c5d), X(0x30fe672b), X(0x310e32e3), X(0x311dff85),
+  X(0x312dcd0f), X(0x313d9b80), X(0x314d6ad7), X(0x315d3b12),
+  X(0x316d0c30), X(0x317cde31), X(0x318cb113), X(0x319c84d4),
+  X(0x31ac5974), X(0x31bc2ef1), X(0x31cc054b), X(0x31dbdc7f),
+  X(0x31ebb48e), X(0x31fb8d74), X(0x320b6733), X(0x321b41c7),
+  X(0x322b1d31), X(0x323af96e), X(0x324ad67e), X(0x325ab45f),
+  X(0x326a9311), X(0x327a7291), X(0x328a52e0), X(0x329a33fb),
+  X(0x32aa15e1), X(0x32b9f892), X(0x32c9dc0c), X(0x32d9c04d),
+  X(0x32e9a555), X(0x32f98b22), X(0x330971b4), X(0x33195909),
+  X(0x3329411f), X(0x333929f6), X(0x3349138c), X(0x3358fde1),
+  X(0x3368e8f2), X(0x3378d4c0), X(0x3388c147), X(0x3398ae89),
+  X(0x33a89c82), X(0x33b88b32), X(0x33c87a98), X(0x33d86ab2),
+  X(0x33e85b80), X(0x33f84d00), X(0x34083f30), X(0x34183210),
+  X(0x3428259f), X(0x343819db), X(0x34480ec3), X(0x34580455),
+  X(0x3467fa92), X(0x3477f176), X(0x3487e902), X(0x3497e134),
+  X(0x34a7da0a), X(0x34b7d384), X(0x34c7cda0), X(0x34d7c85e),
+  X(0x34e7c3bb), X(0x34f7bfb7), X(0x3507bc50), X(0x3517b985),
+  X(0x3527b756), X(0x3537b5c0), X(0x3547b4c3), X(0x3557b45d),
+  X(0x3567b48d), X(0x3577b552), X(0x3587b6aa), X(0x3597b895),
+  X(0x35a7bb12), X(0x35b7be1e), X(0x35c7c1b9), X(0x35d7c5e1),
+  X(0x35e7ca96), X(0x35f7cfd6), X(0x3607d5a0), X(0x3617dbf3),
+  X(0x3627e2cd), X(0x3637ea2d), X(0x3647f212), X(0x3657fa7b),
+  X(0x36680366), X(0x36780cd2), X(0x368816bf), X(0x3698212b),
+  X(0x36a82c14), X(0x36b83779), X(0x36c8435a), X(0x36d84fb4),
+  X(0x36e85c88), X(0x36f869d2), X(0x37087793), X(0x371885c9),
+  X(0x37289473), X(0x3738a38f), X(0x3748b31d), X(0x3758c31a),
+  X(0x3768d387), X(0x3778e461), X(0x3788f5a7), X(0x37990759),
+  X(0x37a91975), X(0x37b92bf9), X(0x37c93ee4), X(0x37d95236),
+  X(0x37e965ed), X(0x37f97a08), X(0x38098e85), X(0x3819a363),
+  X(0x3829b8a2), X(0x3839ce3f), X(0x3849e43a), X(0x3859fa91),
+  X(0x386a1143), X(0x387a284f), X(0x388a3fb4), X(0x389a5770),
+  X(0x38aa6f83), X(0x38ba87ea), X(0x38caa0a5), X(0x38dab9b2),
+  X(0x38ead311), X(0x38faecbf), X(0x390b06bc), X(0x391b2107),
+  X(0x392b3b9e), X(0x393b5680), X(0x394b71ac), X(0x395b8d20),
+  X(0x396ba8dc), X(0x397bc4dd), X(0x398be124), X(0x399bfdae),
+  X(0x39ac1a7a), X(0x39bc3788), X(0x39cc54d5), X(0x39dc7261),
+  X(0x39ec902a), X(0x39fcae2f), X(0x3a0ccc70), X(0x3a1ceaea),
+  X(0x3a2d099c), X(0x3a3d2885), X(0x3a4d47a5), X(0x3a5d66f9),
+  X(0x3a6d8680), X(0x3a7da63a), X(0x3a8dc625), X(0x3a9de63f),
+  X(0x3aae0688), X(0x3abe26fe), X(0x3ace47a0), X(0x3ade686d),
+  X(0x3aee8963), X(0x3afeaa82), X(0x3b0ecbc7), X(0x3b1eed32),
+  X(0x3b2f0ec2), X(0x3b3f3075), X(0x3b4f524a), X(0x3b5f7440),
+  X(0x3b6f9656), X(0x3b7fb889), X(0x3b8fdada), X(0x3b9ffd46),
+  X(0x3bb01fce), X(0x3bc0426e), X(0x3bd06526), X(0x3be087f6),
+  X(0x3bf0aada), X(0x3c00cdd4), X(0x3c10f0e0), X(0x3c2113fe),
+  X(0x3c31372d), X(0x3c415a6b), X(0x3c517db7), X(0x3c61a110),
+  X(0x3c71c475), X(0x3c81e7e4), X(0x3c920b5c), X(0x3ca22edc),
+  X(0x3cb25262), X(0x3cc275ee), X(0x3cd2997e), X(0x3ce2bd11),
+  X(0x3cf2e0a6), X(0x3d03043b), X(0x3d1327cf), X(0x3d234b61),
+  X(0x3d336ef0), X(0x3d43927a), X(0x3d53b5ff), X(0x3d63d97c),
+  X(0x3d73fcf1), X(0x3d84205c), X(0x3d9443bd), X(0x3da46711),
+  X(0x3db48a58), X(0x3dc4ad91), X(0x3dd4d0ba), X(0x3de4f3d1),
+  X(0x3df516d7), X(0x3e0539c9), X(0x3e155ca6), X(0x3e257f6d),
+  X(0x3e35a21d), X(0x3e45c4b4), X(0x3e55e731), X(0x3e660994),
+  X(0x3e762bda), X(0x3e864e03), X(0x3e96700d), X(0x3ea691f7),
+  X(0x3eb6b3bf), X(0x3ec6d565), X(0x3ed6f6e8), X(0x3ee71845),
+  X(0x3ef7397c), X(0x3f075a8c), X(0x3f177b73), X(0x3f279c30),
+  X(0x3f37bcc2), X(0x3f47dd27), X(0x3f57fd5f), X(0x3f681d68),
+  X(0x3f783d40), X(0x3f885ce7), X(0x3f987c5c), X(0x3fa89b9c),
+  X(0x3fb8baa7), X(0x3fc8d97c), X(0x3fd8f819), X(0x3fe9167e),
+  X(0x3ff934a8), X(0x40095296), X(0x40197049), X(0x40298dbd),
+  X(0x4039aaf2), X(0x4049c7e7), X(0x4059e49a), X(0x406a010a),
+  X(0x407a1d36), X(0x408a391d), X(0x409a54bd), X(0x40aa7015),
+  X(0x40ba8b25), X(0x40caa5ea), X(0x40dac063), X(0x40eada90),
+  X(0x40faf46e), X(0x410b0dfe), X(0x411b273d), X(0x412b402a),
+  X(0x413b58c4), X(0x414b710a), X(0x415b88fa), X(0x416ba093),
+  X(0x417bb7d5), X(0x418bcebe), X(0x419be54c), X(0x41abfb7e),
+  X(0x41bc1153), X(0x41cc26ca), X(0x41dc3be2), X(0x41ec5099),
+  X(0x41fc64ef), X(0x420c78e1), X(0x421c8c6f), X(0x422c9f97),
+  X(0x423cb258), X(0x424cc4b2), X(0x425cd6a2), X(0x426ce827),
+  X(0x427cf941), X(0x428d09ee), X(0x429d1a2c), X(0x42ad29fb),
+  X(0x42bd3959), X(0x42cd4846), X(0x42dd56bf), X(0x42ed64c3),
+  X(0x42fd7252), X(0x430d7f6a), X(0x431d8c0a), X(0x432d9831),
+  X(0x433da3dd), X(0x434daf0d), X(0x435db9c0), X(0x436dc3f5),
+  X(0x437dcdab), X(0x438dd6df), X(0x439ddf92), X(0x43ade7c1),
+  X(0x43bdef6c), X(0x43cdf691), X(0x43ddfd2f), X(0x43ee0345),
+  X(0x43fe08d2), X(0x440e0dd4), X(0x441e124b), X(0x442e1634),
+  X(0x443e198f), X(0x444e1c5a), X(0x445e1e95), X(0x446e203e),
+  X(0x447e2153), X(0x448e21d5), X(0x449e21c0), X(0x44ae2115),
+  X(0x44be1fd1), X(0x44ce1df4), X(0x44de1b7d), X(0x44ee186a),
+  X(0x44fe14ba), X(0x450e106b), X(0x451e0b7e), X(0x452e05ef),
+  X(0x453dffbf), X(0x454df8eb), X(0x455df173), X(0x456de956),
+  X(0x457de092), X(0x458dd726), X(0x459dcd10), X(0x45adc251),
+  X(0x45bdb6e5), X(0x45cdaacd), X(0x45dd9e06), X(0x45ed9091),
+  X(0x45fd826a), X(0x460d7392), X(0x461d6407), X(0x462d53c8),
+  X(0x463d42d4), X(0x464d3129), X(0x465d1ec6), X(0x466d0baa),
+  X(0x467cf7d3), X(0x468ce342), X(0x469ccdf3), X(0x46acb7e7),
+  X(0x46bca11c), X(0x46cc8990), X(0x46dc7143), X(0x46ec5833),
+  X(0x46fc3e5f), X(0x470c23c6), X(0x471c0867), X(0x472bec40),
+  X(0x473bcf50), X(0x474bb196), X(0x475b9311), X(0x476b73c0),
+  X(0x477b53a1), X(0x478b32b4), X(0x479b10f6), X(0x47aaee67),
+  X(0x47bacb06), X(0x47caa6d1), X(0x47da81c7), X(0x47ea5be7),
+  X(0x47fa3530), X(0x480a0da1), X(0x4819e537), X(0x4829bbf3),
+  X(0x483991d3), X(0x484966d6), X(0x48593afb), X(0x48690e3f),
+  X(0x4878e0a3), X(0x4888b225), X(0x489882c4), X(0x48a8527e),
+  X(0x48b82153), X(0x48c7ef41), X(0x48d7bc47), X(0x48e78863),
+  X(0x48f75396), X(0x49071ddc), X(0x4916e736), X(0x4926afa2),
+  X(0x4936771f), X(0x49463dac), X(0x49560347), X(0x4965c7ef),
+  X(0x49758ba4), X(0x49854e63), X(0x4995102c), X(0x49a4d0fe),
+  X(0x49b490d7), X(0x49c44fb6), X(0x49d40d9a), X(0x49e3ca82),
+  X(0x49f3866c), X(0x4a034159), X(0x4a12fb45), X(0x4a22b430),
+  X(0x4a326c19), X(0x4a4222ff), X(0x4a51d8e1), X(0x4a618dbd),
+  X(0x4a714192), X(0x4a80f45f), X(0x4a90a623), X(0x4aa056dd),
+  X(0x4ab0068b), X(0x4abfb52c), X(0x4acf62c0), X(0x4adf0f44),
+  X(0x4aeebab9), X(0x4afe651c), X(0x4b0e0e6c), X(0x4b1db6a9),
+  X(0x4b2d5dd1), X(0x4b3d03e2), X(0x4b4ca8dd), X(0x4b5c4cbf),
+  X(0x4b6bef88), X(0x4b7b9136), X(0x4b8b31c8), X(0x4b9ad13d),
+  X(0x4baa6f93), X(0x4bba0ccb), X(0x4bc9a8e2), X(0x4bd943d7),
+  X(0x4be8dda9), X(0x4bf87658), X(0x4c080de1), X(0x4c17a444),
+  X(0x4c27397f), X(0x4c36cd92), X(0x4c46607b), X(0x4c55f239),
+  X(0x4c6582cb), X(0x4c75122f), X(0x4c84a065), X(0x4c942d6c),
+  X(0x4ca3b942), X(0x4cb343e6), X(0x4cc2cd57), X(0x4cd25594),
+  X(0x4ce1dc9c), X(0x4cf1626d), X(0x4d00e707), X(0x4d106a68),
+  X(0x4d1fec8f), X(0x4d2f6d7a), X(0x4d3eed2a), X(0x4d4e6b9d),
+  X(0x4d5de8d1), X(0x4d6d64c5), X(0x4d7cdf79), X(0x4d8c58eb),
+  X(0x4d9bd11a), X(0x4dab4804), X(0x4dbabdaa), X(0x4dca3209),
+  X(0x4dd9a520), X(0x4de916ef), X(0x4df88774), X(0x4e07f6ae),
+  X(0x4e17649c), X(0x4e26d13c), X(0x4e363c8f), X(0x4e45a692),
+  X(0x4e550f44), X(0x4e6476a4), X(0x4e73dcb2), X(0x4e83416c),
+  X(0x4e92a4d1), X(0x4ea206df), X(0x4eb16796), X(0x4ec0c6f5),
+  X(0x4ed024fa), X(0x4edf81a5), X(0x4eeedcf3), X(0x4efe36e5),
+  X(0x4f0d8f79), X(0x4f1ce6ad), X(0x4f2c3c82), X(0x4f3b90f4),
+  X(0x4f4ae405), X(0x4f5a35b1), X(0x4f6985fa), X(0x4f78d4dc),
+  X(0x4f882257), X(0x4f976e6a), X(0x4fa6b914), X(0x4fb60254),
+  X(0x4fc54a28), X(0x4fd49090), X(0x4fe3d58b), X(0x4ff31917),
+  X(0x50025b33), X(0x50119bde), X(0x5020db17), X(0x503018dd),
+  X(0x503f552f), X(0x504e900b), X(0x505dc971), X(0x506d0160),
+  X(0x507c37d7), X(0x508b6cd3), X(0x509aa055), X(0x50a9d25b),
+  X(0x50b902e4), X(0x50c831ef), X(0x50d75f7b), X(0x50e68b87),
+  X(0x50f5b612), X(0x5104df1a), X(0x5114069f), X(0x51232ca0),
+  X(0x5132511a), X(0x5141740f), X(0x5150957b), X(0x515fb55f),
+  X(0x516ed3b8), X(0x517df087), X(0x518d0bca), X(0x519c257f),
+  X(0x51ab3da7), X(0x51ba543f), X(0x51c96947), X(0x51d87cbd),
+  X(0x51e78ea1), X(0x51f69ef1), X(0x5205adad), X(0x5214bad3),
+  X(0x5223c662), X(0x5232d05a), X(0x5241d8b9), X(0x5250df7d),
+  X(0x525fe4a7), X(0x526ee835), X(0x527dea26), X(0x528cea78),
+  X(0x529be92c), X(0x52aae63f), X(0x52b9e1b0), X(0x52c8db80),
+  X(0x52d7d3ac), X(0x52e6ca33), X(0x52f5bf15), X(0x5304b251),
+  X(0x5313a3e5), X(0x532293d0), X(0x53318212), X(0x53406ea8),
+  X(0x534f5993), X(0x535e42d2), X(0x536d2a62), X(0x537c1043),
+  X(0x538af475), X(0x5399d6f6), X(0x53a8b7c4), X(0x53b796e0),
+  X(0x53c67447), X(0x53d54ffa), X(0x53e429f6), X(0x53f3023b),
+  X(0x5401d8c8), X(0x5410ad9c), X(0x541f80b5), X(0x542e5213),
+  X(0x543d21b5), X(0x544bef9a), X(0x545abbc0), X(0x54698627),
+  X(0x54784ece), X(0x548715b3), X(0x5495dad6), X(0x54a49e35),
+  X(0x54b35fd0), X(0x54c21fa6), X(0x54d0ddb5), X(0x54df99fd),
+  X(0x54ee547c), X(0x54fd0d32), X(0x550bc41d), X(0x551a793d),
+  X(0x55292c91), X(0x5537de16), X(0x55468dce), X(0x55553bb6),
+  X(0x5563e7cd), X(0x55729213), X(0x55813a87), X(0x558fe127),
+  X(0x559e85f2), X(0x55ad28e9), X(0x55bbca08), X(0x55ca6950),
+  X(0x55d906c0), X(0x55e7a257), X(0x55f63c13), X(0x5604d3f4),
+  X(0x561369f8), X(0x5621fe1f), X(0x56309067), X(0x563f20d1),
+  X(0x564daf5a), X(0x565c3c02), X(0x566ac6c7), X(0x56794faa),
+  X(0x5687d6a8), X(0x56965bc1), X(0x56a4def4), X(0x56b36040),
+  X(0x56c1dfa4), X(0x56d05d1f), X(0x56ded8af), X(0x56ed5255),
+  X(0x56fbca0f), X(0x570a3fdc), X(0x5718b3bc), X(0x572725ac),
+  X(0x573595ad), X(0x574403bd), X(0x57526fdb), X(0x5760da07),
+  X(0x576f423f), X(0x577da883), X(0x578c0cd1), X(0x579a6f29),
+  X(0x57a8cf8a), X(0x57b72df2), X(0x57c58a61), X(0x57d3e4d6),
+  X(0x57e23d50), X(0x57f093cd), X(0x57fee84e), X(0x580d3ad1),
+  X(0x581b8b54), X(0x5829d9d8), X(0x5838265c), X(0x584670dd),
+  X(0x5854b95c), X(0x5862ffd8), X(0x5871444f), X(0x587f86c1),
+  X(0x588dc72c), X(0x589c0591), X(0x58aa41ed), X(0x58b87c40),
+  X(0x58c6b489), X(0x58d4eac7), X(0x58e31ef9), X(0x58f1511f),
+  X(0x58ff8137), X(0x590daf40), X(0x591bdb3a), X(0x592a0524),
+  X(0x59382cfc), X(0x594652c2), X(0x59547675), X(0x59629815),
+  X(0x5970b79f), X(0x597ed513), X(0x598cf071), X(0x599b09b7),
+  X(0x59a920e5), X(0x59b735f9), X(0x59c548f4), X(0x59d359d2),
+  X(0x59e16895), X(0x59ef753b), X(0x59fd7fc4), X(0x5a0b882d),
+  X(0x5a198e77), X(0x5a2792a0), X(0x5a3594a9), X(0x5a43948e),
+  X(0x5a519251), X(0x5a5f8df0), X(0x5a6d876a), X(0x5a7b7ebe),
+  X(0x5a8973ec), X(0x5a9766f2), X(0x5aa557d0), X(0x5ab34685),
+  X(0x5ac1330f), X(0x5acf1d6f), X(0x5add05a3), X(0x5aeaebaa),
+  X(0x5af8cf84), X(0x5b06b12f), X(0x5b1490ab), X(0x5b226df7),
+  X(0x5b304912), X(0x5b3e21fc), X(0x5b4bf8b2), X(0x5b59cd35),
+  X(0x5b679f84), X(0x5b756f9e), X(0x5b833d82), X(0x5b91092e),
+  X(0x5b9ed2a3), X(0x5bac99e0), X(0x5bba5ee3), X(0x5bc821ac),
+  X(0x5bd5e23a), X(0x5be3a08c), X(0x5bf15ca1), X(0x5bff1679),
+  X(0x5c0cce12), X(0x5c1a836c), X(0x5c283686), X(0x5c35e760),
+  X(0x5c4395f7), X(0x5c51424c), X(0x5c5eec5e), X(0x5c6c942b),
+  X(0x5c7a39b4), X(0x5c87dcf7), X(0x5c957df3), X(0x5ca31ca8),
+  X(0x5cb0b915), X(0x5cbe5338), X(0x5ccbeb12), X(0x5cd980a1),
+  X(0x5ce713e5), X(0x5cf4a4dd), X(0x5d023387), X(0x5d0fbfe4),
+  X(0x5d1d49f2), X(0x5d2ad1b1), X(0x5d38571f), X(0x5d45da3c),
+  X(0x5d535b08), X(0x5d60d981), X(0x5d6e55a7), X(0x5d7bcf78),
+  X(0x5d8946f5), X(0x5d96bc1c), X(0x5da42eec), X(0x5db19f65),
+  X(0x5dbf0d86), X(0x5dcc794e), X(0x5dd9e2bd), X(0x5de749d1),
+  X(0x5df4ae8a), X(0x5e0210e7), X(0x5e0f70e7), X(0x5e1cce8a),
+  X(0x5e2a29ce), X(0x5e3782b4), X(0x5e44d93a), X(0x5e522d5f),
+  X(0x5e5f7f23), X(0x5e6cce85), X(0x5e7a1b85), X(0x5e876620),
+  X(0x5e94ae58), X(0x5ea1f42a), X(0x5eaf3797), X(0x5ebc789d),
+  X(0x5ec9b73c), X(0x5ed6f372), X(0x5ee42d41), X(0x5ef164a5),
+  X(0x5efe999f), X(0x5f0bcc2f), X(0x5f18fc52), X(0x5f262a09),
+  X(0x5f335553), X(0x5f407e2f), X(0x5f4da49d), X(0x5f5ac89b),
+  X(0x5f67ea29), X(0x5f750946), X(0x5f8225f2), X(0x5f8f402b),
+  X(0x5f9c57f2), X(0x5fa96d44), X(0x5fb68023), X(0x5fc3908c),
+  X(0x5fd09e7f), X(0x5fdda9fc), X(0x5feab302), X(0x5ff7b990),
+  X(0x6004bda5), X(0x6011bf40), X(0x601ebe62), X(0x602bbb09),
+  X(0x6038b534), X(0x6045ace4), X(0x6052a216), X(0x605f94cb),
+  X(0x606c8502), X(0x607972b9), X(0x60865df2), X(0x609346aa),
+  X(0x60a02ce1), X(0x60ad1096), X(0x60b9f1c9), X(0x60c6d079),
+  X(0x60d3aca5), X(0x60e0864d), X(0x60ed5d70), X(0x60fa320d),
+  X(0x61070424), X(0x6113d3b4), X(0x6120a0bc), X(0x612d6b3c),
+  X(0x613a3332), X(0x6146f89f), X(0x6153bb82), X(0x61607bd9),
+  X(0x616d39a5), X(0x6179f4e5), X(0x6186ad98), X(0x619363bd),
+  X(0x61a01753), X(0x61acc85b), X(0x61b976d3), X(0x61c622bc),
+  X(0x61d2cc13), X(0x61df72d8), X(0x61ec170c), X(0x61f8b8ad),
+  X(0x620557ba), X(0x6211f434), X(0x621e8e18), X(0x622b2568),
+  X(0x6237ba21), X(0x62444c44), X(0x6250dbd0), X(0x625d68c4),
+  X(0x6269f320), X(0x62767ae2), X(0x6283000b), X(0x628f829a),
+  X(0x629c028e), X(0x62a87fe6), X(0x62b4faa2), X(0x62c172c2),
+  X(0x62cde844), X(0x62da5b29), X(0x62e6cb6e), X(0x62f33915),
+  X(0x62ffa41c), X(0x630c0c83), X(0x63187248), X(0x6324d56d),
+  X(0x633135ef), X(0x633d93ce), X(0x6349ef0b), X(0x635647a3),
+  X(0x63629d97), X(0x636ef0e6), X(0x637b418f), X(0x63878f92),
+  X(0x6393daef), X(0x63a023a4), X(0x63ac69b1), X(0x63b8ad15),
+  X(0x63c4edd1), X(0x63d12be3), X(0x63dd674b), X(0x63e9a008),
+  X(0x63f5d61a), X(0x64020980), X(0x640e3a39), X(0x641a6846),
+  X(0x642693a5), X(0x6432bc56), X(0x643ee258), X(0x644b05ab),
+  X(0x6457264e), X(0x64634441), X(0x646f5f83), X(0x647b7814),
+  X(0x64878df3), X(0x6493a120), X(0x649fb199), X(0x64abbf5f),
+  X(0x64b7ca71), X(0x64c3d2ce), X(0x64cfd877), X(0x64dbdb69),
+  X(0x64e7dba6), X(0x64f3d92b), X(0x64ffd3fa), X(0x650bcc11),
+  X(0x6517c16f), X(0x6523b415), X(0x652fa402), X(0x653b9134),
+  X(0x65477bad), X(0x6553636a), X(0x655f486d), X(0x656b2ab3),
+  X(0x65770a3d), X(0x6582e70a), X(0x658ec11a), X(0x659a986d),
+  X(0x65a66d00), X(0x65b23ed5), X(0x65be0deb), X(0x65c9da41),
+  X(0x65d5a3d7), X(0x65e16aac), X(0x65ed2ebf), X(0x65f8f011),
+  X(0x6604aea1), X(0x66106a6e), X(0x661c2377), X(0x6627d9be),
+  X(0x66338d40), X(0x663f3dfd), X(0x664aebf5), X(0x66569728),
+  X(0x66623f95), X(0x666de53b), X(0x6679881b), X(0x66852833),
+  X(0x6690c583), X(0x669c600b), X(0x66a7f7ca), X(0x66b38cc0),
+  X(0x66bf1eec), X(0x66caae4f), X(0x66d63ae6), X(0x66e1c4b3),
+  X(0x66ed4bb4), X(0x66f8cfea), X(0x67045153), X(0x670fcfef),
+  X(0x671b4bbe), X(0x6726c4bf), X(0x67323af3), X(0x673dae58),
+  X(0x67491eee), X(0x67548cb5), X(0x675ff7ab), X(0x676b5fd2),
+  X(0x6776c528), X(0x678227ad), X(0x678d8761), X(0x6798e443),
+  X(0x67a43e52), X(0x67af958f), X(0x67bae9f9), X(0x67c63b8f),
+  X(0x67d18a52), X(0x67dcd640), X(0x67e81f59), X(0x67f3659d),
+  X(0x67fea90c), X(0x6809e9a5), X(0x68152768), X(0x68206254),
+  X(0x682b9a68), X(0x6836cfa6), X(0x6842020b), X(0x684d3199),
+  X(0x68585e4d), X(0x68638829), X(0x686eaf2b), X(0x6879d354),
+  X(0x6884f4a2), X(0x68901316), X(0x689b2eb0), X(0x68a6476d),
+  X(0x68b15d50), X(0x68bc7056), X(0x68c78080), X(0x68d28dcd),
+  X(0x68dd983e), X(0x68e89fd0), X(0x68f3a486), X(0x68fea65d),
+  X(0x6909a555), X(0x6914a16f), X(0x691f9aa9), X(0x692a9104),
+  X(0x69358480), X(0x6940751b), X(0x694b62d5), X(0x69564daf),
+  X(0x696135a7), X(0x696c1abe), X(0x6976fcf3), X(0x6981dc46),
+  X(0x698cb8b6), X(0x69979243), X(0x69a268ed), X(0x69ad3cb4),
+  X(0x69b80d97), X(0x69c2db96), X(0x69cda6b0), X(0x69d86ee5),
+  X(0x69e33436), X(0x69edf6a1), X(0x69f8b626), X(0x6a0372c5),
+  X(0x6a0e2c7e), X(0x6a18e350), X(0x6a23973c), X(0x6a2e4840),
+  X(0x6a38f65d), X(0x6a43a191), X(0x6a4e49de), X(0x6a58ef42),
+  X(0x6a6391be), X(0x6a6e3151), X(0x6a78cdfa), X(0x6a8367ba),
+  X(0x6a8dfe90), X(0x6a98927c), X(0x6aa3237d), X(0x6aadb194),
+  X(0x6ab83cc0), X(0x6ac2c500), X(0x6acd4a55), X(0x6ad7ccbf),
+  X(0x6ae24c3c), X(0x6aecc8cd), X(0x6af74271), X(0x6b01b929),
+  X(0x6b0c2cf4), X(0x6b169dd1), X(0x6b210bc1), X(0x6b2b76c2),
+  X(0x6b35ded6), X(0x6b4043fc), X(0x6b4aa632), X(0x6b55057a),
+  X(0x6b5f61d3), X(0x6b69bb3d), X(0x6b7411b7), X(0x6b7e6541),
+  X(0x6b88b5db), X(0x6b930385), X(0x6b9d4e3f), X(0x6ba79607),
+  X(0x6bb1dadf), X(0x6bbc1cc6), X(0x6bc65bbb), X(0x6bd097bf),
+  X(0x6bdad0d0), X(0x6be506f0), X(0x6bef3a1d), X(0x6bf96a58),
+  X(0x6c0397a0), X(0x6c0dc1f5), X(0x6c17e957), X(0x6c220dc6),
+  X(0x6c2c2f41), X(0x6c364dc9), X(0x6c40695c), X(0x6c4a81fc),
+  X(0x6c5497a7), X(0x6c5eaa5d), X(0x6c68ba1f), X(0x6c72c6eb),
+  X(0x6c7cd0c3), X(0x6c86d7a6), X(0x6c90db92), X(0x6c9adc8a),
+  X(0x6ca4da8b), X(0x6caed596), X(0x6cb8cdab), X(0x6cc2c2ca),
+  X(0x6cccb4f2), X(0x6cd6a424), X(0x6ce0905e), X(0x6cea79a1),
+  X(0x6cf45fee), X(0x6cfe4342), X(0x6d0823a0), X(0x6d120105),
+  X(0x6d1bdb73), X(0x6d25b2e8), X(0x6d2f8765), X(0x6d3958ea),
+  X(0x6d432777), X(0x6d4cf30a), X(0x6d56bba5), X(0x6d608147),
+  X(0x6d6a43f0), X(0x6d7403a0), X(0x6d7dc056), X(0x6d877a13),
+  X(0x6d9130d6), X(0x6d9ae4a0), X(0x6da4956f), X(0x6dae4345),
+  X(0x6db7ee20), X(0x6dc19601), X(0x6dcb3ae7), X(0x6dd4dcd3),
+  X(0x6dde7bc4), X(0x6de817bb), X(0x6df1b0b6), X(0x6dfb46b7),
+  X(0x6e04d9bc), X(0x6e0e69c7), X(0x6e17f6d5), X(0x6e2180e9),
+  X(0x6e2b0801), X(0x6e348c1d), X(0x6e3e0d3d), X(0x6e478b62),
+  X(0x6e51068a), X(0x6e5a7eb7), X(0x6e63f3e7), X(0x6e6d661b),
+  X(0x6e76d552), X(0x6e80418e), X(0x6e89aacc), X(0x6e93110f),
+  X(0x6e9c7454), X(0x6ea5d49d), X(0x6eaf31e9), X(0x6eb88c37),
+  X(0x6ec1e389), X(0x6ecb37de), X(0x6ed48936), X(0x6eddd790),
+  X(0x6ee722ee), X(0x6ef06b4d), X(0x6ef9b0b0), X(0x6f02f315),
+  X(0x6f0c327c), X(0x6f156ee6), X(0x6f1ea852), X(0x6f27dec1),
+  X(0x6f311232), X(0x6f3a42a5), X(0x6f43701a), X(0x6f4c9a91),
+  X(0x6f55c20a), X(0x6f5ee686), X(0x6f680803), X(0x6f712682),
+  X(0x6f7a4203), X(0x6f835a86), X(0x6f8c700b), X(0x6f958291),
+  X(0x6f9e921a), X(0x6fa79ea4), X(0x6fb0a830), X(0x6fb9aebd),
+  X(0x6fc2b24c), X(0x6fcbb2dd), X(0x6fd4b06f), X(0x6fddab03),
+  X(0x6fe6a299), X(0x6fef9730), X(0x6ff888c9), X(0x70017763),
+  X(0x700a62ff), X(0x70134b9c), X(0x701c313b), X(0x702513dc),
+  X(0x702df37e), X(0x7036d021), X(0x703fa9c6), X(0x7048806d),
+  X(0x70515415), X(0x705a24bf), X(0x7062f26b), X(0x706bbd17),
+  X(0x707484c6), X(0x707d4976), X(0x70860b28), X(0x708ec9dc),
+  X(0x70978591), X(0x70a03e48), X(0x70a8f400), X(0x70b1a6bb),
+  X(0x70ba5677), X(0x70c30335), X(0x70cbacf5), X(0x70d453b6),
+  X(0x70dcf77a), X(0x70e59840), X(0x70ee3607), X(0x70f6d0d1),
+  X(0x70ff689d), X(0x7107fd6b), X(0x71108f3b), X(0x71191e0d),
+  X(0x7121a9e2), X(0x712a32b9), X(0x7132b892), X(0x713b3b6e),
+  X(0x7143bb4c), X(0x714c382d), X(0x7154b211), X(0x715d28f7),
+  X(0x71659ce0), X(0x716e0dcc), X(0x71767bbb), X(0x717ee6ac),
+  X(0x71874ea1), X(0x718fb399), X(0x71981594), X(0x71a07493),
+  X(0x71a8d094), X(0x71b1299a), X(0x71b97fa2), X(0x71c1d2af),
+  X(0x71ca22bf), X(0x71d26fd2), X(0x71dab9ea), X(0x71e30106),
+  X(0x71eb4526), X(0x71f3864a), X(0x71fbc472), X(0x7203ff9e),
+  X(0x720c37cf), X(0x72146d05), X(0x721c9f3f), X(0x7224ce7e),
+  X(0x722cfac2), X(0x7235240b), X(0x723d4a59), X(0x72456dad),
+  X(0x724d8e05), X(0x7255ab63), X(0x725dc5c7), X(0x7265dd31),
+  X(0x726df1a0), X(0x72760315), X(0x727e1191), X(0x72861d12),
+  X(0x728e259a), X(0x72962b28), X(0x729e2dbd), X(0x72a62d59),
+  X(0x72ae29fc), X(0x72b623a5), X(0x72be1a56), X(0x72c60e0e),
+  X(0x72cdfece), X(0x72d5ec95), X(0x72ddd764), X(0x72e5bf3b),
+  X(0x72eda41a), X(0x72f58601), X(0x72fd64f1), X(0x730540e9),
+  X(0x730d19e9), X(0x7314eff3), X(0x731cc305), X(0x73249321),
+  X(0x732c6046), X(0x73342a75), X(0x733bf1ad), X(0x7343b5ef),
+  X(0x734b773b), X(0x73533591), X(0x735af0f2), X(0x7362a95d),
+  X(0x736a5ed3), X(0x73721153), X(0x7379c0df), X(0x73816d76),
+  X(0x73891719), X(0x7390bdc7), X(0x73986181), X(0x73a00247),
+  X(0x73a7a01a), X(0x73af3af8), X(0x73b6d2e4), X(0x73be67dc),
+  X(0x73c5f9e1), X(0x73cd88f3), X(0x73d51513), X(0x73dc9e40),
+  X(0x73e4247c), X(0x73eba7c5), X(0x73f3281c), X(0x73faa582),
+  X(0x74021ff7), X(0x7409977b), X(0x74110c0d), X(0x74187daf),
+  X(0x741fec61), X(0x74275822), X(0x742ec0f3), X(0x743626d5),
+  X(0x743d89c7), X(0x7444e9c9), X(0x744c46dd), X(0x7453a101),
+  X(0x745af837), X(0x74624c7f), X(0x74699dd8), X(0x7470ec44),
+  X(0x747837c2), X(0x747f8052), X(0x7486c5f5), X(0x748e08ac),
+  X(0x74954875), X(0x749c8552), X(0x74a3bf43), X(0x74aaf648),
+  X(0x74b22a62), X(0x74b95b90), X(0x74c089d2), X(0x74c7b52a),
+  X(0x74cedd97), X(0x74d6031a), X(0x74dd25b2), X(0x74e44561),
+  X(0x74eb6226), X(0x74f27c02), X(0x74f992f5), X(0x7500a6ff),
+  X(0x7507b820), X(0x750ec659), X(0x7515d1aa), X(0x751cda14),
+  X(0x7523df96), X(0x752ae231), X(0x7531e1e5), X(0x7538deb2),
+  X(0x753fd89a), X(0x7546cf9b), X(0x754dc3b7), X(0x7554b4ed),
+  X(0x755ba33e), X(0x75628eaa), X(0x75697732), X(0x75705cd5),
+  X(0x75773f95), X(0x757e1f71), X(0x7584fc6a), X(0x758bd67f),
+  X(0x7592adb2), X(0x75998203), X(0x75a05371), X(0x75a721fe),
+  X(0x75adeda9), X(0x75b4b673), X(0x75bb7c5c), X(0x75c23f65),
+  X(0x75c8ff8d), X(0x75cfbcd6), X(0x75d6773f), X(0x75dd2ec8),
+  X(0x75e3e373), X(0x75ea953f), X(0x75f1442d), X(0x75f7f03d),
+  X(0x75fe996f), X(0x76053fc5), X(0x760be33d), X(0x761283d8),
+  X(0x76192197), X(0x761fbc7b), X(0x76265482), X(0x762ce9af),
+  X(0x76337c01), X(0x763a0b78), X(0x76409814), X(0x764721d7),
+  X(0x764da8c1), X(0x76542cd1), X(0x765aae08), X(0x76612c67),
+  X(0x7667a7ee), X(0x766e209d), X(0x76749675), X(0x767b0975),
+  X(0x7681799f), X(0x7687e6f3), X(0x768e5170), X(0x7694b918),
+  X(0x769b1deb), X(0x76a17fe9), X(0x76a7df13), X(0x76ae3b68),
+  X(0x76b494ea), X(0x76baeb98), X(0x76c13f74), X(0x76c7907c),
+  X(0x76cddeb3), X(0x76d42a18), X(0x76da72ab), X(0x76e0b86d),
+  X(0x76e6fb5e), X(0x76ed3b7f), X(0x76f378d0), X(0x76f9b352),
+  X(0x76ffeb05), X(0x77061fe8), X(0x770c51fe), X(0x77128145),
+  X(0x7718adbf), X(0x771ed76c), X(0x7724fe4c), X(0x772b225f),
+  X(0x773143a7), X(0x77376223), X(0x773d7dd3), X(0x774396ba),
+  X(0x7749acd5), X(0x774fc027), X(0x7755d0af), X(0x775bde6f),
+  X(0x7761e965), X(0x7767f193), X(0x776df6fa), X(0x7773f998),
+  X(0x7779f970), X(0x777ff681), X(0x7785f0cd), X(0x778be852),
+  X(0x7791dd12), X(0x7797cf0d), X(0x779dbe43), X(0x77a3aab6),
+  X(0x77a99465), X(0x77af7b50), X(0x77b55f79), X(0x77bb40e0),
+  X(0x77c11f85), X(0x77c6fb68), X(0x77ccd48a), X(0x77d2aaec),
+  X(0x77d87e8d), X(0x77de4f6f), X(0x77e41d92), X(0x77e9e8f5),
+  X(0x77efb19b), X(0x77f57782), X(0x77fb3aad), X(0x7800fb1a),
+  X(0x7806b8ca), X(0x780c73bf), X(0x78122bf7), X(0x7817e175),
+  X(0x781d9438), X(0x78234440), X(0x7828f18f), X(0x782e9c25),
+  X(0x78344401), X(0x7839e925), X(0x783f8b92), X(0x78452b46),
+  X(0x784ac844), X(0x7850628b), X(0x7855fa1c), X(0x785b8ef8),
+  X(0x7861211e), X(0x7866b090), X(0x786c3d4d), X(0x7871c757),
+  X(0x78774ead), X(0x787cd351), X(0x78825543), X(0x7887d483),
+  X(0x788d5111), X(0x7892caef), X(0x7898421c), X(0x789db69a),
+  X(0x78a32868), X(0x78a89787), X(0x78ae03f8), X(0x78b36dbb),
+  X(0x78b8d4d1), X(0x78be393a), X(0x78c39af6), X(0x78c8fa06),
+  X(0x78ce566c), X(0x78d3b026), X(0x78d90736), X(0x78de5b9c),
+  X(0x78e3ad58), X(0x78e8fc6c), X(0x78ee48d7), X(0x78f3929b),
+  X(0x78f8d9b7), X(0x78fe1e2c), X(0x79035ffb), X(0x79089f24),
+  X(0x790ddba8), X(0x79131587), X(0x79184cc2), X(0x791d8159),
+  X(0x7922b34d), X(0x7927e29e), X(0x792d0f4d), X(0x7932395a),
+  X(0x793760c6), X(0x793c8591), X(0x7941a7bd), X(0x7946c749),
+  X(0x794be435), X(0x7950fe84), X(0x79561634), X(0x795b2b47),
+  X(0x79603dbc), X(0x79654d96), X(0x796a5ad4), X(0x796f6576),
+  X(0x79746d7e), X(0x797972eb), X(0x797e75bf), X(0x798375f9),
+  X(0x7988739b), X(0x798d6ea5), X(0x79926717), X(0x79975cf2),
+  X(0x799c5037), X(0x79a140e6), X(0x79a62f00), X(0x79ab1a85),
+  X(0x79b00376), X(0x79b4e9d3), X(0x79b9cd9d), X(0x79beaed4),
+  X(0x79c38d79), X(0x79c8698d), X(0x79cd4310), X(0x79d21a03),
+  X(0x79d6ee66), X(0x79dbc03a), X(0x79e08f7f), X(0x79e55c36),
+  X(0x79ea265f), X(0x79eeedfc), X(0x79f3b30c), X(0x79f87590),
+  X(0x79fd3589), X(0x7a01f2f7), X(0x7a06addc), X(0x7a0b6636),
+  X(0x7a101c08), X(0x7a14cf52), X(0x7a198013), X(0x7a1e2e4d),
+  X(0x7a22da01), X(0x7a27832f), X(0x7a2c29d7), X(0x7a30cdfa),
+  X(0x7a356f99), X(0x7a3a0eb4), X(0x7a3eab4c), X(0x7a434561),
+  X(0x7a47dcf5), X(0x7a4c7207), X(0x7a510498), X(0x7a5594a9),
+  X(0x7a5a223a), X(0x7a5ead4d), X(0x7a6335e0), X(0x7a67bbf6),
+  X(0x7a6c3f8f), X(0x7a70c0ab), X(0x7a753f4b), X(0x7a79bb6f),
+  X(0x7a7e3519), X(0x7a82ac48), X(0x7a8720fe), X(0x7a8b933b),
+  X(0x7a9002ff), X(0x7a94704b), X(0x7a98db20), X(0x7a9d437e),
+  X(0x7aa1a967), X(0x7aa60cd9), X(0x7aaa6dd7), X(0x7aaecc61),
+  X(0x7ab32877), X(0x7ab7821b), X(0x7abbd94b), X(0x7ac02e0a),
+  X(0x7ac48058), X(0x7ac8d035), X(0x7acd1da3), X(0x7ad168a1),
+  X(0x7ad5b130), X(0x7ad9f751), X(0x7ade3b05), X(0x7ae27c4c),
+  X(0x7ae6bb27), X(0x7aeaf796), X(0x7aef319a), X(0x7af36934),
+  X(0x7af79e64), X(0x7afbd12c), X(0x7b00018a), X(0x7b042f81),
+  X(0x7b085b10), X(0x7b0c8439), X(0x7b10aafc), X(0x7b14cf5a),
+  X(0x7b18f153), X(0x7b1d10e8), X(0x7b212e1a), X(0x7b2548e9),
+  X(0x7b296155), X(0x7b2d7761), X(0x7b318b0b), X(0x7b359c55),
+  X(0x7b39ab3f), X(0x7b3db7cb), X(0x7b41c1f8), X(0x7b45c9c8),
+  X(0x7b49cf3b), X(0x7b4dd251), X(0x7b51d30b), X(0x7b55d16b),
+  X(0x7b59cd70), X(0x7b5dc71b), X(0x7b61be6d), X(0x7b65b366),
+  X(0x7b69a608), X(0x7b6d9653), X(0x7b718447), X(0x7b756fe5),
+  X(0x7b79592e), X(0x7b7d4022), X(0x7b8124c3), X(0x7b850710),
+  X(0x7b88e70a), X(0x7b8cc4b3), X(0x7b90a00a), X(0x7b947911),
+  X(0x7b984fc8), X(0x7b9c242f), X(0x7b9ff648), X(0x7ba3c612),
+  X(0x7ba79390), X(0x7bab5ec1), X(0x7baf27a5), X(0x7bb2ee3f),
+  X(0x7bb6b28e), X(0x7bba7493), X(0x7bbe344e), X(0x7bc1f1c1),
+  X(0x7bc5acec), X(0x7bc965cf), X(0x7bcd1c6c), X(0x7bd0d0c3),
+  X(0x7bd482d4), X(0x7bd832a1), X(0x7bdbe02a), X(0x7bdf8b70),
+  X(0x7be33473), X(0x7be6db34), X(0x7bea7fb4), X(0x7bee21f4),
+  X(0x7bf1c1f3), X(0x7bf55fb3), X(0x7bf8fb35), X(0x7bfc9479),
+  X(0x7c002b7f), X(0x7c03c04a), X(0x7c0752d8), X(0x7c0ae32b),
+  X(0x7c0e7144), X(0x7c11fd23), X(0x7c1586c9), X(0x7c190e36),
+  X(0x7c1c936c), X(0x7c20166b), X(0x7c239733), X(0x7c2715c6),
+  X(0x7c2a9224), X(0x7c2e0c4e), X(0x7c318444), X(0x7c34fa07),
+  X(0x7c386d98), X(0x7c3bdef8), X(0x7c3f4e26), X(0x7c42bb25),
+  X(0x7c4625f4), X(0x7c498e95), X(0x7c4cf507), X(0x7c50594c),
+  X(0x7c53bb65), X(0x7c571b51), X(0x7c5a7913), X(0x7c5dd4aa),
+  X(0x7c612e17), X(0x7c64855b), X(0x7c67da76), X(0x7c6b2d6a),
+  X(0x7c6e7e37), X(0x7c71ccdd), X(0x7c75195e), X(0x7c7863ba),
+  X(0x7c7babf1), X(0x7c7ef206), X(0x7c8235f7), X(0x7c8577c6),
+  X(0x7c88b774), X(0x7c8bf502), X(0x7c8f306f), X(0x7c9269bd),
+  X(0x7c95a0ec), X(0x7c98d5fe), X(0x7c9c08f2), X(0x7c9f39cb),
+  X(0x7ca26887), X(0x7ca59528), X(0x7ca8bfb0), X(0x7cabe81d),
+  X(0x7caf0e72), X(0x7cb232af), X(0x7cb554d4), X(0x7cb874e2),
+  X(0x7cbb92db), X(0x7cbeaebe), X(0x7cc1c88d), X(0x7cc4e047),
+  X(0x7cc7f5ef), X(0x7ccb0984), X(0x7cce1b08), X(0x7cd12a7b),
+  X(0x7cd437dd), X(0x7cd74330), X(0x7cda4c74), X(0x7cdd53aa),
+  X(0x7ce058d3), X(0x7ce35bef), X(0x7ce65cff), X(0x7ce95c04),
+  X(0x7cec58ff), X(0x7cef53f0), X(0x7cf24cd7), X(0x7cf543b7),
+  X(0x7cf8388f), X(0x7cfb2b60), X(0x7cfe1c2b), X(0x7d010af1),
+  X(0x7d03f7b2), X(0x7d06e26f), X(0x7d09cb29), X(0x7d0cb1e0),
+  X(0x7d0f9696), X(0x7d12794b), X(0x7d1559ff), X(0x7d1838b4),
+  X(0x7d1b156a), X(0x7d1df022), X(0x7d20c8dd), X(0x7d239f9b),
+  X(0x7d26745e), X(0x7d294725), X(0x7d2c17f1), X(0x7d2ee6c4),
+  X(0x7d31b39f), X(0x7d347e81), X(0x7d37476b), X(0x7d3a0e5f),
+  X(0x7d3cd35d), X(0x7d3f9665), X(0x7d425779), X(0x7d451699),
+  X(0x7d47d3c6), X(0x7d4a8f01), X(0x7d4d484b), X(0x7d4fffa3),
+  X(0x7d52b50c), X(0x7d556885), X(0x7d581a0f), X(0x7d5ac9ac),
+  X(0x7d5d775c), X(0x7d60231f), X(0x7d62ccf6), X(0x7d6574e3),
+  X(0x7d681ae6), X(0x7d6abeff), X(0x7d6d612f), X(0x7d700178),
+  X(0x7d729fd9), X(0x7d753c54), X(0x7d77d6e9), X(0x7d7a6f9a),
+  X(0x7d7d0666), X(0x7d7f9b4f), X(0x7d822e55), X(0x7d84bf79),
+  X(0x7d874ebc), X(0x7d89dc1e), X(0x7d8c67a1), X(0x7d8ef144),
+  X(0x7d91790a), X(0x7d93fef2), X(0x7d9682fd), X(0x7d99052d),
+  X(0x7d9b8581), X(0x7d9e03fb), X(0x7da0809b), X(0x7da2fb62),
+  X(0x7da57451), X(0x7da7eb68), X(0x7daa60a8), X(0x7dacd413),
+  X(0x7daf45a9), X(0x7db1b56a), X(0x7db42357), X(0x7db68f71),
+  X(0x7db8f9b9), X(0x7dbb6230), X(0x7dbdc8d6), X(0x7dc02dac),
+  X(0x7dc290b3), X(0x7dc4f1eb), X(0x7dc75156), X(0x7dc9aef4),
+  X(0x7dcc0ac5), X(0x7dce64cc), X(0x7dd0bd07), X(0x7dd31379),
+  X(0x7dd56821), X(0x7dd7bb01), X(0x7dda0c1a), X(0x7ddc5b6b),
+  X(0x7ddea8f7), X(0x7de0f4bd), X(0x7de33ebe), X(0x7de586fc),
+  X(0x7de7cd76), X(0x7dea122e), X(0x7dec5525), X(0x7dee965a),
+  X(0x7df0d5d0), X(0x7df31386), X(0x7df54f7e), X(0x7df789b8),
+  X(0x7df9c235), X(0x7dfbf8f5), X(0x7dfe2dfa), X(0x7e006145),
+  X(0x7e0292d5), X(0x7e04c2ac), X(0x7e06f0cb), X(0x7e091d32),
+  X(0x7e0b47e1), X(0x7e0d70db), X(0x7e0f981f), X(0x7e11bdaf),
+  X(0x7e13e18a), X(0x7e1603b3), X(0x7e182429), X(0x7e1a42ed),
+  X(0x7e1c6001), X(0x7e1e7b64), X(0x7e209518), X(0x7e22ad1d),
+  X(0x7e24c375), X(0x7e26d81f), X(0x7e28eb1d), X(0x7e2afc70),
+  X(0x7e2d0c17), X(0x7e2f1a15), X(0x7e31266a), X(0x7e333115),
+  X(0x7e353a1a), X(0x7e374177), X(0x7e39472e), X(0x7e3b4b3f),
+  X(0x7e3d4dac), X(0x7e3f4e75), X(0x7e414d9a), X(0x7e434b1e),
+  X(0x7e4546ff), X(0x7e474140), X(0x7e4939e0), X(0x7e4b30e2),
+  X(0x7e4d2644), X(0x7e4f1a09), X(0x7e510c30), X(0x7e52fcbc),
+  X(0x7e54ebab), X(0x7e56d900), X(0x7e58c4bb), X(0x7e5aaedd),
+  X(0x7e5c9766), X(0x7e5e7e57), X(0x7e6063b2), X(0x7e624776),
+  X(0x7e6429a5), X(0x7e660a3f), X(0x7e67e945), X(0x7e69c6b8),
+  X(0x7e6ba299), X(0x7e6d7ce7), X(0x7e6f55a5), X(0x7e712cd3),
+  X(0x7e730272), X(0x7e74d682), X(0x7e76a904), X(0x7e7879f9),
+  X(0x7e7a4962), X(0x7e7c173f), X(0x7e7de392), X(0x7e7fae5a),
+  X(0x7e817799), X(0x7e833f50), X(0x7e85057f), X(0x7e86ca27),
+  X(0x7e888d49), X(0x7e8a4ee5), X(0x7e8c0efd), X(0x7e8dcd91),
+  X(0x7e8f8aa1), X(0x7e914630), X(0x7e93003c), X(0x7e94b8c8),
+  X(0x7e966fd4), X(0x7e982560), X(0x7e99d96e), X(0x7e9b8bfe),
+  X(0x7e9d3d10), X(0x7e9eeca7), X(0x7ea09ac2), X(0x7ea24762),
+  X(0x7ea3f288), X(0x7ea59c35), X(0x7ea7446a), X(0x7ea8eb27),
+  X(0x7eaa906c), X(0x7eac343c), X(0x7eadd696), X(0x7eaf777b),
+  X(0x7eb116ed), X(0x7eb2b4eb), X(0x7eb45177), X(0x7eb5ec91),
+  X(0x7eb7863b), X(0x7eb91e74), X(0x7ebab53e), X(0x7ebc4a99),
+  X(0x7ebdde87), X(0x7ebf7107), X(0x7ec1021b), X(0x7ec291c3),
+  X(0x7ec42001), X(0x7ec5acd5), X(0x7ec7383f), X(0x7ec8c241),
+  X(0x7eca4adb), X(0x7ecbd20d), X(0x7ecd57da), X(0x7ecedc41),
+  X(0x7ed05f44), X(0x7ed1e0e2), X(0x7ed3611d), X(0x7ed4dff6),
+  X(0x7ed65d6d), X(0x7ed7d983), X(0x7ed95438), X(0x7edacd8f),
+  X(0x7edc4586), X(0x7eddbc20), X(0x7edf315c), X(0x7ee0a53c),
+  X(0x7ee217c1), X(0x7ee388ea), X(0x7ee4f8b9), X(0x7ee6672f),
+  X(0x7ee7d44c), X(0x7ee94012), X(0x7eeaaa80), X(0x7eec1397),
+  X(0x7eed7b59), X(0x7eeee1c6), X(0x7ef046df), X(0x7ef1aaa5),
+  X(0x7ef30d18), X(0x7ef46e39), X(0x7ef5ce09), X(0x7ef72c88),
+  X(0x7ef889b8), X(0x7ef9e599), X(0x7efb402c), X(0x7efc9972),
+  X(0x7efdf16b), X(0x7eff4818), X(0x7f009d79), X(0x7f01f191),
+  X(0x7f03445f), X(0x7f0495e4), X(0x7f05e620), X(0x7f073516),
+  X(0x7f0882c5), X(0x7f09cf2d), X(0x7f0b1a51), X(0x7f0c6430),
+  X(0x7f0daccc), X(0x7f0ef425), X(0x7f103a3b), X(0x7f117f11),
+  X(0x7f12c2a5), X(0x7f1404fa), X(0x7f15460f), X(0x7f1685e6),
+  X(0x7f17c47f), X(0x7f1901db), X(0x7f1a3dfb), X(0x7f1b78e0),
+  X(0x7f1cb28a), X(0x7f1deafa), X(0x7f1f2231), X(0x7f20582f),
+  X(0x7f218cf5), X(0x7f22c085), X(0x7f23f2de), X(0x7f252401),
+  X(0x7f2653f0), X(0x7f2782ab), X(0x7f28b032), X(0x7f29dc87),
+  X(0x7f2b07aa), X(0x7f2c319c), X(0x7f2d5a5e), X(0x7f2e81f0),
+  X(0x7f2fa853), X(0x7f30cd88), X(0x7f31f18f), X(0x7f33146a),
+  X(0x7f343619), X(0x7f35569c), X(0x7f3675f6), X(0x7f379425),
+  X(0x7f38b12c), X(0x7f39cd0a), X(0x7f3ae7c0), X(0x7f3c0150),
+  X(0x7f3d19ba), X(0x7f3e30fe), X(0x7f3f471e), X(0x7f405c1a),
+  X(0x7f416ff3), X(0x7f4282a9), X(0x7f43943e), X(0x7f44a4b2),
+  X(0x7f45b405), X(0x7f46c239), X(0x7f47cf4e), X(0x7f48db45),
+  X(0x7f49e61f), X(0x7f4aefdc), X(0x7f4bf87e), X(0x7f4d0004),
+  X(0x7f4e0670), X(0x7f4f0bc2), X(0x7f500ffb), X(0x7f51131c),
+  X(0x7f521525), X(0x7f531618), X(0x7f5415f4), X(0x7f5514bb),
+  X(0x7f56126e), X(0x7f570f0c), X(0x7f580a98), X(0x7f590511),
+  X(0x7f59fe78), X(0x7f5af6ce), X(0x7f5bee14), X(0x7f5ce44a),
+  X(0x7f5dd972), X(0x7f5ecd8b), X(0x7f5fc097), X(0x7f60b296),
+  X(0x7f61a389), X(0x7f629370), X(0x7f63824e), X(0x7f647021),
+  X(0x7f655ceb), X(0x7f6648ad), X(0x7f673367), X(0x7f681d19),
+  X(0x7f6905c6), X(0x7f69ed6d), X(0x7f6ad40f), X(0x7f6bb9ad),
+  X(0x7f6c9e48), X(0x7f6d81e0), X(0x7f6e6475), X(0x7f6f460a),
+  X(0x7f70269d), X(0x7f710631), X(0x7f71e4c6), X(0x7f72c25c),
+  X(0x7f739ef4), X(0x7f747a8f), X(0x7f75552e), X(0x7f762ed1),
+  X(0x7f770779), X(0x7f77df27), X(0x7f78b5db), X(0x7f798b97),
+  X(0x7f7a605a), X(0x7f7b3425), X(0x7f7c06fa), X(0x7f7cd8d9),
+  X(0x7f7da9c2), X(0x7f7e79b7), X(0x7f7f48b8), X(0x7f8016c5),
+  X(0x7f80e3e0), X(0x7f81b009), X(0x7f827b40), X(0x7f834588),
+  X(0x7f840edf), X(0x7f84d747), X(0x7f859ec1), X(0x7f86654d),
+  X(0x7f872aec), X(0x7f87ef9e), X(0x7f88b365), X(0x7f897641),
+  X(0x7f8a3832), X(0x7f8af93a), X(0x7f8bb959), X(0x7f8c7890),
+  X(0x7f8d36df), X(0x7f8df448), X(0x7f8eb0ca), X(0x7f8f6c67),
+  X(0x7f90271e), X(0x7f90e0f2), X(0x7f9199e2), X(0x7f9251f0),
+  X(0x7f93091b), X(0x7f93bf65), X(0x7f9474ce), X(0x7f952958),
+  X(0x7f95dd01), X(0x7f968fcd), X(0x7f9741ba), X(0x7f97f2ca),
+  X(0x7f98a2fd), X(0x7f995254), X(0x7f9a00d0), X(0x7f9aae71),
+  X(0x7f9b5b38), X(0x7f9c0726), X(0x7f9cb23b), X(0x7f9d5c78),
+  X(0x7f9e05de), X(0x7f9eae6e), X(0x7f9f5627), X(0x7f9ffd0b),
+  X(0x7fa0a31b), X(0x7fa14856), X(0x7fa1ecbf), X(0x7fa29054),
+  X(0x7fa33318), X(0x7fa3d50b), X(0x7fa4762c), X(0x7fa5167e),
+  X(0x7fa5b601), X(0x7fa654b5), X(0x7fa6f29b), X(0x7fa78fb3),
+  X(0x7fa82bff), X(0x7fa8c77f), X(0x7fa96234), X(0x7fa9fc1e),
+  X(0x7faa953e), X(0x7fab2d94), X(0x7fabc522), X(0x7fac5be8),
+  X(0x7facf1e6), X(0x7fad871d), X(0x7fae1b8f), X(0x7faeaf3b),
+  X(0x7faf4222), X(0x7fafd445), X(0x7fb065a4), X(0x7fb0f641),
+  X(0x7fb1861b), X(0x7fb21534), X(0x7fb2a38c), X(0x7fb33124),
+  X(0x7fb3bdfb), X(0x7fb44a14), X(0x7fb4d56f), X(0x7fb5600c),
+  X(0x7fb5e9ec), X(0x7fb6730f), X(0x7fb6fb76), X(0x7fb78323),
+  X(0x7fb80a15), X(0x7fb8904d), X(0x7fb915cc), X(0x7fb99a92),
+  X(0x7fba1ea0), X(0x7fbaa1f7), X(0x7fbb2497), X(0x7fbba681),
+  X(0x7fbc27b5), X(0x7fbca835), X(0x7fbd2801), X(0x7fbda719),
+  X(0x7fbe257e), X(0x7fbea331), X(0x7fbf2032), X(0x7fbf9c82),
+  X(0x7fc01821), X(0x7fc09311), X(0x7fc10d52), X(0x7fc186e4),
+  X(0x7fc1ffc8), X(0x7fc277ff), X(0x7fc2ef89), X(0x7fc36667),
+  X(0x7fc3dc9a), X(0x7fc45221), X(0x7fc4c6ff), X(0x7fc53b33),
+  X(0x7fc5aebe), X(0x7fc621a0), X(0x7fc693db), X(0x7fc7056f),
+  X(0x7fc7765c), X(0x7fc7e6a3), X(0x7fc85645), X(0x7fc8c542),
+  X(0x7fc9339b), X(0x7fc9a150), X(0x7fca0e63), X(0x7fca7ad3),
+  X(0x7fcae6a2), X(0x7fcb51cf), X(0x7fcbbc5c), X(0x7fcc2649),
+  X(0x7fcc8f97), X(0x7fccf846), X(0x7fcd6058), X(0x7fcdc7cb),
+  X(0x7fce2ea2), X(0x7fce94dd), X(0x7fcefa7b), X(0x7fcf5f7f),
+  X(0x7fcfc3e8), X(0x7fd027b7), X(0x7fd08aed), X(0x7fd0ed8b),
+  X(0x7fd14f90), X(0x7fd1b0fd), X(0x7fd211d4), X(0x7fd27214),
+  X(0x7fd2d1bf), X(0x7fd330d4), X(0x7fd38f55), X(0x7fd3ed41),
+  X(0x7fd44a9a), X(0x7fd4a761), X(0x7fd50395), X(0x7fd55f37),
+  X(0x7fd5ba48), X(0x7fd614c9), X(0x7fd66eba), X(0x7fd6c81b),
+  X(0x7fd720ed), X(0x7fd77932), X(0x7fd7d0e8), X(0x7fd82812),
+  X(0x7fd87eae), X(0x7fd8d4bf), X(0x7fd92a45), X(0x7fd97f40),
+  X(0x7fd9d3b0), X(0x7fda2797), X(0x7fda7af5), X(0x7fdacdca),
+  X(0x7fdb2018), X(0x7fdb71dd), X(0x7fdbc31c), X(0x7fdc13d5),
+  X(0x7fdc6408), X(0x7fdcb3b6), X(0x7fdd02df), X(0x7fdd5184),
+  X(0x7fdd9fa5), X(0x7fdded44), X(0x7fde3a60), X(0x7fde86fb),
+  X(0x7fded314), X(0x7fdf1eac), X(0x7fdf69c4), X(0x7fdfb45d),
+  X(0x7fdffe76), X(0x7fe04811), X(0x7fe0912e), X(0x7fe0d9ce),
+  X(0x7fe121f0), X(0x7fe16996), X(0x7fe1b0c1), X(0x7fe1f770),
+  X(0x7fe23da4), X(0x7fe2835f), X(0x7fe2c89f), X(0x7fe30d67),
+  X(0x7fe351b5), X(0x7fe3958c), X(0x7fe3d8ec), X(0x7fe41bd4),
+  X(0x7fe45e46), X(0x7fe4a042), X(0x7fe4e1c8), X(0x7fe522da),
+  X(0x7fe56378), X(0x7fe5a3a1), X(0x7fe5e358), X(0x7fe6229b),
+  X(0x7fe6616d), X(0x7fe69fcc), X(0x7fe6ddbb), X(0x7fe71b39),
+  X(0x7fe75847), X(0x7fe794e5), X(0x7fe7d114), X(0x7fe80cd5),
+  X(0x7fe84827), X(0x7fe8830c), X(0x7fe8bd84), X(0x7fe8f78f),
+  X(0x7fe9312f), X(0x7fe96a62), X(0x7fe9a32b), X(0x7fe9db8a),
+  X(0x7fea137e), X(0x7fea4b09), X(0x7fea822b), X(0x7feab8e5),
+  X(0x7feaef37), X(0x7feb2521), X(0x7feb5aa4), X(0x7feb8fc1),
+  X(0x7febc478), X(0x7febf8ca), X(0x7fec2cb6), X(0x7fec603e),
+  X(0x7fec9363), X(0x7fecc623), X(0x7fecf881), X(0x7fed2a7c),
+  X(0x7fed5c16), X(0x7fed8d4e), X(0x7fedbe24), X(0x7fedee9b),
+  X(0x7fee1eb1), X(0x7fee4e68), X(0x7fee7dc0), X(0x7feeacb9),
+  X(0x7feedb54), X(0x7fef0991), X(0x7fef3771), X(0x7fef64f5),
+  X(0x7fef921d), X(0x7fefbee8), X(0x7fefeb59), X(0x7ff0176f),
+  X(0x7ff0432a), X(0x7ff06e8c), X(0x7ff09995), X(0x7ff0c444),
+  X(0x7ff0ee9c), X(0x7ff1189b), X(0x7ff14243), X(0x7ff16b94),
+  X(0x7ff1948e), X(0x7ff1bd32), X(0x7ff1e581), X(0x7ff20d7b),
+  X(0x7ff2351f), X(0x7ff25c70), X(0x7ff2836d), X(0x7ff2aa17),
+  X(0x7ff2d06d), X(0x7ff2f672), X(0x7ff31c24), X(0x7ff34185),
+  X(0x7ff36695), X(0x7ff38b55), X(0x7ff3afc4), X(0x7ff3d3e4),
+  X(0x7ff3f7b4), X(0x7ff41b35), X(0x7ff43e69), X(0x7ff4614e),
+  X(0x7ff483e6), X(0x7ff4a631), X(0x7ff4c82f), X(0x7ff4e9e1),
+  X(0x7ff50b47), X(0x7ff52c62), X(0x7ff54d33), X(0x7ff56db9),
+  X(0x7ff58df5), X(0x7ff5ade7), X(0x7ff5cd90), X(0x7ff5ecf1),
+  X(0x7ff60c09), X(0x7ff62ada), X(0x7ff64963), X(0x7ff667a5),
+  X(0x7ff685a1), X(0x7ff6a357), X(0x7ff6c0c7), X(0x7ff6ddf1),
+  X(0x7ff6fad7), X(0x7ff71778), X(0x7ff733d6), X(0x7ff74fef),
+  X(0x7ff76bc6), X(0x7ff78759), X(0x7ff7a2ab), X(0x7ff7bdba),
+  X(0x7ff7d888), X(0x7ff7f315), X(0x7ff80d61), X(0x7ff8276c),
+  X(0x7ff84138), X(0x7ff85ac4), X(0x7ff87412), X(0x7ff88d20),
+  X(0x7ff8a5f0), X(0x7ff8be82), X(0x7ff8d6d7), X(0x7ff8eeef),
+  X(0x7ff906c9), X(0x7ff91e68), X(0x7ff935cb), X(0x7ff94cf2),
+  X(0x7ff963dd), X(0x7ff97a8f), X(0x7ff99105), X(0x7ff9a742),
+  X(0x7ff9bd45), X(0x7ff9d30f), X(0x7ff9e8a0), X(0x7ff9fdf9),
+  X(0x7ffa131a), X(0x7ffa2803), X(0x7ffa3cb4), X(0x7ffa512f),
+  X(0x7ffa6573), X(0x7ffa7981), X(0x7ffa8d59), X(0x7ffaa0fc),
+  X(0x7ffab46a), X(0x7ffac7a3), X(0x7ffadaa8), X(0x7ffaed78),
+  X(0x7ffb0015), X(0x7ffb127f), X(0x7ffb24b6), X(0x7ffb36bb),
+  X(0x7ffb488d), X(0x7ffb5a2e), X(0x7ffb6b9d), X(0x7ffb7cdb),
+  X(0x7ffb8de9), X(0x7ffb9ec6), X(0x7ffbaf73), X(0x7ffbbff1),
+  X(0x7ffbd03f), X(0x7ffbe05e), X(0x7ffbf04f), X(0x7ffc0012),
+  X(0x7ffc0fa6), X(0x7ffc1f0d), X(0x7ffc2e47), X(0x7ffc3d54),
+  X(0x7ffc4c35), X(0x7ffc5ae9), X(0x7ffc6971), X(0x7ffc77ce),
+  X(0x7ffc8600), X(0x7ffc9407), X(0x7ffca1e4), X(0x7ffcaf96),
+  X(0x7ffcbd1f), X(0x7ffcca7e), X(0x7ffcd7b4), X(0x7ffce4c1),
+  X(0x7ffcf1a5), X(0x7ffcfe62), X(0x7ffd0af6), X(0x7ffd1763),
+  X(0x7ffd23a9), X(0x7ffd2fc8), X(0x7ffd3bc1), X(0x7ffd4793),
+  X(0x7ffd533f), X(0x7ffd5ec5), X(0x7ffd6a27), X(0x7ffd7563),
+  X(0x7ffd807a), X(0x7ffd8b6e), X(0x7ffd963d), X(0x7ffda0e8),
+  X(0x7ffdab70), X(0x7ffdb5d5), X(0x7ffdc017), X(0x7ffdca36),
+  X(0x7ffdd434), X(0x7ffdde0f), X(0x7ffde7c9), X(0x7ffdf161),
+  X(0x7ffdfad8), X(0x7ffe042f), X(0x7ffe0d65), X(0x7ffe167b),
+  X(0x7ffe1f71), X(0x7ffe2848), X(0x7ffe30ff), X(0x7ffe3997),
+  X(0x7ffe4211), X(0x7ffe4a6c), X(0x7ffe52a9), X(0x7ffe5ac8),
+  X(0x7ffe62c9), X(0x7ffe6aae), X(0x7ffe7275), X(0x7ffe7a1f),
+  X(0x7ffe81ad), X(0x7ffe891f), X(0x7ffe9075), X(0x7ffe97b0),
+  X(0x7ffe9ece), X(0x7ffea5d2), X(0x7ffeacbb), X(0x7ffeb38a),
+  X(0x7ffeba3e), X(0x7ffec0d8), X(0x7ffec758), X(0x7ffecdbf),
+  X(0x7ffed40d), X(0x7ffeda41), X(0x7ffee05d), X(0x7ffee660),
+  X(0x7ffeec4b), X(0x7ffef21f), X(0x7ffef7da), X(0x7ffefd7e),
+  X(0x7fff030b), X(0x7fff0881), X(0x7fff0de0), X(0x7fff1328),
+  X(0x7fff185b), X(0x7fff1d77), X(0x7fff227e), X(0x7fff276f),
+  X(0x7fff2c4b), X(0x7fff3112), X(0x7fff35c4), X(0x7fff3a62),
+  X(0x7fff3eeb), X(0x7fff4360), X(0x7fff47c2), X(0x7fff4c0f),
+  X(0x7fff504a), X(0x7fff5471), X(0x7fff5885), X(0x7fff5c87),
+  X(0x7fff6076), X(0x7fff6452), X(0x7fff681d), X(0x7fff6bd6),
+  X(0x7fff6f7d), X(0x7fff7313), X(0x7fff7698), X(0x7fff7a0c),
+  X(0x7fff7d6f), X(0x7fff80c2), X(0x7fff8404), X(0x7fff8736),
+  X(0x7fff8a58), X(0x7fff8d6b), X(0x7fff906e), X(0x7fff9362),
+  X(0x7fff9646), X(0x7fff991c), X(0x7fff9be3), X(0x7fff9e9c),
+  X(0x7fffa146), X(0x7fffa3e2), X(0x7fffa671), X(0x7fffa8f1),
+  X(0x7fffab65), X(0x7fffadca), X(0x7fffb023), X(0x7fffb26f),
+  X(0x7fffb4ae), X(0x7fffb6e0), X(0x7fffb906), X(0x7fffbb20),
+  X(0x7fffbd2e), X(0x7fffbf30), X(0x7fffc126), X(0x7fffc311),
+  X(0x7fffc4f1), X(0x7fffc6c5), X(0x7fffc88f), X(0x7fffca4d),
+  X(0x7fffcc01), X(0x7fffcdab), X(0x7fffcf4a), X(0x7fffd0e0),
+  X(0x7fffd26b), X(0x7fffd3ec), X(0x7fffd564), X(0x7fffd6d2),
+  X(0x7fffd838), X(0x7fffd993), X(0x7fffdae6), X(0x7fffdc31),
+  X(0x7fffdd72), X(0x7fffdeab), X(0x7fffdfdb), X(0x7fffe104),
+  X(0x7fffe224), X(0x7fffe33c), X(0x7fffe44d), X(0x7fffe556),
+  X(0x7fffe657), X(0x7fffe751), X(0x7fffe844), X(0x7fffe930),
+  X(0x7fffea15), X(0x7fffeaf3), X(0x7fffebca), X(0x7fffec9b),
+  X(0x7fffed66), X(0x7fffee2a), X(0x7fffeee8), X(0x7fffefa0),
+  X(0x7ffff053), X(0x7ffff0ff), X(0x7ffff1a6), X(0x7ffff247),
+  X(0x7ffff2e4), X(0x7ffff37a), X(0x7ffff40c), X(0x7ffff499),
+  X(0x7ffff520), X(0x7ffff5a3), X(0x7ffff621), X(0x7ffff69b),
+  X(0x7ffff710), X(0x7ffff781), X(0x7ffff7ee), X(0x7ffff857),
+  X(0x7ffff8bb), X(0x7ffff91c), X(0x7ffff979), X(0x7ffff9d2),
+  X(0x7ffffa27), X(0x7ffffa79), X(0x7ffffac8), X(0x7ffffb13),
+  X(0x7ffffb5b), X(0x7ffffba0), X(0x7ffffbe2), X(0x7ffffc21),
+  X(0x7ffffc5d), X(0x7ffffc96), X(0x7ffffccd), X(0x7ffffd01),
+  X(0x7ffffd32), X(0x7ffffd61), X(0x7ffffd8e), X(0x7ffffdb8),
+  X(0x7ffffde0), X(0x7ffffe07), X(0x7ffffe2b), X(0x7ffffe4d),
+  X(0x7ffffe6d), X(0x7ffffe8b), X(0x7ffffea8), X(0x7ffffec3),
+  X(0x7ffffedc), X(0x7ffffef4), X(0x7fffff0a), X(0x7fffff1f),
+  X(0x7fffff33), X(0x7fffff45), X(0x7fffff56), X(0x7fffff66),
+  X(0x7fffff75), X(0x7fffff82), X(0x7fffff8f), X(0x7fffff9a),
+  X(0x7fffffa5), X(0x7fffffaf), X(0x7fffffb8), X(0x7fffffc0),
+  X(0x7fffffc8), X(0x7fffffce), X(0x7fffffd5), X(0x7fffffda),
+  X(0x7fffffdf), X(0x7fffffe4), X(0x7fffffe8), X(0x7fffffeb),
+  X(0x7fffffef), X(0x7ffffff1), X(0x7ffffff4), X(0x7ffffff6),
+  X(0x7ffffff8), X(0x7ffffff9), X(0x7ffffffb), X(0x7ffffffc),
+  X(0x7ffffffd), X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff),
+  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
+  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
+  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
+};
+
--- a/misc/libtremor/vorbisfile.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1586 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.6 2003/03/30 23:40:56 xiphmont Exp $
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <math.h>
-
-#include "ivorbiscodec.h"
-#include "ivorbisfile.h"
-
-#include "misc.h"
-
-/* A 'chained bitstream' is a Vorbis bitstream that contains more than
-   one logical bitstream arranged end to end (the only form of Ogg
-   multiplexing allowed in a Vorbis bitstream; grouping [parallel
-   multiplexing] is not allowed in Vorbis) */
-
-/* A Vorbis file can be played beginning to end (streamed) without
-   worrying ahead of time about chaining (see decoder_example.c).  If
-   we have the whole file, however, and want random access
-   (seeking/scrubbing) or desire to know the total length/time of a
-   file, we need to account for the possibility of chaining. */
-
-/* We can handle things a number of ways; we can determine the entire
-   bitstream structure right off the bat, or find pieces on demand.
-   This example determines and caches structure for the entire
-   bitstream, but builds a virtual decoder on the fly when moving
-   between links in the chain. */
-
-/* There are also different ways to implement seeking.  Enough
-   information exists in an Ogg bitstream to seek to
-   sample-granularity positions in the output.  Or, one can seek by
-   picking some portion of the stream roughly in the desired area if
-   we only want coarse navigation through the stream. */
-
-/*************************************************************************
- * Many, many internal helpers.  The intention is not to be confusing; 
- * rampant duplication and monolithic function implementation would be 
- * harder to understand anyway.  The high level functions are last.  Begin
- * grokking near the end of the file */
-
-
-/* read a little more data from the file/pipe into the ogg_sync framer */
-static long _get_data(OggVorbis_File *vf){
-  errno=0;
-  if(vf->datasource){
-    unsigned char *buffer=ogg_sync_bufferin(vf->oy,CHUNKSIZE);
-    long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
-    if(bytes>0)ogg_sync_wrote(vf->oy,bytes);
-    if(bytes==0 && errno)return(-1);
-    return(bytes);
-  }else
-    return(0);
-}
-
-/* save a tiny smidge of verbosity to make the code more readable */
-static void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){
-  if(vf->datasource){ 
-    (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET);
-    vf->offset=offset;
-    ogg_sync_reset(vf->oy);
-  }else{
-    /* shouldn't happen unless someone writes a broken callback */
-    return;
-  }
-}
-
-/* The read/seek functions track absolute position within the stream */
-
-/* from the head of the stream, get the next page.  boundary specifies
-   if the function is allowed to fetch more data from the stream (and
-   how much) or only use internally buffered data.
-
-   boundary: -1) unbounded search
-              0) read no additional data; use cached only
-	      n) search for a new page beginning for n bytes
-
-   return:   <0) did not find a page (OV_FALSE, OV_EOF, OV_EREAD)
-              n) found a page at absolute offset n 
-
-              produces a refcounted page */
-
-static ogg_int64_t _get_next_page(OggVorbis_File *vf,ogg_page *og,
-				  ogg_int64_t boundary){
-  if(boundary>0)boundary+=vf->offset;
-  while(1){
-    long more;
-
-    if(boundary>0 && vf->offset>=boundary)return(OV_FALSE);
-    more=ogg_sync_pageseek(vf->oy,og);
-    
-    if(more<0){
-      /* skipped n bytes */
-      vf->offset-=more;
-    }else{
-      if(more==0){
-	/* send more paramedics */
-	if(!boundary)return(OV_FALSE);
-	{
-	  long ret=_get_data(vf);
-	  if(ret==0)return(OV_EOF);
-	  if(ret<0)return(OV_EREAD);
-	}
-      }else{
-	/* got a page.  Return the offset at the page beginning,
-           advance the internal offset past the page end */
-	ogg_int64_t ret=vf->offset;
-	vf->offset+=more;
-	return(ret);
-	
-      }
-    }
-  }
-}
-
-/* find the latest page beginning before the current stream cursor
-   position. Much dirtier than the above as Ogg doesn't have any
-   backward search linkage.  no 'readp' as it will certainly have to
-   read. */
-/* returns offset or OV_EREAD, OV_FAULT and produces a refcounted page */
-
-static ogg_int64_t _get_prev_page(OggVorbis_File *vf,ogg_page *og){
-  ogg_int64_t begin=vf->offset;
-  ogg_int64_t end=begin;
-  ogg_int64_t ret;
-  ogg_int64_t offset=-1;
-
-  while(offset==-1){
-    begin-=CHUNKSIZE;
-    if(begin<0)
-      begin=0;
-    _seek_helper(vf,begin);
-    while(vf->offset<end){
-      ret=_get_next_page(vf,og,end-vf->offset);
-      if(ret==OV_EREAD)return(OV_EREAD);
-      if(ret<0){
-	break;
-      }else{
-	offset=ret;
-      }
-    }
-  }
-
-  /* we have the offset.  Actually snork and hold the page now */
-  _seek_helper(vf,offset);
-  ret=_get_next_page(vf,og,CHUNKSIZE);
-  if(ret<0)
-    /* this shouldn't be possible */
-    return(OV_EFAULT);
-
-  return(offset);
-}
-
-/* finds each bitstream link one at a time using a bisection search
-   (has to begin by knowing the offset of the lb's initial page).
-   Recurses for each link so it can alloc the link storage after
-   finding them all, then unroll and fill the cache at the same time */
-static int _bisect_forward_serialno(OggVorbis_File *vf,
-				    ogg_int64_t begin,
-				    ogg_int64_t searched,
-				    ogg_int64_t end,
-				    ogg_uint32_t currentno,
-				    long m){
-  ogg_int64_t endsearched=end;
-  ogg_int64_t next=end;
-  ogg_page og={0,0,0,0};
-  ogg_int64_t ret;
-  
-  /* the below guards against garbage seperating the last and
-     first pages of two links. */
-  while(searched<endsearched){
-    ogg_int64_t bisect;
-    
-    if(endsearched-searched<CHUNKSIZE){
-      bisect=searched;
-    }else{
-      bisect=(searched+endsearched)/2;
-    }
-    
-    _seek_helper(vf,bisect);
-    ret=_get_next_page(vf,&og,-1);
-    if(ret==OV_EREAD)return(OV_EREAD);
-    if(ret<0 || ogg_page_serialno(&og)!=currentno){
-      endsearched=bisect;
-      if(ret>=0)next=ret;
-    }else{
-      searched=ret+og.header_len+og.body_len;
-    }
-    ogg_page_release(&og);
-  }
-
-  _seek_helper(vf,next);
-  ret=_get_next_page(vf,&og,-1);
-  if(ret==OV_EREAD)return(OV_EREAD);
-  
-  if(searched>=end || ret<0){
-    ogg_page_release(&og);
-    vf->links=m+1;
-    vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets));
-    vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));
-    vf->offsets[m+1]=searched;
-  }else{
-    ret=_bisect_forward_serialno(vf,next,vf->offset,
-				 end,ogg_page_serialno(&og),m+1);
-    ogg_page_release(&og);
-    if(ret==OV_EREAD)return(OV_EREAD);
-  }
-  
-  vf->offsets[m]=begin;
-  vf->serialnos[m]=currentno;
-  return(0);
-}
-
-/* uses the local ogg_stream storage in vf; this is important for
-   non-streaming input sources */
-/* consumes the page that's passed in (if any) */
-
-static int _fetch_headers(OggVorbis_File *vf,
-			  vorbis_info *vi,
-			  vorbis_comment *vc,
-			  ogg_uint32_t *serialno,
-			  ogg_page *og_ptr){
-  ogg_page og={0,0,0,0};
-  ogg_packet op={0,0,0,0,0,0};
-  int i,ret;
-  
-  if(!og_ptr){
-    ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE);
-    if(llret==OV_EREAD)return(OV_EREAD);
-    if(llret<0)return OV_ENOTVORBIS;
-    og_ptr=&og;
-  }
-
-  ogg_stream_reset_serialno(vf->os,ogg_page_serialno(og_ptr));
-  if(serialno)*serialno=vf->os->serialno;
-  vf->ready_state=STREAMSET;
-  
-  /* extract the initial header from the first page and verify that the
-     Ogg bitstream is in fact Vorbis data */
-  
-  vorbis_info_init(vi);
-  vorbis_comment_init(vc);
-  
-  i=0;
-  while(i<3){
-    ogg_stream_pagein(vf->os,og_ptr);
-    while(i<3){
-      int result=ogg_stream_packetout(vf->os,&op);
-      if(result==0)break;
-      if(result==-1){
-	ret=OV_EBADHEADER;
-	goto bail_header;
-      }
-      if((ret=vorbis_synthesis_headerin(vi,vc,&op))){
-	goto bail_header;
-      }
-      i++;
-    }
-    if(i<3)
-      if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){
-	ret=OV_EBADHEADER;
-	goto bail_header;
-      }
-  }
-
-  ogg_packet_release(&op);
-  ogg_page_release(&og);
-  return 0; 
-
- bail_header:
-  ogg_packet_release(&op);
-  ogg_page_release(&og);
-  vorbis_info_clear(vi);
-  vorbis_comment_clear(vc);
-  vf->ready_state=OPENED;
-
-  return ret;
-}
-
-/* last step of the OggVorbis_File initialization; get all the
-   vorbis_info structs and PCM positions.  Only called by the seekable
-   initialization (local stream storage is hacked slightly; pay
-   attention to how that's done) */
-
-/* this is void and does not propogate errors up because we want to be
-   able to open and use damaged bitstreams as well as we can.  Just
-   watch out for missing information for links in the OggVorbis_File
-   struct */
-static void _prefetch_all_headers(OggVorbis_File *vf, ogg_int64_t dataoffset){
-  ogg_page og={0,0,0,0};
-  int i;
-  ogg_int64_t ret;
-  
-  vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi));
-  vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc));
-  vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets));
-  vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths));
-  
-  for(i=0;i<vf->links;i++){
-    if(i==0){
-      /* we already grabbed the initial header earlier.  Just set the offset */
-      vf->dataoffsets[i]=dataoffset;
-      _seek_helper(vf,dataoffset);
-
-    }else{
-
-      /* seek to the location of the initial header */
-
-      _seek_helper(vf,vf->offsets[i]);
-      if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){
-    	vf->dataoffsets[i]=-1;
-      }else{
-	vf->dataoffsets[i]=vf->offset;
-      }
-    }
-
-    /* fetch beginning PCM offset */
-
-    if(vf->dataoffsets[i]!=-1){
-      ogg_int64_t accumulated=0,pos;
-      long        lastblock=-1;
-      int         result;
-
-      ogg_stream_reset_serialno(vf->os,vf->serialnos[i]);
-
-      while(1){
-	ogg_packet op={0,0,0,0,0,0};
-
-	ret=_get_next_page(vf,&og,-1);
-	if(ret<0)
-	  /* this should not be possible unless the file is
-             truncated/mangled */
-	  break;
-       
-	if(ogg_page_serialno(&og)!=vf->serialnos[i])
-	  break;
-	
-	pos=ogg_page_granulepos(&og);
-
-	/* count blocksizes of all frames in the page */
-	ogg_stream_pagein(vf->os,&og);
-	while((result=ogg_stream_packetout(vf->os,&op))){
-	  if(result>0){ /* ignore holes */
-	    long thisblock=vorbis_packet_blocksize(vf->vi+i,&op);
-	    if(lastblock!=-1)
-	      accumulated+=(lastblock+thisblock)>>2;
-	    lastblock=thisblock;
-	  }
-	}
-	ogg_packet_release(&op);
-
-	if(pos!=-1){
-	  /* pcm offset of last packet on the first audio page */
-	  accumulated= pos-accumulated;
-	  break;
-	}
-      }
-
-      /* less than zero?  This is a stream with samples trimmed off
-         the beginning, a normal occurrence; set the offset to zero */
-      if(accumulated<0)accumulated=0;
-
-      vf->pcmlengths[i*2]=accumulated;
-    }
-
-    /* get the PCM length of this link. To do this,
-       get the last page of the stream */
-    {
-      ogg_int64_t end=vf->offsets[i+1];
-      _seek_helper(vf,end);
-
-      while(1){
-	ret=_get_prev_page(vf,&og);
-	if(ret<0){
-	  /* this should not be possible */
-	  vorbis_info_clear(vf->vi+i);
-	  vorbis_comment_clear(vf->vc+i);
-	  break;
-	}
-	if(ogg_page_granulepos(&og)!=-1){
-	  vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2];
-	  break;
-	}
-	vf->offset=ret;
-      }
-    }
-  }
-  ogg_page_release(&og);
-}
-
-static void _make_decode_ready(OggVorbis_File *vf){
-  if(vf->ready_state!=STREAMSET)return;
-  if(vf->seekable){
-    vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link);
-  }else{
-    vorbis_synthesis_init(&vf->vd,vf->vi);
-  }    
-  vorbis_block_init(&vf->vd,&vf->vb);
-  vf->ready_state=INITSET;
-  vf->bittrack=0;
-  vf->samptrack=0;
-  return;
-}
-
-static int _open_seekable2(OggVorbis_File *vf){
-  ogg_uint32_t serialno=vf->current_serialno;
-  ogg_uint32_t tempserialno;
-  ogg_int64_t dataoffset=vf->offset, end;
-  ogg_page og={0,0,0,0};
-
-  /* we're partially open and have a first link header state in
-     storage in vf */
-  /* we can seek, so set out learning all about this file */
-  (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
-  vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
-  
-  /* We get the offset for the last page of the physical bitstream.
-     Most OggVorbis files will contain a single logical bitstream */
-  end=_get_prev_page(vf,&og);
-  if(end<0)return(end);
-
-  /* more than one logical bitstream? */
-  tempserialno=ogg_page_serialno(&og);
-  ogg_page_release(&og);
-
-  if(tempserialno!=serialno){
-
-    /* Chained bitstream. Bisect-search each logical bitstream
-       section.  Do so based on serial number only */
-    if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0)return(OV_EREAD);
-
-  }else{
-
-    /* Only one logical bitstream */
-    if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0))return(OV_EREAD);
-
-  }
-
-  /* the initial header memory is referenced by vf after; don't free it */
-  _prefetch_all_headers(vf,dataoffset);
-  return(ov_raw_seek(vf,0));
-}
-
-/* clear out the current logical bitstream decoder */ 
-static void _decode_clear(OggVorbis_File *vf){
-  vorbis_dsp_clear(&vf->vd);
-  vorbis_block_clear(&vf->vb);
-  vf->ready_state=OPENED;
-}
-
-/* fetch and process a packet.  Handles the case where we're at a
-   bitstream boundary and dumps the decoding machine.  If the decoding
-   machine is unloaded, it loads it.  It also keeps pcm_offset up to
-   date (seek and read both use this.  seek uses a special hack with
-   readp). 
-
-   return: <0) error, OV_HOLE (lost packet) or OV_EOF
-            0) need more data (only if readp==0)
-	    1) got a packet 
-*/
-
-static int _fetch_and_process_packet(OggVorbis_File *vf,
-				     int readp,
-				     int spanp){
-  ogg_page og={0,0,0,0};
-  ogg_packet op={0,0,0,0,0,0};
-  int ret=0;
-
-  /* handle one packet.  Try to fetch it from current stream state */
-  /* extract packets from page */
-  while(1){
-    
-    /* process a packet if we can.  If the machine isn't loaded,
-       neither is a page */
-    if(vf->ready_state==INITSET){
-      while(1) {
-	int result=ogg_stream_packetout(vf->os,&op);
-	ogg_int64_t granulepos;
-
-	if(result<0){
-	  ret=OV_HOLE; /* hole in the data. */
-	  goto cleanup;
-	}
-	if(result>0){
-	  /* got a packet.  process it */
-	  granulepos=op.granulepos;
-	  if(!vorbis_synthesis(&vf->vb,&op,1)){ /* lazy check for lazy
-						      header handling.  The
-						      header packets aren't
-						      audio, so if/when we
-						      submit them,
-						      vorbis_synthesis will
-						      reject them */
-
-	    /* suck in the synthesis data and track bitrate */
-	    {
-	      int oldsamples=vorbis_synthesis_pcmout(&vf->vd,NULL);
-	      /* for proper use of libvorbis within libvorbisfile,
-                 oldsamples will always be zero. */
-	      if(oldsamples){
-		ret=OV_EFAULT;
-		goto cleanup;
-	      }
-
-	      vorbis_synthesis_blockin(&vf->vd,&vf->vb);
-	      vf->samptrack+=vorbis_synthesis_pcmout(&vf->vd,NULL)-oldsamples;
-	      vf->bittrack+=op.bytes*8;
-	    }
-	  
-	    /* update the pcm offset. */
-	    if(granulepos!=-1 && !op.e_o_s){
-	      int link=(vf->seekable?vf->current_link:0);
-	      int i,samples;
-	    
-	      /* this packet has a pcm_offset on it (the last packet
-	         completed on a page carries the offset) After processing
-	         (above), we know the pcm position of the *last* sample
-	         ready to be returned. Find the offset of the *first*
-
-	         As an aside, this trick is inaccurate if we begin
-	         reading anew right at the last page; the end-of-stream
-	         granulepos declares the last frame in the stream, and the
-	         last packet of the last page may be a partial frame.
-	         So, we need a previous granulepos from an in-sequence page
-	         to have a reference point.  Thus the !op.e_o_s clause
-	         above */
-
-	      if(vf->seekable && link>0)
-		granulepos-=vf->pcmlengths[link*2];
-	      if(granulepos<0)granulepos=0; /* actually, this
-					       shouldn't be possible
-					       here unless the stream
-					       is very broken */
-
-	      samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
-	    
-	      granulepos-=samples;
-	      for(i=0;i<link;i++)
-	        granulepos+=vf->pcmlengths[i*2+1];
-	      vf->pcm_offset=granulepos;
-	    }
-	    ret=1;
-	    goto cleanup;
-	  }
-	}
-	else 
-	  break;
-      }
-    }
-
-    if(vf->ready_state>=OPENED){
-      int ret;
-      if(!readp){
-	ret=0;
-	goto cleanup;
-      }
-      if((ret=_get_next_page(vf,&og,-1))<0){
-	ret=OV_EOF; /* eof. leave unitialized */
-	goto cleanup;
-      }
-
-	/* bitrate tracking; add the header's bytes here, the body bytes
-	   are done by packet above */
-      vf->bittrack+=og.header_len*8;
-      
-      /* has our decoding just traversed a bitstream boundary? */
-      if(vf->ready_state==INITSET){
-	if(vf->current_serialno!=ogg_page_serialno(&og)){
-	  if(!spanp){
-	    ret=OV_EOF;
-	    goto cleanup;
-	  }
-
-	  _decode_clear(vf);
-	  
-	  if(!vf->seekable){
-	    vorbis_info_clear(vf->vi);
-	    vorbis_comment_clear(vf->vc);
-	  }
-	}
-      }
-    }
-
-    /* Do we need to load a new machine before submitting the page? */
-    /* This is different in the seekable and non-seekable cases.  
-
-       In the seekable case, we already have all the header
-       information loaded and cached; we just initialize the machine
-       with it and continue on our merry way.
-
-       In the non-seekable (streaming) case, we'll only be at a
-       boundary if we just left the previous logical bitstream and
-       we're now nominally at the header of the next bitstream
-    */
-
-    if(vf->ready_state!=INITSET){ 
-      int link;
-
-      if(vf->ready_state<STREAMSET){
-	if(vf->seekable){
-	  vf->current_serialno=ogg_page_serialno(&og);
-	  
-	  /* match the serialno to bitstream section.  We use this rather than
-	     offset positions to avoid problems near logical bitstream
-	     boundaries */
-	  for(link=0;link<vf->links;link++)
-	    if(vf->serialnos[link]==vf->current_serialno)break;
-	  if(link==vf->links){
-	    ret=OV_EBADLINK; /* sign of a bogus stream.  error out,
-				leave machine uninitialized */
-	    goto cleanup;
-	  }
-	  
-	  vf->current_link=link;
-	  
-	  ogg_stream_reset_serialno(vf->os,vf->current_serialno);
-	  vf->ready_state=STREAMSET;
-	  
-	}else{
-	  /* we're streaming */
-	  /* fetch the three header packets, build the info struct */
-	  
-	  int ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,&og);
-	  if(ret) goto cleanup;
-	  vf->current_link++;
-	  link=0;
-	}
-      }
-      
-      _make_decode_ready(vf);
-    }
-    ogg_stream_pagein(vf->os,&og);
-  }
- cleanup:
-  ogg_packet_release(&op);
-  ogg_page_release(&og);
-  return ret;
-}
-
-/* if, eg, 64 bit stdio is configured by default, this will build with
-   fseek64 */
-static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){
-  if(f==NULL)return(-1);
-  return fseek(f,off,whence);
-}
-
-static int _ov_open1(void *f,OggVorbis_File *vf,char *initial,
-		     long ibytes, ov_callbacks callbacks){
-  int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1);
-  int ret;
-
-  memset(vf,0,sizeof(*vf));
-  vf->datasource=f;
-  vf->callbacks = callbacks;
-
-  /* init the framing state */
-  vf->oy=ogg_sync_create();
-
-  /* perhaps some data was previously read into a buffer for testing
-     against other stream types.  Allow initialization from this
-     previously read data (as we may be reading from a non-seekable
-     stream) */
-  if(initial){
-    unsigned char *buffer=ogg_sync_bufferin(vf->oy,ibytes);
-    memcpy(buffer,initial,ibytes);
-    ogg_sync_wrote(vf->oy,ibytes);
-  }
-
-  /* can we seek? Stevens suggests the seek test was portable */
-  if(offsettest!=-1)vf->seekable=1;
-
-  /* No seeking yet; Set up a 'single' (current) logical bitstream
-     entry for partial open */
-  vf->links=1;
-  vf->vi=_ogg_calloc(vf->links,sizeof(*vf->vi));
-  vf->vc=_ogg_calloc(vf->links,sizeof(*vf->vc));
-  vf->os=ogg_stream_create(-1); /* fill in the serialno later */
-
-  /* Try to fetch the headers, maintaining all the storage */
-  if((ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL))<0){
-    vf->datasource=NULL;
-    ov_clear(vf);
-  }else if(vf->ready_state < PARTOPEN)
-    vf->ready_state=PARTOPEN;
-  return(ret);
-}
-
-static int _ov_open2(OggVorbis_File *vf){
-  if(vf->ready_state < OPENED)
-    vf->ready_state=OPENED;
-  if(vf->seekable){
-    int ret=_open_seekable2(vf);
-    if(ret){
-      vf->datasource=NULL;
-      ov_clear(vf);
-    }
-    return(ret);
-  }
-  return 0;
-}
-
-
-/* clear out the OggVorbis_File struct */
-int ov_clear(OggVorbis_File *vf){
-  if(vf){
-    vorbis_block_clear(&vf->vb);
-    vorbis_dsp_clear(&vf->vd);
-    ogg_stream_destroy(vf->os);
-    
-    if(vf->vi && vf->links){
-      int i;
-      for(i=0;i<vf->links;i++){
-	vorbis_info_clear(vf->vi+i);
-	vorbis_comment_clear(vf->vc+i);
-      }
-      _ogg_free(vf->vi);
-      _ogg_free(vf->vc);
-    }
-    if(vf->dataoffsets)_ogg_free(vf->dataoffsets);
-    if(vf->pcmlengths)_ogg_free(vf->pcmlengths);
-    if(vf->serialnos)_ogg_free(vf->serialnos);
-    if(vf->offsets)_ogg_free(vf->offsets);
-    ogg_sync_destroy(vf->oy);
-
-    if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
-    memset(vf,0,sizeof(*vf));
-  }
-#ifdef DEBUG_LEAKS
-  _VDBG_dump();
-#endif
-  return(0);
-}
-
-/* inspects the OggVorbis file and finds/documents all the logical
-   bitstreams contained in it.  Tries to be tolerant of logical
-   bitstream sections that are truncated/woogie. 
-
-   return: -1) error
-            0) OK
-*/
-
-int ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
-    ov_callbacks callbacks){
-  int ret=_ov_open1(f,vf,initial,ibytes,callbacks);
-  if(ret)return ret;
-  return _ov_open2(vf);
-}
-
-int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
-  ov_callbacks callbacks = {
-    (size_t (*)(void *, size_t, size_t, void *))  fread,
-    (int (*)(void *, ogg_int64_t, int))              _fseek64_wrap,
-    (int (*)(void *))                             fclose,
-    (long (*)(void *))                            ftell
-  };
-
-  return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
-}
-  
-/* Only partially open the vorbis file; test for Vorbisness, and load
-   the headers for the first chain.  Do not seek (although test for
-   seekability).  Use ov_test_open to finish opening the file, else
-   ov_clear to close/free it. Same return codes as open. */
-
-int ov_test_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
-    ov_callbacks callbacks)
-{
-  return _ov_open1(f,vf,initial,ibytes,callbacks);
-}
-
-int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
-  ov_callbacks callbacks = {
-    (size_t (*)(void *, size_t, size_t, void *))  fread,
-    (int (*)(void *, ogg_int64_t, int))              _fseek64_wrap,
-    (int (*)(void *))                             fclose,
-    (long (*)(void *))                            ftell
-  };
-
-  return ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks);
-}
-  
-int ov_test_open(OggVorbis_File *vf){
-  if(vf->ready_state!=PARTOPEN)return(OV_EINVAL);
-  return _ov_open2(vf);
-}
-
-/* How many logical bitstreams in this physical bitstream? */
-long ov_streams(OggVorbis_File *vf){
-  return vf->links;
-}
-
-/* Is the FILE * associated with vf seekable? */
-long ov_seekable(OggVorbis_File *vf){
-  return vf->seekable;
-}
-
-/* returns the bitrate for a given logical bitstream or the entire
-   physical bitstream.  If the file is open for random access, it will
-   find the *actual* average bitrate.  If the file is streaming, it
-   returns the nominal bitrate (if set) else the average of the
-   upper/lower bounds (if set) else -1 (unset).
-
-   If you want the actual bitrate field settings, get them from the
-   vorbis_info structs */
-
-long ov_bitrate(OggVorbis_File *vf,int i){
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(i>=vf->links)return(OV_EINVAL);
-  if(!vf->seekable && i!=0)return(ov_bitrate(vf,0));
-  if(i<0){
-    ogg_int64_t bits=0;
-    int i;
-    for(i=0;i<vf->links;i++)
-      bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;
-    /* This once read: return(rint(bits/ov_time_total(vf,-1)));
-     * gcc 3.x on x86 miscompiled this at optimisation level 2 and above,
-     * so this is slightly transformed to make it work.
-     */
-    return(bits*1000/ov_time_total(vf,-1));
-  }else{
-    if(vf->seekable){
-      /* return the actual bitrate */
-      return((vf->offsets[i+1]-vf->dataoffsets[i])*8000/ov_time_total(vf,i));
-    }else{
-      /* return nominal if set */
-      if(vf->vi[i].bitrate_nominal>0){
-	return vf->vi[i].bitrate_nominal;
-      }else{
-	if(vf->vi[i].bitrate_upper>0){
-	  if(vf->vi[i].bitrate_lower>0){
-	    return (vf->vi[i].bitrate_upper+vf->vi[i].bitrate_lower)/2;
-	  }else{
-	    return vf->vi[i].bitrate_upper;
-	  }
-	}
-	return(OV_FALSE);
-      }
-    }
-  }
-}
-
-/* returns the actual bitrate since last call.  returns -1 if no
-   additional data to offer since last call (or at beginning of stream),
-   EINVAL if stream is only partially open 
-*/
-long ov_bitrate_instant(OggVorbis_File *vf){
-  int link=(vf->seekable?vf->current_link:0);
-  long ret;
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(vf->samptrack==0)return(OV_FALSE);
-  ret=vf->bittrack/vf->samptrack*vf->vi[link].rate;
-  vf->bittrack=0;
-  vf->samptrack=0;
-  return(ret);
-}
-
-/* Guess */
-long ov_serialnumber(OggVorbis_File *vf,int i){
-  if(i>=vf->links)return(ov_serialnumber(vf,vf->links-1));
-  if(!vf->seekable && i>=0)return(ov_serialnumber(vf,-1));
-  if(i<0){
-    return(vf->current_serialno);
-  }else{
-    return(vf->serialnos[i]);
-  }
-}
-
-/* returns: total raw (compressed) length of content if i==-1
-            raw (compressed) length of that logical bitstream for i==0 to n
-	    OV_EINVAL if the stream is not seekable (we can't know the length)
-	    or if stream is only partially open
-*/
-ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
-  if(i<0){
-    ogg_int64_t acc=0;
-    int i;
-    for(i=0;i<vf->links;i++)
-      acc+=ov_raw_total(vf,i);
-    return(acc);
-  }else{
-    return(vf->offsets[i+1]-vf->offsets[i]);
-  }
-}
-
-/* returns: total PCM length (samples) of content if i==-1 PCM length
-	    (samples) of that logical bitstream for i==0 to n
-	    OV_EINVAL if the stream is not seekable (we can't know the
-	    length) or only partially open 
-*/
-ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
-  if(i<0){
-    ogg_int64_t acc=0;
-    int i;
-    for(i=0;i<vf->links;i++)
-      acc+=ov_pcm_total(vf,i);
-    return(acc);
-  }else{
-    return(vf->pcmlengths[i*2+1]);
-  }
-}
-
-/* returns: total milliseconds of content if i==-1
-            milliseconds in that logical bitstream for i==0 to n
-	    OV_EINVAL if the stream is not seekable (we can't know the
-	    length) or only partially open 
-*/
-ogg_int64_t ov_time_total(OggVorbis_File *vf,int i){
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
-  if(i<0){
-    ogg_int64_t acc=0;
-    int i;
-    for(i=0;i<vf->links;i++)
-      acc+=ov_time_total(vf,i);
-    return(acc);
-  }else{
-    return(((ogg_int64_t)vf->pcmlengths[i*2+1])*1000/vf->vi[i].rate);
-  }
-}
-
-/* seek to an offset relative to the *compressed* data. This also
-   scans packets to update the PCM cursor. It will cross a logical
-   bitstream boundary, but only if it can't get any packets out of the
-   tail of the bitstream we seek to (so no surprises).
-
-   returns zero on success, nonzero on failure */
-
-int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
-  ogg_stream_state *work_os=NULL;
-  ogg_page og={0,0,0,0};
-  ogg_packet op={0,0,0,0,0,0};
-  
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(!vf->seekable)
-    return(OV_ENOSEEK); /* don't dump machine if we can't seek */
-
-  if(pos<0 || pos>vf->end)return(OV_EINVAL);
-
-  /* don't yet clear out decoding machine (if it's initialized), in
-     the case we're in the same link.  Restart the decode lapping, and
-     let _fetch_and_process_packet deal with a potential bitstream
-     boundary */
-  vf->pcm_offset=-1;
-  ogg_stream_reset_serialno(vf->os,
-			    vf->current_serialno); /* must set serialno */
-  vorbis_synthesis_restart(&vf->vd);
-    
-  _seek_helper(vf,pos);
-
-  /* we need to make sure the pcm_offset is set, but we don't want to
-     advance the raw cursor past good packets just to get to the first
-     with a granulepos.  That's not equivalent behavior to beginning
-     decoding as immediately after the seek position as possible.
-
-     So, a hack.  We use two stream states; a local scratch state and
-     the shared vf->os stream state.  We use the local state to
-     scan, and the shared state as a buffer for later decode. 
-
-     Unfortuantely, on the last page we still advance to last packet
-     because the granulepos on the last page is not necessarily on a
-     packet boundary, and we need to make sure the granpos is
-     correct. 
-  */
-
-  {
-    int lastblock=0;
-    int accblock=0;
-    int thisblock;
-    int eosflag=0;
-
-    work_os=ogg_stream_create(vf->current_serialno); /* get the memory ready */
-    while(1){
-      if(vf->ready_state>=STREAMSET){
-	/* snarf/scan a packet if we can */
-	int result=ogg_stream_packetout(work_os,&op);
-      
-	if(result>0){
-
-	  if(vf->vi[vf->current_link].codec_setup){
-	    thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
-	    if(thisblock<0){
-	      ogg_stream_packetout(vf->os,NULL);
-	      thisblock=0;
-	    }else{
-	      
-	      if(eosflag)
-		ogg_stream_packetout(vf->os,NULL);
-	      else
-		if(lastblock)accblock+=(lastblock+thisblock)>>2;
-	    }	    
-
-	    if(op.granulepos!=-1){
-	      int i,link=vf->current_link;
-	      ogg_int64_t granulepos=op.granulepos-vf->pcmlengths[link*2];
-	      if(granulepos<0)granulepos=0;
-	      
-	      for(i=0;i<link;i++)
-		granulepos+=vf->pcmlengths[i*2+1];
-	      vf->pcm_offset=granulepos-accblock;
-	      break;
-	    }
-	    lastblock=thisblock;
-	    continue;
-	  }else
-	    ogg_stream_packetout(vf->os,NULL);
-	}
-      }
-      
-      if(!lastblock){
-	if(_get_next_page(vf,&og,-1)<0){
-	  vf->pcm_offset=ov_pcm_total(vf,-1);
-	  break;
-	}
-      }else{
-	/* huh?  Bogus stream with packets but no granulepos */
-	vf->pcm_offset=-1;
-	break;
-      }
-      
-      /* has our decoding just traversed a bitstream boundary? */
-      if(vf->ready_state>=STREAMSET)
-	if(vf->current_serialno!=ogg_page_serialno(&og)){
-	  _decode_clear(vf); /* clear out stream state */
-	  ogg_stream_destroy(work_os);
-	}
-
-      if(vf->ready_state<STREAMSET){
-	int link;
-	
-	vf->current_serialno=ogg_page_serialno(&og);
-	for(link=0;link<vf->links;link++)
-	  if(vf->serialnos[link]==vf->current_serialno)break;
-	if(link==vf->links)
-	  goto seek_error; /* sign of a bogus stream.  error out,
-			      leave machine uninitialized */
- 
-	vf->current_link=link;
-	
-	ogg_stream_reset_serialno(vf->os,vf->current_serialno);
-	ogg_stream_reset_serialno(work_os,vf->current_serialno); 
-	vf->ready_state=STREAMSET;
-	
-      }
-    
-      {
-	ogg_page dup;
-	ogg_page_dup(&dup,&og);
-	eosflag=ogg_page_eos(&og);
-	ogg_stream_pagein(vf->os,&og);
-	ogg_stream_pagein(work_os,&dup);
-      }
-    }
-  }
-
-  ogg_packet_release(&op);
-  ogg_page_release(&og);
-  ogg_stream_destroy(work_os);
-  vf->bittrack=0;
-  vf->samptrack=0;
-  return(0);
-
- seek_error:
-  ogg_packet_release(&op);
-  ogg_page_release(&og);
-
-  /* dump the machine so we're in a known state */
-  vf->pcm_offset=-1;
-  ogg_stream_destroy(work_os);
-  _decode_clear(vf);
-  return OV_EBADLINK;
-}
-
-/* Page granularity seek (faster than sample granularity because we
-   don't do the last bit of decode to find a specific sample).
-
-   Seek to the last [granule marked] page preceeding the specified pos
-   location, such that decoding past the returned point will quickly
-   arrive at the requested position. */
-int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
-  int link=-1;
-  ogg_int64_t result=0;
-  ogg_int64_t total=ov_pcm_total(vf,-1);
-  ogg_page og={0,0,0,0};
-  ogg_packet op={0,0,0,0,0,0};
-
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(!vf->seekable)return(OV_ENOSEEK);
-  if(pos<0 || pos>total)return(OV_EINVAL);
- 
-  /* which bitstream section does this pcm offset occur in? */
-  for(link=vf->links-1;link>=0;link--){
-    total-=vf->pcmlengths[link*2+1];
-    if(pos>=total)break;
-  }
-
-  /* search within the logical bitstream for the page with the highest
-     pcm_pos preceeding (or equal to) pos.  There is a danger here;
-     missing pages or incorrect frame number information in the
-     bitstream could make our task impossible.  Account for that (it
-     would be an error condition) */
-
-  /* new search algorithm by HB (Nicholas Vinen) */
-  {
-    ogg_int64_t end=vf->offsets[link+1];
-    ogg_int64_t begin=vf->offsets[link];
-    ogg_int64_t begintime = vf->pcmlengths[link*2];
-    ogg_int64_t endtime = vf->pcmlengths[link*2+1]+begintime;
-    ogg_int64_t target=pos-total+begintime;
-    ogg_int64_t best=begin;
-    
-    while(begin<end){
-      ogg_int64_t bisect;
-      
-      if(end-begin<CHUNKSIZE){
-	bisect=begin;
-      }else{
-	/* take a (pretty decent) guess. */
-	bisect=begin + 
-	  (target-begintime)*(end-begin)/(endtime-begintime) - CHUNKSIZE;
-	if(bisect<=begin)
-	  bisect=begin+1;
-      }
-      
-      _seek_helper(vf,bisect);
-    
-      while(begin<end){
-	result=_get_next_page(vf,&og,end-vf->offset);
-	if(result==OV_EREAD) goto seek_error;
-	if(result<0){
-	  if(bisect<=begin+1)
-	    end=begin; /* found it */
-	  else{
-	    if(bisect==0) goto seek_error;
-	    bisect-=CHUNKSIZE;
-	    if(bisect<=begin)bisect=begin+1;
-	    _seek_helper(vf,bisect);
-	  }
-	}else{
-	  ogg_int64_t granulepos=ogg_page_granulepos(&og);
-	  if(granulepos==-1)continue;
-	  if(granulepos<target){
-	    best=result;  /* raw offset of packet with granulepos */ 
-	    begin=vf->offset; /* raw offset of next page */
-	    begintime=granulepos;
-	    
-	    if(target-begintime>44100)break;
-	    bisect=begin; /* *not* begin + 1 */
-	  }else{
-	    if(bisect<=begin+1)
-	      end=begin;  /* found it */
-	    else{
-	      if(end==vf->offset){ /* we're pretty close - we'd be stuck in */
-		end=result;
-		bisect-=CHUNKSIZE; /* an endless loop otherwise. */
-		if(bisect<=begin)bisect=begin+1;
-		_seek_helper(vf,bisect);
-	      }else{
-		end=result;
-		endtime=granulepos;
-		break;
-	      }
-	    }
-	  }
-	}
-      }
-    }
-
-    /* found our page. seek to it, update pcm offset. Easier case than
-       raw_seek, don't keep packets preceeding granulepos. */
-    {
-      
-      /* seek */
-      _seek_helper(vf,best);
-      vf->pcm_offset=-1;
-      
-      if(_get_next_page(vf,&og,-1)<0){
-	ogg_page_release(&og);
-	return(OV_EOF); /* shouldn't happen */
-      }
-
-      if(link!=vf->current_link){
-	/* Different link; dump entire decode machine */
-	_decode_clear(vf);  
-	
-	vf->current_link=link;
-	vf->current_serialno=ogg_page_serialno(&og);
-	vf->ready_state=STREAMSET;
-	
-      }else{
-	vorbis_synthesis_restart(&vf->vd);
-      }
-
-      ogg_stream_reset_serialno(vf->os,vf->current_serialno);
-      ogg_stream_pagein(vf->os,&og);
-
-      /* pull out all but last packet; the one with granulepos */
-      while(1){
-	result=ogg_stream_packetpeek(vf->os,&op);
-	if(result==0){
-	  /* !!! the packet finishing this page originated on a
-             preceeding page. Keep fetching previous pages until we
-             get one with a granulepos or without the 'continued' flag
-             set.  Then just use raw_seek for simplicity. */
-	  
-	  _seek_helper(vf,best);
-	  
-	  while(1){
-	    result=_get_prev_page(vf,&og);
-	    if(result<0) goto seek_error;
-	    if(ogg_page_granulepos(&og)>-1 ||
-	       !ogg_page_continued(&og)){
-	      return ov_raw_seek(vf,result);
-	    }
-	    vf->offset=result;
-	  }
-	}
-	if(result<0){
-	  result = OV_EBADPACKET; 
-	  goto seek_error;
-	}
-	if(op.granulepos!=-1){
-	  vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
-	  if(vf->pcm_offset<0)vf->pcm_offset=0;
-	  vf->pcm_offset+=total;
-	  break;
-	}else
-	  result=ogg_stream_packetout(vf->os,NULL);
-      }
-    }
-  }
-  
-  /* verify result */
-  if(vf->pcm_offset>pos || pos>ov_pcm_total(vf,-1)){
-    result=OV_EFAULT;
-    goto seek_error;
-  }
-  vf->bittrack=0;
-  vf->samptrack=0;
-
-  ogg_page_release(&og);
-  ogg_packet_release(&op);
-  return(0);
-  
- seek_error:
-
-  ogg_page_release(&og);
-  ogg_packet_release(&op);
-
-  /* dump machine so we're in a known state */
-  vf->pcm_offset=-1;
-  _decode_clear(vf);
-  return (int)result;
-}
-
-/* seek to a sample offset relative to the decompressed pcm stream 
-   returns zero on success, nonzero on failure */
-
-int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
-  ogg_packet op={0,0,0,0,0,0};
-  ogg_page og={0,0,0,0};
-  int thisblock,lastblock=0;
-  int ret=ov_pcm_seek_page(vf,pos);
-  if(ret<0)return(ret);
-  _make_decode_ready(vf);
-
-  /* discard leading packets we don't need for the lapping of the
-     position we want; don't decode them */
-
-  while(1){
-
-    int ret=ogg_stream_packetpeek(vf->os,&op);
-    if(ret>0){
-      thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
-      if(thisblock<0){
-	ogg_stream_packetout(vf->os,NULL);
-	continue; /* non audio packet */
-      }
-      if(lastblock)vf->pcm_offset+=(lastblock+thisblock)>>2;
-      
-      if(vf->pcm_offset+((thisblock+
-			  vorbis_info_blocksize(vf->vi,1))>>2)>=pos)break;
-      
-      /* remove the packet from packet queue and track its granulepos */
-      ogg_stream_packetout(vf->os,NULL);
-      vorbis_synthesis(&vf->vb,&op,0);  /* set up a vb with
-					   only tracking, no
-					   pcm_decode */
-      vorbis_synthesis_blockin(&vf->vd,&vf->vb); 
-      
-      /* end of logical stream case is hard, especially with exact
-	 length positioning. */
-      
-      if(op.granulepos>-1){
-	int i;
-	/* always believe the stream markers */
-	vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
-	if(vf->pcm_offset<0)vf->pcm_offset=0;
-	for(i=0;i<vf->current_link;i++)
-	  vf->pcm_offset+=vf->pcmlengths[i*2+1];
-      }
-	
-      lastblock=thisblock;
-      
-    }else{
-      if(ret<0 && ret!=OV_HOLE)break;
-      
-      /* suck in a new page */
-      if(_get_next_page(vf,&og,-1)<0)break;
-      if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf);
-      
-      if(vf->ready_state<STREAMSET){
-	int link;
-	
-	vf->current_serialno=ogg_page_serialno(&og);
-	for(link=0;link<vf->links;link++)
-	  if(vf->serialnos[link]==vf->current_serialno)break;
-	if(link==vf->links){
-	  ogg_page_release(&og);
-	  ogg_packet_release(&op);
-	  return(OV_EBADLINK);
-	}
-	vf->current_link=link;
-	
-	ogg_stream_reset_serialno(vf->os,vf->current_serialno); 
-	vf->ready_state=STREAMSET;      
-	_make_decode_ready(vf);
-	lastblock=0;
-      }
-
-      ogg_stream_pagein(vf->os,&og);
-    }
-  }
-
-  vf->bittrack=0;
-  vf->samptrack=0;
-  /* discard samples until we reach the desired position. Crossing a
-     logical bitstream boundary with abandon is OK. */
-  while(vf->pcm_offset<pos){
-    ogg_int64_t target=pos-vf->pcm_offset;
-    long samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
-
-    if(samples>target)samples=target;
-    vorbis_synthesis_read(&vf->vd,samples);
-    vf->pcm_offset+=samples;
-    
-    if(samples<target)
-      if(_fetch_and_process_packet(vf,1,1)<=0)
-	vf->pcm_offset=ov_pcm_total(vf,-1); /* eof */
-  }
-
-  ogg_page_release(&og);
-  ogg_packet_release(&op);
-  return 0;
-}
-
-/* seek to a playback time relative to the decompressed pcm stream 
-   returns zero on success, nonzero on failure */
-int ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
-  /* translate time to PCM position and call ov_pcm_seek */
-
-  int link=-1;
-  ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
-  ogg_int64_t time_total=ov_time_total(vf,-1);
-
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(!vf->seekable)return(OV_ENOSEEK);
-  if(milliseconds<0 || milliseconds>time_total)return(OV_EINVAL);
-  
-  /* which bitstream section does this time offset occur in? */
-  for(link=vf->links-1;link>=0;link--){
-    pcm_total-=vf->pcmlengths[link*2+1];
-    time_total-=ov_time_total(vf,link);
-    if(milliseconds>=time_total)break;
-  }
-
-  /* enough information to convert time offset to pcm offset */
-  {
-    ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
-    return(ov_pcm_seek(vf,target));
-  }
-}
-
-/* page-granularity version of ov_time_seek 
-   returns zero on success, nonzero on failure */
-int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){
-  /* translate time to PCM position and call ov_pcm_seek */
-
-  int link=-1;
-  ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
-  ogg_int64_t time_total=ov_time_total(vf,-1);
-
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(!vf->seekable)return(OV_ENOSEEK);
-  if(milliseconds<0 || milliseconds>time_total)return(OV_EINVAL);
-  
-  /* which bitstream section does this time offset occur in? */
-  for(link=vf->links-1;link>=0;link--){
-    pcm_total-=vf->pcmlengths[link*2+1];
-    time_total-=ov_time_total(vf,link);
-    if(milliseconds>=time_total)break;
-  }
-
-  /* enough information to convert time offset to pcm offset */
-  {
-    ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
-    return(ov_pcm_seek_page(vf,target));
-  }
-}
-
-/* tell the current stream offset cursor.  Note that seek followed by
-   tell will likely not give the set offset due to caching */
-ogg_int64_t ov_raw_tell(OggVorbis_File *vf){
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  return(vf->offset);
-}
-
-/* return PCM offset (sample) of next PCM sample to be read */
-ogg_int64_t ov_pcm_tell(OggVorbis_File *vf){
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  return(vf->pcm_offset);
-}
-
-/* return time offset (milliseconds) of next PCM sample to be read */
-ogg_int64_t ov_time_tell(OggVorbis_File *vf){
-  int link=0;
-  ogg_int64_t pcm_total=0;
-  ogg_int64_t time_total=0;
-  
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-  if(vf->seekable){
-    pcm_total=ov_pcm_total(vf,-1);
-    time_total=ov_time_total(vf,-1);
-  
-    /* which bitstream section does this time offset occur in? */
-    for(link=vf->links-1;link>=0;link--){
-      pcm_total-=vf->pcmlengths[link*2+1];
-      time_total-=ov_time_total(vf,link);
-      if(vf->pcm_offset>=pcm_total)break;
-    }
-  }
-
-  return(time_total+(1000*vf->pcm_offset-pcm_total)/vf->vi[link].rate);
-}
-
-/*  link:   -1) return the vorbis_info struct for the bitstream section
-                currently being decoded
-           0-n) to request information for a specific bitstream section
-    
-    In the case of a non-seekable bitstream, any call returns the
-    current bitstream.  NULL in the case that the machine is not
-    initialized */
-
-vorbis_info *ov_info(OggVorbis_File *vf,int link){
-  if(vf->seekable){
-    if(link<0)
-      if(vf->ready_state>=STREAMSET)
-	return vf->vi+vf->current_link;
-      else
-      return vf->vi;
-    else
-      if(link>=vf->links)
-	return NULL;
-      else
-	return vf->vi+link;
-  }else{
-    return vf->vi;
-  }
-}
-
-/* grr, strong typing, grr, no templates/inheritence, grr */
-vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
-  if(vf->seekable){
-    if(link<0)
-      if(vf->ready_state>=STREAMSET)
-	return vf->vc+vf->current_link;
-      else
-	return vf->vc;
-    else
-      if(link>=vf->links)
-	return NULL;
-      else
-	return vf->vc+link;
-  }else{
-    return vf->vc;
-  }
-}
-
-/* up to this point, everything could more or less hide the multiple
-   logical bitstream nature of chaining from the toplevel application
-   if the toplevel application didn't particularly care.  However, at
-   the point that we actually read audio back, the multiple-section
-   nature must surface: Multiple bitstream sections do not necessarily
-   have to have the same number of channels or sampling rate.
-
-   ov_read returns the sequential logical bitstream number currently
-   being decoded along with the PCM data in order that the toplevel
-   application can take action on channel/sample rate changes.  This
-   number will be incremented even for streamed (non-seekable) streams
-   (for seekable streams, it represents the actual logical bitstream
-   index within the physical bitstream.  Note that the accessor
-   functions above are aware of this dichotomy).
-
-   input values: buffer) a buffer to hold packed PCM data for return
-		 length) the byte length requested to be placed into buffer
-
-   return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL)
-                   0) EOF
-		   n) number of bytes of PCM actually returned.  The
-		   below works on a packet-by-packet basis, so the
-		   return length is not related to the 'length' passed
-		   in, just guaranteed to fit.
-
-	    *section) set to the logical bitstream number */
-
-long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
-  int i,j;
-
-  ogg_int32_t **pcm;
-  long samples;
-
-  if(vf->ready_state<OPENED)return(OV_EINVAL);
-
-  while(1){
-    if(vf->ready_state==INITSET){
-      samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
-      if(samples)break;
-    }
-
-    /* suck in another packet */
-    {
-      int ret=_fetch_and_process_packet(vf,1,1);
-      if(ret==OV_EOF)
-	return(0);
-      if(ret<=0)
-	return(ret);
-    }
-
-  }
-
-  if(samples>0){
-  
-    /* yay! proceed to pack data into the byte buffer */
-    
-    long channels=ov_info(vf,-1)->channels;
-
-    if(samples>(bytes_req/(2*channels)))
-      samples=bytes_req/(2*channels);      
-    
-    for(i=0;i<channels;i++) { /* It's faster in this order */
-      ogg_int32_t *src=pcm[i];
-      short *dest=((short *)buffer)+i;
-      for(j=0;j<samples;j++) {
-        *dest=CLIP_TO_15(src[j]>>9);
-        dest+=channels;
-      }
-    }
-    
-    vorbis_synthesis_read(&vf->vd,samples);
-    vf->pcm_offset+=samples;
-    if(bitstream)*bitstream=vf->current_link;
-    return(samples*2*channels);
-  }else{
-    return(samples);
-  }
-}
--- a/misc/libtremor/window.c	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: window functions
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <math.h>
-#include "misc.h"
-#include "window.h"
-#include "window_lookup.h"
-
-const void *_vorbis_window(int type, int left){
-
-  switch(type){
-  case 0:
-
-    switch(left){
-    case 32:
-      return vwin64;
-    case 64:
-      return vwin128;
-    case 128:
-      return vwin256;
-    case 256:
-      return vwin512;
-    case 512:
-      return vwin1024;
-    case 1024:
-      return vwin2048;
-    case 2048:
-      return vwin4096;
-    case 4096:
-      return vwin8192;
-    default:
-      return(0);
-    }
-    break;
-  default:
-    return(0);
-  }
-}
-
-void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
-			  long *blocksizes,
-			  int lW,int W,int nW){
-  
-  LOOKUP_T *window[2]={window_p[0],window_p[1]};
-  long n=blocksizes[W];
-  long ln=blocksizes[lW];
-  long rn=blocksizes[nW];
-
-  long leftbegin=n/4-ln/4;
-  long leftend=leftbegin+ln/2;
-
-  long rightbegin=n/2+n/4-rn/4;
-  long rightend=rightbegin+rn/2;
-  
-  int i,p;
-
-  for(i=0;i<leftbegin;i++)
-    d[i]=0;
-
-  for(p=0;i<leftend;i++,p++)
-    d[i]=MULT31(d[i],window[lW][p]);
-
-  for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--)
-    d[i]=MULT31(d[i],window[nW][p]);
-
-  for(;i<n;i++)
-    d[i]=0;
-}
--- a/misc/libtremor/window.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: window functions
-
- ********************************************************************/
-
-#ifndef _V_WINDOW_
-#define _V_WINDOW_
-
-extern const void *_vorbis_window(int type,int left);
-extern void _vorbis_apply_window(ogg_int32_t *d,const void *window[2],
-				 long *blocksizes,
-				 int lW,int W,int nW);
-
-
-#endif
--- a/misc/libtremor/window_lookup.h	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2084 +0,0 @@
-/********************************************************************
- *                                                   *
- * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
- *                                                                  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
- * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: window lookup tables
-
- ********************************************************************/
-
-
-#include "os_types.h"
-
-static LOOKUP_T vwin64[32] = {
-  X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4),
-  X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676),
-  X(0x20a74d83), X(0x27f7137c), X(0x2fabb05a), X(0x37a1105a),
-  X(0x3fb0ab28), X(0x47b2dcd1), X(0x4f807bc6), X(0x56f48e70),
-  X(0x5dedfc79), X(0x64511653), X(0x6a08cfff), X(0x6f079328),
-  X(0x734796f4), X(0x76cab7f2), X(0x7999d6e8), X(0x7bc3cf9f),
-  X(0x7d5c20c1), X(0x7e7961df), X(0x7f33a567), X(0x7fa2e1d0),
-  X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f),
-};
-
-static LOOKUP_T vwin128[64] = {
-  X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294),
-  X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f),
-  X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd),
-  X(0x12469488), X(0x152e0c7a), X(0x1842a81c), X(0x1b81686d),
-  X(0x1ee705d9), X(0x226ff15d), X(0x26185705), X(0x29dc21cc),
-  X(0x2db700fe), X(0x31a46f08), X(0x359fb9c1), X(0x39a40c0c),
-  X(0x3dac78b6), X(0x41b40674), X(0x45b5bcb0), X(0x49acb109),
-  X(0x4d94152b), X(0x516744bd), X(0x5521d320), X(0x58bf98a5),
-  X(0x5c3cbef4), X(0x5f95cc5d), X(0x62c7add7), X(0x65cfbf64),
-  X(0x68abd2ba), X(0x6b5a3405), X(0x6dd9acab), X(0x7029840d),
-  X(0x72497e38), X(0x7439d8ac), X(0x75fb4532), X(0x778ee30a),
-  X(0x78f6367e), X(0x7a331f1a), X(0x7b47cccd), X(0x7c36b416),
-  X(0x7d028192), X(0x7dae0d18), X(0x7e3c4caa), X(0x7eb04763),
-  X(0x7f0d08a7), X(0x7f5593b7), X(0x7f8cd7d5), X(0x7fb5a513),
-  X(0x7fd2a1fc), X(0x7fe64212), X(0x7ff2bd4c), X(0x7ffa0890),
-  X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4),
-};
-
-static LOOKUP_T vwin256[128] = {
-  X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1),
-  X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f),
-  X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f),
-  X(0x04b17167), X(0x05776b90), X(0x064bfcdc), X(0x072efedd),
-  X(0x082047b4), X(0x091fa9f1), X(0x0a2cf477), X(0x0b47f25d),
-  X(0x0c706ad2), X(0x0da620ff), X(0x0ee8d3ef), X(0x10383e75),
-  X(0x11941716), X(0x12fc0ff6), X(0x146fd6c8), X(0x15ef14c2),
-  X(0x17796e8e), X(0x190e844f), X(0x1aadf196), X(0x1c574d6e),
-  X(0x1e0a2a62), X(0x1fc61688), X(0x218a9b9c), X(0x23573f12),
-  X(0x252b823d), X(0x2706e269), X(0x28e8d913), X(0x2ad0dc0e),
-  X(0x2cbe5dc1), X(0x2eb0cd60), X(0x30a79733), X(0x32a224d5),
-  X(0x349fdd8b), X(0x36a02690), X(0x38a2636f), X(0x3aa5f65e),
-  X(0x3caa409e), X(0x3eaea2df), X(0x40b27da6), X(0x42b531b8),
-  X(0x44b62086), X(0x46b4ac99), X(0x48b03a05), X(0x4aa82ed5),
-  X(0x4c9bf37d), X(0x4e8af349), X(0x50749ccb), X(0x52586246),
-  X(0x5435ba1c), X(0x560c1f31), X(0x57db1152), X(0x59a21591),
-  X(0x5b60b6a3), X(0x5d168535), X(0x5ec31839), X(0x60660d36),
-  X(0x61ff0886), X(0x638db595), X(0x6511c717), X(0x668af734),
-  X(0x67f907b0), X(0x695bc207), X(0x6ab2f787), X(0x6bfe815a),
-  X(0x6d3e4090), X(0x6e721e16), X(0x6f9a0ab5), X(0x70b5fef8),
-  X(0x71c5fb16), X(0x72ca06cd), X(0x73c2313d), X(0x74ae90b2),
-  X(0x758f4275), X(0x76646a85), X(0x772e335c), X(0x77eccda0),
-  X(0x78a06fd7), X(0x79495613), X(0x79e7c19c), X(0x7a7bf894),
-  X(0x7b064596), X(0x7b86f757), X(0x7bfe6044), X(0x7c6cd615),
-  X(0x7cd2b16e), X(0x7d304d71), X(0x7d860756), X(0x7dd43e06),
-  X(0x7e1b51ad), X(0x7e5ba355), X(0x7e95947e), X(0x7ec986bb),
-  X(0x7ef7db4a), X(0x7f20f2b9), X(0x7f452c7f), X(0x7f64e6a7),
-  X(0x7f807d71), X(0x7f984aff), X(0x7faca700), X(0x7fbde662),
-  X(0x7fcc5b04), X(0x7fd85372), X(0x7fe21a99), X(0x7fe9f791),
-  X(0x7ff02d58), X(0x7ff4fa9e), X(0x7ff89990), X(0x7ffb3faa),
-  X(0x7ffd1d8b), X(0x7ffe5ecc), X(0x7fff29e0), X(0x7fff9ff3),
-  X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc),
-};
-
-static LOOKUP_T vwin512[256] = {
-  X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c),
-  X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7),
-  X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc),
-  X(0x012e32b6), X(0x01605df5), X(0x01965b85), X(0x01d02939),
-  X(0x020dc4ba), X(0x024f2b83), X(0x02945ae6), X(0x02dd5004),
-  X(0x032a07d3), X(0x037a7f19), X(0x03ceb26e), X(0x04269e37),
-  X(0x04823eab), X(0x04e18fcc), X(0x05448d6d), X(0x05ab3329),
-  X(0x06157c68), X(0x0683645e), X(0x06f4e607), X(0x0769fc25),
-  X(0x07e2a146), X(0x085ecfbc), X(0x08de819f), X(0x0961b0cc),
-  X(0x09e856e3), X(0x0a726d46), X(0x0affed1d), X(0x0b90cf4c),
-  X(0x0c250c79), X(0x0cbc9d0b), X(0x0d577926), X(0x0df598aa),
-  X(0x0e96f337), X(0x0f3b8026), X(0x0fe3368f), X(0x108e0d42),
-  X(0x113bfaca), X(0x11ecf56b), X(0x12a0f324), X(0x1357e9ac),
-  X(0x1411ce70), X(0x14ce9698), X(0x158e3702), X(0x1650a444),
-  X(0x1715d2aa), X(0x17ddb638), X(0x18a842aa), X(0x19756b72),
-  X(0x1a4523b9), X(0x1b175e62), X(0x1bec0e04), X(0x1cc324f0),
-  X(0x1d9c9532), X(0x1e78508a), X(0x1f564876), X(0x20366e2e),
-  X(0x2118b2a2), X(0x21fd0681), X(0x22e35a37), X(0x23cb9dee),
-  X(0x24b5c18e), X(0x25a1b4c0), X(0x268f66f1), X(0x277ec74e),
-  X(0x286fc4cc), X(0x29624e23), X(0x2a5651d7), X(0x2b4bbe34),
-  X(0x2c428150), X(0x2d3a8913), X(0x2e33c332), X(0x2f2e1d35),
-  X(0x30298478), X(0x3125e62d), X(0x32232f61), X(0x33214cfc),
-  X(0x34202bc2), X(0x351fb85a), X(0x361fdf4f), X(0x37208d10),
-  X(0x3821adf7), X(0x39232e49), X(0x3a24fa3c), X(0x3b26fdf6),
-  X(0x3c292593), X(0x3d2b5d29), X(0x3e2d90c8), X(0x3f2fac7f),
-  X(0x40319c5f), X(0x41334c81), X(0x4234a905), X(0x43359e16),
-  X(0x443617f3), X(0x453602eb), X(0x46354b65), X(0x4733dde1),
-  X(0x4831a6ff), X(0x492e937f), X(0x4a2a9045), X(0x4b258a5f),
-  X(0x4c1f6f06), X(0x4d182ba2), X(0x4e0fadce), X(0x4f05e35b),
-  X(0x4ffaba53), X(0x50ee20fd), X(0x51e005e1), X(0x52d057ca),
-  X(0x53bf05ca), X(0x54abff3b), X(0x559733c7), X(0x56809365),
-  X(0x57680e62), X(0x584d955d), X(0x59311952), X(0x5a128b96),
-  X(0x5af1dddd), X(0x5bcf023a), X(0x5ca9eb27), X(0x5d828b81),
-  X(0x5e58d68d), X(0x5f2cbffc), X(0x5ffe3be9), X(0x60cd3edf),
-  X(0x6199bdda), X(0x6263ae45), X(0x632b0602), X(0x63efbb66),
-  X(0x64b1c53f), X(0x65711ad0), X(0x662db3d7), X(0x66e7888d),
-  X(0x679e91a5), X(0x6852c84e), X(0x69042635), X(0x69b2a582),
-  X(0x6a5e40dd), X(0x6b06f36c), X(0x6bacb8d2), X(0x6c4f8d30),
-  X(0x6cef6d26), X(0x6d8c55d4), X(0x6e2644d4), X(0x6ebd3840),
-  X(0x6f512ead), X(0x6fe2272e), X(0x7070214f), X(0x70fb1d17),
-  X(0x71831b06), X(0x72081c16), X(0x728a21b5), X(0x73092dc8),
-  X(0x738542a6), X(0x73fe631b), X(0x74749261), X(0x74e7d421),
-  X(0x75582c72), X(0x75c59fd5), X(0x76303333), X(0x7697ebdd),
-  X(0x76fccf85), X(0x775ee443), X(0x77be308a), X(0x781abb2e),
-  X(0x78748b59), X(0x78cba88e), X(0x79201aa7), X(0x7971e9cd),
-  X(0x79c11e79), X(0x7a0dc170), X(0x7a57dbc2), X(0x7a9f76c1),
-  X(0x7ae49c07), X(0x7b27556b), X(0x7b67ad02), X(0x7ba5ad1b),
-  X(0x7be1603a), X(0x7c1ad118), X(0x7c520a9e), X(0x7c8717e1),
-  X(0x7cba0421), X(0x7ceadac3), X(0x7d19a74f), X(0x7d46756e),
-  X(0x7d7150e5), X(0x7d9a4592), X(0x7dc15f69), X(0x7de6aa71),
-  X(0x7e0a32c0), X(0x7e2c0479), X(0x7e4c2bc7), X(0x7e6ab4db),
-  X(0x7e87abe9), X(0x7ea31d24), X(0x7ebd14be), X(0x7ed59edd),
-  X(0x7eecc7a3), X(0x7f029b21), X(0x7f17255a), X(0x7f2a723f),
-  X(0x7f3c8daa), X(0x7f4d835d), X(0x7f5d5f00), X(0x7f6c2c1b),
-  X(0x7f79f617), X(0x7f86c83a), X(0x7f92ada2), X(0x7f9db146),
-  X(0x7fa7ddf3), X(0x7fb13e46), X(0x7fb9dcb0), X(0x7fc1c36c),
-  X(0x7fc8fc83), X(0x7fcf91c7), X(0x7fd58cd2), X(0x7fdaf702),
-  X(0x7fdfd979), X(0x7fe43d1c), X(0x7fe82a8b), X(0x7febaa29),
-  X(0x7feec412), X(0x7ff1801c), X(0x7ff3e5d6), X(0x7ff5fc86),
-  X(0x7ff7cb29), X(0x7ff9586f), X(0x7ffaaaba), X(0x7ffbc81e),
-  X(0x7ffcb660), X(0x7ffd7af3), X(0x7ffe1afa), X(0x7ffe9b42),
-  X(0x7fff0047), X(0x7fff4e2f), X(0x7fff88c9), X(0x7fffb390),
-  X(0x7fffd1a6), X(0x7fffe5d7), X(0x7ffff296), X(0x7ffff9fd),
-  X(0x7ffffdcd), X(0x7fffff6d), X(0x7fffffed), X(0x7fffffff),
-};
-
-static LOOKUP_T vwin1024[512] = {
-  X(0x00001f02), X(0x0001170e), X(0x00030724), X(0x0005ef40),
-  X(0x0009cf59), X(0x000ea767), X(0x0014775e), X(0x001b3f2e),
-  X(0x0022fec8), X(0x002bb618), X(0x00356508), X(0x00400b81),
-  X(0x004ba968), X(0x00583ea0), X(0x0065cb0a), X(0x00744e84),
-  X(0x0083c8ea), X(0x00943a14), X(0x00a5a1da), X(0x00b80010),
-  X(0x00cb5488), X(0x00df9f10), X(0x00f4df76), X(0x010b1584),
-  X(0x01224101), X(0x013a61b2), X(0x01537759), X(0x016d81b6),
-  X(0x01888087), X(0x01a47385), X(0x01c15a69), X(0x01df34e6),
-  X(0x01fe02b1), X(0x021dc377), X(0x023e76e7), X(0x02601ca9),
-  X(0x0282b466), X(0x02a63dc1), X(0x02cab85d), X(0x02f023d6),
-  X(0x03167fcb), X(0x033dcbd3), X(0x03660783), X(0x038f3270),
-  X(0x03b94c29), X(0x03e4543a), X(0x04104a2e), X(0x043d2d8b),
-  X(0x046afdd5), X(0x0499ba8c), X(0x04c9632d), X(0x04f9f734),
-  X(0x052b7615), X(0x055ddf46), X(0x05913237), X(0x05c56e53),
-  X(0x05fa9306), X(0x06309fb6), X(0x066793c5), X(0x069f6e93),
-  X(0x06d82f7c), X(0x0711d5d9), X(0x074c60fe), X(0x0787d03d),
-  X(0x07c422e4), X(0x0801583e), X(0x083f6f91), X(0x087e681f),
-  X(0x08be4129), X(0x08fef9ea), X(0x0940919a), X(0x0983076d),
-  X(0x09c65a92), X(0x0a0a8a38), X(0x0a4f9585), X(0x0a957b9f),
-  X(0x0adc3ba7), X(0x0b23d4b9), X(0x0b6c45ee), X(0x0bb58e5a),
-  X(0x0bffad0f), X(0x0c4aa11a), X(0x0c966982), X(0x0ce3054d),
-  X(0x0d30737b), X(0x0d7eb308), X(0x0dcdc2eb), X(0x0e1da21a),
-  X(0x0e6e4f83), X(0x0ebfca11), X(0x0f1210ad), X(0x0f652238),
-  X(0x0fb8fd91), X(0x100da192), X(0x10630d11), X(0x10b93ee0),
-  X(0x111035cb), X(0x1167f09a), X(0x11c06e13), X(0x1219acf5),
-  X(0x1273abfb), X(0x12ce69db), X(0x1329e54a), X(0x13861cf3),
-  X(0x13e30f80), X(0x1440bb97), X(0x149f1fd8), X(0x14fe3ade),
-  X(0x155e0b40), X(0x15be8f92), X(0x161fc662), X(0x1681ae38),
-  X(0x16e4459b), X(0x17478b0b), X(0x17ab7d03), X(0x181019fb),
-  X(0x18756067), X(0x18db4eb3), X(0x1941e34a), X(0x19a91c92),
-  X(0x1a10f8ea), X(0x1a7976af), X(0x1ae29439), X(0x1b4c4fda),
-  X(0x1bb6a7e2), X(0x1c219a9a), X(0x1c8d2649), X(0x1cf9492e),
-  X(0x1d660188), X(0x1dd34d8e), X(0x1e412b74), X(0x1eaf996a),
-  X(0x1f1e959b), X(0x1f8e1e2f), X(0x1ffe3146), X(0x206ecd01),
-  X(0x20dfef78), X(0x215196c2), X(0x21c3c0f0), X(0x22366c10),
-  X(0x22a9962a), X(0x231d3d45), X(0x23915f60), X(0x2405fa7a),
-  X(0x247b0c8c), X(0x24f09389), X(0x25668d65), X(0x25dcf80c),
-  X(0x2653d167), X(0x26cb175e), X(0x2742c7d0), X(0x27bae09e),
-  X(0x28335fa2), X(0x28ac42b3), X(0x292587a5), X(0x299f2c48),
-  X(0x2a192e69), X(0x2a938bd1), X(0x2b0e4247), X(0x2b894f8d),
-  X(0x2c04b164), X(0x2c806588), X(0x2cfc69b2), X(0x2d78bb9a),
-  X(0x2df558f4), X(0x2e723f6f), X(0x2eef6cbb), X(0x2f6cde83),
-  X(0x2fea9270), X(0x30688627), X(0x30e6b74e), X(0x31652385),
-  X(0x31e3c86b), X(0x3262a39e), X(0x32e1b2b8), X(0x3360f352),
-  X(0x33e06303), X(0x345fff5e), X(0x34dfc5f8), X(0x355fb462),
-  X(0x35dfc82a), X(0x365ffee0), X(0x36e0560f), X(0x3760cb43),
-  X(0x37e15c05), X(0x386205df), X(0x38e2c657), X(0x39639af5),
-  X(0x39e4813e), X(0x3a6576b6), X(0x3ae678e3), X(0x3b678547),
-  X(0x3be89965), X(0x3c69b2c1), X(0x3ceacedc), X(0x3d6beb37),
-  X(0x3ded0557), X(0x3e6e1abb), X(0x3eef28e6), X(0x3f702d5a),
-  X(0x3ff1259a), X(0x40720f29), X(0x40f2e789), X(0x4173ac3f),
-  X(0x41f45ad0), X(0x4274f0c2), X(0x42f56b9a), X(0x4375c8e0),
-  X(0x43f6061d), X(0x447620db), X(0x44f616a5), X(0x4575e509),
-  X(0x45f58994), X(0x467501d6), X(0x46f44b62), X(0x477363cb),
-  X(0x47f248a6), X(0x4870f78e), X(0x48ef6e1a), X(0x496da9e8),
-  X(0x49eba897), X(0x4a6967c8), X(0x4ae6e521), X(0x4b641e47),
-  X(0x4be110e5), X(0x4c5dbaa7), X(0x4cda193f), X(0x4d562a5f),
-  X(0x4dd1ebbd), X(0x4e4d5b15), X(0x4ec87623), X(0x4f433aa9),
-  X(0x4fbda66c), X(0x5037b734), X(0x50b16acf), X(0x512abf0e),
-  X(0x51a3b1c5), X(0x521c40ce), X(0x52946a06), X(0x530c2b50),
-  X(0x53838292), X(0x53fa6db8), X(0x5470eab3), X(0x54e6f776),
-  X(0x555c91fc), X(0x55d1b844), X(0x56466851), X(0x56baa02f),
-  X(0x572e5deb), X(0x57a19f98), X(0x58146352), X(0x5886a737),
-  X(0x58f8696d), X(0x5969a81c), X(0x59da6177), X(0x5a4a93b4),
-  X(0x5aba3d0f), X(0x5b295bcb), X(0x5b97ee30), X(0x5c05f28d),
-  X(0x5c736738), X(0x5ce04a8d), X(0x5d4c9aed), X(0x5db856c1),
-  X(0x5e237c78), X(0x5e8e0a89), X(0x5ef7ff6f), X(0x5f6159b0),
-  X(0x5fca17d4), X(0x6032386e), X(0x6099ba15), X(0x61009b69),
-  X(0x6166db11), X(0x61cc77b9), X(0x62317017), X(0x6295c2e7),
-  X(0x62f96eec), X(0x635c72f1), X(0x63becdc8), X(0x64207e4b),
-  X(0x6481835a), X(0x64e1dbde), X(0x654186c8), X(0x65a0830e),
-  X(0x65fecfb1), X(0x665c6bb7), X(0x66b95630), X(0x67158e30),
-  X(0x677112d7), X(0x67cbe34b), X(0x6825feb9), X(0x687f6456),
-  X(0x68d81361), X(0x69300b1e), X(0x69874ada), X(0x69ddd1ea),
-  X(0x6a339fab), X(0x6a88b382), X(0x6add0cdb), X(0x6b30ab2a),
-  X(0x6b838dec), X(0x6bd5b4a6), X(0x6c271ee2), X(0x6c77cc36),
-  X(0x6cc7bc3d), X(0x6d16ee9b), X(0x6d6562fb), X(0x6db31911),
-  X(0x6e001099), X(0x6e4c4955), X(0x6e97c311), X(0x6ee27d9f),
-  X(0x6f2c78d9), X(0x6f75b4a2), X(0x6fbe30e4), X(0x7005ed91),
-  X(0x704ceaa1), X(0x70932816), X(0x70d8a5f8), X(0x711d6457),
-  X(0x7161634b), X(0x71a4a2f3), X(0x71e72375), X(0x7228e500),
-  X(0x7269e7c8), X(0x72aa2c0a), X(0x72e9b209), X(0x73287a12),
-  X(0x73668476), X(0x73a3d18f), X(0x73e061bc), X(0x741c3566),
-  X(0x74574cfa), X(0x7491a8ee), X(0x74cb49be), X(0x75042fec),
-  X(0x753c5c03), X(0x7573ce92), X(0x75aa882f), X(0x75e08979),
-  X(0x7615d313), X(0x764a65a7), X(0x767e41e5), X(0x76b16884),
-  X(0x76e3da40), X(0x771597dc), X(0x7746a221), X(0x7776f9dd),
-  X(0x77a69fe6), X(0x77d59514), X(0x7803da49), X(0x7831706a),
-  X(0x785e5861), X(0x788a9320), X(0x78b6219c), X(0x78e104cf),
-  X(0x790b3dbb), X(0x7934cd64), X(0x795db4d5), X(0x7985f51d),
-  X(0x79ad8f50), X(0x79d48486), X(0x79fad5de), X(0x7a208478),
-  X(0x7a45917b), X(0x7a69fe12), X(0x7a8dcb6c), X(0x7ab0fabb),
-  X(0x7ad38d36), X(0x7af5841a), X(0x7b16e0a3), X(0x7b37a416),
-  X(0x7b57cfb8), X(0x7b7764d4), X(0x7b9664b6), X(0x7bb4d0b0),
-  X(0x7bd2aa14), X(0x7beff23b), X(0x7c0caa7f), X(0x7c28d43c),
-  X(0x7c4470d2), X(0x7c5f81a5), X(0x7c7a081a), X(0x7c940598),
-  X(0x7cad7b8b), X(0x7cc66b5e), X(0x7cded680), X(0x7cf6be64),
-  X(0x7d0e247b), X(0x7d250a3c), X(0x7d3b711c), X(0x7d515a95),
-  X(0x7d66c822), X(0x7d7bbb3c), X(0x7d903563), X(0x7da43814),
-  X(0x7db7c4d0), X(0x7dcadd16), X(0x7ddd826a), X(0x7defb64d),
-  X(0x7e017a44), X(0x7e12cfd3), X(0x7e23b87f), X(0x7e3435cc),
-  X(0x7e444943), X(0x7e53f467), X(0x7e6338c0), X(0x7e7217d5),
-  X(0x7e80932b), X(0x7e8eac49), X(0x7e9c64b7), X(0x7ea9bdf8),
-  X(0x7eb6b994), X(0x7ec35910), X(0x7ecf9def), X(0x7edb89b6),
-  X(0x7ee71de9), X(0x7ef25c09), X(0x7efd4598), X(0x7f07dc16),
-  X(0x7f122103), X(0x7f1c15dc), X(0x7f25bc1f), X(0x7f2f1547),
-  X(0x7f3822cd), X(0x7f40e62b), X(0x7f4960d6), X(0x7f519443),
-  X(0x7f5981e7), X(0x7f612b31), X(0x7f689191), X(0x7f6fb674),
-  X(0x7f769b45), X(0x7f7d416c), X(0x7f83aa51), X(0x7f89d757),
-  X(0x7f8fc9df), X(0x7f958348), X(0x7f9b04ef), X(0x7fa0502e),
-  X(0x7fa56659), X(0x7faa48c7), X(0x7faef8c7), X(0x7fb377a7),
-  X(0x7fb7c6b3), X(0x7fbbe732), X(0x7fbfda67), X(0x7fc3a196),
-  X(0x7fc73dfa), X(0x7fcab0ce), X(0x7fcdfb4a), X(0x7fd11ea0),
-  X(0x7fd41c00), X(0x7fd6f496), X(0x7fd9a989), X(0x7fdc3bff),
-  X(0x7fdead17), X(0x7fe0fdee), X(0x7fe32f9d), X(0x7fe54337),
-  X(0x7fe739ce), X(0x7fe9146c), X(0x7fead41b), X(0x7fec79dd),
-  X(0x7fee06b2), X(0x7fef7b94), X(0x7ff0d97b), X(0x7ff22158),
-  X(0x7ff35417), X(0x7ff472a3), X(0x7ff57de0), X(0x7ff676ac),
-  X(0x7ff75de3), X(0x7ff8345a), X(0x7ff8fae4), X(0x7ff9b24b),
-  X(0x7ffa5b58), X(0x7ffaf6cd), X(0x7ffb8568), X(0x7ffc07e2),
-  X(0x7ffc7eed), X(0x7ffceb38), X(0x7ffd4d6d), X(0x7ffda631),
-  X(0x7ffdf621), X(0x7ffe3dd8), X(0x7ffe7dea), X(0x7ffeb6e7),
-  X(0x7ffee959), X(0x7fff15c4), X(0x7fff3ca9), X(0x7fff5e80),
-  X(0x7fff7bc0), X(0x7fff94d6), X(0x7fffaa2d), X(0x7fffbc29),
-  X(0x7fffcb29), X(0x7fffd786), X(0x7fffe195), X(0x7fffe9a3),
-  X(0x7fffeffa), X(0x7ffff4dd), X(0x7ffff889), X(0x7ffffb37),
-  X(0x7ffffd1a), X(0x7ffffe5d), X(0x7fffff29), X(0x7fffffa0),
-  X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff),
-};
-
-static LOOKUP_T vwin2048[1024] = {
-  X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3),
-  X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007),
-  X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),
-  X(0x0012ec23), X(0x00161216), X(0x001975fe), X(0x001d17da),
-  X(0x0020f7a8), X(0x00251564), X(0x0029710c), X(0x002e0a9e),
-  X(0x0032e217), X(0x0037f773), X(0x003d4ab0), X(0x0042dbca),
-  X(0x0048aabe), X(0x004eb788), X(0x00550224), X(0x005b8a8f),
-  X(0x006250c5), X(0x006954c1), X(0x0070967e), X(0x007815f9),
-  X(0x007fd32c), X(0x0087ce13), X(0x009006a9), X(0x00987ce9),
-  X(0x00a130cc), X(0x00aa224f), X(0x00b3516b), X(0x00bcbe1a),
-  X(0x00c66856), X(0x00d0501a), X(0x00da755f), X(0x00e4d81f),
-  X(0x00ef7853), X(0x00fa55f4), X(0x010570fc), X(0x0110c963),
-  X(0x011c5f22), X(0x01283232), X(0x0134428c), X(0x01409027),
-  X(0x014d1afb), X(0x0159e302), X(0x0166e831), X(0x01742a82),
-  X(0x0181a9ec), X(0x018f6665), X(0x019d5fe5), X(0x01ab9663),
-  X(0x01ba09d6), X(0x01c8ba34), X(0x01d7a775), X(0x01e6d18d),
-  X(0x01f63873), X(0x0205dc1e), X(0x0215bc82), X(0x0225d997),
-  X(0x02363350), X(0x0246c9a3), X(0x02579c86), X(0x0268abed),
-  X(0x0279f7cc), X(0x028b801a), X(0x029d44c9), X(0x02af45ce),
-  X(0x02c1831d), X(0x02d3fcaa), X(0x02e6b269), X(0x02f9a44c),
-  X(0x030cd248), X(0x03203c4f), X(0x0333e255), X(0x0347c44b),
-  X(0x035be225), X(0x03703bd5), X(0x0384d14d), X(0x0399a280),
-  X(0x03aeaf5e), X(0x03c3f7d9), X(0x03d97be4), X(0x03ef3b6e),
-  X(0x0405366a), X(0x041b6cc8), X(0x0431de78), X(0x04488b6c),
-  X(0x045f7393), X(0x047696dd), X(0x048df53b), X(0x04a58e9b),
-  X(0x04bd62ee), X(0x04d57223), X(0x04edbc28), X(0x050640ed),
-  X(0x051f0060), X(0x0537fa70), X(0x05512f0a), X(0x056a9e1e),
-  X(0x05844798), X(0x059e2b67), X(0x05b84978), X(0x05d2a1b8),
-  X(0x05ed3414), X(0x06080079), X(0x062306d3), X(0x063e470f),
-  X(0x0659c119), X(0x067574dd), X(0x06916247), X(0x06ad8941),
-  X(0x06c9e9b8), X(0x06e68397), X(0x070356c8), X(0x07206336),
-  X(0x073da8cb), X(0x075b2772), X(0x0778df15), X(0x0796cf9c),
-  X(0x07b4f8f3), X(0x07d35b01), X(0x07f1f5b1), X(0x0810c8eb),
-  X(0x082fd497), X(0x084f189e), X(0x086e94e9), X(0x088e495e),
-  X(0x08ae35e6), X(0x08ce5a68), X(0x08eeb6cc), X(0x090f4af8),
-  X(0x093016d3), X(0x09511a44), X(0x09725530), X(0x0993c77f),
-  X(0x09b57115), X(0x09d751d8), X(0x09f969ae), X(0x0a1bb87c),
-  X(0x0a3e3e26), X(0x0a60fa91), X(0x0a83eda2), X(0x0aa7173c),
-  X(0x0aca7743), X(0x0aee0d9b), X(0x0b11da28), X(0x0b35dccc),
-  X(0x0b5a156a), X(0x0b7e83e5), X(0x0ba3281f), X(0x0bc801fa),
-  X(0x0bed1159), X(0x0c12561c), X(0x0c37d025), X(0x0c5d7f55),
-  X(0x0c83638d), X(0x0ca97cae), X(0x0ccfca97), X(0x0cf64d2a),
-  X(0x0d1d0444), X(0x0d43efc7), X(0x0d6b0f92), X(0x0d926383),
-  X(0x0db9eb79), X(0x0de1a752), X(0x0e0996ee), X(0x0e31ba29),
-  X(0x0e5a10e2), X(0x0e829af6), X(0x0eab5841), X(0x0ed448a2),
-  X(0x0efd6bf4), X(0x0f26c214), X(0x0f504ade), X(0x0f7a062e),
-  X(0x0fa3f3df), X(0x0fce13cd), X(0x0ff865d2), X(0x1022e9ca),
-  X(0x104d9f8e), X(0x107886f9), X(0x10a39fe5), X(0x10ceea2c),
-  X(0x10fa65a6), X(0x1126122d), X(0x1151ef9a), X(0x117dfdc5),
-  X(0x11aa3c87), X(0x11d6abb6), X(0x12034b2c), X(0x12301ac0),
-  X(0x125d1a48), X(0x128a499b), X(0x12b7a891), X(0x12e536ff),
-  X(0x1312f4bb), X(0x1340e19c), X(0x136efd75), X(0x139d481e),
-  X(0x13cbc16a), X(0x13fa692f), X(0x14293f40), X(0x14584371),
-  X(0x14877597), X(0x14b6d585), X(0x14e6630d), X(0x15161e04),
-  X(0x1546063b), X(0x15761b85), X(0x15a65db3), X(0x15d6cc99),
-  X(0x16076806), X(0x16382fcd), X(0x166923bf), X(0x169a43ab),
-  X(0x16cb8f62), X(0x16fd06b5), X(0x172ea973), X(0x1760776b),
-  X(0x1792706e), X(0x17c49449), X(0x17f6e2cb), X(0x18295bc3),
-  X(0x185bfeff), X(0x188ecc4c), X(0x18c1c379), X(0x18f4e452),
-  X(0x19282ea4), X(0x195ba23c), X(0x198f3ee6), X(0x19c3046e),
-  X(0x19f6f2a1), X(0x1a2b094a), X(0x1a5f4833), X(0x1a93af28),
-  X(0x1ac83df3), X(0x1afcf460), X(0x1b31d237), X(0x1b66d744),
-  X(0x1b9c034e), X(0x1bd15621), X(0x1c06cf84), X(0x1c3c6f40),
-  X(0x1c72351e), X(0x1ca820e6), X(0x1cde3260), X(0x1d146953),
-  X(0x1d4ac587), X(0x1d8146c3), X(0x1db7eccd), X(0x1deeb76c),
-  X(0x1e25a667), X(0x1e5cb982), X(0x1e93f085), X(0x1ecb4b33),
-  X(0x1f02c953), X(0x1f3a6aaa), X(0x1f722efb), X(0x1faa160b),
-  X(0x1fe21f9e), X(0x201a4b79), X(0x2052995d), X(0x208b0910),
-  X(0x20c39a53), X(0x20fc4cea), X(0x21352097), X(0x216e151c),
-  X(0x21a72a3a), X(0x21e05fb5), X(0x2219b54d), X(0x22532ac3),
-  X(0x228cbfd8), X(0x22c6744d), X(0x230047e2), X(0x233a3a58),
-  X(0x23744b6d), X(0x23ae7ae3), X(0x23e8c878), X(0x242333ec),
-  X(0x245dbcfd), X(0x24986369), X(0x24d326f1), X(0x250e0750),
-  X(0x25490446), X(0x25841d90), X(0x25bf52ec), X(0x25faa417),
-  X(0x263610cd), X(0x267198cc), X(0x26ad3bcf), X(0x26e8f994),
-  X(0x2724d1d6), X(0x2760c451), X(0x279cd0c0), X(0x27d8f6e0),
-  X(0x2815366a), X(0x28518f1b), X(0x288e00ac), X(0x28ca8ad8),
-  X(0x29072d5a), X(0x2943e7eb), X(0x2980ba45), X(0x29bda422),
-  X(0x29faa53c), X(0x2a37bd4a), X(0x2a74ec07), X(0x2ab2312b),
-  X(0x2aef8c6f), X(0x2b2cfd8b), X(0x2b6a8437), X(0x2ba8202c),
-  X(0x2be5d120), X(0x2c2396cc), X(0x2c6170e7), X(0x2c9f5f29),
-  X(0x2cdd6147), X(0x2d1b76fa), X(0x2d599ff7), X(0x2d97dbf5),
-  X(0x2dd62aab), X(0x2e148bcf), X(0x2e52ff16), X(0x2e918436),
-  X(0x2ed01ae5), X(0x2f0ec2d9), X(0x2f4d7bc6), X(0x2f8c4562),
-  X(0x2fcb1f62), X(0x300a097a), X(0x3049035f), X(0x30880cc6),
-  X(0x30c72563), X(0x31064cea), X(0x3145830f), X(0x3184c786),
-  X(0x31c41a03), X(0x32037a39), X(0x3242e7dc), X(0x3282629f),
-  X(0x32c1ea36), X(0x33017e53), X(0x33411ea9), X(0x3380caec),
-  X(0x33c082ce), X(0x34004602), X(0x34401439), X(0x347fed27),
-  X(0x34bfd07e), X(0x34ffbdf0), X(0x353fb52e), X(0x357fb5ec),
-  X(0x35bfbfda), X(0x35ffd2aa), X(0x363fee0f), X(0x368011b9),
-  X(0x36c03d5a), X(0x370070a4), X(0x3740ab48), X(0x3780ecf7),
-  X(0x37c13562), X(0x3801843a), X(0x3841d931), X(0x388233f7),
-  X(0x38c2943d), X(0x3902f9b4), X(0x3943640d), X(0x3983d2f8),
-  X(0x39c44626), X(0x3a04bd48), X(0x3a45380e), X(0x3a85b62a),
-  X(0x3ac6374a), X(0x3b06bb20), X(0x3b47415c), X(0x3b87c9ae),
-  X(0x3bc853c7), X(0x3c08df57), X(0x3c496c0f), X(0x3c89f99f),
-  X(0x3cca87b6), X(0x3d0b1605), X(0x3d4ba43d), X(0x3d8c320e),
-  X(0x3dccbf27), X(0x3e0d4b3a), X(0x3e4dd5f6), X(0x3e8e5f0c),
-  X(0x3ecee62b), X(0x3f0f6b05), X(0x3f4fed49), X(0x3f906ca8),
-  X(0x3fd0e8d2), X(0x40116177), X(0x4051d648), X(0x409246f6),
-  X(0x40d2b330), X(0x41131aa7), X(0x41537d0c), X(0x4193da10),
-  X(0x41d43162), X(0x421482b4), X(0x4254cdb7), X(0x4295121b),
-  X(0x42d54f91), X(0x431585ca), X(0x4355b477), X(0x4395db49),
-  X(0x43d5f9f1), X(0x44161021), X(0x44561d8a), X(0x449621dd),
-  X(0x44d61ccc), X(0x45160e08), X(0x4555f544), X(0x4595d230),
-  X(0x45d5a47f), X(0x46156be3), X(0x4655280e), X(0x4694d8b2),
-  X(0x46d47d82), X(0x4714162f), X(0x4753a26d), X(0x479321ef),
-  X(0x47d29466), X(0x4811f987), X(0x48515104), X(0x48909a91),
-  X(0x48cfd5e1), X(0x490f02a7), X(0x494e2098), X(0x498d2f66),
-  X(0x49cc2ec7), X(0x4a0b1e6f), X(0x4a49fe11), X(0x4a88cd62),
-  X(0x4ac78c18), X(0x4b0639e6), X(0x4b44d683), X(0x4b8361a2),
-  X(0x4bc1dafa), X(0x4c004241), X(0x4c3e972c), X(0x4c7cd970),
-  X(0x4cbb08c5), X(0x4cf924e1), X(0x4d372d7a), X(0x4d752247),
-  X(0x4db30300), X(0x4df0cf5a), X(0x4e2e870f), X(0x4e6c29d6),
-  X(0x4ea9b766), X(0x4ee72f78), X(0x4f2491c4), X(0x4f61de02),
-  X(0x4f9f13ec), X(0x4fdc333b), X(0x50193ba8), X(0x50562ced),
-  X(0x509306c3), X(0x50cfc8e5), X(0x510c730d), X(0x514904f6),
-  X(0x51857e5a), X(0x51c1def5), X(0x51fe2682), X(0x523a54bc),
-  X(0x52766961), X(0x52b2642c), X(0x52ee44d9), X(0x532a0b26),
-  X(0x5365b6d0), X(0x53a14793), X(0x53dcbd2f), X(0x54181760),
-  X(0x545355e5), X(0x548e787d), X(0x54c97ee6), X(0x550468e1),
-  X(0x553f362c), X(0x5579e687), X(0x55b479b3), X(0x55eeef70),
-  X(0x5629477f), X(0x566381a1), X(0x569d9d97), X(0x56d79b24),
-  X(0x57117a0a), X(0x574b3a0a), X(0x5784dae9), X(0x57be5c69),
-  X(0x57f7be4d), X(0x5831005a), X(0x586a2254), X(0x58a32400),
-  X(0x58dc0522), X(0x5914c57f), X(0x594d64de), X(0x5985e305),
-  X(0x59be3fba), X(0x59f67ac3), X(0x5a2e93e9), X(0x5a668af2),
-  X(0x5a9e5fa6), X(0x5ad611ce), X(0x5b0da133), X(0x5b450d9d),
-  X(0x5b7c56d7), X(0x5bb37ca9), X(0x5bea7ede), X(0x5c215d41),
-  X(0x5c58179d), X(0x5c8eadbe), X(0x5cc51f6f), X(0x5cfb6c7c),
-  X(0x5d3194b2), X(0x5d6797de), X(0x5d9d75cf), X(0x5dd32e51),
-  X(0x5e08c132), X(0x5e3e2e43), X(0x5e737551), X(0x5ea8962d),
-  X(0x5edd90a7), X(0x5f12648e), X(0x5f4711b4), X(0x5f7b97ea),
-  X(0x5faff702), X(0x5fe42ece), X(0x60183f20), X(0x604c27cc),
-  X(0x607fe8a6), X(0x60b38180), X(0x60e6f22f), X(0x611a3a89),
-  X(0x614d5a62), X(0x61805190), X(0x61b31fe9), X(0x61e5c545),
-  X(0x62184179), X(0x624a945d), X(0x627cbdca), X(0x62aebd98),
-  X(0x62e0939f), X(0x63123fba), X(0x6343c1c1), X(0x6375198f),
-  X(0x63a646ff), X(0x63d749ec), X(0x64082232), X(0x6438cfad),
-  X(0x64695238), X(0x6499a9b3), X(0x64c9d5f9), X(0x64f9d6ea),
-  X(0x6529ac63), X(0x65595643), X(0x6588d46a), X(0x65b826b8),
-  X(0x65e74d0e), X(0x6616474b), X(0x66451552), X(0x6673b704),
-  X(0x66a22c44), X(0x66d074f4), X(0x66fe90f8), X(0x672c8033),
-  X(0x675a428a), X(0x6787d7e1), X(0x67b5401f), X(0x67e27b27),
-  X(0x680f88e1), X(0x683c6934), X(0x68691c05), X(0x6895a13e),
-  X(0x68c1f8c7), X(0x68ee2287), X(0x691a1e68), X(0x6945ec54),
-  X(0x69718c35), X(0x699cfdf5), X(0x69c8417f), X(0x69f356c0),
-  X(0x6a1e3da3), X(0x6a48f615), X(0x6a738002), X(0x6a9ddb5a),
-  X(0x6ac80808), X(0x6af205fd), X(0x6b1bd526), X(0x6b457575),
-  X(0x6b6ee6d8), X(0x6b982940), X(0x6bc13c9f), X(0x6bea20e5),
-  X(0x6c12d605), X(0x6c3b5bf1), X(0x6c63b29c), X(0x6c8bd9fb),
-  X(0x6cb3d200), X(0x6cdb9aa0), X(0x6d0333d0), X(0x6d2a9d86),
-  X(0x6d51d7b7), X(0x6d78e25a), X(0x6d9fbd67), X(0x6dc668d3),
-  X(0x6dece498), X(0x6e1330ad), X(0x6e394d0c), X(0x6e5f39ae),
-  X(0x6e84f68d), X(0x6eaa83a2), X(0x6ecfe0ea), X(0x6ef50e5e),
-  X(0x6f1a0bfc), X(0x6f3ed9bf), X(0x6f6377a4), X(0x6f87e5a8),
-  X(0x6fac23c9), X(0x6fd03206), X(0x6ff4105c), X(0x7017becc),
-  X(0x703b3d54), X(0x705e8bf5), X(0x7081aaaf), X(0x70a49984),
-  X(0x70c75874), X(0x70e9e783), X(0x710c46b2), X(0x712e7605),
-  X(0x7150757f), X(0x71724523), X(0x7193e4f6), X(0x71b554fd),
-  X(0x71d6953e), X(0x71f7a5bd), X(0x72188681), X(0x72393792),
-  X(0x7259b8f5), X(0x727a0ab2), X(0x729a2cd2), X(0x72ba1f5d),
-  X(0x72d9e25c), X(0x72f975d8), X(0x7318d9db), X(0x73380e6f),
-  X(0x735713a0), X(0x7375e978), X(0x73949003), X(0x73b3074c),
-  X(0x73d14f61), X(0x73ef684f), X(0x740d5222), X(0x742b0ce9),
-  X(0x744898b1), X(0x7465f589), X(0x74832381), X(0x74a022a8),
-  X(0x74bcf30e), X(0x74d994c3), X(0x74f607d8), X(0x75124c5f),
-  X(0x752e6268), X(0x754a4a05), X(0x7566034b), X(0x75818e4a),
-  X(0x759ceb16), X(0x75b819c4), X(0x75d31a66), X(0x75eded12),
-  X(0x760891dc), X(0x762308da), X(0x763d5221), X(0x76576dc8),
-  X(0x76715be4), X(0x768b1c8c), X(0x76a4afd9), X(0x76be15e0),
-  X(0x76d74ebb), X(0x76f05a82), X(0x7709394d), X(0x7721eb35),
-  X(0x773a7054), X(0x7752c8c4), X(0x776af49f), X(0x7782f400),
-  X(0x779ac701), X(0x77b26dbd), X(0x77c9e851), X(0x77e136d8),
-  X(0x77f8596f), X(0x780f5032), X(0x78261b3f), X(0x783cbab2),
-  X(0x78532eaa), X(0x78697745), X(0x787f94a0), X(0x789586db),
-  X(0x78ab4e15), X(0x78c0ea6d), X(0x78d65c03), X(0x78eba2f7),
-  X(0x7900bf68), X(0x7915b179), X(0x792a7949), X(0x793f16fb),
-  X(0x79538aaf), X(0x7967d488), X(0x797bf4a8), X(0x798feb31),
-  X(0x79a3b846), X(0x79b75c0a), X(0x79cad6a1), X(0x79de282e),
-  X(0x79f150d5), X(0x7a0450bb), X(0x7a172803), X(0x7a29d6d3),
-  X(0x7a3c5d50), X(0x7a4ebb9f), X(0x7a60f1e6), X(0x7a73004a),
-  X(0x7a84e6f2), X(0x7a96a604), X(0x7aa83da7), X(0x7ab9ae01),
-  X(0x7acaf73a), X(0x7adc1979), X(0x7aed14e6), X(0x7afde9a8),
-  X(0x7b0e97e8), X(0x7b1f1fcd), X(0x7b2f8182), X(0x7b3fbd2d),
-  X(0x7b4fd2f9), X(0x7b5fc30f), X(0x7b6f8d98), X(0x7b7f32bd),
-  X(0x7b8eb2a9), X(0x7b9e0d85), X(0x7bad437d), X(0x7bbc54b9),
-  X(0x7bcb4166), X(0x7bda09ae), X(0x7be8adbc), X(0x7bf72dbc),
-  X(0x7c0589d8), X(0x7c13c23d), X(0x7c21d716), X(0x7c2fc88f),
-  X(0x7c3d96d5), X(0x7c4b4214), X(0x7c58ca78), X(0x7c66302d),
-  X(0x7c737362), X(0x7c809443), X(0x7c8d92fc), X(0x7c9a6fbc),
-  X(0x7ca72aaf), X(0x7cb3c404), X(0x7cc03be8), X(0x7ccc9288),
-  X(0x7cd8c814), X(0x7ce4dcb9), X(0x7cf0d0a5), X(0x7cfca406),
-  X(0x7d08570c), X(0x7d13e9e5), X(0x7d1f5cbf), X(0x7d2aafca),
-  X(0x7d35e335), X(0x7d40f72e), X(0x7d4bebe4), X(0x7d56c188),
-  X(0x7d617848), X(0x7d6c1054), X(0x7d7689db), X(0x7d80e50e),
-  X(0x7d8b221b), X(0x7d954133), X(0x7d9f4286), X(0x7da92643),
-  X(0x7db2ec9b), X(0x7dbc95bd), X(0x7dc621da), X(0x7dcf9123),
-  X(0x7dd8e3c6), X(0x7de219f6), X(0x7deb33e2), X(0x7df431ba),
-  X(0x7dfd13af), X(0x7e05d9f2), X(0x7e0e84b4), X(0x7e171424),
-  X(0x7e1f8874), X(0x7e27e1d4), X(0x7e302074), X(0x7e384487),
-  X(0x7e404e3c), X(0x7e483dc4), X(0x7e501350), X(0x7e57cf11),
-  X(0x7e5f7138), X(0x7e66f9f4), X(0x7e6e6979), X(0x7e75bff5),
-  X(0x7e7cfd9a), X(0x7e842298), X(0x7e8b2f22), X(0x7e922366),
-  X(0x7e98ff97), X(0x7e9fc3e4), X(0x7ea6707f), X(0x7ead0598),
-  X(0x7eb38360), X(0x7eb9ea07), X(0x7ec039bf), X(0x7ec672b7),
-  X(0x7ecc9521), X(0x7ed2a12c), X(0x7ed8970a), X(0x7ede76ea),
-  X(0x7ee440fd), X(0x7ee9f573), X(0x7eef947d), X(0x7ef51e4b),
-  X(0x7efa930d), X(0x7efff2f2), X(0x7f053e2b), X(0x7f0a74e8),
-  X(0x7f0f9758), X(0x7f14a5ac), X(0x7f19a013), X(0x7f1e86bc),
-  X(0x7f2359d8), X(0x7f281995), X(0x7f2cc623), X(0x7f315fb1),
-  X(0x7f35e66e), X(0x7f3a5a8a), X(0x7f3ebc33), X(0x7f430b98),
-  X(0x7f4748e7), X(0x7f4b7450), X(0x7f4f8e01), X(0x7f539629),
-  X(0x7f578cf5), X(0x7f5b7293), X(0x7f5f4732), X(0x7f630b00),
-  X(0x7f66be2b), X(0x7f6a60df), X(0x7f6df34b), X(0x7f71759b),
-  X(0x7f74e7fe), X(0x7f784aa0), X(0x7f7b9daf), X(0x7f7ee156),
-  X(0x7f8215c3), X(0x7f853b22), X(0x7f88519f), X(0x7f8b5967),
-  X(0x7f8e52a6), X(0x7f913d87), X(0x7f941a36), X(0x7f96e8df),
-  X(0x7f99a9ad), X(0x7f9c5ccb), X(0x7f9f0265), X(0x7fa19aa5),
-  X(0x7fa425b5), X(0x7fa6a3c1), X(0x7fa914f3), X(0x7fab7974),
-  X(0x7fadd16f), X(0x7fb01d0d), X(0x7fb25c78), X(0x7fb48fd9),
-  X(0x7fb6b75a), X(0x7fb8d323), X(0x7fbae35d), X(0x7fbce831),
-  X(0x7fbee1c7), X(0x7fc0d047), X(0x7fc2b3d9), X(0x7fc48ca5),
-  X(0x7fc65ad3), X(0x7fc81e88), X(0x7fc9d7ee), X(0x7fcb872a),
-  X(0x7fcd2c63), X(0x7fcec7bf), X(0x7fd05966), X(0x7fd1e17c),
-  X(0x7fd36027), X(0x7fd4d58d), X(0x7fd641d3), X(0x7fd7a51e),
-  X(0x7fd8ff94), X(0x7fda5157), X(0x7fdb9a8e), X(0x7fdcdb5b),
-  X(0x7fde13e2), X(0x7fdf4448), X(0x7fe06caf), X(0x7fe18d3b),
-  X(0x7fe2a60e), X(0x7fe3b74b), X(0x7fe4c114), X(0x7fe5c38b),
-  X(0x7fe6bed2), X(0x7fe7b30a), X(0x7fe8a055), X(0x7fe986d4),
-  X(0x7fea66a7), X(0x7feb3ff0), X(0x7fec12cd), X(0x7fecdf5f),
-  X(0x7feda5c5), X(0x7fee6620), X(0x7fef208d), X(0x7fefd52c),
-  X(0x7ff0841c), X(0x7ff12d7a), X(0x7ff1d164), X(0x7ff26ff9),
-  X(0x7ff30955), X(0x7ff39d96), X(0x7ff42cd9), X(0x7ff4b739),
-  X(0x7ff53cd4), X(0x7ff5bdc5), X(0x7ff63a28), X(0x7ff6b217),
-  X(0x7ff725af), X(0x7ff7950a), X(0x7ff80043), X(0x7ff86773),
-  X(0x7ff8cab4), X(0x7ff92a21), X(0x7ff985d1), X(0x7ff9dddf),
-  X(0x7ffa3262), X(0x7ffa8374), X(0x7ffad12c), X(0x7ffb1ba1),
-  X(0x7ffb62ec), X(0x7ffba723), X(0x7ffbe85c), X(0x7ffc26b0),
-  X(0x7ffc6233), X(0x7ffc9afb), X(0x7ffcd11e), X(0x7ffd04b1),
-  X(0x7ffd35c9), X(0x7ffd647b), X(0x7ffd90da), X(0x7ffdbafa),
-  X(0x7ffde2f0), X(0x7ffe08ce), X(0x7ffe2ca7), X(0x7ffe4e8e),
-  X(0x7ffe6e95), X(0x7ffe8cce), X(0x7ffea94a), X(0x7ffec41b),
-  X(0x7ffedd52), X(0x7ffef4ff), X(0x7fff0b33), X(0x7fff1ffd),
-  X(0x7fff336e), X(0x7fff4593), X(0x7fff567d), X(0x7fff663a),
-  X(0x7fff74d8), X(0x7fff8265), X(0x7fff8eee), X(0x7fff9a81),
-  X(0x7fffa52b), X(0x7fffaef8), X(0x7fffb7f5), X(0x7fffc02d),
-  X(0x7fffc7ab), X(0x7fffce7c), X(0x7fffd4a9), X(0x7fffda3e),
-  X(0x7fffdf44), X(0x7fffe3c6), X(0x7fffe7cc), X(0x7fffeb60),
-  X(0x7fffee8a), X(0x7ffff153), X(0x7ffff3c4), X(0x7ffff5e3),
-  X(0x7ffff7b8), X(0x7ffff94b), X(0x7ffffaa1), X(0x7ffffbc1),
-  X(0x7ffffcb2), X(0x7ffffd78), X(0x7ffffe19), X(0x7ffffe9a),
-  X(0x7ffffeff), X(0x7fffff4e), X(0x7fffff89), X(0x7fffffb3),
-  X(0x7fffffd2), X(0x7fffffe6), X(0x7ffffff3), X(0x7ffffffa),
-  X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
-};
-
-static LOOKUP_T vwin4096[2048] = {
-  X(0x000001f0), X(0x00001171), X(0x00003072), X(0x00005ef5),
-  X(0x00009cf8), X(0x0000ea7c), X(0x00014780), X(0x0001b405),
-  X(0x0002300b), X(0x0002bb91), X(0x00035698), X(0x0004011e),
-  X(0x0004bb25), X(0x000584ac), X(0x00065db3), X(0x0007463a),
-  X(0x00083e41), X(0x000945c7), X(0x000a5ccc), X(0x000b8350),
-  X(0x000cb954), X(0x000dfed7), X(0x000f53d8), X(0x0010b857),
-  X(0x00122c55), X(0x0013afd1), X(0x001542ca), X(0x0016e541),
-  X(0x00189735), X(0x001a58a7), X(0x001c2995), X(0x001e09ff),
-  X(0x001ff9e6), X(0x0021f948), X(0x00240826), X(0x00262680),
-  X(0x00285454), X(0x002a91a3), X(0x002cde6c), X(0x002f3aaf),
-  X(0x0031a66b), X(0x003421a0), X(0x0036ac4f), X(0x00394675),
-  X(0x003bf014), X(0x003ea92a), X(0x004171b7), X(0x004449bb),
-  X(0x00473135), X(0x004a2824), X(0x004d2e8a), X(0x00504463),
-  X(0x005369b2), X(0x00569e74), X(0x0059e2aa), X(0x005d3652),
-  X(0x0060996d), X(0x00640bf9), X(0x00678df7), X(0x006b1f66),
-  X(0x006ec045), X(0x00727093), X(0x00763051), X(0x0079ff7d),
-  X(0x007dde16), X(0x0081cc1d), X(0x0085c991), X(0x0089d671),
-  X(0x008df2bc), X(0x00921e71), X(0x00965991), X(0x009aa41a),
-  X(0x009efe0c), X(0x00a36766), X(0x00a7e028), X(0x00ac6850),
-  X(0x00b0ffde), X(0x00b5a6d1), X(0x00ba5d28), X(0x00bf22e4),
-  X(0x00c3f802), X(0x00c8dc83), X(0x00cdd065), X(0x00d2d3a8),
-  X(0x00d7e64a), X(0x00dd084c), X(0x00e239ac), X(0x00e77a69),
-  X(0x00ecca83), X(0x00f229f9), X(0x00f798ca), X(0x00fd16f5),
-  X(0x0102a479), X(0x01084155), X(0x010ded89), X(0x0113a913),
-  X(0x011973f3), X(0x011f4e27), X(0x012537af), X(0x012b308a),
-  X(0x013138b7), X(0x01375035), X(0x013d7702), X(0x0143ad1f),
-  X(0x0149f289), X(0x01504741), X(0x0156ab44), X(0x015d1e92),
-  X(0x0163a12a), X(0x016a330b), X(0x0170d433), X(0x017784a3),
-  X(0x017e4458), X(0x01851351), X(0x018bf18e), X(0x0192df0d),
-  X(0x0199dbcd), X(0x01a0e7cd), X(0x01a8030c), X(0x01af2d89),
-  X(0x01b66743), X(0x01bdb038), X(0x01c50867), X(0x01cc6fd0),
-  X(0x01d3e670), X(0x01db6c47), X(0x01e30153), X(0x01eaa593),
-  X(0x01f25907), X(0x01fa1bac), X(0x0201ed81), X(0x0209ce86),
-  X(0x0211beb8), X(0x0219be17), X(0x0221cca2), X(0x0229ea56),
-  X(0x02321733), X(0x023a5337), X(0x02429e60), X(0x024af8af),
-  X(0x02536220), X(0x025bdab3), X(0x02646267), X(0x026cf93a),
-  X(0x02759f2a), X(0x027e5436), X(0x0287185d), X(0x028feb9d),
-  X(0x0298cdf4), X(0x02a1bf62), X(0x02aabfe5), X(0x02b3cf7b),
-  X(0x02bcee23), X(0x02c61bdb), X(0x02cf58a2), X(0x02d8a475),
-  X(0x02e1ff55), X(0x02eb693e), X(0x02f4e230), X(0x02fe6a29),
-  X(0x03080127), X(0x0311a729), X(0x031b5c2d), X(0x03252031),
-  X(0x032ef334), X(0x0338d534), X(0x0342c630), X(0x034cc625),
-  X(0x0356d512), X(0x0360f2f6), X(0x036b1fce), X(0x03755b99),
-  X(0x037fa655), X(0x038a0001), X(0x0394689a), X(0x039ee020),
-  X(0x03a9668f), X(0x03b3fbe6), X(0x03bea024), X(0x03c95347),
-  X(0x03d4154d), X(0x03dee633), X(0x03e9c5f9), X(0x03f4b49b),
-  X(0x03ffb219), X(0x040abe71), X(0x0415d9a0), X(0x042103a5),
-  X(0x042c3c7d), X(0x04378428), X(0x0442daa2), X(0x044e3fea),
-  X(0x0459b3fd), X(0x046536db), X(0x0470c880), X(0x047c68eb),
-  X(0x0488181a), X(0x0493d60b), X(0x049fa2bc), X(0x04ab7e2a),
-  X(0x04b76854), X(0x04c36137), X(0x04cf68d1), X(0x04db7f21),
-  X(0x04e7a424), X(0x04f3d7d8), X(0x05001a3b), X(0x050c6b4a),
-  X(0x0518cb04), X(0x05253966), X(0x0531b66e), X(0x053e421a),
-  X(0x054adc68), X(0x05578555), X(0x05643cdf), X(0x05710304),
-  X(0x057dd7c1), X(0x058abb15), X(0x0597acfd), X(0x05a4ad76),
-  X(0x05b1bc7f), X(0x05beda14), X(0x05cc0635), X(0x05d940dd),
-  X(0x05e68a0b), X(0x05f3e1bd), X(0x060147f0), X(0x060ebca1),
-  X(0x061c3fcf), X(0x0629d176), X(0x06377194), X(0x06452027),
-  X(0x0652dd2c), X(0x0660a8a2), X(0x066e8284), X(0x067c6ad1),
-  X(0x068a6186), X(0x069866a1), X(0x06a67a1e), X(0x06b49bfc),
-  X(0x06c2cc38), X(0x06d10acf), X(0x06df57bf), X(0x06edb304),
-  X(0x06fc1c9d), X(0x070a9487), X(0x07191abe), X(0x0727af40),
-  X(0x0736520b), X(0x0745031c), X(0x0753c270), X(0x07629004),
-  X(0x07716bd6), X(0x078055e2), X(0x078f4e26), X(0x079e549f),
-  X(0x07ad694b), X(0x07bc8c26), X(0x07cbbd2e), X(0x07dafc5f),
-  X(0x07ea49b7), X(0x07f9a533), X(0x08090ed1), X(0x0818868c),
-  X(0x08280c62), X(0x0837a051), X(0x08474255), X(0x0856f26b),
-  X(0x0866b091), X(0x08767cc3), X(0x088656fe), X(0x08963f3f),
-  X(0x08a63584), X(0x08b639c8), X(0x08c64c0a), X(0x08d66c45),
-  X(0x08e69a77), X(0x08f6d69d), X(0x090720b3), X(0x091778b7),
-  X(0x0927dea5), X(0x0938527a), X(0x0948d433), X(0x095963cc),
-  X(0x096a0143), X(0x097aac94), X(0x098b65bb), X(0x099c2cb6),
-  X(0x09ad0182), X(0x09bde41a), X(0x09ced47d), X(0x09dfd2a5),
-  X(0x09f0de90), X(0x0a01f83b), X(0x0a131fa3), X(0x0a2454c3),
-  X(0x0a359798), X(0x0a46e820), X(0x0a584656), X(0x0a69b237),
-  X(0x0a7b2bc0), X(0x0a8cb2ec), X(0x0a9e47ba), X(0x0aafea24),
-  X(0x0ac19a29), X(0x0ad357c3), X(0x0ae522ef), X(0x0af6fbab),
-  X(0x0b08e1f1), X(0x0b1ad5c0), X(0x0b2cd712), X(0x0b3ee5e5),
-  X(0x0b510234), X(0x0b632bfd), X(0x0b75633b), X(0x0b87a7eb),
-  X(0x0b99fa08), X(0x0bac5990), X(0x0bbec67e), X(0x0bd140cf),
-  X(0x0be3c87e), X(0x0bf65d89), X(0x0c08ffeb), X(0x0c1bafa1),
-  X(0x0c2e6ca6), X(0x0c4136f6), X(0x0c540e8f), X(0x0c66f36c),
-  X(0x0c79e588), X(0x0c8ce4e1), X(0x0c9ff172), X(0x0cb30b37),
-  X(0x0cc6322c), X(0x0cd9664d), X(0x0ceca797), X(0x0cfff605),
-  X(0x0d135193), X(0x0d26ba3d), X(0x0d3a2fff), X(0x0d4db2d5),
-  X(0x0d6142ba), X(0x0d74dfac), X(0x0d8889a5), X(0x0d9c40a1),
-  X(0x0db0049d), X(0x0dc3d593), X(0x0dd7b380), X(0x0deb9e60),
-  X(0x0dff962f), X(0x0e139ae7), X(0x0e27ac85), X(0x0e3bcb05),
-  X(0x0e4ff662), X(0x0e642e98), X(0x0e7873a2), X(0x0e8cc57d),
-  X(0x0ea12423), X(0x0eb58f91), X(0x0eca07c2), X(0x0ede8cb1),
-  X(0x0ef31e5b), X(0x0f07bcba), X(0x0f1c67cb), X(0x0f311f88),
-  X(0x0f45e3ee), X(0x0f5ab4f7), X(0x0f6f92a0), X(0x0f847ce3),
-  X(0x0f9973bc), X(0x0fae7726), X(0x0fc3871e), X(0x0fd8a39d),
-  X(0x0fedcca1), X(0x10030223), X(0x1018441f), X(0x102d9291),
-  X(0x1042ed74), X(0x105854c3), X(0x106dc879), X(0x10834892),
-  X(0x1098d508), X(0x10ae6dd8), X(0x10c412fc), X(0x10d9c46f),
-  X(0x10ef822d), X(0x11054c30), X(0x111b2274), X(0x113104f5),
-  X(0x1146f3ac), X(0x115cee95), X(0x1172f5ab), X(0x118908e9),
-  X(0x119f284a), X(0x11b553ca), X(0x11cb8b62), X(0x11e1cf0f),
-  X(0x11f81ecb), X(0x120e7a90), X(0x1224e25a), X(0x123b5624),
-  X(0x1251d5e9), X(0x126861a3), X(0x127ef94e), X(0x12959ce3),
-  X(0x12ac4c5f), X(0x12c307bb), X(0x12d9cef2), X(0x12f0a200),
-  X(0x130780df), X(0x131e6b8a), X(0x133561fa), X(0x134c642c),
-  X(0x1363721a), X(0x137a8bbe), X(0x1391b113), X(0x13a8e214),
-  X(0x13c01eba), X(0x13d76702), X(0x13eebae5), X(0x14061a5e),
-  X(0x141d8567), X(0x1434fbfb), X(0x144c7e14), X(0x14640bae),
-  X(0x147ba4c1), X(0x14934949), X(0x14aaf941), X(0x14c2b4a2),
-  X(0x14da7b67), X(0x14f24d8a), X(0x150a2b06), X(0x152213d5),
-  X(0x153a07f1), X(0x15520755), X(0x156a11fb), X(0x158227dd),
-  X(0x159a48f5), X(0x15b2753d), X(0x15caacb1), X(0x15e2ef49),
-  X(0x15fb3d01), X(0x161395d2), X(0x162bf9b6), X(0x164468a8),
-  X(0x165ce2a1), X(0x1675679c), X(0x168df793), X(0x16a69280),
-  X(0x16bf385c), X(0x16d7e922), X(0x16f0a4cc), X(0x17096b54),
-  X(0x17223cb4), X(0x173b18e5), X(0x1753ffe2), X(0x176cf1a5),
-  X(0x1785ee27), X(0x179ef562), X(0x17b80750), X(0x17d123eb),
-  X(0x17ea4b2d), X(0x18037d10), X(0x181cb98d), X(0x1836009e),
-  X(0x184f523c), X(0x1868ae63), X(0x1882150a), X(0x189b862c),
-  X(0x18b501c4), X(0x18ce87c9), X(0x18e81836), X(0x1901b305),
-  X(0x191b582f), X(0x193507ad), X(0x194ec17a), X(0x1968858f),
-  X(0x198253e5), X(0x199c2c75), X(0x19b60f3a), X(0x19cffc2d),
-  X(0x19e9f347), X(0x1a03f482), X(0x1a1dffd7), X(0x1a381540),
-  X(0x1a5234b5), X(0x1a6c5e31), X(0x1a8691ac), X(0x1aa0cf21),
-  X(0x1abb1687), X(0x1ad567da), X(0x1aefc311), X(0x1b0a2826),
-  X(0x1b249712), X(0x1b3f0fd0), X(0x1b599257), X(0x1b741ea1),
-  X(0x1b8eb4a7), X(0x1ba95462), X(0x1bc3fdcd), X(0x1bdeb0de),
-  X(0x1bf96d91), X(0x1c1433dd), X(0x1c2f03bc), X(0x1c49dd27),
-  X(0x1c64c017), X(0x1c7fac85), X(0x1c9aa269), X(0x1cb5a1be),
-  X(0x1cd0aa7c), X(0x1cebbc9c), X(0x1d06d816), X(0x1d21fce4),
-  X(0x1d3d2aff), X(0x1d586260), X(0x1d73a2fe), X(0x1d8eecd4),
-  X(0x1daa3fda), X(0x1dc59c09), X(0x1de1015a), X(0x1dfc6fc5),
-  X(0x1e17e743), X(0x1e3367cd), X(0x1e4ef15b), X(0x1e6a83e7),
-  X(0x1e861f6a), X(0x1ea1c3da), X(0x1ebd7133), X(0x1ed9276b),
-  X(0x1ef4e67c), X(0x1f10ae5e), X(0x1f2c7f0a), X(0x1f485879),
-  X(0x1f643aa2), X(0x1f80257f), X(0x1f9c1908), X(0x1fb81536),
-  X(0x1fd41a00), X(0x1ff02761), X(0x200c3d4f), X(0x20285bc3),
-  X(0x204482b7), X(0x2060b221), X(0x207ce9fb), X(0x20992a3e),
-  X(0x20b572e0), X(0x20d1c3dc), X(0x20ee1d28), X(0x210a7ebe),
-  X(0x2126e895), X(0x21435aa6), X(0x215fd4ea), X(0x217c5757),
-  X(0x2198e1e8), X(0x21b57493), X(0x21d20f51), X(0x21eeb21b),
-  X(0x220b5ce7), X(0x22280fb0), X(0x2244ca6c), X(0x22618d13),
-  X(0x227e579f), X(0x229b2a06), X(0x22b80442), X(0x22d4e649),
-  X(0x22f1d015), X(0x230ec19d), X(0x232bbad9), X(0x2348bbc1),
-  X(0x2365c44c), X(0x2382d474), X(0x239fec30), X(0x23bd0b78),
-  X(0x23da3244), X(0x23f7608b), X(0x24149646), X(0x2431d36c),
-  X(0x244f17f5), X(0x246c63da), X(0x2489b711), X(0x24a71193),
-  X(0x24c47358), X(0x24e1dc57), X(0x24ff4c88), X(0x251cc3e2),
-  X(0x253a425e), X(0x2557c7f4), X(0x2575549a), X(0x2592e848),
-  X(0x25b082f7), X(0x25ce249e), X(0x25ebcd34), X(0x26097cb2),
-  X(0x2627330e), X(0x2644f040), X(0x2662b441), X(0x26807f07),
-  X(0x269e5089), X(0x26bc28c1), X(0x26da07a4), X(0x26f7ed2b),
-  X(0x2715d94d), X(0x2733cc02), X(0x2751c540), X(0x276fc500),
-  X(0x278dcb39), X(0x27abd7e2), X(0x27c9eaf3), X(0x27e80463),
-  X(0x28062429), X(0x28244a3e), X(0x28427697), X(0x2860a92d),
-  X(0x287ee1f7), X(0x289d20eb), X(0x28bb6603), X(0x28d9b134),
-  X(0x28f80275), X(0x291659c0), X(0x2934b709), X(0x29531a49),
-  X(0x29718378), X(0x298ff28b), X(0x29ae677b), X(0x29cce23e),
-  X(0x29eb62cb), X(0x2a09e91b), X(0x2a287523), X(0x2a4706dc),
-  X(0x2a659e3c), X(0x2a843b39), X(0x2aa2ddcd), X(0x2ac185ec),
-  X(0x2ae0338f), X(0x2afee6ad), X(0x2b1d9f3c), X(0x2b3c5d33),
-  X(0x2b5b208b), X(0x2b79e939), X(0x2b98b734), X(0x2bb78a74),
-  X(0x2bd662ef), X(0x2bf5409d), X(0x2c142374), X(0x2c330b6b),
-  X(0x2c51f87a), X(0x2c70ea97), X(0x2c8fe1b9), X(0x2caeddd6),
-  X(0x2ccddee7), X(0x2cece4e1), X(0x2d0befbb), X(0x2d2aff6d),
-  X(0x2d4a13ec), X(0x2d692d31), X(0x2d884b32), X(0x2da76de4),
-  X(0x2dc69540), X(0x2de5c13d), X(0x2e04f1d0), X(0x2e2426f0),
-  X(0x2e436095), X(0x2e629eb4), X(0x2e81e146), X(0x2ea1283f),
-  X(0x2ec07398), X(0x2edfc347), X(0x2eff1742), X(0x2f1e6f80),
-  X(0x2f3dcbf8), X(0x2f5d2ca0), X(0x2f7c916f), X(0x2f9bfa5c),
-  X(0x2fbb675d), X(0x2fdad869), X(0x2ffa4d76), X(0x3019c67b),
-  X(0x3039436f), X(0x3058c448), X(0x307848fc), X(0x3097d183),
-  X(0x30b75dd3), X(0x30d6ede2), X(0x30f681a6), X(0x31161917),
-  X(0x3135b42b), X(0x315552d8), X(0x3174f514), X(0x31949ad7),
-  X(0x31b44417), X(0x31d3f0ca), X(0x31f3a0e6), X(0x32135462),
-  X(0x32330b35), X(0x3252c555), X(0x327282b7), X(0x32924354),
-  X(0x32b20720), X(0x32d1ce13), X(0x32f19823), X(0x33116546),
-  X(0x33313573), X(0x3351089f), X(0x3370dec2), X(0x3390b7d1),
-  X(0x33b093c3), X(0x33d0728f), X(0x33f05429), X(0x3410388a),
-  X(0x34301fa7), X(0x34500977), X(0x346ff5ef), X(0x348fe506),
-  X(0x34afd6b3), X(0x34cfcaeb), X(0x34efc1a5), X(0x350fbad7),
-  X(0x352fb678), X(0x354fb47d), X(0x356fb4dd), X(0x358fb78e),
-  X(0x35afbc86), X(0x35cfc3bc), X(0x35efcd25), X(0x360fd8b8),
-  X(0x362fe66c), X(0x364ff636), X(0x3670080c), X(0x36901be5),
-  X(0x36b031b7), X(0x36d04978), X(0x36f0631e), X(0x37107ea0),
-  X(0x37309bf3), X(0x3750bb0e), X(0x3770dbe6), X(0x3790fe73),
-  X(0x37b122aa), X(0x37d14881), X(0x37f16fee), X(0x381198e8),
-  X(0x3831c365), X(0x3851ef5a), X(0x38721cbe), X(0x38924b87),
-  X(0x38b27bac), X(0x38d2ad21), X(0x38f2dfde), X(0x391313d8),
-  X(0x39334906), X(0x39537f5d), X(0x3973b6d4), X(0x3993ef60),
-  X(0x39b428f9), X(0x39d46393), X(0x39f49f25), X(0x3a14dba6),
-  X(0x3a35190a), X(0x3a555748), X(0x3a759657), X(0x3a95d62c),
-  X(0x3ab616be), X(0x3ad65801), X(0x3af699ed), X(0x3b16dc78),
-  X(0x3b371f97), X(0x3b576341), X(0x3b77a76c), X(0x3b97ec0d),
-  X(0x3bb8311b), X(0x3bd8768b), X(0x3bf8bc55), X(0x3c19026d),
-  X(0x3c3948ca), X(0x3c598f62), X(0x3c79d62b), X(0x3c9a1d1b),
-  X(0x3cba6428), X(0x3cdaab48), X(0x3cfaf271), X(0x3d1b3999),
-  X(0x3d3b80b6), X(0x3d5bc7be), X(0x3d7c0ea8), X(0x3d9c5569),
-  X(0x3dbc9bf7), X(0x3ddce248), X(0x3dfd2852), X(0x3e1d6e0c),
-  X(0x3e3db36c), X(0x3e5df866), X(0x3e7e3cf2), X(0x3e9e8106),
-  X(0x3ebec497), X(0x3edf079b), X(0x3eff4a09), X(0x3f1f8bd7),
-  X(0x3f3fccfa), X(0x3f600d69), X(0x3f804d1a), X(0x3fa08c02),
-  X(0x3fc0ca19), X(0x3fe10753), X(0x400143a7), X(0x40217f0a),
-  X(0x4041b974), X(0x4061f2da), X(0x40822b32), X(0x40a26272),
-  X(0x40c29891), X(0x40e2cd83), X(0x41030140), X(0x412333bd),
-  X(0x414364f1), X(0x416394d2), X(0x4183c355), X(0x41a3f070),
-  X(0x41c41c1b), X(0x41e4464a), X(0x42046ef4), X(0x42249610),
-  X(0x4244bb92), X(0x4264df72), X(0x428501a5), X(0x42a52222),
-  X(0x42c540de), X(0x42e55dd0), X(0x430578ed), X(0x4325922d),
-  X(0x4345a985), X(0x4365beeb), X(0x4385d255), X(0x43a5e3ba),
-  X(0x43c5f30f), X(0x43e6004b), X(0x44060b65), X(0x44261451),
-  X(0x44461b07), X(0x44661f7c), X(0x448621a7), X(0x44a6217d),
-  X(0x44c61ef6), X(0x44e61a07), X(0x450612a6), X(0x452608ca),
-  X(0x4545fc69), X(0x4565ed79), X(0x4585dbf1), X(0x45a5c7c6),
-  X(0x45c5b0ef), X(0x45e59761), X(0x46057b15), X(0x46255bfe),
-  X(0x46453a15), X(0x4665154f), X(0x4684eda2), X(0x46a4c305),
-  X(0x46c4956e), X(0x46e464d3), X(0x4704312b), X(0x4723fa6c),
-  X(0x4743c08d), X(0x47638382), X(0x47834344), X(0x47a2ffc9),
-  X(0x47c2b906), X(0x47e26ef2), X(0x48022183), X(0x4821d0b1),
-  X(0x48417c71), X(0x486124b9), X(0x4880c981), X(0x48a06abe),
-  X(0x48c00867), X(0x48dfa272), X(0x48ff38d6), X(0x491ecb8a),
-  X(0x493e5a84), X(0x495de5b9), X(0x497d6d22), X(0x499cf0b4),
-  X(0x49bc7066), X(0x49dbec2e), X(0x49fb6402), X(0x4a1ad7db),
-  X(0x4a3a47ad), X(0x4a59b370), X(0x4a791b1a), X(0x4a987ea1),
-  X(0x4ab7ddfd), X(0x4ad73924), X(0x4af6900c), X(0x4b15e2ad),
-  X(0x4b3530fc), X(0x4b547af1), X(0x4b73c082), X(0x4b9301a6),
-  X(0x4bb23e53), X(0x4bd17681), X(0x4bf0aa25), X(0x4c0fd937),
-  X(0x4c2f03ae), X(0x4c4e297f), X(0x4c6d4aa3), X(0x4c8c670f),
-  X(0x4cab7eba), X(0x4cca919c), X(0x4ce99fab), X(0x4d08a8de),
-  X(0x4d27ad2c), X(0x4d46ac8b), X(0x4d65a6f3), X(0x4d849c5a),
-  X(0x4da38cb7), X(0x4dc27802), X(0x4de15e31), X(0x4e003f3a),
-  X(0x4e1f1b16), X(0x4e3df1ba), X(0x4e5cc31e), X(0x4e7b8f3a),
-  X(0x4e9a5603), X(0x4eb91771), X(0x4ed7d37b), X(0x4ef68a18),
-  X(0x4f153b3f), X(0x4f33e6e7), X(0x4f528d08), X(0x4f712d97),
-  X(0x4f8fc88e), X(0x4fae5de1), X(0x4fcced8a), X(0x4feb777f),
-  X(0x5009fbb6), X(0x50287a28), X(0x5046f2cc), X(0x50656598),
-  X(0x5083d284), X(0x50a23988), X(0x50c09a9a), X(0x50def5b1),
-  X(0x50fd4ac7), X(0x511b99d0), X(0x5139e2c5), X(0x5158259e),
-  X(0x51766251), X(0x519498d6), X(0x51b2c925), X(0x51d0f334),
-  X(0x51ef16fb), X(0x520d3473), X(0x522b4b91), X(0x52495c4e),
-  X(0x526766a2), X(0x52856a83), X(0x52a367e9), X(0x52c15ecd),
-  X(0x52df4f24), X(0x52fd38e8), X(0x531b1c10), X(0x5338f892),
-  X(0x5356ce68), X(0x53749d89), X(0x539265eb), X(0x53b02788),
-  X(0x53cde257), X(0x53eb964f), X(0x54094369), X(0x5426e99c),
-  X(0x544488df), X(0x5462212c), X(0x547fb279), X(0x549d3cbe),
-  X(0x54babff4), X(0x54d83c12), X(0x54f5b110), X(0x55131ee7),
-  X(0x5530858d), X(0x554de4fc), X(0x556b3d2a), X(0x55888e11),
-  X(0x55a5d7a8), X(0x55c319e7), X(0x55e054c7), X(0x55fd883f),
-  X(0x561ab447), X(0x5637d8d8), X(0x5654f5ea), X(0x56720b75),
-  X(0x568f1971), X(0x56ac1fd7), X(0x56c91e9e), X(0x56e615c0),
-  X(0x57030534), X(0x571fecf2), X(0x573cccf3), X(0x5759a530),
-  X(0x577675a0), X(0x57933e3c), X(0x57affefd), X(0x57ccb7db),
-  X(0x57e968ce), X(0x580611cf), X(0x5822b2d6), X(0x583f4bdd),
-  X(0x585bdcdb), X(0x587865c9), X(0x5894e69f), X(0x58b15f57),
-  X(0x58cdcfe9), X(0x58ea384e), X(0x5906987d), X(0x5922f071),
-  X(0x593f4022), X(0x595b8788), X(0x5977c69c), X(0x5993fd57),
-  X(0x59b02bb2), X(0x59cc51a6), X(0x59e86f2c), X(0x5a04843c),
-  X(0x5a2090d0), X(0x5a3c94e0), X(0x5a589065), X(0x5a748359),
-  X(0x5a906db4), X(0x5aac4f70), X(0x5ac82884), X(0x5ae3f8ec),
-  X(0x5affc09f), X(0x5b1b7f97), X(0x5b3735cd), X(0x5b52e33a),
-  X(0x5b6e87d8), X(0x5b8a239f), X(0x5ba5b689), X(0x5bc1408f),
-  X(0x5bdcc1aa), X(0x5bf839d5), X(0x5c13a907), X(0x5c2f0f3b),
-  X(0x5c4a6c6a), X(0x5c65c08d), X(0x5c810b9e), X(0x5c9c4d97),
-  X(0x5cb78670), X(0x5cd2b623), X(0x5ceddcaa), X(0x5d08f9ff),
-  X(0x5d240e1b), X(0x5d3f18f8), X(0x5d5a1a8f), X(0x5d7512da),
-  X(0x5d9001d3), X(0x5daae773), X(0x5dc5c3b5), X(0x5de09692),
-  X(0x5dfb6004), X(0x5e162004), X(0x5e30d68d), X(0x5e4b8399),
-  X(0x5e662721), X(0x5e80c11f), X(0x5e9b518e), X(0x5eb5d867),
-  X(0x5ed055a4), X(0x5eeac940), X(0x5f053334), X(0x5f1f937b),
-  X(0x5f39ea0f), X(0x5f5436ea), X(0x5f6e7a06), X(0x5f88b35d),
-  X(0x5fa2e2e9), X(0x5fbd08a6), X(0x5fd7248d), X(0x5ff13698),
-  X(0x600b3ec2), X(0x60253d05), X(0x603f315b), X(0x60591bc0),
-  X(0x6072fc2d), X(0x608cd29e), X(0x60a69f0b), X(0x60c06171),
-  X(0x60da19ca), X(0x60f3c80f), X(0x610d6c3d), X(0x6127064d),
-  X(0x6140963a), X(0x615a1bff), X(0x61739797), X(0x618d08fc),
-  X(0x61a67029), X(0x61bfcd1a), X(0x61d91fc8), X(0x61f2682f),
-  X(0x620ba64a), X(0x6224da13), X(0x623e0386), X(0x6257229d),
-  X(0x62703754), X(0x628941a6), X(0x62a2418e), X(0x62bb3706),
-  X(0x62d4220a), X(0x62ed0296), X(0x6305d8a3), X(0x631ea42f),
-  X(0x63376533), X(0x63501bab), X(0x6368c793), X(0x638168e5),
-  X(0x6399ff9e), X(0x63b28bb8), X(0x63cb0d2f), X(0x63e383ff),
-  X(0x63fbf022), X(0x64145195), X(0x642ca853), X(0x6444f457),
-  X(0x645d359e), X(0x64756c22), X(0x648d97e0), X(0x64a5b8d3),
-  X(0x64bdcef6), X(0x64d5da47), X(0x64eddabf), X(0x6505d05c),
-  X(0x651dbb19), X(0x65359af2), X(0x654d6fe3), X(0x656539e7),
-  X(0x657cf8fb), X(0x6594ad1b), X(0x65ac5643), X(0x65c3f46e),
-  X(0x65db8799), X(0x65f30fc0), X(0x660a8ce0), X(0x6621fef3),
-  X(0x663965f7), X(0x6650c1e7), X(0x666812c1), X(0x667f5880),
-  X(0x66969320), X(0x66adc29e), X(0x66c4e6f7), X(0x66dc0026),
-  X(0x66f30e28), X(0x670a10fa), X(0x67210898), X(0x6737f4ff),
-  X(0x674ed62b), X(0x6765ac19), X(0x677c76c5), X(0x6793362c),
-  X(0x67a9ea4b), X(0x67c0931f), X(0x67d730a3), X(0x67edc2d6),
-  X(0x680449b3), X(0x681ac538), X(0x68313562), X(0x68479a2d),
-  X(0x685df396), X(0x6874419b), X(0x688a8438), X(0x68a0bb6a),
-  X(0x68b6e72e), X(0x68cd0782), X(0x68e31c63), X(0x68f925cd),
-  X(0x690f23be), X(0x69251633), X(0x693afd29), X(0x6950d89e),
-  X(0x6966a88f), X(0x697c6cf8), X(0x699225d9), X(0x69a7d32d),
-  X(0x69bd74f3), X(0x69d30b27), X(0x69e895c8), X(0x69fe14d2),
-  X(0x6a138844), X(0x6a28f01b), X(0x6a3e4c54), X(0x6a539ced),
-  X(0x6a68e1e4), X(0x6a7e1b37), X(0x6a9348e3), X(0x6aa86ae6),
-  X(0x6abd813d), X(0x6ad28be7), X(0x6ae78ae2), X(0x6afc7e2b),
-  X(0x6b1165c0), X(0x6b26419f), X(0x6b3b11c7), X(0x6b4fd634),
-  X(0x6b648ee6), X(0x6b793bda), X(0x6b8ddd0e), X(0x6ba27281),
-  X(0x6bb6fc31), X(0x6bcb7a1b), X(0x6bdfec3e), X(0x6bf45299),
-  X(0x6c08ad29), X(0x6c1cfbed), X(0x6c313ee4), X(0x6c45760a),
-  X(0x6c59a160), X(0x6c6dc0e4), X(0x6c81d493), X(0x6c95dc6d),
-  X(0x6ca9d86f), X(0x6cbdc899), X(0x6cd1acea), X(0x6ce5855f),
-  X(0x6cf951f7), X(0x6d0d12b1), X(0x6d20c78c), X(0x6d347087),
-  X(0x6d480da0), X(0x6d5b9ed6), X(0x6d6f2427), X(0x6d829d94),
-  X(0x6d960b1a), X(0x6da96cb9), X(0x6dbcc270), X(0x6dd00c3c),
-  X(0x6de34a1f), X(0x6df67c16), X(0x6e09a221), X(0x6e1cbc3f),
-  X(0x6e2fca6e), X(0x6e42ccaf), X(0x6e55c300), X(0x6e68ad60),
-  X(0x6e7b8bd0), X(0x6e8e5e4d), X(0x6ea124d8), X(0x6eb3df70),
-  X(0x6ec68e13), X(0x6ed930c3), X(0x6eebc77d), X(0x6efe5242),
-  X(0x6f10d111), X(0x6f2343e9), X(0x6f35aacb), X(0x6f4805b5),
-  X(0x6f5a54a8), X(0x6f6c97a2), X(0x6f7ecea4), X(0x6f90f9ae),
-  X(0x6fa318be), X(0x6fb52bd6), X(0x6fc732f4), X(0x6fd92e19),
-  X(0x6feb1d44), X(0x6ffd0076), X(0x700ed7ad), X(0x7020a2eb),
-  X(0x7032622f), X(0x7044157a), X(0x7055bcca), X(0x70675821),
-  X(0x7078e77e), X(0x708a6ae2), X(0x709be24c), X(0x70ad4dbd),
-  X(0x70bead36), X(0x70d000b5), X(0x70e1483d), X(0x70f283cc),
-  X(0x7103b363), X(0x7114d704), X(0x7125eead), X(0x7136fa60),
-  X(0x7147fa1c), X(0x7158ede4), X(0x7169d5b6), X(0x717ab193),
-  X(0x718b817d), X(0x719c4573), X(0x71acfd76), X(0x71bda988),
-  X(0x71ce49a8), X(0x71deddd7), X(0x71ef6617), X(0x71ffe267),
-  X(0x721052ca), X(0x7220b73e), X(0x72310fc6), X(0x72415c62),
-  X(0x72519d14), X(0x7261d1db), X(0x7271faba), X(0x728217b1),
-  X(0x729228c0), X(0x72a22dea), X(0x72b22730), X(0x72c21491),
-  X(0x72d1f611), X(0x72e1cbaf), X(0x72f1956c), X(0x7301534c),
-  X(0x7311054d), X(0x7320ab72), X(0x733045bc), X(0x733fd42d),
-  X(0x734f56c5), X(0x735ecd86), X(0x736e3872), X(0x737d9789),
-  X(0x738ceacf), X(0x739c3243), X(0x73ab6de7), X(0x73ba9dbe),
-  X(0x73c9c1c8), X(0x73d8da08), X(0x73e7e67f), X(0x73f6e72e),
-  X(0x7405dc17), X(0x7414c53c), X(0x7423a29f), X(0x74327442),
-  X(0x74413a26), X(0x744ff44d), X(0x745ea2b9), X(0x746d456c),
-  X(0x747bdc68), X(0x748a67ae), X(0x7498e741), X(0x74a75b23),
-  X(0x74b5c356), X(0x74c41fdb), X(0x74d270b6), X(0x74e0b5e7),
-  X(0x74eeef71), X(0x74fd1d57), X(0x750b3f9a), X(0x7519563c),
-  X(0x75276140), X(0x753560a8), X(0x75435477), X(0x75513cae),
-  X(0x755f1951), X(0x756cea60), X(0x757aafdf), X(0x758869d1),
-  X(0x75961837), X(0x75a3bb14), X(0x75b1526a), X(0x75bede3c),
-  X(0x75cc5e8d), X(0x75d9d35f), X(0x75e73cb5), X(0x75f49a91),
-  X(0x7601ecf6), X(0x760f33e6), X(0x761c6f65), X(0x76299f74),
-  X(0x7636c417), X(0x7643dd51), X(0x7650eb24), X(0x765ded93),
-  X(0x766ae4a0), X(0x7677d050), X(0x7684b0a4), X(0x7691859f),
-  X(0x769e4f45), X(0x76ab0d98), X(0x76b7c09c), X(0x76c46852),
-  X(0x76d104bf), X(0x76dd95e6), X(0x76ea1bc9), X(0x76f6966b),
-  X(0x770305d0), X(0x770f69fb), X(0x771bc2ef), X(0x772810af),
-  X(0x7734533e), X(0x77408aa0), X(0x774cb6d7), X(0x7758d7e8),
-  X(0x7764edd5), X(0x7770f8a2), X(0x777cf852), X(0x7788ece8),
-  X(0x7794d668), X(0x77a0b4d5), X(0x77ac8833), X(0x77b85085),
-  X(0x77c40dce), X(0x77cfc013), X(0x77db6756), X(0x77e7039b),
-  X(0x77f294e6), X(0x77fe1b3b), X(0x7809969c), X(0x7815070e),
-  X(0x78206c93), X(0x782bc731), X(0x783716ea), X(0x78425bc3),
-  X(0x784d95be), X(0x7858c4e1), X(0x7863e92d), X(0x786f02a8),
-  X(0x787a1156), X(0x78851539), X(0x78900e56), X(0x789afcb1),
-  X(0x78a5e04d), X(0x78b0b92f), X(0x78bb875b), X(0x78c64ad4),
-  X(0x78d1039e), X(0x78dbb1be), X(0x78e65537), X(0x78f0ee0e),
-  X(0x78fb7c46), X(0x7905ffe4), X(0x791078ec), X(0x791ae762),
-  X(0x79254b4a), X(0x792fa4a7), X(0x7939f380), X(0x794437d7),
-  X(0x794e71b0), X(0x7958a111), X(0x7962c5fd), X(0x796ce078),
-  X(0x7976f087), X(0x7980f62f), X(0x798af173), X(0x7994e258),
-  X(0x799ec8e2), X(0x79a8a515), X(0x79b276f7), X(0x79bc3e8b),
-  X(0x79c5fbd6), X(0x79cfaedc), X(0x79d957a2), X(0x79e2f62c),
-  X(0x79ec8a7f), X(0x79f6149f), X(0x79ff9492), X(0x7a090a5a),
-  X(0x7a1275fe), X(0x7a1bd781), X(0x7a252ee9), X(0x7a2e7c39),
-  X(0x7a37bf77), X(0x7a40f8a7), X(0x7a4a27ce), X(0x7a534cf0),
-  X(0x7a5c6813), X(0x7a65793b), X(0x7a6e806d), X(0x7a777dad),
-  X(0x7a807100), X(0x7a895a6b), X(0x7a9239f4), X(0x7a9b0f9e),
-  X(0x7aa3db6f), X(0x7aac9d6b), X(0x7ab55597), X(0x7abe03f9),
-  X(0x7ac6a895), X(0x7acf4370), X(0x7ad7d48f), X(0x7ae05bf6),
-  X(0x7ae8d9ac), X(0x7af14db5), X(0x7af9b815), X(0x7b0218d2),
-  X(0x7b0a6ff2), X(0x7b12bd78), X(0x7b1b016a), X(0x7b233bce),
-  X(0x7b2b6ca7), X(0x7b3393fc), X(0x7b3bb1d1), X(0x7b43c62c),
-  X(0x7b4bd111), X(0x7b53d286), X(0x7b5bca90), X(0x7b63b935),
-  X(0x7b6b9e78), X(0x7b737a61), X(0x7b7b4cf3), X(0x7b831634),
-  X(0x7b8ad629), X(0x7b928cd8), X(0x7b9a3a45), X(0x7ba1de77),
-  X(0x7ba97972), X(0x7bb10b3c), X(0x7bb893d9), X(0x7bc01350),
-  X(0x7bc789a6), X(0x7bcef6e0), X(0x7bd65b03), X(0x7bddb616),
-  X(0x7be5081c), X(0x7bec511c), X(0x7bf3911b), X(0x7bfac81f),
-  X(0x7c01f62c), X(0x7c091b49), X(0x7c10377b), X(0x7c174ac7),
-  X(0x7c1e5532), X(0x7c2556c4), X(0x7c2c4f80), X(0x7c333f6c),
-  X(0x7c3a268e), X(0x7c4104ec), X(0x7c47da8a), X(0x7c4ea76f),
-  X(0x7c556ba1), X(0x7c5c2724), X(0x7c62d9fe), X(0x7c698435),
-  X(0x7c7025cf), X(0x7c76bed0), X(0x7c7d4f40), X(0x7c83d723),
-  X(0x7c8a567f), X(0x7c90cd5a), X(0x7c973bb9), X(0x7c9da1a2),
-  X(0x7ca3ff1b), X(0x7caa542a), X(0x7cb0a0d3), X(0x7cb6e51e),
-  X(0x7cbd210f), X(0x7cc354ac), X(0x7cc97ffc), X(0x7ccfa304),
-  X(0x7cd5bdc9), X(0x7cdbd051), X(0x7ce1daa3), X(0x7ce7dcc3),
-  X(0x7cedd6b8), X(0x7cf3c888), X(0x7cf9b238), X(0x7cff93cf),
-  X(0x7d056d51), X(0x7d0b3ec5), X(0x7d110830), X(0x7d16c99a),
-  X(0x7d1c8306), X(0x7d22347c), X(0x7d27de00), X(0x7d2d7f9a),
-  X(0x7d33194f), X(0x7d38ab24), X(0x7d3e351f), X(0x7d43b748),
-  X(0x7d4931a2), X(0x7d4ea435), X(0x7d540f06), X(0x7d59721b),
-  X(0x7d5ecd7b), X(0x7d64212a), X(0x7d696d2f), X(0x7d6eb190),
-  X(0x7d73ee53), X(0x7d79237e), X(0x7d7e5117), X(0x7d837723),
-  X(0x7d8895a9), X(0x7d8dacae), X(0x7d92bc3a), X(0x7d97c451),
-  X(0x7d9cc4f9), X(0x7da1be39), X(0x7da6b017), X(0x7dab9a99),
-  X(0x7db07dc4), X(0x7db5599e), X(0x7dba2e2f), X(0x7dbefb7b),
-  X(0x7dc3c189), X(0x7dc8805e), X(0x7dcd3802), X(0x7dd1e879),
-  X(0x7dd691ca), X(0x7ddb33fb), X(0x7ddfcf12), X(0x7de46315),
-  X(0x7de8f00a), X(0x7ded75f8), X(0x7df1f4e3), X(0x7df66cd3),
-  X(0x7dfaddcd), X(0x7dff47d7), X(0x7e03aaf8), X(0x7e080735),
-  X(0x7e0c5c95), X(0x7e10ab1e), X(0x7e14f2d5), X(0x7e1933c1),
-  X(0x7e1d6de8), X(0x7e21a150), X(0x7e25cdff), X(0x7e29f3fc),
-  X(0x7e2e134c), X(0x7e322bf5), X(0x7e363dfd), X(0x7e3a496b),
-  X(0x7e3e4e45), X(0x7e424c90), X(0x7e464454), X(0x7e4a3595),
-  X(0x7e4e205a), X(0x7e5204aa), X(0x7e55e289), X(0x7e59b9ff),
-  X(0x7e5d8b12), X(0x7e6155c7), X(0x7e651a24), X(0x7e68d831),
-  X(0x7e6c8ff2), X(0x7e70416e), X(0x7e73ecac), X(0x7e7791b0),
-  X(0x7e7b3082), X(0x7e7ec927), X(0x7e825ba6), X(0x7e85e804),
-  X(0x7e896e48), X(0x7e8cee77), X(0x7e906899), X(0x7e93dcb2),
-  X(0x7e974aca), X(0x7e9ab2e5), X(0x7e9e150b), X(0x7ea17141),
-  X(0x7ea4c78e), X(0x7ea817f7), X(0x7eab6283), X(0x7eaea737),
-  X(0x7eb1e61a), X(0x7eb51f33), X(0x7eb85285), X(0x7ebb8019),
-  X(0x7ebea7f4), X(0x7ec1ca1d), X(0x7ec4e698), X(0x7ec7fd6d),
-  X(0x7ecb0ea1), X(0x7ece1a3a), X(0x7ed1203f), X(0x7ed420b6),
-  X(0x7ed71ba4), X(0x7eda110f), X(0x7edd00ff), X(0x7edfeb78),
-  X(0x7ee2d081), X(0x7ee5b01f), X(0x7ee88a5a), X(0x7eeb5f36),
-  X(0x7eee2eba), X(0x7ef0f8ed), X(0x7ef3bdd3), X(0x7ef67d73),
-  X(0x7ef937d3), X(0x7efbecf9), X(0x7efe9ceb), X(0x7f0147ae),
-  X(0x7f03ed4a), X(0x7f068dc4), X(0x7f092922), X(0x7f0bbf69),
-  X(0x7f0e50a1), X(0x7f10dcce), X(0x7f1363f7), X(0x7f15e622),
-  X(0x7f186355), X(0x7f1adb95), X(0x7f1d4ee9), X(0x7f1fbd57),
-  X(0x7f2226e4), X(0x7f248b96), X(0x7f26eb74), X(0x7f294683),
-  X(0x7f2b9cc9), X(0x7f2dee4d), X(0x7f303b13), X(0x7f328322),
-  X(0x7f34c680), X(0x7f370533), X(0x7f393f40), X(0x7f3b74ad),
-  X(0x7f3da581), X(0x7f3fd1c1), X(0x7f41f972), X(0x7f441c9c),
-  X(0x7f463b43), X(0x7f48556d), X(0x7f4a6b21), X(0x7f4c7c64),
-  X(0x7f4e893c), X(0x7f5091ae), X(0x7f5295c1), X(0x7f54957a),
-  X(0x7f5690e0), X(0x7f5887f7), X(0x7f5a7ac5), X(0x7f5c6951),
-  X(0x7f5e53a0), X(0x7f6039b8), X(0x7f621b9e), X(0x7f63f958),
-  X(0x7f65d2ed), X(0x7f67a861), X(0x7f6979ba), X(0x7f6b46ff),
-  X(0x7f6d1034), X(0x7f6ed560), X(0x7f709687), X(0x7f7253b1),
-  X(0x7f740ce1), X(0x7f75c21f), X(0x7f777370), X(0x7f7920d8),
-  X(0x7f7aca5f), X(0x7f7c7008), X(0x7f7e11db), X(0x7f7fafdd),
-  X(0x7f814a13), X(0x7f82e082), X(0x7f847331), X(0x7f860224),
-  X(0x7f878d62), X(0x7f8914f0), X(0x7f8a98d4), X(0x7f8c1912),
-  X(0x7f8d95b0), X(0x7f8f0eb5), X(0x7f908425), X(0x7f91f605),
-  X(0x7f93645c), X(0x7f94cf2f), X(0x7f963683), X(0x7f979a5d),
-  X(0x7f98fac4), X(0x7f9a57bb), X(0x7f9bb14a), X(0x7f9d0775),
-  X(0x7f9e5a41), X(0x7f9fa9b4), X(0x7fa0f5d3), X(0x7fa23ea4),
-  X(0x7fa3842b), X(0x7fa4c66f), X(0x7fa60575), X(0x7fa74141),
-  X(0x7fa879d9), X(0x7fa9af42), X(0x7faae182), X(0x7fac109e),
-  X(0x7fad3c9a), X(0x7fae657d), X(0x7faf8b4c), X(0x7fb0ae0b),
-  X(0x7fb1cdc0), X(0x7fb2ea70), X(0x7fb40420), X(0x7fb51ad5),
-  X(0x7fb62e95), X(0x7fb73f64), X(0x7fb84d48), X(0x7fb95846),
-  X(0x7fba6062), X(0x7fbb65a2), X(0x7fbc680c), X(0x7fbd67a3),
-  X(0x7fbe646d), X(0x7fbf5e70), X(0x7fc055af), X(0x7fc14a31),
-  X(0x7fc23bf9), X(0x7fc32b0d), X(0x7fc41773), X(0x7fc5012e),
-  X(0x7fc5e844), X(0x7fc6ccba), X(0x7fc7ae94), X(0x7fc88dd8),
-  X(0x7fc96a8a), X(0x7fca44af), X(0x7fcb1c4c), X(0x7fcbf167),
-  X(0x7fccc403), X(0x7fcd9425), X(0x7fce61d3), X(0x7fcf2d11),
-  X(0x7fcff5e3), X(0x7fd0bc4f), X(0x7fd1805a), X(0x7fd24207),
-  X(0x7fd3015c), X(0x7fd3be5d), X(0x7fd47910), X(0x7fd53178),
-  X(0x7fd5e79b), X(0x7fd69b7c), X(0x7fd74d21), X(0x7fd7fc8e),
-  X(0x7fd8a9c8), X(0x7fd954d4), X(0x7fd9fdb5), X(0x7fdaa471),
-  X(0x7fdb490b), X(0x7fdbeb89), X(0x7fdc8bef), X(0x7fdd2a42),
-  X(0x7fddc685), X(0x7fde60be), X(0x7fdef8f0), X(0x7fdf8f20),
-  X(0x7fe02353), X(0x7fe0b58d), X(0x7fe145d3), X(0x7fe1d428),
-  X(0x7fe26091), X(0x7fe2eb12), X(0x7fe373b0), X(0x7fe3fa6f),
-  X(0x7fe47f53), X(0x7fe50260), X(0x7fe5839b), X(0x7fe60308),
-  X(0x7fe680ab), X(0x7fe6fc88), X(0x7fe776a4), X(0x7fe7ef02),
-  X(0x7fe865a7), X(0x7fe8da97), X(0x7fe94dd6), X(0x7fe9bf68),
-  X(0x7fea2f51), X(0x7fea9d95), X(0x7feb0a39), X(0x7feb7540),
-  X(0x7febdeae), X(0x7fec4687), X(0x7fecaccf), X(0x7fed118b),
-  X(0x7fed74be), X(0x7fedd66c), X(0x7fee3698), X(0x7fee9548),
-  X(0x7feef27e), X(0x7fef4e3f), X(0x7fefa88e), X(0x7ff0016f),
-  X(0x7ff058e7), X(0x7ff0aef8), X(0x7ff103a6), X(0x7ff156f6),
-  X(0x7ff1a8eb), X(0x7ff1f988), X(0x7ff248d2), X(0x7ff296cc),
-  X(0x7ff2e37a), X(0x7ff32edf), X(0x7ff378ff), X(0x7ff3c1de),
-  X(0x7ff4097e), X(0x7ff44fe5), X(0x7ff49515), X(0x7ff4d911),
-  X(0x7ff51bde), X(0x7ff55d7f), X(0x7ff59df7), X(0x7ff5dd4a),
-  X(0x7ff61b7b), X(0x7ff6588d), X(0x7ff69485), X(0x7ff6cf65),
-  X(0x7ff70930), X(0x7ff741eb), X(0x7ff77998), X(0x7ff7b03b),
-  X(0x7ff7e5d7), X(0x7ff81a6f), X(0x7ff84e06), X(0x7ff880a1),
-  X(0x7ff8b241), X(0x7ff8e2ea), X(0x7ff912a0), X(0x7ff94165),
-  X(0x7ff96f3d), X(0x7ff99c2b), X(0x7ff9c831), X(0x7ff9f354),
-  X(0x7ffa1d95), X(0x7ffa46f9), X(0x7ffa6f81), X(0x7ffa9731),
-  X(0x7ffabe0d), X(0x7ffae416), X(0x7ffb0951), X(0x7ffb2dbf),
-  X(0x7ffb5164), X(0x7ffb7442), X(0x7ffb965d), X(0x7ffbb7b8),
-  X(0x7ffbd854), X(0x7ffbf836), X(0x7ffc175f), X(0x7ffc35d3),
-  X(0x7ffc5394), X(0x7ffc70a5), X(0x7ffc8d09), X(0x7ffca8c2),
-  X(0x7ffcc3d4), X(0x7ffcde3f), X(0x7ffcf809), X(0x7ffd1132),
-  X(0x7ffd29be), X(0x7ffd41ae), X(0x7ffd5907), X(0x7ffd6fc9),
-  X(0x7ffd85f9), X(0x7ffd9b97), X(0x7ffdb0a7), X(0x7ffdc52b),
-  X(0x7ffdd926), X(0x7ffdec99), X(0x7ffdff88), X(0x7ffe11f4),
-  X(0x7ffe23e0), X(0x7ffe354f), X(0x7ffe4642), X(0x7ffe56bc),
-  X(0x7ffe66bf), X(0x7ffe764e), X(0x7ffe856a), X(0x7ffe9416),
-  X(0x7ffea254), X(0x7ffeb026), X(0x7ffebd8e), X(0x7ffeca8f),
-  X(0x7ffed72a), X(0x7ffee362), X(0x7ffeef38), X(0x7ffefaaf),
-  X(0x7fff05c9), X(0x7fff1087), X(0x7fff1aec), X(0x7fff24f9),
-  X(0x7fff2eb1), X(0x7fff3816), X(0x7fff4128), X(0x7fff49eb),
-  X(0x7fff5260), X(0x7fff5a88), X(0x7fff6266), X(0x7fff69fc),
-  X(0x7fff714b), X(0x7fff7854), X(0x7fff7f1a), X(0x7fff859f),
-  X(0x7fff8be3), X(0x7fff91ea), X(0x7fff97b3), X(0x7fff9d41),
-  X(0x7fffa296), X(0x7fffa7b3), X(0x7fffac99), X(0x7fffb14b),
-  X(0x7fffb5c9), X(0x7fffba15), X(0x7fffbe31), X(0x7fffc21d),
-  X(0x7fffc5dc), X(0x7fffc96f), X(0x7fffccd8), X(0x7fffd016),
-  X(0x7fffd32d), X(0x7fffd61c), X(0x7fffd8e7), X(0x7fffdb8d),
-  X(0x7fffde0f), X(0x7fffe071), X(0x7fffe2b1), X(0x7fffe4d2),
-  X(0x7fffe6d5), X(0x7fffe8bb), X(0x7fffea85), X(0x7fffec34),
-  X(0x7fffedc9), X(0x7fffef45), X(0x7ffff0aa), X(0x7ffff1f7),
-  X(0x7ffff330), X(0x7ffff453), X(0x7ffff562), X(0x7ffff65f),
-  X(0x7ffff749), X(0x7ffff823), X(0x7ffff8ec), X(0x7ffff9a6),
-  X(0x7ffffa51), X(0x7ffffaee), X(0x7ffffb7e), X(0x7ffffc02),
-  X(0x7ffffc7a), X(0x7ffffce7), X(0x7ffffd4a), X(0x7ffffda3),
-  X(0x7ffffdf4), X(0x7ffffe3c), X(0x7ffffe7c), X(0x7ffffeb6),
-  X(0x7ffffee8), X(0x7fffff15), X(0x7fffff3c), X(0x7fffff5e),
-  X(0x7fffff7b), X(0x7fffff95), X(0x7fffffaa), X(0x7fffffbc),
-  X(0x7fffffcb), X(0x7fffffd7), X(0x7fffffe2), X(0x7fffffea),
-  X(0x7ffffff0), X(0x7ffffff5), X(0x7ffffff9), X(0x7ffffffb),
-  X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff),
-  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
-};
-
-static LOOKUP_T vwin8192[4096] = {
-  X(0x0000007c), X(0x0000045c), X(0x00000c1d), X(0x000017bd),
-  X(0x0000273e), X(0x00003a9f), X(0x000051e0), X(0x00006d02),
-  X(0x00008c03), X(0x0000aee5), X(0x0000d5a7), X(0x00010049),
-  X(0x00012ecb), X(0x0001612d), X(0x00019770), X(0x0001d193),
-  X(0x00020f96), X(0x00025178), X(0x0002973c), X(0x0002e0df),
-  X(0x00032e62), X(0x00037fc5), X(0x0003d509), X(0x00042e2c),
-  X(0x00048b30), X(0x0004ec13), X(0x000550d7), X(0x0005b97a),
-  X(0x000625fe), X(0x00069661), X(0x00070aa4), X(0x000782c8),
-  X(0x0007fecb), X(0x00087eae), X(0x00090271), X(0x00098a14),
-  X(0x000a1597), X(0x000aa4f9), X(0x000b383b), X(0x000bcf5d),
-  X(0x000c6a5f), X(0x000d0941), X(0x000dac02), X(0x000e52a3),
-  X(0x000efd23), X(0x000fab84), X(0x00105dc3), X(0x001113e3),
-  X(0x0011cde2), X(0x00128bc0), X(0x00134d7e), X(0x0014131b),
-  X(0x0014dc98), X(0x0015a9f4), X(0x00167b30), X(0x0017504a),
-  X(0x00182945), X(0x0019061e), X(0x0019e6d7), X(0x001acb6f),
-  X(0x001bb3e6), X(0x001ca03c), X(0x001d9071), X(0x001e8485),
-  X(0x001f7c79), X(0x0020784b), X(0x002177fc), X(0x00227b8c),
-  X(0x002382fb), X(0x00248e49), X(0x00259d76), X(0x0026b081),
-  X(0x0027c76b), X(0x0028e234), X(0x002a00dc), X(0x002b2361),
-  X(0x002c49c6), X(0x002d7409), X(0x002ea22a), X(0x002fd42a),
-  X(0x00310a08), X(0x003243c5), X(0x00338160), X(0x0034c2d9),
-  X(0x00360830), X(0x00375165), X(0x00389e78), X(0x0039ef6a),
-  X(0x003b4439), X(0x003c9ce6), X(0x003df971), X(0x003f59da),
-  X(0x0040be20), X(0x00422645), X(0x00439247), X(0x00450226),
-  X(0x004675e3), X(0x0047ed7e), X(0x004968f5), X(0x004ae84b),
-  X(0x004c6b7d), X(0x004df28d), X(0x004f7d7a), X(0x00510c44),
-  X(0x00529eeb), X(0x00543570), X(0x0055cfd1), X(0x00576e0f),
-  X(0x00591029), X(0x005ab621), X(0x005c5ff5), X(0x005e0da6),
-  X(0x005fbf33), X(0x0061749d), X(0x00632de4), X(0x0064eb06),
-  X(0x0066ac05), X(0x006870e0), X(0x006a3998), X(0x006c062b),
-  X(0x006dd69b), X(0x006faae6), X(0x0071830d), X(0x00735f10),
-  X(0x00753eef), X(0x007722a9), X(0x00790a3f), X(0x007af5b1),
-  X(0x007ce4fe), X(0x007ed826), X(0x0080cf29), X(0x0082ca08),
-  X(0x0084c8c2), X(0x0086cb57), X(0x0088d1c7), X(0x008adc11),
-  X(0x008cea37), X(0x008efc37), X(0x00911212), X(0x00932bc7),
-  X(0x00954957), X(0x00976ac2), X(0x00999006), X(0x009bb925),
-  X(0x009de61e), X(0x00a016f1), X(0x00a24b9e), X(0x00a48425),
-  X(0x00a6c086), X(0x00a900c0), X(0x00ab44d4), X(0x00ad8cc2),
-  X(0x00afd889), X(0x00b22829), X(0x00b47ba2), X(0x00b6d2f5),
-  X(0x00b92e21), X(0x00bb8d26), X(0x00bdf004), X(0x00c056ba),
-  X(0x00c2c149), X(0x00c52fb1), X(0x00c7a1f1), X(0x00ca180a),
-  X(0x00cc91fb), X(0x00cf0fc5), X(0x00d19166), X(0x00d416df),
-  X(0x00d6a031), X(0x00d92d5a), X(0x00dbbe5b), X(0x00de5333),
-  X(0x00e0ebe3), X(0x00e3886b), X(0x00e628c9), X(0x00e8ccff),
-  X(0x00eb750c), X(0x00ee20f0), X(0x00f0d0ab), X(0x00f3843d),
-  X(0x00f63ba5), X(0x00f8f6e4), X(0x00fbb5fa), X(0x00fe78e5),
-  X(0x01013fa7), X(0x01040a3f), X(0x0106d8ae), X(0x0109aaf2),
-  X(0x010c810c), X(0x010f5afb), X(0x011238c0), X(0x01151a5b),
-  X(0x0117ffcb), X(0x011ae910), X(0x011dd62a), X(0x0120c719),
-  X(0x0123bbdd), X(0x0126b476), X(0x0129b0e4), X(0x012cb126),
-  X(0x012fb53c), X(0x0132bd27), X(0x0135c8e6), X(0x0138d879),
-  X(0x013bebdf), X(0x013f031a), X(0x01421e28), X(0x01453d0a),
-  X(0x01485fbf), X(0x014b8648), X(0x014eb0a4), X(0x0151ded2),
-  X(0x015510d4), X(0x015846a8), X(0x015b8050), X(0x015ebdc9),
-  X(0x0161ff15), X(0x01654434), X(0x01688d24), X(0x016bd9e6),
-  X(0x016f2a7b), X(0x01727ee1), X(0x0175d718), X(0x01793321),
-  X(0x017c92fc), X(0x017ff6a7), X(0x01835e24), X(0x0186c972),
-  X(0x018a3890), X(0x018dab7f), X(0x0191223f), X(0x01949ccf),
-  X(0x01981b2f), X(0x019b9d5f), X(0x019f235f), X(0x01a2ad2f),
-  X(0x01a63acf), X(0x01a9cc3e), X(0x01ad617c), X(0x01b0fa8a),
-  X(0x01b49767), X(0x01b83813), X(0x01bbdc8d), X(0x01bf84d6),
-  X(0x01c330ee), X(0x01c6e0d4), X(0x01ca9488), X(0x01ce4c0b),
-  X(0x01d2075b), X(0x01d5c679), X(0x01d98964), X(0x01dd501d),
-  X(0x01e11aa3), X(0x01e4e8f6), X(0x01e8bb17), X(0x01ec9104),
-  X(0x01f06abd), X(0x01f44844), X(0x01f82996), X(0x01fc0eb5),
-  X(0x01fff7a0), X(0x0203e456), X(0x0207d4d9), X(0x020bc926),
-  X(0x020fc140), X(0x0213bd24), X(0x0217bcd4), X(0x021bc04e),
-  X(0x021fc793), X(0x0223d2a3), X(0x0227e17d), X(0x022bf421),
-  X(0x02300a90), X(0x023424c8), X(0x023842ca), X(0x023c6495),
-  X(0x02408a2a), X(0x0244b389), X(0x0248e0b0), X(0x024d11a0),
-  X(0x02514659), X(0x02557eda), X(0x0259bb24), X(0x025dfb35),
-  X(0x02623f0f), X(0x026686b1), X(0x026ad21a), X(0x026f214b),
-  X(0x02737443), X(0x0277cb02), X(0x027c2588), X(0x028083d5),
-  X(0x0284e5e9), X(0x02894bc2), X(0x028db562), X(0x029222c8),
-  X(0x029693f4), X(0x029b08e6), X(0x029f819d), X(0x02a3fe19),
-  X(0x02a87e5b), X(0x02ad0261), X(0x02b18a2c), X(0x02b615bb),
-  X(0x02baa50f), X(0x02bf3827), X(0x02c3cf03), X(0x02c869a3),
-  X(0x02cd0807), X(0x02d1aa2d), X(0x02d65017), X(0x02daf9c4),
-  X(0x02dfa734), X(0x02e45866), X(0x02e90d5b), X(0x02edc612),
-  X(0x02f2828b), X(0x02f742c6), X(0x02fc06c3), X(0x0300ce80),
-  X(0x030599ff), X(0x030a6940), X(0x030f3c40), X(0x03141302),
-  X(0x0318ed84), X(0x031dcbc6), X(0x0322adc8), X(0x0327938a),
-  X(0x032c7d0c), X(0x03316a4c), X(0x03365b4d), X(0x033b500c),
-  X(0x03404889), X(0x034544c6), X(0x034a44c0), X(0x034f4879),
-  X(0x03544ff0), X(0x03595b24), X(0x035e6a16), X(0x03637cc5),
-  X(0x03689331), X(0x036dad5a), X(0x0372cb40), X(0x0377ece2),
-  X(0x037d1240), X(0x03823b5a), X(0x03876830), X(0x038c98c1),
-  X(0x0391cd0e), X(0x03970516), X(0x039c40d8), X(0x03a18055),
-  X(0x03a6c38d), X(0x03ac0a7f), X(0x03b1552b), X(0x03b6a390),
-  X(0x03bbf5af), X(0x03c14b88), X(0x03c6a519), X(0x03cc0263),
-  X(0x03d16366), X(0x03d6c821), X(0x03dc3094), X(0x03e19cc0),
-  X(0x03e70ca2), X(0x03ec803d), X(0x03f1f78e), X(0x03f77296),
-  X(0x03fcf155), X(0x040273cb), X(0x0407f9f7), X(0x040d83d9),
-  X(0x04131170), X(0x0418a2bd), X(0x041e37c0), X(0x0423d077),
-  X(0x04296ce4), X(0x042f0d04), X(0x0434b0da), X(0x043a5863),
-  X(0x044003a0), X(0x0445b290), X(0x044b6534), X(0x04511b8b),
-  X(0x0456d595), X(0x045c9352), X(0x046254c1), X(0x046819e1),
-  X(0x046de2b4), X(0x0473af39), X(0x04797f6e), X(0x047f5355),
-  X(0x04852aec), X(0x048b0635), X(0x0490e52d), X(0x0496c7d6),
-  X(0x049cae2e), X(0x04a29836), X(0x04a885ed), X(0x04ae7753),
-  X(0x04b46c68), X(0x04ba652b), X(0x04c0619d), X(0x04c661bc),
-  X(0x04cc658a), X(0x04d26d04), X(0x04d8782c), X(0x04de8701),
-  X(0x04e49983), X(0x04eaafb0), X(0x04f0c98a), X(0x04f6e710),
-  X(0x04fd0842), X(0x05032d1e), X(0x050955a6), X(0x050f81d8),
-  X(0x0515b1b5), X(0x051be53d), X(0x05221c6e), X(0x05285748),
-  X(0x052e95cd), X(0x0534d7fa), X(0x053b1dd0), X(0x0541674e),
-  X(0x0547b475), X(0x054e0544), X(0x055459bb), X(0x055ab1d9),
-  X(0x05610d9e), X(0x05676d0a), X(0x056dd01c), X(0x057436d5),
-  X(0x057aa134), X(0x05810f38), X(0x058780e2), X(0x058df631),
-  X(0x05946f25), X(0x059aebbe), X(0x05a16bfa), X(0x05a7efdb),
-  X(0x05ae775f), X(0x05b50287), X(0x05bb9152), X(0x05c223c0),
-  X(0x05c8b9d0), X(0x05cf5382), X(0x05d5f0d6), X(0x05dc91cc),
-  X(0x05e33663), X(0x05e9de9c), X(0x05f08a75), X(0x05f739ee),
-  X(0x05fded07), X(0x0604a3c0), X(0x060b5e19), X(0x06121c11),
-  X(0x0618dda8), X(0x061fa2dd), X(0x06266bb1), X(0x062d3822),
-  X(0x06340831), X(0x063adbde), X(0x0641b328), X(0x06488e0e),
-  X(0x064f6c91), X(0x06564eaf), X(0x065d346a), X(0x06641dc0),
-  X(0x066b0ab1), X(0x0671fb3d), X(0x0678ef64), X(0x067fe724),
-  X(0x0686e27f), X(0x068de173), X(0x0694e400), X(0x069bea27),
-  X(0x06a2f3e6), X(0x06aa013d), X(0x06b1122c), X(0x06b826b3),
-  X(0x06bf3ed1), X(0x06c65a86), X(0x06cd79d1), X(0x06d49cb3),
-  X(0x06dbc32b), X(0x06e2ed38), X(0x06ea1adb), X(0x06f14c13),
-  X(0x06f880df), X(0x06ffb940), X(0x0706f535), X(0x070e34bd),
-  X(0x071577d9), X(0x071cbe88), X(0x072408c9), X(0x072b569d),
-  X(0x0732a802), X(0x0739fcf9), X(0x07415582), X(0x0748b19b),
-  X(0x07501145), X(0x0757747f), X(0x075edb49), X(0x076645a3),
-  X(0x076db38c), X(0x07752503), X(0x077c9a09), X(0x0784129e),
-  X(0x078b8ec0), X(0x07930e70), X(0x079a91ac), X(0x07a21876),
-  X(0x07a9a2cc), X(0x07b130ad), X(0x07b8c21b), X(0x07c05714),
-  X(0x07c7ef98), X(0x07cf8ba6), X(0x07d72b3f), X(0x07dece62),
-  X(0x07e6750e), X(0x07ee1f43), X(0x07f5cd01), X(0x07fd7e48),
-  X(0x08053316), X(0x080ceb6d), X(0x0814a74a), X(0x081c66af),
-  X(0x0824299a), X(0x082bf00c), X(0x0833ba03), X(0x083b8780),
-  X(0x08435882), X(0x084b2d09), X(0x08530514), X(0x085ae0a3),
-  X(0x0862bfb6), X(0x086aa24c), X(0x08728865), X(0x087a7201),
-  X(0x08825f1e), X(0x088a4fbe), X(0x089243de), X(0x089a3b80),
-  X(0x08a236a2), X(0x08aa3545), X(0x08b23767), X(0x08ba3d09),
-  X(0x08c2462a), X(0x08ca52c9), X(0x08d262e7), X(0x08da7682),
-  X(0x08e28d9c), X(0x08eaa832), X(0x08f2c645), X(0x08fae7d4),
-  X(0x09030cdf), X(0x090b3566), X(0x09136168), X(0x091b90e5),
-  X(0x0923c3dc), X(0x092bfa4d), X(0x09343437), X(0x093c719b),
-  X(0x0944b277), X(0x094cf6cc), X(0x09553e99), X(0x095d89dd),
-  X(0x0965d899), X(0x096e2acb), X(0x09768073), X(0x097ed991),
-  X(0x09873625), X(0x098f962e), X(0x0997f9ac), X(0x09a0609e),
-  X(0x09a8cb04), X(0x09b138dd), X(0x09b9aa29), X(0x09c21ee8),
-  X(0x09ca9719), X(0x09d312bc), X(0x09db91d0), X(0x09e41456),
-  X(0x09ec9a4b), X(0x09f523b1), X(0x09fdb087), X(0x0a0640cc),
-  X(0x0a0ed47f), X(0x0a176ba2), X(0x0a200632), X(0x0a28a42f),
-  X(0x0a31459a), X(0x0a39ea72), X(0x0a4292b5), X(0x0a4b3e65),
-  X(0x0a53ed80), X(0x0a5ca006), X(0x0a6555f7), X(0x0a6e0f51),
-  X(0x0a76cc16), X(0x0a7f8c44), X(0x0a884fda), X(0x0a9116d9),
-  X(0x0a99e140), X(0x0aa2af0e), X(0x0aab8043), X(0x0ab454df),
-  X(0x0abd2ce1), X(0x0ac60849), X(0x0acee716), X(0x0ad7c948),
-  X(0x0ae0aedf), X(0x0ae997d9), X(0x0af28437), X(0x0afb73f7),
-  X(0x0b04671b), X(0x0b0d5da0), X(0x0b165788), X(0x0b1f54d0),
-  X(0x0b285579), X(0x0b315983), X(0x0b3a60ec), X(0x0b436bb5),
-  X(0x0b4c79dd), X(0x0b558b63), X(0x0b5ea048), X(0x0b67b88a),
-  X(0x0b70d429), X(0x0b79f324), X(0x0b83157c), X(0x0b8c3b30),
-  X(0x0b95643f), X(0x0b9e90a8), X(0x0ba7c06c), X(0x0bb0f38a),
-  X(0x0bba2a01), X(0x0bc363d1), X(0x0bcca0f9), X(0x0bd5e17a),
-  X(0x0bdf2552), X(0x0be86c81), X(0x0bf1b706), X(0x0bfb04e2),
-  X(0x0c045613), X(0x0c0daa99), X(0x0c170274), X(0x0c205da3),
-  X(0x0c29bc25), X(0x0c331dfb), X(0x0c3c8323), X(0x0c45eb9e),
-  X(0x0c4f576a), X(0x0c58c688), X(0x0c6238f6), X(0x0c6baeb5),
-  X(0x0c7527c3), X(0x0c7ea421), X(0x0c8823cd), X(0x0c91a6c8),
-  X(0x0c9b2d10), X(0x0ca4b6a6), X(0x0cae4389), X(0x0cb7d3b8),
-  X(0x0cc16732), X(0x0ccafdf8), X(0x0cd49809), X(0x0cde3564),
-  X(0x0ce7d609), X(0x0cf179f7), X(0x0cfb212e), X(0x0d04cbad),
-  X(0x0d0e7974), X(0x0d182a83), X(0x0d21ded8), X(0x0d2b9673),
-  X(0x0d355154), X(0x0d3f0f7b), X(0x0d48d0e6), X(0x0d529595),
-  X(0x0d5c5d88), X(0x0d6628be), X(0x0d6ff737), X(0x0d79c8f2),
-  X(0x0d839dee), X(0x0d8d762c), X(0x0d9751aa), X(0x0da13068),
-  X(0x0dab1266), X(0x0db4f7a3), X(0x0dbee01e), X(0x0dc8cbd8),
-  X(0x0dd2bace), X(0x0ddcad02), X(0x0de6a272), X(0x0df09b1e),
-  X(0x0dfa9705), X(0x0e049627), X(0x0e0e9883), X(0x0e189e19),
-  X(0x0e22a6e8), X(0x0e2cb2f0), X(0x0e36c230), X(0x0e40d4a8),
-  X(0x0e4aea56), X(0x0e55033b), X(0x0e5f1f56), X(0x0e693ea7),
-  X(0x0e73612c), X(0x0e7d86e5), X(0x0e87afd3), X(0x0e91dbf3),
-  X(0x0e9c0b47), X(0x0ea63dcc), X(0x0eb07383), X(0x0ebaac6b),
-  X(0x0ec4e883), X(0x0ecf27cc), X(0x0ed96a44), X(0x0ee3afea),
-  X(0x0eedf8bf), X(0x0ef844c2), X(0x0f0293f2), X(0x0f0ce64e),
-  X(0x0f173bd6), X(0x0f21948a), X(0x0f2bf069), X(0x0f364f72),
-  X(0x0f40b1a5), X(0x0f4b1701), X(0x0f557f86), X(0x0f5feb32),
-  X(0x0f6a5a07), X(0x0f74cc02), X(0x0f7f4124), X(0x0f89b96b),
-  X(0x0f9434d8), X(0x0f9eb369), X(0x0fa9351e), X(0x0fb3b9f7),
-  X(0x0fbe41f3), X(0x0fc8cd11), X(0x0fd35b51), X(0x0fddecb2),
-  X(0x0fe88134), X(0x0ff318d6), X(0x0ffdb397), X(0x10085177),
-  X(0x1012f275), X(0x101d9691), X(0x10283dca), X(0x1032e81f),
-  X(0x103d9591), X(0x1048461e), X(0x1052f9c5), X(0x105db087),
-  X(0x10686a62), X(0x10732756), X(0x107de763), X(0x1088aa87),
-  X(0x109370c2), X(0x109e3a14), X(0x10a9067c), X(0x10b3d5f9),
-  X(0x10bea88b), X(0x10c97e31), X(0x10d456eb), X(0x10df32b8),
-  X(0x10ea1197), X(0x10f4f387), X(0x10ffd889), X(0x110ac09b),
-  X(0x1115abbe), X(0x112099ef), X(0x112b8b2f), X(0x11367f7d),
-  X(0x114176d9), X(0x114c7141), X(0x11576eb6), X(0x11626f36),
-  X(0x116d72c1), X(0x11787957), X(0x118382f6), X(0x118e8f9e),
-  X(0x11999f4f), X(0x11a4b208), X(0x11afc7c7), X(0x11bae08e),
-  X(0x11c5fc5a), X(0x11d11b2c), X(0x11dc3d02), X(0x11e761dd),
-  X(0x11f289ba), X(0x11fdb49b), X(0x1208e27e), X(0x12141362),
-  X(0x121f4748), X(0x122a7e2d), X(0x1235b812), X(0x1240f4f6),
-  X(0x124c34d9), X(0x125777b9), X(0x1262bd96), X(0x126e0670),
-  X(0x12795245), X(0x1284a115), X(0x128ff2e0), X(0x129b47a5),
-  X(0x12a69f63), X(0x12b1fa19), X(0x12bd57c7), X(0x12c8b86c),
-  X(0x12d41c08), X(0x12df829a), X(0x12eaec21), X(0x12f6589d),
-  X(0x1301c80c), X(0x130d3a6f), X(0x1318afc4), X(0x1324280b),
-  X(0x132fa344), X(0x133b216d), X(0x1346a286), X(0x1352268e),
-  X(0x135dad85), X(0x1369376a), X(0x1374c43c), X(0x138053fb),
-  X(0x138be6a5), X(0x13977c3b), X(0x13a314bc), X(0x13aeb026),
-  X(0x13ba4e79), X(0x13c5efb5), X(0x13d193d9), X(0x13dd3ae4),
-  X(0x13e8e4d6), X(0x13f491ad), X(0x1400416a), X(0x140bf40b),
-  X(0x1417a98f), X(0x142361f7), X(0x142f1d41), X(0x143adb6d),
-  X(0x14469c7a), X(0x14526067), X(0x145e2734), X(0x1469f0df),
-  X(0x1475bd69), X(0x14818cd0), X(0x148d5f15), X(0x14993435),
-  X(0x14a50c31), X(0x14b0e708), X(0x14bcc4b8), X(0x14c8a542),
-  X(0x14d488a5), X(0x14e06edf), X(0x14ec57f1), X(0x14f843d9),
-  X(0x15043297), X(0x1510242b), X(0x151c1892), X(0x15280fcd),
-  X(0x153409dc), X(0x154006bc), X(0x154c066e), X(0x155808f1),
-  X(0x15640e44), X(0x15701666), X(0x157c2157), X(0x15882f16),
-  X(0x15943fa2), X(0x15a052fb), X(0x15ac691f), X(0x15b8820f),
-  X(0x15c49dc8), X(0x15d0bc4c), X(0x15dcdd98), X(0x15e901ad),
-  X(0x15f52888), X(0x1601522b), X(0x160d7e93), X(0x1619adc1),
-  X(0x1625dfb3), X(0x16321469), X(0x163e4be2), X(0x164a861d),
-  X(0x1656c31a), X(0x166302d8), X(0x166f4555), X(0x167b8a92),
-  X(0x1687d28e), X(0x16941d47), X(0x16a06abe), X(0x16acbaf0),
-  X(0x16b90ddf), X(0x16c56388), X(0x16d1bbeb), X(0x16de1708),
-  X(0x16ea74dd), X(0x16f6d56a), X(0x170338ae), X(0x170f9ea8),
-  X(0x171c0758), X(0x172872bd), X(0x1734e0d6), X(0x174151a2),
-  X(0x174dc520), X(0x175a3b51), X(0x1766b432), X(0x17732fc4),
-  X(0x177fae05), X(0x178c2ef4), X(0x1798b292), X(0x17a538dd),
-  X(0x17b1c1d4), X(0x17be4d77), X(0x17cadbc5), X(0x17d76cbc),
-  X(0x17e4005e), X(0x17f096a7), X(0x17fd2f98), X(0x1809cb31),
-  X(0x1816696f), X(0x18230a53), X(0x182faddc), X(0x183c5408),
-  X(0x1848fcd8), X(0x1855a849), X(0x1862565d), X(0x186f0711),
-  X(0x187bba64), X(0x18887057), X(0x189528e9), X(0x18a1e418),
-  X(0x18aea1e3), X(0x18bb624b), X(0x18c8254e), X(0x18d4eaeb),
-  X(0x18e1b321), X(0x18ee7df1), X(0x18fb4b58), X(0x19081b57),
-  X(0x1914edec), X(0x1921c317), X(0x192e9ad6), X(0x193b7529),
-  X(0x19485210), X(0x19553189), X(0x19621393), X(0x196ef82e),
-  X(0x197bdf59), X(0x1988c913), X(0x1995b55c), X(0x19a2a432),
-  X(0x19af9595), X(0x19bc8983), X(0x19c97ffd), X(0x19d67900),
-  X(0x19e3748e), X(0x19f072a3), X(0x19fd7341), X(0x1a0a7665),
-  X(0x1a177c10), X(0x1a248440), X(0x1a318ef4), X(0x1a3e9c2c),
-  X(0x1a4babe7), X(0x1a58be24), X(0x1a65d2e2), X(0x1a72ea20),
-  X(0x1a8003de), X(0x1a8d201a), X(0x1a9a3ed5), X(0x1aa7600c),
-  X(0x1ab483bf), X(0x1ac1a9ee), X(0x1aced297), X(0x1adbfdba),
-  X(0x1ae92b56), X(0x1af65b69), X(0x1b038df4), X(0x1b10c2f5),
-  X(0x1b1dfa6b), X(0x1b2b3456), X(0x1b3870b5), X(0x1b45af87),
-  X(0x1b52f0ca), X(0x1b60347f), X(0x1b6d7aa4), X(0x1b7ac339),
-  X(0x1b880e3c), X(0x1b955bad), X(0x1ba2ab8b), X(0x1baffdd5),
-  X(0x1bbd528a), X(0x1bcaa9a9), X(0x1bd80332), X(0x1be55f24),
-  X(0x1bf2bd7d), X(0x1c001e3d), X(0x1c0d8164), X(0x1c1ae6ef),
-  X(0x1c284edf), X(0x1c35b932), X(0x1c4325e7), X(0x1c5094fe),
-  X(0x1c5e0677), X(0x1c6b7a4f), X(0x1c78f086), X(0x1c86691b),
-  X(0x1c93e40d), X(0x1ca1615c), X(0x1caee107), X(0x1cbc630c),
-  X(0x1cc9e76b), X(0x1cd76e23), X(0x1ce4f733), X(0x1cf2829a),
-  X(0x1d001057), X(0x1d0da06a), X(0x1d1b32d1), X(0x1d28c78c),
-  X(0x1d365e9a), X(0x1d43f7f9), X(0x1d5193a9), X(0x1d5f31aa),
-  X(0x1d6cd1f9), X(0x1d7a7497), X(0x1d881982), X(0x1d95c0ba),
-  X(0x1da36a3d), X(0x1db1160a), X(0x1dbec422), X(0x1dcc7482),
-  X(0x1dda272b), X(0x1de7dc1a), X(0x1df59350), X(0x1e034ccb),
-  X(0x1e11088a), X(0x1e1ec68c), X(0x1e2c86d1), X(0x1e3a4958),
-  X(0x1e480e20), X(0x1e55d527), X(0x1e639e6d), X(0x1e7169f1),
-  X(0x1e7f37b2), X(0x1e8d07b0), X(0x1e9ad9e8), X(0x1ea8ae5b),
-  X(0x1eb68507), X(0x1ec45dec), X(0x1ed23908), X(0x1ee0165b),
-  X(0x1eedf5e4), X(0x1efbd7a1), X(0x1f09bb92), X(0x1f17a1b6),
-  X(0x1f258a0d), X(0x1f337494), X(0x1f41614b), X(0x1f4f5032),
-  X(0x1f5d4147), X(0x1f6b3489), X(0x1f7929f7), X(0x1f872192),
-  X(0x1f951b56), X(0x1fa31744), X(0x1fb1155b), X(0x1fbf159a),
-  X(0x1fcd17ff), X(0x1fdb1c8b), X(0x1fe9233b), X(0x1ff72c0f),
-  X(0x20053706), X(0x20134420), X(0x2021535a), X(0x202f64b4),
-  X(0x203d782e), X(0x204b8dc6), X(0x2059a57c), X(0x2067bf4e),
-  X(0x2075db3b), X(0x2083f943), X(0x20921964), X(0x20a03b9e),
-  X(0x20ae5fef), X(0x20bc8657), X(0x20caaed5), X(0x20d8d967),
-  X(0x20e7060e), X(0x20f534c7), X(0x21036592), X(0x2111986e),
-  X(0x211fcd59), X(0x212e0454), X(0x213c3d5d), X(0x214a7873),
-  X(0x2158b594), X(0x2166f4c1), X(0x217535f8), X(0x21837938),
-  X(0x2191be81), X(0x21a005d0), X(0x21ae4f26), X(0x21bc9a81),
-  X(0x21cae7e0), X(0x21d93743), X(0x21e788a8), X(0x21f5dc0e),
-  X(0x22043174), X(0x221288da), X(0x2220e23e), X(0x222f3da0),
-  X(0x223d9afe), X(0x224bfa58), X(0x225a5bac), X(0x2268bef9),
-  X(0x2277243f), X(0x22858b7d), X(0x2293f4b0), X(0x22a25fda),
-  X(0x22b0ccf8), X(0x22bf3c09), X(0x22cdad0d), X(0x22dc2002),
-  X(0x22ea94e8), X(0x22f90bbe), X(0x23078482), X(0x2315ff33),
-  X(0x23247bd1), X(0x2332fa5b), X(0x23417acf), X(0x234ffd2c),
-  X(0x235e8173), X(0x236d07a0), X(0x237b8fb4), X(0x238a19ae),
-  X(0x2398a58c), X(0x23a7334d), X(0x23b5c2f1), X(0x23c45477),
-  X(0x23d2e7dd), X(0x23e17d22), X(0x23f01446), X(0x23fead47),
-  X(0x240d4825), X(0x241be4dd), X(0x242a8371), X(0x243923dd),
-  X(0x2447c622), X(0x24566a3e), X(0x24651031), X(0x2473b7f8),
-  X(0x24826194), X(0x24910d03), X(0x249fba44), X(0x24ae6957),
-  X(0x24bd1a39), X(0x24cbccea), X(0x24da816a), X(0x24e937b7),
-  X(0x24f7efcf), X(0x2506a9b3), X(0x25156560), X(0x252422d6),
-  X(0x2532e215), X(0x2541a31a), X(0x255065e4), X(0x255f2a74),
-  X(0x256df0c7), X(0x257cb8dd), X(0x258b82b4), X(0x259a4e4c),
-  X(0x25a91ba4), X(0x25b7eaba), X(0x25c6bb8e), X(0x25d58e1e),
-  X(0x25e46269), X(0x25f3386e), X(0x2602102d), X(0x2610e9a4),
-  X(0x261fc4d3), X(0x262ea1b7), X(0x263d8050), X(0x264c609e),
-  X(0x265b429e), X(0x266a2650), X(0x26790bb3), X(0x2687f2c6),
-  X(0x2696db88), X(0x26a5c5f7), X(0x26b4b213), X(0x26c39fda),
-  X(0x26d28f4c), X(0x26e18067), X(0x26f0732b), X(0x26ff6796),
-  X(0x270e5da7), X(0x271d555d), X(0x272c4eb7), X(0x273b49b5),
-  X(0x274a4654), X(0x27594495), X(0x27684475), X(0x277745f4),
-  X(0x27864910), X(0x27954dc9), X(0x27a4541e), X(0x27b35c0d),
-  X(0x27c26596), X(0x27d170b7), X(0x27e07d6f), X(0x27ef8bbd),
-  X(0x27fe9ba0), X(0x280dad18), X(0x281cc022), X(0x282bd4be),
-  X(0x283aeaeb), X(0x284a02a7), X(0x28591bf2), X(0x286836cb),
-  X(0x28775330), X(0x28867120), X(0x2895909b), X(0x28a4b19e),
-  X(0x28b3d42a), X(0x28c2f83d), X(0x28d21dd5), X(0x28e144f3),
-  X(0x28f06d94), X(0x28ff97b8), X(0x290ec35d), X(0x291df082),
-  X(0x292d1f27), X(0x293c4f4a), X(0x294b80eb), X(0x295ab407),
-  X(0x2969e89e), X(0x29791eaf), X(0x29885639), X(0x29978f3b),
-  X(0x29a6c9b3), X(0x29b605a0), X(0x29c54302), X(0x29d481d7),
-  X(0x29e3c21e), X(0x29f303d6), X(0x2a0246fd), X(0x2a118b94),
-  X(0x2a20d198), X(0x2a301909), X(0x2a3f61e6), X(0x2a4eac2c),
-  X(0x2a5df7dc), X(0x2a6d44f4), X(0x2a7c9374), X(0x2a8be359),
-  X(0x2a9b34a2), X(0x2aaa8750), X(0x2ab9db60), X(0x2ac930d1),
-  X(0x2ad887a3), X(0x2ae7dfd3), X(0x2af73962), X(0x2b06944e),
-  X(0x2b15f096), X(0x2b254e38), X(0x2b34ad34), X(0x2b440d89),
-  X(0x2b536f34), X(0x2b62d236), X(0x2b72368d), X(0x2b819c38),
-  X(0x2b910336), X(0x2ba06b86), X(0x2bafd526), X(0x2bbf4015),
-  X(0x2bceac53), X(0x2bde19de), X(0x2bed88b5), X(0x2bfcf8d7),
-  X(0x2c0c6a43), X(0x2c1bdcf7), X(0x2c2b50f3), X(0x2c3ac635),
-  X(0x2c4a3cbd), X(0x2c59b488), X(0x2c692d97), X(0x2c78a7e7),
-  X(0x2c882378), X(0x2c97a049), X(0x2ca71e58), X(0x2cb69da4),
-  X(0x2cc61e2c), X(0x2cd59ff0), X(0x2ce522ed), X(0x2cf4a723),
-  X(0x2d042c90), X(0x2d13b334), X(0x2d233b0d), X(0x2d32c41a),
-  X(0x2d424e5a), X(0x2d51d9cc), X(0x2d61666e), X(0x2d70f440),
-  X(0x2d808340), X(0x2d90136e), X(0x2d9fa4c7), X(0x2daf374c),
-  X(0x2dbecafa), X(0x2dce5fd1), X(0x2dddf5cf), X(0x2ded8cf4),
-  X(0x2dfd253d), X(0x2e0cbeab), X(0x2e1c593b), X(0x2e2bf4ed),
-  X(0x2e3b91c0), X(0x2e4b2fb1), X(0x2e5acec1), X(0x2e6a6eee),
-  X(0x2e7a1037), X(0x2e89b29b), X(0x2e995618), X(0x2ea8faad),
-  X(0x2eb8a05a), X(0x2ec8471c), X(0x2ed7eef4), X(0x2ee797df),
-  X(0x2ef741dc), X(0x2f06eceb), X(0x2f16990a), X(0x2f264639),
-  X(0x2f35f475), X(0x2f45a3bd), X(0x2f555412), X(0x2f650570),
-  X(0x2f74b7d8), X(0x2f846b48), X(0x2f941fbe), X(0x2fa3d53a),
-  X(0x2fb38bbb), X(0x2fc3433f), X(0x2fd2fbc5), X(0x2fe2b54c),
-  X(0x2ff26fd3), X(0x30022b58), X(0x3011e7db), X(0x3021a55a),
-  X(0x303163d4), X(0x30412348), X(0x3050e3b5), X(0x3060a519),
-  X(0x30706773), X(0x30802ac3), X(0x308fef06), X(0x309fb43d),
-  X(0x30af7a65), X(0x30bf417d), X(0x30cf0985), X(0x30ded27a),
-  X(0x30ee9c5d), X(0x30fe672b), X(0x310e32e3), X(0x311dff85),
-  X(0x312dcd0f), X(0x313d9b80), X(0x314d6ad7), X(0x315d3b12),
-  X(0x316d0c30), X(0x317cde31), X(0x318cb113), X(0x319c84d4),
-  X(0x31ac5974), X(0x31bc2ef1), X(0x31cc054b), X(0x31dbdc7f),
-  X(0x31ebb48e), X(0x31fb8d74), X(0x320b6733), X(0x321b41c7),
-  X(0x322b1d31), X(0x323af96e), X(0x324ad67e), X(0x325ab45f),
-  X(0x326a9311), X(0x327a7291), X(0x328a52e0), X(0x329a33fb),
-  X(0x32aa15e1), X(0x32b9f892), X(0x32c9dc0c), X(0x32d9c04d),
-  X(0x32e9a555), X(0x32f98b22), X(0x330971b4), X(0x33195909),
-  X(0x3329411f), X(0x333929f6), X(0x3349138c), X(0x3358fde1),
-  X(0x3368e8f2), X(0x3378d4c0), X(0x3388c147), X(0x3398ae89),
-  X(0x33a89c82), X(0x33b88b32), X(0x33c87a98), X(0x33d86ab2),
-  X(0x33e85b80), X(0x33f84d00), X(0x34083f30), X(0x34183210),
-  X(0x3428259f), X(0x343819db), X(0x34480ec3), X(0x34580455),
-  X(0x3467fa92), X(0x3477f176), X(0x3487e902), X(0x3497e134),
-  X(0x34a7da0a), X(0x34b7d384), X(0x34c7cda0), X(0x34d7c85e),
-  X(0x34e7c3bb), X(0x34f7bfb7), X(0x3507bc50), X(0x3517b985),
-  X(0x3527b756), X(0x3537b5c0), X(0x3547b4c3), X(0x3557b45d),
-  X(0x3567b48d), X(0x3577b552), X(0x3587b6aa), X(0x3597b895),
-  X(0x35a7bb12), X(0x35b7be1e), X(0x35c7c1b9), X(0x35d7c5e1),
-  X(0x35e7ca96), X(0x35f7cfd6), X(0x3607d5a0), X(0x3617dbf3),
-  X(0x3627e2cd), X(0x3637ea2d), X(0x3647f212), X(0x3657fa7b),
-  X(0x36680366), X(0x36780cd2), X(0x368816bf), X(0x3698212b),
-  X(0x36a82c14), X(0x36b83779), X(0x36c8435a), X(0x36d84fb4),
-  X(0x36e85c88), X(0x36f869d2), X(0x37087793), X(0x371885c9),
-  X(0x37289473), X(0x3738a38f), X(0x3748b31d), X(0x3758c31a),
-  X(0x3768d387), X(0x3778e461), X(0x3788f5a7), X(0x37990759),
-  X(0x37a91975), X(0x37b92bf9), X(0x37c93ee4), X(0x37d95236),
-  X(0x37e965ed), X(0x37f97a08), X(0x38098e85), X(0x3819a363),
-  X(0x3829b8a2), X(0x3839ce3f), X(0x3849e43a), X(0x3859fa91),
-  X(0x386a1143), X(0x387a284f), X(0x388a3fb4), X(0x389a5770),
-  X(0x38aa6f83), X(0x38ba87ea), X(0x38caa0a5), X(0x38dab9b2),
-  X(0x38ead311), X(0x38faecbf), X(0x390b06bc), X(0x391b2107),
-  X(0x392b3b9e), X(0x393b5680), X(0x394b71ac), X(0x395b8d20),
-  X(0x396ba8dc), X(0x397bc4dd), X(0x398be124), X(0x399bfdae),
-  X(0x39ac1a7a), X(0x39bc3788), X(0x39cc54d5), X(0x39dc7261),
-  X(0x39ec902a), X(0x39fcae2f), X(0x3a0ccc70), X(0x3a1ceaea),
-  X(0x3a2d099c), X(0x3a3d2885), X(0x3a4d47a5), X(0x3a5d66f9),
-  X(0x3a6d8680), X(0x3a7da63a), X(0x3a8dc625), X(0x3a9de63f),
-  X(0x3aae0688), X(0x3abe26fe), X(0x3ace47a0), X(0x3ade686d),
-  X(0x3aee8963), X(0x3afeaa82), X(0x3b0ecbc7), X(0x3b1eed32),
-  X(0x3b2f0ec2), X(0x3b3f3075), X(0x3b4f524a), X(0x3b5f7440),
-  X(0x3b6f9656), X(0x3b7fb889), X(0x3b8fdada), X(0x3b9ffd46),
-  X(0x3bb01fce), X(0x3bc0426e), X(0x3bd06526), X(0x3be087f6),
-  X(0x3bf0aada), X(0x3c00cdd4), X(0x3c10f0e0), X(0x3c2113fe),
-  X(0x3c31372d), X(0x3c415a6b), X(0x3c517db7), X(0x3c61a110),
-  X(0x3c71c475), X(0x3c81e7e4), X(0x3c920b5c), X(0x3ca22edc),
-  X(0x3cb25262), X(0x3cc275ee), X(0x3cd2997e), X(0x3ce2bd11),
-  X(0x3cf2e0a6), X(0x3d03043b), X(0x3d1327cf), X(0x3d234b61),
-  X(0x3d336ef0), X(0x3d43927a), X(0x3d53b5ff), X(0x3d63d97c),
-  X(0x3d73fcf1), X(0x3d84205c), X(0x3d9443bd), X(0x3da46711),
-  X(0x3db48a58), X(0x3dc4ad91), X(0x3dd4d0ba), X(0x3de4f3d1),
-  X(0x3df516d7), X(0x3e0539c9), X(0x3e155ca6), X(0x3e257f6d),
-  X(0x3e35a21d), X(0x3e45c4b4), X(0x3e55e731), X(0x3e660994),
-  X(0x3e762bda), X(0x3e864e03), X(0x3e96700d), X(0x3ea691f7),
-  X(0x3eb6b3bf), X(0x3ec6d565), X(0x3ed6f6e8), X(0x3ee71845),
-  X(0x3ef7397c), X(0x3f075a8c), X(0x3f177b73), X(0x3f279c30),
-  X(0x3f37bcc2), X(0x3f47dd27), X(0x3f57fd5f), X(0x3f681d68),
-  X(0x3f783d40), X(0x3f885ce7), X(0x3f987c5c), X(0x3fa89b9c),
-  X(0x3fb8baa7), X(0x3fc8d97c), X(0x3fd8f819), X(0x3fe9167e),
-  X(0x3ff934a8), X(0x40095296), X(0x40197049), X(0x40298dbd),
-  X(0x4039aaf2), X(0x4049c7e7), X(0x4059e49a), X(0x406a010a),
-  X(0x407a1d36), X(0x408a391d), X(0x409a54bd), X(0x40aa7015),
-  X(0x40ba8b25), X(0x40caa5ea), X(0x40dac063), X(0x40eada90),
-  X(0x40faf46e), X(0x410b0dfe), X(0x411b273d), X(0x412b402a),
-  X(0x413b58c4), X(0x414b710a), X(0x415b88fa), X(0x416ba093),
-  X(0x417bb7d5), X(0x418bcebe), X(0x419be54c), X(0x41abfb7e),
-  X(0x41bc1153), X(0x41cc26ca), X(0x41dc3be2), X(0x41ec5099),
-  X(0x41fc64ef), X(0x420c78e1), X(0x421c8c6f), X(0x422c9f97),
-  X(0x423cb258), X(0x424cc4b2), X(0x425cd6a2), X(0x426ce827),
-  X(0x427cf941), X(0x428d09ee), X(0x429d1a2c), X(0x42ad29fb),
-  X(0x42bd3959), X(0x42cd4846), X(0x42dd56bf), X(0x42ed64c3),
-  X(0x42fd7252), X(0x430d7f6a), X(0x431d8c0a), X(0x432d9831),
-  X(0x433da3dd), X(0x434daf0d), X(0x435db9c0), X(0x436dc3f5),
-  X(0x437dcdab), X(0x438dd6df), X(0x439ddf92), X(0x43ade7c1),
-  X(0x43bdef6c), X(0x43cdf691), X(0x43ddfd2f), X(0x43ee0345),
-  X(0x43fe08d2), X(0x440e0dd4), X(0x441e124b), X(0x442e1634),
-  X(0x443e198f), X(0x444e1c5a), X(0x445e1e95), X(0x446e203e),
-  X(0x447e2153), X(0x448e21d5), X(0x449e21c0), X(0x44ae2115),
-  X(0x44be1fd1), X(0x44ce1df4), X(0x44de1b7d), X(0x44ee186a),
-  X(0x44fe14ba), X(0x450e106b), X(0x451e0b7e), X(0x452e05ef),
-  X(0x453dffbf), X(0x454df8eb), X(0x455df173), X(0x456de956),
-  X(0x457de092), X(0x458dd726), X(0x459dcd10), X(0x45adc251),
-  X(0x45bdb6e5), X(0x45cdaacd), X(0x45dd9e06), X(0x45ed9091),
-  X(0x45fd826a), X(0x460d7392), X(0x461d6407), X(0x462d53c8),
-  X(0x463d42d4), X(0x464d3129), X(0x465d1ec6), X(0x466d0baa),
-  X(0x467cf7d3), X(0x468ce342), X(0x469ccdf3), X(0x46acb7e7),
-  X(0x46bca11c), X(0x46cc8990), X(0x46dc7143), X(0x46ec5833),
-  X(0x46fc3e5f), X(0x470c23c6), X(0x471c0867), X(0x472bec40),
-  X(0x473bcf50), X(0x474bb196), X(0x475b9311), X(0x476b73c0),
-  X(0x477b53a1), X(0x478b32b4), X(0x479b10f6), X(0x47aaee67),
-  X(0x47bacb06), X(0x47caa6d1), X(0x47da81c7), X(0x47ea5be7),
-  X(0x47fa3530), X(0x480a0da1), X(0x4819e537), X(0x4829bbf3),
-  X(0x483991d3), X(0x484966d6), X(0x48593afb), X(0x48690e3f),
-  X(0x4878e0a3), X(0x4888b225), X(0x489882c4), X(0x48a8527e),
-  X(0x48b82153), X(0x48c7ef41), X(0x48d7bc47), X(0x48e78863),
-  X(0x48f75396), X(0x49071ddc), X(0x4916e736), X(0x4926afa2),
-  X(0x4936771f), X(0x49463dac), X(0x49560347), X(0x4965c7ef),
-  X(0x49758ba4), X(0x49854e63), X(0x4995102c), X(0x49a4d0fe),
-  X(0x49b490d7), X(0x49c44fb6), X(0x49d40d9a), X(0x49e3ca82),
-  X(0x49f3866c), X(0x4a034159), X(0x4a12fb45), X(0x4a22b430),
-  X(0x4a326c19), X(0x4a4222ff), X(0x4a51d8e1), X(0x4a618dbd),
-  X(0x4a714192), X(0x4a80f45f), X(0x4a90a623), X(0x4aa056dd),
-  X(0x4ab0068b), X(0x4abfb52c), X(0x4acf62c0), X(0x4adf0f44),
-  X(0x4aeebab9), X(0x4afe651c), X(0x4b0e0e6c), X(0x4b1db6a9),
-  X(0x4b2d5dd1), X(0x4b3d03e2), X(0x4b4ca8dd), X(0x4b5c4cbf),
-  X(0x4b6bef88), X(0x4b7b9136), X(0x4b8b31c8), X(0x4b9ad13d),
-  X(0x4baa6f93), X(0x4bba0ccb), X(0x4bc9a8e2), X(0x4bd943d7),
-  X(0x4be8dda9), X(0x4bf87658), X(0x4c080de1), X(0x4c17a444),
-  X(0x4c27397f), X(0x4c36cd92), X(0x4c46607b), X(0x4c55f239),
-  X(0x4c6582cb), X(0x4c75122f), X(0x4c84a065), X(0x4c942d6c),
-  X(0x4ca3b942), X(0x4cb343e6), X(0x4cc2cd57), X(0x4cd25594),
-  X(0x4ce1dc9c), X(0x4cf1626d), X(0x4d00e707), X(0x4d106a68),
-  X(0x4d1fec8f), X(0x4d2f6d7a), X(0x4d3eed2a), X(0x4d4e6b9d),
-  X(0x4d5de8d1), X(0x4d6d64c5), X(0x4d7cdf79), X(0x4d8c58eb),
-  X(0x4d9bd11a), X(0x4dab4804), X(0x4dbabdaa), X(0x4dca3209),
-  X(0x4dd9a520), X(0x4de916ef), X(0x4df88774), X(0x4e07f6ae),
-  X(0x4e17649c), X(0x4e26d13c), X(0x4e363c8f), X(0x4e45a692),
-  X(0x4e550f44), X(0x4e6476a4), X(0x4e73dcb2), X(0x4e83416c),
-  X(0x4e92a4d1), X(0x4ea206df), X(0x4eb16796), X(0x4ec0c6f5),
-  X(0x4ed024fa), X(0x4edf81a5), X(0x4eeedcf3), X(0x4efe36e5),
-  X(0x4f0d8f79), X(0x4f1ce6ad), X(0x4f2c3c82), X(0x4f3b90f4),
-  X(0x4f4ae405), X(0x4f5a35b1), X(0x4f6985fa), X(0x4f78d4dc),
-  X(0x4f882257), X(0x4f976e6a), X(0x4fa6b914), X(0x4fb60254),
-  X(0x4fc54a28), X(0x4fd49090), X(0x4fe3d58b), X(0x4ff31917),
-  X(0x50025b33), X(0x50119bde), X(0x5020db17), X(0x503018dd),
-  X(0x503f552f), X(0x504e900b), X(0x505dc971), X(0x506d0160),
-  X(0x507c37d7), X(0x508b6cd3), X(0x509aa055), X(0x50a9d25b),
-  X(0x50b902e4), X(0x50c831ef), X(0x50d75f7b), X(0x50e68b87),
-  X(0x50f5b612), X(0x5104df1a), X(0x5114069f), X(0x51232ca0),
-  X(0x5132511a), X(0x5141740f), X(0x5150957b), X(0x515fb55f),
-  X(0x516ed3b8), X(0x517df087), X(0x518d0bca), X(0x519c257f),
-  X(0x51ab3da7), X(0x51ba543f), X(0x51c96947), X(0x51d87cbd),
-  X(0x51e78ea1), X(0x51f69ef1), X(0x5205adad), X(0x5214bad3),
-  X(0x5223c662), X(0x5232d05a), X(0x5241d8b9), X(0x5250df7d),
-  X(0x525fe4a7), X(0x526ee835), X(0x527dea26), X(0x528cea78),
-  X(0x529be92c), X(0x52aae63f), X(0x52b9e1b0), X(0x52c8db80),
-  X(0x52d7d3ac), X(0x52e6ca33), X(0x52f5bf15), X(0x5304b251),
-  X(0x5313a3e5), X(0x532293d0), X(0x53318212), X(0x53406ea8),
-  X(0x534f5993), X(0x535e42d2), X(0x536d2a62), X(0x537c1043),
-  X(0x538af475), X(0x5399d6f6), X(0x53a8b7c4), X(0x53b796e0),
-  X(0x53c67447), X(0x53d54ffa), X(0x53e429f6), X(0x53f3023b),
-  X(0x5401d8c8), X(0x5410ad9c), X(0x541f80b5), X(0x542e5213),
-  X(0x543d21b5), X(0x544bef9a), X(0x545abbc0), X(0x54698627),
-  X(0x54784ece), X(0x548715b3), X(0x5495dad6), X(0x54a49e35),
-  X(0x54b35fd0), X(0x54c21fa6), X(0x54d0ddb5), X(0x54df99fd),
-  X(0x54ee547c), X(0x54fd0d32), X(0x550bc41d), X(0x551a793d),
-  X(0x55292c91), X(0x5537de16), X(0x55468dce), X(0x55553bb6),
-  X(0x5563e7cd), X(0x55729213), X(0x55813a87), X(0x558fe127),
-  X(0x559e85f2), X(0x55ad28e9), X(0x55bbca08), X(0x55ca6950),
-  X(0x55d906c0), X(0x55e7a257), X(0x55f63c13), X(0x5604d3f4),
-  X(0x561369f8), X(0x5621fe1f), X(0x56309067), X(0x563f20d1),
-  X(0x564daf5a), X(0x565c3c02), X(0x566ac6c7), X(0x56794faa),
-  X(0x5687d6a8), X(0x56965bc1), X(0x56a4def4), X(0x56b36040),
-  X(0x56c1dfa4), X(0x56d05d1f), X(0x56ded8af), X(0x56ed5255),
-  X(0x56fbca0f), X(0x570a3fdc), X(0x5718b3bc), X(0x572725ac),
-  X(0x573595ad), X(0x574403bd), X(0x57526fdb), X(0x5760da07),
-  X(0x576f423f), X(0x577da883), X(0x578c0cd1), X(0x579a6f29),
-  X(0x57a8cf8a), X(0x57b72df2), X(0x57c58a61), X(0x57d3e4d6),
-  X(0x57e23d50), X(0x57f093cd), X(0x57fee84e), X(0x580d3ad1),
-  X(0x581b8b54), X(0x5829d9d8), X(0x5838265c), X(0x584670dd),
-  X(0x5854b95c), X(0x5862ffd8), X(0x5871444f), X(0x587f86c1),
-  X(0x588dc72c), X(0x589c0591), X(0x58aa41ed), X(0x58b87c40),
-  X(0x58c6b489), X(0x58d4eac7), X(0x58e31ef9), X(0x58f1511f),
-  X(0x58ff8137), X(0x590daf40), X(0x591bdb3a), X(0x592a0524),
-  X(0x59382cfc), X(0x594652c2), X(0x59547675), X(0x59629815),
-  X(0x5970b79f), X(0x597ed513), X(0x598cf071), X(0x599b09b7),
-  X(0x59a920e5), X(0x59b735f9), X(0x59c548f4), X(0x59d359d2),
-  X(0x59e16895), X(0x59ef753b), X(0x59fd7fc4), X(0x5a0b882d),
-  X(0x5a198e77), X(0x5a2792a0), X(0x5a3594a9), X(0x5a43948e),
-  X(0x5a519251), X(0x5a5f8df0), X(0x5a6d876a), X(0x5a7b7ebe),
-  X(0x5a8973ec), X(0x5a9766f2), X(0x5aa557d0), X(0x5ab34685),
-  X(0x5ac1330f), X(0x5acf1d6f), X(0x5add05a3), X(0x5aeaebaa),
-  X(0x5af8cf84), X(0x5b06b12f), X(0x5b1490ab), X(0x5b226df7),
-  X(0x5b304912), X(0x5b3e21fc), X(0x5b4bf8b2), X(0x5b59cd35),
-  X(0x5b679f84), X(0x5b756f9e), X(0x5b833d82), X(0x5b91092e),
-  X(0x5b9ed2a3), X(0x5bac99e0), X(0x5bba5ee3), X(0x5bc821ac),
-  X(0x5bd5e23a), X(0x5be3a08c), X(0x5bf15ca1), X(0x5bff1679),
-  X(0x5c0cce12), X(0x5c1a836c), X(0x5c283686), X(0x5c35e760),
-  X(0x5c4395f7), X(0x5c51424c), X(0x5c5eec5e), X(0x5c6c942b),
-  X(0x5c7a39b4), X(0x5c87dcf7), X(0x5c957df3), X(0x5ca31ca8),
-  X(0x5cb0b915), X(0x5cbe5338), X(0x5ccbeb12), X(0x5cd980a1),
-  X(0x5ce713e5), X(0x5cf4a4dd), X(0x5d023387), X(0x5d0fbfe4),
-  X(0x5d1d49f2), X(0x5d2ad1b1), X(0x5d38571f), X(0x5d45da3c),
-  X(0x5d535b08), X(0x5d60d981), X(0x5d6e55a7), X(0x5d7bcf78),
-  X(0x5d8946f5), X(0x5d96bc1c), X(0x5da42eec), X(0x5db19f65),
-  X(0x5dbf0d86), X(0x5dcc794e), X(0x5dd9e2bd), X(0x5de749d1),
-  X(0x5df4ae8a), X(0x5e0210e7), X(0x5e0f70e7), X(0x5e1cce8a),
-  X(0x5e2a29ce), X(0x5e3782b4), X(0x5e44d93a), X(0x5e522d5f),
-  X(0x5e5f7f23), X(0x5e6cce85), X(0x5e7a1b85), X(0x5e876620),
-  X(0x5e94ae58), X(0x5ea1f42a), X(0x5eaf3797), X(0x5ebc789d),
-  X(0x5ec9b73c), X(0x5ed6f372), X(0x5ee42d41), X(0x5ef164a5),
-  X(0x5efe999f), X(0x5f0bcc2f), X(0x5f18fc52), X(0x5f262a09),
-  X(0x5f335553), X(0x5f407e2f), X(0x5f4da49d), X(0x5f5ac89b),
-  X(0x5f67ea29), X(0x5f750946), X(0x5f8225f2), X(0x5f8f402b),
-  X(0x5f9c57f2), X(0x5fa96d44), X(0x5fb68023), X(0x5fc3908c),
-  X(0x5fd09e7f), X(0x5fdda9fc), X(0x5feab302), X(0x5ff7b990),
-  X(0x6004bda5), X(0x6011bf40), X(0x601ebe62), X(0x602bbb09),
-  X(0x6038b534), X(0x6045ace4), X(0x6052a216), X(0x605f94cb),
-  X(0x606c8502), X(0x607972b9), X(0x60865df2), X(0x609346aa),
-  X(0x60a02ce1), X(0x60ad1096), X(0x60b9f1c9), X(0x60c6d079),
-  X(0x60d3aca5), X(0x60e0864d), X(0x60ed5d70), X(0x60fa320d),
-  X(0x61070424), X(0x6113d3b4), X(0x6120a0bc), X(0x612d6b3c),
-  X(0x613a3332), X(0x6146f89f), X(0x6153bb82), X(0x61607bd9),
-  X(0x616d39a5), X(0x6179f4e5), X(0x6186ad98), X(0x619363bd),
-  X(0x61a01753), X(0x61acc85b), X(0x61b976d3), X(0x61c622bc),
-  X(0x61d2cc13), X(0x61df72d8), X(0x61ec170c), X(0x61f8b8ad),
-  X(0x620557ba), X(0x6211f434), X(0x621e8e18), X(0x622b2568),
-  X(0x6237ba21), X(0x62444c44), X(0x6250dbd0), X(0x625d68c4),
-  X(0x6269f320), X(0x62767ae2), X(0x6283000b), X(0x628f829a),
-  X(0x629c028e), X(0x62a87fe6), X(0x62b4faa2), X(0x62c172c2),
-  X(0x62cde844), X(0x62da5b29), X(0x62e6cb6e), X(0x62f33915),
-  X(0x62ffa41c), X(0x630c0c83), X(0x63187248), X(0x6324d56d),
-  X(0x633135ef), X(0x633d93ce), X(0x6349ef0b), X(0x635647a3),
-  X(0x63629d97), X(0x636ef0e6), X(0x637b418f), X(0x63878f92),
-  X(0x6393daef), X(0x63a023a4), X(0x63ac69b1), X(0x63b8ad15),
-  X(0x63c4edd1), X(0x63d12be3), X(0x63dd674b), X(0x63e9a008),
-  X(0x63f5d61a), X(0x64020980), X(0x640e3a39), X(0x641a6846),
-  X(0x642693a5), X(0x6432bc56), X(0x643ee258), X(0x644b05ab),
-  X(0x6457264e), X(0x64634441), X(0x646f5f83), X(0x647b7814),
-  X(0x64878df3), X(0x6493a120), X(0x649fb199), X(0x64abbf5f),
-  X(0x64b7ca71), X(0x64c3d2ce), X(0x64cfd877), X(0x64dbdb69),
-  X(0x64e7dba6), X(0x64f3d92b), X(0x64ffd3fa), X(0x650bcc11),
-  X(0x6517c16f), X(0x6523b415), X(0x652fa402), X(0x653b9134),
-  X(0x65477bad), X(0x6553636a), X(0x655f486d), X(0x656b2ab3),
-  X(0x65770a3d), X(0x6582e70a), X(0x658ec11a), X(0x659a986d),
-  X(0x65a66d00), X(0x65b23ed5), X(0x65be0deb), X(0x65c9da41),
-  X(0x65d5a3d7), X(0x65e16aac), X(0x65ed2ebf), X(0x65f8f011),
-  X(0x6604aea1), X(0x66106a6e), X(0x661c2377), X(0x6627d9be),
-  X(0x66338d40), X(0x663f3dfd), X(0x664aebf5), X(0x66569728),
-  X(0x66623f95), X(0x666de53b), X(0x6679881b), X(0x66852833),
-  X(0x6690c583), X(0x669c600b), X(0x66a7f7ca), X(0x66b38cc0),
-  X(0x66bf1eec), X(0x66caae4f), X(0x66d63ae6), X(0x66e1c4b3),
-  X(0x66ed4bb4), X(0x66f8cfea), X(0x67045153), X(0x670fcfef),
-  X(0x671b4bbe), X(0x6726c4bf), X(0x67323af3), X(0x673dae58),
-  X(0x67491eee), X(0x67548cb5), X(0x675ff7ab), X(0x676b5fd2),
-  X(0x6776c528), X(0x678227ad), X(0x678d8761), X(0x6798e443),
-  X(0x67a43e52), X(0x67af958f), X(0x67bae9f9), X(0x67c63b8f),
-  X(0x67d18a52), X(0x67dcd640), X(0x67e81f59), X(0x67f3659d),
-  X(0x67fea90c), X(0x6809e9a5), X(0x68152768), X(0x68206254),
-  X(0x682b9a68), X(0x6836cfa6), X(0x6842020b), X(0x684d3199),
-  X(0x68585e4d), X(0x68638829), X(0x686eaf2b), X(0x6879d354),
-  X(0x6884f4a2), X(0x68901316), X(0x689b2eb0), X(0x68a6476d),
-  X(0x68b15d50), X(0x68bc7056), X(0x68c78080), X(0x68d28dcd),
-  X(0x68dd983e), X(0x68e89fd0), X(0x68f3a486), X(0x68fea65d),
-  X(0x6909a555), X(0x6914a16f), X(0x691f9aa9), X(0x692a9104),
-  X(0x69358480), X(0x6940751b), X(0x694b62d5), X(0x69564daf),
-  X(0x696135a7), X(0x696c1abe), X(0x6976fcf3), X(0x6981dc46),
-  X(0x698cb8b6), X(0x69979243), X(0x69a268ed), X(0x69ad3cb4),
-  X(0x69b80d97), X(0x69c2db96), X(0x69cda6b0), X(0x69d86ee5),
-  X(0x69e33436), X(0x69edf6a1), X(0x69f8b626), X(0x6a0372c5),
-  X(0x6a0e2c7e), X(0x6a18e350), X(0x6a23973c), X(0x6a2e4840),
-  X(0x6a38f65d), X(0x6a43a191), X(0x6a4e49de), X(0x6a58ef42),
-  X(0x6a6391be), X(0x6a6e3151), X(0x6a78cdfa), X(0x6a8367ba),
-  X(0x6a8dfe90), X(0x6a98927c), X(0x6aa3237d), X(0x6aadb194),
-  X(0x6ab83cc0), X(0x6ac2c500), X(0x6acd4a55), X(0x6ad7ccbf),
-  X(0x6ae24c3c), X(0x6aecc8cd), X(0x6af74271), X(0x6b01b929),
-  X(0x6b0c2cf4), X(0x6b169dd1), X(0x6b210bc1), X(0x6b2b76c2),
-  X(0x6b35ded6), X(0x6b4043fc), X(0x6b4aa632), X(0x6b55057a),
-  X(0x6b5f61d3), X(0x6b69bb3d), X(0x6b7411b7), X(0x6b7e6541),
-  X(0x6b88b5db), X(0x6b930385), X(0x6b9d4e3f), X(0x6ba79607),
-  X(0x6bb1dadf), X(0x6bbc1cc6), X(0x6bc65bbb), X(0x6bd097bf),
-  X(0x6bdad0d0), X(0x6be506f0), X(0x6bef3a1d), X(0x6bf96a58),
-  X(0x6c0397a0), X(0x6c0dc1f5), X(0x6c17e957), X(0x6c220dc6),
-  X(0x6c2c2f41), X(0x6c364dc9), X(0x6c40695c), X(0x6c4a81fc),
-  X(0x6c5497a7), X(0x6c5eaa5d), X(0x6c68ba1f), X(0x6c72c6eb),
-  X(0x6c7cd0c3), X(0x6c86d7a6), X(0x6c90db92), X(0x6c9adc8a),
-  X(0x6ca4da8b), X(0x6caed596), X(0x6cb8cdab), X(0x6cc2c2ca),
-  X(0x6cccb4f2), X(0x6cd6a424), X(0x6ce0905e), X(0x6cea79a1),
-  X(0x6cf45fee), X(0x6cfe4342), X(0x6d0823a0), X(0x6d120105),
-  X(0x6d1bdb73), X(0x6d25b2e8), X(0x6d2f8765), X(0x6d3958ea),
-  X(0x6d432777), X(0x6d4cf30a), X(0x6d56bba5), X(0x6d608147),
-  X(0x6d6a43f0), X(0x6d7403a0), X(0x6d7dc056), X(0x6d877a13),
-  X(0x6d9130d6), X(0x6d9ae4a0), X(0x6da4956f), X(0x6dae4345),
-  X(0x6db7ee20), X(0x6dc19601), X(0x6dcb3ae7), X(0x6dd4dcd3),
-  X(0x6dde7bc4), X(0x6de817bb), X(0x6df1b0b6), X(0x6dfb46b7),
-  X(0x6e04d9bc), X(0x6e0e69c7), X(0x6e17f6d5), X(0x6e2180e9),
-  X(0x6e2b0801), X(0x6e348c1d), X(0x6e3e0d3d), X(0x6e478b62),
-  X(0x6e51068a), X(0x6e5a7eb7), X(0x6e63f3e7), X(0x6e6d661b),
-  X(0x6e76d552), X(0x6e80418e), X(0x6e89aacc), X(0x6e93110f),
-  X(0x6e9c7454), X(0x6ea5d49d), X(0x6eaf31e9), X(0x6eb88c37),
-  X(0x6ec1e389), X(0x6ecb37de), X(0x6ed48936), X(0x6eddd790),
-  X(0x6ee722ee), X(0x6ef06b4d), X(0x6ef9b0b0), X(0x6f02f315),
-  X(0x6f0c327c), X(0x6f156ee6), X(0x6f1ea852), X(0x6f27dec1),
-  X(0x6f311232), X(0x6f3a42a5), X(0x6f43701a), X(0x6f4c9a91),
-  X(0x6f55c20a), X(0x6f5ee686), X(0x6f680803), X(0x6f712682),
-  X(0x6f7a4203), X(0x6f835a86), X(0x6f8c700b), X(0x6f958291),
-  X(0x6f9e921a), X(0x6fa79ea4), X(0x6fb0a830), X(0x6fb9aebd),
-  X(0x6fc2b24c), X(0x6fcbb2dd), X(0x6fd4b06f), X(0x6fddab03),
-  X(0x6fe6a299), X(0x6fef9730), X(0x6ff888c9), X(0x70017763),
-  X(0x700a62ff), X(0x70134b9c), X(0x701c313b), X(0x702513dc),
-  X(0x702df37e), X(0x7036d021), X(0x703fa9c6), X(0x7048806d),
-  X(0x70515415), X(0x705a24bf), X(0x7062f26b), X(0x706bbd17),
-  X(0x707484c6), X(0x707d4976), X(0x70860b28), X(0x708ec9dc),
-  X(0x70978591), X(0x70a03e48), X(0x70a8f400), X(0x70b1a6bb),
-  X(0x70ba5677), X(0x70c30335), X(0x70cbacf5), X(0x70d453b6),
-  X(0x70dcf77a), X(0x70e59840), X(0x70ee3607), X(0x70f6d0d1),
-  X(0x70ff689d), X(0x7107fd6b), X(0x71108f3b), X(0x71191e0d),
-  X(0x7121a9e2), X(0x712a32b9), X(0x7132b892), X(0x713b3b6e),
-  X(0x7143bb4c), X(0x714c382d), X(0x7154b211), X(0x715d28f7),
-  X(0x71659ce0), X(0x716e0dcc), X(0x71767bbb), X(0x717ee6ac),
-  X(0x71874ea1), X(0x718fb399), X(0x71981594), X(0x71a07493),
-  X(0x71a8d094), X(0x71b1299a), X(0x71b97fa2), X(0x71c1d2af),
-  X(0x71ca22bf), X(0x71d26fd2), X(0x71dab9ea), X(0x71e30106),
-  X(0x71eb4526), X(0x71f3864a), X(0x71fbc472), X(0x7203ff9e),
-  X(0x720c37cf), X(0x72146d05), X(0x721c9f3f), X(0x7224ce7e),
-  X(0x722cfac2), X(0x7235240b), X(0x723d4a59), X(0x72456dad),
-  X(0x724d8e05), X(0x7255ab63), X(0x725dc5c7), X(0x7265dd31),
-  X(0x726df1a0), X(0x72760315), X(0x727e1191), X(0x72861d12),
-  X(0x728e259a), X(0x72962b28), X(0x729e2dbd), X(0x72a62d59),
-  X(0x72ae29fc), X(0x72b623a5), X(0x72be1a56), X(0x72c60e0e),
-  X(0x72cdfece), X(0x72d5ec95), X(0x72ddd764), X(0x72e5bf3b),
-  X(0x72eda41a), X(0x72f58601), X(0x72fd64f1), X(0x730540e9),
-  X(0x730d19e9), X(0x7314eff3), X(0x731cc305), X(0x73249321),
-  X(0x732c6046), X(0x73342a75), X(0x733bf1ad), X(0x7343b5ef),
-  X(0x734b773b), X(0x73533591), X(0x735af0f2), X(0x7362a95d),
-  X(0x736a5ed3), X(0x73721153), X(0x7379c0df), X(0x73816d76),
-  X(0x73891719), X(0x7390bdc7), X(0x73986181), X(0x73a00247),
-  X(0x73a7a01a), X(0x73af3af8), X(0x73b6d2e4), X(0x73be67dc),
-  X(0x73c5f9e1), X(0x73cd88f3), X(0x73d51513), X(0x73dc9e40),
-  X(0x73e4247c), X(0x73eba7c5), X(0x73f3281c), X(0x73faa582),
-  X(0x74021ff7), X(0x7409977b), X(0x74110c0d), X(0x74187daf),
-  X(0x741fec61), X(0x74275822), X(0x742ec0f3), X(0x743626d5),
-  X(0x743d89c7), X(0x7444e9c9), X(0x744c46dd), X(0x7453a101),
-  X(0x745af837), X(0x74624c7f), X(0x74699dd8), X(0x7470ec44),
-  X(0x747837c2), X(0x747f8052), X(0x7486c5f5), X(0x748e08ac),
-  X(0x74954875), X(0x749c8552), X(0x74a3bf43), X(0x74aaf648),
-  X(0x74b22a62), X(0x74b95b90), X(0x74c089d2), X(0x74c7b52a),
-  X(0x74cedd97), X(0x74d6031a), X(0x74dd25b2), X(0x74e44561),
-  X(0x74eb6226), X(0x74f27c02), X(0x74f992f5), X(0x7500a6ff),
-  X(0x7507b820), X(0x750ec659), X(0x7515d1aa), X(0x751cda14),
-  X(0x7523df96), X(0x752ae231), X(0x7531e1e5), X(0x7538deb2),
-  X(0x753fd89a), X(0x7546cf9b), X(0x754dc3b7), X(0x7554b4ed),
-  X(0x755ba33e), X(0x75628eaa), X(0x75697732), X(0x75705cd5),
-  X(0x75773f95), X(0x757e1f71), X(0x7584fc6a), X(0x758bd67f),
-  X(0x7592adb2), X(0x75998203), X(0x75a05371), X(0x75a721fe),
-  X(0x75adeda9), X(0x75b4b673), X(0x75bb7c5c), X(0x75c23f65),
-  X(0x75c8ff8d), X(0x75cfbcd6), X(0x75d6773f), X(0x75dd2ec8),
-  X(0x75e3e373), X(0x75ea953f), X(0x75f1442d), X(0x75f7f03d),
-  X(0x75fe996f), X(0x76053fc5), X(0x760be33d), X(0x761283d8),
-  X(0x76192197), X(0x761fbc7b), X(0x76265482), X(0x762ce9af),
-  X(0x76337c01), X(0x763a0b78), X(0x76409814), X(0x764721d7),
-  X(0x764da8c1), X(0x76542cd1), X(0x765aae08), X(0x76612c67),
-  X(0x7667a7ee), X(0x766e209d), X(0x76749675), X(0x767b0975),
-  X(0x7681799f), X(0x7687e6f3), X(0x768e5170), X(0x7694b918),
-  X(0x769b1deb), X(0x76a17fe9), X(0x76a7df13), X(0x76ae3b68),
-  X(0x76b494ea), X(0x76baeb98), X(0x76c13f74), X(0x76c7907c),
-  X(0x76cddeb3), X(0x76d42a18), X(0x76da72ab), X(0x76e0b86d),
-  X(0x76e6fb5e), X(0x76ed3b7f), X(0x76f378d0), X(0x76f9b352),
-  X(0x76ffeb05), X(0x77061fe8), X(0x770c51fe), X(0x77128145),
-  X(0x7718adbf), X(0x771ed76c), X(0x7724fe4c), X(0x772b225f),
-  X(0x773143a7), X(0x77376223), X(0x773d7dd3), X(0x774396ba),
-  X(0x7749acd5), X(0x774fc027), X(0x7755d0af), X(0x775bde6f),
-  X(0x7761e965), X(0x7767f193), X(0x776df6fa), X(0x7773f998),
-  X(0x7779f970), X(0x777ff681), X(0x7785f0cd), X(0x778be852),
-  X(0x7791dd12), X(0x7797cf0d), X(0x779dbe43), X(0x77a3aab6),
-  X(0x77a99465), X(0x77af7b50), X(0x77b55f79), X(0x77bb40e0),
-  X(0x77c11f85), X(0x77c6fb68), X(0x77ccd48a), X(0x77d2aaec),
-  X(0x77d87e8d), X(0x77de4f6f), X(0x77e41d92), X(0x77e9e8f5),
-  X(0x77efb19b), X(0x77f57782), X(0x77fb3aad), X(0x7800fb1a),
-  X(0x7806b8ca), X(0x780c73bf), X(0x78122bf7), X(0x7817e175),
-  X(0x781d9438), X(0x78234440), X(0x7828f18f), X(0x782e9c25),
-  X(0x78344401), X(0x7839e925), X(0x783f8b92), X(0x78452b46),
-  X(0x784ac844), X(0x7850628b), X(0x7855fa1c), X(0x785b8ef8),
-  X(0x7861211e), X(0x7866b090), X(0x786c3d4d), X(0x7871c757),
-  X(0x78774ead), X(0x787cd351), X(0x78825543), X(0x7887d483),
-  X(0x788d5111), X(0x7892caef), X(0x7898421c), X(0x789db69a),
-  X(0x78a32868), X(0x78a89787), X(0x78ae03f8), X(0x78b36dbb),
-  X(0x78b8d4d1), X(0x78be393a), X(0x78c39af6), X(0x78c8fa06),
-  X(0x78ce566c), X(0x78d3b026), X(0x78d90736), X(0x78de5b9c),
-  X(0x78e3ad58), X(0x78e8fc6c), X(0x78ee48d7), X(0x78f3929b),
-  X(0x78f8d9b7), X(0x78fe1e2c), X(0x79035ffb), X(0x79089f24),
-  X(0x790ddba8), X(0x79131587), X(0x79184cc2), X(0x791d8159),
-  X(0x7922b34d), X(0x7927e29e), X(0x792d0f4d), X(0x7932395a),
-  X(0x793760c6), X(0x793c8591), X(0x7941a7bd), X(0x7946c749),
-  X(0x794be435), X(0x7950fe84), X(0x79561634), X(0x795b2b47),
-  X(0x79603dbc), X(0x79654d96), X(0x796a5ad4), X(0x796f6576),
-  X(0x79746d7e), X(0x797972eb), X(0x797e75bf), X(0x798375f9),
-  X(0x7988739b), X(0x798d6ea5), X(0x79926717), X(0x79975cf2),
-  X(0x799c5037), X(0x79a140e6), X(0x79a62f00), X(0x79ab1a85),
-  X(0x79b00376), X(0x79b4e9d3), X(0x79b9cd9d), X(0x79beaed4),
-  X(0x79c38d79), X(0x79c8698d), X(0x79cd4310), X(0x79d21a03),
-  X(0x79d6ee66), X(0x79dbc03a), X(0x79e08f7f), X(0x79e55c36),
-  X(0x79ea265f), X(0x79eeedfc), X(0x79f3b30c), X(0x79f87590),
-  X(0x79fd3589), X(0x7a01f2f7), X(0x7a06addc), X(0x7a0b6636),
-  X(0x7a101c08), X(0x7a14cf52), X(0x7a198013), X(0x7a1e2e4d),
-  X(0x7a22da01), X(0x7a27832f), X(0x7a2c29d7), X(0x7a30cdfa),
-  X(0x7a356f99), X(0x7a3a0eb4), X(0x7a3eab4c), X(0x7a434561),
-  X(0x7a47dcf5), X(0x7a4c7207), X(0x7a510498), X(0x7a5594a9),
-  X(0x7a5a223a), X(0x7a5ead4d), X(0x7a6335e0), X(0x7a67bbf6),
-  X(0x7a6c3f8f), X(0x7a70c0ab), X(0x7a753f4b), X(0x7a79bb6f),
-  X(0x7a7e3519), X(0x7a82ac48), X(0x7a8720fe), X(0x7a8b933b),
-  X(0x7a9002ff), X(0x7a94704b), X(0x7a98db20), X(0x7a9d437e),
-  X(0x7aa1a967), X(0x7aa60cd9), X(0x7aaa6dd7), X(0x7aaecc61),
-  X(0x7ab32877), X(0x7ab7821b), X(0x7abbd94b), X(0x7ac02e0a),
-  X(0x7ac48058), X(0x7ac8d035), X(0x7acd1da3), X(0x7ad168a1),
-  X(0x7ad5b130), X(0x7ad9f751), X(0x7ade3b05), X(0x7ae27c4c),
-  X(0x7ae6bb27), X(0x7aeaf796), X(0x7aef319a), X(0x7af36934),
-  X(0x7af79e64), X(0x7afbd12c), X(0x7b00018a), X(0x7b042f81),
-  X(0x7b085b10), X(0x7b0c8439), X(0x7b10aafc), X(0x7b14cf5a),
-  X(0x7b18f153), X(0x7b1d10e8), X(0x7b212e1a), X(0x7b2548e9),
-  X(0x7b296155), X(0x7b2d7761), X(0x7b318b0b), X(0x7b359c55),
-  X(0x7b39ab3f), X(0x7b3db7cb), X(0x7b41c1f8), X(0x7b45c9c8),
-  X(0x7b49cf3b), X(0x7b4dd251), X(0x7b51d30b), X(0x7b55d16b),
-  X(0x7b59cd70), X(0x7b5dc71b), X(0x7b61be6d), X(0x7b65b366),
-  X(0x7b69a608), X(0x7b6d9653), X(0x7b718447), X(0x7b756fe5),
-  X(0x7b79592e), X(0x7b7d4022), X(0x7b8124c3), X(0x7b850710),
-  X(0x7b88e70a), X(0x7b8cc4b3), X(0x7b90a00a), X(0x7b947911),
-  X(0x7b984fc8), X(0x7b9c242f), X(0x7b9ff648), X(0x7ba3c612),
-  X(0x7ba79390), X(0x7bab5ec1), X(0x7baf27a5), X(0x7bb2ee3f),
-  X(0x7bb6b28e), X(0x7bba7493), X(0x7bbe344e), X(0x7bc1f1c1),
-  X(0x7bc5acec), X(0x7bc965cf), X(0x7bcd1c6c), X(0x7bd0d0c3),
-  X(0x7bd482d4), X(0x7bd832a1), X(0x7bdbe02a), X(0x7bdf8b70),
-  X(0x7be33473), X(0x7be6db34), X(0x7bea7fb4), X(0x7bee21f4),
-  X(0x7bf1c1f3), X(0x7bf55fb3), X(0x7bf8fb35), X(0x7bfc9479),
-  X(0x7c002b7f), X(0x7c03c04a), X(0x7c0752d8), X(0x7c0ae32b),
-  X(0x7c0e7144), X(0x7c11fd23), X(0x7c1586c9), X(0x7c190e36),
-  X(0x7c1c936c), X(0x7c20166b), X(0x7c239733), X(0x7c2715c6),
-  X(0x7c2a9224), X(0x7c2e0c4e), X(0x7c318444), X(0x7c34fa07),
-  X(0x7c386d98), X(0x7c3bdef8), X(0x7c3f4e26), X(0x7c42bb25),
-  X(0x7c4625f4), X(0x7c498e95), X(0x7c4cf507), X(0x7c50594c),
-  X(0x7c53bb65), X(0x7c571b51), X(0x7c5a7913), X(0x7c5dd4aa),
-  X(0x7c612e17), X(0x7c64855b), X(0x7c67da76), X(0x7c6b2d6a),
-  X(0x7c6e7e37), X(0x7c71ccdd), X(0x7c75195e), X(0x7c7863ba),
-  X(0x7c7babf1), X(0x7c7ef206), X(0x7c8235f7), X(0x7c8577c6),
-  X(0x7c88b774), X(0x7c8bf502), X(0x7c8f306f), X(0x7c9269bd),
-  X(0x7c95a0ec), X(0x7c98d5fe), X(0x7c9c08f2), X(0x7c9f39cb),
-  X(0x7ca26887), X(0x7ca59528), X(0x7ca8bfb0), X(0x7cabe81d),
-  X(0x7caf0e72), X(0x7cb232af), X(0x7cb554d4), X(0x7cb874e2),
-  X(0x7cbb92db), X(0x7cbeaebe), X(0x7cc1c88d), X(0x7cc4e047),
-  X(0x7cc7f5ef), X(0x7ccb0984), X(0x7cce1b08), X(0x7cd12a7b),
-  X(0x7cd437dd), X(0x7cd74330), X(0x7cda4c74), X(0x7cdd53aa),
-  X(0x7ce058d3), X(0x7ce35bef), X(0x7ce65cff), X(0x7ce95c04),
-  X(0x7cec58ff), X(0x7cef53f0), X(0x7cf24cd7), X(0x7cf543b7),
-  X(0x7cf8388f), X(0x7cfb2b60), X(0x7cfe1c2b), X(0x7d010af1),
-  X(0x7d03f7b2), X(0x7d06e26f), X(0x7d09cb29), X(0x7d0cb1e0),
-  X(0x7d0f9696), X(0x7d12794b), X(0x7d1559ff), X(0x7d1838b4),
-  X(0x7d1b156a), X(0x7d1df022), X(0x7d20c8dd), X(0x7d239f9b),
-  X(0x7d26745e), X(0x7d294725), X(0x7d2c17f1), X(0x7d2ee6c4),
-  X(0x7d31b39f), X(0x7d347e81), X(0x7d37476b), X(0x7d3a0e5f),
-  X(0x7d3cd35d), X(0x7d3f9665), X(0x7d425779), X(0x7d451699),
-  X(0x7d47d3c6), X(0x7d4a8f01), X(0x7d4d484b), X(0x7d4fffa3),
-  X(0x7d52b50c), X(0x7d556885), X(0x7d581a0f), X(0x7d5ac9ac),
-  X(0x7d5d775c), X(0x7d60231f), X(0x7d62ccf6), X(0x7d6574e3),
-  X(0x7d681ae6), X(0x7d6abeff), X(0x7d6d612f), X(0x7d700178),
-  X(0x7d729fd9), X(0x7d753c54), X(0x7d77d6e9), X(0x7d7a6f9a),
-  X(0x7d7d0666), X(0x7d7f9b4f), X(0x7d822e55), X(0x7d84bf79),
-  X(0x7d874ebc), X(0x7d89dc1e), X(0x7d8c67a1), X(0x7d8ef144),
-  X(0x7d91790a), X(0x7d93fef2), X(0x7d9682fd), X(0x7d99052d),
-  X(0x7d9b8581), X(0x7d9e03fb), X(0x7da0809b), X(0x7da2fb62),
-  X(0x7da57451), X(0x7da7eb68), X(0x7daa60a8), X(0x7dacd413),
-  X(0x7daf45a9), X(0x7db1b56a), X(0x7db42357), X(0x7db68f71),
-  X(0x7db8f9b9), X(0x7dbb6230), X(0x7dbdc8d6), X(0x7dc02dac),
-  X(0x7dc290b3), X(0x7dc4f1eb), X(0x7dc75156), X(0x7dc9aef4),
-  X(0x7dcc0ac5), X(0x7dce64cc), X(0x7dd0bd07), X(0x7dd31379),
-  X(0x7dd56821), X(0x7dd7bb01), X(0x7dda0c1a), X(0x7ddc5b6b),
-  X(0x7ddea8f7), X(0x7de0f4bd), X(0x7de33ebe), X(0x7de586fc),
-  X(0x7de7cd76), X(0x7dea122e), X(0x7dec5525), X(0x7dee965a),
-  X(0x7df0d5d0), X(0x7df31386), X(0x7df54f7e), X(0x7df789b8),
-  X(0x7df9c235), X(0x7dfbf8f5), X(0x7dfe2dfa), X(0x7e006145),
-  X(0x7e0292d5), X(0x7e04c2ac), X(0x7e06f0cb), X(0x7e091d32),
-  X(0x7e0b47e1), X(0x7e0d70db), X(0x7e0f981f), X(0x7e11bdaf),
-  X(0x7e13e18a), X(0x7e1603b3), X(0x7e182429), X(0x7e1a42ed),
-  X(0x7e1c6001), X(0x7e1e7b64), X(0x7e209518), X(0x7e22ad1d),
-  X(0x7e24c375), X(0x7e26d81f), X(0x7e28eb1d), X(0x7e2afc70),
-  X(0x7e2d0c17), X(0x7e2f1a15), X(0x7e31266a), X(0x7e333115),
-  X(0x7e353a1a), X(0x7e374177), X(0x7e39472e), X(0x7e3b4b3f),
-  X(0x7e3d4dac), X(0x7e3f4e75), X(0x7e414d9a), X(0x7e434b1e),
-  X(0x7e4546ff), X(0x7e474140), X(0x7e4939e0), X(0x7e4b30e2),
-  X(0x7e4d2644), X(0x7e4f1a09), X(0x7e510c30), X(0x7e52fcbc),
-  X(0x7e54ebab), X(0x7e56d900), X(0x7e58c4bb), X(0x7e5aaedd),
-  X(0x7e5c9766), X(0x7e5e7e57), X(0x7e6063b2), X(0x7e624776),
-  X(0x7e6429a5), X(0x7e660a3f), X(0x7e67e945), X(0x7e69c6b8),
-  X(0x7e6ba299), X(0x7e6d7ce7), X(0x7e6f55a5), X(0x7e712cd3),
-  X(0x7e730272), X(0x7e74d682), X(0x7e76a904), X(0x7e7879f9),
-  X(0x7e7a4962), X(0x7e7c173f), X(0x7e7de392), X(0x7e7fae5a),
-  X(0x7e817799), X(0x7e833f50), X(0x7e85057f), X(0x7e86ca27),
-  X(0x7e888d49), X(0x7e8a4ee5), X(0x7e8c0efd), X(0x7e8dcd91),
-  X(0x7e8f8aa1), X(0x7e914630), X(0x7e93003c), X(0x7e94b8c8),
-  X(0x7e966fd4), X(0x7e982560), X(0x7e99d96e), X(0x7e9b8bfe),
-  X(0x7e9d3d10), X(0x7e9eeca7), X(0x7ea09ac2), X(0x7ea24762),
-  X(0x7ea3f288), X(0x7ea59c35), X(0x7ea7446a), X(0x7ea8eb27),
-  X(0x7eaa906c), X(0x7eac343c), X(0x7eadd696), X(0x7eaf777b),
-  X(0x7eb116ed), X(0x7eb2b4eb), X(0x7eb45177), X(0x7eb5ec91),
-  X(0x7eb7863b), X(0x7eb91e74), X(0x7ebab53e), X(0x7ebc4a99),
-  X(0x7ebdde87), X(0x7ebf7107), X(0x7ec1021b), X(0x7ec291c3),
-  X(0x7ec42001), X(0x7ec5acd5), X(0x7ec7383f), X(0x7ec8c241),
-  X(0x7eca4adb), X(0x7ecbd20d), X(0x7ecd57da), X(0x7ecedc41),
-  X(0x7ed05f44), X(0x7ed1e0e2), X(0x7ed3611d), X(0x7ed4dff6),
-  X(0x7ed65d6d), X(0x7ed7d983), X(0x7ed95438), X(0x7edacd8f),
-  X(0x7edc4586), X(0x7eddbc20), X(0x7edf315c), X(0x7ee0a53c),
-  X(0x7ee217c1), X(0x7ee388ea), X(0x7ee4f8b9), X(0x7ee6672f),
-  X(0x7ee7d44c), X(0x7ee94012), X(0x7eeaaa80), X(0x7eec1397),
-  X(0x7eed7b59), X(0x7eeee1c6), X(0x7ef046df), X(0x7ef1aaa5),
-  X(0x7ef30d18), X(0x7ef46e39), X(0x7ef5ce09), X(0x7ef72c88),
-  X(0x7ef889b8), X(0x7ef9e599), X(0x7efb402c), X(0x7efc9972),
-  X(0x7efdf16b), X(0x7eff4818), X(0x7f009d79), X(0x7f01f191),
-  X(0x7f03445f), X(0x7f0495e4), X(0x7f05e620), X(0x7f073516),
-  X(0x7f0882c5), X(0x7f09cf2d), X(0x7f0b1a51), X(0x7f0c6430),
-  X(0x7f0daccc), X(0x7f0ef425), X(0x7f103a3b), X(0x7f117f11),
-  X(0x7f12c2a5), X(0x7f1404fa), X(0x7f15460f), X(0x7f1685e6),
-  X(0x7f17c47f), X(0x7f1901db), X(0x7f1a3dfb), X(0x7f1b78e0),
-  X(0x7f1cb28a), X(0x7f1deafa), X(0x7f1f2231), X(0x7f20582f),
-  X(0x7f218cf5), X(0x7f22c085), X(0x7f23f2de), X(0x7f252401),
-  X(0x7f2653f0), X(0x7f2782ab), X(0x7f28b032), X(0x7f29dc87),
-  X(0x7f2b07aa), X(0x7f2c319c), X(0x7f2d5a5e), X(0x7f2e81f0),
-  X(0x7f2fa853), X(0x7f30cd88), X(0x7f31f18f), X(0x7f33146a),
-  X(0x7f343619), X(0x7f35569c), X(0x7f3675f6), X(0x7f379425),
-  X(0x7f38b12c), X(0x7f39cd0a), X(0x7f3ae7c0), X(0x7f3c0150),
-  X(0x7f3d19ba), X(0x7f3e30fe), X(0x7f3f471e), X(0x7f405c1a),
-  X(0x7f416ff3), X(0x7f4282a9), X(0x7f43943e), X(0x7f44a4b2),
-  X(0x7f45b405), X(0x7f46c239), X(0x7f47cf4e), X(0x7f48db45),
-  X(0x7f49e61f), X(0x7f4aefdc), X(0x7f4bf87e), X(0x7f4d0004),
-  X(0x7f4e0670), X(0x7f4f0bc2), X(0x7f500ffb), X(0x7f51131c),
-  X(0x7f521525), X(0x7f531618), X(0x7f5415f4), X(0x7f5514bb),
-  X(0x7f56126e), X(0x7f570f0c), X(0x7f580a98), X(0x7f590511),
-  X(0x7f59fe78), X(0x7f5af6ce), X(0x7f5bee14), X(0x7f5ce44a),
-  X(0x7f5dd972), X(0x7f5ecd8b), X(0x7f5fc097), X(0x7f60b296),
-  X(0x7f61a389), X(0x7f629370), X(0x7f63824e), X(0x7f647021),
-  X(0x7f655ceb), X(0x7f6648ad), X(0x7f673367), X(0x7f681d19),
-  X(0x7f6905c6), X(0x7f69ed6d), X(0x7f6ad40f), X(0x7f6bb9ad),
-  X(0x7f6c9e48), X(0x7f6d81e0), X(0x7f6e6475), X(0x7f6f460a),
-  X(0x7f70269d), X(0x7f710631), X(0x7f71e4c6), X(0x7f72c25c),
-  X(0x7f739ef4), X(0x7f747a8f), X(0x7f75552e), X(0x7f762ed1),
-  X(0x7f770779), X(0x7f77df27), X(0x7f78b5db), X(0x7f798b97),
-  X(0x7f7a605a), X(0x7f7b3425), X(0x7f7c06fa), X(0x7f7cd8d9),
-  X(0x7f7da9c2), X(0x7f7e79b7), X(0x7f7f48b8), X(0x7f8016c5),
-  X(0x7f80e3e0), X(0x7f81b009), X(0x7f827b40), X(0x7f834588),
-  X(0x7f840edf), X(0x7f84d747), X(0x7f859ec1), X(0x7f86654d),
-  X(0x7f872aec), X(0x7f87ef9e), X(0x7f88b365), X(0x7f897641),
-  X(0x7f8a3832), X(0x7f8af93a), X(0x7f8bb959), X(0x7f8c7890),
-  X(0x7f8d36df), X(0x7f8df448), X(0x7f8eb0ca), X(0x7f8f6c67),
-  X(0x7f90271e), X(0x7f90e0f2), X(0x7f9199e2), X(0x7f9251f0),
-  X(0x7f93091b), X(0x7f93bf65), X(0x7f9474ce), X(0x7f952958),
-  X(0x7f95dd01), X(0x7f968fcd), X(0x7f9741ba), X(0x7f97f2ca),
-  X(0x7f98a2fd), X(0x7f995254), X(0x7f9a00d0), X(0x7f9aae71),
-  X(0x7f9b5b38), X(0x7f9c0726), X(0x7f9cb23b), X(0x7f9d5c78),
-  X(0x7f9e05de), X(0x7f9eae6e), X(0x7f9f5627), X(0x7f9ffd0b),
-  X(0x7fa0a31b), X(0x7fa14856), X(0x7fa1ecbf), X(0x7fa29054),
-  X(0x7fa33318), X(0x7fa3d50b), X(0x7fa4762c), X(0x7fa5167e),
-  X(0x7fa5b601), X(0x7fa654b5), X(0x7fa6f29b), X(0x7fa78fb3),
-  X(0x7fa82bff), X(0x7fa8c77f), X(0x7fa96234), X(0x7fa9fc1e),
-  X(0x7faa953e), X(0x7fab2d94), X(0x7fabc522), X(0x7fac5be8),
-  X(0x7facf1e6), X(0x7fad871d), X(0x7fae1b8f), X(0x7faeaf3b),
-  X(0x7faf4222), X(0x7fafd445), X(0x7fb065a4), X(0x7fb0f641),
-  X(0x7fb1861b), X(0x7fb21534), X(0x7fb2a38c), X(0x7fb33124),
-  X(0x7fb3bdfb), X(0x7fb44a14), X(0x7fb4d56f), X(0x7fb5600c),
-  X(0x7fb5e9ec), X(0x7fb6730f), X(0x7fb6fb76), X(0x7fb78323),
-  X(0x7fb80a15), X(0x7fb8904d), X(0x7fb915cc), X(0x7fb99a92),
-  X(0x7fba1ea0), X(0x7fbaa1f7), X(0x7fbb2497), X(0x7fbba681),
-  X(0x7fbc27b5), X(0x7fbca835), X(0x7fbd2801), X(0x7fbda719),
-  X(0x7fbe257e), X(0x7fbea331), X(0x7fbf2032), X(0x7fbf9c82),
-  X(0x7fc01821), X(0x7fc09311), X(0x7fc10d52), X(0x7fc186e4),
-  X(0x7fc1ffc8), X(0x7fc277ff), X(0x7fc2ef89), X(0x7fc36667),
-  X(0x7fc3dc9a), X(0x7fc45221), X(0x7fc4c6ff), X(0x7fc53b33),
-  X(0x7fc5aebe), X(0x7fc621a0), X(0x7fc693db), X(0x7fc7056f),
-  X(0x7fc7765c), X(0x7fc7e6a3), X(0x7fc85645), X(0x7fc8c542),
-  X(0x7fc9339b), X(0x7fc9a150), X(0x7fca0e63), X(0x7fca7ad3),
-  X(0x7fcae6a2), X(0x7fcb51cf), X(0x7fcbbc5c), X(0x7fcc2649),
-  X(0x7fcc8f97), X(0x7fccf846), X(0x7fcd6058), X(0x7fcdc7cb),
-  X(0x7fce2ea2), X(0x7fce94dd), X(0x7fcefa7b), X(0x7fcf5f7f),
-  X(0x7fcfc3e8), X(0x7fd027b7), X(0x7fd08aed), X(0x7fd0ed8b),
-  X(0x7fd14f90), X(0x7fd1b0fd), X(0x7fd211d4), X(0x7fd27214),
-  X(0x7fd2d1bf), X(0x7fd330d4), X(0x7fd38f55), X(0x7fd3ed41),
-  X(0x7fd44a9a), X(0x7fd4a761), X(0x7fd50395), X(0x7fd55f37),
-  X(0x7fd5ba48), X(0x7fd614c9), X(0x7fd66eba), X(0x7fd6c81b),
-  X(0x7fd720ed), X(0x7fd77932), X(0x7fd7d0e8), X(0x7fd82812),
-  X(0x7fd87eae), X(0x7fd8d4bf), X(0x7fd92a45), X(0x7fd97f40),
-  X(0x7fd9d3b0), X(0x7fda2797), X(0x7fda7af5), X(0x7fdacdca),
-  X(0x7fdb2018), X(0x7fdb71dd), X(0x7fdbc31c), X(0x7fdc13d5),
-  X(0x7fdc6408), X(0x7fdcb3b6), X(0x7fdd02df), X(0x7fdd5184),
-  X(0x7fdd9fa5), X(0x7fdded44), X(0x7fde3a60), X(0x7fde86fb),
-  X(0x7fded314), X(0x7fdf1eac), X(0x7fdf69c4), X(0x7fdfb45d),
-  X(0x7fdffe76), X(0x7fe04811), X(0x7fe0912e), X(0x7fe0d9ce),
-  X(0x7fe121f0), X(0x7fe16996), X(0x7fe1b0c1), X(0x7fe1f770),
-  X(0x7fe23da4), X(0x7fe2835f), X(0x7fe2c89f), X(0x7fe30d67),
-  X(0x7fe351b5), X(0x7fe3958c), X(0x7fe3d8ec), X(0x7fe41bd4),
-  X(0x7fe45e46), X(0x7fe4a042), X(0x7fe4e1c8), X(0x7fe522da),
-  X(0x7fe56378), X(0x7fe5a3a1), X(0x7fe5e358), X(0x7fe6229b),
-  X(0x7fe6616d), X(0x7fe69fcc), X(0x7fe6ddbb), X(0x7fe71b39),
-  X(0x7fe75847), X(0x7fe794e5), X(0x7fe7d114), X(0x7fe80cd5),
-  X(0x7fe84827), X(0x7fe8830c), X(0x7fe8bd84), X(0x7fe8f78f),
-  X(0x7fe9312f), X(0x7fe96a62), X(0x7fe9a32b), X(0x7fe9db8a),
-  X(0x7fea137e), X(0x7fea4b09), X(0x7fea822b), X(0x7feab8e5),
-  X(0x7feaef37), X(0x7feb2521), X(0x7feb5aa4), X(0x7feb8fc1),
-  X(0x7febc478), X(0x7febf8ca), X(0x7fec2cb6), X(0x7fec603e),
-  X(0x7fec9363), X(0x7fecc623), X(0x7fecf881), X(0x7fed2a7c),
-  X(0x7fed5c16), X(0x7fed8d4e), X(0x7fedbe24), X(0x7fedee9b),
-  X(0x7fee1eb1), X(0x7fee4e68), X(0x7fee7dc0), X(0x7feeacb9),
-  X(0x7feedb54), X(0x7fef0991), X(0x7fef3771), X(0x7fef64f5),
-  X(0x7fef921d), X(0x7fefbee8), X(0x7fefeb59), X(0x7ff0176f),
-  X(0x7ff0432a), X(0x7ff06e8c), X(0x7ff09995), X(0x7ff0c444),
-  X(0x7ff0ee9c), X(0x7ff1189b), X(0x7ff14243), X(0x7ff16b94),
-  X(0x7ff1948e), X(0x7ff1bd32), X(0x7ff1e581), X(0x7ff20d7b),
-  X(0x7ff2351f), X(0x7ff25c70), X(0x7ff2836d), X(0x7ff2aa17),
-  X(0x7ff2d06d), X(0x7ff2f672), X(0x7ff31c24), X(0x7ff34185),
-  X(0x7ff36695), X(0x7ff38b55), X(0x7ff3afc4), X(0x7ff3d3e4),
-  X(0x7ff3f7b4), X(0x7ff41b35), X(0x7ff43e69), X(0x7ff4614e),
-  X(0x7ff483e6), X(0x7ff4a631), X(0x7ff4c82f), X(0x7ff4e9e1),
-  X(0x7ff50b47), X(0x7ff52c62), X(0x7ff54d33), X(0x7ff56db9),
-  X(0x7ff58df5), X(0x7ff5ade7), X(0x7ff5cd90), X(0x7ff5ecf1),
-  X(0x7ff60c09), X(0x7ff62ada), X(0x7ff64963), X(0x7ff667a5),
-  X(0x7ff685a1), X(0x7ff6a357), X(0x7ff6c0c7), X(0x7ff6ddf1),
-  X(0x7ff6fad7), X(0x7ff71778), X(0x7ff733d6), X(0x7ff74fef),
-  X(0x7ff76bc6), X(0x7ff78759), X(0x7ff7a2ab), X(0x7ff7bdba),
-  X(0x7ff7d888), X(0x7ff7f315), X(0x7ff80d61), X(0x7ff8276c),
-  X(0x7ff84138), X(0x7ff85ac4), X(0x7ff87412), X(0x7ff88d20),
-  X(0x7ff8a5f0), X(0x7ff8be82), X(0x7ff8d6d7), X(0x7ff8eeef),
-  X(0x7ff906c9), X(0x7ff91e68), X(0x7ff935cb), X(0x7ff94cf2),
-  X(0x7ff963dd), X(0x7ff97a8f), X(0x7ff99105), X(0x7ff9a742),
-  X(0x7ff9bd45), X(0x7ff9d30f), X(0x7ff9e8a0), X(0x7ff9fdf9),
-  X(0x7ffa131a), X(0x7ffa2803), X(0x7ffa3cb4), X(0x7ffa512f),
-  X(0x7ffa6573), X(0x7ffa7981), X(0x7ffa8d59), X(0x7ffaa0fc),
-  X(0x7ffab46a), X(0x7ffac7a3), X(0x7ffadaa8), X(0x7ffaed78),
-  X(0x7ffb0015), X(0x7ffb127f), X(0x7ffb24b6), X(0x7ffb36bb),
-  X(0x7ffb488d), X(0x7ffb5a2e), X(0x7ffb6b9d), X(0x7ffb7cdb),
-  X(0x7ffb8de9), X(0x7ffb9ec6), X(0x7ffbaf73), X(0x7ffbbff1),
-  X(0x7ffbd03f), X(0x7ffbe05e), X(0x7ffbf04f), X(0x7ffc0012),
-  X(0x7ffc0fa6), X(0x7ffc1f0d), X(0x7ffc2e47), X(0x7ffc3d54),
-  X(0x7ffc4c35), X(0x7ffc5ae9), X(0x7ffc6971), X(0x7ffc77ce),
-  X(0x7ffc8600), X(0x7ffc9407), X(0x7ffca1e4), X(0x7ffcaf96),
-  X(0x7ffcbd1f), X(0x7ffcca7e), X(0x7ffcd7b4), X(0x7ffce4c1),
-  X(0x7ffcf1a5), X(0x7ffcfe62), X(0x7ffd0af6), X(0x7ffd1763),
-  X(0x7ffd23a9), X(0x7ffd2fc8), X(0x7ffd3bc1), X(0x7ffd4793),
-  X(0x7ffd533f), X(0x7ffd5ec5), X(0x7ffd6a27), X(0x7ffd7563),
-  X(0x7ffd807a), X(0x7ffd8b6e), X(0x7ffd963d), X(0x7ffda0e8),
-  X(0x7ffdab70), X(0x7ffdb5d5), X(0x7ffdc017), X(0x7ffdca36),
-  X(0x7ffdd434), X(0x7ffdde0f), X(0x7ffde7c9), X(0x7ffdf161),
-  X(0x7ffdfad8), X(0x7ffe042f), X(0x7ffe0d65), X(0x7ffe167b),
-  X(0x7ffe1f71), X(0x7ffe2848), X(0x7ffe30ff), X(0x7ffe3997),
-  X(0x7ffe4211), X(0x7ffe4a6c), X(0x7ffe52a9), X(0x7ffe5ac8),
-  X(0x7ffe62c9), X(0x7ffe6aae), X(0x7ffe7275), X(0x7ffe7a1f),
-  X(0x7ffe81ad), X(0x7ffe891f), X(0x7ffe9075), X(0x7ffe97b0),
-  X(0x7ffe9ece), X(0x7ffea5d2), X(0x7ffeacbb), X(0x7ffeb38a),
-  X(0x7ffeba3e), X(0x7ffec0d8), X(0x7ffec758), X(0x7ffecdbf),
-  X(0x7ffed40d), X(0x7ffeda41), X(0x7ffee05d), X(0x7ffee660),
-  X(0x7ffeec4b), X(0x7ffef21f), X(0x7ffef7da), X(0x7ffefd7e),
-  X(0x7fff030b), X(0x7fff0881), X(0x7fff0de0), X(0x7fff1328),
-  X(0x7fff185b), X(0x7fff1d77), X(0x7fff227e), X(0x7fff276f),
-  X(0x7fff2c4b), X(0x7fff3112), X(0x7fff35c4), X(0x7fff3a62),
-  X(0x7fff3eeb), X(0x7fff4360), X(0x7fff47c2), X(0x7fff4c0f),
-  X(0x7fff504a), X(0x7fff5471), X(0x7fff5885), X(0x7fff5c87),
-  X(0x7fff6076), X(0x7fff6452), X(0x7fff681d), X(0x7fff6bd6),
-  X(0x7fff6f7d), X(0x7fff7313), X(0x7fff7698), X(0x7fff7a0c),
-  X(0x7fff7d6f), X(0x7fff80c2), X(0x7fff8404), X(0x7fff8736),
-  X(0x7fff8a58), X(0x7fff8d6b), X(0x7fff906e), X(0x7fff9362),
-  X(0x7fff9646), X(0x7fff991c), X(0x7fff9be3), X(0x7fff9e9c),
-  X(0x7fffa146), X(0x7fffa3e2), X(0x7fffa671), X(0x7fffa8f1),
-  X(0x7fffab65), X(0x7fffadca), X(0x7fffb023), X(0x7fffb26f),
-  X(0x7fffb4ae), X(0x7fffb6e0), X(0x7fffb906), X(0x7fffbb20),
-  X(0x7fffbd2e), X(0x7fffbf30), X(0x7fffc126), X(0x7fffc311),
-  X(0x7fffc4f1), X(0x7fffc6c5), X(0x7fffc88f), X(0x7fffca4d),
-  X(0x7fffcc01), X(0x7fffcdab), X(0x7fffcf4a), X(0x7fffd0e0),
-  X(0x7fffd26b), X(0x7fffd3ec), X(0x7fffd564), X(0x7fffd6d2),
-  X(0x7fffd838), X(0x7fffd993), X(0x7fffdae6), X(0x7fffdc31),
-  X(0x7fffdd72), X(0x7fffdeab), X(0x7fffdfdb), X(0x7fffe104),
-  X(0x7fffe224), X(0x7fffe33c), X(0x7fffe44d), X(0x7fffe556),
-  X(0x7fffe657), X(0x7fffe751), X(0x7fffe844), X(0x7fffe930),
-  X(0x7fffea15), X(0x7fffeaf3), X(0x7fffebca), X(0x7fffec9b),
-  X(0x7fffed66), X(0x7fffee2a), X(0x7fffeee8), X(0x7fffefa0),
-  X(0x7ffff053), X(0x7ffff0ff), X(0x7ffff1a6), X(0x7ffff247),
-  X(0x7ffff2e4), X(0x7ffff37a), X(0x7ffff40c), X(0x7ffff499),
-  X(0x7ffff520), X(0x7ffff5a3), X(0x7ffff621), X(0x7ffff69b),
-  X(0x7ffff710), X(0x7ffff781), X(0x7ffff7ee), X(0x7ffff857),
-  X(0x7ffff8bb), X(0x7ffff91c), X(0x7ffff979), X(0x7ffff9d2),
-  X(0x7ffffa27), X(0x7ffffa79), X(0x7ffffac8), X(0x7ffffb13),
-  X(0x7ffffb5b), X(0x7ffffba0), X(0x7ffffbe2), X(0x7ffffc21),
-  X(0x7ffffc5d), X(0x7ffffc96), X(0x7ffffccd), X(0x7ffffd01),
-  X(0x7ffffd32), X(0x7ffffd61), X(0x7ffffd8e), X(0x7ffffdb8),
-  X(0x7ffffde0), X(0x7ffffe07), X(0x7ffffe2b), X(0x7ffffe4d),
-  X(0x7ffffe6d), X(0x7ffffe8b), X(0x7ffffea8), X(0x7ffffec3),
-  X(0x7ffffedc), X(0x7ffffef4), X(0x7fffff0a), X(0x7fffff1f),
-  X(0x7fffff33), X(0x7fffff45), X(0x7fffff56), X(0x7fffff66),
-  X(0x7fffff75), X(0x7fffff82), X(0x7fffff8f), X(0x7fffff9a),
-  X(0x7fffffa5), X(0x7fffffaf), X(0x7fffffb8), X(0x7fffffc0),
-  X(0x7fffffc8), X(0x7fffffce), X(0x7fffffd5), X(0x7fffffda),
-  X(0x7fffffdf), X(0x7fffffe4), X(0x7fffffe8), X(0x7fffffeb),
-  X(0x7fffffef), X(0x7ffffff1), X(0x7ffffff4), X(0x7ffffff6),
-  X(0x7ffffff8), X(0x7ffffff9), X(0x7ffffffb), X(0x7ffffffc),
-  X(0x7ffffffd), X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff),
-  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
-  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
-  X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
-};
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/CMakeLists.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,102 @@
+###################################################################################
+# Hedgewars, a free turn based strategy game
+# Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+###################################################################################
+
+find_program(ANT ant)
+
+if(NOT ANDROID_NDK)
+    find_path(ANDROID_NDK ndk-build)
+endif()
+
+if(IS_DIRECTORY "${ANDROID_NDK}")
+    MESSAGE(STATUS "Detected the android NDK directory at: " ${ANDROID_NDK}) 
+else ()
+    MESSAGE(FATAL_ERROR "Couldn't detect the Android NDK directory")
+endif()
+
+if(NOT ANDROID_SDK)#Check if its defined at the cmdline
+    find_path(ANDROID_SDK adb ) #assume they've added platform-tools to their path
+    get_filename_component(ANDROID_SDK "${ANDROID_SDK}" PATH)
+    set(ANDROID_SDK "${ANDROID_SDK}" CACHE PATH "Path to the android sdk" FORCE)
+endif()
+
+if( IS_DIRECTORY "${ANDROID_SDK}")
+    MESSAGE(STATUS "Detected the android SDK directory at: " ${ANDROID_SDK}) 
+else ()
+    MESSAGE(FATAL_ERROR "Couldn't detect the Android SDK directory")
+endif()
+
+if( NOT FPC_DIR)
+    find_path(FPC_DIR ppcrossarm)
+    get_filename_component(FPC_DIR "${FPC_DIR}" PATH)
+    set(FPC_DIR "${FPC_DIR}" CACHE PATH "Path to fpc dir used in the android port" FORCE)
+endif()
+
+if( IS_DIRECTORY "${FPC_DIR}")
+    MESSAGE(STATUS "Detected the FreePascal directory at: " "${FPC_DIR}") 
+else ()
+    MESSAGE(FATAL_ERROR "Couldn't detect the FreePascal directory")
+endif()
+
+set(SDL_DIR /home/richard/Downloads/android-project)
+
+
+set(ANDROID_SDK_API_LVL 8)
+set(ANDROID_NDK_API_LVL 5)
+
+MESSAGE(STATUS "Creating android scripts and configuration files")
+
+configure_file(Templates/complete_build.sh .)
+configure_file(Templates/default.properties SDL-android-project/)
+configure_file(Templates/local.properties SDL-android-project/)
+configure_file(Templates/Makefile.android .)
+configure_file(Templates/pushToDevice.sh .)
+
+if(SDL_DIR_TEMP_DISABLE)
+    MESSAGE("Moving Android port of SDL to the proper directories")
+    set(DirsToCopy
+        SDL
+        SDL_image
+        SDL_mixer
+        SDL_ttf
+	jpeg
+	png
+         mikmod
+        ) 
+    foreach(DIR ${DirsToCopy})
+        exec_program( 
+            ${CMAKE_COMMAND} 
+            ARGS -E copy_directory 
+            ${SDL_DIR}/jni/${DIR}
+            ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/${DIR}
+        )
+        MESSAGE(STATUS "Moved ${DIR}")
+    endforeach(DIR)
+    exec_program(${HGCOMMAND}
+        ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/core/android/SDL_android.cpp
+	)
+    exec_program(${HGCOMMAND}
+        ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/main/android/SDL_android_main.cpp
+	)
+    exec_program(${HGCOMMAND}
+        ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/video/android/SDL_androidtouch.c
+        )
+
+    exec_program(${HGCOMMAND}
+        ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/video/android/SDL_androidtouch.h
+	)
+endif(SDL_DIR_TEMP_DISABLE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/AndroidManifest.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="org.hedgewars.hedgeroid"
+      android:versionCode="7"
+      android:installLocation="preferExternal" android:versionName="0.1.2.2">
+    <uses-sdk android:targetSdkVersion="14" android:minSdkVersion="7"></uses-sdk>
+    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
+    <application android:label="@string/app_name" android:icon="@drawable/icon">
+        <activity android:name=".MainActivity"
+                  android:label="@string/app_name"
+ 		  		  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+ 		  		  android:launchMode="singleTask">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".SDLActivity"
+                  android:label="@string/app_name"
+ 		  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+		  android:screenOrientation='landscape'>
+        </activity>
+        
+        <activity android:name=".Downloader.DownloadFragment"
+                  android:label="@string/app_name"
+				  android:theme="@android:style/Theme.Dialog">
+        </activity>
+        
+        <activity android:name=".Downloader.DownloadListActivity"
+                  android:label="@string/app_name"
+				  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+				  android:screenOrientation='landscape'>
+        </activity>
+        
+        <service android:name=".Downloader.DownloadService"/>
+        
+        <activity android:name="StartGameActivity"
+                  android:label="@string/app_name"
+				  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+				  android:screenOrientation='landscape'>
+        </activity>
+        <activity android:name="TeamSelectionActivity"
+                  android:label="@string/app_name"
+				  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+				  android:screenOrientation='landscape'>
+        </activity>
+        <activity android:name="TeamCreatorActivity"
+                  android:label="@string/app_name"
+				  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+				  android:screenOrientation='landscape'
+				  android:windowSoftInputMode="stateUnchanged">
+        </activity>
+    </application>
+</manifest> 
Binary file project_files/Android-build/SDL-android-project/assets/Data/Fonts/DejaVuSans-Bold.ttf has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Forts/LegoL.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Forts/LegoR.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AirBomb.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AirDrill.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Airplane.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AmmoMenu/Ammos.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AmmoMenu/Ammos_bw.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AmmoMenu/BorderHorizontal.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AmmoMenu/BorderVertical.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AmmoMenu/Corners.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AmmoMenu/Slot.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AmmoMenu/SlotKeys.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/AmmoMenu/TurnsLeft.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Arrow.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Balls.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/BazookaShell.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Bee.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/BeeTrace.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/BigDigits.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/BigExplosion.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Birdy.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/BlueWater.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Bomb.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Bubbles.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/BulletHit.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Buttons/firebutton.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Cake_down.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Cake_walk.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Case.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Censored.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/ClBomb.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/ClParticle.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Clouds.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Cross.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Crosshair.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Drill.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Droplet.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Dust.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Egg.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/EvilTrace.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Expl50.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/ExplPart.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/ExplPart2.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Explosives.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/ExplosivesRoll.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Feather.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Finger.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/FirstAid.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Flags/cm_binary.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Flags/hedgewars.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Flame.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Frame.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Girder.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Graves/Bone.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/HHDeath.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/HHDress.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hammer.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hats/NoHat.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Health.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Hurrah.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/ILoveLemonade.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Idle.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Invulnerable.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Juggle.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Kowtow.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Sad.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/ShoutCorner.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/ShoutEdge.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/ShoutTail.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Shrug.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/SpeechCorner.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/SpeechEdge.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/SpeechTail.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/ThoughtCorner.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/ThoughtEdge.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/ThoughtTail.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Vampiric.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/Wave.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amAirAttack.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amBTorch_i.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amBTorch_w.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amBallgun.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amBaseball.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amBazooka.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amBee.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amCake.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amCheese.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amCluster.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amConstruction.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amDEagle.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amDEagle_w.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amDrill.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amDynamite.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amFlamethrower.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amGirder.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amGrenade.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amHammer.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amHellish.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amJetpack.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amKamikaze.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amMelon.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amMine.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amMolotov.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amMortar.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amPortalGun.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amRCPlane.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amResurrector.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amRope.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amSMine.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amSeduction.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amShotgun.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amShotgun_w.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amSineGun.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amSkip.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amSniperRifle.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amSnowball.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amVamp.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/amWhip.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Hedgehog/hh_small.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/HellishBomb.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Lag.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/MineDead.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/MineOff.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/MineOn.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Molotov.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Mortar.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/NapalmBomb.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Note.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Parachute.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Piano.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Portal.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Power.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/PowerBar.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Progress.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/RCPlane.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/RopeHook.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/RopeNode.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SMineOff.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SMineOn.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Seduction.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Shells.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Smoke.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SmokeRing.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SmokeTrace.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SmokeWhite.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Snow.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SnowDust.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Snowball.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Splash.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SuddenDeath/SDClouds.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SuddenDeath/SDDroplet.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SuddenDeath/SDFlake.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SuddenDeath/SDSplash.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/SuddenDeath/SDWater.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Switch.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Target.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/TargetBee.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Targetp.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Teleport.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Utility.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/Watermelon.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/WindBar.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/WindL.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/WindR.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/amAirplane.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/amGirder.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/amTeleport.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/cheese.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/dynamite.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/hhMask.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/hwengine.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/missions.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Graphics/thinking.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/assets/Data/Locale/en.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,526 @@
+; English locale
+
+00:00=Grenade
+00:01=ClusterBomb
+00:02=Bazooka
+00:03=Homing Bee
+00:04=Shotgun
+00:05=PickHammer
+00:06=Skip
+00:07=Rope
+00:08=Mine
+00:09=Desert Eagle
+00:10=Dynamite
+00:11=Baseball Bat
+00:12=Shoryuken
+00:13=sec
+00:14=Parachute
+00:15=Air Attack
+00:16=Mine Strike
+00:17=Blow Torch
+00:18=Construction
+00:19=Teleportation
+00:20=Switch Hedgehog
+00:21=Mortar
+00:22=Whip
+00:23=Kamikaze
+00:24=Cake
+00:25=Seduction
+00:26=Watermelon Bomb
+00:27=Hellish hand-grenade
+00:28=Drill Rocket
+00:29=Ballgun
+00:30=Napalm
+00:31=RC Plane
+00:32=Low Gravity
+00:33=Extra Damage
+00:34=Invulnerable
+00:35=Extra Time
+00:36=Laser Sight
+00:37=Vampirism
+00:38=Sniper Rifle
+00:39=Flying Saucer
+00:40=Molotov Cocktail
+00:41=Birdy
+00:42=Portable Portal Device
+00:43=Piano Strike
+00:44=Old Limburger
+00:45=Sine Gun (beta)
+00:46=Flamethrower
+00:47=Sticky Mine
+00:48=Hammer
+00:49=Resurrector
+00:50=Drill Strike
+00:51=Mudball
+00:52=No weapon selected
+00:53=TARDIS
+00:54=Structure
+00:55=Land Spray
+
+01:00=Let's fight!
+01:01=Round draw
+01:02=%1 wins!
+01:03=Volume %1%
+01:04=Paused
+01:05=Really quit (Y/Esc)?
+01:06=Sudden Death!
+01:07=%1 remaining
+01:08=Fuel
+01:09=Synchronizing...
+01:10=Using this utility won't end your turn!
+01:11=This weapon or utility is not yet available!
+01:12=Last round till Sudden Death!
+01:13=%1 rounds till Sudden Death!
+01:14=Get ready, %1!
+01:15=Slight
+01:16=Low
+01:17=Normal
+01:18=High
+01:19=Extreme
+01:20=%1 Bounce
+
+; Event messages
+; Hog (%1) died
+02:00=%1 has kicked the bucket!
+02:00=%1 has seen the light!
+02:00=%1 never saw that coming!
+02:00=%1 waves goodbye!
+02:00=%1 has gone to a better place!
+02:00=%1 meets his maker!
+02:00=%1 can hang on no longer!
+02:00=%1 has done his duty!
+02:00=%1 makes the ultimate sacrifice!
+02:00=%1 departs this mortal coil!
+02:00=%1 makes like a tree and leaves!
+02:00=%1 has timed out!
+02:00=%1 says peace out!
+02:00=%1 will be fondly remembered!
+02:00=%1 has an aneurysm!
+02:00=%1 leaves behind a wife and child
+02:00=%1 has launched his last bazooka
+02:00=%1 has tossed his last grenade
+02:00=%1 has baked his last cake
+02:00=%1 has swung on his last rope
+02:00=%1 has called his last airstrike
+02:00=%1 has pumped his last shotgun
+02:00=%1 has thrown his last melon
+02:00=%1 has drawn his last deagle
+02:00=%1 took one shot too many
+02:00=%1 could really have used a health crate
+02:00=%1 has gone to play a better game
+02:00=%1 has ragequit life
+02:00=%1 fails
+02:00=Poor poor %1...
+02:00=%1 prefers wormux
+02:00=%1 has been blocking shots with his face
+02:00=%1 is a hero amongst me...err...hogs
+02:00=%1 finds his place in Valhalla
+02:00=%1 has left the building
+02:00=%1 goes the way of the dinosaurs
+02:00=%1 brings hedgehogs one step closer to extinction
+02:00=%1 brings a tear to my eye
+02:00=%1 is an ex-hog
+02:00=%1 is pushing up the daisies
+02:00=%1 has ceased to be
+02:00=Say goodbye to %1
+02:00=No hope left for %1
+02:00=%1 faces the final curtain
+02:00=Smoke 'em if you got 'em, %1
+02:00=%1 suffers a Spontaneous Massive Existence Failure
+02:00=%1 has passed on
+02:00=%1 is stone dead
+02:00=%1 is no more
+02:00=%1 has expired
+02:00=Bereft of life, %1 rests in peace
+02:00=%1 joins the choir invisible
+02:00=Farewell %1, we hardly knew ye!
+02:00=%1 had a low tolerance for being shot
+02:00=%1 could have used an extra life
+02:00=Is there a doctor in the house?
+
+; Hog (%1) drowned
+02:01=%1 plays submarine!
+02:01=%1 mimics the Titanic!
+02:01=%1 swims like a stone!
+02:01=%1 floats like a brick!
+02:01=%1 checks out the deep end
+02:01=%1 goes glug glug glug
+02:01=%1 goes splash
+02:01=%1 forgot his armbands
+02:01=%1 really should have taken swimming lessons
+02:01=%1 left his surfboard at home
+02:01=%1 is washed up
+02:01=%1 is one soggy hog
+02:01=%1 forgot to bring his life jacket
+02:01=%1 goes splish splash splish
+02:01=%1 is sleeping with the fishes
+02:01=%1 thinks the water physics suck in this game
+02:01=%1 looks thirsty
+02:01=The sea claims %1
+02:01=%1 is lost at sea
+02:01=%1 should have brought his scuba gear
+02:01=%1 gets a burial at sea
+02:01=%1 has that sinking feeling
+02:01=%1 is practicing his backstroke
+02:01=%1 goes in search of the Titanic
+02:01=%1 is not Jesus
+02:01=%1 is finding Nemo
+02:01=%1 springs a leak
+02:01=You've gotta wonder how many hogs are down there
+02:01=%1 makes the ocean slightly higher
+02:01=%1 didn't enlist in the Navy
+02:01=%1 is doing his impersonation of a dead fish
+02:01=At least you didn't go down the toilet, %1
+02:01=Sonic couldn't swim and neither can %1
+02:01=%1 wants to play Ecco the dolphin
+02:01=%1 has gone to visit Aquaria
+02:01=%1 has found the lost city of Atlantis
+02:01=%1 aims for the lead role in Bioshock 3
+02:01=Your doggy paddle could use a little work, %1
+02:01=%1 should have brought a jet ski
+02:01=%1 doesn't like watersports
+02:01=%1 is forever blowing bubbles
+02:01=%1 is short of a raft
+02:01=%1 thinks salt water is good for the skin
+02:01=%1 gets salt water in his wounds
+02:01=%1 has walked the plank
+02:01=%1 has a bath
+02:01=%1 is wet wet wet
+02:01=%1 gets his quills wet
+02:01=It's Davy Jones' locker for %1
+
+; Round starts
+02:02=Let's fight!
+02:02=Armed and ready!
+02:02=Let's get ready to rumble!
+02:02=Let's get it on!
+02:02=Let's get this party started
+02:02=Last hog standing wins
+02:02=Let's go!
+02:02=Let's rock!
+02:02=Let's jam!
+02:02=It's beginning...
+02:02=This is the start of something big
+02:02=Welcome to Hedgewars
+02:02=Welcome to the front lines
+02:02=Crush your enemies!
+02:02=May the best hog win
+02:02=Victory or death
+02:02=To the victor goes the spoils
+02:02=Losing is not an option
+02:02=Cry havoc! Let loose the hogs of war!
+02:02=Hedgewars, brought to you by Hedgewars.org
+02:02=GL HF
+02:02=Just count yourself lucky you're not up against Tiyuri
+02:02=Just count yourself lucky you're not up against unC0Rr
+02:02=Just count yourself lucky you're not up against Nemo
+02:02=Just count yourself lucky you're not up against Smaxx
+02:02=Just count yourself lucky you're not up against Jessor
+02:02=Give it your all!
+02:02=The losers do the cleaning up!
+02:02=Let the fight of the millenium begin
+02:02=Let the fight of the century begin
+02:02=Let the fight of the decade begin
+02:02=Let the fight of the year begin
+02:02=Let the fight of the month begin
+02:02=Let the fight of the week begin
+02:02=Let the fight of the day begin
+02:02=Let the fight of the hour begin
+02:02=Do your best!
+02:02=Destroy the enemy!
+02:02=Good luck
+02:02=Have fun
+02:02=Fight the good fight
+02:02=Fight dirty
+02:02=Fight with honour
+02:02=Don't give up
+02:02=Never surrender
+02:02=Rock 'em and sock 'em!
+02:02=Let the fragfest begin!
+02:02=I hope you're ready for a tussle!
+02:02=Go Go Go!
+02:02=Hedgehogs advance!
+02:02=Bring it to them!
+02:02=Have no fear!
+02:02=Be brave and conquer
+
+; Round ends (win; unused atm)
+02:03=...
+
+; Round ends (draw; unused atm)
+02:04=...
+
+; New health crate
+02:05=Incoming aid!
+02:05=Medic!
+02:05=First aid from the skies!
+02:05=A health pack for you
+02:05=Good health... in box form!
+02:05=The doctor calls
+02:05=Fresh band-aids!
+02:05=This will make you feel better
+02:05=A Hi-Potion! Whoops wrong game
+02:05=A pick-me-up!
+02:05=Grab it
+02:05=A healthy snack
+02:05=A remedy to pain
+02:05=Correct Dosage: as many as you can find!
+02:05=Urgent delivery
+02:05=Supplies!
+
+; New ammo crate
+02:06=More weapons!
+02:06=Reinforcements!
+02:06=Lock and load!
+02:06=I wonder what weapon is in there?
+02:06=Supplies!
+02:06=What could be inside?
+02:06=Christmas comes early in Hedgewars
+02:06=A present!
+02:06=Special delivery!
+02:06=It was a nightmare getting this through customs
+02:06=Destructive toys from the heavens
+02:06=Warning! Contents Volatile
+02:06=Pick it up or blow it up, choice is yours
+02:06=Goodies!
+02:06=Mmmmm Ammo
+02:06=A box of destructive power
+02:06=Airmail!
+02:06=Whatever's in that box, it ain't pizza
+02:06=Get it!
+02:06=Weapon drop incoming
+02:06=Don't let the enemy grab that!
+02:06=Shiny new toys!
+02:06=A mysterious box!
+
+; New utility crate
+02:07=Tooltime!
+02:07=This could come in handy...
+02:07=Utilities!
+02:07=Utilise this box
+02:07=Watch out below
+02:07=More utilities!
+02:07=Tools for you!
+02:07=This should be good!
+02:07=Use this wisely
+02:07=Ooo this box is heavy
+02:07=You might need this
+
+; Hog (%1) skips his turn
+02:08=%1 is sooo boring...
+02:08=%1 couldn't be bothered
+02:08=%1 is one lazy hog
+02:08=%1 is thoughtless
+02:08=%1 gave up
+02:08=You snooze you lose, %1
+02:08=%1 shamelessly skips
+02:08=%1 is really lazy
+02:08=%1 needs a little more motivation
+02:08=%1 is a pacifist
+02:08=%1 has a breather
+02:08=%1 has a rest
+02:08=%1 chills out
+02:08=%1 has no faith in his own abilities
+02:08=%1 decides to do nothing at all
+02:08=%1 lets the enemy destroy itself
+02:08=%1 would be terrible at parties
+02:08=%1 hides out
+02:08=%1 has decided to pass on this opportunity
+02:08=%1 decides the best thing he can do is...nothing
+02:08=%1 is a big wuss
+02:08=Buck Buck Buck, %1 is a chicken
+02:08=%1 is looking a little yellow
+02:08=%1 is a coward!
+02:08=%1 is waiting for sudden death
+02:08=%1 is not the fighting type
+02:08=%1 is reconsidering his purpose in life
+02:08=%1 was never much of a good shot anyway
+02:08=%1 didn't want to join the army in the first place
+02:08=Stop wasting our time, %1
+02:08=I'm dissapointed in you, %1
+02:08=Come on, you can do better than that %1
+02:08=%1's will has broken
+02:08=%1 apparently has better things to do
+02:08=%1 is scared stiff
+02:08=%1 has fallen asleep
+
+; Hog (%1) hurts himself only
+02:09=%1 should practice aiming!
+02:09=%1 seems to hate himself
+02:09=%1 is standing on the wrong side!
+02:09=%1 makes like an emo
+02:09=%1 was holding his weapon the wrong way around
+02:09=%1 is a little sadistic
+02:09=%1 is a masochist
+02:09=%1 has no instinct of self-preservation
+02:09=%1 messed up
+02:09=%1 screwed up
+02:09=That was a poor shot, %1
+02:09=%1 is a little too careless with dangerous weapons
+02:09=%1 should consider a change of career
+02:09=Worst. Shot. Ever!
+02:09=No no no %1, you shoot at the ENEMY!
+02:09=%1 should only be destroying the enemy
+02:09=%1 moves one step closer to suicide
+02:09=%1 aids the enemy
+02:09=That was stupid %1
+02:09=%1 lives by the mantra of "no pain, no gain"
+02:09=%1 is confused
+02:09=%1 hurt itself in its confusion
+02:09=%1 has a knack for embarrassing himself
+02:09=%1 is a klutz!
+02:09=%1 is clumsy
+02:09=%1 shows the enemy what he's capable of
+02:09=%1 can't be expected to be perfect all the time
+02:09=Don't worry %1, pobody's nerfect
+02:09=%1 totally did that on purpose
+02:09=I won't tell anyone if you don't, %1
+02:09=How embarrassing!
+02:09=I'm sure nobody saw that %1
+02:09=%1 needs to review his field manual
+02:09=%1's weapon clearly malfunctioned
+
+; Hog shot an home run (using the bat and another hog)
+02:10=Home Run!
+02:10=A bird, a plane, ...
+02:10=That one is out!
+
+; Hog (%1) has to leave (team is gone)
+02:11=%1 has to go to bed!
+02:11=%1 seems too busy to play
+02:11=Beam him up, Scotty!
+02:11=%1 has to go
+
+; Weapon Categories
+03:00=Timed Grenade
+03:01=Timed Grenade
+03:02=Ballistic Weapon
+03:03=Guided Weapon
+03:04=Gun (multiple shots)
+03:05=Digging Tool
+03:06=Action
+03:07=Transport Utility
+03:08=Proximity Bomb
+03:09=Gun (multiple shots)
+03:10=BOOM!
+03:11=Bonk!
+03:12=Martial Arts
+03:13=UNUSED
+03:14=Transport Utility
+03:15=Airborne Attack
+03:16=Airborne Attack
+03:17=Digging Tool
+03:18=Utility
+03:19=Transport Utility
+03:20=Action
+03:21=Ballistic Weapon
+03:22=Call me Indiana!
+03:23=(Really) Martial Arts
+03:24=The cake is NOT a lie!
+03:25=Costume Kit
+03:26=Juicy Grenade
+03:27=Fiery Grenade
+03:28=Ballistic Weapon
+03:29=Ballistic Weapon
+03:30=Airborne Attack
+03:31=Remote Controlled Bomb
+03:32=Temporary Effect
+03:33=Temporary Effect
+03:34=Temporary Effect
+03:35=Temporary Effect
+03:36=Temporary Effect
+03:37=Temporary Effect
+03:38=Gun (multiple shots)
+03:39=Transport Utility
+03:40=Incinerating Grenade
+03:41=Huge fan of Squawks
+03:42=I'm making a note here...
+; the misspelled "Beethoven" is intentional (-> to beat)
+03:43=Performing Beathoven's deadly sonata
+03:44=Best before: 1923
+03:45=The power of science
+03:46=Hot Hot Hot!
+03:47=Stick these somewhere useful!
+03:48=It's Hammer time!
+03:49=Does what you guess
+03:50=Moles fan
+03:51=Found on the ground
+03:52=UNUSED
+03:53=Type 40
+03:54=Build something
+
+; Weapon Descriptions (use | as line breaks)
+04:00=Attack your enemies using a simple grenade.|It will explode once its timer reaches zero.|1-5: Set grenade's timer|Attack: Hold to throw with more power
+04:01=Attack your enemies using a cluster bomb.|It will split into smaller bombs once its timer|reaches zero.|1-5: Set grenade's timer|Attack: Hold to throw with more power
+04:02=Attack your enemies using a ballistic projectile|that might be influenced by wind.|Attack: Hold to shoot with more power
+04:03=Launch an explosive bee that will lock on|the selected target. Don't shoot with full power|to improve its precision.|Cursor: Pick target|Attack: Hold to shoot with more power
+04:04=Attack your enemy using a shotgun with two shots.|Thanks to its spread you don't need direct hits|to harm your opponents.|Attack: Shoot (multiple times)
+04:05=Move underground! Use the pickhammer to drill|a hole into the ground and reach other areas.|Attack: Start or stop digging
+04:06=Bored? No way to attack? Save your ammo?|No problem! Just skip your turn, coward!|Attack: Skip your turn without fighting
+04:07=Bridge huge distances using timed shots with the|rope. Use your momentum to slide into other hogs|or drop grenades and other weapons on them.|Attack: Shoot or release the rope|Long Jump: Drop grenades or similar weapons
+04:08=Keep your enemies away by dropping a mine in|narrow passages or right below their feet. Be|sure to retreat before you trigger it yourself!|Attack: Drop mine next to your feet
+04:09=Not sure about your aiming? Use the Desert|Eagle to attack using up to four shots.|Attack: Shoot (multiple times)
+04:10=Brute force is always an option. Drop this classic|explosive next to your enemies and retreat.|Attack: Drop dynamite next to your feet
+04:11=Get rid of enemy hogs by batting them over|the map borders or into water. Or how about|knocking some mines to your friends?|Attack: Bat everything in front of you
+04:12=Get close and personal to unleash the power of|this almost deadly martial arts technique.|Attack: Perform the amazing Shoryuken.
+04:13=UNUSED
+04:14=Fear of heights? Better grab a parachute.|It will unfold once|you fall too far and|save your hog from taking fall damage.|Attack: Unfold the parachute|Long Jump: Drop grenades or similar weapons
+04:15=Call in an airplane to attack your enemies|using a bombing run.|Left/Right: Determine attack direction|Cursor: Select target region
+04:16=Call in an airplane to drop several mines|in the target area.|Left/Right: Determine attack direction|Cursor: Select target region
+04:17=Need shelter? Use the blow torch to dig|a tunnel into solid ground granting you|cover.|Attack: Start or stop digging
+04:18=Need additional protection or want to pass|unpassable ground? Place some girders as you|like.|Left/Right: Select girder to place|Cursor: Place girder in a valid position
+04:19=Used at the right moment teleportation can|be more powerful than almost all weapons as|it allows you to save hogs from dangerous|situations within seconds.|Cursor: Select target region
+04:20=Allows you to play the current turn with|a different hog.|Attack: Enable switching hogs
+04:21=Shoot a grenade-like projectile that will|release multiple bombs upon impact.|Attack: Shoot at full power
+04:22=Not just for Indiana Jones! The whip is a|useful weapon in many situations. Especially|when you'd like to shove someone off a cliff.|Attack: Strike everything in front of you
+04:23=If you have nothing to lose, this might be|quite handy. Sacrifice your hog by launching|him into a specific direction hurting everything|on his way and exploding at the end.|Attack: Launch the devastating and deadly attack
+04:24=Happy Birthday! Launch this cake, let it walk right|next to your enemies and let them have an explosive|party. The cake is able to pass almost all terrain|but he might detonate earlier this way.|Attack: Start the cake or let it stop and explode
+04:25=Use this disguise kit to get your enemies to jump|towards your hog (and into some gap or hole).|Attack: Use the kit and try to seduce another hog
+04:26=Throw this juicy watermelon at your enemies. Once|the timer expires, it will split into several|explosive pieces.|1-5: Set watermelon's timer|Attack: Hold to shoot with more power
+04:27=Let hellfire rain onto your opponents by using|this fiendish explosive. Don't get too close to|the explosion as smaller fires might last longer.|Attack: Hold to shoot with more power
+04:28=Short time after launching this rocket, it will|start drilling through solid ground and explode|once its fuse is triggered or it resurfaces again.|Attack: Hold to shoot with more power
+04:29=This is nothing for small kids! The ball gun fires|tons of small colored balls filled with explosives.|Attack: Shoot at full power|Up/Down: Continue aiming
+04:30=Call in an airplane to launch a powerful napalm|strike. With proper aiming this attack can eradicate|huge parts of landscape including unlucky hogs|sitting there.|Left/Right: Determine attack direction|Cursor: Select target region
+04:31=The RC plane is the ideal weapon to collect crates or|attack far away hogs. Either steer it into enemies or|drop some bombs first.|Attack: Launch the plane or drop bombs|Long Jump: Let the valkyries ride into battle|Left/Right: Steer the plane
+04:32=Low gravity is more effective than any diet! Jump|higher and over greater distances or let your enemies|fly even further.|Attack: Activate
+04:33=Sometimes you just need that little extra boost to|deal some more damage.|Attack: Activate
+04:34=Can't touch me!|Attack: Activate
+04:35=Sometimes time's running too fast. Grab some extra|seconds to finish your attack.|Attack: Activate
+04:36=Well, sometimes you're just too bad in aiming. Get|some assistance using modern day technology.|Attack: Activate
+04:37=Don't fear the daylight. It will just last one turn|but will enable you to absorb the damage you do to|other hogs.|Attack: Activate
+04:38=The sniper rifle can be the most devastating weapon|in your whole arsenal, however it's very ineffective|at close quarters. The damage dealt increases with|the distance to its target.|Attack: Shoot (twice)
+04:39=Fly to other parts of the map using the flying|saucer. This hard to master utility is able to|take you to almost any position on the battlefield.|Attack: Activate|Up/Left/Right: Apply force in one direction|Long Jump: Drop grenades or similar weapons
+04:40=Set some ground on fire using this bottle filled|with (soon to be) burning liquid.|Attack: Hold to shoot with more power
+04:41=The evidence nature might even top the flying|saucer. Birdy can carry your hog around and|drop eggs on your enemies!|Attack: Activate and drop eggs|Up/Left/Right: Flap in one direction
+04:42=This portable portal device is capable|of instantly transporting you, your enemies,|or your weaponry between two points on the|terrain.|Use it wisely and your campaign will be a...|HUGE SUCCESS!|Attack: Shoot a portal|Switch: Cycle portal colours
+04:43=Make your musical debut an explosive success!|Drop a piano from the heavens, but beware...|someone needs to play it, and that may cost you|your life!|Cursor: Select target region|F1-F9: Play the piano
+04:44=This isn't just cheese, it's biological warfare!|It won't cause an huge amount of damage once|the timer reaches zero but it will definitely|poison anyone unlucky to touch the smell!|1-5: Set grenade's timer|Attack: Hold to throw with more power
+04:45=All those physics classes have finally|paid off, launch a devastating Sine|wave at your foes.|Watch out, this weapon packs quite a kick. (This weapon is incomplete)|Attack: Shoot
+04:46=Cover your foes with sizzling liquid flame.|Heartwarming!|Attack: Activate|Up/Down: Continue aiming|Left/Right: Modify spitting power
+04:47=Double the fun with two spiky, sneaky, sticky mines.|Set up a chain reaction or defend yourself (or both!)|Attack: Hold to shoot with more power (twice)
+04:48=Why should the moles get all the abuse?|Wacking a hog can be just as fun! A good|blow from this hammer will shave off one|third of a hog's health and plunge them|underground.|Attack: Activate
+04:49=Resurrect your friends!|But beware that this also resurrects your foes.|Attack: Keep attack pressed to resurrect slowly|Up: Accelerate resurrection
+
+; Game goal strings
+05:00=Game Modes
+05:01=The following rules apply
+05:02=Forts: Defend your fortress; vanquish your enemies!
+05:03=Low Gravity: Watch your step
+05:04=Invulnerability: Hogs are (almost) invulnerable
+05:05=Vampirism: Hogs will be healed for the damage dealt
+05:06=Karma: Hogs will be damaged for the damage dealt
+05:07=Protect the King: Don't let your king die!|Place the King: Pick a protected starting point for your King
+05:08=Place Hedgehogs: Place your hogs before the game starts
+05:09=Artillery: Hogs can't walk to change position
+05:10=Indestructible Terrain: Most weapons won't destroy terrain
+05:11=Shared Ammo: All teams of the same color share their ammunition
+05:12=Mine Timers: Mines will detonate after %1 second(s)
+05:13=Mine Timers: Mines will detonate instantly
+05:14=Mine Timers: Mines will detonate after 0 - 5 seconds
+05:15=Damage Modifier: All weapons will do %1% damage
+05:16=Health of all hogs is reset on end of turn
+05:17=AI hogs respawn on death
+05:18=Unlimited Attacks
+05:19=Weapons are reset on end of turn
+05:20=Weapons are not shared between hogs
+05:21=Tag Team: Teams in a clan takes successive turns|Shared Time: Teams within a clan share turn time
Binary file project_files/Android-build/SDL-android-project/assets/Data/Locale/hedgewars_en.qm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/assets/Data/Maps/EarthRise/map.cfg	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,1 @@
+EarthRise
\ No newline at end of file
Binary file project_files/Android-build/SDL-android-project/assets/Data/Maps/EarthRise/map.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Maps/EarthRise/preview.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Music/EarthRise.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/1C.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/2D.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/3E.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/4F.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/5G.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/6A.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/7B.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/8C.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/9D.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/BirdyLay.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/CollectCrate.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/Droplet1.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/Droplet2.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/Droplet3.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/Hellish.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/Whistle.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/Yoohoo.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/baseballbat.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/bee.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/beewater.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/bump.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/cake2.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/denied.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/drillgun.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/egg.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/explosion.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/graveimpact.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/grenadeimpact.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/gun.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/hammer.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/hell_growl.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/hell_ooff.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/hell_ow.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/hell_ugh.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/hogchant3.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/homerun.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/lowgravity.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/melonimpact.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/mineimpact.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/minetick.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/molotov.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/mortar.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/parachute.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/pickhammer.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/placed.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/plane.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/rcplane.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/ride_of_the_valkyries.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/ropeattach.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/roperelease.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/ropeshot.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/shotgunfire.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/shotgunreload.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/shutterclick.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/sinegun.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/skip.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/sniperreload.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/splash.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/steam.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/steps.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/suddendeath.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/switchhog.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/throwpowerup.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/throwrelease.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/ufo.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Boring.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Byebye.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Comeonthen.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Coward.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Enemydown.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Firstblood.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Flawless.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Hello.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Hurry.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Illgetyou.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Incoming.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Jump1.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Jump2.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Jump3.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Kamikaze.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Laugh.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Missed.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Nooo.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Nutter.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Ooff1.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Ooff2.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Ooff3.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Oops.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Ow1.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Ow2.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Ow3.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Ow4.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/PoisonCough.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/PoisonMoan.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Reinforcements.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Sameteam.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Stupid.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Takecover.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Traitor.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Uh-oh.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Victory.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Watchit.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Yessir.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/voices/Classic/Youllregretthat.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/warp.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Sounds/whipcrack.ogg has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/Border.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/Chunk.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/Flake.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/LandBackTex.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/LandTex.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/Rock.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/RockShort.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/Sky.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/SkyL.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/SkyR.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/horizont.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/horizontR.png has changed
Binary file project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/icon.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/assets/Data/Themes/EarthRise/theme.cfg	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,10 @@
+sky = 0, 0, 0
+border = 106, 106, 106
+water-top = $54, $5C, $9D
+water-bottom = $34, $3C, $7D
+water-opacity = $80
+music = EarthRise.ogg
+clouds = 0
+object = Rock, 3, 65, 258, 175, 2, 1, 0, 0, 240, 215
+object = RockShort, 3, 0, 165, 163, 2, 1, 0, 0, 163, 140
+flakes = 20, 1, 0, 20, 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/build.properties	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+# This file is used to override default values used by the Ant build system.
+# 
+# This file must be checked in Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+#  'source.dir' for the location of your java source folder and
+#  'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+#  'key.store' for the location of your keystore and
+#  'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/build.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="MainActivity" default="help">
+
+    <!-- The local.properties file is created and updated by the 'android' tool.
+         It contains the path to the SDK. It should *NOT* be checked into
+         Version Control Systems. -->
+    <loadproperties srcFile="local.properties" />
+
+    <!-- The ant.properties file can be created by you. It is only edited by the
+         'android' tool to add properties to it.
+         This is the place to change some Ant specific build properties.
+         Here are some properties you may want to change/update:
+
+         source.dir
+             The name of the source directory. Default is 'src'.
+         out.dir
+             The name of the output directory. Default is 'bin'.
+
+         For other overridable properties, look at the beginning of the rules
+         files in the SDK, at tools/ant/build.xml
+
+         Properties related to the SDK location or the project target should
+         be updated using the 'android' tool with the 'update' action.
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems.
+
+         -->
+    <property file="ant.properties" />
+
+    <!-- The project.properties file is created and updated by the 'android'
+         tool, as well as ADT.
+
+         This contains project specific properties such as project target, and library
+         dependencies. Lower level build properties are stored in ant.properties
+         (or in .classpath for Eclipse projects).
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems. -->
+    <loadproperties srcFile="project.properties" />
+
+    <!-- quick check on sdk.dir -->
+    <fail
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
+            unless="sdk.dir"
+    />
+
+
+<!-- extension targets. Uncomment the ones where you want to do custom work
+     in between standard targets -->
+<!--
+    <target name="-pre-build">
+    </target>
+    <target name="-pre-compile">
+    </target>
+
+    /* This is typically used for code obfuscation.
+       Compiled code location: ${out.classes.absolute.dir}
+       If this is not done in place, override ${out.dex.input.absolute.dir} */
+    <target name="-post-compile">
+    </target>
+-->
+
+    <!-- Import the actual build file.
+
+         To customize existing targets, there are two options:
+         - Customize only one target:
+             - copy/paste the target into this file, *before* the
+               <import> task.
+             - customize it to your needs.
+         - Customize the whole content of build.xml
+             - copy/paste the content of the rules files (minus the top node)
+               into this file, replacing the <import> task.
+             - customize to your needs.
+
+         ***********************
+         ****** IMPORTANT ******
+         ***********************
+         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+         in order to avoid having your file be overridden by tools such as "android update project"
+    -->
+    <!-- version-tag: 1 -->
+    <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/jni/Android.mk	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,10 @@
+#Set the current path must be set like this because call all-subdir-makefiles changes LOCAL_PATH
+JNI_DIR  := $(call my-dir)
+LOCAL_PATH := $(JNI_DIR)
+
+include $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+include $(JNI_DIR)/../../../../misc/Android.mk
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/jni/SDL/src/core/android/SDL_android.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,267 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2011 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+#define org_hedgewars_hedgeroid org_hedgewars_hedgeroid
+
+#include "SDL_config.h"
+#include "SDL_stdinc.h"
+
+#include "SDL_android.h"
+
+extern "C" {
+#include "../../events/SDL_events_c.h"
+#include "../../video/android/SDL_androidkeyboard.h"
+#include "../../video/android/SDL_androidtouch.h"
+#include "../../video/android/SDL_androidvideo.h"
+
+/* Impelemented in audio/android/SDL_androidaudio.c */
+extern void Android_RunAudioThread();
+} // C
+
+/*******************************************************************************
+ This file links the Java side of Android with libsdl
+*******************************************************************************/
+#include <jni.h>
+#include <android/log.h>
+
+
+/*******************************************************************************
+                               Globals
+*******************************************************************************/
+static JNIEnv* mEnv = NULL;
+static JNIEnv* mAudioEnv = NULL;
+
+// Main activity
+static jclass mActivityClass;
+
+// method signatures
+static jmethodID midCreateGLContext;
+static jmethodID midFlipBuffers;
+static jmethodID midAudioInit;
+static jmethodID midAudioWriteShortBuffer;
+static jmethodID midAudioWriteByteBuffer;
+static jmethodID midAudioQuit;
+
+// Accelerometer data storage
+static float fLastAccelerometer[3];
+
+
+/*******************************************************************************
+                 Functions called by JNI
+*******************************************************************************/
+
+// Library init
+extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
+{
+    return JNI_VERSION_1_4;
+}
+
+// Called before SDL_main() to initialize JNI bindings
+extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls)
+{
+    __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init()");
+
+    mEnv = env;
+    mActivityClass = cls;
+
+    midCreateGLContext = mEnv->GetStaticMethodID(mActivityClass,
+                                "createGLContext","(II)Z");
+    midFlipBuffers = mEnv->GetStaticMethodID(mActivityClass,
+                                "flipBuffers","()V");
+    midAudioInit = mEnv->GetStaticMethodID(mActivityClass, 
+                                "audioInit", "(IZZI)Ljava/lang/Object;");
+    midAudioWriteShortBuffer = mEnv->GetStaticMethodID(mActivityClass,
+                                "audioWriteShortBuffer", "([S)V");
+    midAudioWriteByteBuffer = mEnv->GetStaticMethodID(mActivityClass,
+                                "audioWriteByteBuffer", "([B)V");
+    midAudioQuit = mEnv->GetStaticMethodID(mActivityClass,
+                                "audioQuit", "()V");
+
+    if(!midCreateGLContext || !midFlipBuffers || !midAudioInit ||
+       !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioQuit) {
+        __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java callbacks, check that they're named and typed correctly");
+    }
+}
+
+// Resize
+extern "C" void Java_org_hedgewars_hedgeroid_SDLActivity_onNativeResize(
+                                    JNIEnv* env, jclass jcls,
+                                    jint width, jint height, jint format)
+{
+    Android_SetScreenResolution(width, height, format);
+}
+
+// Keydown
+extern "C" void Java_org_hedgewars_hedgeroid_SDLActivity_onNativeKeyDown(
+                                    JNIEnv* env, jclass jcls, jint keycode)
+{
+    Android_OnKeyDown(keycode);
+}
+
+// Keyup
+extern "C" void Java_org_hedgewars_hedgeroid_SDLActivity_onNativeKeyUp(
+                                    JNIEnv* env, jclass jcls, jint keycode)
+{
+    Android_OnKeyUp(keycode);
+}
+
+// Touch
+extern "C" void Java_org_hedgewars_hedgeroid_SDLActivity_onNativeTouch(
+                                    JNIEnv* env, jclass jcls,
+                                    jint touch_device_id_in, jint pointer_finger_id_in,
+                                    jint action, jfloat x, jfloat y, jfloat p)
+{
+    Android_OnTouch(touch_device_id_in, pointer_finger_id_in, action, x, y, p);
+}
+
+// Accelerometer
+extern "C" void Java_org_hedgewars_hedgeroid_SDLActivity_onNativeAccel(
+                                    JNIEnv* env, jclass jcls,
+                                    jfloat x, jfloat y, jfloat z)
+{
+    fLastAccelerometer[0] = x;
+    fLastAccelerometer[1] = y;
+    fLastAccelerometer[2] = z;   
+}
+
+// Quit
+extern "C" void Java_org_hedgewars_hedgeroid_SDLActivity_nativeQuit(
+                                    JNIEnv* env, jclass cls)
+{    
+    // Inject a SDL_QUIT event
+    SDL_SendQuit();
+}
+
+extern "C" void Java_org_hedgewars_hedgeroid_SDLActivity_nativeRunAudioThread(
+                                    JNIEnv* env, jclass cls)
+{
+    /* This is the audio thread, with a different environment */
+    mAudioEnv = env;
+
+    Android_RunAudioThread();
+}
+
+
+/*******************************************************************************
+             Functions called by SDL into Java
+*******************************************************************************/
+extern "C" SDL_bool Android_JNI_CreateContext(int majorVersion, int minorVersion)
+{
+    if (mEnv->CallStaticBooleanMethod(mActivityClass, midCreateGLContext, majorVersion, minorVersion)) {
+        return SDL_TRUE;
+    } else {
+        return SDL_FALSE;
+    }
+}
+
+extern "C" void Android_JNI_SwapWindow()
+{
+    mEnv->CallStaticVoidMethod(mActivityClass, midFlipBuffers); 
+}
+
+extern "C" void Android_JNI_SetActivityTitle(const char *title)
+{
+    jmethodID mid;
+
+    mid = mEnv->GetStaticMethodID(mActivityClass,"setActivityTitle","(Ljava/lang/String;)V");
+    if (mid) {
+        mEnv->CallStaticVoidMethod(mActivityClass, mid, mEnv->NewStringUTF(title));
+    }
+}
+
+extern "C" void Android_JNI_GetAccelerometerValues(float values[3])
+{
+    int i;
+    for (i = 0; i < 3; ++i) {
+        values[i] = fLastAccelerometer[i];
+    }
+}
+
+//
+// Audio support
+//
+static jboolean audioBuffer16Bit = JNI_FALSE;
+static jboolean audioBufferStereo = JNI_FALSE;
+static jobject audioBuffer = NULL;
+static void* audioBufferPinned = NULL;
+
+extern "C" int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames)
+{
+    int audioBufferFrames;
+
+    __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
+    audioBuffer16Bit = is16Bit;
+    audioBufferStereo = channelCount > 1;
+
+    audioBuffer = mEnv->CallStaticObjectMethod(mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames);
+
+    if (audioBuffer == NULL) {
+        __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: didn't get back a good audio buffer!");
+        return 0;
+    }
+    audioBuffer = mEnv->NewGlobalRef(audioBuffer);
+
+    jboolean isCopy = JNI_FALSE;
+    if (audioBuffer16Bit) {
+        audioBufferPinned = mEnv->GetShortArrayElements((jshortArray)audioBuffer, &isCopy);
+        audioBufferFrames = mEnv->GetArrayLength((jshortArray)audioBuffer);
+    } else {
+        audioBufferPinned = mEnv->GetByteArrayElements((jbyteArray)audioBuffer, &isCopy);
+        audioBufferFrames = mEnv->GetArrayLength((jbyteArray)audioBuffer);
+    }
+    if (audioBufferStereo) {
+        audioBufferFrames /= 2;
+    }
+
+    return audioBufferFrames;
+}
+
+extern "C" void * Android_JNI_GetAudioBuffer()
+{
+    return audioBufferPinned;
+}
+
+extern "C" void Android_JNI_WriteAudioBuffer()
+{
+    if (audioBuffer16Bit) {
+        mAudioEnv->ReleaseShortArrayElements((jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT);
+        mAudioEnv->CallStaticVoidMethod(mActivityClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer);
+    } else {
+        mAudioEnv->ReleaseByteArrayElements((jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT);
+        mAudioEnv->CallStaticVoidMethod(mActivityClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer);
+    }
+
+    /* JNI_COMMIT means the changes are committed to the VM but the buffer remains pinned */
+}
+
+extern "C" void Android_JNI_CloseAudioDevice()
+{
+    mEnv->CallStaticVoidMethod(mActivityClass, midAudioQuit); 
+
+    if (audioBuffer) {
+        mEnv->DeleteGlobalRef(audioBuffer);
+        audioBuffer = NULL;
+        audioBufferPinned = NULL;
+    }
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/jni/SDL/src/main/android/SDL_android_main.cpp	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,49 @@
+
+/* Include the SDL main definition header */
+#include "SDL_main.h"
+
+/*******************************************************************************
+                 Functions called by JNI
+*******************************************************************************/
+#include <jni.h>
+
+// Called before SDL_main() to initialize JNI bindings in SDL library
+extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls);
+
+// Library init
+extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
+{
+    return JNI_VERSION_1_4;
+}
+
+// Start up the SDL app
+extern "C" void Java_org_hedgewars_hedgeroid_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobjectArray strArray)
+{
+    /* This interface could expand with ABI negotiation, calbacks, etc. */
+    SDL_Android_Init(env, cls);
+
+    //Get the String array from java
+    int argc = env->GetArrayLength(strArray);
+    char *argv[argc];
+    jstring jstringArgv[argc];
+    for(int i = 0; i < argc; i++){
+        jstringArgv[i] = (jstring)env->GetObjectArrayElement(strArray, i);  //get the element
+	argv[i] = (char*)malloc(sizeof(char) * env->GetStringLength(jstringArgv[i]));
+	strcpy(argv[i], env->GetStringUTFChars(jstringArgv[i], JNI_FALSE)); //copy it to a mutable location
+	//Don't release memory the JAVA GC will take care of it
+        //env->ReleaseStringChars(jstringArgv[i], (jchar*)argv[i]);           
+    }
+    
+    /* Run the application code! */
+    int status;
+    status = SDL_main(argc, argv);
+
+    //Clean up argv
+    for(int i = 0; i < argc; i++){
+    }
+
+    /* We exit here for consistency with other platforms. */
+    //exit(status); Xeli: Or lets not crash the entire app.....
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/jni/SDL_mixer/Android.mk	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,20 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := SDL_mixer
+
+LOCAL_C_INCLUDES := \
+	$(LOCAL_PATH)/../../../../../misc/libtremor \
+        $(LOCAL_PATH)/.. \
+	$(LOCAL_PATH)/../SDL/include \
+	$(LOCAL_PATH)/../mikmod/include \
+
+LOCAL_CFLAGS := -DWAV_MUSIC -DOGG_MUSIC -DOGG_USE_TREMOR -DMOD_MUSIC
+
+LOCAL_SRC_FILES := $(notdir $(filter-out %/playmus.c %/playwave.c %/fluidsynth.c, $(wildcard $(LOCAL_PATH)/*.c)))
+
+LOCAL_SHARED_LIBRARIES := SDL mikmod
+LOCAL_STATIC_LIBRARIES := tremor
+
+include $(BUILD_SHARED_LIBRARY)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/jni/src/Android.mk	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := main
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/../SDL/include
+
+# Add your application source files here...
+LOCAL_SRC_FILES := ../SDL/src/main/android/SDL_android_main.cpp hedgewars_main.c 
+
+LOCAL_SHARED_LIBRARIES := SDL
+
+LOCAL_LDLIBS := -llog -lGLESv1_CM
+
+include $(BUILD_SHARED_LIBRARY)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/jni/src/hedgewars_main.c	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,40 @@
+
+#include "android/log.h"
+#include "SDL.h"
+#include "dlfcn.h"
+#include "GLES/gl.h"
+
+#define TAG "HWEngine Loader"
+
+typedef  (*HWEngine_Game)(char**);
+
+main(int argc, char *argv[]){
+	void *handle;
+	char *error;
+	HWEngine_Game Game;
+	
+
+        __android_log_print(ANDROID_LOG_INFO, TAG, "HWEngine being loaded");
+	handle = dlopen("libhwengine.so", RTLD_NOW|RTLD_GLOBAL);
+	if(!handle){
+		__android_log_print(ANDROID_LOG_INFO, TAG, dlerror());
+		__android_log_print(ANDROID_LOG_INFO, TAG, "error dlopen");
+		exit(EXIT_FAILURE);
+	}
+	dlerror();
+
+        __android_log_print(ANDROID_LOG_INFO, TAG, "HWEngine successfully loaded..");
+
+
+	Game = (HWEngine_Game) dlsym(handle,"Game");
+	if((error = dlerror()) != NULL){
+		__android_log_print(ANDROID_LOG_INFO, TAG, error);
+		__android_log_print(ANDROID_LOG_INFO, TAG, "error dlsym");
+		exit(EXIT_FAILURE);
+	}
+	__android_log_print(ANDROID_LOG_INFO, TAG, "dlsym succeeded");
+	Game(argv);
+	__android_log_print(ANDROID_LOG_INFO, TAG, "Game() ended");
+
+	dlclose(handle);
+}
Binary file project_files/Android-build/SDL-android-project/res/drawable-large-mdpi/background.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-large-mdpi/icon.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/arrow.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/backbutton.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/background.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/bot1.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/bot2.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/bot3.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/bot4.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/bot5.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/box.9.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/box_dark.9.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/dice.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/dropdown.9.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/edit.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/fort.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/human.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/icon.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/playsound.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/savebutton.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/settings.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/startgamebutton.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/statusbar.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,12 @@
+ <level-list xmlns:android="http://schemas.android.com/apk/res/android">
+  <item android:maxLevel="0" android:drawable="@drawable/teams_number0" />
+  <item android:maxLevel="1" android:drawable="@drawable/teams_number1" />
+  <item android:maxLevel="2" android:drawable="@drawable/teams_number2" />
+  <item android:maxLevel="3" android:drawable="@drawable/teams_number3" />
+  <item android:maxLevel="4" android:drawable="@drawable/teams_number4" />
+  <item android:maxLevel="5" android:drawable="@drawable/teams_number5" />
+  <item android:maxLevel="6" android:drawable="@drawable/teams_number6" />
+  <item android:maxLevel="7" android:drawable="@drawable/teams_number7" />
+  <item android:maxLevel="8" android:drawable="@drawable/teams_number8" />
+  <item android:maxLevel="9" android:drawable="@drawable/teams_number9" />
+ </level-list>
\ No newline at end of file
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount0.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount1.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount2.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount3.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount4.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount5.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount6.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount7.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount8.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teamcount9.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number0.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number1.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number2.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number3.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number4.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number5.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number6.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number7.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number8.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-mdpi/teams_number9.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-normal-hdpi/background.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-normal-hdpi/fort.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-normal-hdpi/icon.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-normal-ldpi/icon.png has changed
Binary file project_files/Android-build/SDL-android-project/res/drawable-xlarge-mdpi/background.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/backbutton.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+    <ImageButton
+    	android:id="@+id/btnBack"
+    	android:layout_width="120dip"
+    	android:layout_height="40dip"
+    	android:layout_alignParentBottom="true"
+    	android:layout_alignParentLeft="true"
+    	android:adjustViewBounds="true"
+    	android:scaleType="centerInside"
+    	android:background="@android:color/transparent"
+    	android:src="@drawable/backbutton"/>
+</merge>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/background.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+<ImageView
+	android:layout_width="fill_parent"
+	android:layout_height="fill_parent"
+	android:scaleType="center"
+	android:src="@drawable/background"/>
+</merge>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/config.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+    	
+    <ListView
+    	android:id="@+id/listView"
+    	android:layout_width="wrap_content"
+    	android:layout_height="fill_parent"/>
+    	
+</RelativeLayout>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/download_confirmdialog.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="fill_parent"
+    android:padding="5dip">
+  	<TextView 
+      	android:id="@+id/text"
+       	android:layout_width="200dip"
+       	android:layout_height="wrap_content"
+       	android:padding="5dip"
+       	android:gravity="center"
+       	android:maxWidth="200dip"/>
+
+	<LinearLayout
+	    android:layout_width="fill_parent"
+	    android:layout_height="wrap_content"
+	    android:layout_below="@+id/text"
+	    android:layout_alignLeft="@id/text"
+	    android:layout_alignRight="@id/text"
+	    android:orientation="horizontal"
+	    android:gravity="center">
+
+	    <Button
+	        android:id="@+id/yes"
+	        android:layout_width="fill_parent"
+	        android:layout_height="fill_parent"
+	        android:layout_weight="1"
+	        android:text="@android:string/yes" />
+
+	    <Button
+	        android:id="@+id/no"
+	        android:layout_width="fill_parent"
+	        android:layout_height="fill_parent"
+	        android:layout_weight="1"
+	        android:text="@android:string/no" />
+	</LinearLayout>
+   	
+</RelativeLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/download_info.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="horizontal"
+    android:gravity="center_vertical">
+    <ImageView
+        android:id="@+id/arrow"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="8"
+        android:src="@drawable/arrow"
+        android:adjustViewBounds="true"/>
+    
+    <RelativeLayout
+        android:id="@+id/container"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:layout_weight="1"
+        android:gravity="center"
+        android:background="@drawable/box_dark">        
+        <TextView
+            android:id="@+id/text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="This package will higher quality sounds better sounds"/>
+        
+        <Button 
+            android:id="@+id/download"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignLeft="@id/text"
+            android:layout_below="@id/text"
+            android:text="@string/download_downloadnow"/>        
+        <Button 
+            android:id="@+id/cancel"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignRight="@id/text"
+            android:layout_below="@id/text"
+            android:text="@android:string/no"/>
+            
+    </RelativeLayout>
+    
+
+</LinearLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/download_listactivity.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+    
+   <include layout="@layout/background"/>
+    
+	<LinearLayout 
+	    android:layout_width="fill_parent"
+	    android:layout_height="fill_parent"
+	    android:orientation="horizontal"
+	    android:background="@android:color/transparent">	    
+	    <fragment class="org.hedgewars.hedgeroid.Downloader.DownloadListFragment"
+	        android:id="@+id/downloadList"
+	        android:layout_width="fill_parent"
+	        android:layout_height="fill_parent"
+	        android:layout_weight="1"/>
+	    
+	    <FrameLayout 
+	        android:id="@+id/downloadFrameLayout"
+	        android:layout_width="fill_parent"
+	        android:layout_height="fill_parent"
+	        android:layout_weight="1"
+	        android:background="@android:color/transparent">
+	        
+	        <ScrollView
+	            android:layout_width="fill_parent"
+	        	android:layout_height="fill_parent">
+	            
+	            <LinearLayout
+	                android:id="@+id/downloadQueueContainer"
+	                android:layout_width="fill_parent"
+	        		android:layout_height="fill_parent"
+	        		android:orientation="vertical"/>	        		
+	        </ScrollView>
+	    </FrameLayout>
+	
+	</LinearLayout>
+</FrameLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/download_progress.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:id="@+id/container"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:minWidth="250dip"
+    android:padding="5dp"
+    android:background="@drawable/box">
+    <ProgressBar
+    	android:id="@+id/progressbar"
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:layout_alignParentLeft="true"
+    	android:layout_alignParentRight="true"
+    	android:progressDrawable="@android:drawable/progress_horizontal"
+		android:indeterminate="false" 
+		android:indeterminateOnly="false"/>
+	<TextView
+    	android:id="@+id/progressbar_sub"
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:layout_below="@id/progressbar"
+    	android:layout_alignParentLeft="true"
+    	android:layout_alignParentRight="true"
+    	android:text="@string/download_queued"
+    	android:textColor="#FFF"
+    	android:textSize="14dp"
+    	android:gravity="center"/> 	
+    <!--  <Button
+    	android:id="@id/background"
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:layout_below="@id/progressbar_sub"
+    	android:text="@string/download_background"/>-->
+    <Button
+    	android:id="@+id/cancelDownload"
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:layout_below="@id/progressbar_sub"
+    	
+    	android:layout_centerHorizontal="true"
+    	android:text="@string/download_cancel"/>
+    <!-- android:layout_toRightOf="@id/background"-->
+    	
+</RelativeLayout>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/listview_item.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_width="fill_parent"
+	android:layout_height="wrap_content"
+	android:textSize="10dip"
+	android:textColor="#FFF"
+	android:gravity="center"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/main.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+<TextView  
+    android:layout_width="fill_parent" 
+    android:layout_height="wrap_content" 
+    android:text="Press download on first every launch, then startGame"
+    />
+    
+    <Button
+    	android:id="@+id/downloader"
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:text="downloader"/>
+    	
+    <Button
+    	android:id="@+id/startGame"
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:text="startgame"/>
+    	
+</LinearLayout>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/notification.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:padding="3dp">
+	<ImageView
+		android:id="@+id/icon"
+    	android:layout_width="wrap_content" 
+    	android:layout_height="fill_parent"
+    	android:scaleType="centerInside"
+    	android:src="@drawable/icon"/>
+    
+    <TextView
+    	android:id="@+id/title"
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:layout_toRightOf="@id/icon"
+    	android:text="@string/notification_title"
+    	android:textColor="#000"
+    	android:textSize="17dp"
+    	android:textStyle="bold"/>
+    			
+	<TextView
+    	android:id="@+id/progressbar_sub"
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:layout_toRightOf="@id/icon"
+    	android:layout_alignParentBottom="true"
+    	android:text="@string/notification_title"
+    	android:textColor="#000"
+    	android:textSize="10dp"/> 	
+	<ProgressBar
+		android:id="@+id/notification_progress"
+		android:layout_width="fill_parent"
+		android:layout_height="wrap_content"
+		android:layout_toRightOf="@id/icon"
+		android:layout_below="@id/title"
+		android:layout_above="@id/progressbar_sub"
+		android:progressDrawable="@android:drawable/progress_horizontal"
+		android:indeterminate="false" android:indeterminateOnly="false"
+		android:paddingRight="5dp"
+		android:paddingTop="5dp"/>   
+
+</RelativeLayout>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/savebutton.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+    <ImageButton
+    	android:id="@+id/btnSave"
+    	android:layout_width="120dip"
+    	android:layout_height="40dip"
+    	android:layout_alignParentBottom="true"
+    	android:layout_alignParentRight="true"
+    	android:adjustViewBounds="true"
+    	android:scaleType="centerInside"
+    	android:background="@android:color/transparent"
+    	android:src="@drawable/savebutton"/>
+</merge>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/spinner_textimg_dropdown_entry.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_width="wrap_content"
+	android:layout_height="wrap_content"
+	android:gravity="center">
+	<ImageView
+		android:id="@+id/spinner_img"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"
+		android:layout_gravity="center"
+		android:adjustViewBounds="true"
+		android:scaleType="centerInside"
+		android:layout_marginRight="5dip"
+		/>
+	<TextView
+		android:id="@+id/spinner_txt"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"
+		android:textSize="14dip"
+		android:textColor="#000"
+		android:gravity="center"/>
+</LinearLayout>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/spinner_textimg_entry.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_width="wrap_content"
+	android:layout_height="wrap_content"
+	android:gravity="center">
+	<ImageView
+		android:id="@+id/spinner_img"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"
+		android:layout_gravity="center"
+		android:adjustViewBounds="true"
+		android:scaleType="centerInside"
+		android:layout_marginRight="5dip"
+		/>
+	<TextView
+		android:id="@+id/spinner_txt"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"
+		android:textSize="14dip"
+		android:textColor="#FFF"
+		android:gravity="center"/>
+</LinearLayout>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/starting_game.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+    <include
+    	layout="@layout/background"/>
+     
+    <ImageView
+    	android:id="@+id/mapPreview"
+    	android:layout_width="256dip"
+    	android:layout_height="128dip"
+    	android:layout_margin="5dip"
+    	android:scaleType="fitXY"
+    	android:background="@drawable/box"
+    	android:src="@drawable/backbutton"/>
+    
+    <Spinner 
+       	android:id="@+id/spinMaps"
+       	android:layout_height="wrap_content"
+       	android:layout_width="wrap_content"    
+       	android:layout_below="@id/mapPreview"
+       	android:layout_alignRight="@id/mapPreview"
+       	android:layout_toRightOf="@+id/txtMap"
+       	android:background="@drawable/dropdown"/>
+    <TextView
+		android:id="@id/txtMap"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content"
+		android:text="@string/start_map"
+		android:layout_alignTop="@id/spinMaps"
+		android:layout_alignBottom="@id/spinMaps"
+		android:layout_alignLeft="@id/mapPreview"
+		android:gravity="center"/>	
+   	
+    <TableLayout 
+       	android:id="@+id/gameOptions" 
+       	android:layout_height="wrap_content" 
+       	android:layout_width="wrap_content"
+       	android:layout_centerHorizontal="true"
+       	android:layout_toRightOf="@id/mapPreview" 
+       	android:layout_alignParentRight="true"
+       	android:padding="3dip"
+       	android:layout_margin="5dip"
+       	android:background="@drawable/box"
+       	android:stretchColumns="0,2"
+       	android:shrinkColumns="1">
+	       	
+       	<TableRow>
+        	 <TextView 
+		        android:id="@+id/txtGameplay"
+		        android:layout_height="wrap_content"
+		        android:layout_width="wrap_content"
+		        android:text="@string/start_gameplay"/>
+        	<Spinner
+	        	android:id="@+id/spinGameplay"
+	        	android:layout_height="wrap_content"
+		        android:layout_width="wrap_content"
+		        android:background="@drawable/dropdown"
+		        />
+		</TableRow>  
+		<TableRow>
+		    <TextView 
+		        android:id="@+id/txtGamescheme"
+		        android:layout_height="wrap_content"
+		        android:layout_width="wrap_content"
+		        android:text="@string/start_gamescheme"/>
+		    <Spinner
+		       	android:id="@+id/spinGamescheme"
+		       	android:layout_height="wrap_content"
+		        android:layout_width="wrap_content"
+		        android:background="@drawable/dropdown"/>
+		    <ImageButton
+		    	android:id="@+id/btnGamescheme"
+		    	android:layout_height="wrap_content"
+		        android:layout_width="wrap_content"
+		        android:background="@drawable/edit"
+		        android:adjustViewBounds="true"
+		        android:scaleType="centerInside"
+		        android:layout_gravity="center"
+		        android:padding="3dip"/>
+		 </TableRow>
+		 <TableRow>    
+		     <TextView 
+		        android:id="@+id/txtweapons"
+		        android:layout_height="wrap_content"
+		        android:layout_width="wrap_content"
+		        android:layout_below="@id/txtGamescheme"
+		        android:layout_marginTop="5dip"
+		        android:text="@string/start_weapons"/>
+	        
+	        <Spinner
+	        	android:id="@+id/spinweapons"
+	        	android:layout_height="wrap_content"
+		        android:layout_width="wrap_content"
+		        android:background="@drawable/dropdown"/>
+		    
+		    <ImageButton
+		    	android:id="@+id/btnweapons"
+		    	android:layout_height="wrap_content"
+		        android:layout_width="wrap_content"
+		        android:background="@drawable/edit"
+		        android:adjustViewBounds="true"
+		        android:scaleType="centerInside"
+		        android:layout_gravity="center"
+		        android:padding="3dip"/>
+        </TableRow>	
+    </TableLayout>
+        
+    <ImageView 
+       	android:id="@+id/imgTheme"
+       	android:layout_height="wrap_content" 
+       	android:layout_width="wrap_content"
+       	android:layout_alignTop="@+id/spinTheme"
+       	android:layout_alignBottom="@id/spinTheme"
+       	android:layout_alignLeft="@id/gameOptions"
+       	android:adjustViewBounds="true"/>
+       
+    <Spinner
+        android:id="@id/spinTheme"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content" 
+        android:layout_toRightOf="@+id/imgTheme"
+        android:layout_alignParentRight="true"
+       	android:layout_below="@id/gameOptions"
+       	android:background="@drawable/dropdown"/>
+        
+	<include layout="@layout/backbutton"/>
+    
+    <LinearLayout
+    	android:layout_width="wrap_content"
+    	android:layout_height="wrap_content"
+    	android:layout_alignParentBottom="true"
+    	android:layout_centerHorizontal="true"
+    	android:orientation="horizontal">
+    <ImageButton
+    	android:id="@+id/btnTeams"
+    	android:layout_width="120dip"
+    	android:layout_height="40dip"
+    	android:adjustViewBounds="true"
+    	android:scaleType="centerInside"
+    	android:background="@android:color/transparent"
+    	android:src="@drawable/teams"/>
+    <ImageView
+    	android:id="@+id/imgTeamsCount"
+    	android:layout_width="40dip"
+    	android:layout_height="40dip"
+    	android:adjustViewBounds="true"
+    	android:scaleType="centerInside"
+    	android:background="@android:color/transparent"
+    	android:src="@drawable/teamcount"/>
+        
+    </LinearLayout>
+
+    <ImageButton
+    	android:id="@+id/btnStart"
+    	android:layout_width="120dip"
+    	android:layout_height="40dip"
+    	android:layout_alignParentBottom="true"
+    	android:layout_alignParentRight="true"
+    	android:adjustViewBounds="true"
+    	android:scaleType="centerInside"
+    	android:background="@android:color/transparent"
+    	android:src="@drawable/startgamebutton"/>
+
+</RelativeLayout>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_creation.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout
+	xmlns:android="http://schemas.android.com/apk/res/android"
+  	android:layout_width="fill_parent"
+	android:layout_height="fill_parent">
+	<include layout="@layout/background"/>
+	<LinearLayout
+	  xmlns:android="http://schemas.android.com/apk/res/android"
+	  android:orientation="horizontal"
+	  android:layout_width="fill_parent"
+	  android:layout_height="fill_parent"
+	  android:padding="3dp">
+	  
+	  <RelativeLayout
+	  	android:layout_width="fill_parent"
+	  	android:layout_height="fill_parent"
+	  	android:layout_weight="1">
+	  	<include layout="@layout/backbutton"/>
+	  	<include layout="@layout/savebutton"/>
+	  	<ScrollView
+		  	android:layout_width="fill_parent"
+		  	android:layout_height="fill_parent"
+		  	android:layout_above="@+id/btnBack"
+		  	android:background="@drawable/box"
+		  	android:scrollbarFadeDuration="0">
+		  	<TableLayout
+		  		android:layout_width="fill_parent"
+		  		android:layout_height="fill_parent"
+		  		android:stretchColumns="1"
+		  		android:layout_marginRight="4dip">
+		  		<TableRow android:padding="2dip">
+			  		<TextView
+			  			android:id="@+id/nameTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="wrap_content"
+			  			android:text="@string/name"/>
+			  		<EditText
+			  			android:id="@+id/txtName"
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_margin="3dip"
+			  			android:background="@drawable/box"
+			  			android:text="@string/name_default"
+			  			android:textColor="#FFF"/>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+			  		<TextView
+			  			android:id="@+id/typeTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="fill_parent"
+			  			android:layout_alignTop="@+id/spinType"
+			  			android:layout_alignBottom="@id/spinType"
+			  			android:gravity="center"
+			  			android:text="@string/type"/>
+			  		<Spinner
+			  			android:id="@id/spinType"
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip"
+			  			android:background="@drawable/dropdown"/>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+		  			<TextView
+			  			android:id="@+id/graveTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="fill_parent"
+			  			android:layout_alignTop="@+id/spinGrave"
+			  			android:layout_alignBottom="@id/spinGrave"
+			  			android:gravity="center"
+			  			android:text="@string/grave"/>
+			  		<Spinner
+			  			android:id="@id/spinGrave"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip"
+			  			android:background="@drawable/dropdown"/>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+		   			<TextView
+			  			android:id="@+id/FlagTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="fill_parent"
+			  			android:layout_alignTop="@+id/spinFlag"
+			  			android:layout_alignBottom="@id/spinFlag"
+			  			android:gravity="center"
+			  			android:text="@string/flag"/>
+			  		<Spinner
+			  			android:id="@id/spinFlag"
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip"
+			  			android:background="@drawable/dropdown"/>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+		  		  	<TextView
+			  			android:id="@+id/voiceTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="fill_parent"
+			  			android:layout_alignTop="@+id/spinVoice"
+			  			android:layout_alignBottom="@id/spinVoice"
+			  			android:gravity="center"
+			  			android:text="@string/voice"/>
+			  		<RelativeLayout
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip">
+			  			<ImageButton
+			  				android:id="@+id/btnPlay"
+			  				android:layout_width="wrap_content"
+			  				android:layout_height="wrap_content"
+			  				android:layout_alignParentRight="true"
+			  				android:adjustViewBounds="true"
+			  				android:scaleType="centerInside"
+			  				android:src="@drawable/playsound"
+			  				android:background="@android:color/transparent"/>
+			  			<Spinner
+			  				android:id="@+id/spinVoice"
+			  				android:layout_width="fill_parent"
+			  				android:layout_height="fill_parent"
+			  				android:layout_centerVertical="true"
+			  				android:layout_alignParentLeft="true"
+			  				android:layout_toLeftOf="@id/btnPlay"
+			  				android:background="@drawable/dropdown"/>
+			  		</RelativeLayout>
+		  		</TableRow>
+		  		<TableRow android:padding="2dip">
+		  			<TextView
+			  			android:id="@+id/fortTag"
+			  			android:layout_width="wrap_content"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginTop="2dip"
+			  			android:gravity="top"
+			  			android:text="@string/fort"/>
+		  			<RelativeLayout
+			  			android:layout_width="fill_parent"
+			  			android:layout_height="wrap_content"
+			  			android:layout_marginLeft="3dip">
+			  			<Spinner
+			  				android:id="@+id/spinFort"
+			  				android:layout_width="fill_parent"
+			  				android:layout_height="wrap_content"
+			  				android:layout_centerHorizontal="true"
+			  				android:background="@drawable/dropdown"/>
+			  			<ImageView
+			  				android:id="@+id/imgFort"
+			  				android:layout_width="128dip"
+			  				android:layout_height="128dip"
+			  				android:layout_centerHorizontal="true"
+			  				android:layout_below="@id/spinFort"
+			  				android:adjustViewBounds="true"
+			  				android:scaleType="centerInside"
+			  				android:background="@android:color/transparent"
+			  				android:src="@drawable/fort"/>
+			  			
+			  		</RelativeLayout>
+		  		</TableRow>
+		  	</TableLayout>
+		  </ScrollView>
+	  </RelativeLayout>
+	  
+	  <ScrollView
+	  	android:id="@+id/scroller"
+	  	android:layout_width="fill_parent"
+	  	android:layout_height="fill_parent"
+	  	android:layout_weight="1"
+	  	android:background="@drawable/box"
+	  	android:scrollbarFadeDuration="0">
+	  	<LinearLayout
+	  		android:id="@+id/HogsContainer"
+	  		android:orientation="vertical"
+	  		android:layout_width="fill_parent"
+	  		android:layout_height="fill_parent">
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  		<include layout="@layout/team_creation_entry"/>
+	  	</LinearLayout>
+	  </ScrollView>
+	</LinearLayout>
+</FrameLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_creation_entry.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+  <RelativeLayout
+  		android:layout_width="fill_parent"
+  		android:layout_height="wrap_content"
+  		android:background="@drawable/box"
+  		android:layout_margin="3dp">
+  		<Spinner
+  			android:id="@+id/spinTeam1"
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:layout_alignParentRight="true"
+  			android:layout_toRightOf="@+id/btnTeam1"
+  			android:background="@drawable/dropdown"/>
+  		<EditText
+  			android:id="@+id/txtTeam1"
+  			android:layout_width="fill_parent"
+  			android:layout_height="wrap_content"
+  			android:layout_below="@id/spinTeam1"
+  			android:background="@drawable/box"
+  			android:gravity="center"
+  			android:textColor="#FFF"
+  			android:text="Arnold"/>
+  		<ImageButton
+  			android:id="@id/btnTeam1"
+  			android:layout_height="wrap_content"
+  			android:layout_width="wrap_content"
+  			android:layout_alignLeft="@id/txtTeam1"
+  			android:layout_above="@id/txtTeam1"
+  			android:layout_alignTop="@id/spinTeam1"
+  			android:adjustViewBounds="true"
+  			android:scaleType="centerInside"
+  			android:background="@android:color/transparent"
+  			android:src="@drawable/dice"/>
+  </RelativeLayout>
+</merge>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_selection_dialog.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:orientation="vertical"
+  android:layout_width="wrap_content"
+  android:layout_height="wrap_content">
+  <TextView
+  	android:id="@+id/team_selection_dialog_select"
+  	android:layout_width="wrap_content"
+  	android:layout_height="wrap_content"
+  	android:text="@string/select"/>
+  <TextView
+  	android:id="@+id/team_selection_dialog_edit"
+  	android:layout_width="wrap_content"
+  	android:layout_height="wrap_content"
+  	android:text="@string/edit"/>
+  <TextView
+  	android:id="@+id/team_selection_dialog_delete"
+  	android:layout_width="wrap_content"
+  	android:layout_height="wrap_content"
+  	android:text="@string/delete"/>
+</LinearLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_selection_entry.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:id="@+id/teamColor"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  android:background="#8FFF"
+  android:padding="3dip">
+  
+  <ImageView
+  	android:id="@+id/imgDifficulty"
+  	android:layout_height="fill_parent"
+  	android:layout_width="wrap_content"
+  	android:adjustViewBounds="true"
+  	android:scaleType="centerInside"/>
+  <ImageView
+  	
+  	android:layout_height="wrap_content"
+  	android:layout_width="wrap_content"
+  	android:layout_alignParentRight="true"
+  	android:layout_centerVertical="true"
+  	android:adjustViewBounds="true"
+  	android:scaleType="centerInside"
+  	android:background="#FDA"/>
+  <ImageView
+  	android:id="@+id/teamCount"
+  	android:layout_height="fill_parent"
+  	android:layout_width="wrap_content"
+  	android:layout_alignParentRight="true"
+  	android:layout_alignTop="@id/imgDifficulty"
+  	android:layout_alignBottom="@id/imgDifficulty"
+  	android:adjustViewBounds="true"
+  	android:scaleType="centerInside"
+  	android:src="@drawable/teamcount7"/>
+  <TextView
+  	android:id="@+id/txtName"
+  	android:layout_height="fill_parent"
+  	android:layout_width="wrap_content"
+  	android:layout_toRightOf="@id/imgDifficulty"
+  	android:layout_toLeftOf="@id/teamCount"
+  	android:layout_alignTop="@id/imgDifficulty"
+  	android:layout_alignBottom="@id/imgDifficulty"
+  	android:gravity="center"
+  	android:textColor="#FFF"/>
+</RelativeLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_selection_entry_simple.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  android:background="#8FFF"
+  android:padding="3dip">
+  
+  <ImageView
+  	android:id="@+id/imgDifficulty"
+  	android:layout_height="fill_parent"
+  	android:layout_width="wrap_content"
+  	android:adjustViewBounds="true"
+  	android:scaleType="centerInside"/>
+ 
+  <TextView
+  	android:id="@+id/txtName"
+  	android:layout_height="fill_parent"
+  	android:layout_width="wrap_content"
+  	android:layout_toRightOf="@id/imgDifficulty"
+  	android:layout_toLeftOf="@id/teamCount"
+  	android:layout_alignTop="@id/imgDifficulty"
+  	android:layout_alignBottom="@id/imgDifficulty"
+  	android:gravity="center"
+  	android:textColor="#FFF"/>
+</RelativeLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/layout/team_selector.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent">
+  
+  <include layout="@layout/background"/>
+ 
+  <include layout="@layout/backbutton"/>
+
+  <ImageButton
+   	android:id="@+id/btnAdd"
+   	android:layout_width="wrap_content"
+   	android:layout_height="50dip"
+   	android:layout_alignParentBottom="true"
+   	android:layout_alignParentRight="true"
+   	android:adjustViewBounds="true"
+   	android:scaleType="centerInside"
+   	android:background="@android:color/transparent"
+   	android:src="@drawable/settings"/>
+ <TextView
+  	android:id="@+id/txtInfo"
+  	android:layout_height="wrap_content"
+  	android:layout_width="fill_parent"
+  	android:layout_alignParentBottom="true"
+  	android:layout_toRightOf="@id/btnBack"
+  	android:layout_toLeftOf="@id/btnAdd"
+  	android:layout_alignTop="@id/btnBack"
+  	android:layout_margin="3dp"
+  	android:gravity="center"
+  	android:background="@drawable/box"/>
+  	
+  
+
+  <LinearLayout
+  	android:orientation="horizontal"
+  	android:layout_width="fill_parent"
+  	android:layout_height="fill_parent"
+  	android:layout_above="@id/txtInfo"
+  	android:layout_margin="3dp">
+  	
+	  <ListView
+	  	android:id="@+id/selectedTeams"
+	  	android:layout_height="fill_parent"
+	  	android:layout_width="wrap_content"
+	  	android:layout_margin="3dp"
+	  	android:background="@drawable/box"
+	  	android:layout_weight="1"/>
+	  	
+	  <ListView
+	  	android:id="@+id/availableTeams"
+	  	android:layout_height="fill_parent"
+	  	android:layout_width="wrap_content"
+	  	android:layout_margin="3dp"
+	  	android:background="@drawable/box"
+	  	android:layout_weight="1"/>
+  </LinearLayout>
+</RelativeLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/basicflags.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,384 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<basicflags>
+    <tflag>
+        <default>
+            <integer>100</integer>
+        </default>
+        <image>
+            <string>Health</string>
+        </image>
+        <max>
+            <integer>200</integer>
+        </max>
+        <min>
+            <integer>50</integer>
+        </min>
+        <title>
+            <string>Initial Health</string>
+        </title>
+    </tflag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$damagepct</string>
+        </command>
+        <default>
+            <integer>100</integer>
+        </default>
+        <image>
+            <string>Damage</string>
+        </image>
+        <max>
+            <integer>300</integer>
+        </max>
+        <min>
+            <integer>10</integer>
+        </min>
+        <title>
+            <string>Damage Modifier</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>true</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>true</boolean>
+        </times1000>
+        <command>
+            <string>e$turntime</string>
+        </command>
+        <default>
+            <integer>45</integer>
+        </default>
+        <image>
+            <string>Time</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>1</integer>
+        </min>
+        <title>
+            <string>Turn Time</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>true</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$sd_turns</string>
+        </command>
+        <default>
+            <integer>15</integer>
+        </default>
+        <image>
+            <string>SuddenDeath</string>
+        </image>
+        <max>
+            <integer>50</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Sudden Death Timeout</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$waterrise</string>
+        </command>
+        <default>
+            <integer>47</integer>
+        </default>
+        <image>
+            <string>SuddenDeath</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Water Rise Amount</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$healthdec</string>
+        </command>
+        <default>
+            <integer>5</integer>
+        </default>
+        <image>
+            <string>SuddenDeath</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Health Decrease</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$ropepct</string>
+        </command>
+        <default>
+            <integer>100</integer>
+        </default>
+        <image>
+            <string>Rope</string>
+        </image>
+        <max>
+            <integer>999</integer>
+        </max>
+        <min>
+            <integer>25</integer>
+        </min>
+        <title>
+            <string>Rope Length (%)</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$casefreq</string>
+        </command>
+        <default>
+            <integer>5</integer>
+        </default>
+        <image>
+            <string>Box</string>
+        </image>
+        <max>
+            <integer>9</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Crate Drop Turns</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$healthprob</string>
+        </command>
+        <default>
+            <integer>35</integer>
+        </default>
+        <image>
+            <string>Health</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Health Kit Probability (%)</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$hcaseamount</string>
+        </command>
+        <default>
+            <integer>25</integer>
+        </default>
+        <image>
+            <string>Health</string>
+        </image>
+        <max>
+            <integer>200</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Health Amount in Kit</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>true</boolean>
+        </times1000>
+        <command>
+            <string>e$minestime</string>
+        </command>
+        <default>
+            <integer>3</integer>
+        </default>
+        <image>
+            <string>Time</string>
+        </image>
+        <max>
+            <integer>5</integer>
+        </max>
+        <min>
+            <integer>-1</integer>
+        </min>
+        <title>
+            <string>Mines Time</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$minesnum</string>
+        </command>
+        <default>
+            <integer>4</integer>
+        </default>
+        <image>
+            <string>Mine</string>
+        </image>
+        <max>
+            <integer>80</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Mines Number</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$minedudpct</string>
+        </command>
+        <default>
+            <integer>0</integer>
+        </default>
+        <image>
+            <string>Dud</string>
+        </image>
+        <max>
+            <integer>100</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Dud Mines Probability (%)</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$explosives</string>
+        </command>
+        <default>
+            <integer>2</integer>
+        </default>
+        <image>
+            <string>Damage</string>
+        </image>
+        <max>
+            <integer>40</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Explosives</string>
+        </title>
+    </flag>
+    <flag>
+        <checkOverMax>
+            <boolean>false</boolean>
+        </checkOverMax>
+        <times1000>
+            <boolean>false</boolean>
+        </times1000>
+        <command>
+            <string>e$getawaytime</string>
+        </command>
+        <default>
+            <integer>100</integer>
+        </default>
+        <image>
+            <string>Time</string>
+        </image>
+        <max>
+            <integer>999</integer>
+        </max>
+        <min>
+            <integer>0</integer>
+        </min>
+        <title>
+            <string>Get Away Time (%)</string>
+        </title>
+    </flag>
+</basicflags>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_barrelmayhem.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Barrel Mayhem</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>30</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>0</integer>
+		<integer>35</integer>
+		<integer>25</integer>
+		<integer>0</integer>
+		<integer>0</integer>
+		<integer>0</integer>
+		<integer>40</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_cleanslate.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Clean Slate</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>45</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>5</integer>
+		<integer>35</integer>
+		<integer>25</integer>
+		<integer>3</integer>
+		<integer>4</integer>
+		<integer>0</integer>
+		<integer>2</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_default_scheme.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Default</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>45</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>5</integer>
+		<integer>35</integer>
+		<integer>25</integer>
+		<integer>3</integer>
+		<integer>4</integer>
+		<integer>0</integer>
+		<integer>2</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_fortmode.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Fort Mode</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>45</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>5</integer>
+		<integer>35</integer>
+		<integer>25</integer>
+		<integer>3</integer>
+		<integer>0</integer>
+		<integer>0</integer>
+		<integer>0</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_kingmode.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>King Mode</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>45</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>5</integer>
+		<integer>35</integer>
+		<integer>25</integer>
+		<integer>3</integer>
+		<integer>4</integer>
+		<integer>0</integer>
+		<integer>2</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_minefield.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Minefield</name>
+	<basicflags>
+		<integer>50</integer>
+		<integer>150</integer>
+		<integer>30</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>0</integer>
+		<integer>35</integer>
+		<integer>25</integer>
+		<integer>0</integer>
+		<integer>80</integer>
+		<integer>0</integer>
+		<integer>0</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_promode.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Pro Mode</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>15</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>0</integer>
+		<integer>35</integer>
+		<integer>25</integer>
+		<integer>3</integer>
+		<integer>0</integer>
+		<integer>0</integer>
+		<integer>2</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_shoppa.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Shoppa</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>300</integer>
+		<integer>50</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>1</integer>
+		<integer>0</integer>
+		<integer>35</integer>
+		<integer>3</integer>
+		<integer>0</integer>
+		<integer>0</integer>
+		<integer>0</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_thinkingwithportals.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Thinking with Portals</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>45</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>2</integer>
+		<integer>25</integer>
+		<integer>25</integer>
+		<integer>4</integer>
+		<integer>5</integer>
+		<integer>0</integer>
+		<integer>5</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_timeless.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Timeless</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>5</integer>
+		<integer>35</integer>
+		<integer>30</integer>
+		<integer>5</integer>
+		<integer>3</integer>
+		<integer>10</integer>
+		<integer>2</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/scheme_tunnelhogs.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scheme>
+	<name>Tunnelhogs</name>
+	<basicflags>
+		<integer>100</integer>
+		<integer>100</integer>
+		<integer>30</integer>
+		<integer>15</integer>
+		<integer>47</integer>
+		<integer>5</integer>
+		<integer>100</integer>
+		<integer>5</integer>
+		<integer>35</integer>
+		<integer>3</integer>
+		<integer>25</integer>
+		<integer>10</integer>
+		<integer>10</integer>
+		<integer>10</integer>
+	</basicflags>
+	<gamemod>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<true/>
+		<false/>
+		<false/>
+		<true/>
+		<true/>
+		<true/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+		<false/>
+	</gamemod>
+</scheme>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/team_one.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,49 @@
+<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
+<team>
+  <name>Team 1</name>
+  <flag>hedgewars</flag>
+  <fort>Lego</fort>
+  <grave>Bone</grave>
+  <voice>Classic</voice>
+  <hash>0</hash>
+  <hog>
+    <name>Leonidas</name>
+    <hat>NoHat</hat>
+    <level>0</level>
+  </hog>
+  <hog>
+    <name>Pipo</name>
+    <hat>NoHat</hat>
+    <level>0</level>
+  </hog>
+  <hog>
+    <name>Sonic</name>
+    <hat>NoHat</hat>
+    <level>0</level>
+  </hog>
+  <hog>
+    <name>Xin</name>
+    <hat>NoHat</hat>
+    <level>0</level>
+  </hog>
+  <hog>
+    <name>Arnold</name>
+    <hat>NoHat</hat>
+    <level>0</level>
+  </hog>
+  <hog>
+    <name>Jack</name>
+    <hat>NoHat</hat>
+    <level>0</level>
+  </hog>
+  <hog>
+    <name>Tom</name>
+    <hat>NoHat</hat>
+    <level>0</level>
+  </hog>
+  <hog>
+    <name>Goldie</name>
+    <hat>NoHat</hat>
+    <level>0</level>
+  </hog>
+</team>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/team_two.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,49 @@
+<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
+<team>
+  <name>Team 2</name>
+  <flag>cm_binary</flag>
+  <fort>Lego</fort>
+  <grave>Bone</grave>
+  <voice>Classic</voice>
+  <hash>0</hash>
+  <hog>
+    <name>Paris</name>
+    <hat>NoHat</hat>
+    <level>2</level>
+  </hog>
+  <hog>
+    <name>Knut</name>
+    <hat>NoHat</hat>
+    <level>2</level>
+  </hog>
+  <hog>
+    <name>Ash</name>
+    <hat>NoHat</hat>
+    <level>2</level>
+  </hog>
+  <hog>
+    <name>Woad</name>
+    <hat>NoHat</hat>
+    <level>2</level>
+  </hog>
+  <hog>
+    <name>Bob</name>
+    <hat>NoHat</hat>
+    <level>2</level>
+  </hog>
+  <hog>
+    <name>Corky</name>
+    <hat>NoHat</hat>
+    <level>2</level>
+  </hog>
+  <hog>
+    <name>Bea</name>
+    <hat>NoHat</hat>
+    <level>2</level>
+  </hog>
+  <hog>
+    <name>Silvia</name>
+    <hat>NoHat</hat>
+    <level>2</level>
+  </hog>
+</team>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/weapon_clean	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<weapon>
+    <name>Clean</name>
+    <QT>
+    101000900001000001100000000000000000000000000000100000
+    </QT>
+    <probability>
+    040504054160065554655446477657666666615551010111541111
+    </probability>
+    <delay>
+    000000000000000000000000000000000000000000000000000000
+    </delay>
+    <crate>
+    131111031211111112311411111111111111121111110111111111
+    </crate>
+</weapon>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/weapon_crazy	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<weapon>
+    <name>Crazy</name>
+    <QT>
+    999999999999999999299999999999999929999999990999999229
+    </QT>
+    <probability>
+    111111011111111111111111111111111111111111110111111111
+    </probability>
+    <delay>
+    000000000000000000000000000000000000000000000000000000
+    </delay>
+    <crate>
+    131111031211111112311411111111111111121111010111111111
+    </crate>
+</weapon>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/weapon_default	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<weapon>
+    <name>Default</name>
+    <QT>
+    939192942219912103223511100120100000021111010101111991
+    </QT>
+    <probability>
+    040504054160065554655446477657666666615551010111541111
+    </probability>
+    <delay>
+    000000000000020550000004000700400000000022000000060000
+    </delay>
+    <crate>
+    131111031211111112311411111111111111121111110111111111
+    </crate>
+</weapon>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/weapon_mines	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<weapon>
+    <name>Mines</name>
+    <QT>
+    000000990009000000030000000000000000000000000000000000
+    </QT>
+    <probability>
+    000000000000000000000000000000000000000000000000000000
+    </probability>
+    <delay>
+    000000000000020550000004000700400000000020000000060000
+    </delay>
+    <crate>
+    111111111111111111111111111111111111111111110111111111
+    </crate>
+</weapon>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/weapon_portals	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<weapon>
+    <name>Portals</name>
+    <QT>
+    900000900200000000210000000000000011000009000000000000
+    </QT>
+    <probability>
+    040504054160065554655446477657666666615551010111541111
+    </probability>
+    <delay>
+    000000000000020550000004000700400000000020000000060000
+    </delay>
+    <crate>
+    131111031211111112311411111111111111121111110111111111
+    </crate>
+</weapon>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/weapon_promode	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<weapon>
+    <name>Pro Mode</name>
+    <QT>
+    909000900000000000000900000000000000000000000000000000
+    </QT>
+    <probability>
+    000000000000000000000000000000000000000000000000000000
+    </probability>
+    <delay>
+    000000000000020550000004000700400000000020000000000000
+    </delay>
+    <crate>
+    111111111111111111111111111111111111111110010111111111
+    </crate>
+</weapon>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/raw/weapon_shoppa	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<weapon>
+    <name>Shoppa</name>
+    <QT>
+    000000990000000000000000000000000000000000000000000000
+    </QT>
+    <probability>
+    444441004424440221011212122242200000000200040001001111
+    </probability>
+    <delay>
+    000000000000000000000000000000000000000000000000000000
+    </delay>
+    <crate>
+    111111111111111111111111111111111111111110110111111111
+    </crate>
+</weapon>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/values/frontend_data_pointers.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+<array name="schemes">
+	<item>@raw/basicflags</item>
+	<item>@raw/scheme_default_scheme</item>
+	<item>@raw/scheme_barrelmayhem</item>
+	<item>@raw/scheme_cleanslate</item>
+	<item>@raw/scheme_fortmode</item>
+	<item>@raw/scheme_kingmode</item>
+	<item>@raw/scheme_minefield</item>
+	<item>@raw/scheme_promode</item>
+	<item>@raw/scheme_shoppa</item>
+	<item>@raw/scheme_thinkingwithportals</item>
+	<item>@raw/scheme_timeless</item>
+	<item>@raw/scheme_tunnelhogs</item>
+</array>
+
+<array name="weapons">
+    <item>@raw/weapon_default</item>
+    <item>@raw/weapon_clean</item>
+    <item>@raw/weapon_crazy</item>
+    <item>@raw/weapon_mines</item>
+    <item>@raw/weapon_portals</item>
+    <item>@raw/weapon_promode</item>
+    <item>@raw/weapon_shoppa</item>
+</array>
+
+<array name="teams">
+	<item>@raw/team_one</item>
+	<item>@raw/team_two</item>
+
+</array>
+</resources>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/res/values/strings.xml	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Hedgewars</string>
+    
+    <string name="select">Select</string>
+    <string name="edit">Edit</string>
+    <string name="delete">Delete</string>
+    <string name="saved">Saved succesfully</string>
+    
+    <!-- SDCARD -->
+    <string name="sdcard_not_mounted_title">Sorry! Could not find the SDCard</string>
+    <string name="sdcard_not_mounted">There\'s been an error when accessing the SDcard. Please check if there is an SDcard present in the device (internal or external) and if the SDcard is not mounted (via usb to your computer for example). Hedgewars for Android will now quit</string>
+        
+    <!-- Notification -->
+    <string name="notification_title">Downloading hedgewars files...</string>
+    <string name="notification_done">Successfully downloaded: </string>
+    
+    <!-- Download Activity -->
+    <string name="download_background">Continue in background</string>
+    <string name="download_cancel">Cancel</string>
+    <string name="download_done">Done</string>
+    <string name="download_back">Back to main menu</string>
+    <string name="download_tryagain">Try again</string>
+    <string name="download_failed">The download has failed, check the internet connectivity and please try again</string>
+    <string name="download_userexplain">Before starting the game we must download some extra files...</string>
+    
+    <string name="download_areyousure">Are you sure you want to download this package?</string>
+    <string name="download_alreadydownloaded">You\'ve already downloaded this package, are you sure you want to download it again?</string>
+    <string name="download_downloadnow">Download now!</string>
+    
+    <string name="download_queued">This download has been queued</string>
+    
+    <!-- start game -->
+    
+    <string name="start_gameplay">Style</string>
+    <string name="start_gamescheme">Game scheme</string>
+    <string name="start_weapons">Weapons</string>
+    <string name="start_map">Map</string>
+    <string name="start_filter">Filter</string>
+    <string name="start_themes">Themes</string>
+    
+    
+    
+    <!-- Teams -->
+    <string name="not_enough_teams">Not enough teams</string>
+    <string name="teams_info_template">Selected teams = %d</string>
+    <!-- Settings -->
+    <string name="name">Name</string>
+    <string name="name_default">Unnamed</string>
+    <string name="type">Type</string>
+    <string name="grave">Grave</string>
+    <string name="flag">Flag</string>
+    <string name="voice">Voice</string>
+    <string name="fort">Fort</string>
+    
+    <!-- Difficulty levels -->
+    <string name="human">Human</string>
+    <string name="bot5">Level 5</string>
+    <string name="bot4">Level 4</string>
+    <string name="bot3">Level 3</string>
+    <string name="bot2">Level 2</string>
+    <string name="bot1">Level 1</string>
+    
+</resources>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/FrontendDataUtils.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,216 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid.Datastructures;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.hedgewars.hedgeroid.R;
+import org.hedgewars.hedgeroid.Utils;
+import org.hedgewars.hedgeroid.Datastructures.Map.MapType;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+public class FrontendDataUtils {
+
+
+	public static ArrayList<Map> getMaps(Context c){
+		File[] files = Utils.getFilesFromRelativeDir(c,"Maps");
+		ArrayList<Map> ret = new ArrayList<Map>();
+
+		for(File f : files){
+			if(Utils.hasFileWithSuffix(f, ".lua")){
+				ret.add(new Map(f,MapType.TYPE_MISSION, c));
+			}else{
+				ret.add(new Map(f, MapType.TYPE_DEFAULT,c));
+			}
+		}
+		Collections.sort(ret);
+
+		return ret;
+	}
+
+	public static List<String> getGameplay(Context c){
+		String[] files = Utils.getFileNamesFromRelativeDir(c, "Scripts/Multiplayer");
+		ArrayList<String> ret = new ArrayList<String>();
+		
+		for(int i = 0; i < files.length; i++){
+			if(files[i].endsWith(".lua")){
+				ret.add(files[i].replace('_', ' ').substring(0, files[i].length()-4)); //replace _ by a space and removed the last four characters (.lua)
+			}
+		}
+		ret.add(0,"None");
+		Collections.sort(ret);
+		return ret;	
+	}
+
+	public static List<String> getThemes(Context c){
+		List<String> list = Utils.getDirsWithFileSuffix(c, "Themes", "icon.png");
+		Collections.sort(list);
+		return list;
+	}
+
+	public static List<Scheme> getSchemes(Context c){
+		List<Scheme> list = Scheme.getSchemes(c);
+		Collections.sort(list);
+		return list;
+	}
+
+	public static List<Weapon> getWeapons(Context c){
+		List<Weapon> list = Weapon.getWeapons(c);
+		Collections.sort(list);
+		return list;
+	}
+
+	public static ArrayList<HashMap<String, ?>> getGraves(Context c){
+		String pathPrefix = Utils.getDataPath(c) + "Graphics/Graves/";
+		ArrayList<String> names = Utils.getFilesFromDirWithSuffix(c,"Graphics/Graves", ".png", true);
+		ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>(names.size());
+
+		for(String s : names){
+			HashMap<String, Object> map = new HashMap<String, Object>();
+			map.put("txt", s);
+			Bitmap b = BitmapFactory.decodeFile(pathPrefix + s + ".png");//create a full path - decode to to a bitmap
+			int width = b.getWidth();
+			if(b.getHeight() > width){//some pictures contain more 'frames' underneath each other, if so we only use the first frame
+				Bitmap tmp = Bitmap.createBitmap(b, 0, 0, width, width);
+				b.recycle();
+				b = tmp;
+			}
+			map.put("img", b);
+			data.add(map);
+		}
+		return data;
+	}
+
+	public static ArrayList<HashMap<String, ?>> getFlags(Context c){
+		String pathPrefix = Utils.getDataPath(c) + "Graphics/Flags/";
+		ArrayList<String> names = Utils.getFilesFromDirWithSuffix(c, "Graphics/Flags", ".png", true);
+		ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>(names.size());
+
+		for(String s : names){
+			HashMap<String, Object> map = new HashMap<String, Object>();
+			map.put("txt", s);
+			Bitmap b = BitmapFactory.decodeFile(pathPrefix + s + ".png");//create a full path - decode to to a bitmap
+			map.put("img", b);
+			data.add(map);
+		}
+		return data;
+	}
+
+	public static ArrayList<String> getVoices(Context c){
+		File[] files = Utils.getFilesFromRelativeDir(c, "Sounds/voices");
+		ArrayList<String> ret = new ArrayList<String>();
+
+		for(File f : files){
+			if(f.isDirectory()) ret.add(f.getName());
+		}
+		return ret;
+	}
+
+	public static ArrayList<String> getForts(Context c){
+		return Utils.getFilesFromDirWithSuffix(c,"Forts", "L.png", true);
+	}
+	public static ArrayList<HashMap<String, ?>> getTypes(Context c){
+		ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>(6);
+		String[] levels = {c.getString(R.string.human), c.getString(R.string.bot5), c.getString(R.string.bot4), c.getString(R.string.bot3), c.getString(R.string.bot2), c.getString(R.string.bot1)};
+		int[] images = {R.drawable.human, R.drawable.bot5, R.drawable.bot4, R.drawable.bot3, R.drawable.bot2, R.drawable.bot1};
+
+		for(int i = 0; i < levels.length; i++){
+			HashMap<String, Object> map = new HashMap<String, Object>();
+			map.put("txt", levels[i]);
+			map.put("img", images[i]);
+			data.add(map);
+		}
+
+		return data;
+	}
+
+	public static ArrayList<HashMap<String, ?>> getHats(Context c){
+		ArrayList<String> files = Utils.getFilesFromDirWithSuffix(c,"Graphics/Hats", ".png", true);
+		String pathPrefix = Utils.getDataPath(c) + "Graphics/Hats/";
+		int size = files.size();
+		ArrayList<HashMap<String, ?>> data = new ArrayList<HashMap<String, ?>>(size);
+
+		HashMap<String, Object> hashmap; 
+		for(String s : files){
+			hashmap = new HashMap<String, Object>();
+			hashmap.put("txt", s);
+			Bitmap b = BitmapFactory.decodeFile(pathPrefix + s + ".png");//create a full path - decode to to a bitmap
+			b = Bitmap.createBitmap(b, 0,0,b.getWidth()/2, b.getWidth()/2);
+			hashmap.put("img", b);
+			data.add(hashmap);
+		}
+
+		return data;
+	}
+
+	public static List<HashMap<String, Object>> getTeams(Context c){
+		List<HashMap<String, Object>> ret = new ArrayList<HashMap<String, Object>>();
+
+		File teamsDir = new File(c.getFilesDir().getAbsolutePath() + '/' + Team.DIRECTORY_TEAMS);
+		File[] teamFileNames = teamsDir.listFiles();
+		if(teamFileNames != null){
+			for(File s : teamFileNames){
+				Team t = Team.getTeamFromXml(s.getAbsolutePath());
+				if(t != null){
+					t.file = s.getName();
+					ret.add(teamToMap(t));
+				}
+			}
+		}
+		return ret;
+	}
+
+	public static HashMap<String, Object> teamToMap(Team t){
+		HashMap<String, Object> hashmap = new HashMap<String, Object>();
+		hashmap.put("team", t);
+		hashmap.put("txt", t.name);
+		hashmap.put("color", t.color);
+		hashmap.put("count", t.hogCount);
+		switch(t.levels[0]){
+		case 0:
+			hashmap.put("img", R.drawable.human);
+			break;
+		case 1:
+			hashmap.put("img", R.drawable.bot5);
+			break;
+		case 2:
+			hashmap.put("img", R.drawable.bot4);
+			break;
+		case 3:
+			hashmap.put("img", R.drawable.bot3);
+			break;
+		case 4:
+			hashmap.put("img", R.drawable.bot2);
+			break;
+		default:
+		case 5:
+			hashmap.put("img", R.drawable.bot1);
+			break;
+		}
+		return hashmap;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/GameMode.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,24 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid.Datastructures;
+
+public enum GameMode {
+		MODE_LOCAL, MODE_DEMO, MODE_NET, MODE_SAVE
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Grave.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,36 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid.Datastructures;
+
+public class Grave{
+
+	public final String name;
+	public final String path;
+	
+	public Grave(String _name, String _path) {
+		name = _name;
+		path = _path;
+	}
+
+	public String toString(){
+		return name;
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Map.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,163 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid.Datastructures;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.hedgewars.hedgeroid.EngineProtocol.EngineProtocolNetwork;
+
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class Map implements Comparable<Map>, Parcelable{
+
+	private static final String MISSION_PREFIX = "Mission: ";
+
+	private String name;
+	private String path;
+	private String previewPath;
+	private MapType type;
+
+	public Map(File mapDir, MapType _type, Context c){
+		type = _type;
+
+		name = mapDir.getName();
+		path = mapDir.getAbsolutePath();
+		previewPath = path + "/preview.png";
+		
+		/*switch(type){
+		case TYPE_DEFAULT:
+			
+			break;
+		case TYPE_GENERATED:
+			//TODO
+			break;
+		case TYPE_MISSION:
+			name = MISSION_PREFIX + mapDir.getName();
+			path = mapDir.getAbsolutePath();
+			break;
+		}*/
+
+		
+	}
+	
+	public Map(Parcel in){
+		readFromParcel(in);
+	}
+
+	public String toString(){
+		switch(type){
+		default:
+		case TYPE_DEFAULT:
+			return name;
+		case TYPE_GENERATED:
+			return "bla";
+		case TYPE_MISSION:
+			return MISSION_PREFIX + name;
+		}
+	}
+	
+	public void sendToEngine(EngineProtocolNetwork epn) throws IOException{
+		epn.sendToEngine(String.format("emap %s",name));
+	}
+	
+	public MapType getType(){
+		return type;
+	}
+
+	public Drawable getDrawable(){
+		switch(type){
+		case TYPE_MISSION:
+		case TYPE_DEFAULT:
+			return Drawable.createFromPath(previewPath);
+		case TYPE_GENERATED:
+
+		default:
+			return null;
+		}
+	}
+
+	public int compareTo(Map another) {
+		switch(type){
+		case TYPE_GENERATED:
+			switch(another.getType()){
+			case TYPE_GENERATED:
+				return name.compareTo(another.name);
+			case TYPE_MISSION:
+				return -1;
+			case TYPE_DEFAULT:
+				return -1;
+			}
+		case TYPE_MISSION:
+			switch(another.getType()){
+			case TYPE_GENERATED:
+				return 1;
+			case TYPE_MISSION:
+				return name.compareTo(another.name);
+			case TYPE_DEFAULT:
+				return -1;
+			}
+		case TYPE_DEFAULT:
+			switch(another.getType()){
+			case TYPE_GENERATED:
+				return 1;
+			case TYPE_MISSION:
+				return 1;
+			case TYPE_DEFAULT:
+				return name.compareTo(another.name);
+			}
+		}
+		return 0;//default case this should never happen
+	}
+
+	public enum MapType{
+		TYPE_DEFAULT, TYPE_MISSION, TYPE_GENERATED
+	}
+
+	public int describeContents() {
+		return 0;
+	}
+	
+	public void writeToParcel(Parcel dest, int flags) {
+		dest.writeString(name);
+		dest.writeString(path);
+		dest.writeString(previewPath);
+		dest.writeString(type.name());
+	}
+	
+	private void readFromParcel(Parcel src){
+		name = src.readString();
+		path = src.readString();
+		previewPath = src.readString();
+		type = MapType.valueOf(src.readString());
+	}
+	public static final Parcelable.Creator<Map> CREATOR = new Parcelable.Creator<Map>() {
+		public Map createFromParcel(Parcel source) {
+			return new Map(source);
+		}
+		public Map[] newArray(int size) {
+			return new Map[size];
+		}
+		
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Scheme.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,360 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid.Datastructures;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+
+import org.hedgewars.hedgeroid.EngineProtocol.EngineProtocolNetwork;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+import android.content.Context;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class Scheme implements Parcelable, Comparable<Scheme>{
+
+	public static final String DIRECTORY_SCHEME = "schemes";
+
+	private String name;
+	//private ArrayList<Integer> basic;
+	private Integer gamemod;
+	private ArrayList<Integer> basic;;
+	private static ArrayList<LinkedHashMap<String, ?>> basicflags = new ArrayList<LinkedHashMap<String, ?>>();//TODO why is it static?
+	
+	public Scheme(String _name, ArrayList<Integer> _basic, int _gamemod){
+		name = _name;
+		gamemod = _gamemod;
+		basic = _basic;
+	}
+	
+	public Scheme(Parcel in){
+		readFromParcel(in);
+	}
+
+	public void sendToEngine(EngineProtocolNetwork epn)throws IOException{ 
+		epn.sendToEngine(String.format("e$gmflags %d", gamemod));
+
+		for(int pos = 0; pos < basic.size(); pos++){
+			LinkedHashMap<String, ?> basicflag = basicflags.get(pos);
+			
+			String command = (String)basicflag.get("command");
+			Integer value = basic.get(pos);
+			Boolean checkOverMax = (Boolean) basicflag.get("checkOverMax");
+			Boolean times1000 = (Boolean) basicflag.get("times1000");
+			Integer max = (Integer) basicflag.get("max");
+			
+			if(checkOverMax && value >= max) value = max;
+			if(times1000) value *= 1000;
+			
+			epn.sendToEngine(String.format("%s %d", command, value));
+		}
+	}
+	public String toString(){
+		return name;
+	}
+
+
+	public static final int STATE_START = 0;
+	public static final int STATE_ROOT = 1;
+	public static final int STATE_NAME = 2;
+	public static final int STATE_BASICFLAGS = 3;
+	public static final int STATE_GAMEMOD = 4;
+	public static final int STATE_BASICFLAG_INTEGER = 5;
+	public static final int STATE_GAMEMOD_TRUE = 6;
+	public static final int STATE_GAMEMOD_FALSE = 7;
+
+	public static ArrayList<Scheme> getSchemes(Context c) throws IllegalArgumentException{
+		String dir = c.getFilesDir().getAbsolutePath() + '/' + DIRECTORY_SCHEME + '/';
+		String[] files = new File(dir).list(fnf);
+		if(files == null) files = new String[]{};
+		Arrays.sort(files);
+		ArrayList<Scheme> schemes = new ArrayList<Scheme>();
+
+		try {
+			XmlPullParserFactory xmlPullFactory = XmlPullParserFactory.newInstance();
+			XmlPullParser xmlPuller = xmlPullFactory.newPullParser();
+
+			for(String file : files){
+				BufferedReader br = new BufferedReader(new FileReader(dir + file), 1024);
+				xmlPuller.setInput(br);
+				String name = null;
+				ArrayList<Integer> basic = new ArrayList<Integer>();
+				Integer gamemod = 0;
+				int mask = 0x000000004;
+
+				int eventType = xmlPuller.getEventType();
+				int state = STATE_START;
+				while(eventType != XmlPullParser.END_DOCUMENT){
+					switch(state){
+					case STATE_START:
+						if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().equals("scheme")) state = STATE_ROOT;
+						else if(eventType != XmlPullParser.START_DOCUMENT) throwException(file, eventType);
+						break;
+					case STATE_ROOT:
+						if(eventType == XmlPullParser.START_TAG){
+							if(xmlPuller.getName().equals("basicflags")) state = STATE_BASICFLAGS;
+							else if(xmlPuller.getName().toLowerCase().equals("gamemod")) state = STATE_GAMEMOD;
+							else if(xmlPuller.getName().toLowerCase().equals("name")) state = STATE_NAME;
+							else throwException(file, eventType);
+						}else if(eventType == XmlPullParser.END_TAG) state = STATE_START;
+						else throwException(xmlPuller.getText(), eventType);
+						break;
+					case STATE_BASICFLAGS:
+						if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().toLowerCase().equals("integer")) state = STATE_BASICFLAG_INTEGER;
+						else if(eventType == XmlPullParser.END_TAG)	state = STATE_ROOT;
+						else throwException(file, eventType);
+						break;
+					case STATE_GAMEMOD:
+						if(eventType == XmlPullParser.START_TAG){
+							if(xmlPuller.getName().toLowerCase().equals("true")) state = STATE_GAMEMOD_TRUE;
+							else if(xmlPuller.getName().toLowerCase().equals("false")) state = STATE_GAMEMOD_FALSE;
+							else throwException(file, eventType);
+						}else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
+						else throwException(file, eventType);
+						break;
+					case STATE_NAME:
+						if(eventType == XmlPullParser.TEXT) name = xmlPuller.getText().trim();
+						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
+						else throwException(file, eventType);
+						break;
+					case STATE_BASICFLAG_INTEGER:
+						if(eventType == XmlPullParser.TEXT) basic.add(Integer.parseInt(xmlPuller.getText().trim()));
+						else if(eventType == XmlPullParser.END_TAG) state = STATE_BASICFLAGS;
+						else throwException(file, eventType);
+						break;
+					case STATE_GAMEMOD_FALSE:
+						if(eventType == XmlPullParser.TEXT) gamemod <<= 1;
+						else if(eventType == XmlPullParser.END_TAG) state = STATE_GAMEMOD;
+						else throwException(file, eventType);
+						break;
+					case STATE_GAMEMOD_TRUE:
+						if(eventType == XmlPullParser.TEXT){
+							gamemod |= mask;
+							gamemod <<= 1;
+						}else if(eventType == XmlPullParser.END_TAG) state = STATE_GAMEMOD;
+						else throwException(file, eventType);
+						break;
+					}
+					eventType = getEventType(xmlPuller);
+				}//end while(eventtype != END_DOCUMENT
+				schemes.add(new Scheme(name, basic, gamemod));
+			}//end for(string file : files
+			return schemes;
+		} catch (XmlPullParserException e) {
+			e.printStackTrace();
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return new ArrayList<Scheme>();//TODO handle correctly
+	}
+	
+	private static FilenameFilter fnf = new FilenameFilter(){
+		public boolean accept(File dir, String filename) {
+			return filename.toLowerCase().startsWith("scheme_");
+		}
+	};
+
+	/**
+	 * This method will parse the basic flags from a prespecified xml file.
+	 * I use a raw xml file rather than one parsed by aatp at compile time
+	 * to keep it generic with other frontends, ie in the future we could 
+	 * use one provided by the Data folder.
+	 */
+	public static void parseBasicFlags(Context c){
+		String filename = String.format("%s/%s/basicflags", c.getFilesDir().getAbsolutePath(), DIRECTORY_SCHEME);
+
+		XmlPullParser xmlPuller = null;
+		BufferedReader br = null;
+		try {
+			XmlPullParserFactory xmlPullFactory = XmlPullParserFactory.newInstance();
+			xmlPuller = xmlPullFactory.newPullParser();
+			br = new BufferedReader(new FileReader(filename), 1024);
+			xmlPuller.setInput(br);
+
+			int eventType = getEventType(xmlPuller);
+			boolean continueParsing = true;
+			do{
+				switch(eventType){
+				
+				case XmlPullParser.START_TAG:
+					if(xmlPuller.getName().toLowerCase().equals("flag")){
+						basicflags.add(parseFlag(xmlPuller));
+					}else if(xmlPuller.getName().toLowerCase().equals("basicflags")){
+						eventType = getEventType(xmlPuller);
+					}else{
+						skipCurrentTag(xmlPuller);
+						eventType = getEventType(xmlPuller);
+					}
+					break;
+				case XmlPullParser.START_DOCUMENT://ignore all tags not being "flag"
+				case XmlPullParser.END_TAG:
+				case XmlPullParser.TEXT:
+				default:
+					continueParsing = true;
+				case XmlPullParser.END_DOCUMENT:
+					continueParsing = false;
+				}
+			}while(continueParsing);
+
+		}catch(IOException e){
+			e.printStackTrace();
+		}catch (XmlPullParserException e) {
+			e.printStackTrace();
+		}finally{
+			if(br != null)
+				try {
+					br.close();
+				} catch (IOException e) {}
+		}
+
+	}
+
+	/*
+	 * * Parses a Tag structure from xml as example we use
+	 *<flag>
+	 *   <checkOverMax>
+	 *       <boolean>false</boolean>
+	 *   </checkOverMax>
+	 *</flag>
+	 *
+	 * It returns a LinkedHashMap with key/value pairs
+	 */
+	private static LinkedHashMap<String, Object> parseFlag(XmlPullParser xmlPuller)throws XmlPullParserException, IOException{
+		LinkedHashMap<String, Object> hash = new LinkedHashMap<String, Object>();
+
+		int eventType = xmlPuller.getEventType();//Get the event type which triggered this method
+		if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().toLowerCase().equals("flag")){//valid start of flag tag
+			String lcKey = null;
+			String lcType = null;
+			String value = null;
+
+			eventType = getEventType(xmlPuller);//<checkOverMax>
+			while(eventType == XmlPullParser.START_TAG){
+				lcKey = xmlPuller.getName();//checkOverMax
+				if(getEventType(xmlPuller) == XmlPullParser.START_TAG){//<boolean>
+					lcType = xmlPuller.getName().toLowerCase();
+					if(getEventType(xmlPuller) == XmlPullParser.TEXT){
+						value = xmlPuller.getText();
+						if(getEventType(xmlPuller) == XmlPullParser.END_TAG && //</boolean> 
+								getEventType(xmlPuller) == XmlPullParser.END_TAG){//</checkOverMax>
+							if(lcType.equals("boolean")) hash.put(lcKey, new Boolean(value));
+							else if(lcType.equals("string"))hash.put(lcKey, value);							
+							else if(lcType.equals("integer")){
+								try{
+									hash.put(lcKey, new Integer(value));
+								}catch (NumberFormatException e){
+									throw new XmlPullParserException("Wrong integer value in xml file");
+								}
+							}else{
+								throwException("basicflags", eventType);
+							}
+						}//</boolean> / </checkOverMax>
+					}//if TEXT
+				}//if boolean
+				eventType = getEventType(xmlPuller);//start new loop
+			}
+			eventType = getEventType(xmlPuller);//</flag>
+		}
+
+		return hash;
+	}
+
+	private static void skipCurrentTag(XmlPullParser xmlPuller) throws XmlPullParserException, IOException{
+		int eventType = xmlPuller.getEventType();
+		if(eventType != XmlPullParser.START_TAG)return;
+		String tag = xmlPuller.getName().toLowerCase();
+
+		while(true){
+			eventType = getEventType(xmlPuller);//getNext()
+			switch(eventType){
+			case XmlPullParser.START_DOCUMENT://we're inside of a start tag so START_ or END_DOCUMENT is just wrong
+			case XmlPullParser.END_DOCUMENT:
+				throw new XmlPullParserException("invalid xml file");
+			case XmlPullParser.START_TAG://if we get a new tag recursively handle it
+				skipCurrentTag(xmlPuller);
+				break;
+			case XmlPullParser.TEXT:
+				break;
+			case XmlPullParser.END_TAG:
+				if(!xmlPuller.getName().toLowerCase().equals(tag)){//if the end tag doesn't match the start tag
+					throw new XmlPullParserException("invalid xml file");
+				}else{
+					return;//skip completed	
+				}
+
+			}
+		}
+	}
+
+	/**
+	 * Skips whitespaces..
+	 */
+	private static int getEventType(XmlPullParser xmlPuller)throws XmlPullParserException, IOException{
+		int eventType = xmlPuller.next();
+		while(eventType == XmlPullParser.TEXT && xmlPuller.isWhitespace()){
+			eventType = xmlPuller.next();
+		}
+		return eventType;
+	}
+	private static void throwException(String file, int eventType){
+		throw new IllegalArgumentException(String.format("Xml file: %s malformed with error: %d.", file, eventType));
+	}
+
+	public int describeContents() {
+		return 0;
+	}
+
+	public void writeToParcel(Parcel dest, int flags) {
+		dest.writeString(name);
+		dest.writeInt(gamemod);
+		dest.writeList(basic);
+	}
+	
+	public void readFromParcel(Parcel src){
+		name = src.readString();
+		gamemod = src.readInt();
+		basic = src.readArrayList(ArrayList.class.getClassLoader());
+	}
+
+	public static final Parcelable.Creator<Scheme> CREATOR = new Parcelable.Creator<Scheme>() {
+		public Scheme createFromParcel(Parcel source) {
+			return new Scheme(source);
+		}
+		public Scheme[] newArray(int size) {
+			return new Scheme[size];
+		}
+		
+	};
+
+	public int compareTo(Scheme another) {
+		return name.compareTo(another.name);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Team.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,368 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid.Datastructures;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+
+import org.hedgewars.hedgeroid.EngineProtocol.EngineProtocolNetwork;
+import org.hedgewars.hedgeroid.EngineProtocol.PascalExports;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+import org.xmlpull.v1.XmlSerializer;
+
+import android.content.Context;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Xml;
+
+public class Team implements Parcelable{
+
+	public static final String DIRECTORY_TEAMS = "teams";
+	private static final Integer[] TEAM_COLORS = {
+		0xd12b42, /* red    */ 
+		0x4980c1, /* blue   */ 
+		0x6ab530, /* green  */ 
+		0xbc64c4, /* purple */ 
+		0xe76d14, /* orange */ 
+		0x3fb6e6, /* cyan   */ 
+		0xe3e90c, /* yellow */ 
+		0x61d4ac, /* mint   */ 
+		0xf1c3e1, /* pink   */ 
+		/* add new colors here */
+	};
+
+//	private static final Integer[] TEAM_COLORS = {
+//		0xff0000, /* red    */ 
+//		0x00ff00, /* blue   */ 
+//		0x0000ff, /* green  */ 
+//	};
+
+	private static final int STATE_START = 0;
+	private static final int STATE_ROOT = 1;
+	private static final int STATE_HOG_ROOT = 2;
+
+	public String name, grave, flag, voice, fort, hash;
+	public String file = null;
+
+	public static int maxNumberOfHogs = 0;
+	public static int maxNumberOfTeams = 0;
+
+	static{
+		maxNumberOfHogs = PascalExports.HWgetMaxNumberOfHogs();
+		maxNumberOfTeams = PascalExports.HWgetMaxNumberOfTeams();
+	}
+	public String[] hats = new String[maxNumberOfHogs];
+	public String[] hogNames = new String[maxNumberOfHogs];
+	public int[] levels = new int[maxNumberOfHogs];
+
+	public int hogCount = 4;
+	public int color = TEAM_COLORS[0];
+
+	public Team(){
+	}
+
+	public Team(Parcel in){
+		readFromParcel(in);
+	}
+
+	public boolean equals(Object o){
+		if(super.equals(o)) return true;
+		else if(o instanceof Team){
+			Team t = (Team)o;
+			boolean ret = name.equals(t.name);
+			ret &= grave.equals(t.grave);
+			ret &= flag.equals(t.flag);
+			ret &= voice.equals(t.voice);
+			ret &= fort.equals(t.fort);
+			ret &= hash.equals(t.hash);
+			return ret;
+		}else{
+			return false;
+		}
+	}
+
+	public void setRandomColor(int[] illegalcolors){
+		Integer[] colorsToPickFrom = TEAM_COLORS;
+		if(illegalcolors != null){
+			ArrayList<Integer> colors = new ArrayList<Integer>();
+			for(int color : TEAM_COLORS){
+				boolean validColor = true;
+				for(int illegal : illegalcolors){
+					if(color == illegal) validColor = false;
+				}
+				if(validColor) colors.add(color);
+			}
+			if(colors.size() != 0) colorsToPickFrom = colors.toArray(new Integer[1]);
+		}
+		int index = (int)Math.round(Math.random()*(colorsToPickFrom.length-1));
+		color = colorsToPickFrom[index];
+	}
+
+
+	public void sendToEngine(EngineProtocolNetwork epn, int hogCount, int health) throws IOException{
+		epn.sendToEngine(String.format("eaddteam %s %d %s", hash, color, name));
+		epn.sendToEngine(String.format("egrave %s", grave));
+		epn.sendToEngine(String.format("efort %s", fort));
+		epn.sendToEngine(String.format("evoicepack %s", voice));
+		epn.sendToEngine(String.format("eflag %s", flag));
+
+		for(int i = 0; i < hogCount; i++){
+			epn.sendToEngine(String.format("eaddhh %d %d %s", levels[i], health, hogNames[i]));
+			epn.sendToEngine(String.format("ehat %s", hats[i]));
+		}
+	}
+
+	public void setFileName(Context c){
+		if(file == null){
+		  	file = validFileName(c, name);
+		}
+	}
+	private String validFileName(Context c, String fileName){
+		String absolutePath = String.format("%s/%s", c.getFilesDir(), fileName);
+		File f = new File(absolutePath);
+		if(f.exists()){
+			String newFileName = fileName + (int)(Math.random()*10);
+			return validFileName(c, newFileName);
+		}else{
+			return fileName;
+		}
+	}
+	
+	/*
+	 * XML METHODS
+	 */
+
+	/**
+	 * Read the xml file path and convert it to a Team object
+	 * @param path absolute path to the xml file
+	 * @return
+	 */
+	public static Team getTeamFromXml(String path){
+		try {
+			XmlPullParserFactory xmlPullFactory = XmlPullParserFactory.newInstance();
+			XmlPullParser xmlPuller = xmlPullFactory.newPullParser();
+
+			BufferedReader br = new BufferedReader(new FileReader(path), 1024);
+			xmlPuller.setInput(br);
+			Team team = new Team();
+			int hogCounter = 0;
+
+			int eventType = xmlPuller.getEventType();
+			int state = STATE_START;
+			while(eventType != XmlPullParser.END_DOCUMENT){
+				switch(state){
+				case STATE_START:
+					if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().equals("team")) state = STATE_ROOT;
+					else if(eventType != XmlPullParser.START_DOCUMENT) throwException(path, eventType);
+					break;
+				case STATE_ROOT:
+					if(eventType == XmlPullParser.START_TAG){
+						if(xmlPuller.getName().toLowerCase().equals("name")){
+							team.name = getXmlText(xmlPuller, "name");
+						}else if(xmlPuller.getName().toLowerCase().equals("flag")){
+							team.flag= getXmlText(xmlPuller, "flag");
+						}else if(xmlPuller.getName().toLowerCase().equals("voice")){
+							team.voice = getXmlText(xmlPuller, "voice");
+						}else if(xmlPuller.getName().toLowerCase().equals("grave")){
+							team.grave = getXmlText(xmlPuller, "grave");
+						}else if(xmlPuller.getName().toLowerCase().equals("fort")){
+							team.fort = getXmlText(xmlPuller, "fort");
+						}else if(xmlPuller.getName().toLowerCase().equals("hash")){
+							team.hash = getXmlText(xmlPuller, "hash");
+						}else if(xmlPuller.getName().toLowerCase().equals("hog")){
+							state = STATE_HOG_ROOT;
+						}else throwException(xmlPuller.getName(), eventType);
+					}else if(eventType == XmlPullParser.END_TAG) state = STATE_START;
+					else throwException(xmlPuller.getText(), eventType);
+					break;
+				case STATE_HOG_ROOT:
+					if(eventType == XmlPullParser.START_TAG){
+						if(xmlPuller.getName().toLowerCase().equals("name")){
+							team.hogNames[hogCounter] = getXmlText(xmlPuller, "name");
+						}else if(xmlPuller.getName().toLowerCase().equals("hat")){
+							team.hats[hogCounter] = getXmlText(xmlPuller, "hat");
+						}else if(xmlPuller.getName().toLowerCase().equals("level")){
+							team.levels[hogCounter] = Integer.parseInt(getXmlText(xmlPuller, "level"));
+						}else throwException(xmlPuller.getText(), eventType);
+					}else if(eventType == XmlPullParser.END_TAG){
+						hogCounter++;
+						state = STATE_ROOT;
+					}else throwException(xmlPuller.getText(), eventType);
+					break;
+				}
+				eventType = getEventType(xmlPuller);
+			}//end while(eventtype != END_DOCUMENT
+			return team;
+		} catch (NumberFormatException e){
+			e.printStackTrace();
+		} catch (XmlPullParserException e) {
+			e.printStackTrace();
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	private static String getXmlText(XmlPullParser xmlPuller, String parentTag)throws XmlPullParserException, IOException{
+		if(getEventType(xmlPuller) == XmlPullParser.TEXT){
+			String txt = xmlPuller.getText();
+			if(getEventType(xmlPuller) == XmlPullParser.END_TAG && xmlPuller.getName().toLowerCase().equals(parentTag)){
+				return txt;
+			}
+		}
+		throw new XmlPullParserException("malformed xml file on string read from tag: " + parentTag);
+	}
+
+	/**
+	 * Skips whitespaces..
+	 */
+	private static int getEventType(XmlPullParser xmlPuller)throws XmlPullParserException, IOException{
+		int eventType = xmlPuller.next();
+		while(eventType == XmlPullParser.TEXT && xmlPuller.isWhitespace()){
+			eventType = xmlPuller.next();
+		}
+		return eventType;
+	}
+
+	private static void throwException(String file, int eventType){
+		throw new IllegalArgumentException(String.format("Xml file: %s malformed with error: %d.", file, eventType));
+	}
+
+	public void writeToXml(OutputStream os){
+		XmlSerializer serializer = Xml.newSerializer();
+		try{
+			serializer.setOutput(os, "UTF-8");	
+			serializer.startDocument("UTF-8", true);
+			serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
+
+			serializer.startTag(null, "team");
+			serializer.startTag(null, "name");
+			serializer.text(name);
+			serializer.endTag(null, "name");
+			serializer.startTag(null, "flag");
+			serializer.text(flag);
+			serializer.endTag(null, "flag");
+			serializer.startTag(null, "fort");
+			serializer.text(fort);
+			serializer.endTag(null, "fort");
+			serializer.startTag(null, "grave");
+			serializer.text(grave);
+			serializer.endTag(null, "grave");
+			serializer.startTag(null, "voice");
+			serializer.text(voice);
+			serializer.endTag(null, "voice");
+			serializer.startTag(null, "hash");
+			serializer.text(hash);
+			serializer.endTag(null, "hash");
+
+			for(int i = 0; i < maxNumberOfHogs; i++){
+				serializer.startTag(null, "hog");
+				serializer.startTag(null, "name");
+				serializer.text(hogNames[i]);
+				serializer.endTag(null, "name");
+				serializer.startTag(null, "hat");
+				serializer.text(hats[i]);
+				serializer.endTag(null, "hat");
+				serializer.startTag(null, "level");
+				serializer.text(String.valueOf(levels[i]));
+				serializer.endTag(null, "level");
+
+				serializer.endTag(null, "hog");
+			}
+			serializer.endTag(null, "team");
+			serializer.endDocument();
+			serializer.flush();
+
+		} catch (IOException e) {
+			e.printStackTrace();
+		}finally{
+			try {
+				os.close();
+			} catch (IOException e) {}
+		}
+	}
+	/*
+	 * END XML METHODS
+	 */
+
+
+
+	/*
+	 * PARCABLE METHODS
+	 */
+
+	public int describeContents() {
+		return 0;
+	}
+
+	public void writeToParcel(Parcel dest, int flags) {
+		dest.writeString(name);
+		dest.writeString(grave);
+		dest.writeString(flag);
+		dest.writeString(voice);
+		dest.writeString(fort);
+		dest.writeString(hash);
+		dest.writeStringArray(hats);
+		dest.writeStringArray(hogNames);
+		dest.writeIntArray(levels);
+		dest.writeInt(color);
+		dest.writeInt(hogCount);
+		dest.writeString(file);
+	}
+
+
+	public void readFromParcel(Parcel src){
+		name = src.readString();
+		grave = src.readString();
+		flag = src.readString();
+		voice = src.readString();
+		fort = src.readString();
+		hash = src.readString();
+		src.readStringArray(hats);
+		src.readStringArray(hogNames);
+		src.readIntArray(levels);
+		color = src.readInt();
+		hogCount = src.readInt();
+		file = src.readString();
+	}
+
+	public static final Parcelable.Creator<Team> CREATOR = new Parcelable.Creator<Team>() {
+		public Team createFromParcel(Parcel source) {
+			return new Team(source);
+		}
+		public Team[] newArray(int size) {
+			return new Team[size];
+		}
+
+	};
+
+	/*
+	 * END PARCABLE METHODS
+	 */
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Weapon.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,217 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid.Datastructures;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.hedgewars.hedgeroid.EngineProtocol.EngineProtocolNetwork;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+import android.content.Context;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class Weapon implements Parcelable, Comparable<Weapon>{
+
+	public static final String DIRECTORY_WEAPON = "weapons";
+	
+	private String name;
+	private String QT;
+	private String prob;
+	private String delay;
+	private String crate;
+	private static int maxWeapons;
+	
+	static{
+		//maxWeapons = PascalExports.HWgetNumberOfWeapons();
+	}
+	
+	public Weapon(String _name, String _QT, String _prob, String _delay, String _crate){
+		name = _name;
+		
+		//Incase there's a newer ammoStore which is bigger we append with zeros
+		StringBuffer sb = new StringBuffer();
+		while(_QT.length() + sb.length() < maxWeapons){
+			sb.append('0');
+		}
+		
+		QT = String.format("e%s %s%s", "ammloadt", _QT, sb);
+		prob = String.format("e%s %s%s", "ammprob", _prob, sb);
+		delay = String.format("e%s %s%s", "ammdelay", _delay, sb);
+		crate = String.format("e%s %s%s", "ammreinf", _crate, sb);
+	}
+	
+	public Weapon(Parcel in){
+		readFromParcel(in);
+	}
+	
+	public String toString(){
+		return name;
+	}
+	
+	public void sendToEngine(EngineProtocolNetwork epn, int teamsCount) throws IOException{
+		epn.sendToEngine(QT);//command prefix is already in string 
+		epn.sendToEngine(prob);
+		epn.sendToEngine(delay);
+		epn.sendToEngine(crate);
+		
+		for(int i = 0; i < teamsCount; i++){
+			epn.sendToEngine("eammstore");
+		}
+	}
+	
+	public static final int STATE_START = 0;
+	public static final int STATE_ROOT = 1;
+	public static final int STATE_NAME = 2;
+	public static final int STATE_QT = 3;
+	public static final int STATE_PROBABILITY = 4;
+	public static final int STATE_DELAY = 5;
+	public static final int STATE_CRATE = 6;
+	
+	public static ArrayList<Weapon> getWeapons(Context c) throws IllegalArgumentException{
+		String dir = c.getFilesDir().getAbsolutePath() + '/' + DIRECTORY_WEAPON + '/';
+		String[] files = new File(dir).list();
+		if(files == null) files = new String[]{};
+		
+		ArrayList<Weapon> weapons = new ArrayList<Weapon>();
+
+		try {
+			XmlPullParserFactory xmlPullFactory = XmlPullParserFactory.newInstance();
+			XmlPullParser xmlPuller = xmlPullFactory.newPullParser();
+			
+			for(String file : files){
+				BufferedReader br = new BufferedReader(new FileReader(dir + file), 1024);
+				xmlPuller.setInput(br);
+				String name = null;
+				String qt = null;
+				String prob = null;
+				String delay = null;
+				String crate = null;
+				
+				int eventType = xmlPuller.getEventType();
+				int state = STATE_START;
+				while(eventType != XmlPullParser.END_DOCUMENT){
+					switch(state){
+					case STATE_START:
+						if(eventType == XmlPullParser.START_TAG && xmlPuller.getName().equals("weapon")) state = STATE_ROOT;
+						else if(eventType != XmlPullParser.START_DOCUMENT) throwException(file, eventType);
+						break;
+					case STATE_ROOT:
+						if(eventType == XmlPullParser.START_TAG){
+							if(xmlPuller.getName().toLowerCase().equals("qt")) state = STATE_QT;
+							else if(xmlPuller.getName().toLowerCase().equals("name")) state = STATE_NAME;
+							else if(xmlPuller.getName().toLowerCase().equals("probability")) state = STATE_PROBABILITY;
+							else if(xmlPuller.getName().toLowerCase().equals("delay")) state = STATE_DELAY;
+							else if(xmlPuller.getName().toLowerCase().equals("crate")) state = STATE_CRATE;
+							else throwException(file, eventType);
+						}else if(eventType == XmlPullParser.END_TAG) state = STATE_START;
+						else throwException(xmlPuller.getText(), eventType);
+						break;
+					case STATE_NAME:
+						if(eventType == XmlPullParser.TEXT) name = xmlPuller.getText().trim();
+						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
+						else throwException(file, eventType);
+						break;
+					case STATE_QT:
+						if(eventType == XmlPullParser.TEXT) qt = xmlPuller.getText().trim();
+						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
+						else throwException(file, eventType);
+						break;
+					case STATE_PROBABILITY:
+						if(eventType == XmlPullParser.TEXT) prob = xmlPuller.getText().trim();
+						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
+						else throwException(file, eventType);
+						break;
+					case STATE_DELAY:
+						if(eventType == XmlPullParser.TEXT) delay = xmlPuller.getText().trim();
+						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
+						else throwException(file, eventType);
+						break;
+					case STATE_CRATE:
+						if(eventType == XmlPullParser.TEXT) crate = xmlPuller.getText().trim();
+						else if(eventType == XmlPullParser.END_TAG) state = STATE_ROOT;
+						else throwException(file, eventType);
+						break;
+					}
+					eventType = xmlPuller.next();
+					while(eventType == XmlPullParser.TEXT && xmlPuller.isWhitespace()){//Skip whitespaces
+						eventType = xmlPuller.next();
+					}
+				}//end while(eventtype != END_DOCUMENT
+				weapons.add(new Weapon(name, qt, prob, delay, crate));
+			}//end for(string file : files
+			return weapons;
+			
+		} catch (XmlPullParserException e) {
+			e.printStackTrace();
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return new ArrayList<Weapon>();//TODO handle correctly
+	}
+	
+	private static void throwException(String file, int eventType){
+		throw new IllegalArgumentException(String.format("Xml file: %s malformed with eventType: %d.", file, eventType));
+	}
+
+	public int describeContents() {
+		return 0;
+	}
+
+	public void writeToParcel(Parcel dest, int flags) {
+		dest.writeString(name);
+		dest.writeString(QT);
+		dest.writeString(prob);
+		dest.writeString(delay);
+		dest.writeString(crate);
+	}
+	
+	private void readFromParcel(Parcel src){
+		name = src.readString();
+		QT = src.readString();
+		prob = src.readString();
+		delay = src.readString();
+		crate = src.readString();
+	}
+	
+	public static final Parcelable.Creator<Weapon> CREATOR = new Parcelable.Creator<Weapon>() {
+		public Weapon createFromParcel(Parcel source) {
+			return new Weapon(source);
+		}
+		public Weapon[] newArray(int size) {
+			return new Weapon[size];
+		}
+		
+	};
+
+	public int compareTo(Weapon another) {
+		return name.compareTo(another.name);
+	}
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadAssets.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,93 @@
+package org.hedgewars.hedgeroid.Downloader;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.hedgewars.hedgeroid.MainActivity;
+import org.hedgewars.hedgeroid.Utils;
+
+import android.content.Context;
+import android.content.res.AssetManager;
+import android.os.AsyncTask;
+import android.util.Log;
+
+public class DownloadAssets extends AsyncTask<Object, Long, Long>{
+	
+	private MainActivity act;
+	private static byte[] buffer = null;
+	
+	public DownloadAssets(MainActivity _act){
+		act = _act;
+	}
+	
+	public static Long copyFileOrDir(Context c, String path) {
+	    AssetManager assetManager = c.getAssets();
+	    String assets[] = null;
+	    try {
+	        assets = assetManager.list(path);
+	        if (assets.length == 0) {
+	            return DownloadAssets.copyFile(c, path);
+	        } else {
+	            String fullPath = Utils.getCachePath(c) + path;
+	            File dir = new File(fullPath);
+	            if (!dir.exists())
+	                dir.mkdir();
+	            for (int i = 0; i < assets.length; ++i) {
+	                Long result = DownloadAssets.copyFileOrDir(c, path + "/" + assets[i]);
+	                if(result > 0) return 1l;
+	            }
+	        }
+	    } catch (IOException ex) {
+	    	ex.printStackTrace();
+	        Log.e("tag", "I/O Exception", ex);
+	        return 1l;
+	    }
+	    return 0l;
+	}
+	
+	private static Long copyFile(Context c, String filename) {
+	    AssetManager assetManager = c.getAssets();
+
+	    InputStream in = null;
+	    OutputStream out = null;
+	    try {
+	        in = assetManager.open(filename);
+	        in = new BufferedInputStream(in, 8192);
+	        
+	        String newFileName = Utils.getCachePath(c) + filename;
+	        out = new FileOutputStream(newFileName);
+	        out = new BufferedOutputStream(out, 8192);
+
+	        int read;
+	        while ((read = in.read(buffer)) != -1) {
+	            out.write(buffer, 0, read);
+	        }
+	        in.close();
+	        in = null;
+	        out.flush();
+	        out.close();
+	        out = null;
+	    } catch (Exception e) {
+	    	e.printStackTrace();
+	        Log.e("tag", e.getMessage());
+	        return 1l;
+	    }
+	    return 0l;
+
+	}
+
+	protected Long doInBackground(Object... params) {
+		buffer = new byte[8192];//allocate the buffer
+		return DownloadAssets.copyFileOrDir(act, "Data");
+	}
+	
+	protected void onPostExecute(Long result){
+		act.onAssetsDownloaded(result == 0);
+		buffer = null;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadAsyncTask.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,223 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid.Downloader;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.hedgewars.hedgeroid.Downloader.DownloadService.DownloadTask;
+
+import android.os.AsyncTask;
+/**
+ * This is an AsyncTask which will download a zip from an URL and unzip it to a specified path
+ * 
+ *  a typical call to start the task would be new DownloadAsyncTask().execute(getExternalStorage(), "www.hedgewars.org/data.zip");
+ * @author Xeli
+ *
+ */
+public class DownloadAsyncTask extends AsyncTask<DownloadPackage, Object, Integer> {
+
+	//private final static String URL_WITHOUT_SUFFIX = "http://www.xelification.com/tmp/firebutton.";
+	private final static String URL_ZIP_SUFFIX = ".zip";
+	private final static String URL_HASH_SUFFIX = ".hash";
+
+	public static final int EXIT_SUCCESS = 0;
+	public static final int EXIT_URLFAIL = 1;
+	public static final int EXIT_CONNERROR = 2;
+	public static final int EXIT_FNF = 3;
+	public static final int EXIT_MD5 = 4;
+	public static final int EXIT_CANCELLED = 5;
+
+	private DownloadTask task;
+	private long lastUpdateMillis = 0;
+
+	public DownloadAsyncTask(DownloadTask _task){
+		task = _task;
+	}
+
+	/**
+	 * 
+	 * @param params - A {@link}DownloadTask which gives information about where to download from and store the files to 
+	 */
+	protected Integer doInBackground(DownloadPackage...packages) {
+		DownloadPackage pack = packages[0];//just use one task per execute call for now
+
+		HttpURLConnection conn = null;
+		MessageDigest digester = null;
+		String rootZipDest = pack.getPathToStore();
+
+		File rootDest = new File(rootZipDest);//TODO check for nullpointer, it hints to the absence of an sdcard
+		rootDest.mkdir();
+
+		try {
+			URL url = new URL(pack.getURL() + URL_ZIP_SUFFIX);
+			conn = (HttpURLConnection)url.openConnection();
+		} catch (IOException e) {
+			e.printStackTrace();
+			return EXIT_URLFAIL;
+		}
+
+		String contentType = conn.getContentType();
+
+		if(contentType == null || contentType.contains("zip")){ //Seeing as we provide the url if the contentType is unknown lets assume zips
+			int bytesDecompressed = 0;
+			ZipEntry entry = null;
+			ZipInputStream input = null;
+			FileOutputStream output = null;
+			int kbytesToProcess = conn.getContentLength()/1024;
+
+			byte[] buffer = new byte[1024];
+			task.start(kbytesToProcess);
+
+			try {
+				digester = MessageDigest.getInstance("MD5");
+
+			} catch (NoSuchAlgorithmException e1) {
+				e1.printStackTrace();
+			}
+
+			try{
+				input = new ZipInputStream(conn.getInputStream());
+				entry = input.getNextEntry();	
+			}catch(IOException e){
+				e.printStackTrace();
+				if(conn != null) conn.disconnect();
+				return EXIT_CONNERROR;
+			}
+
+
+
+			while(entry != null){
+
+				if(isCancelled()) break;
+
+				try {
+					String fileName = entry.getName();
+					File f = new File(rootZipDest + fileName);
+					bytesDecompressed += entry.getCompressedSize();
+
+					if(entry.isDirectory()){
+						f.mkdir();
+					}else{
+						if(f.exists()){
+							f.delete();
+						}
+						f.createNewFile();
+						output = new FileOutputStream(f);
+
+						int count = 0;
+						while((count = input.read(buffer)) != -1){
+							output.write(buffer, 0, count);
+							digester.update(buffer, 0, count);
+							if(System.currentTimeMillis() - lastUpdateMillis > 1000){
+								lastUpdateMillis = System.currentTimeMillis();
+								publishProgress(bytesDecompressed, kbytesToProcess, fileName);
+							}
+						}
+						output.flush();
+						input.closeEntry();
+					}//if isDir 
+					entry = input.getNextEntry();
+				} catch (FileNotFoundException e) {
+					e.printStackTrace();
+					if(conn != null) conn.disconnect();
+					return EXIT_FNF;
+				} catch (IOException e) {
+					e.printStackTrace();
+					if(conn != null) conn.disconnect();
+					return EXIT_CONNERROR;
+				}finally{
+					try {
+						if( output != null) output.close();
+
+					} catch (IOException e) {}
+				}
+			}//end while(entry != null)
+			if( input != null)
+				try {
+					input.close();
+				} catch (IOException e) {}
+		}else{//end if contentType == "zip"
+			return EXIT_URLFAIL;
+		}
+		if(conn != null) conn.disconnect();
+
+		if(checkMD5(digester, pack))return EXIT_SUCCESS;
+		else return EXIT_MD5;
+	}
+
+	//TODO proper result handling
+	protected void onPostExecute(Integer result){
+		task.done(result);
+	}
+
+	protected void onProgressUpdate(Object...objects){
+		task.update((Integer)objects[0], (Integer)objects[1], (String)objects[2]);
+	}
+
+	protected void onCancelled(){
+		onPostExecute(EXIT_CANCELLED);
+	}
+
+	private boolean checkMD5(MessageDigest digester, DownloadPackage task){
+		if(digester != null) {
+			byte[] messageDigest = digester.digest();
+
+			try {
+				URL url = new URL(task.getURL() + URL_HASH_SUFFIX);
+				HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+
+				byte[] buffer = new byte[1024];//size is large enough to hold the entire hash
+				BufferedInputStream bis = new BufferedInputStream(conn.getInputStream());
+				int bytesRead = bis.read(buffer);
+				String hash = null;
+				if(bytesRead > -1){
+					hash = new String(buffer, 0, bytesRead);
+				}
+				StringBuffer sb = new StringBuffer();
+				Integer tmp = 0;
+				for(int i = 0; i < messageDigest.length; i++){
+					tmp = 0xFF & messageDigest[i];
+					if(tmp < 0xF) sb.append('0');
+					sb.append(Integer.toHexString(tmp));
+				}
+				sb.append('\n');//add newline to become identical with the hash file
+
+				return hash.equals(sb.toString());
+			} catch (IOException e) {
+				e.printStackTrace();
+				return true;
+			}
+		}else{
+			return true;	
+		}
+
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadDialogFragment.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,69 @@
+package org.hedgewars.hedgeroid.Downloader;
+
+import org.hedgewars.hedgeroid.R;
+
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.DialogFragment;
+
+public class DownloadDialogFragment extends DialogFragment {
+
+	public static final int NUM_ALREADYDOWNLOADED = 0;
+	public static final int NUM_AREYOUSURE = 1;
+
+	private final static String BUNDLE_TASK = "task";
+
+	static DownloadDialogFragment newInstance(DownloadPackage task){
+		DownloadDialogFragment dialog = new DownloadDialogFragment();
+
+		Bundle args = new Bundle();
+		args.putParcelable(DownloadDialogFragment.BUNDLE_TASK, task);
+		dialog.setArguments(args);
+
+		return dialog;
+	}
+
+	public Dialog onCreateDialog(Bundle savedInstanceState){
+		DownloadPackage task = (DownloadPackage)getArguments().getParcelable(DownloadDialogFragment.BUNDLE_TASK);
+
+		Builder builder = new AlertDialog.Builder(getActivity());
+
+		switch(task.getStatus()){
+		case CURRENTVERSION:
+		case NEWERVERSION:
+			builder.setMessage(R.string.download_areyousure);
+			break;
+		case OLDERVERSION:
+			builder.setMessage(R.string.download_alreadydownloaded);
+			break;
+		}
+
+		DownloadClicker clicker = new DownloadClicker(task);
+		builder.setPositiveButton(android.R.string.yes, clicker);
+		builder.setNegativeButton(android.R.string.no, clicker);
+
+		return builder.create();
+	}
+
+	class DownloadClicker implements OnClickListener{
+
+		DownloadPackage task = null;
+
+		public DownloadClicker(DownloadPackage _task){
+			task = _task;
+		}
+
+		public void onClick(DialogInterface dialog, int which) {
+			if(which == Dialog.BUTTON_POSITIVE){
+				Intent i = new Intent(getActivity(), DownloadFragment.class);
+				i.putExtra(DownloadFragment.EXTRA_TASK, task);
+				getActivity().startActivity(i);
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadFragment.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,214 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid.Downloader;
+
+import org.hedgewars.hedgeroid.R;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.RemoteException;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+public class DownloadFragment extends Fragment{
+	public static final String EXTRA_TASK = "task";
+
+	public static final int MSG_START = 0;
+	public static final int MSG_UPDATE = 1;
+	public static final int MSG_DONE = 2;
+	public static final int MSG_FAILED = 3;
+
+	private boolean boundToService = false;
+
+	private TextView progress_sub;
+	private ProgressBar progress;
+	private Button /*positive,*/ negative;
+
+	private DownloadPackage pack;
+
+	private Handler messageHandler;
+	private Messenger messenger, messengerService;
+
+	public static DownloadFragment getInstance(DownloadPackage task){
+		DownloadFragment df = new DownloadFragment();
+		Bundle args = new Bundle();
+		args.putParcelable(DownloadFragment.EXTRA_TASK, task);
+
+		df.setArguments(args);
+
+		return df;
+	}
+
+	public void onActivityCreated(Bundle savedInstanceState){
+		super.onActivityCreated(savedInstanceState);
+
+		messageHandler = new Handler(messageCallback);
+		messenger = new Messenger(messageHandler);
+		Intent i = new Intent(getActivity().getApplicationContext(), DownloadService.class);
+		getActivity().startService(i);
+		getActivity().bindService(new Intent(getActivity().getApplicationContext(), DownloadService.class), connection, Context.BIND_AUTO_CREATE);
+	}
+
+	public View onCreateView(LayoutInflater inflater, ViewGroup viewgroup, Bundle savedInstanceState){
+		View v = inflater.inflate(R.layout.download_progress, viewgroup, false);
+		progress_sub = (TextView)v.findViewById(R.id.progressbar_sub);
+		progress = (ProgressBar)v.findViewById(R.id.progressbar);
+
+		//positive = (Button) v.findViewById(R.id.background);
+		negative = (Button) v.findViewById(R.id.cancelDownload);
+		//positive.setOnClickListener(backgroundClicker);
+		negative.setOnClickListener(cancelClicker);
+
+		pack = getArguments().getParcelable(DownloadFragment.EXTRA_TASK);
+
+		return v;
+	}
+
+	private OnClickListener backgroundClicker = new OnClickListener(){
+		public void onClick(View v){
+			getActivity().finish();
+		}
+	};
+	private OnClickListener cancelClicker = new OnClickListener(){
+		public void onClick(View v){
+			if(messengerService != null){
+				Message message = Message.obtain(messageHandler, DownloadService.MSG_CANCEL, pack);
+				try {
+					messengerService.send(message);
+				} catch (RemoteException e) {}
+			}
+			//getActivity().finish();
+		}
+	};
+	private OnClickListener doneClicker = new OnClickListener(){
+		public void onClick(View v){
+			getActivity().finish();
+		}
+	};
+
+	private OnClickListener tryAgainClicker = new OnClickListener(){
+		public void onClick(View v){
+			if(messengerService != null){
+				Message message = Message.obtain(messageHandler, DownloadService.MSG_ADDTASK, pack);
+				message.replyTo = messenger;
+				try {
+					messengerService.send(message);
+				} catch (RemoteException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+	};
+
+	public void onDestroy(){
+		unBindFromService();
+		super.onDestroy();
+	}
+
+	private ServiceConnection connection = new ServiceConnection(){
+
+		public void onServiceConnected(ComponentName name, IBinder service) {
+			messengerService = new Messenger(service);
+
+			try{
+				//give the service a task
+				if(messengerService != null){
+					Message message = Message.obtain(messageHandler, DownloadService.MSG_ADDTASK, pack);
+					message.replyTo = messenger;
+					messengerService.send(message);
+				}
+
+			}catch (RemoteException e){}
+		}
+
+		public void onServiceDisconnected(ComponentName name) {
+			messengerService = null;
+		}
+
+	};
+
+	public void unBindFromService(){
+		if(messengerService != null){
+			try {
+				Message message = Message.obtain(messageHandler, DownloadService.MSG_UNREGISTER_CLIENT, pack);
+				message.replyTo = messenger;
+				messengerService.send(message);
+			} catch (RemoteException e) {
+				e.printStackTrace();
+			}
+		}
+
+		getActivity().unbindService(connection);
+	}
+
+	private Handler.Callback messageCallback = new Handler.Callback() {
+
+		public boolean handleMessage(Message msg) {
+			switch(msg.what){
+			case MSG_START:
+				progress.setMax(msg.arg1);
+				progress_sub.setText(String.format("%dkb/%dkb\n%s", 0, msg.arg1, ""));
+				//positive.setText(R.string.download_background);
+				//positive.setOnClickListener(backgroundClicker);
+				negative.setText(R.string.download_cancel);
+				negative.setOnClickListener(cancelClicker);
+				break;
+			case MSG_UPDATE:
+				progress_sub.setText(String.format("%d%% - %dkb/%dkb\n%s",(msg.arg1*100)/msg.arg2, msg.arg1, msg.arg2, msg.obj));
+				progress.setProgress(msg.arg1);
+				break;
+			case MSG_DONE:
+				progress.setProgress(progress.getMax());
+				progress_sub.setText(R.string.download_done);
+
+				//	positive.setText(R.string.download_back);
+				//	positive.setOnClickListener(doneClicker);
+
+				negative.setVisibility(View.INVISIBLE);
+				break;
+			case MSG_FAILED:
+				progress.setProgress(progress.getMax());
+				progress_sub.setText(R.string.download_failed);
+				//	positive.setText(R.string.download_back);
+				//	positive.setOnClickListener(doneClicker);
+
+				negative.setText(R.string.download_tryagain);
+				negative.setOnClickListener(tryAgainClicker);
+				break;
+			}
+			return false;
+		}
+	};
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadListActivity.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,115 @@
+package org.hedgewars.hedgeroid.Downloader;
+
+import org.hedgewars.hedgeroid.R;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+
+public class DownloadListActivity extends FragmentActivity implements OnItemMovementListener{
+
+	private FrameLayout layout = null;
+	private LinearLayout downloadQueueContainer = null;
+	private View infoView = null;
+	private ImageView arrow = null;
+	private int halfSize = 0;
+	private DownloadPackage task = null;
+
+	public void onCreate(Bundle savedInstanceState){
+		super.onCreate(savedInstanceState);
+
+		setContentView(R.layout.download_listactivity);
+		//FragmentManager fm = this.getSupportFragmentManager();
+		//if(fm.findFragmentById(android.R.id.content) == null){
+		//	DownloadListFragment listfrag = new DownloadListFragment();
+		//	fm.beginTransaction().add(android.R.id.content, listfrag).commit();
+		//}
+
+		layout = (FrameLayout)findViewById(R.id.downloadFrameLayout);
+		downloadQueueContainer = (LinearLayout) findViewById(R.id.downloadQueueContainer);
+	}
+	
+	public void onNewItemSelected(DownloadPackage _task, int x, int minX, int maxX, int size) {
+		if(layout != null){
+			if(!_task.equals(task)){//if it's a new task refresh the whole thing
+				task = _task;
+				layout.removeView(infoView);
+				infoView = null;
+			}
+			
+			if(infoView == null){//build iv if it hasn't been created yet
+				infoView = this.getLayoutInflater().inflate(R.layout.download_info, layout, false);
+				FrameLayout.LayoutParams params = (android.widget.FrameLayout.LayoutParams) infoView.getLayoutParams();
+				params.gravity = Gravity.NO_GRAVITY;
+				params.height = size;
+				arrow = (ImageView)infoView.findViewById(R.id.arrow);
+				arrow.setVisibility(View.INVISIBLE);
+				halfSize = size/2;
+				
+				Button yes = (Button)infoView.findViewById(R.id.download);
+				Button no = (Button)infoView.findViewById(R.id.cancel);
+				yes.setOnClickListener(yesClicker);
+				no.setOnClickListener(noClicker);
+				
+				layout.addView(infoView, params);
+			}
+		}
+	}
+
+	public void onViewMoved(int x, int minX, int maxX) {
+		if(halfSize == -1){
+			if(infoView.getHeight() != 0){
+				halfSize = infoView.getHeight()/2;
+			}
+		}
+		if(layout != null && infoView != null){
+			FrameLayout.LayoutParams params = ((FrameLayout.LayoutParams)infoView.getLayoutParams());
+			if(x - halfSize < minX){
+				params.topMargin = 0;
+				arrow.setVisibility(View.INVISIBLE);
+				params.gravity = Gravity.TOP;
+			}else if (x + halfSize >= maxX){
+				params.topMargin = 0;
+				arrow.setVisibility(View.INVISIBLE);
+				params.gravity = Gravity.BOTTOM;
+			}else{
+				params.topMargin = x - halfSize;
+				params.gravity = Gravity.NO_GRAVITY;
+				arrow.setVisibility(View.VISIBLE);
+			}
+			
+			infoView.requestLayout();
+			
+		}
+	}
+	
+	private OnClickListener yesClicker = new OnClickListener(){
+		public void onClick(View v){
+			FragmentManager fm = getSupportFragmentManager();
+			FragmentTransaction ft= fm.beginTransaction();
+			DownloadFragment df = DownloadFragment.getInstance(task);
+			
+			ft.add(R.id.downloadQueueContainer, df).commit();
+			//ft.show(new DownloadFragment());
+			
+			task = null;
+			layout.removeView(infoView);
+		}
+	};
+	
+	private OnClickListener noClicker = new OnClickListener(){
+		public void onClick(View v){
+			task = null;
+			layout.removeView(infoView);
+		}
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadListFragment.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,195 @@
+package org.hedgewars.hedgeroid.Downloader;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.v4.app.ListFragment;
+import android.util.Log;
+import android.view.View;
+import android.widget.AbsListView;
+import android.widget.AbsListView.OnScrollListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ArrayAdapter;
+
+public class DownloadListFragment extends ListFragment implements OnItemClickListener, OnScrollListener, Runnable{
+
+	private View targetView = null;
+	private ArrayList<OnItemMovementListener> listeners = new ArrayList<OnItemMovementListener>(); 
+
+	public void onActivityCreated(Bundle savedInstanceState){
+		super.onActivityCreated(savedInstanceState);
+
+		ArrayList<DownloadPackage> tasks = new ArrayList<DownloadPackage>();
+
+		ArrayAdapter<DownloadPackage> adapter = new ArrayAdapter<DownloadPackage>(getActivity().getApplicationContext(), android.R.layout.simple_list_item_1, tasks);
+		setListAdapter(adapter);
+		getListView().setOnItemClickListener(this);
+		getListView().setOnScrollListener(this);
+
+		if(getActivity() instanceof OnItemMovementListener){
+			listeners.add((OnItemMovementListener)getActivity());
+		}
+
+		getListView().setCacheColorHint(Color.TRANSPARENT);//To prevent a blackish background while scrolling
+		
+		
+		Thread t = new Thread(this, "DownloadListParser");
+		t.start();
+	}
+
+	public void run(){
+		XmlPullParserFactory xmlPullFactory;
+		try {
+			xmlPullFactory = XmlPullParserFactory.newInstance();
+			XmlPullParser xmlPuller = xmlPullFactory.newPullParser();
+
+			URL url = new URL("http://www.xelification.com/tmp/downloads.xml");
+			HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+
+			BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()), 1024);
+			xmlPuller.setInput(br);
+
+			final ArrayAdapter<DownloadPackage> adapter = (ArrayAdapter<DownloadPackage>) getListAdapter();
+			
+			int eventType = xmlPuller.getEventType();
+			while(eventType != XmlPullParser.END_DOCUMENT){
+			
+				if(eventType == XmlPullParser.START_TAG){
+					if(xmlPuller.getName().toLowerCase().equals("task")){
+						final DownloadPackage task = DownloadPackage.getTaskFromXML(getActivity(), xmlPuller);
+						
+						getActivity().runOnUiThread(new Runnable(){
+							public void run() {
+								adapter.add(task);								
+							}
+						});
+					}
+				}
+				eventType = getEventType(xmlPuller);
+			}
+			
+			
+		} catch (XmlPullParserException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+	
+
+	/**
+	 * Skips whitespaces..
+	 */
+	private static int getEventType(XmlPullParser xmlPuller)throws XmlPullParserException, IOException{
+		int eventType = xmlPuller.next();
+		while(eventType == XmlPullParser.TEXT && xmlPuller.isWhitespace()){
+			eventType = xmlPuller.next();
+		}
+		return eventType;
+	}
+
+	public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
+		DownloadPackage task = (DownloadPackage)arg0.getAdapter().getItem(position);
+		/*
+		FragmentTransaction ft = getFragmentManager().beginTransaction();
+		Fragment prev = getFragmentManager().findFragmentByTag("dialog");
+
+		//remove any old dialogs
+		if(prev != null) ft.remove(prev);
+		ft.addToBackStack(null);
+
+		//create a new dialog based on this task
+		
+		DialogFragment newFragment = DownloadDialogFragment.newInstance(task);
+
+		//show it
+		newFragment.show(ft, "dialog");
+		 */
+		targetView = arg1;
+
+		//determine state
+		int min = arg0.getTop();
+		int max = arg0.getBottom();
+		int top = targetView.getTop();
+
+		previousXCoord = top;
+		for(OnItemMovementListener listener : listeners){
+			listener.onNewItemSelected(task, top, min, max, targetView.getHeight()*2);
+		}
+	}
+
+	private int previousXCoord = 0;
+
+	/*
+	 * (non-Javadoc)
+	 * @see android.widget.AbsListView.OnScrollListener#onScroll(android.widget.AbsListView, int, int, int)
+	 * 
+	 * Android renews the Items used in the view, so when a user scroll down the list, 
+	 * as soon as the item has dissapeard from the list it gets reused at the bottom.
+	 * 
+	 * For this reason we cannot just keep sending the targetView.getTop() but we must
+	 *  remember if the view is supposed to be at the top or bottom of the list. We 
+	 *  remember this with int state, 
+	 *     - 0 means we've got accurate reading from getTop()
+	 *     - -1 means it's somewhere at the top of the list
+	 *     - 1 means it's at the bottom somewhere
+	 */
+	public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
+		if(targetView != null){
+			int top = targetView.getTop() + (targetView.getHeight()/2);
+			int min = view.getTop();
+			int max = view.getBottom();
+
+			if(Math.abs(previousXCoord - top) > targetView.getHeight()*2 ){
+				top = previousXCoord;
+			}
+
+			for(OnItemMovementListener listener : listeners){
+				listener.onViewMoved(top, min, max);
+			}
+
+			previousXCoord = top;
+		}
+	}
+
+	public void onScrollStateChanged(AbsListView view, int scrollState) {
+		switch(scrollState){
+		case OnScrollListener.SCROLL_STATE_FLING: Log.d("tag", "fling"); break;
+		case OnScrollListener.SCROLL_STATE_IDLE:Log.d("tag", "idle"); break;
+		case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:Log.d("tag", "scroll"); break;
+
+		}
+
+	}
+}
+
+interface OnItemMovementListener{
+	/**
+	 * When I new item has been selected this method will be called
+	 * @param task The task which goes with this item
+	 * @param x The middle of this item
+	 * @param minX The top of the parent of this item
+	 * @param maxX The bottom of the parent of this item
+	 */
+	void onNewItemSelected(DownloadPackage task, int x, int minX, int maxX, int size);
+
+	/**
+	 * When the item has been moved this method is called
+	 * @param x The middle of this item
+	 * @param minX The top of the parent of this item
+	 * @param maxX The bottom of the parent of this item
+	 */
+	void onViewMoved(int x, int minX, int maxX);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadPackage.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,186 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid.Downloader;
+
+import java.io.IOException;
+
+import org.hedgewars.hedgeroid.Utils;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+public class DownloadPackage implements Parcelable{
+	private String url_without_suffix;
+	private String pathToStore;
+	private String representation;
+	private String description;
+	private int versionNumber;
+	private final Status status;
+	private int uniqueId;
+
+
+	public DownloadPackage(Parcel src){
+		url_without_suffix = src.readString();
+		pathToStore = src.readString();
+		representation = src.readString();
+		versionNumber = src.readInt();
+		status = Status.values()[src.readInt()];
+		description = src.readString();
+		uniqueId = src.readInt();
+	}
+
+	public DownloadPackage(Context c, String _url_without_suffix, String path, int version, String _representation, String _description, int _uniqueId){
+		url_without_suffix = _url_without_suffix;
+		pathToStore = path;
+		representation = _representation;
+		versionNumber = version;
+		description = _description;
+		uniqueId = _uniqueId;
+
+
+		//determine if the user has already downloaded this version
+		SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(c);
+		int currentVersion = sharedPref.getInt(representation, -1);
+		if(currentVersion == versionNumber) status = Status.CURRENTVERSION;
+		else if (currentVersion < versionNumber) status = Status.NEWERVERSION;
+		else status = Status.OLDERVERSION;
+	}
+
+	public Status getStatus(){
+		return status;
+	}
+
+	public String getURL(){
+		return url_without_suffix;
+	}
+
+	public String getPathToStore(){
+		return pathToStore;
+	}
+
+	public String toString(){
+		return representation;
+	}
+
+	public int describeContents() {
+		return 0;
+	}
+	public int getId(){
+		return uniqueId;
+	}
+
+	public void writeToParcel(Parcel dest, int flags) {
+		dest.writeString(url_without_suffix);
+		dest.writeString(pathToStore);
+		dest.writeString(representation);
+		dest.writeInt(versionNumber);
+		dest.writeInt(status.ordinal());
+		dest.writeString(description);
+	}
+
+	public static final Parcelable.Creator<DownloadPackage> CREATOR = new Parcelable.Creator<DownloadPackage>() {
+		public DownloadPackage createFromParcel(Parcel source) {
+			return new DownloadPackage(source);
+		}
+		public DownloadPackage[] newArray(int size) {
+			return new DownloadPackage[size];
+		}
+	};
+
+	/*
+	 * We enter with a XmlPullParser.Start_tag with name "task"
+	 */
+	public static DownloadPackage getTaskFromXML(Context c, XmlPullParser xmlPuller) throws XmlPullParserException, IOException{
+		String url = null;
+		String path = null;
+		String representation = null;
+		String description = null;
+		int uniqueId = -1;
+		int version = -1;
+
+		int eventType = DownloadPackage.getEventType(xmlPuller);//get the next token, should be a start tag
+		while(eventType != XmlPullParser.END_DOCUMENT){
+			switch(eventType){
+			case XmlPullParser.START_TAG:
+				String name = xmlPuller.getName().toLowerCase();
+				if(DownloadPackage.getEventType(xmlPuller) == XmlPullParser.TEXT){
+					String text = xmlPuller.getText().trim();
+					if(name.equals("url")){
+						url = text;
+					}else if(name.equals("version")){
+						try{
+						version = Integer.parseInt(text);
+						}catch (NumberFormatException e){
+							e.printStackTrace();
+							version = -1;
+						}
+					}else if(name.equals("path")){
+						path = Utils.getDataPath(c) + text;
+					}else if(name.equals("representation")){
+						representation = text;
+					}else if(name.equals("description")){
+						description = text;
+					}else if(name.equals("uniqueid")){
+						try{
+							uniqueId = Integer.parseInt(text);
+							}catch (NumberFormatException e){
+								e.printStackTrace();
+								version = -1;
+							}
+					}
+				}				
+				DownloadPackage.getEventType(xmlPuller);//endtag
+				break;
+			case XmlPullParser.END_TAG:
+				if(xmlPuller.getName().toLowerCase().equals("task") && url != null && path != null && version != -1 && representation != null){
+					return new DownloadPackage(c, url, path, version, representation, description, uniqueId);
+				}else{
+					throw new XmlPullParserException("XML download parsing: missing tags");
+				}
+			case XmlPullParser.TEXT:
+				throw new XmlPullParserException("Wrong tag recieved got TEXT : " + xmlPuller.getText());
+			default:
+				throw new XmlPullParserException("Wrong tag recieved got: " + eventType);
+			}
+			eventType = DownloadPackage.getEventType(xmlPuller);
+		}
+		throw new XmlPullParserException("Xml: unexpected endofdocument tag");
+	}
+
+	/**
+	 * Skips whitespaces..
+	 */
+	private static int getEventType(XmlPullParser xmlPuller)throws XmlPullParserException, IOException{
+		int eventType = xmlPuller.next();
+		while(eventType == XmlPullParser.TEXT && xmlPuller.isWhitespace()){
+			eventType = xmlPuller.next();
+		}
+		return eventType;
+	}
+}
+
+enum Status{
+	CURRENTVERSION, NEWERVERSION, OLDERVERSION;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Downloader/DownloadService.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,230 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid.Downloader;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.hedgewars.hedgeroid.R;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.app.Service;
+import android.content.Intent;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.RemoteException;
+import android.widget.RemoteViews;
+
+public class DownloadService extends Service {
+	public final static String INTENT_TASKID = "taskId";
+	public final static String INTENT_TASK = "task";
+
+	public static final String PREF_DOWNLOADED = "downloaded";
+	public static final int MSG_CANCEL = 0;
+	public static final int MSG_UNREGISTER_CLIENT = 2;
+	public final static int MSG_ADDTASK = 4;
+
+	public static final int NOTIFICATION_PROCESSING = 0;
+	public static final int NOTIFICATION_DONE = 1;
+
+	private DownloadAsyncTask asyncExecutor;
+
+	private DownloadHandler handler = new DownloadHandler();
+	private final Messenger messenger = new Messenger(handler);
+
+	private NotificationManager nM;
+	private RemoteViews contentView;
+
+	private LinkedList<DownloadTask> downloadTasks = new LinkedList<DownloadTask>();
+	private DownloadTask currentTask = null;
+
+	public class DownloadHandler extends Handler{
+
+		public void handleMessage(Message msg){
+			if(msg.obj != null){
+				DownloadPackage pack = (DownloadPackage) msg.obj;
+				DownloadTask task = null;
+				Messenger replyToMessenger = msg.replyTo;
+				for(DownloadTask _task : downloadTasks){
+					if(_task.getPackage().equals(pack)){
+						task = _task;
+						break;
+					}
+				}
+
+				switch(msg.what){
+				case MSG_ADDTASK:
+					if(task == null){
+						task = new DownloadTask(pack);
+						downloadTasks.add(task);
+					}
+
+					task.addClient(replyToMessenger);
+					runNextTask();
+					return;
+				case MSG_CANCEL:
+					if(task != null && task.getPackage().equals(pack) && task.getStatus() == TASK_STATE.PENDING){
+						downloadTasks.remove(task);
+					}
+					if(currentTask.getPackage().equals(pack)){
+						asyncExecutor.cancel(false);
+					}
+					return;
+				case MSG_UNREGISTER_CLIENT:
+					if(task != null){
+						task.removeClient(replyToMessenger);
+					}
+					return;
+				}
+			}
+		}
+	}
+
+	public void onCreate(){
+		super.onCreate();
+		nM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+	}
+	public IBinder onBind(Intent intent) {
+		return messenger.getBinder();
+	}
+
+	private void runNextTask(){
+		if(asyncExecutor == null){//if (task isnt running right now) ...
+			currentTask = downloadTasks.poll();
+			if(currentTask != null){
+				asyncExecutor = new DownloadAsyncTask(currentTask);
+				asyncExecutor.execute(currentTask.getPackage());
+			}
+		}
+	}
+
+	public void onDestroy(){
+		super.onDestroy();
+		asyncExecutor.cancel(false);	
+	}
+
+	class DownloadTask {
+		private final DownloadPackage pack;
+		private TASK_STATE status = TASK_STATE.PENDING;
+		private Notification progressNotification, doneNotification;
+
+		//I expect little to no removeClient calls that's why we go for a list rather than a map
+		private final List<Messenger> clients;
+
+		public DownloadTask(DownloadPackage _pack){
+			pack = _pack;
+			clients = new LinkedList<Messenger>();
+		}
+
+		public void addClient(Messenger messenger){
+			clients.add(messenger);
+		}
+		public void removeClient(Messenger messenger){
+			clients.remove(messenger);
+		}
+
+		public DownloadPackage getPackage(){
+			return pack;
+		}
+
+		public TASK_STATE getStatus(){
+			return status;
+		}
+
+		public void sendMessageToClients(Message msg){
+			for(Messenger messenger : clients){
+				try {
+					messenger.send(msg);		
+				} catch (RemoteException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+
+		/*
+		 * Callbacks called from the async tasks
+		 */
+
+		//Thread safe method to let clients know the processing is starting and will process int max kbytes
+		public void start(int max){
+			progressNotification = new Notification(R.drawable.statusbar, getString(R.string.notification_title), System.currentTimeMillis());
+			progressNotification.flags |= Notification.FLAG_ONGOING_EVENT;
+
+			contentView = new RemoteViews(getPackageName(), R.layout.notification);
+			contentView.setProgressBar(R.id.notification_progress, 100, 34, false);
+			progressNotification.contentView = contentView;
+
+			PendingIntent contentIntent = PendingIntent.getActivity(DownloadService.this, 0, new Intent(DownloadService.this, DownloadFragment.class), Intent.FLAG_ACTIVITY_NEW_TASK);
+			progressNotification.contentIntent = contentIntent;
+
+			startForeground(NOTIFICATION_PROCESSING, progressNotification);
+
+			Message msg = Message.obtain(null, DownloadFragment.MSG_START, max, 0);
+			sendMessageToClients(msg);
+		}
+
+		//periodically gets called by the ASyncTask, we can't tell for sure when it's called
+		public void update(int progress, int max, String fileName){
+			progress = (progress/1024);
+
+			contentView.setProgressBar(R.id.notification_progress, max, progress, false);
+			contentView.setTextViewText(R.id.progressbar_sub, String.format("%dkb/%dkb (Compressed sizes)", progress, max));
+			nM.notify(NOTIFICATION_PROCESSING, progressNotification);
+
+			sendMessageToClients(Message.obtain(handler, DownloadFragment.MSG_UPDATE, progress, max, fileName));
+		}
+
+		//Call back from the ASync task when the task has either run into an error or finished otherwise
+		public void done(int result){
+			switch(result){
+			case DownloadAsyncTask.EXIT_SUCCESS: 	sendMessageToClients(Message.obtain(handler, DownloadFragment.MSG_DONE)); break;
+			case DownloadAsyncTask.EXIT_CONNERROR:  sendMessageToClients(Message.obtain(handler, DownloadFragment.MSG_FAILED)); break;
+			case DownloadAsyncTask.EXIT_FNF:		sendMessageToClients(Message.obtain(handler, DownloadFragment.MSG_FAILED)); break;
+			case DownloadAsyncTask.EXIT_MD5:		sendMessageToClients(Message.obtain(handler, DownloadFragment.MSG_FAILED)); break;
+			case DownloadAsyncTask.EXIT_URLFAIL:	sendMessageToClients(Message.obtain(handler, DownloadFragment.MSG_FAILED)); break;
+			case DownloadAsyncTask.EXIT_CANCELLED:	sendMessageToClients(Message.obtain(handler, DownloadFragment.MSG_DONE)); break;
+			}
+			
+			stopForeground(true);
+			nM.cancel(NOTIFICATION_PROCESSING);
+
+			String title = getString(R.string.notification_title);
+
+			doneNotification = new Notification(R.drawable.icon, title, System.currentTimeMillis());
+			doneNotification.flags |= Notification.FLAG_AUTO_CANCEL;
+			PendingIntent contentIntent = PendingIntent.getActivity(DownloadService.this, 0, new Intent(DownloadService.this, DownloadListActivity.class), Intent.FLAG_ACTIVITY_NEW_TASK);
+			doneNotification.setLatestEventInfo(DownloadService.this, title, getString(R.string.notification_done) + pack, contentIntent);
+			nM.notify(pack.getId(), doneNotification);
+
+			asyncExecutor = null;
+			runNextTask();//see if there are more tasks
+		}
+
+	}
+
+	enum TASK_STATE{
+		RUNNING, FINISHED, PENDING;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/EngineProtocol/EngineProtocolNetwork.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,159 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid.EngineProtocol;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+public class EngineProtocolNetwork extends Thread{
+
+	public static final String GAMEMODE_LOCAL = "TL";
+	public static final String GAMEMODE_DEMO = "TD";
+	public static final String GAMEMODE_NET = "TN";
+	public static final String GAMEMODE_SAVE = "TS";
+	
+	public static final int BUFFER_SIZE = 255; //From iOS code which got it from the origional frontend
+	
+	public static final int MODE_GENLANDPREVIEW = 0;
+	public static final int MODE_GAME = 1;
+
+	private ServerSocket serverSocket;
+	private InputStream input;
+	private OutputStream output;
+	public int port;
+	private final GameConfig config;
+	private boolean clientQuit = false;
+
+	public EngineProtocolNetwork(GameConfig _config){
+		config = _config;
+		try {
+			serverSocket = new ServerSocket(0);
+			port = serverSocket.getLocalPort();
+			Thread ipcThread = new Thread(this, "IPC - Thread");			
+			ipcThread.start();
+		} catch (UnknownHostException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	public void run(){
+		//if(mode == MODE_GENLANDPREVIEW) genLandPreviewIPC();
+		/*else if (mode == MODE_GAME)*/ gameIPC();
+	}
+	
+	private void gameIPC(){
+		Socket sock = null;
+		try{
+			sock = serverSocket.accept();
+			input = sock.getInputStream();
+			output = sock.getOutputStream();
+			
+			int msgSize = 0;
+			byte[] buffer = new byte[BUFFER_SIZE];
+
+			while(!clientQuit){
+				msgSize = 0;
+
+				input.read(buffer, 0, 1);
+				msgSize = buffer[0];
+
+				input.read(buffer, 0, msgSize);
+				System.out.println("IPC" + (char)buffer[0] + " : " + new String(buffer, 1,msgSize-1, "US_ASCII"));
+				switch(buffer[0]){
+				case 'C'://game init
+					config.sendToEngine(this);
+					break;
+				case '?'://ping - pong
+					sendToEngine("!");
+					break;
+				case 'e'://Send protocol version
+					System.out.println(new String(buffer));
+					break;
+				case 'i'://game statistics
+					switch(buffer[1]){
+					case 'r'://winning team
+						break;
+					case 'D'://best shot
+						break;
+					case 'k'://best hedgehog
+						break;
+					case 'K'://# hogs killed
+						break;
+					case 'H'://team health graph
+						break;
+					case 'T':// local team stats
+						break;
+					case 'P'://teams ranking
+						break;
+					case 's'://self damage
+						break;
+					case 'S'://friendly fire
+						break;
+					case 'B'://turn skipped
+						break;
+					default:
+					}
+					break;
+				case 'E'://error - quits game
+					System.out.println(new String(buffer));
+					return;
+				case 'q'://game ended remove save file
+
+				    return;
+				case 'Q'://game ended but not finished
+
+					return;
+				}
+
+			}
+		}catch(IOException e){
+			e.printStackTrace();
+		}finally{
+			try {
+				if(sock != null) sock.close();
+			} catch (IOException e) {}
+			try{
+				if(serverSocket != null) serverSocket.close();
+			} catch (IOException e) {}
+		}
+	}
+
+	public void sendToEngine(String s){
+		int length = s.length();
+		
+		try {
+			output.write(length);
+			output.write(s.getBytes(), 0, length);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	public void quitIPC(){
+		clientQuit = true;
+	}
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/EngineProtocol/GameConfig.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,127 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid.EngineProtocol;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.UUID;
+
+import org.hedgewars.hedgeroid.Datastructures.GameMode;
+import org.hedgewars.hedgeroid.Datastructures.Map;
+import org.hedgewars.hedgeroid.Datastructures.Scheme;
+import org.hedgewars.hedgeroid.Datastructures.Team;
+import org.hedgewars.hedgeroid.Datastructures.Weapon;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+public class GameConfig implements Parcelable{
+	
+	public GameMode mode = GameMode.MODE_LOCAL;
+	public Map map = null;
+	public String theme = null;
+	public Scheme scheme = null;
+	public Weapon weapon = null;
+	
+	public String style = null;
+	public String training = null;
+	public String seed = null;
+	
+	public ArrayList<Team> teams = new ArrayList<Team>();
+	
+	public GameConfig(){
+		
+	}
+	
+	public GameConfig(Parcel in){
+		readFromParcel(in);	
+	}
+	
+
+	
+	public void sendToEngine(EngineProtocolNetwork epn) throws IOException{
+		Log.d("HW_Frontend", "Sending Gameconfig...");
+		int teamCount = 4;
+		epn.sendToEngine("TL"); //Write game mode
+		if(training != null) epn.sendToEngine(String.format("escript Scripts/Training/%s.lua", training));
+		else if(style != null) epn.sendToEngine(String.format("escript Scripts/Multiplayer/%s.lua", style));
+		
+		//seed info
+		epn.sendToEngine(String.format("eseed {%s}", UUID.randomUUID().toString()));
+		
+		map.sendToEngine(epn);
+		//dimensions of the map
+		//templatefilter_command
+		//mapgen_command
+		//mazesize_command
+		
+		epn.sendToEngine(String.format("etheme %s", theme));
+		
+		scheme.sendToEngine(epn);
+		
+		weapon.sendToEngine(epn, teamCount);
+		
+		for(Team t : teams){
+			if(t != null)t.sendToEngine(epn, teamCount, 50);
+		}
+	}
+	
+	public int describeContents() {
+		return 0;
+	}
+
+	public void writeToParcel(Parcel dest, int flags) {
+		dest.writeString(mode.name());
+		dest.writeParcelable(map, flags);
+		dest.writeString(theme);
+		dest.writeParcelable(scheme, flags);
+		dest.writeParcelable(weapon, flags);
+		dest.writeString(style);
+		dest.writeString(training);
+		dest.writeString(seed);
+		dest.writeParcelableArray((Team[])teams.toArray(new Team[1]), 0);
+	}
+	
+	private void readFromParcel(Parcel src){
+		mode = GameMode.valueOf(src.readString());
+		map = src.readParcelable(Map.class.getClassLoader());
+		theme = src.readString();
+		scheme = src.readParcelable(Scheme.class.getClassLoader());
+		weapon = src.readParcelable(Weapon.class.getClassLoader());
+		style = src.readString();
+		training = src.readString();
+		seed = src.readString();
+		Parcelable[] parcelables = src.readParcelableArray(Team[].class.getClassLoader());
+		for(Parcelable team : parcelables){
+			teams.add((Team)team);
+		}
+		
+	}
+	
+	public static final Parcelable.Creator<GameConfig> CREATOR = new Parcelable.Creator<GameConfig>() {
+		public GameConfig createFromParcel(Parcel source) {
+			return new GameConfig(source);
+		}
+		public GameConfig[] newArray(int size) {
+			return new GameConfig[size];
+		}
+	};
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/EngineProtocol/PascalExports.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,40 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid.EngineProtocol;
+
+public class PascalExports {
+
+	static{
+		System.loadLibrary("SDL");
+		System.loadLibrary("SDL_image");
+		System.loadLibrary("mikmod");
+		System.loadLibrary("SDL_net");
+		System.loadLibrary("SDL_mixer");
+		System.loadLibrary("SDL_ttf");
+		System.loadLibrary("lua5.1");
+		System.loadLibrary("hwengine");
+	}
+	
+	public static native int HWversionInfoNetProto();
+	public static native String HWversionInfoVersion();
+	public static native int HWgetNumberOfWeapons();
+	public static native int HWgetMaxNumberOfTeams();
+	public static native int HWgetMaxNumberOfHogs();
+        public static native int HWterminate(boolean b);	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/MainActivity.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,101 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid;
+
+import org.hedgewars.hedgeroid.Downloader.DownloadAssets;
+import org.hedgewars.hedgeroid.Downloader.DownloadListActivity;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.support.v4.app.FragmentActivity;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.Toast;
+
+public class MainActivity extends FragmentActivity {
+
+	private Button downloader, startGame;
+	private ProgressDialog assetsDialog;
+
+	public void onCreate(Bundle sis){
+		super.onCreate(sis);
+		setContentView(R.layout.main);
+
+		downloader = (Button)findViewById(R.id.downloader);
+		startGame = (Button)findViewById(R.id.startGame);
+
+		downloader.setOnClickListener(downloadClicker);
+		startGame.setOnClickListener(startGameClicker);
+
+
+		String cacheDir = Utils.getCachePath(this);
+		if(cacheDir == null){
+			showDialog(0);
+		}else{
+			boolean assetsCopied = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("assetscopied", false);
+
+			if(!assetsCopied){
+				DownloadAssets assetsAsyncTask = new DownloadAssets(this);
+				assetsDialog = ProgressDialog.show(this, "Please wait a moment", "Moving assets...");
+				assetsAsyncTask.execute((Object[])null);
+			}
+		}
+	}
+
+	public Dialog onCreateDialog(int id, Bundle args){
+		AlertDialog.Builder builder = new AlertDialog.Builder(this);
+		builder.setTitle(R.string.sdcard_not_mounted_title);
+		builder.setMessage(R.string.sdcard_not_mounted);
+		builder.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener(){
+			public void onClick(DialogInterface dialog, int which) {
+				finish();				
+			}
+		});
+
+		return builder.create();
+	}
+
+	public void onAssetsDownloaded(boolean result){
+		if(result){
+			PreferenceManager.getDefaultSharedPreferences(this).edit().putBoolean("assetscopied", true).commit();
+		}else{
+			Toast.makeText(this, R.string.download_failed, Toast.LENGTH_LONG);
+		}
+		assetsDialog.dismiss();
+	}
+
+	private OnClickListener downloadClicker = new OnClickListener(){
+		public void onClick(View v){
+			//startActivityForResult(new Intent(getApplicationContext(), DownloadActivity.class), 0);
+			startActivityForResult(new Intent(getApplicationContext(), DownloadListActivity.class), 0);
+		}
+	};
+
+	private OnClickListener startGameClicker = new OnClickListener(){
+		public void onClick(View v){
+			startActivity(new Intent(getApplicationContext(), StartGameActivity.class));
+		}
+	};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/SDLActivity.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,565 @@
+package org.hedgewars.hedgeroid;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.egl.EGLSurface;
+
+import org.hedgewars.hedgeroid.EngineProtocol.EngineProtocolNetwork;
+import org.hedgewars.hedgeroid.EngineProtocol.GameConfig;
+import org.hedgewars.hedgeroid.EngineProtocol.PascalExports;
+import org.hedgewars.hedgeroid.UserInput.TouchInterface;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.PixelFormat;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.media.AudioFormat;
+import android.media.AudioManager;
+import android.media.AudioTrack;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.View;
+
+/**
+ * SDL Activity
+ */
+public class SDLActivity extends Activity {
+
+	// Main components
+	public static SDLActivity mSingleton;
+	public static SDLSurface mSurface;
+
+	// Audio
+	private static Thread mAudioThread;
+	private static AudioTrack mAudioTrack;
+
+	// Load the .so
+	static {
+		System.loadLibrary("SDL");
+		System.loadLibrary("SDL_image");
+		System.loadLibrary("mikmod");
+		System.loadLibrary("SDL_net");
+		System.loadLibrary("SDL_mixer");
+		System.loadLibrary("SDL_ttf");
+		System.loadLibrary("lua5.1");
+		System.loadLibrary("hwengine");
+		System.loadLibrary("main");
+	}
+
+	// Setup
+	protected void onCreate(Bundle savedInstanceState) {
+		// Log.v("SDL", "onCreate()");
+		super.onCreate(savedInstanceState);
+
+		// So we can call stuff from static callbacks
+		mSingleton = this;
+
+		// Set up the surface
+		GameConfig config = getIntent().getParcelableExtra("config");
+		mSurface = new SDLSurface(getApplication(), config);
+		setContentView(mSurface);
+		SurfaceHolder holder = mSurface.getHolder();
+		holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
+	}
+
+	// Events
+	protected void onPause() {
+		// Log.v("SDL", "onPause()");
+		super.onPause();
+
+	}
+
+	protected void onResume() {
+		// Log.v("SDL", "onResume()");
+		super.onResume();
+	}
+	
+	public void onBackPressed(){
+		nativeQuit();
+		super.onBackPressed();
+	}
+
+	// Messages from the SDLMain thread
+	static int COMMAND_CHANGE_TITLE = 1;
+
+	// Handler for the messages
+	Handler commandHandler = new Handler() {
+		public void handleMessage(Message msg) {
+			if (msg.arg1 == COMMAND_CHANGE_TITLE) {
+				setTitle((String) msg.obj);
+			}
+		}
+	};
+
+	// Send a message from the SDLMain thread
+	void sendCommand(int command, Object data) {
+		Message msg = commandHandler.obtainMessage();
+		msg.arg1 = command;
+		msg.obj = data;
+		commandHandler.sendMessage(msg);
+	}
+
+	// C functions we call
+	public static native void nativeInit(String[] argv);
+
+	public static native void nativeQuit();
+
+	public static native void onNativeResize(int x, int y, int format);
+
+	public static native void onNativeKeyDown(int keycode);
+
+	public static native void onNativeKeyUp(int keycode);
+
+	public static native void onNativeTouch(int touchDevId, int pointerFingerId, int action, float x, float y,
+			float p);
+
+	public static native void onNativeAccel(float x, float y, float z);
+
+	public static native void nativeRunAudioThread();
+
+	// Java functions called from C
+
+	public static boolean createGLContext(int majorVersion, int minorVersion) {
+		return mSurface.initEGL(majorVersion, minorVersion);
+	}
+
+	public static void flipBuffers() {
+		mSurface.flipEGL();
+	}
+
+	public static void setActivityTitle(String title) {
+		// Called from SDLMain() thread and can't directly affect the view
+		mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title);
+	}
+
+	// Audio
+	private static Object buf;
+
+	public static Object audioInit(int sampleRate, boolean is16Bit,
+			boolean isStereo, int desiredFrames) {
+		int channelConfig = isStereo ? AudioFormat.CHANNEL_CONFIGURATION_STEREO
+				: AudioFormat.CHANNEL_CONFIGURATION_MONO;
+		int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT
+				: AudioFormat.ENCODING_PCM_8BIT;
+		int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1);
+
+		Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono")
+				+ " " + (is16Bit ? "16-bit" : "8-bit") + " "
+				+ ((float) sampleRate / 1000f) + "kHz, " + desiredFrames
+				+ " frames buffer");
+
+		// Let the user pick a larger buffer if they really want -- but ye
+		// gods they probably shouldn't, the minimums are horrifyingly high
+		// latency already
+		desiredFrames = Math.max(
+				desiredFrames,
+				(AudioTrack.getMinBufferSize(sampleRate, channelConfig,
+						audioFormat) + frameSize - 1)
+						/ frameSize);
+
+		mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate,
+				channelConfig, audioFormat, desiredFrames * frameSize,
+				AudioTrack.MODE_STREAM);
+
+		audioStartThread();
+
+		Log.v("SDL",
+				"SDL audio: got "
+						+ ((mAudioTrack.getChannelCount() >= 2) ? "stereo"
+								: "mono")
+						+ " "
+						+ ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit"
+								: "8-bit") + " "
+						+ ((float) mAudioTrack.getSampleRate() / 1000f)
+						+ "kHz, " + desiredFrames + " frames buffer");
+
+		if (is16Bit) {
+			buf = new short[desiredFrames * (isStereo ? 2 : 1)];
+		} else {
+			buf = new byte[desiredFrames * (isStereo ? 2 : 1)];
+		}
+		return buf;
+	}
+
+	public static void audioStartThread() {
+		mAudioThread = new Thread(new Runnable() {
+			public void run() {
+				mAudioTrack.play();
+				nativeRunAudioThread();
+			}
+		});
+
+		// I'd take REALTIME if I could get it!
+		mAudioThread.setPriority(Thread.MAX_PRIORITY);
+		mAudioThread.start();
+	}
+
+	public static void audioWriteShortBuffer(short[] buffer) {
+		for (int i = 0; i < buffer.length;) {
+			int result = mAudioTrack.write(buffer, i, buffer.length - i);
+			if (result > 0) {
+				i += result;
+			} else if (result == 0) {
+				try {
+					Thread.sleep(1);
+				} catch (InterruptedException e) {
+					// Nom nom
+				}
+			} else {
+				Log.w("SDL", "SDL audio: error return from write(short)");
+				return;
+			}
+		}
+	}
+
+	public static void audioWriteByteBuffer(byte[] buffer) {
+		for (int i = 0; i < buffer.length;) {
+			int result = mAudioTrack.write(buffer, i, buffer.length - i);
+			if (result > 0) {
+				i += result;
+			} else if (result == 0) {
+				try {
+					Thread.sleep(1);
+				} catch (InterruptedException e) {
+					// Nom nom
+				}
+			} else {
+				Log.w("SDL", "SDL audio: error return from write(short)");
+				return;
+			}
+		}
+	}
+
+	public static void audioQuit() {
+		if (mAudioThread != null) {
+			try {
+				mAudioThread.join();
+			} catch (Exception e) {
+				Log.v("SDL", "Problem stopping audio thread: " + e);
+			}
+			mAudioThread = null;
+
+			// Log.v("SDL", "Finished waiting for audio thread");
+		}
+
+		if (mAudioTrack != null) {
+			mAudioTrack.stop();
+			mAudioTrack = null;
+		}
+	}
+}
+
+/**
+ * Simple nativeInit() runnable
+ */
+class SDLMain implements Runnable {
+	private int surfaceWidth, surfaceHeight;
+	private GameConfig config;
+
+	public SDLMain(int width, int height, GameConfig _config) {
+		config = _config;
+		surfaceWidth = width;
+		surfaceHeight = height;
+	}
+
+	public void run() {
+		//Set up the IPC socket server to communicate with the engine
+		EngineProtocolNetwork ipc = new EngineProtocolNetwork(config);
+
+		String path = Utils.getDataPath(SDLActivity.mSingleton);//This represents the data directory
+		path = path.substring(0, path.length()-1);//remove the trailing '/'
+
+		
+		// Runs SDL_main() with added parameters
+		SDLActivity.nativeInit(new String[] { String.valueOf(ipc.port),
+				String.valueOf(surfaceWidth), String.valueOf(surfaceHeight),
+				"0", "null", "xeli", "1", "1", "1", path, ""  });
+
+		try {
+			ipc.quitIPC();
+			ipc.join();
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+		//Log.v("SDL", "SDL thread terminated");
+		SDLActivity.mSingleton.finish();
+	}
+}
+
+/**
+ * SDLSurface. This is what we draw on, so we need to know when it's created in
+ * order to do anything useful.
+ * 
+ * Because of this, that's where we set up the SDL thread
+ */
+class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
+		View.OnKeyListener, SensorEventListener {
+
+	// This is what SDL runs in. It invokes SDL_main(), eventually
+	private Thread mSDLThread;
+
+	// EGL private objects
+	private EGLContext mEGLContext;
+	private EGLSurface mEGLSurface;
+	private EGLDisplay mEGLDisplay;
+
+	// Sensors
+	private static SensorManager mSensorManager;
+
+	private GameConfig config;
+
+	// Startup
+	public SDLSurface(Context context, GameConfig _config) {
+		super(context);
+		getHolder().addCallback(this);
+
+		setFocusable(true);
+		setFocusableInTouchMode(true);
+		requestFocus();
+		setOnKeyListener(this);
+		setOnTouchListener(TouchInterface.getTouchInterface());
+
+		mSensorManager = (SensorManager) context.getSystemService("sensor");
+
+		config = _config;
+	}
+
+	// Called when we have a valid drawing surface
+	public void surfaceCreated(SurfaceHolder holder) {
+		Log.v("SDL", "surfaceCreated()");
+
+		//enableSensor(Sensor.TYPE_ACCELEROMETER, true);
+	}
+
+	// Called when we lose the surface
+	public void surfaceDestroyed(SurfaceHolder holder) {
+		Log.v("SDL", "surfaceDestroyed()");
+
+		// Send a quit message to the application
+		//SDLActivity.nativeQuit();
+                PascalExports.HWterminate(true);
+
+		// Now wait for the SDL thread to quit
+		if (mSDLThread != null) {
+			try {
+				mSDLThread.join();
+			} catch (Exception e) {
+				Log.v("SDL", "Problem stopping thread: " + e);
+			}
+			mSDLThread = null;
+
+			Log.v("SDL", "Finished waiting for SDL thread");
+		}
+
+		//enableSensor(Sensor.TYPE_ACCELEROMETER, false);
+	}
+
+	// Called when the surface is resized
+	public void surfaceChanged(SurfaceHolder holder, int format, int width,
+			int height) {
+		Log.d("SDL", "surfaceChanged()" + width + " + " + height);
+
+		int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default
+		switch (format) {
+		case PixelFormat.A_8:
+			Log.v("SDL", "pixel format A_8");
+			break;
+		case PixelFormat.LA_88:
+			Log.v("SDL", "pixel format LA_88");
+			break;
+		case PixelFormat.L_8:
+			Log.v("SDL", "pixel format L_8");
+			break;
+		case PixelFormat.RGBA_4444:
+			Log.v("SDL", "pixel format RGBA_4444");
+			sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444
+			break;
+		case PixelFormat.RGBA_5551:
+			Log.v("SDL", "pixel format RGBA_5551");
+			sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551
+			break;
+		case PixelFormat.RGBA_8888:
+			Log.v("SDL", "pixel format RGBA_8888");
+			sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888
+			break;
+		case PixelFormat.RGBX_8888:
+			Log.v("SDL", "pixel format RGBX_8888");
+			sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888
+			break;
+		case PixelFormat.RGB_332:
+			Log.v("SDL", "pixel format RGB_332");
+			sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332
+			break;
+		case PixelFormat.RGB_565:
+			Log.v("SDL", "pixel format RGB_565");
+			sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565
+			break;
+		case PixelFormat.RGB_888:
+			Log.v("SDL", "pixel format RGB_888");
+			// Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead?
+			sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888
+			break;
+		default:
+			Log.v("SDL", "pixel format unknown " + format);
+			break;
+		}
+		SDLActivity.onNativeResize(width, height, sdlFormat);
+
+		// Now start up the C app thread
+		if (mSDLThread == null) {
+			mSDLThread = new Thread(new SDLMain(width, height, config),
+					"SDLThread");
+			mSDLThread.start();
+		}
+	}
+
+	// unused
+	public void onDraw(Canvas canvas) {
+	}
+
+	// EGL functions
+	public boolean initEGL(int majorVersion, int minorVersion) {
+		Log.v("SDL", "Starting up OpenGL ES " + majorVersion + "."
+				+ minorVersion);
+
+		try {
+			EGL10 egl = (EGL10) EGLContext.getEGL();
+
+			EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
+
+			int[] version = new int[2];
+			egl.eglInitialize(dpy, version);
+
+			int EGL_OPENGL_ES_BIT = 1;
+			int EGL_OPENGL_ES2_BIT = 4;
+			int renderableType = 0;
+			if (majorVersion == 2) {
+				renderableType = EGL_OPENGL_ES2_BIT;
+			} else if (majorVersion == 1) {
+				renderableType = EGL_OPENGL_ES_BIT;
+			}
+			int[] configSpec = {
+					// EGL10.EGL_DEPTH_SIZE, 16,
+					EGL10.EGL_RENDERABLE_TYPE, renderableType, EGL10.EGL_NONE };
+			EGLConfig[] configs = new EGLConfig[1];
+			int[] num_config = new int[1];
+			if (!egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config)
+					|| num_config[0] == 0) {
+				Log.e("SDL", "No EGL config available");
+				return false;
+			}
+			EGLConfig config = configs[0];
+
+			EGLContext ctx = egl.eglCreateContext(dpy, config,
+					EGL10.EGL_NO_CONTEXT, null);
+			if (ctx == EGL10.EGL_NO_CONTEXT) {
+				Log.e("SDL", "Couldn't create context");
+				return false;
+			}
+
+			EGLSurface surface = egl.eglCreateWindowSurface(dpy, config, this,
+					null);
+			if (surface == EGL10.EGL_NO_SURFACE) {
+				Log.e("SDL", "Couldn't create surface");
+				return false;
+			}
+
+			if (!egl.eglMakeCurrent(dpy, surface, surface, ctx)) {
+				Log.e("SDL", "Couldn't make context current");
+				return false;
+			}
+
+			mEGLContext = ctx;
+			mEGLDisplay = dpy;
+			mEGLSurface = surface;
+
+		} catch (Exception e) {
+			Log.v("SDL", e + "");
+			for (StackTraceElement s : e.getStackTrace()) {
+				Log.v("SDL", s.toString());
+			}
+		}
+
+		return true;
+	}
+
+	// EGL buffer flip
+	public void flipEGL() {
+		try {
+			EGL10 egl = (EGL10) EGLContext.getEGL();
+
+			egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
+
+			// drawing here
+
+			egl.eglWaitGL();
+
+			egl.eglSwapBuffers(mEGLDisplay, mEGLSurface);
+
+		} catch (Exception e) {
+			Log.v("SDL", "flipEGL(): " + e);
+			for (StackTraceElement s : e.getStackTrace()) {
+				Log.v("SDL", s.toString());
+			}
+			
+		}
+	}
+
+	// Key events
+	public boolean onKey(View v, int keyCode, KeyEvent event) {
+                if(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) return false;
+		if (event.getAction() == KeyEvent.ACTION_DOWN) {
+			Log.v("SDL", "key down: " + keyCode);
+			if(keyCode == KeyEvent.KEYCODE_BACK){//TODO ask user to quit or not
+				PascalExports.HWterminate(true);
+				//SDLActivity.mSingleton.finish();
+			}else{
+				SDLActivity.onNativeKeyDown(keyCode);	
+			}
+			
+			return true;
+		} else if (event.getAction() == KeyEvent.ACTION_UP) {
+			Log.v("SDL", "key up: " + keyCode);
+			SDLActivity.onNativeKeyUp(keyCode);
+			return true;
+		}
+
+		return false;
+	}
+
+	// Sensor events
+	public void enableSensor(int sensortype, boolean enabled) {
+		// TODO: This uses getDefaultSensor - what if we have >1 accels?
+		if (enabled) {
+			mSensorManager.registerListener(this,
+					mSensorManager.getDefaultSensor(sensortype),
+					SensorManager.SENSOR_DELAY_GAME, null);
+		} else {
+			mSensorManager.unregisterListener(this,
+					mSensorManager.getDefaultSensor(sensortype));
+		}
+	}
+
+	public void onAccuracyChanged(Sensor sensor, int accuracy) {
+		// TODO
+	}
+
+	public void onSensorChanged(SensorEvent event) {
+		if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
+			SDLActivity.onNativeAccel(event.values[0], event.values[1],
+					event.values[2]);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/StartGameActivity.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,245 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid;
+
+import org.hedgewars.hedgeroid.Datastructures.FrontendDataUtils;
+import org.hedgewars.hedgeroid.Datastructures.Map;
+import org.hedgewars.hedgeroid.Datastructures.Map.MapType;
+import org.hedgewars.hedgeroid.Datastructures.Scheme;
+import org.hedgewars.hedgeroid.Datastructures.Team;
+import org.hedgewars.hedgeroid.Datastructures.Weapon;
+import org.hedgewars.hedgeroid.EngineProtocol.GameConfig;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.preference.PreferenceManager;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.Spinner;
+import android.widget.Toast;
+
+public class StartGameActivity extends Activity {
+
+	public static final int ACTIVITY_TEAM_SELECTOR = 0;
+
+	private GameConfig config = null;
+	private ImageButton start, back, team;
+	private Spinner maps, gameplay, gamescheme, weapons, themes;
+	private ImageView themeIcon, mapPreview, teamCount;
+
+	public void onCreate(Bundle savedInstanceState){
+		super.onCreate(savedInstanceState);
+
+		SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
+		boolean firstTime = sharedPref.getBoolean("firstTime", true);
+		//Copy all the xml files to the device TODO only do first time launch of the app...
+		if(firstTime){
+			sharedPref.edit().putBoolean("firstTime", false).commit();
+			
+			Utils.resRawToFilesDir(this,R.array.schemes, Scheme.DIRECTORY_SCHEME);
+			Utils.resRawToFilesDir(this, R.array.weapons, Weapon.DIRECTORY_WEAPON);
+			Utils.resRawToFilesDir(this, R.array.teams, Team.DIRECTORY_TEAMS);
+		}
+
+		Scheme.parseBasicFlags(this);
+		config = new GameConfig();
+
+		setContentView(R.layout.starting_game);
+
+		back = (ImageButton) findViewById(R.id.btnBack);
+		team = (ImageButton) findViewById(R.id.btnTeams);
+		start = (ImageButton) findViewById(R.id.btnStart);
+
+		maps = (Spinner) findViewById(R.id.spinMaps);
+		gameplay = (Spinner) findViewById(R.id.spinGameplay);
+		gamescheme = (Spinner) findViewById(R.id.spinGamescheme);
+		weapons = (Spinner) findViewById(R.id.spinweapons);
+		themes = (Spinner) findViewById(R.id.spinTheme);
+
+		themeIcon = (ImageView) findViewById(R.id.imgTheme);
+		mapPreview = (ImageView) findViewById(R.id.mapPreview);
+		teamCount = (ImageView) findViewById(R.id.imgTeamsCount);
+
+		start.setOnClickListener(startClicker);
+		back.setOnClickListener(backClicker);
+		team.setOnClickListener(teamClicker);
+
+		ArrayAdapter<?> adapter = new ArrayAdapter<Map>(this, R.layout.listview_item, FrontendDataUtils.getMaps(this));
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		maps.setAdapter(adapter);
+		maps.setOnItemSelectedListener(mapsClicker);
+		//set to first nonmap
+		for(int i = 0; i < adapter.getCount(); i++){
+			if(((Map)adapter.getItem(i)).getType() == MapType.TYPE_DEFAULT){
+				maps.setSelection(i, false);
+				break;
+			}
+		}
+
+		adapter = new ArrayAdapter<String>(this, R.layout.listview_item, FrontendDataUtils.getGameplay(this));
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		gameplay.setAdapter(adapter);
+		gameplay.setOnItemSelectedListener(gameplayClicker);
+		//set to first nonmap
+		for(int i = 0; i < adapter.getCount(); i++){
+			if(((String)adapter.getItem(i)).equals("None")){
+				gameplay.setSelection(i, false);
+				break;
+			}
+		}
+
+		adapter = new ArrayAdapter<Scheme>(this, R.layout.listview_item, FrontendDataUtils.getSchemes(this));
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		gamescheme.setAdapter(adapter);
+		gamescheme.setOnItemSelectedListener(schemeClicker);
+		//set to first nonmap
+		for(int i = 0; i < adapter.getCount(); i++){
+			if(((Scheme)adapter.getItem(i)).toString().equals("Default")){
+				gamescheme.setSelection(i, false);
+				break;
+			}
+		}
+		
+		
+		adapter = new ArrayAdapter<Weapon>(this, R.layout.listview_item, FrontendDataUtils.getWeapons(this));
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		weapons.setAdapter(adapter);
+		weapons.setOnItemSelectedListener(weaponClicker);
+		for(int i = 0; i < adapter.getCount(); i++){
+			if(((Weapon)adapter.getItem(i)).toString().equals("Crazy")){
+				weapons.setSelection(i, false);
+				break;
+			}
+		}
+		adapter = new ArrayAdapter<String>(this, R.layout.listview_item, FrontendDataUtils.getThemes(this));
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		themes.setAdapter(adapter);
+		themes.setOnItemSelectedListener(themesClicker);
+	}
+
+	private void startTeamsActivity(){
+		Intent i = new Intent(StartGameActivity.this, TeamSelectionActivity.class);
+		i.putParcelableArrayListExtra("teams", config.teams);
+		startActivityForResult(i, ACTIVITY_TEAM_SELECTOR);
+	}
+
+	public void onActivityResult(int requestCode, int resultCode, Intent data){
+		switch(requestCode){
+		case ACTIVITY_TEAM_SELECTOR:
+			if(resultCode == Activity.RESULT_OK){
+				Parcelable[] parcelables = (Parcelable[])data.getParcelableArrayExtra("teams");
+				config.teams.clear();
+				for(Parcelable t : parcelables){
+					config.teams.add((Team)t);
+				}
+				teamCount.getDrawable().setLevel(config.teams.size());
+			}
+			break;
+		}
+	}
+
+
+	private OnItemSelectedListener themesClicker = new OnItemSelectedListener(){
+
+		public void onItemSelected(AdapterView<?> arg0, View view, int position, long rowId) {
+			String themeName = (String) arg0.getAdapter().getItem(position);
+			Drawable themeIconDrawable = Drawable.createFromPath(Utils.getDataPath(StartGameActivity.this) + "Themes/" + themeName + "/icon@2X.png");
+			themeIcon.setImageDrawable(themeIconDrawable);
+			config.theme = themeName;
+		}
+
+		public void onNothingSelected(AdapterView<?> arg0) {
+		}
+
+	};
+
+	private OnItemSelectedListener mapsClicker = new OnItemSelectedListener(){
+
+		public void onItemSelected(AdapterView<?> arg0, View view, int position,long rowId) {
+			Map map = (Map)arg0.getAdapter().getItem(position);
+			mapPreview.setImageDrawable(map.getDrawable());
+			config.map = map;
+		}
+
+		public void onNothingSelected(AdapterView<?> arg0) {
+		}
+
+	};
+
+	private OnItemSelectedListener weaponClicker = new OnItemSelectedListener(){
+		public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
+			config.weapon = (Weapon)arg0.getAdapter().getItem(arg2);
+		}
+		public void onNothingSelected(AdapterView<?> arg0) {
+
+		}
+	};
+	private OnItemSelectedListener schemeClicker = new OnItemSelectedListener(){
+		public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
+			config.scheme = (Scheme)arg0.getAdapter().getItem(arg2);
+		}
+		public void onNothingSelected(AdapterView<?> arg0) {
+
+		}
+	};
+	private OnItemSelectedListener gameplayClicker = new OnItemSelectedListener(){
+		public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
+			//config = ()arg0.getAdapter().getItem(arg2);
+		}
+		public void onNothingSelected(AdapterView<?> arg0) {
+
+		}
+	};
+
+	private OnClickListener startClicker = new OnClickListener(){
+		public void onClick(View v) {
+			if(config.teams.size() < 2){
+				Toast.makeText(StartGameActivity.this, R.string.not_enough_teams, Toast.LENGTH_LONG).show();
+				startTeamsActivity();
+			}
+			else{
+				Intent i = new Intent(StartGameActivity.this, SDLActivity.class);
+				i.putExtra("config", config);
+				startActivity(i);}
+		}
+	};
+
+	private OnClickListener backClicker = new OnClickListener(){
+		public void onClick(View v) {
+			finish();
+		}
+	};
+
+	private OnClickListener teamClicker = new OnClickListener(){
+		public void onClick(View v) {
+			startTeamsActivity();
+		}
+	};
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TeamCreatorActivity.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,397 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.hedgewars.hedgeroid.Datastructures.FrontendDataUtils;
+import org.hedgewars.hedgeroid.Datastructures.Team;
+
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.drawable.Drawable;
+import android.media.MediaPlayer;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnFocusChangeListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.ScrollView;
+import android.widget.SimpleAdapter;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class TeamCreatorActivity extends Activity implements Runnable{
+
+	private TextView name;
+	private Spinner difficulty, grave, flag, voice, fort;
+	private ImageView imgFort;
+	private ArrayList<ImageButton> hogDice = new ArrayList<ImageButton>();
+	private ArrayList<Spinner> hogHat = new ArrayList<Spinner>();
+	private ArrayList<EditText> hogName = new ArrayList<EditText>();
+	private ImageButton back, save, voiceButton;
+	private ScrollView scroller;
+	private MediaPlayer mp = null;
+	private boolean settingsChanged = false;
+	private boolean saved = false;
+	private String fileName = null;
+
+	private List<HashMap<String, ?>> flagsData, typesData, gravesData, hatsData;
+	private List<String> voicesData, fortsData;
+
+	public void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.team_creation);
+
+		name = (TextView) findViewById(R.id.txtName);
+		difficulty = (Spinner) findViewById(R.id.spinType);
+		grave = (Spinner) findViewById(R.id.spinGrave);
+		flag = (Spinner) findViewById(R.id.spinFlag);
+		voice = (Spinner) findViewById(R.id.spinVoice);
+		fort = (Spinner) findViewById(R.id.spinFort);
+
+		imgFort = (ImageView) findViewById(R.id.imgFort);
+
+		back = (ImageButton) findViewById(R.id.btnBack);
+		save = (ImageButton) findViewById(R.id.btnSave);
+		voiceButton = (ImageButton) findViewById(R.id.btnPlay);
+
+		scroller = (ScrollView) findViewById(R.id.scroller);
+
+		save.setOnClickListener(saveClicker);
+		back.setOnClickListener(backClicker);
+
+		LinearLayout ll = (LinearLayout) findViewById(R.id.HogsContainer);
+		for (int i = 0; i < ll.getChildCount(); i++) {
+			RelativeLayout team_creation_entry = (RelativeLayout) ll.getChildAt(i);
+
+			hogHat.add((Spinner) team_creation_entry
+					.findViewById(R.id.spinTeam1));
+			hogDice.add((ImageButton) team_creation_entry
+					.findViewById(R.id.btnTeam1));
+			hogName.add((EditText) team_creation_entry
+					.findViewById(R.id.txtTeam1));
+		}
+
+		gravesData = new ArrayList<HashMap<String, ?>>();
+		SimpleAdapter sa = new SimpleAdapter(this, gravesData,
+				R.layout.spinner_textimg_entry, new String[] { "txt", "img" },
+				new int[] { R.id.spinner_txt, R.id.spinner_img });
+		sa.setDropDownViewResource(R.layout.spinner_textimg_dropdown_entry);
+		sa.setViewBinder(viewBinder);
+		grave.setAdapter(sa);
+		grave.setOnFocusChangeListener(focusser);
+
+		flagsData = new ArrayList<HashMap<String, ?>>();
+		sa = new SimpleAdapter(this, flagsData, R.layout.spinner_textimg_entry,
+				new String[] { "txt", "img" }, new int[] { R.id.spinner_txt,
+				R.id.spinner_img });
+		sa.setDropDownViewResource(R.layout.spinner_textimg_dropdown_entry);
+		sa.setViewBinder(viewBinder);
+		flag.setAdapter(sa);
+		flag.setOnFocusChangeListener(focusser);
+
+		typesData = new ArrayList<HashMap<String, ?>>();
+		sa = new SimpleAdapter(this, typesData, R.layout.spinner_textimg_entry,
+				new String[] { "txt", "img" }, new int[] { R.id.spinner_txt,
+				R.id.spinner_img });
+		sa.setDropDownViewResource(R.layout.spinner_textimg_dropdown_entry);
+		difficulty.setAdapter(sa);
+		difficulty.setOnFocusChangeListener(focusser);
+
+		hatsData = new ArrayList<HashMap<String, ?>>();
+		sa = new SimpleAdapter(this, hatsData, R.layout.spinner_textimg_entry,
+				new String[] { "txt", "img" }, new int[] { R.id.spinner_txt,
+				R.id.spinner_img });
+		sa.setDropDownViewResource(R.layout.spinner_textimg_dropdown_entry);
+		sa.setViewBinder(viewBinder);
+		for (Spinner spin : hogHat) {
+			spin.setAdapter(sa);
+		}
+
+		voicesData = new ArrayList<String>();
+		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.listview_item, voicesData);
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		voice.setAdapter(adapter);
+		voice.setOnFocusChangeListener(focusser);
+		voiceButton.setOnClickListener(voiceClicker);
+
+		fortsData = new ArrayList<String>();
+		adapter = new ArrayAdapter<String>(this, R.layout.listview_item, fortsData);
+		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+		fort.setAdapter(adapter);
+		fort.setOnItemSelectedListener(fortSelector);
+		fort.setOnFocusChangeListener(focusser);
+
+		new Thread(this).start();
+	}
+
+	public void run(){
+		ArrayList<HashMap<String, ?>> gravesData = FrontendDataUtils.getGraves(this);
+		ArrayList<HashMap<String, ?>> flagsData = FrontendDataUtils.getFlags(this);
+		ArrayList<HashMap<String, ?>> typesData = FrontendDataUtils.getTypes(this);
+		ArrayList<HashMap<String, ?>> hatsData = FrontendDataUtils.getHats(this);
+		ArrayList<String> voicesData = FrontendDataUtils.getVoices(this);
+		ArrayList<String> fortsData = FrontendDataUtils.getForts(this);
+		
+		copy(this.gravesData, gravesData);
+		copy(this.flagsData, flagsData);
+		copy(this.typesData, typesData);
+		copy(this.hatsData, hatsData);
+		copy(this.voicesData, voicesData);
+		copy(this.fortsData, fortsData);
+		
+		this.runOnUiThread(new Runnable(){
+			public void run() {
+				((SimpleAdapter)grave.getAdapter()).notifyDataSetChanged();
+				((SimpleAdapter)flag.getAdapter()).notifyDataSetChanged();
+				((SimpleAdapter)difficulty.getAdapter()).notifyDataSetChanged();
+				((SimpleAdapter)hogHat.get(0).getAdapter()).notifyDataSetChanged();				
+				((ArrayAdapter<String>)fort.getAdapter()).notifyDataSetChanged();
+				((ArrayAdapter<String>)voice.getAdapter()).notifyDataSetChanged();
+			}
+		});		
+
+	}
+	
+	private static <T> void copy(List<T> dest, List<T> src){
+		for(T t: src) dest.add(t);
+	}
+
+	public void onDestroy() {
+		super.onDestroy();
+		if (mp != null) {
+			mp.release();
+			mp = null;
+		}
+	}
+
+	private OnFocusChangeListener focusser = new OnFocusChangeListener() {
+		public void onFocusChange(View v, boolean hasFocus) {
+			settingsChanged = true;
+		}
+
+	};
+
+	public void onBackPressed() {
+		onFinishing();
+		super.onBackPressed();
+
+	}
+
+	private OnClickListener backClicker = new OnClickListener() {
+		public void onClick(View v) {
+			onFinishing();
+			finish();
+		}
+	};
+
+	private void onFinishing() {
+		if (settingsChanged) {
+			setResult(RESULT_OK);
+		} else {
+			setResult(RESULT_CANCELED);
+		}
+	}
+
+	private OnClickListener saveClicker = new OnClickListener() {
+		public void onClick(View v) {
+			Toast.makeText(TeamCreatorActivity.this, R.string.saved, Toast.LENGTH_SHORT).show();
+			saved = true;
+			Team team = new Team();
+			team.name = name.getText().toString();
+			HashMap<String, Object> hashmap = (HashMap<String, Object>) flag.getSelectedItem();
+
+			team.flag = (String) hashmap.get("txt");
+			team.fort = fort.getSelectedItem().toString();
+			hashmap = (HashMap<String, Object>) grave.getSelectedItem();
+			team.grave = hashmap.get("txt").toString();
+			team.hash = "0";
+			team.voice = voice.getSelectedItem().toString();
+			team.file = fileName;
+
+			hashmap = ((HashMap<String, Object>) difficulty.getSelectedItem());
+			String levelString = hashmap.get("txt").toString();
+			int levelInt;
+			if (levelString.equals(getString(R.string.human))) {
+				levelInt = 0;
+			} else if (levelString.equals(getString(R.string.bot5))) {
+				levelInt = 1;
+			} else if (levelString.equals(getString(R.string.bot4))) {
+				levelInt = 2;
+			} else if (levelString.equals(getString(R.string.bot3))) {
+				levelInt = 3;
+			} else if (levelString.equals(getString(R.string.bot2))) {
+				levelInt = 4;
+			} else {
+				levelInt = 5;
+			}
+
+			for (int i = 0; i < hogName.size(); i++) {
+				team.hogNames[i] = hogName.get(i).getText().toString();
+				hashmap = (HashMap<String, Object>) hogHat.get(i).getSelectedItem();
+				team.hats[i] = hashmap.get("txt").toString();
+				team.levels[i] = levelInt;
+			}
+			try {
+				File teamsDir = new File(getFilesDir().getAbsolutePath() + '/' + Team.DIRECTORY_TEAMS);
+				if (!teamsDir.exists()) teamsDir.mkdir();
+				if(team.file == null){
+					team.setFileName(TeamCreatorActivity.this);
+				}
+				FileOutputStream fos = new FileOutputStream(String.format("%s/%s", teamsDir.getAbsolutePath(), team.file));
+				team.writeToXml(fos);
+			} catch (FileNotFoundException e) {
+				e.printStackTrace();
+			}
+		}
+
+	};
+
+	private OnItemSelectedListener fortSelector = new OnItemSelectedListener() {
+		@SuppressWarnings("unchecked")
+		public void onItemSelected(AdapterView<?> arg0, View arg1,
+				int position, long arg3) {
+			settingsChanged = true;
+			String fortName = (String) arg0.getAdapter().getItem(position);
+			Drawable fortIconDrawable = Drawable.createFromPath(Utils
+					.getDataPath(TeamCreatorActivity.this)
+					+ "Forts/"
+					+ fortName + "L.png");
+			imgFort.setImageDrawable(fortIconDrawable);
+			scroller.fullScroll(ScrollView.FOCUS_DOWN);// Scroll the scrollview
+			// to the bottom, work
+			// around for scollview
+			// invalidation (scrolls
+			// back to top)
+		}
+
+		public void onNothingSelected(AdapterView<?> arg0) {
+		}
+
+	};
+
+	private OnClickListener voiceClicker = new OnClickListener() {
+		public void onClick(View v) {
+			try {
+				File dir = new File(String.format("%sSounds/voices/%s",
+						Utils.getDataPath(TeamCreatorActivity.this),
+						voice.getSelectedItem()));
+				String file = "";
+				File[] dirs = dir.listFiles();
+				File f = dirs[(int) Math.round(Math.random() * dirs.length)];
+				if (f.getName().endsWith(".ogg"))
+					file = f.getAbsolutePath();
+
+				if (mp == null)
+					mp = new MediaPlayer();
+				else
+					mp.reset();
+				mp.setDataSource(file);
+				mp.prepare();
+				mp.start();
+			} catch (IllegalArgumentException e) {
+				e.printStackTrace();
+			} catch (IllegalStateException e) {
+				e.printStackTrace();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+	};
+
+	private void setTeamValues(Team t){
+
+		if (t != null) {
+			name.setText(t.name);
+			int position = ((ArrayAdapter<String>) voice.getAdapter()).getPosition(t.voice);
+			voice.setSelection(position);
+
+			position = ((ArrayAdapter<String>) fort.getAdapter()).getPosition(t.fort);
+			fort.setSelection(position);
+
+			position = 0;
+			for (HashMap<String, ?> hashmap : typesData) {
+				if (hashmap.get("txt").equals(t.levels[0])) {
+					difficulty.setSelection(position);
+					break;
+				}
+			}
+
+			position = 0;
+			for (HashMap<String, ?> hashmap : gravesData) {
+				if (hashmap.get("txt").equals(t.grave)) {
+					grave.setSelection(position);
+					break;
+				}
+			}
+
+			position = 0;
+			for (HashMap<String, ?> hashmap : typesData) {
+				if (hashmap.get("txt").equals(t.flag)) {
+					flag.setSelection(position);
+					break;
+				}
+			}
+
+			for (int i = 0; i < Team.maxNumberOfHogs; i++) {
+				position = 0;
+				for (HashMap<String, ?> hashmap : hatsData) {
+					if (hashmap.get("txt").equals(t.hats[i])) {
+						hogHat.get(i).setSelection(position);
+					}
+				}
+
+				hogName.get(i).setText(t.hogNames[i]);
+			}
+			this.fileName = t.file;
+		}
+	}
+
+
+	private SimpleAdapter.ViewBinder viewBinder = new SimpleAdapter.ViewBinder() {
+
+		public boolean setViewValue(View view, Object data,
+				String textRepresentation) {
+			if (view instanceof ImageView && data instanceof Bitmap) {
+				ImageView v = (ImageView) view;
+				v.setImageBitmap((Bitmap) data);
+				return true;
+			} else {
+				return false;
+			}
+		}
+	};
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TeamSelectionActivity.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,307 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.hedgewars.hedgeroid.Datastructures.FrontendDataUtils;
+import org.hedgewars.hedgeroid.Datastructures.Team;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.view.ContextMenu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.RelativeLayout;
+import android.widget.SimpleAdapter;
+import android.widget.SimpleAdapter.ViewBinder;
+import android.widget.TextView;
+
+public class TeamSelectionActivity extends Activity implements Runnable{
+
+	private static final int ACTIVITY_TEAMCREATION = 0;
+
+	private ImageButton addTeam, back;
+	private ListView availableTeams, selectedTeams;
+	private List<HashMap<String, Object>> availableTeamsList, selectedTeamsList;
+	private TextView txtInfo;
+
+	public void onCreate(Bundle savedInstanceState){
+		super.onCreate(savedInstanceState);
+
+		setContentView(R.layout.team_selector);
+
+		addTeam = (ImageButton) findViewById(R.id.btnAdd);
+		back = (ImageButton) findViewById(R.id.btnBack);
+		txtInfo = (TextView) findViewById(R.id.txtInfo);
+		selectedTeams = (ListView) findViewById(R.id.selectedTeams);
+		availableTeams = (ListView) findViewById(R.id.availableTeams);
+		addTeam.setOnClickListener(addTeamClicker);
+		back.setOnClickListener(backClicker);
+
+		availableTeamsList = new ArrayList<HashMap<String, Object>>();
+		SimpleAdapter adapter = new SimpleAdapter(this, availableTeamsList, R.layout.team_selection_entry_simple, new String[]{"txt", "img"}, new int[]{R.id.txtName, R.id.imgDifficulty});
+		availableTeams.setAdapter(adapter);
+		availableTeams.setOnItemClickListener(availableClicker);
+		registerForContextMenu(availableTeams);
+
+		selectedTeamsList = new ArrayList<HashMap<String, Object>>();
+		adapter = new SimpleAdapter(this, selectedTeamsList, R.layout.team_selection_entry, new String[]{"txt", "img", "color", "count"}, new int[]{R.id.txtName, R.id.imgDifficulty, R.id.teamColor, R.id.teamCount});
+		adapter.setViewBinder(viewBinder);
+		selectedTeams.setAdapter(adapter);
+		selectedTeams.setOnItemClickListener(selectedClicker);
+
+		txtInfo.setText(String.format(getResources().getString(R.string.teams_info_template), selectedTeams.getChildCount()));
+
+		new Thread(this).start();//load the teams from xml async
+	}
+
+	public void run(){
+		List<HashMap<String, Object>> teamsList = FrontendDataUtils.getTeams(this);//teams from xml
+		ArrayList<Team> teamsStartGame = getIntent().getParcelableArrayListExtra("teams");//possible selected teams
+
+		for(HashMap<String, Object> hashmap : teamsList){
+			boolean added = false;
+			for(Team t : teamsStartGame){
+				if(((Team)hashmap.get("team")).equals(t)){//add to available or add to selected
+					selectedTeamsList.add(FrontendDataUtils.teamToMap(t));//create a new hashmap to ensure all variables are entered into the map
+					added = true;
+					break;
+				}
+			}
+			if(!added) availableTeamsList.add(hashmap);
+		}
+
+		this.runOnUiThread(new Runnable(){
+			public void run() {
+				((SimpleAdapter)selectedTeams.getAdapter()).notifyDataSetChanged();
+				((SimpleAdapter)availableTeams.getAdapter()).notifyDataSetChanged();		
+			}
+		});
+	}
+
+	private ViewBinder viewBinder = new ViewBinder(){
+		public boolean setViewValue(View view, Object data,	String textRepresentation) {
+			switch(view.getId()){
+			case R.id.teamColor:
+				setTeamColor(view, (Integer)data);
+				return true;
+			case R.id.teamCount:
+				setTeamHogCount((ImageView)view, (Integer)data);
+				return true;
+			default:
+				return false;
+			}
+		}
+	};
+
+	public void onActivityResult(int requestCode, int resultCode, Intent data){
+		if(requestCode == ACTIVITY_TEAMCREATION){
+			if(resultCode == Activity.RESULT_OK){
+				updateListViews();
+			}
+		}else{
+			super.onActivityResult(requestCode, resultCode, data);
+		}
+	}
+
+	/*
+	 * Updates the list view when TeamCreationActivity is shutdown and the user returns to this point
+	 */
+	private void updateListViews(){
+		unregisterForContextMenu(availableTeams);
+		availableTeamsList = FrontendDataUtils.getTeams(this);
+		ArrayList<HashMap<String, Object>> toBeRemoved = new ArrayList<HashMap<String, Object>>();
+		for(HashMap<String, Object> hashmap : selectedTeamsList){
+			String name = (String)hashmap.get("txt");
+
+			for(HashMap<String, Object> hash : availableTeamsList){
+				if(name.equals((String)hash.get("txt"))){
+					toBeRemoved.add(hash);
+				}
+			}
+		}
+		for(HashMap<String, Object> hash: toBeRemoved) availableTeamsList.remove(hash);
+
+		SimpleAdapter adapter = new SimpleAdapter(this, availableTeamsList, R.layout.team_selection_entry, new String[]{"txt", "img"}, new int[]{R.id.txtName, R.id.imgDifficulty});
+		availableTeams.setAdapter(adapter);
+		registerForContextMenu(availableTeams);
+		availableTeams.setOnItemClickListener(availableClicker);
+
+
+	}
+
+	private void setTeamColor(int position, int color){
+		View iv = ((RelativeLayout)selectedTeams.getChildAt(position)).findViewById(R.id.teamCount);
+		setTeamColor(iv, color);
+	}
+	private void setTeamColor(View iv, int color){
+		iv.setBackgroundColor(0xFF000000 + color);
+	}
+
+	private void setTeamHogCount(int position, int count){
+		ImageView iv = (ImageView)((RelativeLayout)selectedTeams.getChildAt(position)).findViewById(R.id.teamCount);
+		setTeamHogCount(iv, count);
+	}
+
+	private void setTeamHogCount(ImageView iv, int count){
+
+		switch(count){
+		case 0:
+			iv.setImageResource(R.drawable.teamcount0);
+			break;
+		case 1:
+			iv.setImageResource(R.drawable.teamcount1);
+			break;
+		case 2:
+			iv.setImageResource(R.drawable.teamcount2);
+			break;
+		case 3:
+			iv.setImageResource(R.drawable.teamcount3);
+			break;
+		case 4:
+			iv.setImageResource(R.drawable.teamcount4);
+			break;
+		case 5:
+			iv.setImageResource(R.drawable.teamcount5);
+			break;
+		case 6:
+			iv.setImageResource(R.drawable.teamcount6);
+			break;
+		case 7:
+			iv.setImageResource(R.drawable.teamcount7);
+			break;
+		case 8:
+			iv.setImageResource(R.drawable.teamcount8);
+			break;
+		case 9:
+			iv.setImageResource(R.drawable.teamcount9);
+			break;
+		}
+	}
+
+	public void onBackPressed(){
+		returnTeams();
+		super.onBackPressed();
+	}
+
+	private OnClickListener addTeamClicker = new OnClickListener(){
+		public void onClick(View v) {
+			startActivityForResult(new Intent(TeamSelectionActivity.this, TeamCreatorActivity.class), ACTIVITY_TEAMCREATION);
+		}
+	};
+
+	private OnClickListener backClicker = new OnClickListener(){
+		public void onClick(View v){
+			returnTeams();
+			finish();
+		}
+	};
+
+	private OnItemClickListener availableClicker = new OnItemClickListener(){
+		public void onItemClick(AdapterView<?> arg0, View arg1, int position,long arg3) {
+			selectAvailableTeamsItem(position);
+		}
+	};
+	private OnItemClickListener selectedClicker = new OnItemClickListener(){
+		public void onItemClick(AdapterView<?> arg0, View arg1, int position,long arg3) {
+			availableTeamsList.add((HashMap<String, Object>) selectedTeamsList.get(position));
+			selectedTeamsList.remove(position);
+			((SimpleAdapter)availableTeams.getAdapter()).notifyDataSetChanged();
+			((SimpleAdapter)selectedTeams.getAdapter()).notifyDataSetChanged();
+
+			txtInfo.setText(String.format(getResources().getString(R.string.teams_info_template), selectedTeamsList.size()));
+		}
+
+	};
+
+	public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuinfo){
+		menu.add(ContextMenu.NONE, 0, ContextMenu.NONE, R.string.select);
+		menu.add(ContextMenu.NONE, 2, ContextMenu.NONE, R.string.edit);
+		menu.add(ContextMenu.NONE, 1, ContextMenu.NONE, R.string.delete);
+
+	}
+	public boolean onContextItemSelected(MenuItem item){
+		AdapterView.AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
+		int position = menuInfo.position;
+		switch(item.getItemId()){
+		case 0://select
+			selectAvailableTeamsItem(position);
+			return true;
+		case 1://delete
+			Team team = (Team)availableTeamsList.get(position).get("team");
+			File f = new File(String.format("%s/%s/%s", TeamSelectionActivity.this.getFilesDir(), Team.DIRECTORY_TEAMS, team.file));
+			f.delete();
+			availableTeamsList.remove(position);
+			((SimpleAdapter)availableTeams.getAdapter()).notifyDataSetChanged();
+			return true;
+		case 2://edit
+			Intent i = new Intent(TeamSelectionActivity.this, TeamCreatorActivity.class);
+			Team t = (Team)availableTeamsList.get(position).get("team");
+			i.putExtra("team", t);
+			startActivityForResult(i, ACTIVITY_TEAMCREATION);
+			return true;
+		}
+		return false;
+	}
+
+	private void selectAvailableTeamsItem(int position){
+		HashMap<String, Object> hash = (HashMap<String, Object>) availableTeamsList.get(position);
+		Team t = (Team)hash.get("team");
+		int[] illegalcolors = new int[selectedTeamsList.size()];
+		for(int i = 0; i < selectedTeamsList.size(); i++){
+			illegalcolors[i] = ((Team)selectedTeamsList.get(i).get("team")).color;
+		}
+		t.setRandomColor(illegalcolors);
+		hash.put("color", t.color);
+		hash.put("count", t.hogCount);
+
+		selectedTeamsList.add(hash);
+		availableTeamsList.remove(position);
+		((SimpleAdapter)availableTeams.getAdapter()).notifyDataSetChanged();
+		((SimpleAdapter)selectedTeams.getAdapter()).notifyDataSetChanged();
+
+		txtInfo.setText(String.format(getResources().getString(R.string.teams_info_template), selectedTeamsList.size()));
+	}
+
+	private void returnTeams(){
+		int teamsCount = selectedTeamsList.size();
+		Intent i = new Intent();
+		Parcelable[] teams = new Parcelable[teamsCount];
+		for(int x = 0 ; x < teamsCount; x++){
+			teams[x] = (Team)selectedTeamsList.get(x).get("team");
+		}
+		i.putExtra("teams", teams);
+		setResult(Activity.RESULT_OK, i);
+
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/TextImageAdapter.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,74 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.SimpleAdapter;
+import android.widget.TextView;
+
+
+public class TextImageAdapter extends SimpleAdapter {
+
+	private Context context;
+	private ArrayList<Map<String, ?>> data;
+	
+	public TextImageAdapter(Context _context, ArrayList<Map<String, ?>> _data, int resource, String[] from, int[] to) {
+		super(_context, _data, resource, from, to);
+		context = _context;
+		data = _data;
+	}
+	
+	public static TextImageAdapter createAdapter(Context c, String[] txt, String[] img, String[] from, int[] to){
+		if(txt.length != img.length) throw new IllegalArgumentException("txt and img parameters not equal");
+		
+		ArrayList<Map<String, ?>> data = new ArrayList<Map<String, ?>>(txt.length);
+		
+		for(int i = 0; i < txt.length; i++){
+			HashMap<String, Object> map = new HashMap<String, Object>();
+			map.put("txt", txt[i]);
+			map.put("img", BitmapFactory.decodeFile(img[i]));
+			data.add(map);
+		}
+		return new TextImageAdapter(c, data, R.layout.spinner_textimg_entry, from, to);
+	}
+
+	public View getView(int position, View convertView, ViewGroup parent){
+		if(convertView == null){
+			LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+			convertView = inflater.inflate(R.layout.spinner_textimg_entry, parent);
+		}
+		TextView tv = (TextView) convertView.findViewById(R.id.spinner_txt);
+		ImageView img = (ImageView) convertView.findViewById(R.id.spinner_img);
+		
+		tv.setText((String)data.get(position).get("txt"));
+		img.setImageBitmap((Bitmap)data.get(position).get("img"));
+		
+		return convertView;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/UserInput/TouchInterface.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,103 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+package org.hedgewars.hedgeroid.UserInput;
+
+import org.hedgewars.hedgeroid.SDLActivity;
+
+import android.os.Build;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnTouchListener;
+
+public class TouchInterface{
+
+	public static OnTouchListener getTouchInterface(){
+		OnTouchListener toucher;
+		if(Build.VERSION.SDK_INT < 5){//8 == Build.VERSION_CODES.FROYO
+			toucher = new TouchInterfaceST();
+		}else{
+			toucher = new TouchInterfaceMT();
+		}
+
+		return toucher;
+	}
+}
+/**
+ * Touch interface with multitouch
+ */
+class TouchInterfaceMT implements OnTouchListener {
+	
+	private boolean firstEvent = true;
+	
+	public boolean onTouch(View v, MotionEvent event) {
+		//dumpEvent(event);
+		
+		int action = event.getAction();
+		int actionCode = action & MotionEvent.ACTION_MASK;
+		
+		for (int i = 0; i < event.getPointerCount(); i++) {
+			SDLActivity.onNativeTouch(event.getDeviceId(),  event.getPointerId(i), actionCode, (int)event.getX(i), (int)event.getY(i), event.getPressure(i));
+//			Log.d("Android", String.format("x=%f, y=%f, pntr=%d", event.getX(i), event.getY(i), event.getPointerId(i)));
+		   }
+		return true;
+	}
+
+	/** Show an event in the LogCat view, for debugging */
+	private void dumpEvent(MotionEvent event) {
+	   String names[] = { "DOWN" , "UP" , "MOVE" , "CANCEL" , "OUTSIDE" ,
+	      "POINTER_DOWN" , "POINTER_UP" , "7?" , "8?" , "9?" };
+	   StringBuilder sb = new StringBuilder();
+	   int action = event.getAction();
+	   int actionCode = action & MotionEvent.ACTION_MASK;
+	   sb.append("event ACTION_" ).append(names[actionCode]);
+	   if (actionCode == MotionEvent.ACTION_POINTER_DOWN
+	         || actionCode == MotionEvent.ACTION_POINTER_UP) {
+	      sb.append("(pid " ).append(
+	      action >> MotionEvent.ACTION_POINTER_ID_SHIFT);
+	      sb.append(")" );
+	   }
+	   sb.append("[" );
+	   for (int i = 0; i < event.getPointerCount(); i++) {
+	      sb.append("#" ).append(i);
+	      sb.append("(pid " ).append(event.getPointerId(i));
+	      sb.append(")=" ).append((int) event.getX(i));
+	      sb.append("," ).append((int) event.getY(i));
+	      if (i + 1 < event.getPointerCount())
+	         sb.append(";" );
+	   }
+	   sb.append("]" );
+	   Log.d("HW_APP_TOUCH", sb.toString());
+	}
+
+}
+
+/**
+ * Touch interface without multitouch
+ */
+class TouchInterfaceST implements OnTouchListener {
+
+	public boolean onTouch(View v, MotionEvent event) {
+		return false;
+	}
+
+
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Utils.java	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,221 @@
+/*
+ * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+package org.hedgewars.hedgeroid;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.os.Build;
+import android.os.Environment;
+import android.util.Log;
+
+public class Utils {
+
+	private static final String ROOT_DIR = "Data/";
+
+	/**
+	 * get the path to which we should download all the data files
+	 * @param c context 
+	 * @return absolute path
+	 */
+	public static String getCachePath(Context c){
+		if(Build.VERSION.SDK_INT < 8){//8 == Build.VERSION_CODES.FROYO
+			return PreFroyoSDCardDir.getDownloadPath(c) + '/';
+		}else{
+			return FroyoSDCardDir.getDownloadPath(c) + '/';
+		}
+	}
+
+	public static String getDataPath(Context c){
+		return getCachePath(c) + ROOT_DIR;
+	}
+
+	static class FroyoSDCardDir{
+		public static String getDownloadPath(Context c){
+			File f =  c.getExternalCacheDir();
+			if(f != null){
+				return f.getAbsolutePath();
+			}else{
+				return null;
+			}	
+		}
+	}
+
+	static class PreFroyoSDCardDir{
+		public static String getDownloadPath(Context c){
+			if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
+				if(Environment.getExternalStorageDirectory() != null)
+					return Environment.getExternalStorageDirectory().getAbsolutePath() + "/Hedgewars/";				
+			}
+			return null;
+		}
+	}
+
+	/**
+	 * Get files from dirName, dir name is relative to {@link getDownloadPath}
+	 * @param dirName
+	 * @param c context
+	 * @return string of files
+	 */
+	public static String[] getFileNamesFromRelativeDir(Context c, String dirName){
+		String prefix = getDataPath(c);
+		File f = new File(prefix + dirName);
+
+		if(f.exists() && f.isDirectory()) return f.list();
+		else{
+
+			Log.e("Utils::", "Couldn't find dir: " + dirName);
+			return new String[0];
+		}
+	}
+
+	/**
+	 * Return a File array with all the files from dirName
+	 * @param c
+	 * @param dirName
+	 * @return
+	 */
+	public static File[] getFilesFromRelativeDir(Context c, String dirName){
+		String prefix = getDataPath(c);
+		File f = new File(prefix + dirName);
+
+		if(f.exists() && f.isDirectory()) return f.listFiles();
+		else {
+			Log.e("Utils::", "Dir not found: " + dirName);
+			return new File[0];
+		}
+	}
+
+	/**
+	 * Checks if this directory has a file with suffix suffix
+	 * @param f - directory
+	 * @return
+	 */
+	public static boolean hasFileWithSuffix(File f, String suffix){
+		if(f.isDirectory()){
+			for(String s : f.list()){
+				if(s.endsWith(suffix)) return true;
+			}
+			return false;
+		}else{
+			return false;
+		}
+	}
+
+	/**
+	 * Gives back all dirs which contain a file with suffix fileSuffix
+	 * @param c
+	 * @param path
+	 * @param fileSuffix
+	 * @return
+	 */
+	public static List<String> getDirsWithFileSuffix(Context c, String path, String fileSuffix){
+		File[] files = getFilesFromRelativeDir(c,path);
+		ArrayList<String> ret = new ArrayList<String>();
+
+		for(File f : files){
+			if(hasFileWithSuffix(f, fileSuffix)) ret.add(f.getName());
+		}
+		return ret;
+	}
+
+	/**
+	 * Get all files from directory dir which have the given suffix
+	 * @param c
+	 * @param dir
+	 * @param suffix
+	 * @param removeSuffix
+	 * @return
+	 */
+	public static ArrayList<String> getFilesFromDirWithSuffix(Context c, String dir, String suffix, boolean removeSuffix){
+		String[] files = Utils.getFileNamesFromRelativeDir(c, dir);
+		ArrayList<String> ret = new ArrayList<String>();
+		for(String s : files){
+			if(s.endsWith(suffix)){
+				if(removeSuffix) ret.add(s.substring(0, s.length()-suffix.length()));
+				else ret.add(s);
+			}
+		}
+		return ret;
+	}
+
+	/**
+	 * Moves resources pointed to by sourceResId (from @res/raw/) to the app's private data directory
+	 * @param c
+	 * @param sourceResId
+	 * @param directory
+	 */
+	public static void resRawToFilesDir(Context c, int sourceResId, String directory){
+		byte[] buffer = new byte[1024];
+		InputStream bis = null;
+		BufferedOutputStream bos = null;
+		File schemesDirFile = new File(c.getFilesDir().getAbsolutePath() + '/' + directory);
+		schemesDirFile.mkdirs();
+		String schemesDirPath = schemesDirFile.getAbsolutePath() + '/';
+
+		//Get an array with the resource files ID
+		TypedArray ta = c.getResources().obtainTypedArray(sourceResId);
+		int[] resIds = new int[ta.length()];
+		for(int i = 0; i < ta.length(); i++){
+			resIds[i] = ta.getResourceId(i, 0);
+		}
+
+		for(int id : resIds){
+			String fileName = c.getResources().getResourceEntryName(id);
+			File f = new File(schemesDirPath + fileName);
+			try {
+				if(!f.createNewFile()){
+					f.delete();
+					f.createNewFile();
+				}
+
+				bis = c.getResources().openRawResource(id);
+				bos = new BufferedOutputStream(new FileOutputStream(f), 1024);
+				int read = 0;
+				while((read = bis.read(buffer)) != -1){
+					bos.write(buffer, 0, read);
+				}
+
+			} catch (IOException e) {
+				e.printStackTrace();
+			}finally{
+				if(bis != null)
+					try { 
+						bis.close();
+					} catch (IOException e) {
+						e.printStackTrace();
+					}
+					if(bos != null)
+						try {
+							bos.close();
+						} catch (IOException e) {
+							e.printStackTrace();
+						}
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/Makefile.android	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,27 @@
+SDL_ANDROID_DIR=./SDL-android-project
+
+PPCROSSARM=${FPC_DIR}/compiler/ppcrossarm
+PPCROSSARM_FLAGS= -Xd -O- -Tlinux -XParm-linux-androideabi- -vwnh -XS -a- -B
+PPCROSSARM_INCLUDES= \
+	-FD${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin \
+	-Fu${FPC_DIR}/rtl/units/arm-linux \
+	-Fl${ANDROID_NDK}/platforms/android-${ANDROID_NDK_API_LVL}/arch-arm/usr/lib \
+	-Fl$(SDL_ANDROID_DIR)/libs/armeabi \
+	-Fl${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux/arm-linux-androideabi/4.4.3/ \
+#LINKERFLAGS= -k"--static"
+FPC_DEFINES=-dandroid -darm
+
+
+all:
+	-${CMAKE_COMMAND} -E make_directory out
+
+	${ANDROID_NDK}/ndk-build -C $(SDL_ANDROID_DIR) -j 8
+
+	$(PPCROSSARM) $(LINKERFLAGS) $(PPCROSSARM_FLAGS) $(PPCROSSARM_INCLUDES) $(FPC_DEFINES) -oout/libhwengine.so ../../hedgewars/hwLibrary.pas
+	${CMAKE_COMMAND} -E copy out/libhwengine.so SDL-android-project/libs/armeabi/
+
+	${ANT} install -f $(SDL_ANDROID_DIR)/build.xml
+clean:  
+	${CMAKE_COMMAND} -E remove_directory out
+	${ANDROID_NDK}/ndk-build -C $(SDL_ANDROID_DIR) -j 8 clean
+	${ANT} clean -f $(SDL_ANDROID_DIR)/build.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/complete_build.sh	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+
+cd SDL-android-project
+${ANDROID_NDK}/ndk-build -j 8
+if [ $? -ne 0 ] 
+then 
+  echo "Failed to execute ${ANDROID_NDK}/ndk-build"
+  exit 1
+fi
+
+cd ..
+make -f Makefile.android
+if [ $? -ne 0 ] 
+then 
+  echo "Failed to execute make"
+  exit 1
+fi
+
+cd SDL-android-project
+ant install
+if [ $? -ne 0 ] 
+then 
+  echo "Failed to execute ant install"
+  exit 1
+fi
+exit 0 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/default.properties	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,1 @@
+target=android-${ANDROID_SDK_API_LVL}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/local.properties	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,1 @@
+sdk.dir=${ANDROID_SDK}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/Templates/pushToDevice.sh	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+${ANDROID_SDK}/platform-tools/adb push ./out/libhwengine.so /sdcard/libhwengine.so
+${ANDROID_SDK}/platform-tools/adb shell "su -c \"cat /sdcard/libhwengine.so > /data/data/org.hedgewars.mobile/lib/libhwengine.so \""
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/gles11.pp	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,1120 @@
+(*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2011 Richard Deurwaarder <xeli@xelification.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *)
+
+{$mode objfpc}
+unit gles11;
+interface
+
+{
+  Automatically converted by H2Pas 1.0.0 from gl.hh
+  The following command line parameters were used:
+    -P
+    -l
+    GLESv1_CM
+    -o
+    gles11.pp
+    -D
+    gl.hh
+}
+
+  procedure init;
+
+  const
+    External_library='GLESv1_CM'; {Setup as you need}
+
+  Type
+ 
+//     khronos_int32_t = int32_t;
+//     khronos_uint32_t = uint32_t;
+//     khronos_int64_t = int64_t;
+//     khronos_uint64_t = uint64_t;
+
+  khronos_int32_t = longint;
+  khronos_uint32_t = longword;
+  khronos_int64_t = Int64;
+  khronos_uint64_t = QWord;
+  khronos_int8_t = char;
+  khronos_uint8_t = byte;
+  khronos_int16_t = smallint;
+  khronos_uint16_t = word;
+  khronos_intptr_t = longint;
+  khronos_uintptr_t = dword;
+  khronos_ssize_t = longint;
+  khronos_usize_t = dword;
+  khronos_float_t = single;
+
+  GLvoid = pointer;
+  GLenum = dword;
+  GLboolean = byte;
+  GLbitfield = dword;
+  GLshort = smallint;
+  GLint = longint;
+  GLsizei = longint;
+  GLushort = word;
+  GLuint = dword;
+
+  GLbyte = khronos_int8_t;
+  GLubyte = khronos_uint8_t;
+  GLfloat = khronos_float_t;
+  GLclampf = khronos_float_t;
+  GLfixed = khronos_int32_t;
+  GLclampx = khronos_int32_t;
+  GLintptr = khronos_intptr_t;
+  GLsizeiptr = khronos_ssize_t;
+
+  PGLboolean  = ^GLboolean;
+  PGLfixed  = ^GLfixed;
+  PGLfloat  = ^GLfloat;
+  PGLint  = ^GLint;
+  PGLuint  = ^GLuint;
+  PGLvoid  = ^GLvoid;
+  PGLubyte = ^GLubyte;
+{$IFDEF FPC}
+{$PACKRECORDS C}
+{$ENDIF}
+
+  const
+//    GL_API = KHRONOS_APICALL;     
+{$define KHRONOS_APIENTRY}  
+     GL_DIRECT_TEXTURE_2D_QUALCOMM = $7E80;     
+
+  {*********************************************************** }
+  { OpenGL ES core versions  }
+
+  const
+     GL_VERSION_ES_CM_1_0 = 1;     
+     GL_VERSION_ES_CL_1_0 = 1;     
+     GL_VERSION_ES_CM_1_1 = 1;     
+     GL_VERSION_ES_CL_1_1 = 1;     
+  { ClearBufferMask  }
+     GL_DEPTH_BUFFER_BIT = $00000100;     
+     GL_STENCIL_BUFFER_BIT = $00000400;     
+     GL_COLOR_BUFFER_BIT = $00004000;     
+  { Boolean  }
+     GL_FALSE = 0;     
+     GL_TRUE = 1;     
+  { BeginMode  }
+     GL_POINTS = $0000;     
+     GL_LINES = $0001;     
+     GL_LINE_LOOP = $0002;     
+     GL_LINE_STRIP = $0003;     
+     GL_TRIANGLES = $0004;     
+     GL_TRIANGLE_STRIP = $0005;     
+     GL_TRIANGLE_FAN = $0006;     
+  { AlphaFunction  }
+     GL_NEVER = $0200;     
+     GL_LESS = $0201;     
+     GL_EQUAL = $0202;     
+     GL_LEQUAL = $0203;     
+     GL_GREATER = $0204;     
+     GL_NOTEQUAL = $0205;     
+     GL_GEQUAL = $0206;     
+     GL_ALWAYS = $0207;     
+  { BlendingFactorDest  }
+     GL_ZERO = 0;     
+     GL_ONE = 1;     
+     GL_SRC_COLOR = $0300;     
+     GL_ONE_MINUS_SRC_COLOR = $0301;     
+     GL_SRC_ALPHA = $0302;     
+     GL_ONE_MINUS_SRC_ALPHA = $0303;     
+     GL_DST_ALPHA = $0304;     
+     GL_ONE_MINUS_DST_ALPHA = $0305;     
+  { BlendingFactorSrc  }
+  {      GL_ZERO  }
+  {      GL_ONE  }
+     GL_DST_COLOR = $0306;     
+     GL_ONE_MINUS_DST_COLOR = $0307;     
+     GL_SRC_ALPHA_SATURATE = $0308;     
+  {      GL_SRC_ALPHA  }
+  {      GL_ONE_MINUS_SRC_ALPHA  }
+  {      GL_DST_ALPHA  }
+  {      GL_ONE_MINUS_DST_ALPHA  }
+  { ClipPlaneName  }
+     GL_CLIP_PLANE0 = $3000;     
+     GL_CLIP_PLANE1 = $3001;     
+     GL_CLIP_PLANE2 = $3002;     
+     GL_CLIP_PLANE3 = $3003;     
+     GL_CLIP_PLANE4 = $3004;     
+     GL_CLIP_PLANE5 = $3005;     
+  { ColorMaterialFace  }
+  {      GL_FRONT_AND_BACK  }
+  { ColorMaterialParameter  }
+  {      GL_AMBIENT_AND_DIFFUSE  }
+  { ColorPointerType  }
+  {      GL_UNSIGNED_BYTE  }
+  {      GL_FLOAT  }
+  {      GL_FIXED  }
+  { CullFaceMode  }
+     GL_FRONT = $0404;     
+     GL_BACK = $0405;     
+     GL_FRONT_AND_BACK = $0408;     
+  { DepthFunction  }
+  {      GL_NEVER  }
+  {      GL_LESS  }
+  {      GL_EQUAL  }
+  {      GL_LEQUAL  }
+  {      GL_GREATER  }
+  {      GL_NOTEQUAL  }
+  {      GL_GEQUAL  }
+  {      GL_ALWAYS  }
+  { EnableCap  }
+     GL_FOG = $0B60;     
+     GL_LIGHTING = $0B50;     
+     GL_TEXTURE_2D = $0DE1;     
+     GL_CULL_FACE = $0B44;     
+     GL_ALPHA_TEST = $0BC0;     
+     GL_BLEND = $0BE2;     
+     GL_COLOR_LOGIC_OP = $0BF2;     
+     GL_DITHER = $0BD0;     
+     GL_STENCIL_TEST = $0B90;     
+     GL_DEPTH_TEST = $0B71;     
+  {      GL_LIGHT0  }
+  {      GL_LIGHT1  }
+  {      GL_LIGHT2  }
+  {      GL_LIGHT3  }
+  {      GL_LIGHT4  }
+  {      GL_LIGHT5  }
+  {      GL_LIGHT6  }
+  {      GL_LIGHT7  }
+     GL_POINT_SMOOTH = $0B10;     
+     GL_LINE_SMOOTH = $0B20;     
+     GL_SCISSOR_TEST = $0C11;     
+     GL_COLOR_MATERIAL = $0B57;     
+     GL_NORMALIZE = $0BA1;     
+     GL_RESCALE_NORMAL = $803A;     
+     GL_POLYGON_OFFSET_FILL = $8037;     
+     GL_VERTEX_ARRAY = $8074;     
+     GL_NORMAL_ARRAY = $8075;     
+     GL_COLOR_ARRAY = $8076;     
+     GL_TEXTURE_COORD_ARRAY = $8078;     
+     GL_MULTISAMPLE = $809D;     
+     GL_SAMPLE_ALPHA_TO_COVERAGE = $809E;     
+     GL_SAMPLE_ALPHA_TO_ONE = $809F;     
+     GL_SAMPLE_COVERAGE = $80A0;     
+  { ErrorCode  }
+     GL_NO_ERROR = 0;     
+     GL_INVALID_ENUM = $0500;     
+     GL_INVALID_VALUE = $0501;     
+     GL_INVALID_OPERATION = $0502;     
+     GL_STACK_OVERFLOW = $0503;     
+     GL_STACK_UNDERFLOW = $0504;     
+     GL_OUT_OF_MEMORY = $0505;     
+  { FogMode  }
+  {      GL_LINEAR  }
+     GL_EXP = $0800;     
+     GL_EXP2 = $0801;     
+  { FogParameter  }
+     GL_FOG_DENSITY = $0B62;     
+     GL_FOG_START = $0B63;     
+     GL_FOG_END = $0B64;     
+     GL_FOG_MODE = $0B65;     
+     GL_FOG_COLOR = $0B66;     
+  { FrontFaceDirection  }
+     GL_CW = $0900;     
+     GL_CCW = $0901;     
+  { GetPName  }
+     GL_CURRENT_COLOR = $0B00;     
+     GL_CURRENT_NORMAL = $0B02;     
+     GL_CURRENT_TEXTURE_COORDS = $0B03;     
+     GL_POINT_SIZE = $0B11;     
+     GL_POINT_SIZE_MIN = $8126;     
+     GL_POINT_SIZE_MAX = $8127;     
+     GL_POINT_FADE_THRESHOLD_SIZE = $8128;     
+     GL_POINT_DISTANCE_ATTENUATION = $8129;     
+     GL_SMOOTH_POINT_SIZE_RANGE = $0B12;     
+     GL_LINE_WIDTH = $0B21;     
+     GL_SMOOTH_LINE_WIDTH_RANGE = $0B22;     
+     GL_ALIASED_POINT_SIZE_RANGE = $846D;     
+     GL_ALIASED_LINE_WIDTH_RANGE = $846E;     
+     GL_CULL_FACE_MODE = $0B45;     
+     GL_FRONT_FACE = $0B46;     
+     GL_SHADE_MODEL = $0B54;     
+     GL_DEPTH_RANGE = $0B70;     
+     GL_DEPTH_WRITEMASK = $0B72;     
+     GL_DEPTH_CLEAR_VALUE = $0B73;     
+     GL_DEPTH_FUNC = $0B74;     
+     GL_STENCIL_CLEAR_VALUE = $0B91;     
+     GL_STENCIL_FUNC = $0B92;     
+     GL_STENCIL_VALUE_MASK = $0B93;     
+     GL_STENCIL_FAIL = $0B94;     
+     GL_STENCIL_PASS_DEPTH_FAIL = $0B95;     
+     GL_STENCIL_PASS_DEPTH_PASS = $0B96;     
+     GL_STENCIL_REF = $0B97;     
+     GL_STENCIL_WRITEMASK = $0B98;     
+     GL_MATRIX_MODE = $0BA0;     
+     GL_VIEWPORT = $0BA2;     
+     GL_MODELVIEW_STACK_DEPTH = $0BA3;     
+     GL_PROJECTION_STACK_DEPTH = $0BA4;     
+     GL_TEXTURE_STACK_DEPTH = $0BA5;     
+     GL_MODELVIEW_MATRIX = $0BA6;     
+     GL_PROJECTION_MATRIX = $0BA7;     
+     GL_TEXTURE_MATRIX = $0BA8;     
+     GL_ALPHA_TEST_FUNC = $0BC1;     
+     GL_ALPHA_TEST_REF = $0BC2;     
+     GL_BLEND_DST = $0BE0;     
+     GL_BLEND_SRC = $0BE1;     
+     GL_LOGIC_OP_MODE = $0BF0;     
+     GL_SCISSOR_BOX = $0C10;     
+//     GL_SCISSOR_TEST = $0C11;     
+     GL_COLOR_CLEAR_VALUE = $0C22;     
+     GL_COLOR_WRITEMASK = $0C23;     
+     GL_UNPACK_ALIGNMENT = $0CF5;     
+     GL_PACK_ALIGNMENT = $0D05;     
+     GL_MAX_LIGHTS = $0D31;     
+     GL_MAX_CLIP_PLANES = $0D32;     
+     GL_MAX_TEXTURE_SIZE = $0D33;     
+     GL_MAX_MODELVIEW_STACK_DEPTH = $0D36;     
+     GL_MAX_PROJECTION_STACK_DEPTH = $0D38;     
+     GL_MAX_TEXTURE_STACK_DEPTH = $0D39;     
+     GL_MAX_VIEWPORT_DIMS = $0D3A;     
+     GL_MAX_TEXTURE_UNITS = $84E2;     
+     GL_SUBPIXEL_BITS = $0D50;     
+     GL_RED_BITS = $0D52;     
+     GL_GREEN_BITS = $0D53;     
+     GL_BLUE_BITS = $0D54;     
+     GL_ALPHA_BITS = $0D55;     
+     GL_DEPTH_BITS = $0D56;     
+     GL_STENCIL_BITS = $0D57;     
+     GL_POLYGON_OFFSET_UNITS = $2A00;     
+//     GL_POLYGON_OFFSET_FILL = $8037;     
+     GL_POLYGON_OFFSET_FACTOR = $8038;     
+     GL_TEXTURE_BINDING_2D = $8069;     
+     GL_VERTEX_ARRAY_SIZE = $807A;     
+     GL_VERTEX_ARRAY_TYPE = $807B;     
+     GL_VERTEX_ARRAY_STRIDE = $807C;     
+     GL_NORMAL_ARRAY_TYPE = $807E;     
+     GL_NORMAL_ARRAY_STRIDE = $807F;     
+     GL_COLOR_ARRAY_SIZE = $8081;     
+     GL_COLOR_ARRAY_TYPE = $8082;     
+     GL_COLOR_ARRAY_STRIDE = $8083;     
+     GL_TEXTURE_COORD_ARRAY_SIZE = $8088;     
+     GL_TEXTURE_COORD_ARRAY_TYPE = $8089;     
+     GL_TEXTURE_COORD_ARRAY_STRIDE = $808A;     
+     GL_VERTEX_ARRAY_POINTER = $808E;     
+     GL_NORMAL_ARRAY_POINTER = $808F;     
+     GL_COLOR_ARRAY_POINTER = $8090;     
+     GL_TEXTURE_COORD_ARRAY_POINTER = $8092;     
+     GL_SAMPLE_BUFFERS = $80A8;     
+     GL_SAMPLES = $80A9;     
+     GL_SAMPLE_COVERAGE_VALUE = $80AA;     
+     GL_SAMPLE_COVERAGE_INVERT = $80AB;     
+  { GetTextureParameter  }
+  {      GL_TEXTURE_MAG_FILTER  }
+  {      GL_TEXTURE_MIN_FILTER  }
+  {      GL_TEXTURE_WRAP_S  }
+  {      GL_TEXTURE_WRAP_T  }
+     GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2;     
+     GL_COMPRESSED_TEXTURE_FORMATS = $86A3;     
+  { HintMode  }
+     GL_DONT_CARE = $1100;     
+     GL_FASTEST = $1101;     
+     GL_NICEST = $1102;     
+  { HintTarget  }
+     GL_PERSPECTIVE_CORRECTION_HINT = $0C50;     
+     GL_POINT_SMOOTH_HINT = $0C51;     
+     GL_LINE_SMOOTH_HINT = $0C52;     
+     GL_FOG_HINT = $0C54;     
+     GL_GENERATE_MIPMAP_HINT = $8192;     
+  { LightModelParameter  }
+     GL_LIGHT_MODEL_AMBIENT = $0B53;     
+     GL_LIGHT_MODEL_TWO_SIDE = $0B52;     
+  { LightParameter  }
+     GL_AMBIENT = $1200;     
+     GL_DIFFUSE = $1201;     
+     GL_SPECULAR = $1202;     
+     GL_POSITION = $1203;     
+     GL_SPOT_DIRECTION = $1204;     
+     GL_SPOT_EXPONENT = $1205;     
+     GL_SPOT_CUTOFF = $1206;     
+     GL_CONSTANT_ATTENUATION = $1207;     
+     GL_LINEAR_ATTENUATION = $1208;     
+     GL_QUADRATIC_ATTENUATION = $1209;     
+  { DataType  }
+     GL_BYTE = $1400;     
+     GL_UNSIGNED_BYTE = $1401;     
+     GL_SHORT = $1402;     
+     GL_UNSIGNED_SHORT = $1403;     
+     GL_FLOAT = $1406;     
+     GL_FIXED = $140C;     
+  { LogicOp  }
+     GL_CLEAR = $1500;     
+     GL_AND = $1501;     
+     GL_AND_REVERSE = $1502;     
+     GL_COPY = $1503;     
+     GL_AND_INVERTED = $1504;     
+     GL_NOOP = $1505;     
+     GL_XOR = $1506;     
+     GL_OR = $1507;     
+     GL_NOR = $1508;     
+     GL_EQUIV = $1509;     
+     GL_INVERT = $150A;     
+     GL_OR_REVERSE = $150B;     
+     GL_COPY_INVERTED = $150C;     
+     GL_OR_INVERTED = $150D;     
+     GL_NAND = $150E;     
+     GL_SET = $150F;     
+  { MaterialFace  }
+  {      GL_FRONT_AND_BACK  }
+  { MaterialParameter  }
+     GL_EMISSION = $1600;     
+     GL_SHININESS = $1601;     
+     GL_AMBIENT_AND_DIFFUSE = $1602;     
+  {      GL_AMBIENT  }
+  {      GL_DIFFUSE  }
+  {      GL_SPECULAR  }
+  { MatrixMode  }
+     GL_MODELVIEW = $1700;     
+     GL_PROJECTION = $1701;     
+     GL_TEXTURE = $1702;     
+  { NormalPointerType  }
+  {      GL_BYTE  }
+  {      GL_SHORT  }
+  {      GL_FLOAT  }
+  {      GL_FIXED  }
+  { PixelFormat  }
+     GL_ALPHA = $1906;     
+     GL_RGB = $1907;     
+     GL_RGBA = $1908;     
+     GL_LUMINANCE = $1909;     
+     GL_LUMINANCE_ALPHA = $190A;     
+  { PixelStoreParameter  }
+//     GL_UNPACK_ALIGNMENT = $0CF5;     
+//     GL_PACK_ALIGNMENT = $0D05;     
+  { PixelType  }
+  {      GL_UNSIGNED_BYTE  }
+     GL_UNSIGNED_SHORT_4_4_4_4 = $8033;     
+     GL_UNSIGNED_SHORT_5_5_5_1 = $8034;     
+     GL_UNSIGNED_SHORT_5_6_5 = $8363;     
+  { ShadingModel  }
+     GL_FLAT = $1D00;     
+     GL_SMOOTH = $1D01;     
+  { StencilFunction  }
+  {      GL_NEVER  }
+  {      GL_LESS  }
+  {      GL_EQUAL  }
+  {      GL_LEQUAL  }
+  {      GL_GREATER  }
+  {      GL_NOTEQUAL  }
+  {      GL_GEQUAL  }
+  {      GL_ALWAYS  }
+  { StencilOp  }
+  {      GL_ZERO  }
+     GL_KEEP = $1E00;     
+     GL_REPLACE = $1E01;     
+     GL_INCR = $1E02;     
+     GL_DECR = $1E03;     
+  {      GL_INVERT  }
+  { StringName  }
+     GL_VENDOR = $1F00;     
+     GL_RENDERER = $1F01;     
+     GL_VERSION = $1F02;     
+     GL_EXTENSIONS = $1F03;     
+  { TexCoordPointerType  }
+  {      GL_SHORT  }
+  {      GL_FLOAT  }
+  {      GL_FIXED  }
+  {      GL_BYTE  }
+  { TextureEnvMode  }
+     GL_MODULATE = $2100;     
+     GL_DECAL = $2101;     
+  {      GL_BLEND  }
+     GL_ADD = $0104;     
+  {      GL_REPLACE  }
+  { TextureEnvParameter  }
+     GL_TEXTURE_ENV_MODE = $2200;     
+     GL_TEXTURE_ENV_COLOR = $2201;     
+  { TextureEnvTarget  }
+     GL_TEXTURE_ENV = $2300;     
+  { TextureMagFilter  }
+     GL_NEAREST = $2600;     
+     GL_LINEAR = $2601;     
+  { TextureMinFilter  }
+  {      GL_NEAREST  }
+  {      GL_LINEAR  }
+     GL_NEAREST_MIPMAP_NEAREST = $2700;     
+     GL_LINEAR_MIPMAP_NEAREST = $2701;     
+     GL_NEAREST_MIPMAP_LINEAR = $2702;     
+     GL_LINEAR_MIPMAP_LINEAR = $2703;     
+  { TextureParameterName  }
+     GL_TEXTURE_MAG_FILTER = $2800;     
+     GL_TEXTURE_MIN_FILTER = $2801;     
+     GL_TEXTURE_WRAP_S = $2802;     
+     GL_TEXTURE_WRAP_T = $2803;     
+     GL_GENERATE_MIPMAP = $8191;     
+  { TextureTarget  }
+  {      GL_TEXTURE_2D  }
+  { TextureUnit  }
+     GL_TEXTURE0 = $84C0;     
+     GL_TEXTURE1 = $84C1;     
+     GL_TEXTURE2 = $84C2;     
+     GL_TEXTURE3 = $84C3;     
+     GL_TEXTURE4 = $84C4;     
+     GL_TEXTURE5 = $84C5;     
+     GL_TEXTURE6 = $84C6;     
+     GL_TEXTURE7 = $84C7;     
+     GL_TEXTURE8 = $84C8;     
+     GL_TEXTURE9 = $84C9;     
+     GL_TEXTURE10 = $84CA;     
+     GL_TEXTURE11 = $84CB;     
+     GL_TEXTURE12 = $84CC;     
+     GL_TEXTURE13 = $84CD;     
+     GL_TEXTURE14 = $84CE;     
+     GL_TEXTURE15 = $84CF;     
+     GL_TEXTURE16 = $84D0;     
+     GL_TEXTURE17 = $84D1;     
+     GL_TEXTURE18 = $84D2;     
+     GL_TEXTURE19 = $84D3;     
+     GL_TEXTURE20 = $84D4;     
+     GL_TEXTURE21 = $84D5;     
+     GL_TEXTURE22 = $84D6;     
+     GL_TEXTURE23 = $84D7;     
+     GL_TEXTURE24 = $84D8;     
+     GL_TEXTURE25 = $84D9;     
+     GL_TEXTURE26 = $84DA;     
+     GL_TEXTURE27 = $84DB;     
+     GL_TEXTURE28 = $84DC;     
+     GL_TEXTURE29 = $84DD;     
+     GL_TEXTURE30 = $84DE;     
+     GL_TEXTURE31 = $84DF;     
+     GL_ACTIVE_TEXTURE = $84E0;     
+     GL_CLIENT_ACTIVE_TEXTURE = $84E1;     
+  { TextureWrapMode  }
+     GL_REPEAT = $2901;     
+     GL_CLAMP_TO_EDGE = $812F;     
+  { VertexPointerType  }
+  {      GL_SHORT  }
+  {      GL_FLOAT  }
+  {      GL_FIXED  }
+  {      GL_BYTE  }
+  { LightName  }
+     GL_LIGHT0 = $4000;     
+     GL_LIGHT1 = $4001;     
+     GL_LIGHT2 = $4002;     
+     GL_LIGHT3 = $4003;     
+     GL_LIGHT4 = $4004;     
+     GL_LIGHT5 = $4005;     
+     GL_LIGHT6 = $4006;     
+     GL_LIGHT7 = $4007;     
+  { Buffer Objects  }
+     GL_ARRAY_BUFFER = $8892;     
+     GL_ELEMENT_ARRAY_BUFFER = $8893;     
+     GL_ARRAY_BUFFER_BINDING = $8894;     
+     GL_ELEMENT_ARRAY_BUFFER_BINDING = $8895;     
+     GL_VERTEX_ARRAY_BUFFER_BINDING = $8896;     
+     GL_NORMAL_ARRAY_BUFFER_BINDING = $8897;     
+     GL_COLOR_ARRAY_BUFFER_BINDING = $8898;     
+     GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = $889A;     
+     GL_STATIC_DRAW = $88E4;     
+     GL_DYNAMIC_DRAW = $88E8;     
+     GL_BUFFER_SIZE = $8764;     
+     GL_BUFFER_USAGE = $8765;     
+  { Texture combine + dot3  }
+     GL_SUBTRACT = $84E7;     
+     GL_COMBINE = $8570;     
+     GL_COMBINE_RGB = $8571;     
+     GL_COMBINE_ALPHA = $8572;     
+     GL_RGB_SCALE = $8573;     
+     GL_ADD_SIGNED = $8574;     
+     GL_INTERPOLATE = $8575;     
+     GL_CONSTANT = $8576;     
+     GL_PRIMARY_COLOR = $8577;     
+     GL_PREVIOUS = $8578;     
+     GL_OPERAND0_RGB = $8590;     
+     GL_OPERAND1_RGB = $8591;     
+     GL_OPERAND2_RGB = $8592;     
+     GL_OPERAND0_ALPHA = $8598;     
+     GL_OPERAND1_ALPHA = $8599;     
+     GL_OPERAND2_ALPHA = $859A;     
+     GL_ALPHA_SCALE = $0D1C;     
+     GL_SRC0_RGB = $8580;     
+     GL_SRC1_RGB = $8581;     
+     GL_SRC2_RGB = $8582;     
+     GL_SRC0_ALPHA = $8588;     
+     GL_SRC1_ALPHA = $8589;     
+     GL_SRC2_ALPHA = $858A;     
+     GL_DOT3_RGB = $86AE;     
+     GL_DOT3_RGBA = $86AF;     
+  {------------------------------------------------------------------------*
+   * required OES extension tokens
+   *------------------------------------------------------------------------ }
+  { OES_read_format  }
+     GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = $8B9A;     
+     GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = $8B9B;     
+  { GL_OES_compressed_paletted_texture  }
+     GL_PALETTE4_RGB8_OES = $8B90;     
+     GL_PALETTE4_RGBA8_OES = $8B91;     
+     GL_PALETTE4_R5_G6_B5_OES = $8B92;     
+     GL_PALETTE4_RGBA4_OES = $8B93;     
+     GL_PALETTE4_RGB5_A1_OES = $8B94;     
+     GL_PALETTE8_RGB8_OES = $8B95;     
+     GL_PALETTE8_RGBA8_OES = $8B96;     
+     GL_PALETTE8_R5_G6_B5_OES = $8B97;     
+     GL_PALETTE8_RGBA4_OES = $8B98;     
+     GL_PALETTE8_RGB5_A1_OES = $8B99;     
+  { OES_point_size_array  }
+     GL_POINT_SIZE_ARRAY_OES = $8B9C;     
+     GL_POINT_SIZE_ARRAY_TYPE_OES = $898A;     
+     GL_POINT_SIZE_ARRAY_STRIDE_OES = $898B;     
+     GL_POINT_SIZE_ARRAY_POINTER_OES = $898C;     
+     GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = $8B9F;     
+  { GL_OES_point_sprite  }
+     GL_POINT_SPRITE_OES = $8861;     
+     GL_COORD_REPLACE_OES = $8862;     
+  {*********************************************************** }
+  { Available only in Common profile  }
+
+  var
+    glAlphaFunc : procedure(func:GLenum; ref:GLclampf);cdecl;
+    glClearColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);cdecl;
+    glClearDepthf : procedure(depth:GLclampf);cdecl;
+(* Const before type ignored *)
+    glClipPlanef : procedure(plane:GLenum; equation:pGLfloat);cdecl;
+    glColor4f : procedure(red:GLfloat; green:GLfloat; blue:GLfloat; alpha:GLfloat);cdecl;
+    glDepthRangef : procedure(zNear:GLclampf; zFar:GLclampf);cdecl;
+    glFogf : procedure(pname:GLenum; param:GLfloat);cdecl;
+(* Const before type ignored *)
+    glFogfv : procedure(pname:GLenum; params:pGLfloat);cdecl;
+    glFrustumf : procedure(left:GLfloat; right:GLfloat; bottom:GLfloat; top:GLfloat; zNear:GLfloat; 
+      zFar:GLfloat);cdecl;
+    glGetClipPlanef : procedure(pname:GLenum; eqn:array of GLfloat);cdecl;
+    glGetFloatv : procedure(pname:GLenum; params:pGLfloat);cdecl;
+    glGetLightfv : procedure(light:GLenum; pname:GLenum; params:pGLfloat);cdecl;
+    glGetMaterialfv : procedure(face:GLenum; pname:GLenum; params:pGLfloat);cdecl;
+    glGetTexEnvfv : procedure(env:GLenum; pname:GLenum; params:pGLfloat);cdecl;
+    glGetTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);cdecl;
+    glLightModelf : procedure(pname:GLenum; param:GLfloat);cdecl;
+(* Const before type ignored *)
+    glLightModelfv : procedure(pname:GLenum; params:pGLfloat);cdecl;
+    glLightf : procedure(light:GLenum; pname:GLenum; param:GLfloat);cdecl;
+(* Const before type ignored *)
+    glLightfv : procedure(light:GLenum; pname:GLenum; params:pGLfloat);cdecl;
+    glLineWidth : procedure(width:GLfloat);cdecl;
+(* Const before type ignored *)
+    glLoadMatrixf : procedure(m:pGLfloat);cdecl;
+    glMaterialf : procedure(face:GLenum; pname:GLenum; param:GLfloat);cdecl;
+(* Const before type ignored *)
+    glMaterialfv : procedure(face:GLenum; pname:GLenum; params:pGLfloat);cdecl;
+(* Const before type ignored *)
+    glMultMatrixf : procedure(m:pGLfloat);cdecl;
+    glMultiTexCoord4f : procedure(target:GLenum; s:GLfloat; t:GLfloat; r:GLfloat; q:GLfloat);cdecl;
+    glNormal3f : procedure(nx:GLfloat; ny:GLfloat; nz:GLfloat);cdecl;
+    glOrthof : procedure(left:GLfloat; right:GLfloat; bottom:GLfloat; top:GLfloat; zNear:GLfloat; 
+      zFar:GLfloat);cdecl;
+    glPointParameterf : procedure(pname:GLenum; param:GLfloat);cdecl;
+(* Const before type ignored *)
+    glPointParameterfv : procedure(pname:GLenum; params:pGLfloat);cdecl;
+    glPointSize : procedure(size:GLfloat);cdecl;
+    glPolygonOffset : procedure(factor:GLfloat; units:GLfloat);cdecl;
+    glRotatef : procedure(angle:GLfloat; x:GLfloat; y:GLfloat; z:GLfloat);cdecl;
+    glScalef : procedure(x:GLfloat; y:GLfloat; z:GLfloat);cdecl;
+    glTexEnvf : procedure(target:GLenum; pname:GLenum; param:GLfloat);cdecl;
+(* Const before type ignored *)
+    glTexEnvfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);cdecl;
+    glTexParameterf : procedure(target:GLenum; pname:GLenum; param:GLfloat);cdecl;
+(* Const before type ignored *)
+    glTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);cdecl;
+    glTranslatef : procedure(x:GLfloat; y:GLfloat; z:GLfloat);cdecl;
+  { Available in both Common and Common-Lite profiles  }
+    glActiveTexture : procedure(texture:GLenum);cdecl;
+    glAlphaFuncx : procedure(func:GLenum; ref:GLclampx);cdecl;
+    glBindBuffer : procedure(target:GLenum; buffer:GLuint);cdecl;
+    glBindTexture : procedure(target:GLenum; texture:GLuint);cdecl;
+    glBlendFunc : procedure(sfactor:GLenum; dfactor:GLenum);cdecl;
+(* Const before type ignored *)
+    glBufferData : procedure(target:GLenum; size:GLsizeiptr; data:pGLvoid; usage:GLenum);cdecl;
+(* Const before type ignored *)
+    glBufferSubData : procedure(target:GLenum; offset:GLintptr; size:GLsizeiptr; data:pGLvoid);cdecl;
+    glClear : procedure(mask:GLbitfield);cdecl;
+    glClearColorx : procedure(red:GLclampx; green:GLclampx; blue:GLclampx; alpha:GLclampx);cdecl;
+    glClearDepthx : procedure(depth:GLclampx);cdecl;
+    glClearStencil : procedure(s:GLint);cdecl;
+    glClientActiveTexture : procedure(texture:GLenum);cdecl;
+(* Const before type ignored *)
+    glClipPlanex : procedure(plane:GLenum; equation:pGLfixed);cdecl;
+    glColor4ub : procedure(red:GLubyte; green:GLubyte; blue:GLubyte; alpha:GLubyte);cdecl;
+    glColor4x : procedure(red:GLfixed; green:GLfixed; blue:GLfixed; alpha:GLfixed);cdecl;
+    glColorMask : procedure(red:GLboolean; green:GLboolean; blue:GLboolean; alpha:GLboolean);cdecl;
+(* Const before type ignored *)
+    glColorPointer : procedure(size:GLint; _type:GLenum; stride:GLsizei; pointer:pGLvoid);cdecl;
+(* Const before type ignored *)
+    glCompressedTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
+      border:GLint; imageSize:GLsizei; data:pGLvoid);cdecl;
+(* Const before type ignored *)
+    glCompressedTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei; 
+      height:GLsizei; format:GLenum; imageSize:GLsizei; data:pGLvoid);cdecl;
+    glCopyTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; x:GLint; y:GLint; 
+      width:GLsizei; height:GLsizei; border:GLint);cdecl;
+    glCopyTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; x:GLint; 
+      y:GLint; width:GLsizei; height:GLsizei);cdecl;
+    glCullFace : procedure(mode:GLenum);cdecl;
+(* Const before type ignored *)
+    glDeleteBuffers : procedure(n:GLsizei; buffers:pGLuint);cdecl;
+(* Const before type ignored *)
+    glDeleteTextures : procedure(n:GLsizei; textures:pGLuint);cdecl;
+    glDepthFunc : procedure(func:GLenum);cdecl;
+    glDepthMask : procedure(flag:GLboolean);cdecl;
+    glDepthRangex : procedure(zNear:GLclampx; zFar:GLclampx);cdecl;
+    glDisable : procedure(cap:GLenum);cdecl;
+    glDisableClientState : procedure(arry:GLenum);cdecl;
+    glDrawArrays : procedure(mode:GLenum; first:GLint; count:GLsizei);cdecl;
+(* Const before type ignored *)
+    glDrawElements : procedure(mode:GLenum; count:GLsizei; _type:GLenum; indices:pGLvoid);cdecl;
+    glEnable : procedure(cap:GLenum);cdecl;
+    glEnableClientState : procedure(arry:GLenum);cdecl;
+    glFinish : procedure;cdecl;
+    glFlush : procedure;cdecl;
+    glFogx : procedure(pname:GLenum; param:GLfixed);cdecl;
+(* Const before type ignored *)
+    glFogxv : procedure(pname:GLenum; params:pGLfixed);cdecl;
+    glFrontFace : procedure(mode:GLenum);cdecl;
+    glFrustumx : procedure(left:GLfixed; right:GLfixed; bottom:GLfixed; top:GLfixed; zNear:GLfixed; 
+      zFar:GLfixed);cdecl;
+    glGetBooleanv : procedure(pname:GLenum; params:pGLboolean);cdecl;
+    glGetBufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);cdecl;
+    glGetClipPlanex : procedure(pname:GLenum; eqn:array of GLfixed);cdecl;
+    glGenBuffers : procedure(n:GLsizei; buffers:pGLuint);cdecl;
+    glGenTextures : procedure(n:GLsizei; textures:pGLuint);cdecl;
+    glGetError : function:GLenum;cdecl;
+    glGetFixedv : procedure(pname:GLenum; params:pGLfixed);cdecl;
+    glGetIntegerv : procedure(pname:GLenum; params:pGLint);cdecl;
+    glGetLightxv : procedure(light:GLenum; pname:GLenum; params:pGLfixed);cdecl;
+    glGetMaterialxv : procedure(face:GLenum; pname:GLenum; params:pGLfixed);cdecl;
+    glGetPointerv : procedure(pname:GLenum; params:Ppointer);cdecl;
+(* Const before type ignored *)
+    glGetString : function(name:GLenum):PGLubyte;cdecl;
+    glGetTexEnviv : procedure(env:GLenum; pname:GLenum; params:pGLint);cdecl;
+    glGetTexEnvxv : procedure(env:GLenum; pname:GLenum; params:pGLfixed);cdecl;
+    glGetTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);cdecl;
+    glGetTexParameterxv : procedure(target:GLenum; pname:GLenum; params:pGLfixed);cdecl;
+    glHint : procedure(target:GLenum; mode:GLenum);cdecl;
+    glIsBuffer : function(buffer:GLuint):GLboolean;cdecl;
+    glIsEnabled : function(cap:GLenum):GLboolean;cdecl;
+    glIsTexture : function(texture:GLuint):GLboolean;cdecl;
+    glLightModelx : procedure(pname:GLenum; param:GLfixed);cdecl;
+(* Const before type ignored *)
+    glLightModelxv : procedure(pname:GLenum; params:pGLfixed);cdecl;
+    glLightx : procedure(light:GLenum; pname:GLenum; param:GLfixed);cdecl;
+(* Const before type ignored *)
+    glLightxv : procedure(light:GLenum; pname:GLenum; params:pGLfixed);cdecl;
+    glLineWidthx : procedure(width:GLfixed);cdecl;
+    glLoadIdentity : procedure;cdecl;
+(* Const before type ignored *)
+    glLoadMatrixx : procedure(m:pGLfixed);cdecl;
+    glLogicOp : procedure(opcode:GLenum);cdecl;
+    glMaterialx : procedure(face:GLenum; pname:GLenum; param:GLfixed);cdecl;
+(* Const before type ignored *)
+    glMaterialxv : procedure(face:GLenum; pname:GLenum; params:pGLfixed);cdecl;
+    glMatrixMode : procedure(mode:GLenum);cdecl;
+(* Const before type ignored *)
+    glMultMatrixx : procedure(m:pGLfixed);cdecl;
+    glMultiTexCoord4x : procedure(target:GLenum; s:GLfixed; t:GLfixed; r:GLfixed; q:GLfixed);cdecl;
+    glNormal3x : procedure(nx:GLfixed; ny:GLfixed; nz:GLfixed);cdecl;
+(* Const before type ignored *)
+    glNormalPointer : procedure(_type:GLenum; stride:GLsizei; pointer:pGLvoid);cdecl;
+    glOrthox : procedure(left:GLfixed; right:GLfixed; bottom:GLfixed; top:GLfixed; zNear:GLfixed; 
+      zFar:GLfixed);cdecl;
+    glPixelStorei : procedure(pname:GLenum; param:GLint);cdecl;
+    glPointParameterx : procedure(pname:GLenum; param:GLfixed);cdecl;
+(* Const before type ignored *)
+    glPointParameterxv : procedure(pname:GLenum; params:pGLfixed);cdecl;
+    glPointSizex : procedure(size:GLfixed);cdecl;
+    glPolygonOffsetx : procedure(factor:GLfixed; units:GLfixed);cdecl;
+    glPopMatrix : procedure;cdecl;
+    glPushMatrix : procedure;cdecl;
+    glReadPixels : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei; format:GLenum; 
+      _type:GLenum; pixels:pGLvoid);cdecl;
+    glRotatex : procedure(angle:GLfixed; x:GLfixed; y:GLfixed; z:GLfixed);cdecl;
+    glSampleCoverage : procedure(value:GLclampf; invert:GLboolean);cdecl;
+    glSampleCoveragex : procedure(value:GLclampx; invert:GLboolean);cdecl;
+    glScalex : procedure(x:GLfixed; y:GLfixed; z:GLfixed);cdecl;
+    glScissor : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);cdecl;
+    glShadeModel : procedure(mode:GLenum);cdecl;
+    glStencilFunc : procedure(func:GLenum; ref:GLint; mask:GLuint);cdecl;
+    glStencilMask : procedure(mask:GLuint);cdecl;
+    glStencilOp : procedure(fail:GLenum; zfail:GLenum; zpass:GLenum);cdecl;
+(* Const before type ignored *)
+    glTexCoordPointer : procedure(size:GLint; _type:GLenum; stride:GLsizei; pointer:pGLvoid);cdecl;
+    glTexEnvi : procedure(target:GLenum; pname:GLenum; param:GLint);cdecl;
+    glTexEnvx : procedure(target:GLenum; pname:GLenum; param:GLfixed);cdecl;
+(* Const before type ignored *)
+    glTexEnviv : procedure(target:GLenum; pname:GLenum; params:pGLint);cdecl;
+(* Const before type ignored *)
+    glTexEnvxv : procedure(target:GLenum; pname:GLenum; params:pGLfixed);cdecl;
+(* Const before type ignored *)
+    glTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLint; width:GLsizei; height:GLsizei; 
+      border:GLint; format:GLenum; _type:GLenum; pixels:pGLvoid);cdecl;
+    glTexParameteri : procedure(target:GLenum; pname:GLenum; param:GLint);cdecl;
+    glTexParameterx : procedure(target:GLenum; pname:GLenum; param:GLfixed);cdecl;
+(* Const before type ignored *)
+    glTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);cdecl;
+(* Const before type ignored *)
+    glTexParameterxv : procedure(target:GLenum; pname:GLenum; params:pGLfixed);cdecl;
+(* Const before type ignored *)
+    glTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei; 
+      height:GLsizei; format:GLenum; _type:GLenum; pixels:pGLvoid);cdecl;
+    glTranslatex : procedure(x:GLfixed; y:GLfixed; z:GLfixed);cdecl;
+(* Const before type ignored *)
+    glVertexPointer : procedure(size:GLint; _type:GLenum; stride:GLsizei; pointer:pGLvoid);cdecl;
+    glViewport : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);cdecl;
+  {------------------------------------------------------------------------*
+   * Required OES extension functions
+   *------------------------------------------------------------------------ }
+  { GL_OES_read_format  }
+
+  const
+     GL_OES_read_format = 1;     
+  { GL_OES_compressed_paletted_texture  }
+     GL_OES_compressed_paletted_texture = 1;     
+  { GL_OES_point_size_array  }
+     GL_OES_point_size_array = 1;     
+(* Const before type ignored *)
+
+  var
+    glPointSizePointerOES : procedure(_type:GLenum; stride:GLsizei; pointer:pGLvoid);cdecl;
+  { GL_OES_point_sprite  }
+
+  const
+     GL_OES_point_sprite = 1;     
+
+implementation
+
+  uses
+    SysUtils, dynlibs;
+
+  var
+    hlib : tlibhandle;
+
+
+  procedure Freegles11;
+    begin
+//      FreeLibrary(hlib);
+      glAlphaFunc:=nil;
+      glClearColor:=nil;
+      glClearDepthf:=nil;
+      glClipPlanef:=nil;
+      glColor4f:=nil;
+      glDepthRangef:=nil;
+      glFogf:=nil;
+      glFogfv:=nil;
+      glFrustumf:=nil;
+      glGetClipPlanef:=nil;
+      glGetFloatv:=nil;
+      glGetLightfv:=nil;
+      glGetMaterialfv:=nil;
+      glGetTexEnvfv:=nil;
+      glGetTexParameterfv:=nil;
+      glLightModelf:=nil;
+      glLightModelfv:=nil;
+      glLightf:=nil;
+      glLightfv:=nil;
+      glLineWidth:=nil;
+      glLoadMatrixf:=nil;
+      glMaterialf:=nil;
+      glMaterialfv:=nil;
+      glMultMatrixf:=nil;
+      glMultiTexCoord4f:=nil;
+      glNormal3f:=nil;
+      glOrthof:=nil;
+      glPointParameterf:=nil;
+      glPointParameterfv:=nil;
+      glPointSize:=nil;
+      glPolygonOffset:=nil;
+      glRotatef:=nil;
+      glScalef:=nil;
+      glTexEnvf:=nil;
+      glTexEnvfv:=nil;
+      glTexParameterf:=nil;
+      glTexParameterfv:=nil;
+      glTranslatef:=nil;
+      glActiveTexture:=nil;
+      glAlphaFuncx:=nil;
+      glBindBuffer:=nil;
+      glBindTexture:=nil;
+      glBlendFunc:=nil;
+      glBufferData:=nil;
+      glBufferSubData:=nil;
+      glClear:=nil;
+      glClearColorx:=nil;
+      glClearDepthx:=nil;
+      glClearStencil:=nil;
+      glClientActiveTexture:=nil;
+      glClipPlanex:=nil;
+      glColor4ub:=nil;
+      glColor4x:=nil;
+      glColorMask:=nil;
+      glColorPointer:=nil;
+      glCompressedTexImage2D:=nil;
+      glCompressedTexSubImage2D:=nil;
+      glCopyTexImage2D:=nil;
+      glCopyTexSubImage2D:=nil;
+      glCullFace:=nil;
+      glDeleteBuffers:=nil;
+      glDeleteTextures:=nil;
+      glDepthFunc:=nil;
+      glDepthMask:=nil;
+      glDepthRangex:=nil;
+      glDisable:=nil;
+      glDisableClientState:=nil;
+      glDrawArrays:=nil;
+      glDrawElements:=nil;
+      glEnable:=nil;
+      glEnableClientState:=nil;
+      glFinish:=nil;
+      glFlush:=nil;
+      glFogx:=nil;
+      glFogxv:=nil;
+      glFrontFace:=nil;
+      glFrustumx:=nil;
+      glGetBooleanv:=nil;
+      glGetBufferParameteriv:=nil;
+      glGetClipPlanex:=nil;
+      glGenBuffers:=nil;
+      glGenTextures:=nil;
+      glGetError:=nil;
+      glGetFixedv:=nil;
+      glGetIntegerv:=nil;
+      glGetLightxv:=nil;
+      glGetMaterialxv:=nil;
+      glGetPointerv:=nil;
+      glGetString:=nil;
+      glGetTexEnviv:=nil;
+      glGetTexEnvxv:=nil;
+      glGetTexParameteriv:=nil;
+      glGetTexParameterxv:=nil;
+      glHint:=nil;
+      glIsBuffer:=nil;
+      glIsEnabled:=nil;
+      glIsTexture:=nil;
+      glLightModelx:=nil;
+      glLightModelxv:=nil;
+      glLightx:=nil;
+      glLightxv:=nil;
+      glLineWidthx:=nil;
+      glLoadIdentity:=nil;
+      glLoadMatrixx:=nil;
+      glLogicOp:=nil;
+      glMaterialx:=nil;
+      glMaterialxv:=nil;
+      glMatrixMode:=nil;
+      glMultMatrixx:=nil;
+      glMultiTexCoord4x:=nil;
+      glNormal3x:=nil;
+      glNormalPointer:=nil;
+      glOrthox:=nil;
+      glPixelStorei:=nil;
+      glPointParameterx:=nil;
+      glPointParameterxv:=nil;
+      glPointSizex:=nil;
+      glPolygonOffsetx:=nil;
+      glPopMatrix:=nil;
+      glPushMatrix:=nil;
+      glReadPixels:=nil;
+      glRotatex:=nil;
+      glSampleCoverage:=nil;
+      glSampleCoveragex:=nil;
+      glScalex:=nil;
+      glScissor:=nil;
+      glShadeModel:=nil;
+      glStencilFunc:=nil;
+      glStencilMask:=nil;
+      glStencilOp:=nil;
+      glTexCoordPointer:=nil;
+      glTexEnvi:=nil;
+      glTexEnvx:=nil;
+      glTexEnviv:=nil;
+      glTexEnvxv:=nil;
+      glTexImage2D:=nil;
+      glTexParameteri:=nil;
+      glTexParameterx:=nil;
+      glTexParameteriv:=nil;
+      glTexParameterxv:=nil;
+      glTexSubImage2D:=nil;
+      glTranslatex:=nil;
+      glVertexPointer:=nil;
+      glViewport:=nil;
+      glPointSizePointerOES:=nil;
+    end;
+
+
+  procedure Loadgles11(lib : pchar);
+    begin
+      Freegles11;
+      hlib:=LoadLibrary(lib);
+      if hlib=0 then
+	begin
+         raise Exception.Create(format('Could not load library: %s',[lib]));
+	end;
+      pointer(glAlphaFunc):=GetProcAddress(hlib,'glAlphaFunc');
+      pointer(glClearColor):=GetProcAddress(hlib,'glClearColor');
+      pointer(glClearDepthf):=GetProcAddress(hlib,'glClearDepthf');
+      pointer(glClipPlanef):=GetProcAddress(hlib,'glClipPlanef');
+      pointer(glColor4f):=GetProcAddress(hlib,'glColor4f');
+      pointer(glDepthRangef):=GetProcAddress(hlib,'glDepthRangef');
+      pointer(glFogf):=GetProcAddress(hlib,'glFogf');
+      pointer(glFogfv):=GetProcAddress(hlib,'glFogfv');
+      pointer(glFrustumf):=GetProcAddress(hlib,'glFrustumf');
+      pointer(glGetClipPlanef):=GetProcAddress(hlib,'glGetClipPlanef');
+      pointer(glGetFloatv):=GetProcAddress(hlib,'glGetFloatv');
+      pointer(glGetLightfv):=GetProcAddress(hlib,'glGetLightfv');
+      pointer(glGetMaterialfv):=GetProcAddress(hlib,'glGetMaterialfv');
+      pointer(glGetTexEnvfv):=GetProcAddress(hlib,'glGetTexEnvfv');
+      pointer(glGetTexParameterfv):=GetProcAddress(hlib,'glGetTexParameterfv');
+      pointer(glLightModelf):=GetProcAddress(hlib,'glLightModelf');
+      pointer(glLightModelfv):=GetProcAddress(hlib,'glLightModelfv');
+      pointer(glLightf):=GetProcAddress(hlib,'glLightf');
+      pointer(glLightfv):=GetProcAddress(hlib,'glLightfv');
+      pointer(glLineWidth):=GetProcAddress(hlib,'glLineWidth');
+      pointer(glLoadMatrixf):=GetProcAddress(hlib,'glLoadMatrixf');
+      pointer(glMaterialf):=GetProcAddress(hlib,'glMaterialf');
+      pointer(glMaterialfv):=GetProcAddress(hlib,'glMaterialfv');
+      pointer(glMultMatrixf):=GetProcAddress(hlib,'glMultMatrixf');
+      pointer(glMultiTexCoord4f):=GetProcAddress(hlib,'glMultiTexCoord4f');
+      pointer(glNormal3f):=GetProcAddress(hlib,'glNormal3f');
+      pointer(glOrthof):=GetProcAddress(hlib,'glOrthof');
+      pointer(glPointParameterf):=GetProcAddress(hlib,'glPointParameterf');
+      pointer(glPointParameterfv):=GetProcAddress(hlib,'glPointParameterfv');
+      pointer(glPointSize):=GetProcAddress(hlib,'glPointSize');
+      pointer(glPolygonOffset):=GetProcAddress(hlib,'glPolygonOffset');
+      pointer(glRotatef):=GetProcAddress(hlib,'glRotatef');
+      pointer(glScalef):=GetProcAddress(hlib,'glScalef');
+      pointer(glTexEnvf):=GetProcAddress(hlib,'glTexEnvf');
+      pointer(glTexEnvfv):=GetProcAddress(hlib,'glTexEnvfv');
+      pointer(glTexParameterf):=GetProcAddress(hlib,'glTexParameterf');
+      pointer(glTexParameterfv):=GetProcAddress(hlib,'glTexParameterfv');
+      pointer(glTranslatef):=GetProcAddress(hlib,'glTranslatef');
+      pointer(glActiveTexture):=GetProcAddress(hlib,'glActiveTexture');
+      pointer(glAlphaFuncx):=GetProcAddress(hlib,'glAlphaFuncx');
+      pointer(glBindBuffer):=GetProcAddress(hlib,'glBindBuffer');
+      pointer(glBindTexture):=GetProcAddress(hlib,'glBindTexture');
+      pointer(glBlendFunc):=GetProcAddress(hlib,'glBlendFunc');
+      pointer(glBufferData):=GetProcAddress(hlib,'glBufferData');
+      pointer(glBufferSubData):=GetProcAddress(hlib,'glBufferSubData');
+      pointer(glClear):=GetProcAddress(hlib,'glClear');
+      pointer(glClearColorx):=GetProcAddress(hlib,'glClearColorx');
+      pointer(glClearDepthx):=GetProcAddress(hlib,'glClearDepthx');
+      pointer(glClearStencil):=GetProcAddress(hlib,'glClearStencil');
+      pointer(glClientActiveTexture):=GetProcAddress(hlib,'glClientActiveTexture');
+      pointer(glClipPlanex):=GetProcAddress(hlib,'glClipPlanex');
+      pointer(glColor4ub):=GetProcAddress(hlib,'glColor4ub');
+      pointer(glColor4x):=GetProcAddress(hlib,'glColor4x');
+      pointer(glColorMask):=GetProcAddress(hlib,'glColorMask');
+      pointer(glColorPointer):=GetProcAddress(hlib,'glColorPointer');
+      pointer(glCompressedTexImage2D):=GetProcAddress(hlib,'glCompressedTexImage2D');
+      pointer(glCompressedTexSubImage2D):=GetProcAddress(hlib,'glCompressedTexSubImage2D');
+      pointer(glCopyTexImage2D):=GetProcAddress(hlib,'glCopyTexImage2D');
+      pointer(glCopyTexSubImage2D):=GetProcAddress(hlib,'glCopyTexSubImage2D');
+      pointer(glCullFace):=GetProcAddress(hlib,'glCullFace');
+      pointer(glDeleteBuffers):=GetProcAddress(hlib,'glDeleteBuffers');
+      pointer(glDeleteTextures):=GetProcAddress(hlib,'glDeleteTextures');
+      pointer(glDepthFunc):=GetProcAddress(hlib,'glDepthFunc');
+      pointer(glDepthMask):=GetProcAddress(hlib,'glDepthMask');
+      pointer(glDepthRangex):=GetProcAddress(hlib,'glDepthRangex');
+      pointer(glDisable):=GetProcAddress(hlib,'glDisable');
+      pointer(glDisableClientState):=GetProcAddress(hlib,'glDisableClientState');
+      pointer(glDrawArrays):=GetProcAddress(hlib,'glDrawArrays');
+      pointer(glDrawElements):=GetProcAddress(hlib,'glDrawElements');
+      pointer(glEnable):=GetProcAddress(hlib,'glEnable');
+      pointer(glEnableClientState):=GetProcAddress(hlib,'glEnableClientState');
+      pointer(glFinish):=GetProcAddress(hlib,'glFinish');
+      pointer(glFlush):=GetProcAddress(hlib,'glFlush');
+      pointer(glFogx):=GetProcAddress(hlib,'glFogx');
+      pointer(glFogxv):=GetProcAddress(hlib,'glFogxv');
+      pointer(glFrontFace):=GetProcAddress(hlib,'glFrontFace');
+      pointer(glFrustumx):=GetProcAddress(hlib,'glFrustumx');
+      pointer(glGetBooleanv):=GetProcAddress(hlib,'glGetBooleanv');
+      pointer(glGetBufferParameteriv):=GetProcAddress(hlib,'glGetBufferParameteriv');
+      pointer(glGetClipPlanex):=GetProcAddress(hlib,'glGetClipPlanex');
+      pointer(glGenBuffers):=GetProcAddress(hlib,'glGenBuffers');
+      pointer(glGenTextures):=GetProcAddress(hlib,'glGenTextures');
+      pointer(glGetError):=GetProcAddress(hlib,'glGetError');
+      pointer(glGetFixedv):=GetProcAddress(hlib,'glGetFixedv');
+      pointer(glGetIntegerv):=GetProcAddress(hlib,'glGetIntegerv');
+      pointer(glGetLightxv):=GetProcAddress(hlib,'glGetLightxv');
+      pointer(glGetMaterialxv):=GetProcAddress(hlib,'glGetMaterialxv');
+      pointer(glGetPointerv):=GetProcAddress(hlib,'glGetPointerv');
+      pointer(glGetString):=GetProcAddress(hlib,'glGetString');
+      pointer(glGetTexEnviv):=GetProcAddress(hlib,'glGetTexEnviv');
+      pointer(glGetTexEnvxv):=GetProcAddress(hlib,'glGetTexEnvxv');
+      pointer(glGetTexParameteriv):=GetProcAddress(hlib,'glGetTexParameteriv');
+      pointer(glGetTexParameterxv):=GetProcAddress(hlib,'glGetTexParameterxv');
+      pointer(glHint):=GetProcAddress(hlib,'glHint');
+      pointer(glIsBuffer):=GetProcAddress(hlib,'glIsBuffer');
+      pointer(glIsEnabled):=GetProcAddress(hlib,'glIsEnabled');
+      pointer(glIsTexture):=GetProcAddress(hlib,'glIsTexture');
+      pointer(glLightModelx):=GetProcAddress(hlib,'glLightModelx');
+      pointer(glLightModelxv):=GetProcAddress(hlib,'glLightModelxv');
+      pointer(glLightx):=GetProcAddress(hlib,'glLightx');
+      pointer(glLightxv):=GetProcAddress(hlib,'glLightxv');
+      pointer(glLineWidthx):=GetProcAddress(hlib,'glLineWidthx');
+      pointer(glLoadIdentity):=GetProcAddress(hlib,'glLoadIdentity');
+      pointer(glLoadMatrixx):=GetProcAddress(hlib,'glLoadMatrixx');
+      pointer(glLogicOp):=GetProcAddress(hlib,'glLogicOp');
+      pointer(glMaterialx):=GetProcAddress(hlib,'glMaterialx');
+      pointer(glMaterialxv):=GetProcAddress(hlib,'glMaterialxv');
+      pointer(glMatrixMode):=GetProcAddress(hlib,'glMatrixMode');
+      pointer(glMultMatrixx):=GetProcAddress(hlib,'glMultMatrixx');
+      pointer(glMultiTexCoord4x):=GetProcAddress(hlib,'glMultiTexCoord4x');
+      pointer(glNormal3x):=GetProcAddress(hlib,'glNormal3x');
+      pointer(glNormalPointer):=GetProcAddress(hlib,'glNormalPointer');
+      pointer(glOrthox):=GetProcAddress(hlib,'glOrthox');
+      pointer(glPixelStorei):=GetProcAddress(hlib,'glPixelStorei');
+      pointer(glPointParameterx):=GetProcAddress(hlib,'glPointParameterx');
+      pointer(glPointParameterxv):=GetProcAddress(hlib,'glPointParameterxv');
+      pointer(glPointSizex):=GetProcAddress(hlib,'glPointSizex');
+      pointer(glPolygonOffsetx):=GetProcAddress(hlib,'glPolygonOffsetx');
+      pointer(glPopMatrix):=GetProcAddress(hlib,'glPopMatrix');
+      pointer(glPushMatrix):=GetProcAddress(hlib,'glPushMatrix');
+      pointer(glReadPixels):=GetProcAddress(hlib,'glReadPixels');
+      pointer(glRotatex):=GetProcAddress(hlib,'glRotatex');
+      pointer(glSampleCoverage):=GetProcAddress(hlib,'glSampleCoverage');
+      pointer(glSampleCoveragex):=GetProcAddress(hlib,'glSampleCoveragex');
+      pointer(glScalex):=GetProcAddress(hlib,'glScalex');
+      pointer(glScissor):=GetProcAddress(hlib,'glScissor');
+      pointer(glShadeModel):=GetProcAddress(hlib,'glShadeModel');
+      pointer(glStencilFunc):=GetProcAddress(hlib,'glStencilFunc');
+      pointer(glStencilMask):=GetProcAddress(hlib,'glStencilMask');
+      pointer(glStencilOp):=GetProcAddress(hlib,'glStencilOp');
+      pointer(glTexCoordPointer):=GetProcAddress(hlib,'glTexCoordPointer');
+      pointer(glTexEnvi):=GetProcAddress(hlib,'glTexEnvi');
+      pointer(glTexEnvx):=GetProcAddress(hlib,'glTexEnvx');
+      pointer(glTexEnviv):=GetProcAddress(hlib,'glTexEnviv');
+      pointer(glTexEnvxv):=GetProcAddress(hlib,'glTexEnvxv');
+      pointer(glTexImage2D):=GetProcAddress(hlib,'glTexImage2D');
+      pointer(glTexParameteri):=GetProcAddress(hlib,'glTexParameteri');
+      pointer(glTexParameterx):=GetProcAddress(hlib,'glTexParameterx');
+      pointer(glTexParameteriv):=GetProcAddress(hlib,'glTexParameteriv');
+      pointer(glTexParameterxv):=GetProcAddress(hlib,'glTexParameterxv');
+      pointer(glTexSubImage2D):=GetProcAddress(hlib,'glTexSubImage2D');
+      pointer(glTranslatex):=GetProcAddress(hlib,'glTranslatex');
+      pointer(glVertexPointer):=GetProcAddress(hlib,'glVertexPointer');
+      pointer(glViewport):=GetProcAddress(hlib,'glViewport');
+      pointer(glPointSizePointerOES):=GetProcAddress(hlib,'glPointSizePointerOES');
+    end;
+
+procedure init;
+begin
+    Loadgles11('libGLESv1_CM.so');
+end;
+
+
+initialization
+  Loadgles11('gles11');
+finalization
+  Freegles11;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/jni.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,538 @@
+unit jni;
+{$ifdef fpc}
+ {$packrecords c}
+{$endif}
+
+interface
+
+(*
+ * Manifest constants.
+ *)
+const JNI_FALSE=0;
+      JNI_TRUE=1;
+
+      JNI_VERSION_1_1=$00010001;
+      JNI_VERSION_1_2=$00010002;
+      JNI_VERSION_1_4=$00010004;
+      JNI_VERSION_1_6=$00010006;
+
+      JNI_OK=0;         // no error
+      JNI_ERR=-1;       // generic error
+      JNI_EDETACHED=-2; // thread detached from the VM
+      JNI_EVERSION=-3;  // JNI version error
+
+      JNI_COMMIT=1;     // copy content, do not free buffer
+      JNI_ABORT=2;      // free buffer w/o copying back
+
+(*
+ * Type definitions.
+ *)
+type va_list=pointer;
+
+     jboolean=byte;        // unsigned 8 bits
+     jbyte=shortint;       // signed 8 bits
+     jchar=word;           // unsigned 16 bits
+     jshort=smallint;      // signed 16 bits
+     jint=longint;         // signed 32 bits
+     jlong=int64;          // signed 64 bits
+     jfloat=single;        // 32-bit IEEE 754
+     jdouble=double;       // 64-bit IEEE 754
+
+     jsize=jint;            // "cardinal indices and sizes"
+
+     Pjboolean=^jboolean;
+     Pjbyte=^jbyte;
+     Pjchar=^jchar;
+     Pjshort=^jshort;
+     Pjint=^jint;
+     Pjlong=^jlong;
+     Pjfloat=^jfloat;
+     Pjdouble=^jdouble;
+
+     Pjsize=^jsize;
+
+     // Reference type
+     jobject=pointer;
+     jclass=jobject;
+     jstring=jobject;
+     jarray=jobject;
+     jobjectArray=jarray;
+     jbooleanArray=jarray;
+     jbyteArray=jarray;
+     jcharArray=jarray;
+     jshortArray=jarray;
+     jintArray=jarray;
+     jlongArray=jarray;
+     jfloatArray=jarray;
+     jdoubleArray=jarray;
+     jthrowable=jobject;
+     jweak=jobject;
+     jref=jobject;
+
+     //PPointer=^pointer;
+     Pjobject=^jobject;
+     Pjclass=^jclass;
+     Pjstring=^jstring;
+     Pjarray=^jarray;
+     PjobjectArray=^jobjectArray;
+     PjbooleanArray=^jbooleanArray;
+     PjbyteArray=^jbyteArray;
+     PjcharArray=^jcharArray;
+     PjshortArray=^jshortArray;
+     PjintArray=^jintArray;
+     PjlongArray=^jlongArray;
+     PjfloatArray=^jfloatArray;
+     PjdoubleArray=^jdoubleArray;
+     Pjthrowable=^jthrowable;
+     Pjweak=^jweak;
+     Pjref=^jref;
+
+     _jfieldID=record // opaque structure
+     end;
+     jfieldID=^_jfieldID;// field IDs
+     PjfieldID=^jfieldID;
+
+     _jmethodID=record // opaque structure
+     end;
+     jmethodID=^_jmethodID;// method IDs
+     PjmethodID=^jmethodID;
+
+     PJNIInvokeInterface=^JNIInvokeInterface;
+
+     Pjvalue=^jvalue;
+     jvalue={$ifdef packedrecords}packed{$endif} record
+      case integer of
+       0:(z:jboolean);
+       1:(b:jbyte);
+       2:(c:jchar);
+       3:(s:jshort);
+       4:(i:jint);
+       5:(j:jlong);
+       6:(f:jfloat);
+       7:(d:jdouble);
+       8:(l:jobject);
+     end;
+
+     jobjectRefType=(
+      JNIInvalidRefType=0,
+      JNILocalRefType=1,
+      JNIGlobalRefType=2,
+      JNIWeakGlobalRefType=3);
+
+     PJNINativeMethod=^JNINativeMethod;
+     JNINativeMethod={$ifdef packedrecords}packed{$endif} record
+      name:pchar;
+      signature:pchar;
+      fnPtr:pointer;
+     end;
+
+     PJNINativeInterface=^JNINativeInterface;
+
+     _JNIEnv={$ifdef packedrecords}packed{$endif} record
+      functions:PJNINativeInterface;
+     end;
+
+     _JavaVM={$ifdef packedrecords}packed{$endif} record
+      functions:PJNIInvokeInterface;
+     end;
+
+     C_JNIEnv=^JNINativeInterface;
+     JNIEnv=^JNINativeInterface;
+     JavaVM=^JNIInvokeInterface;
+
+     PPJNIEnv=^PJNIEnv;
+     PJNIEnv=^JNIEnv;
+
+     PPJavaVM=^PJavaVM;
+     PJavaVM=^JavaVM;
+
+     JNINativeInterface={$ifdef packedrecords}packed{$endif} record
+      reserved0:pointer;
+      reserved1:pointer;
+      reserved2:pointer;
+      reserved3:pointer;
+
+      GetVersion:function(Env:PJNIEnv):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      DefineClass:function(Env:PJNIEnv;const Name:pchar;Loader:JObject;const Buf:PJByte;Len:JSize):JClass;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      FindClass:function(Env:PJNIEnv;const Name:pchar):JClass;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // Reflection Support
+      FromReflectedMethod:function(Env:PJNIEnv;Method:JObject):JMethodID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      FromReflectedField:function(Env:PJNIEnv;Field:JObject):JFieldID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ToReflectedMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;IsStatic:JBoolean):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetSuperclass:function(Env:PJNIEnv;Sub:JClass):JClass;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      IsAssignableFrom:function(Env:PJNIEnv;Sub:JClass;Sup:JClass):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // Reflection Support
+      ToReflectedField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;IsStatic:JBoolean):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      Throw:function(Env:PJNIEnv;Obj:JThrowable):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ThrowNew:function(Env:PJNIEnv;AClass:JClass;const Msg:pchar):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ExceptionOccurred:function(Env:PJNIEnv):JThrowable;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ExceptionDescribe:procedure(Env:PJNIEnv);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ExceptionClear:procedure(Env:PJNIEnv);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      FatalError:procedure(Env:PJNIEnv;const Msg:pchar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // Local Reference Management
+      PushLocalFrame:function(Env:PJNIEnv;Capacity:JInt):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      PopLocalFrame:function(Env:PJNIEnv;Result:JObject):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      NewGlobalRef:function(Env:PJNIEnv;LObj:JObject):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      DeleteGlobalRef:procedure(Env:PJNIEnv;GRef:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      DeleteLocalRef:procedure(Env:PJNIEnv;Obj:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      IsSameObject:function(Env:PJNIEnv;Obj1:JObject;Obj2:JObject):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // Local Reference Management
+      NewLocalRef:function(Env:PJNIEnv;Ref:JObject):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      EnsureLocalCapacity:function(Env:PJNIEnv;Capacity:JInt):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      AllocObject:function(Env:PJNIEnv;AClass:JClass):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewObject:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewObjectV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewObjectA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetObjectClass:function(Env:PJNIEnv;Obj:JObject):JClass;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      IsInstanceOf:function(Env:PJNIEnv;Obj:JObject;AClass:JClass):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetMethodID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JMethodID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallObjectMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallObjectMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallObjectMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallBooleanMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallBooleanMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallBooleanMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallByteMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallByteMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallByteMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallCharMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallCharMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallCharMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallShortMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallShortMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallShortMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallIntMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallIntMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallIntMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallLongMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallLongMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallLongMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallFloatMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallFloatMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallFloatMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallDoubleMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallDoubleMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallDoubleMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallVoidMethod:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallVoidMethodV:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallVoidMethodA:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualObjectMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualObjectMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualObjectMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualBooleanMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualBooleanMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualBooleanMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualByteMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualByteMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualByteMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualCharMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualCharMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualCharMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualShortMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualShortMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualShortMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualIntMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualIntMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualIntMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualLongMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualLongMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualLongMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualFloatMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualFloatMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualFloatMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualDoubleMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualDoubleMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualDoubleMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallNonvirtualVoidMethod:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualVoidMethodV:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallNonvirtualVoidMethodA:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetFieldID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JFieldID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetObjectField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetBooleanField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetByteField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetCharField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetShortField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetIntField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetLongField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetFloatField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetDoubleField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      SetObjectField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetBooleanField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JBoolean);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetByteField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JByte);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetCharField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetShortField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JShort);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetIntField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetLongField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JLong);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetFloatField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JFloat);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetDoubleField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JDouble);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetStaticMethodID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JMethodID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticObjectMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticObjectMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticObjectMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticBooleanMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticBooleanMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticBooleanMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticByteMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticByteMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticByteMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticCharMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticCharMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticCharMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticShortMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticShortMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticShortMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticIntMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticIntMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticIntMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticLongMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticLongMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticLongMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticFloatMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticFloatMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticFloatMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticDoubleMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticDoubleMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticDoubleMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      CallStaticVoidMethod:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticVoidMethodV:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      CallStaticVoidMethodA:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetStaticFieldID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JFieldID;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticObjectField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticBooleanField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticByteField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticCharField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticShortField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticIntField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticLongField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticFloatField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStaticDoubleField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      SetStaticObjectField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetStaticBooleanField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JBoolean);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetStaticByteField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JByte);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetStaticCharField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetStaticShortField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JShort);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetStaticIntField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetStaticLongField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JLong);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetStaticFloatField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JFloat);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetStaticDoubleField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JDouble);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      NewString:function(Env:PJNIEnv;const Unicode:PJChar;Len:JSize):JString;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStringLength:function(Env:PJNIEnv;Str:JString):JSize;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStringChars:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):PJChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseStringChars:procedure(Env:PJNIEnv;Str:JString;const Chars:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      NewStringUTF:function(Env:PJNIEnv;const UTF:pchar):JString;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStringUTFLength:function(Env:PJNIEnv;Str:JString):JSize;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStringUTFChars:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):pchar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseStringUTFChars:procedure(Env:PJNIEnv;Str:JString;const Chars:pchar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetArrayLength:function(Env:PJNIEnv;AArray:JArray):JSize;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      NewObjectArray:function(Env:PJNIEnv;Len:JSize;AClass:JClass;Init:JObject):JObjectArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetObjectArrayElement:function(Env:PJNIEnv;AArray:JObjectArray;Index:JSize):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetObjectArrayElement:procedure(Env:PJNIEnv;AArray:JObjectArray;Index:JSize;Val:JObject);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      NewBooleanArray:function(Env:PJNIEnv;Len:JSize):JBooleanArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewByteArray:function(Env:PJNIEnv;Len:JSize):JByteArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewCharArray:function(Env:PJNIEnv;Len:JSize):JCharArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewShortArray:function(Env:PJNIEnv;Len:JSize):JShortArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewIntArray:function(Env:PJNIEnv;Len:JSize):JIntArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewLongArray:function(Env:PJNIEnv;Len:JSize):JLongArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewFloatArray:function(Env:PJNIEnv;Len:JSize):JFloatArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      NewDoubleArray:function(Env:PJNIEnv;Len:JSize):JDoubleArray;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetBooleanArrayElements:function(Env:PJNIEnv;AArray:JBooleanArray;IsCopy:PJBoolean):PJBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetByteArrayElements:function(Env:PJNIEnv;AArray:JByteArray;IsCopy:PJBoolean):PJByte;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetCharArrayElements:function(Env:PJNIEnv;AArray:JCharArray;IsCopy:PJBoolean):PJChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetShortArrayElements:function(Env:PJNIEnv;AArray:JShortArray;IsCopy:PJBoolean):PJShort;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetIntArrayElements:function(Env:PJNIEnv;AArray:JIntArray;IsCopy:PJBoolean):PJInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetLongArrayElements:function(Env:PJNIEnv;AArray:JLongArray;IsCopy:PJBoolean):PJLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetFloatArrayElements:function(Env:PJNIEnv;AArray:JFloatArray;IsCopy:PJBoolean):PJFloat;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetDoubleArrayElements:function(Env:PJNIEnv;AArray:JDoubleArray;IsCopy:PJBoolean):PJDouble;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      ReleaseBooleanArrayElements:procedure(Env:PJNIEnv;AArray:JBooleanArray;Elems:PJBoolean;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseByteArrayElements:procedure(Env:PJNIEnv;AArray:JByteArray;Elems:PJByte;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseCharArrayElements:procedure(Env:PJNIEnv;AArray:JCharArray;Elems:PJChar;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseShortArrayElements:procedure(Env:PJNIEnv;AArray:JShortArray;Elems:PJShort;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseIntArrayElements:procedure(Env:PJNIEnv;AArray:JIntArray;Elems:PJInt;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseLongArrayElements:procedure(Env:PJNIEnv;AArray:JLongArray;Elems:PJLong;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseFloatArrayElements:procedure(Env:PJNIEnv;AArray:JFloatArray;Elems:PJFloat;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseDoubleArrayElements:procedure(Env:PJNIEnv;AArray:JDoubleArray;Elems:PJDouble;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetBooleanArrayRegion:procedure(Env:PJNIEnv;AArray:JBooleanArray;Start:JSize;Len:JSize;Buf:PJBoolean);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetByteArrayRegion:procedure(Env:PJNIEnv;AArray:JByteArray;Start:JSize;Len:JSize;Buf:PJByte);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetCharArrayRegion:procedure(Env:PJNIEnv;AArray:JCharArray;Start:JSize;Len:JSize;Buf:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetShortArrayRegion:procedure(Env:PJNIEnv;AArray:JShortArray;Start:JSize;Len:JSize;Buf:PJShort);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetIntArrayRegion:procedure(Env:PJNIEnv;AArray:JIntArray;Start:JSize;Len:JSize;Buf:PJInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetLongArrayRegion:procedure(Env:PJNIEnv;AArray:JLongArray;Start:JSize;Len:JSize;Buf:PJLong);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetFloatArrayRegion:procedure(Env:PJNIEnv;AArray:JFloatArray;Start:JSize;Len:JSize;Buf:PJFloat);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetDoubleArrayRegion:procedure(Env:PJNIEnv;AArray:JDoubleArray;Start:JSize;Len:JSize;Buf:PJDouble);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      SetBooleanArrayRegion:procedure(Env:PJNIEnv;AArray:JBooleanArray;Start:JSize;Len:JSize;Buf:PJBoolean);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetByteArrayRegion:procedure(Env:PJNIEnv;AArray:JByteArray;Start:JSize;Len:JSize;Buf:PJByte);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetCharArrayRegion:procedure(Env:PJNIEnv;AArray:JCharArray;Start:JSize;Len:JSize;Buf:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetShortArrayRegion:procedure(Env:PJNIEnv;AArray:JShortArray;Start:JSize;Len:JSize;Buf:PJShort);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetIntArrayRegion:procedure(Env:PJNIEnv;AArray:JIntArray;Start:JSize;Len:JSize;Buf:PJInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetLongArrayRegion:procedure(Env:PJNIEnv;AArray:JLongArray;Start:JSize;Len:JSize;Buf:PJLong);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetFloatArrayRegion:procedure(Env:PJNIEnv;AArray:JFloatArray;Start:JSize;Len:JSize;Buf:PJFloat);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      SetDoubleArrayRegion:procedure(Env:PJNIEnv;AArray:JDoubleArray;Start:JSize;Len:JSize;Buf:PJDouble);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      RegisterNatives:function(Env:PJNIEnv;AClass:JClass;const Methods:PJNINativeMethod;NMethods:JInt):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      UnregisterNatives:function(Env:PJNIEnv;AClass:JClass):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      MonitorEnter:function(Env:PJNIEnv;Obj:JObject):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      MonitorExit:function(Env:PJNIEnv;Obj:JObject):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      GetJavaVM:function(Env:PJNIEnv;VM:PJavaVM):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // String Operations
+      GetStringRegion:procedure(Env:PJNIEnv;Str:JString;Start:JSize;Len:JSize;Buf:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetStringUTFRegion:procedure(Env:PJNIEnv;Str:JString;Start:JSize;Len:JSize;Buf:pchar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // Array Operations
+      GetPrimitiveArrayCritical:function(Env:PJNIEnv;AArray:JArray;IsCopy:PJBoolean):pointer;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleasePrimitiveArrayCritical:procedure(Env:PJNIEnv;AArray:JArray;CArray:pointer;Mode:JInt);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // String Operations
+      GetStringCritical:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):PJChar;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      ReleaseStringCritical:procedure(Env:PJNIEnv;Str:JString;CString:PJChar);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // Weak Global References
+      NewWeakGlobalRef:function(Env:PJNIEnv;Obj:JObject):JWeak;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      DeleteWeakGlobalRef:procedure(Env:PJNIEnv;Ref:JWeak);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // Exceptions
+      ExceptionCheck:function(Env:PJNIEnv):JBoolean;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // J2SDK1_4
+      NewDirectByteBuffer:function(Env:PJNIEnv;Address:pointer;Capacity:JLong):JObject;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetDirectBufferAddress:function(Env:PJNIEnv;Buf:JObject):pointer;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetDirectBufferCapacity:function(Env:PJNIEnv;Buf:JObject):JLong;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+
+      // added in JNI 1.6
+      GetObjectRefType:function(Env:PJNIEnv;AObject:JObject):jobjectRefType;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+     end;
+
+     JNIInvokeInterface={$ifdef packedrecords}packed{$endif} record
+      reserved0:pointer;
+      reserved1:pointer;
+      reserved2:pointer;
+
+      DestroyJavaVM:function(PVM:PJavaVM):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      AttachCurrentThread:function(PVM:PJavaVM;PEnv:PPJNIEnv;Args:pointer):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      DetachCurrentThread:function(PVM:PJavaVM):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      GetEnv:function(PVM:PJavaVM;PEnv:Ppointer;Version:JInt):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+      AttachCurrentThreadAsDaemon:function(PVM:PJavaVM;PEnv:PPJNIEnv;Args:pointer):JInt;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+     end;
+
+     JavaVMAttachArgs={$ifdef packedrecords}packed{$endif} record
+      version:jint;  // must be >= JNI_VERSION_1_2
+      name:pchar;    // NULL or name of thread as modified UTF-8 str
+      group:jobject; // global ref of a ThreadGroup object, or NULL
+     end;
+
+(**
+ * JNI 1.2+ initialization.  (As of 1.6, the pre-1.2 structures are no
+ * longer supported.)
+ *)
+
+     PJavaVMOption=^JavaVMOption;
+     JavaVMOption={$ifdef packedrecords}packed{$endif} record
+      optionString:pchar;
+      extraInfo:pointer;
+     end;
+
+     JavaVMInitArgs={$ifdef packedrecords}packed{$endif} record
+      version:jint; // use JNI_VERSION_1_2 or later
+      nOptions:jint;
+      options:PJavaVMOption;
+      ignoreUnrecognized:Pjboolean;
+     end;
+
+(*
+ * VM initialization functions.
+ *
+ * Note these are the only symbols exported for JNI by the VM.
+ *)
+{$ifdef jniexternals}
+function JNI_GetDefaultJavaVMInitArgs(p:pointer):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}external 'jni' name 'JNI_GetDefaultJavaVMInitArgs';
+function JNI_CreateJavaVM(vm:PPJavaVM;AEnv:PPJNIEnv;p:pointer):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}external 'jni' name 'JNI_CreateJavaVM';
+function JNI_GetCreatedJavaVMs(vm:PPJavaVM;ASize:jsize;p:Pjsize):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}external 'jni' name 'JNI_GetCreatedJavaVMs';
+{$endif}
+
+(*
+ * Prototypes for functions exported by loadable shared libs.  These are
+ * called by JNI, not provided by JNI.
+ *)
+
+const curVM:PJavaVM=nil;
+      curEnv:PJNIEnv=nil;
+      
+(*
+function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+*)
+implementation
+
+function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint;{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+begin
+ reserved:=reserved;
+ curVM:=vm;
+ exit(JNI_VERSION_1_6);
+end;
+
+procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
+begin
+ vm:=vm;
+ reserved:=reserved;
+end;
+
+end.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/log.pas	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,28 @@
+unit log;
+{$ifdef fpc}
+ {$mode delphi}
+{$endif}
+
+interface
+
+const libname='liblog.so';
+
+      ANDROID_LOG_UNKNOWN=0;
+      ANDROID_LOG_DEFAULT=1;
+      ANDROID_LOG_VERBOSE=2;
+      ANDROID_LOG_DEBUG=3;
+      ANDROID_LOG_INFO=4;
+      ANDROID_LOG_WARN=5;
+      ANDROID_LOG_ERROR=6;
+      ANDROID_LOG_FATAL=7;
+      ANDROID_LOG_SILENT=8;
+
+type android_LogPriority=integer;
+
+function __android_log_write(prio:longint;tag,text:pchar):longint; cdecl; external libname name '__android_log_write';
+
+//function __android_log_print(prio:longint;tag,print:pchar;params:array of pchar):longint; cdecl; external libname name '__android_log_print';
+  
+implementation
+
+end.
Binary file project_files/AudioMono/Music/Art.ogg has changed
Binary file project_files/AudioMono/Music/Brick.ogg has changed
Binary file project_files/AudioMono/Music/Castle.ogg has changed
Binary file project_files/AudioMono/Music/City.ogg has changed
Binary file project_files/AudioMono/Music/Compost.ogg has changed
Binary file project_files/AudioMono/Music/Desert.ogg has changed
Binary file project_files/AudioMono/Music/EarthRise.ogg has changed
Binary file project_files/AudioMono/Music/Freeway.ogg has changed
Binary file project_files/AudioMono/Music/Golf.ogg has changed
Binary file project_files/AudioMono/Music/Halloween.ogg has changed
Binary file project_files/AudioMono/Music/Nature.ogg has changed
Binary file project_files/AudioMono/Music/Olympics.ogg has changed
Binary file project_files/AudioMono/Music/Rock.ogg has changed
Binary file project_files/AudioMono/Music/Sheep.ogg has changed
Binary file project_files/AudioMono/Music/bath.ogg has changed
Binary file project_files/AudioMono/Music/hell.ogg has changed
Binary file project_files/AudioMono/Music/main_theme.ogg has changed
Binary file project_files/AudioMono/Music/oriental.ogg has changed
Binary file project_files/AudioMono/Music/pirate.ogg has changed
Binary file project_files/AudioMono/Music/snow.ogg has changed
Binary file project_files/AudioMono/Music/underwater.ogg has changed
Binary file project_files/AudioMono/Sounds/1C.ogg has changed
Binary file project_files/AudioMono/Sounds/2D.ogg has changed
Binary file project_files/AudioMono/Sounds/3E.ogg has changed
Binary file project_files/AudioMono/Sounds/4F.ogg has changed
Binary file project_files/AudioMono/Sounds/5G.ogg has changed
Binary file project_files/AudioMono/Sounds/6A.ogg has changed
Binary file project_files/AudioMono/Sounds/7B.ogg has changed
Binary file project_files/AudioMono/Sounds/8C.ogg has changed
Binary file project_files/AudioMono/Sounds/9D.ogg has changed
Binary file project_files/AudioMono/Sounds/BirdyLay.ogg has changed
Binary file project_files/AudioMono/Sounds/CollectCrate.ogg has changed
Binary file project_files/AudioMono/Sounds/Droplet1.ogg has changed
Binary file project_files/AudioMono/Sounds/Droplet2.ogg has changed
Binary file project_files/AudioMono/Sounds/Droplet3.ogg has changed
Binary file project_files/AudioMono/Sounds/Hellish.ogg has changed
Binary file project_files/AudioMono/Sounds/Whistle.ogg has changed
Binary file project_files/AudioMono/Sounds/Yoohoo.ogg has changed
Binary file project_files/AudioMono/Sounds/baseballbat.ogg has changed
Binary file project_files/AudioMono/Sounds/bee.ogg has changed
Binary file project_files/AudioMono/Sounds/beewater.ogg has changed
Binary file project_files/AudioMono/Sounds/bump.ogg has changed
Binary file project_files/AudioMono/Sounds/cake2.ogg has changed
Binary file project_files/AudioMono/Sounds/denied.ogg has changed
Binary file project_files/AudioMono/Sounds/drillgun.ogg has changed
Binary file project_files/AudioMono/Sounds/egg.ogg has changed
Binary file project_files/AudioMono/Sounds/explosion.ogg has changed
Binary file project_files/AudioMono/Sounds/graveimpact.ogg has changed
Binary file project_files/AudioMono/Sounds/grenadeimpact.ogg has changed
Binary file project_files/AudioMono/Sounds/gun.ogg has changed
Binary file project_files/AudioMono/Sounds/hammer.ogg has changed
Binary file project_files/AudioMono/Sounds/hell_growl.ogg has changed
Binary file project_files/AudioMono/Sounds/hell_ooff.ogg has changed
Binary file project_files/AudioMono/Sounds/hell_ow.ogg has changed
Binary file project_files/AudioMono/Sounds/hell_ugh.ogg has changed
Binary file project_files/AudioMono/Sounds/hogchant3.ogg has changed
Binary file project_files/AudioMono/Sounds/homerun.ogg has changed
Binary file project_files/AudioMono/Sounds/lowgravity.ogg has changed
Binary file project_files/AudioMono/Sounds/melonimpact.ogg has changed
Binary file project_files/AudioMono/Sounds/mineimpact.ogg has changed
Binary file project_files/AudioMono/Sounds/minetick.ogg has changed
Binary file project_files/AudioMono/Sounds/molotov.ogg has changed
Binary file project_files/AudioMono/Sounds/mortar.ogg has changed
Binary file project_files/AudioMono/Sounds/parachute.ogg has changed
Binary file project_files/AudioMono/Sounds/pickhammer.ogg has changed
Binary file project_files/AudioMono/Sounds/placed.ogg has changed
Binary file project_files/AudioMono/Sounds/plane.ogg has changed
Binary file project_files/AudioMono/Sounds/rcplane.ogg has changed
Binary file project_files/AudioMono/Sounds/ride_of_the_valkyries.ogg has changed
Binary file project_files/AudioMono/Sounds/ropeattach.ogg has changed
Binary file project_files/AudioMono/Sounds/roperelease.ogg has changed
Binary file project_files/AudioMono/Sounds/ropeshot.ogg has changed
Binary file project_files/AudioMono/Sounds/shotgunfire.ogg has changed
Binary file project_files/AudioMono/Sounds/shotgunreload.ogg has changed
Binary file project_files/AudioMono/Sounds/shutterclick.ogg has changed
Binary file project_files/AudioMono/Sounds/sinegun.ogg has changed
Binary file project_files/AudioMono/Sounds/skip.ogg has changed
Binary file project_files/AudioMono/Sounds/sniperreload.ogg has changed
Binary file project_files/AudioMono/Sounds/splash.ogg has changed
Binary file project_files/AudioMono/Sounds/steam.ogg has changed
Binary file project_files/AudioMono/Sounds/steps.ogg has changed
Binary file project_files/AudioMono/Sounds/suddendeath.ogg has changed
Binary file project_files/AudioMono/Sounds/switchhog.ogg has changed
Binary file project_files/AudioMono/Sounds/throwpowerup.ogg has changed
Binary file project_files/AudioMono/Sounds/throwrelease.ogg has changed
Binary file project_files/AudioMono/Sounds/ufo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Amazing.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Brilliant.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Bugger.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Bungee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Cutitout.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Drat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Excellent.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Fire.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Firepunch1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Gonnagetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Grenade.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Hmm.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Justyouwait.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Leavemealone.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Melon.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ohdear.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ouch.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Perfect.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Revenge.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Runaway.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Solong.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Thisoneismine.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Watchthis.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Whatthe.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Whoopsee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/British/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Classic/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Amazing.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Brilliant.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Bugger.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Bungee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Cutitout.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Drat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Excellent.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Fire.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Firepunch1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Firepunch2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Firepunch3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Firepunch4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Firepunch5.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Firepunch6.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Gonnagetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Grenade.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Hmm.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Justyouwait.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Leavemealone.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Melon.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ohdear.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ouch.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Perfect.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Revenge.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Runaway.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Solong.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Thisoneismine.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Watchthis.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Whatthe.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Whoopsee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Default/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Amazing.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Brilliant.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Bugger.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Bungee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Cutitout.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Drat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Excellent.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Fire.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Firepunch1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Gonnagetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Grenade.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Hmm.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Justyouwait.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Leavemealone.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Melon.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ohdear.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ouch.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Perfect.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Revenge.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Runaway.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Solong.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Thisoneismine.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Watchthis.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Whatthe.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Whoopsee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Mobster/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Amazing.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Brilliant.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Bugger.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Bungee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Cutitout.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Drat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Excellent.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Fire.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Firepunch1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Firepunch2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Firepunch3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Firepunch4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Firepunch5.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Firepunch6.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Gonnagetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Grenade.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Hmm.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Justyouwait.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Leavemealone.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Melon.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ohdear.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ouch.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Perfect.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Revenge.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Runaway.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Solong.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Thisoneismine.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Watchthis.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Whatthe.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Whoopsee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Pirate/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Amazing.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Brilliant.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Bugger.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Bungee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Cutitout.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Drat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Excellent.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Fire.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Firepunch1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Firepunch2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Firepunch3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Firepunch4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Firepunch5.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Firepunch6.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Gonnagetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Grenade.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Hmm.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Justyouwait.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Leavemealone.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Melon.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ohdear.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ouch.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Perfect.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Revenge.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Runaway.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Solong.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Thisoneismine.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Watchthis.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Whatthe.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Whoopsee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Robot/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Amazing.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Brilliant.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Bugger.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Bungee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Cutitout.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Drat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Excellent.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Fire.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Firepunch1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Gonnagetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Grenade.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Hmm.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Justyouwait.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Leavemealone.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Melon.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ohdear.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ouch.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Perfect.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Revenge.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Runaway.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Solong.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Thisoneismine.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Watchthis.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Whatthe.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Whoopsee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Russian/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Amazing.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Brilliant.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Bugger.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Bungee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Cutitout.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Drat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Excellent.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Fire.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Firepunch1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Firepunch2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Firepunch3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Firepunch4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Firepunch5.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Firepunch6.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/FlawlessPossibility.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Gonnagetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Grenade.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Hmm.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Justyouwait.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Leavemealone.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Melon.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ohdear.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ouch.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Perfect.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Revenge.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Runaway.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Solong.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Thisoneismine.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/VictoryPossibility.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Watchthis.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Whatthe.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Whoopsee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Singer/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Amazing.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Boring.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Brilliant.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Bugger.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Bungee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Byebye.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Comeonthen.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Coward.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Cutitout.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Drat.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Enemydown.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Excellent.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Fire.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Firepunch1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Firepunch2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Firepunch3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Firepunch4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Firepunch5.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Firepunch6.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Firstblood.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Flawless.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Gonnagetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Grenade.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Hello.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Hmm.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Hurry.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Illgetyou.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Incoming.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Jump1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Jump2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Jump3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Justyouwait.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Kamikaze.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Laugh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Leavemealone.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Melon.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Missed.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Nooo.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Nutter.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ohdear.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ooff1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ooff2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ooff3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Oops.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ouch.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ow1.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ow2.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ow3.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Ow4.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Perfect.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/PoisonCough.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/PoisonMoan.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Reinforcements.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Revenge.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Runaway.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Sameteam.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Solong.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Stupid.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Takecover.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Thisoneismine.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Traitor.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Uh-oh.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Victory.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Watchit.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Watchthis.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Whatthe.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Whoopsee.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Yessir.ogg has changed
Binary file project_files/AudioMono/Sounds/voices/Surfer/Youllregretthat.ogg has changed
Binary file project_files/AudioMono/Sounds/warp.ogg has changed
Binary file project_files/AudioMono/Sounds/whipcrack.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Art.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Brick.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Castle.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/City.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Compost.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Desert.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/EarthRise.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Freeway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Halloween.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Nature.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Olympics.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Rock.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/Sheep.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/bath.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/hell.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/oriental.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/pirate.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/snow.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Music/underwater.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/1C.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/2D.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/3E.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/4F.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/5G.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/6A.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/7B.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/8C.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/9D.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/BirdyLay.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/CollectCrate.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/Droplet1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/Droplet2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/Droplet3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/Hellish.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/Whistle.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/Yoohoo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/baseballbat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/bee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/beewater.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/cake2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/denied.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/drillgun.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/egg.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/explosion.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/graveimpact.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/grenadeimpact.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/gun.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/hell_growl.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/hell_ooff.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/hell_ow.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/hell_ugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/hogchant3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/homerun.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/lowgravity.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/melonimpact.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/minetick.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/molotov.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/mortar.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/pickhammer.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/placed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/plane.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/rcplane.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/ride_of_the_valkyries.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/ropeattach.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/roperelease.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/ropeshot.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/shotgunfire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/shotgunreload.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/shutterclick.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/skip.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/sniperreload.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/splash.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/steam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/steps.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/suddendeath.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/switchhog.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/throwpowerup.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/throwrelease.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/ufo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Justyouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/British/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Firepunch2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Firepunch3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Firepunch4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Firepunch5.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Firepunch6.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Justyouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/PoisonCough.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/PoisonMoan.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Firepunch2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Firepunch3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Firepunch4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Firepunch5.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Firepunch6.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/JustYouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/PoisonCough.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/PoisonMoan.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Default_uk/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Justyouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Mobster/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Firepunch2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Firepunch3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Firepunch4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Firepunch5.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Firepunch6.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Justyouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Pirate/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Firepunch2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Firepunch3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Firepunch4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Firepunch5.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Firepunch6.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Justyouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Robot/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Justyouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Russian/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Firepunch2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Firepunch3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Firepunch4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Firepunch5.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Firepunch6.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/FlawlessPossibility.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Justyouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/VictoryPossibility.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Singer/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Amazing.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Boring.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Brilliant.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Bugger.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Bungee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Byebye.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Comeonthen.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Coward.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Cutitout.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Drat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Enemydown.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Excellent.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Fire.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Firepunch1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Firepunch2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Firepunch3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Firepunch4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Firepunch5.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Firepunch6.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Firstblood.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Flawless.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Gonnagetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Grenade.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Hello.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Hmm.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Hurry.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Illgetyou.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Incoming.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Jump1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Jump2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Jump3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Justyouwait.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Kamikaze.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Laugh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Leavemealone.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Melon.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Missed.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Nooo.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Nutter.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ohdear.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ooff1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ooff2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ooff3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Oops.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ouch.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ow1.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ow2.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ow3.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Ow4.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Perfect.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Reinforcements.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Revenge.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Runaway.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Sameteam.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Solong.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Stupid.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Takecover.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Thisoneismine.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Traitor.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Uh-oh.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Victory.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Watchit.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Watchthis.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Whatthe.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Whoopsee.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Yessir.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/voices/Surfer/Youllregretthat.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/warp.ogg has changed
Binary file project_files/HedgewarsMobile/Audio/Sounds/whipcrack.ogg has changed
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon Dec 05 18:38:07 2011 -0500
@@ -135,7 +135,7 @@
 
     NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", (int)(width * screenScale)];
     NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", (int)(height * screenScale)];
-    NSString *rotation = [[NSString alloc] initWithString:@"0"];
+    NSString *resourcePath = [[NSString alloc] initWithFormat:@"%@/Data", [[NSBundle mainBundle] resourcePath]];
 
     NSString *modelId = [HWUtils modelType];
     NSInteger tmpQuality;
@@ -168,12 +168,12 @@
     gameArgs[ 6] = [[[settings objectForKey:@"sound"] stringValue] UTF8String];                 //isSoundEnabled
     gameArgs[ 7] = [[[settings objectForKey:@"music"] stringValue] UTF8String];                 //isMusicEnabled
     gameArgs[ 8] = [[[settings objectForKey:@"alternate"] stringValue] UTF8String];             //cAltDamage
-    gameArgs[ 9] = [rotation UTF8String];                                                       //rotateQt
+    gameArgs[ 9] = [resourcePath UTF8String];                                                   //PathPrefix
     gameArgs[10] = ([HWUtils gameType] == gtSave) ? [self.savePath UTF8String] : NULL;          //recordFileName
 
     [verticalSize release];
     [horizontalSize release];
-    [rotation release];
+    [resourcePath release];
     [localeString release];
     [ipcString release];
 
--- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m	Mon Dec 05 18:38:07 2011 -0500
@@ -134,13 +134,13 @@
     NSString *sectionTitle = nil;
     switch (section) {
         case 0:
-            sectionTitle = NSLocalizedString(@"Main Configuration", @"");
+            sectionTitle = NSLocalizedString(@"Main Configuration", @"from the settings table");
             break;
         case 1:
-            sectionTitle = NSLocalizedString(@"Audio Preferences", @"");
+            sectionTitle = NSLocalizedString(@"Audio Preferences", @"from the settings table");
             break;
         case 2:
-            sectionTitle = NSLocalizedString(@"Other Settings", @"");
+            sectionTitle = NSLocalizedString(@"Other Settings", @"from the settings table");
             break;
         default:
             DLog(@"Nope");
@@ -173,13 +173,13 @@
             
             if (row == 0) {
                 editableCell.titleLabel.text = NSLocalizedString(@"Nickname","from the settings table");
-                editableCell.textField.placeholder = NSLocalizedString(@"Insert your username (if you have one)",@"");
+                editableCell.textField.placeholder = NSLocalizedString(@"Insert your username (if you have one)",@"from the settings table");
                 editableCell.textField.text = [settings objectForKey:@"username"];
                 editableCell.textField.secureTextEntry = NO;
                 editableCell.tag = 40;
             } else {
                 editableCell.titleLabel.text = NSLocalizedString(@"Password","from the settings table");
-                editableCell.textField.placeholder = NSLocalizedString(@"Insert your password",@"");
+                editableCell.textField.placeholder = NSLocalizedString(@"Insert your password",@"from the settings table");
                 editableCell.textField.text = [settings objectForKey:@"password"];
                 editableCell.textField.secureTextEntry = YES;
                 editableCell.tag = 50;
@@ -200,11 +200,11 @@
             
             switchContent = (UISwitch *)cell.accessoryView;
             if (row == 0) {
-                cell.textLabel.text = NSLocalizedString(@"Sound", @"");
+                cell.textLabel.text = NSLocalizedString(@"Sound", @"from the settings table");
                 switchContent.on = [[settings objectForKey:@"sound"] boolValue];
                 switchContent.tag = 10;
             } else {
-                cell.textLabel.text = NSLocalizedString(@"Music", @"");
+                cell.textLabel.text = NSLocalizedString(@"Music", @"from the settings table");
                 switchContent.on = [[settings objectForKey:@"music"] boolValue];
                 switchContent.tag = 20;
             }
@@ -223,20 +223,20 @@
             cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
             switch (row) {
                 case 0:
-                    cell.textLabel.text = NSLocalizedString(@"Alternate Damage", @"");
-                    cell.detailTextLabel.text = NSLocalizedString(@"Damage popups will notify you on every single hit", @"");
+                    cell.textLabel.text = NSLocalizedString(@"Alternate Damage", @"from the settings table");
+                    cell.detailTextLabel.text = NSLocalizedString(@"Damage popups will notify you on every single hit", @"from the settings table");
                     switchContent.on = [[settings objectForKey:@"alternate"] boolValue];
                     switchContent.tag = 30;
                     break;
                 case 1:
                     cell.textLabel.text = NSLocalizedString(@"Sync Schemes and Weapons", @"");
-                    cell.detailTextLabel.text = NSLocalizedString(@"Choosing a Scheme will select its associated Weapon", @"");
+                    cell.detailTextLabel.text = NSLocalizedString(@"Choosing a Scheme will select its associated Weapon", @"from the settings table");
                     switchContent.on = [[settings objectForKey:@"sync_ws"] boolValue];
                     switchContent.tag = 90;
                     break;
                 case 2:
                     cell.textLabel.text = NSLocalizedString(@"Classic Ammo Menu", @"");
-                    cell.detailTextLabel.text = NSLocalizedString(@"Select which style of ammo menu you prefer",@"");
+                    cell.detailTextLabel.text = NSLocalizedString(@"Select which style of ammo menu you prefer",@"from the settings table");
                     switchContent.on = [[settings objectForKey:@"classic_menu"] boolValue];
                     switchContent.tag = 60;
                     break;
--- a/project_files/HedgewarsMobile/Classes/HWUtils.h	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.h	Mon Dec 05 18:38:07 2011 -0500
@@ -37,9 +37,11 @@
 
 +(NSString *)modelType;
 +(NSArray *)teamColors;
++(void) releaseCache;
+
 +(NSInteger) randomPort;
 +(BOOL) isNetworkReachable;
-+(void) releaseCache;
++(UIView *)mainSDLViewInstance;
 
 @end
 
--- a/project_files/HedgewarsMobile/Classes/HWUtils.m	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.m	Mon Dec 05 18:38:07 2011 -0500
@@ -26,6 +26,7 @@
 #import <SystemConfiguration/SCNetworkReachability.h>
 #import "hwconsts.h"
 #import "EngineProtocolNetwork.h"
+#import "SDL_uikitwindow.h"
 
 static NSString *cachedModel = nil;
 static NSArray *cachedColors = nil;
@@ -62,7 +63,7 @@
 }
 
 #pragma mark -
-#pragma mark Helper Functions
+#pragma mark Helper Functions with cache
 +(NSString *)modelType {
     if (cachedModel == nil) {
         size_t size;
@@ -94,6 +95,13 @@
     return cachedColors;
 }
 
++(void) releaseCache {
+    [cachedModel release], cachedModel = nil;
+    [cachedColors release], cachedColors = nil;
+}
+
+#pragma mark -
+#pragma mark Helper Functions without cache
 +(NSInteger) randomPort {
     srandom(time(NULL));
     NSInteger res = (random() % 64511) + 1024;
@@ -138,9 +146,15 @@
     return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO;
 }
 
-+(void) releaseCache {
-    [cachedModel release], cachedModel = nil;
-    [cachedColors release], cachedColors = nil;
++(UIView *)mainSDLViewInstance {
+    SDL_Window *window = HW_getSDLWindow();
+    if (window == NULL) {
+        SDL_SetError("Window does not exist");
+        return nil;
+    }
+    SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
+    SDL_uikitview *view = data != NULL ? data->view : nil;
+    return view;
 }
 
 @end
--- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Mon Dec 05 18:38:07 2011 -0500
@@ -23,8 +23,6 @@
 #import "SDL_sysvideo.h"
 #import "SDL_uikitkeyboard.h"
 
-//FIXME: add a proper #import when this is exposed in SDL
-extern UIView *SDL_getUikitView(void *);
 
 #define VIEW_HEIGHT 200
 
@@ -115,7 +113,7 @@
                                              cancelButtonTitle:NSLocalizedString(@"Well, maybe not...", @"")
                                         destructiveButtonTitle:NSLocalizedString(@"Of course!", @"")
                                              otherButtonTitles:nil];
-            [actionSheet showInView:(IS_IPAD() ? self.view : SDL_getUikitView(HW_getSDLWindow()))];
+            [actionSheet showInView:(IS_IPAD() ? self.view : [HWUtils mainSDLViewInstance])];
             [actionSheet release];
 
             break;
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m	Mon Dec 05 18:38:07 2011 -0500
@@ -93,13 +93,13 @@
         NSString *descComplete = [[NSString alloc] initWithContentsOfFile:descLocation encoding:NSUTF8StringEncoding error:NULL];
         [descLocation release];
         NSArray *descArray = [descComplete componentsSeparatedByString:@"\n"];
-        NSMutableArray *filteredArray = [[NSMutableArray alloc] initWithCapacity:[descArray count]];
+        NSMutableArray *filteredArray = [[NSMutableArray alloc] initWithCapacity:[descArray count]/3];
         [descComplete release];
         // sanity check to avoid having missions and descriptions conflicts
         for (int i = 0; i < [self.listOfMissions count]; i++) {
             NSString *desc = [[self.listOfMissions objectAtIndex:i] stringByDeletingPathExtension];
             for (NSString *str in descArray)
-                if ([str hasPrefix:desc]) {
+                if ([str hasPrefix:desc] && [str hasSuffix:@"\""]) {
                     NSArray *descriptionText = [str componentsSeparatedByString:@"\""];
                     [filteredArray insertObject:[descriptionText objectAtIndex:1] atIndex:i];
                     break;
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m	Mon Dec 05 18:38:07 2011 -0500
@@ -23,8 +23,6 @@
 #import "OverlayViewController.h"
 #import "AmmoMenuViewController.h"
 
-//FIXME: add a proper #import when this is exposed in SDL
-extern UIView *SDL_getUikitView(void *);
 
 // cache the grenade time
 static NSInteger grenadeTime;
@@ -55,7 +53,7 @@
     overlay_instance = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil];
     // in order to get rotation events we have to insert the view inside the first view of the second window
     //TODO: when multihead make sure that overlay is displayed in the touch-enabled window
-    [SDL_getUikitView(HW_getSDLWindow()) addSubview:overlay_instance.view];
+    [[HWUtils mainSDLViewInstance] addSubview:overlay_instance.view];
     grenadeTime = 2;
 
     if ([HWUtils gameType] == gtSave) {
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Mon Dec 05 18:38:07 2011 -0500
@@ -33,6 +33,11 @@
 		610782981440EE5C00645B29 /* gameMods.plist in Resources */ = {isa = PBXBuildFile; fileRef = 610782951440EE5C00645B29 /* gameMods.plist */; };
 		610D5FB21270E2660033333A /* Icon-Small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43411E290650040BA66 /* Icon-Small@2x.png */; };
 		610D5FB31270E26C0033333A /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43611E290650040BA66 /* Icon@2x.png */; };
+		61156521147F48B6006729A9 /* About.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61156520147F48B6006729A9 /* About.strings */; };
+		61156523147F48B7006729A9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61156522147F48B7006729A9 /* Localizable.strings */; };
+		61156525147F48B8006729A9 /* Scheme.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61156524147F48B8006729A9 /* Scheme.strings */; };
+		61177C02148B8BB100686905 /* uLandGenMaze.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61177C00148B8BB100686905 /* uLandGenMaze.pas */; };
+		61177C03148B8BB100686905 /* uLandOutline.pas in Sources */ = {isa = PBXBuildFile; fileRef = 61177C01148B8BB100686905 /* uLandOutline.pas */; };
 		61188BF212A6FE530026C5DA /* ammoButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D399129B350700911D8D /* ammoButton@2x.png */; };
 		61188BF312A6FE540026C5DA /* arrowDown@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D39A129B350700911D8D /* arrowDown@2x.png */; };
 		61188BF412A6FE560026C5DA /* arrowLeft@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D39B129B350700911D8D /* arrowLeft@2x.png */; };
@@ -57,6 +62,7 @@
 		61188C0712A6FE960026C5DA /* settingsButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FECA1298CE4E00D73365 /* settingsButton@2x.png */; };
 		61188C0812A6FE9A0026C5DA /* title@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 618899811299516000D55FD6 /* title@2x~iphone.png */; };
 		61188C0912A6FE9C0026C5DA /* tw@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D385129B348200911D8D /* tw@2x.png */; };
+		611D7A50142FDCD3006E0798 /* uTouch.pas in Sources */ = {isa = PBXBuildFile; fileRef = 611D7A4F142FDCD3006E0798 /* uTouch.pas */; };
 		611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611D9BF912497E9800008271 /* SavedGamesViewController.m */; };
 		611D9BFC12497E9800008271 /* SavedGamesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */; };
 		611E0EE711FB20610077A41E /* ammoButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 611E0EE511FB20610077A41E /* ammoButton.png */; };
@@ -370,6 +376,30 @@
 		610782931440EE5C00645B29 /* basicFlags.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = basicFlags.plist; path = Resources/basicFlags.plist; sourceTree = "<group>"; };
 		610782941440EE5C00645B29 /* credits.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = credits.plist; path = Resources/credits.plist; sourceTree = "<group>"; };
 		610782951440EE5C00645B29 /* gameMods.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = gameMods.plist; path = Resources/gameMods.plist; sourceTree = "<group>"; };
+		6115651A147F48AE006729A9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = Locale/English.lproj/About.strings; sourceTree = "<group>"; };
+		6115651B147F48AE006729A9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = Locale/English.lproj/Localizable.strings; sourceTree = "<group>"; };
+		6115651C147F48AE006729A9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = Locale/English.lproj/Scheme.strings; sourceTree = "<group>"; };
+		61156526147F49E1006729A9 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Locale/Spanish.lproj/About.strings; sourceTree = "<group>"; };
+		61156527147F4A2E006729A9 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Locale/Spanish.lproj/Localizable.strings; sourceTree = "<group>"; };
+		61156528147F4A3C006729A9 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Locale/Spanish.lproj/Scheme.strings; sourceTree = "<group>"; };
+		6115652B147F4C45006729A9 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = Locale/French.lproj/Scheme.strings; sourceTree = "<group>"; };
+		6115652C147F4C4C006729A9 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = Locale/French.lproj/Localizable.strings; sourceTree = "<group>"; };
+		6115652D147F4C52006729A9 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = Locale/French.lproj/About.strings; sourceTree = "<group>"; };
+		61156530147F4D10006729A9 /* Polish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Polish; path = Locale/Polish.lproj/About.strings; sourceTree = "<group>"; };
+		61156531147F4D17006729A9 /* Polish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Polish; path = Locale/Polish.lproj/Localizable.strings; sourceTree = "<group>"; };
+		61156532147F4D1E006729A9 /* Polish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Polish; path = Locale/Polish.lproj/Scheme.strings; sourceTree = "<group>"; };
+		61177BA7148A658900686905 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = Locale/German.lproj/Localizable.strings; sourceTree = "<group>"; };
+		61177BA9148A660C00686905 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = Locale/German.lproj/Scheme.strings; sourceTree = "<group>"; };
+		61177BAA148A661600686905 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = Locale/German.lproj/About.strings; sourceTree = "<group>"; };
+		61177BAC148A671600686905 /* Turkish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Turkish; path = Locale/Turkish.lproj/About.strings; sourceTree = "<group>"; };
+		61177BAD148A672000686905 /* Turkish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Turkish; path = Locale/Turkish.lproj/Localizable.strings; sourceTree = "<group>"; };
+		61177BAE148A672C00686905 /* Turkish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Turkish; path = Locale/Turkish.lproj/Scheme.strings; sourceTree = "<group>"; };
+		61177BE4148B881C00686905 /* Danish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Danish; path = Locale/Danish.lproj/About.strings; sourceTree = "<group>"; };
+		61177BF0148B882500686905 /* Danish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Danish; path = Locale/Danish.lproj/Localizable.strings; sourceTree = "<group>"; };
+		61177BF1148B882F00686905 /* Danish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Danish; path = Locale/Danish.lproj/Scheme.strings; sourceTree = "<group>"; };
+		61177C00148B8BB100686905 /* uLandGenMaze.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uLandGenMaze.pas; path = ../../hedgewars/uLandGenMaze.pas; sourceTree = SOURCE_ROOT; };
+		61177C01148B8BB100686905 /* uLandOutline.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uLandOutline.pas; path = ../../hedgewars/uLandOutline.pas; sourceTree = SOURCE_ROOT; };
+		611D7A4F142FDCD3006E0798 /* uTouch.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uTouch.pas; path = ../../hedgewars/uTouch.pas; sourceTree = SOURCE_ROOT; };
 		611D9BF812497E9800008271 /* SavedGamesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedGamesViewController.h; sourceTree = "<group>"; };
 		611D9BF912497E9800008271 /* SavedGamesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedGamesViewController.m; sourceTree = "<group>"; };
 		611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SavedGamesViewController.xib; sourceTree = "<group>"; };
@@ -709,6 +739,7 @@
 				29B97315FDCFA39411CA2CEA /* Other Sources */,
 				29B97323FDCFA39411CA2CEA /* Frameworks */,
 				29B97317FDCFA39411CA2CEA /* Resources */,
+				61156510147F481B006729A9 /* Locale */,
 				19C28FACFE9D520D11CA2CBB /* Products */,
 				61370652117B1D50004EE44A /* Entitlements-Distribution.plist */,
 				611E12FE117BBBDA0044B62F /* Entitlements-Development.plist */,
@@ -786,6 +817,16 @@
 			name = Frameworks;
 			sourceTree = "<group>";
 		};
+		61156510147F481B006729A9 /* Locale */ = {
+			isa = PBXGroup;
+			children = (
+				61156520147F48B6006729A9 /* About.strings */,
+				61156522147F48B7006729A9 /* Localizable.strings */,
+				61156524147F48B8006729A9 /* Scheme.strings */,
+			);
+			name = Locale;
+			sourceTree = "<group>";
+		};
 		611D9BF312497B7700008271 /* Satellite Controllers */ = {
 			isa = PBXGroup;
 			children = (
@@ -1149,6 +1190,9 @@
 		9283015C0F10E48900CC5A3C /* Pascal Sources */ = {
 			isa = PBXGroup;
 			children = (
+				61177C00148B8BB100686905 /* uLandGenMaze.pas */,
+				61177C01148B8BB100686905 /* uLandOutline.pas */,
+				611D7A4F142FDCD3006E0798 /* uTouch.pas */,
 				61A976B2136F668500DD9878 /* uCursor.pas */,
 				61E5D68C12AB006F00566F29 /* uLandPainted.pas */,
 				61A4A3A112A5CD56004D81E6 /* uCaptions.pas */,
@@ -1259,6 +1303,10 @@
 				Japanese,
 				French,
 				German,
+				Spanish,
+				Polish,
+				Turkish,
+				Danish,
 			);
 			mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
 			projectDirPath = "";
@@ -1494,6 +1542,9 @@
 				610782971440EE5C00645B29 /* credits.plist in Resources */,
 				610782981440EE5C00645B29 /* gameMods.plist in Resources */,
 				61B9A86814423A9D001541C1 /* GameConfigViewController-iPad.xib in Resources */,
+				61156521147F48B6006729A9 /* About.strings in Resources */,
+				61156523147F48B7006729A9 /* Localizable.strings in Resources */,
+				61156525147F48B8006729A9 /* Scheme.strings in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1511,7 +1562,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Icons\ncp    ${PROJECT_DIR}/../../QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png  ${PROJECT_DIR}/Data/Graphics/Icons/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n#copy mono audio\ncp -R ${PROJECT_DIR}/Audio/* ${PROJECT_DIR}/Data/\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`; do if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]]; then mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/; fi; done;\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n#remove cfg files since we have plists\nfind ${PROJECT_DIR}/Data/Scripts -name *.cfg -delete\nif ((`ls ${PROJECT_DIR}/Data/Scripts/Multiplayer/*.lua|wc -l` >= `ls ${PROJECT_DIR}/Data/Scripts/plist/*.plist|wc -l` ))\nthen\necho \"${PROJECT_DIR}/Data/Scripts/Multiplayer/Normal.plist:0: warning, missing plist implementation of a Multiplayer script file\"\nfi\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n#cleanup missions/trainings info\nsed -i -e -n '/\"/p' ${PROJECT_DIR}/Data/Locale/missions_en.txt\n\necho \"Done\"";
+			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Icons\ncp    ${PROJECT_DIR}/../../QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png  ${PROJECT_DIR}/Data/Graphics/Icons/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#copy mono audio\ncp -R ${PROJECT_DIR}/../AudioMono/* ${PROJECT_DIR}/Data/\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`;\ndo \n    if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]];\n    then\n        mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/;\n    fi;\ndone;\n\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n#remove cfg files since we have plists\nfind ${PROJECT_DIR}/Data/Scripts -name *.cfg -delete\nif ((`ls ${PROJECT_DIR}/Data/Scripts/Multiplayer/*.lua|wc -l` >= `ls ${PROJECT_DIR}/Data/Scripts/plist/*.plist|wc -l` ))\nthen\necho \"${PROJECT_DIR}/Data/Scripts/Multiplayer/Normal.plist:0: warning, missing plist implementation of a Multiplayer script file\"\nfi\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\"";
 			showEnvVarsInLog = 0;
 		};
 		9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = {
@@ -1647,8 +1698,11 @@
 				61A976B3136F668500DD9878 /* uCursor.pas in Sources */,
 				6167A6761391514600AA6D07 /* RestoreViewController.m in Sources */,
 				61C28D3F142D380400DA16C2 /* AudioManagerController.m in Sources */,
+				611D7A50142FDCD3006E0798 /* uTouch.pas in Sources */,
 				61915D5B143A4E2C00299991 /* MissionTrainingViewController.m in Sources */,
 				61D0BDF91457508C0011A899 /* ExtraCategories.m in Sources */,
+				61177C02148B8BB100686905 /* uLandGenMaze.pas in Sources */,
+				61177C03148B8BB100686905 /* uLandOutline.pas in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1662,6 +1716,51 @@
 		};
 /* End PBXTargetDependency section */
 
+/* Begin PBXVariantGroup section */
+		61156520147F48B6006729A9 /* About.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				6115651A147F48AE006729A9 /* English */,
+				61156526147F49E1006729A9 /* Spanish */,
+				6115652D147F4C52006729A9 /* French */,
+				61156530147F4D10006729A9 /* Polish */,
+				61177BAA148A661600686905 /* German */,
+				61177BAC148A671600686905 /* Turkish */,
+				61177BE4148B881C00686905 /* Danish */,
+			);
+			name = About.strings;
+			sourceTree = "<group>";
+		};
+		61156522147F48B7006729A9 /* Localizable.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				6115651B147F48AE006729A9 /* English */,
+				61156527147F4A2E006729A9 /* Spanish */,
+				6115652C147F4C4C006729A9 /* French */,
+				61156531147F4D17006729A9 /* Polish */,
+				61177BA7148A658900686905 /* German */,
+				61177BAD148A672000686905 /* Turkish */,
+				61177BF0148B882500686905 /* Danish */,
+			);
+			name = Localizable.strings;
+			sourceTree = "<group>";
+		};
+		61156524147F48B8006729A9 /* Scheme.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				6115651C147F48AE006729A9 /* English */,
+				61156528147F4A3C006729A9 /* Spanish */,
+				6115652B147F4C45006729A9 /* French */,
+				61156532147F4D1E006729A9 /* Polish */,
+				61177BA9148A660C00686905 /* German */,
+				61177BAE148A672C00686905 /* Turkish */,
+				61177BF1148B882F00686905 /* Danish */,
+			);
+			name = Scheme.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
 /* Begin XCBuildConfiguration section */
 		1D6058940D05DD3E006BFB54 /* Debug */ = {
 			isa = XCBuildConfiguration;
Binary file project_files/HedgewarsMobile/Locale/Danish.lproj/About.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Danish.lproj/Localizable.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Danish.lproj/Scheme.strings has changed
Binary file project_files/HedgewarsMobile/Locale/English.lproj/About.strings has changed
Binary file project_files/HedgewarsMobile/Locale/English.lproj/Localizable.strings has changed
Binary file project_files/HedgewarsMobile/Locale/English.lproj/Scheme.strings has changed
Binary file project_files/HedgewarsMobile/Locale/French.lproj/About.strings has changed
Binary file project_files/HedgewarsMobile/Locale/French.lproj/Localizable.strings has changed
Binary file project_files/HedgewarsMobile/Locale/French.lproj/Scheme.strings has changed
Binary file project_files/HedgewarsMobile/Locale/German.lproj/About.strings has changed
Binary file project_files/HedgewarsMobile/Locale/German.lproj/Localizable.strings has changed
Binary file project_files/HedgewarsMobile/Locale/German.lproj/Scheme.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Polish.lproj/About.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Polish.lproj/Localizable.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Polish.lproj/Scheme.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Spanish.lproj/About.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Spanish.lproj/Localizable.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Spanish.lproj/Scheme.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Turkish.lproj/About.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Turkish.lproj/Localizable.strings has changed
Binary file project_files/HedgewarsMobile/Locale/Turkish.lproj/Scheme.strings has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Locale/hw-desc_da.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,31 @@
+Hedgewars, det' Vildt!
+
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+Hedgewars er tilgængeligt i Mac App Store! Søg efter Hedgewars på din Mac og få din GRATIS kopi i dag!
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭ 
+
+iOS versionen har flere eksklusive funktioner, så som
+* iPad VGA-udgangssignal: tilslut en ekstern skærm og spil i fuld oplysning;
+* Understøttelse af Retina-skærmen: spil hele spillet i en højere opløsning;
+* Multitasking: sæt spillet på pause når som helst;
+* Genoptagelse af Spil: du kan altid færdiggøre din kamp, lige meget hvad.
+
+Beskrivelse:
+Det her er det sjoveste og mest afhængighedsskabende spil du nogensinde kommer til at prøve - hylende morsomt og lige til at tage op af lommen hvor som helst, når som helst. Hedgewars er et turbaseret strategispil, men det fedeste er at se de utrolige ødelæggelser de forbistrede pindsvin laver med deres fantasifulde våben - luskede små fyre med en uforskammet holdning.
+
+Med andre ord er Hedgewars et turbaseret strategi-, artilleri-, action- og komediespil som byder på an narrestreger fra små lyserøde pindsvin med attitude og som viser hvordan de slås overalt, fra det dybeste helvede til den yderste afkroge af rummet.
+
+Som hærfører er det dit arbejde at sammensætte et førsteklasses hold af pindsvinesoldater og føre krig mod fjenderne helt fremme ved frontlinjen.
+
+Hver spiller styrer et hold bestående af adskillige pindsvin. I løbet af spillet tager spillerne ture med et af deres pindsvin. De bruger her et hvilket som helst tilgængeligt værktøj eller våben til at angribe og dræbe deres modstanderes pindsvin, og vinder derved spillet. Pindsvinene kan bevæge sig rundt i terrænet på mange forskellige måder, normalt ved at gå og hoppe, men også ved at bruge forskellige værktøjer som f.eks. et reb, en teleporter eller en faldskærm for at nå ellers utilgængelige steder. Hver tur er tidsbegrænset for at sikre at spillere ikke forsinker spillet med for mange tanker eller bevægelser. Et stort assortiment af våben er tilgængeligt i løbet af spillet: Granater, klyngebomber, bazookaer, UFO'er, haglgeværer, pistoler, slag med brændende næver, baseballbatter, dynamit, miner, reb, trykluftsbor, faldskærme, osv. De fleste våben laver eksplosioner som deformerer terrænet ved at fjerne cirkulære stykker. Landskabet består af en flydende ø i en vandmasse, eller en begrænset grotte med vand i bunden. Pindsvin dør hvis de falder i vandet (enten ved at falde ud over kanten af øen, eller gennem et hul i bunden), falder ud over kanten af banen eller hvis deres liv bliver reduceret (typisk ved nærkontakt med for mange eksplosioner) til nul.
+
+* Vandvittig morsom og ødelæggende turbaseret krigsførsel for op til 6 spillere
+* Multiplayer, både lokalt og over et netværk, men valgfri computerstyrede modstandere
+* Kæmp på et uendeligt antal tilfældigt genererede baner med over 20 forskellige typer omgivelser
+* Brug 48 (forøges løbende) overvældende våben! Inklusiv klaveranslaget og den eksplosive robotkage
+* Spil lige som du har lyst til! Med mere end 20 forskellige måder at justere spillet på, kan du selv bestemme over næsten alle aspekter af kampen
+* Skræddersy dit hold med over 120 kostumer, 30 gravsten, 12 forter, hundredvis af flag og mange unikke sæt stemmer
+* Enorme slag med op til 64 pindsvin
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Locale/hw-desc_de.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,31 @@
+Hedgewars, einfach Bombastisch!
+
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+Hedgewars ist jetzt auch im Mac Appstore verfügbar! Suche Hedgewars von deinem Mac und bekomme deine GRATIS Kopie!
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭ 
+
+Der iOS-Port hat einige exklusiven Features, wie z.B.:
+* iPad VGA-Ausgabe: Schließe einen externen Bildschirm an und spiele mit voller Auflösung;
+* Retina Display-Unterstützung: Spiele das gesamte Spiel mit noch höherer Auflösung;
+* Multitasking: Pausiere das Spiel wann immer du willst;
+* Spielstandwiederherstellung: Egal was passiert, du wirst immer in der Lage sein die Partie zu Ende zu spielen.
+
+Beschreibung:
+Es ist das lustigste und süchtig-machendste Spiel auf der Welt - wahnsinniger Spielspaß, wo und wann du willst. Hedgewars ist ein rundenbasiertes Strategiespiel. Aber die richtige Begeisterung verursacht erst, diesen nervigen kleinen Igeln zu zuschauen, wie sie mit ihren fantastischen Waffen alles zerstören - hinterhältige kleine Mistkerle mit bösen Absichten!
+
+Anders gesagt, Hedgewars ist ein rundenbasiertes Strategie-, Artillerie-, Action- und Comedy-Spiel. In den Hauptrollen die Grimassen der pinken Igel, mit dem Anschein als wollten sie sich aus den Tiefen der Hölle in die Tiefen des Universums vorkämpfen.
+
+Als Kommandant ist es deine Aufgabe ein Sondereinsatzkommando aus Igelsoldaten zusammenzustellen und deine Feinde mit Krieg zu überziehen.
+
+Jeder Spieler befehligt ein aus mehreren Igeln bestehendes Team. Im Spielverlauf ziehen die Spieler mit einem ihrer Igel. Sie benutzen dann alle zur Verfügung stehende Hilfsmittel und Waffen um die gegnerischen Igel zu töten. Dadurch gewinnen sie das Spiel. Igel können sich auf verschiedene Arten und Weisen auf dem Gelände bewegen, normalerweise durch laufen und springen, sie können aber auch spezielle Hilfsmittel wie zum Beispiel ein Seil oder einen Fallschirm benutzen, um zu ansonsten unerreichbaren Regionen vorzudringen. Um zu verhindern, dass Teilnehmer nicht das Spiel durch übermäßiges Nachdenken oder Bewegen aufhalten, ist jeder Zug zeitlich begrenzt. Während dem Spiel gibt es eine Vielzahl von Waffen und Hilfsmitteln: Granaten, Streubomben, Panzerfäuste, UFOs, Schrotflinten, Desert Eagles, Feuerschläge, Baseballschläger, Dynamit, Minen, Seile, Presslufthammer und Fallschirme. Die meisten Waffen verursachen Explosionen, die auch kreisförmige Stücke des Geländes heraus sprengen. Die verfügbaren Umgebungen sind eine auf einem Gewässer schwimmende Insel oder eine beschränkt zugängliche Höhle mit Wasser auf dem Boden. Ein Igel stirbt wenn er ins Wasser fällt (z.B. weil er von der Insel oder durch ein Loch in deren Boden fällt), er auf irgendeiner Seite aus dem Spielfeld fliegt oder wenn seine Gesundheit unter Null fällt, typischerweise aber durch Explosionen. (Der einem oder mehreren Igeln durch einen Spieler- oder KI-Zug zugefügte Schaden wird erst angerechnet, nachdem alle Bewegungen auf dem Schlachtfeld abgeschlossen ist).
+
+* Sensationeller, zerstörerischer, rundenbasierter Krieg für bis zu 6 Spieler
+* Lokale- und Online-Multiplayerspiele, mit zusätzlichen KI-Gegnern
+* Kämpfe auf unendlichen vielen, zufällig generierten Karten mit über 20 Umgebungen
+* Benutze 48 (und es werden laufend mehr) überwältigende Waffen! Inklusive dem Piano-Schlag und dem explosiven Roboterkuchen
+* Spiel das Spiel auf deine Weise, mit mehr als 20 verschiedenen Modifikatoren kannst du so gut wie jedes Detail anpassen
+* Passe dein Team an, mit über 120 Kostümen, 30 Gräbern, 12 Festungen, 100ten von Flaggen und einzigartigen Stimmen
+* Riesige Schlachten mit bis zu 64 Igeln
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Locale/hw-desc_en.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,31 @@
+Hedgewars, it's a Blast!
+
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+Hedgewars is available for the Mac Appstore! Search Hedgewars on your Mac and get your FREE copy today!
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭ 
+
+The iOS port has some exclusive features, such as
+* iPad VGA Out: hook an external display and play at full resolution;
+* Retina Display Support: play at a higher resolution the whole game;
+* Multitasking: pause the game at any time;
+* Game Restore: you will be always able to complete your match, no matter what.
+
+Description:
+This is the funniest and most addictive game you'll ever play - hilarious fun that you can enjoy anywhere, anytime. Hedgewars is a turn based strategy game but the real buzz is from watching the devastation caused by those pesky hedgehogs with those fantastic weapons - sneaky little blighters with a bad attitude!
+
+In other words Hedgewars is a turn based strategy, artillery, action and comedy game, featuring the antics of pink hedgehogs with attitude as they battle from the depths of hell to the depths of space.
+
+As commander, it's your job to assemble your crack team of hedgehog soldiers and bring the war to your enemy.
+
+Each player controls a team of several hedgehogs. During the course of the game, players take turns with one of their hedgehogs. They then use whatever tools and weapons are available to attack and kill the opponents' hedgehogs, thereby winning the game. Hedgehogs may move around the terrain in a variety of ways, normally by walking and jumping but also by using particular tools such as the "Rope" or "Parachute", to move to otherwise inaccessible areas. Each turn is time-limited to ensure that players do not hold up the game with excessive thinking or moving. A large variety of tools and weapons are available for players during the game: Grenade, Cluster Bomb, Bazooka, UFO, Shotgun, Desert Eagle, Fire Punch, Baseball Bat, Dynamite, Mine, Rope, Pneumatic pick, Parachute. Most weapons, when used, cause explosions that deform the terrain, removing circular chunks. The landscape is an island floating on a body of water, or a restricted cave with water at the bottom. A hedgehog dies when it enters the water (either by falling off the island, or through a hole in the bottom of it), it is thrown off either side of the arena or when its health is reduced, typically from contact with explosions, to zero (the damage dealt to the attacked hedgehog or hedgehogs after a player's or CPU turn is shown only when all movement on the battlefield has ceased).
+
+* Hilarious and devastating turn based combat for up to 6 players
+* Both local and network multiplayer, with optional AI opponents
+* Battle on an infinite number of randomly generated maps, with over 20 environments
+* Use 48 (and counting) overwhelming weapons! Including the piano strike and explosive robotic cake
+* Play the game your way, with more than 20 different game modifiers, tweak almost every aspect of the match
+* Customize your team, with over 120 costumes, 30 graves, 12 forts, 100s of flags and unique voice packs
+* Huge battles with up to 64 hogs
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Locale/hw-desc_es.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,31 @@
+Hedgewars, ¡es la leche!
+
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+¡Hedgewars esta disponible en la Mac Appstore! ¡Busca Hedgewars en tu Mac y consigue tu copia gratuita hoy!
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭ 
+
+La versión para iOS contiene algunas características exclusivas, como:
+* Salida VGA para iPad: conecta un monitor externo y juega a resolución completa;
+* Soporte para pantalla Retina: juega el juego entero a una resolución mayor;
+* Multitarea: pausa el juego en cualquier momento;
+* Restauración de partidas: siempre podrás completar tu partida, pase lo que pase.
+
+Descripción:
+Este es el juego más adictivo que jugarás - diviértete en cualquier sitio, en cualquier momento. Hedgewars es un juego de estrategia por turnos pero la verdadera diversión esta en ver como estos molestos erizos con sus fantásticas armas destrozan el entorno - unos pequeños pero gamberros tíos con ganas de liarla parda!
+
+En otras palabra, Hedgewars es un juego de estrategia por turnos, con toques de artillería, acción y comedia, protagonizado por las travesuras de erizos rosas con mal carácter que luchan desde el fondo del infierno hasta el espacio exterior.
+
+Eres el comandante, tu tarea es crear un potente equipo de erizos soldado y llevar la guerra a las puertas de tus enemigos.
+
+Cada jugador controla un equipo de varios erizos. Durante el transcurso de la partida, los jugador usan un turno con cada uno de sus erizos. Entonces pueden usar cualquier herramienta o arma disponible para atacar y matar a los erizos de los oponentes, ganando así la partida. Los erizos se pueden mover por el campo de juego de muchas maneras, normalmente andando o saltando pero también usando herramientas especiales como la "Cuerda" o el "Paracaídas", para moverse a lugares de otra forma incaccesibles. Cada turno tiene un límite de tiempo para asegurar que los jugadores no se pasan demasiado tiempo pensando o moviendo. Una gran variedad de armas y herramientas están disponibles durante la partida: Granada, Bomba de Racimo, Bazoka, UFO, Escopeta, Desert Eagle, Puñetazo de fuego, Bate de Beisbol, Dinamita, Minas, Cuerda, Taladro Neumático, Paracaidas. Casi todas las armas, cuando son usadas, causan explosiones que deforman el terreno, destruyendo sectores circulares. El paisaje es una isla que flota en el agua, o una restringida cueva con agua en el fondo. Un erizo muere cuando entra en el agua (ya sea callendose por un borde o un agujero), es lanzado fuera del campo de juego o cuando se queda sin vida, normalmente por las explosiones (el daño hecho a un erizo o unos erizos es mostrado después del turno del jugador o de la CPU cuando todo el movimiento en el campo de batalla ha terminado).
+
+* Divertido y devastador combate basado en turnos para un máximo de 6 jugadores.
+* Juego multijugador tanto local como en red, con oponentes virtuales opcionales
+* Lucha en infinitos mapas generados aleatoriamente, con más de 20 entornos.
+* Usa 48 (y la cuenta sigue) poderosas armas! Incluido el golpe de piano o la explosiva tarta robot
+* Juega a tu manera, con más de 20 modificadores de juego puedes configurar todo los aspectos de la partida
+* Personaliza to equipo, con más de 120 trajes, 30 tumbas, 12 fuertes, y cientos de banderas y voces únicas
+* Grandes batallas con hasta 64 puercos
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Locale/hw-desc_fr.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,31 @@
+Hedgewars, c'est génial!
+
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+Hedgewars est disponible sur le Mac Appstore ! Cherchez Hedgewars sur votre Mac et obtenez une copie gratuite aujourd'hui !
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭ 
+
+Le portage vers iOS a quelques fonctionnalités exclusives, comme :
+* Sortie VGA de l'iPad: connectez un affichage externe et jouez à la résolution maximale;
+* Support de l'Affichage Rétinien: jouez le jeu entier à une résolution supérieure;
+* Multitâche: mettez le jeu en pause à n'importe-quel moment;
+* Restoration de Jeu: vous aurez toujours la possibilité de finir votre match, quoiqu'il arrive.
+
+Description :
+C'est le jeu le plus amusant et le plus addictif auquel vous ne jouerez jamais - de l'amusement que vous pouvez apprécier partout, tout le temps. Hedgewars est un jeu de stratégie au tour par tout mais le vrai intérêt est de regarder la dévastation causée par ces satanés hérissons avec ces armes fantastiques - sournois petits gars au mauvais comportement!
+
+En d'autres mots Hedgewars est un jeu au tour par tour basé sur la stratégie, l'artillerie, l'action et la comédie, présentant les pitreries des hérissons roses pendant qu'ils combattent des profondeurs de l'enfer aux profondeurs de l'espace.
+
+En tant que commandant, c'est votre devoir de rassembler votre folle équipe de soldats hérissons et de partir en guerre contre l'ennemi.
+
+Chaque joueur contrôle une équipe de plusieurs hérissons. Pendant le déroulement du jeu, les joueurs prennent leur tour avec un de leurs hérissons. Ils peuvent utiliser n'importe-quels outils ou armes disponibles pour attaquer et tuer les hérissons des opposants, et ainsi gagner la partie. Les hérissons peuvent bouger autour du terrain de diverses façons, généralement en marchant et sautant mais aussi en utilisant des outils particuliers comme la "Corbe" ou le "Parachute", pour atteindre des zones inaccessibles en d'autres circonstances. Chaque tour est limité en temps afin d'être sûr que les joueurs ne mettent pas le jeu en suspens en pensant ou bougeant à excès. Une grande diversité d'outils et d'armes sont disponibles pour les joueurs pendant le jeu : la Grenade, la Grenade à Fragmentation, le Bazooka, l'OVNI, le fusil à pompes, le Desert Eagle, le Poing de Feu, la Batte de Baseball, la Dynamite, la Mine, la Corbe, le Ramassage Pneumatique, le Parachute. La plupart des armes, lorsqu'elles sont utilisées, causent des explosions qui déforment le terrain, en enlevant des morceaux circulaires. Le paysage est une île flottant sur un plan d'eau. Un hérisson meure quand il entre dans de l'eau (soit en tombant en dehors de l'île, soit à travers un trou situé au fond de celle-ci), quand il est éjecté de n'importe-quel côté de l'arène ou quand sa santé est réduite, généralement au contact des explosions, à zéro (les dégâts infligés à l'hérisson ou aux hérissons attaqués après le tour d'un joueur ou d'un ordinateur est seulement montré quand tous les mouvements sur le champ de bataille ont cessé).
+
+* des combats tordants et dévastateurs basés sur le tour par tour jusqu'à 6 joueurs
+* multijoueur à la fois local et en réseau, avec d'optionnels opposants IA
+* Combattez sur un nombre infini de cartes générées aléatoirement, avec plus de 20 environnements
+* Utilisez 48 (et plus) d'armes écrasantes! Y compris la frappe de piano et le gateau explostif robotique
+* Jouez au jeu à votre façon, avec plus de 20 modificateurs de jeux différents, déformez presque chaque aspect du match
+* Personnalisez votre équipe, avec plus de 120 costumes, 30 tombes, 12 forts, 100s de drapeaux et d'uniques packs de voix
+* D'énormes batailles avec jusqu'à 64 hérissons
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Locale/hw-desc_pl.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,31 @@
+Hedgewars jest super!
+
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+Hedgewars jest dostępny na Mac Appstore! Poszukaj Hedgewars na swoim Mac'u i otrzymaj kopię za darmo!
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭
+✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭✭ 
+
+Port na iOS posiada kilka unikalnych funkcji, takich jak:
+* Wtyczka iPad VGA : podłącz zewnętrzny ekran i graj w pełnej rozdzielczości;
+* Wsparcie dla Retina Display: graj całą grę w wyższej rozdzielczości;
+* Wielozadaniowość: pauzuj grę kiedy chcesz;
+* Wznawianie gry: zawsze możesz dokończyć swój mecz;.
+
+Opis:
+To najzabawniejsza i najbardziej uzależniająca gra w jaką kiedykolwiek grałeś - niezwykła zabawa, w którą możesz wciągnąć się zawsze i wszędzie. Hedgewars to turowa gra strategiczna, jednak najlepsze jest patrzenie, jak te małe jeże niszczą otoczenie swoim niecodziennym orężem. Nie daj się zmylić pozorom - to podstępne małe gagatki z nie do końca dobrą postawą.
+
+Inaczej mówiąc Hedgewars jest komediową grą strategiczną, artylerii i akcji, w której do łez rozbawią cię wybryki jeżów z charakterkiem, które walczą ze sobą przy każdej okazji.
+
+W roli dowódcy, Twoją robotą będzie zorganizowanie ekipy jeży i sprawienie piekła przeciwnikowi.
+
+Każdy gracz kontroluje drużynę złożoną z kilku jeży. Podczas gry, uczestnicy kierują jednym jeżem na turę. Mogą wtedy używać przeróżnych narzędzi i broni, którymi rozniesie w pył jeże wroga, w ten sposób zwyciężając. Jeże przemieszczać się mogą na różnorakie sposoby, m.in. chodząc lub skacząc, ale również używając narzędzi takich jak lina, czy spadochron, aby dostać się do trudno dostępnych obszarów. Każda tura jest ograniczona czasowo, aby zapewnić brak sytuacji, w których gracz zbyt długo "zastanawia się nad ruchem". Gracze do dyspozycji mają dużą pulę broni i narzędzi: granaty, bomby kasetowe, bazooki, UFO, strzelby, pistolety Desert Eagle, kije baseballowe, dynamity, miny, młoty pneumatyczne. Większość typów oręża powoduje eksplozje, które deformują teren zostawiając okrągłe wyrwy. Mapa jest unoszącą się na wodzie wyspą, lub ograniczoną jaskinią, z wodą na dnie. Jeż umiera, gdy znajdzie się w wodzie (na przykład przez wyrzucenie poza wyspę lub wpadnięcie do dziury), wypadnie poza mapę, lub jeśli jego poziom zdrowia wyniesie 0 (obrażenia zadane jeżom przez gracza lub CPU ukazują się gdy wszystkie ruchy są zatrzymane).
+
+* Komiczne i niszczycielskie boje podzielone na tury dla maksymalnie 6 graczy
+* Możliwa jest gra zarówno lokalna jak i sieciowa z opcjonalnymi przeciwnikami AI
+* Bitwy na nieskończonej ilości, losowo generowanych map z ponad 20 różnymi środowiskami
+* Aż 48 rodzajów (liczba ciągle rośnie) druzgocących broni! Między innymi zrzut pianina, czy eksplodujące ciasto urodzinowe
+* Graj jak tylko chcesz. Masz do dyspozycji ponad 20 modyfikacji, możesz zasmakować każdego aspektu rozgrywki.
+* Dostosuj swoją drużynę do własnych zachcianek. Możesz wybrać 120 przebrań, 30 grobów, 12 fortów, setki flag oraz unikalne zestawy głosów
+* Ogromne bitwy, w których mogą uczestniczyć aż 64 jeże.
+
Binary file project_files/HedgewarsMobile/Locale/hw-desc_tr.txt has changed
--- a/project_files/HedgewarsMobile/SDL-50560ca58f80.patch	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-diff -r 9738f2a8eee4 Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
---- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Wed Nov 09 02:35:49 2011 -0500
-+++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sat Nov 12 21:55:27 2011 +0100
-@@ -1596,9 +1596,12 @@
- 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- 				GCC_C_LANGUAGE_STANDARD = c99;
- 				GCC_DEBUGGING_SYMBOLS = full;
-+				GCC_OPTIMIZATION_LEVEL = 0;
-+				GCC_THUMB_SUPPORT = NO;
-+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
- 				GCC_WARN_UNUSED_VARIABLE = NO;
--				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
-+				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
- 				ONLY_ACTIVE_ARCH = NO;
- 				PREBINDING = NO;
- 				SDKROOT = iphoneos;
-@@ -1613,9 +1616,12 @@
- 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- 				GCC_C_LANGUAGE_STANDARD = c99;
-+				GCC_FAST_MATH = YES;
-+				GCC_THUMB_SUPPORT = NO;
-+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
- 				GCC_WARN_UNUSED_VARIABLE = NO;
--				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
-+				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
- 				PREBINDING = NO;
- 				SDKROOT = iphoneos;
- 				TARGETED_DEVICE_FAMILY = "1,2";
-@@ -1630,6 +1636,7 @@
- 				DEPLOYMENT_LOCATION = NO;
- 				GCC_DYNAMIC_NO_PIC = NO;
- 				GCC_OPTIMIZATION_LEVEL = 0;
-+				GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT;
- 				PREBINDING = NO;
- 				PRODUCT_NAME = SDL;
- 				SKIP_INSTALL = YES;
-@@ -1644,6 +1651,7 @@
- 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- 				DEPLOYMENT_LOCATION = NO;
- 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-+				GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT;
- 				PREBINDING = NO;
- 				PRODUCT_NAME = SDL;
- 				SKIP_INSTALL = YES;
-diff -r 9738f2a8eee4 include/SDL_compat.h
---- a/include/SDL_compat.h	Wed Nov 09 02:35:49 2011 -0500
-+++ b/include/SDL_compat.h	Sat Nov 12 21:55:27 2011 +0100
-@@ -40,7 +40,7 @@
- 
-  /*@}*/
- 
--#ifdef SDL_NO_COMPAT
-+#ifndef SDL_NO_COMPAT
- #define _SDL_compat_h
- #endif
- 
-diff -r 9738f2a8eee4 include/SDL_config_iphoneos.h
---- a/include/SDL_config_iphoneos.h	Wed Nov 09 02:35:49 2011 -0500
-+++ b/include/SDL_config_iphoneos.h	Sat Nov 12 21:55:27 2011 +0100
-@@ -106,7 +106,7 @@
- /* enable iPhone version of Core Audio driver */
- #define SDL_AUDIO_DRIVER_COREAUDIO 1
- /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
--#define SDL_AUDIO_DRIVER_DUMMY	1
-+#define SDL_AUDIO_DRIVER_DUMMY	0
- 
- /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
- #define SDL_HAPTIC_DISABLED	1
-@@ -132,16 +132,16 @@
- /* enable OpenGL ES */
- #define SDL_VIDEO_OPENGL_ES	1
- #define SDL_VIDEO_RENDER_OGL_ES	1
--#define SDL_VIDEO_RENDER_OGL_ES2	1
-+#define SDL_VIDEO_RENDER_OGL_ES2	0
- 
- /* Enable system power support */
--#define SDL_POWER_UIKIT 1
-+#define SDL_POWER_UIKIT 0
- 
- /* enable iPhone keyboard support */
- #define SDL_IPHONE_KEYBOARD 1
- 
- /* enable joystick subsystem */
--#define SDL_JOYSTICK_DISABLED 0
-+#define SDL_JOYSTICK_DISABLED 1
- 
- /* Set max recognized G-force from accelerometer
-    See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
-diff -r 9738f2a8eee4 include/SDL_events.h
---- a/include/SDL_events.h	Wed Nov 09 02:35:49 2011 -0500
-+++ b/include/SDL_events.h	Sat Nov 12 21:55:27 2011 +0100
-@@ -107,11 +107,12 @@
- 
-     SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
- 
-+#ifndef SDL_NO_COMPAT
-     /* Obsolete events */
-     SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
-     SDL_EVENT_COMPAT2,
-     SDL_EVENT_COMPAT3,
--
-+#endif
- 
-     /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
-      *  and should be allocated with SDL_RegisterEvents()
-diff -r 9738f2a8eee4 src/SDL_compat.c
---- a/src/SDL_compat.c	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/SDL_compat.c	Sat Nov 12 21:55:27 2011 +0100
-@@ -29,6 +29,7 @@
- #include "video/SDL_pixels_c.h"
- #include "render/SDL_yuv_sw_c.h"
- 
-+#ifndef SDL_NO_COMPAT
- 
- static SDL_Window *SDL_VideoWindow = NULL;
- static SDL_Surface *SDL_WindowSurface = NULL;
-@@ -1813,4 +1814,5 @@
-     return 0;
- }
- 
-+#endif /* SDL_NO_COMPAT */
- /* vi: set ts=4 sw=4 expandtab: */
-diff -r 9738f2a8eee4 src/video/SDL_surface.c
---- a/src/video/SDL_surface.c	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/SDL_surface.c	Sat Nov 12 21:55:27 2011 +0100
-@@ -195,12 +195,14 @@
-         SDL_InvalidateMap(surface->map);
-     }
- 
-+#ifndef SDL_NO_COMPAT
-     /* Compatibility mode */
-     if (surface->map->info.flags & SDL_COPY_COLORKEY) {
-         surface->flags |= SDL_SRCCOLORKEY;
-     } else {
-         surface->flags &= ~SDL_SRCCOLORKEY;
-     }
-+#endif
- 
-     return 0;
- }
-@@ -405,12 +407,14 @@
-         SDL_InvalidateMap(surface->map);
-     }
- 
-+#ifndef SDL_NO_COMPAT
-     /* Compatibility mode */
-     if (surface->map->info.flags & SDL_COPY_BLEND) {
-         surface->flags |= SDL_SRCALPHA;
-     } else {
-         surface->flags &= ~SDL_SRCALPHA;
-     }
-+#endif
- 
-     return status;
- }
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitappdelegate.h
---- a/src/video/uikit/SDL_uikitappdelegate.h	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitappdelegate.h	Sat Nov 12 21:55:27 2011 +0100
-@@ -24,7 +24,7 @@
- @interface SDLUIKitDelegate : NSObject<UIApplicationDelegate> {
- }
- 
--+ (SDLUIKitDelegate *)sharedAppDelegate;
-++ (id) sharedAppDelegate;
- + (NSString *)getAppDelegateClassName;
- 
- @end
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitappdelegate.m
---- a/src/video/uikit/SDL_uikitappdelegate.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitappdelegate.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -79,10 +79,10 @@
- @implementation SDLUIKitDelegate
- 
- /* convenience method */
--+ (SDLUIKitDelegate *)sharedAppDelegate
-++ (id) sharedAppDelegate
- {
-     /* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */
--    return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
-+    return [[UIApplication sharedApplication] delegate];
- }
- 
- + (NSString *)getAppDelegateClassName
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitopengles.m
---- a/src/video/uikit/SDL_uikitopengles.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitopengles.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -79,7 +79,7 @@
- 
- void UIKit_GL_SwapWindow(_THIS, SDL_Window * window)
- {
--#ifdef SDL_POWER_UIKIT
-+#if SDL_POWER_UIKIT
-     // Check once a frame to see if we should turn off the battery monitor.
-     SDL_UIKit_UpdateBatteryMonitoring();
- #endif
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitopenglview.m
---- a/src/video/uikit/SDL_uikitopenglview.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitopenglview.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -117,8 +117,8 @@
- 
-         // !!! FIXME: use the screen this is on!
-         /* Use the main screen scale (for retina display support) */
--        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
--            self.contentScaleFactor = [UIScreen mainScreen].scale;
-+        if ([self respondsToSelector:@selector(contentScaleFactor)])
-+            self.contentScaleFactor = [[UIScreen mainScreen] scale];
- 
-         self.autoresizingMask = 0;  // don't allow autoresize, since we need to do some magic in -(void)updateFrame.
-     }
-@@ -147,8 +147,8 @@
- 
-     // !!! FIXME: use the screen this is on!
-     /* Use the main screen scale (for retina display support) */
--    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
--        self.contentScaleFactor = [UIScreen mainScreen].scale;
-+    if ([self respondsToSelector:@selector(contentScaleFactor)])
-+        self.contentScaleFactor = [[UIScreen mainScreen] scale];
- }
- 
- - (void)setCurrentContext
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitvideo.m
---- a/src/video/uikit/SDL_uikitvideo.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitvideo.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -201,10 +201,8 @@
- {
-     _this->gl_config.driver_loaded = 1;
- 
--    NSString *reqSysVer = @"3.2";
--    NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
--    if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
--        SDL_UIKit_supports_multiple_displays = YES;
-+    // this tells us whether we are running on ios >= 3.2
-+    SDL_UIKit_supports_multiple_displays = [UIScreen instancesRespondToSelector:@selector(currentMode)];
- 
-     // Add the main screen.
-     UIScreen *uiscreen = [UIScreen mainScreen];
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitview.m
---- a/src/video/uikit/SDL_uikitview.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitview.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -316,7 +316,7 @@
- /* iPhone keyboard addition functions */
- #if SDL_IPHONE_KEYBOARD
- 
--static SDL_uikitview * getWindowView(SDL_Window * window)
-+SDL_uikitview *SDL_getUikitView(SDL_Window *window)
- {
-     if (window == NULL) {
-         SDL_SetError("Window does not exist");
-@@ -333,9 +333,9 @@
-     return view;
- }
- 
--int SDL_iPhoneKeyboardShow(SDL_Window * window)
-+int SDL_iPhoneKeyboardShow(SDL_Window *window)
- {
--    SDL_uikitview *view = getWindowView(window);
-+    SDL_uikitview *view = SDL_getUikitView(window);
-     if (view == nil) {
-         return -1;
-     }
-@@ -344,9 +344,9 @@
-     return 0;
- }
- 
--int SDL_iPhoneKeyboardHide(SDL_Window * window)
-+int SDL_iPhoneKeyboardHide(SDL_Window *window)
- {
--    SDL_uikitview *view = getWindowView(window);
-+    SDL_uikitview *view = SDL_getUikitView(window);
-     if (view == nil) {
-         return -1;
-     }
-@@ -355,9 +355,9 @@
-     return 0;
- }
- 
--SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
-+SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window *window)
- {
--    SDL_uikitview *view = getWindowView(window);
-+    SDL_uikitview *view = SDL_getUikitView(window);
-     if (view == nil) {
-         return 0;
-     }
-@@ -365,9 +365,9 @@
-     return view.keyboardVisible;
- }
- 
--int SDL_iPhoneKeyboardToggle(SDL_Window * window)
-+int SDL_iPhoneKeyboardToggle(SDL_Window *window)
- {
--    SDL_uikitview *view = getWindowView(window);
-+    SDL_uikitview *view = SDL_getUikitView(window);
-     if (view == nil) {
-         return -1;
-     }
-@@ -385,24 +385,24 @@
- 
- /* stubs, used if compiled without keyboard support */
- 
--int SDL_iPhoneKeyboardShow(SDL_Window * window)
-+int SDL_iPhoneKeyboardShow(SDL_Window *window)
- {
-     SDL_SetError("Not compiled with keyboard support");
-     return -1;
- }
- 
--int SDL_iPhoneKeyboardHide(SDL_Window * window)
-+int SDL_iPhoneKeyboardHide(SDL_Window *window)
- {
-     SDL_SetError("Not compiled with keyboard support");
-     return -1;
- }
- 
--SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window * window)
-+SDL_bool SDL_iPhoneKeyboardIsShown(SDL_Window *window)
- {
-     return 0;
- }
- 
--int SDL_iPhoneKeyboardToggle(SDL_Window * window)
-+int SDL_iPhoneKeyboardToggle(SDL_Window *window)
- {
-     SDL_SetError("Not compiled with keyboard support");
-     return -1;
-diff -r 9738f2a8eee4 src/video/uikit/SDL_uikitviewcontroller.m
---- a/src/video/uikit/SDL_uikitviewcontroller.m	Wed Nov 09 02:35:49 2011 -0500
-+++ b/src/video/uikit/SDL_uikitviewcontroller.m	Sat Nov 12 21:55:27 2011 +0100
-@@ -30,8 +30,8 @@
- 
- #include "SDL_uikitwindow.h"
- 
--#import "SDL_uikitviewcontroller.h"
--
-+#include "SDL_uikitviewcontroller.h"
-+#include "SDL_uikitvideo.h"
- 
- @implementation SDL_uikitviewcontroller
- 
-@@ -118,38 +118,17 @@
-     const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation];
-     SDL_WindowData *data = self->window->driverdata;
-     UIWindow *uiwindow = data->uiwindow;
--    UIScreen *uiscreen = [uiwindow screen];
-+    UIScreen *uiscreen;
-+    if (SDL_UIKit_supports_multiple_displays)
-+        uiscreen = [uiwindow screen];
-+    else
-+        uiscreen = [UIScreen mainScreen];
-     const int noborder = self->window->flags & SDL_WINDOW_BORDERLESS;
-     CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame];
--    const CGSize size = frame.size;
--    int w, h;
--
--    switch (toInterfaceOrientation) {
--        case UIInterfaceOrientationPortrait:
--        case UIInterfaceOrientationPortraitUpsideDown:
--            w = (size.width < size.height) ? size.width : size.height;
--            h = (size.width > size.height) ? size.width : size.height;
--            break;
--
--        case UIInterfaceOrientationLandscapeLeft:
--        case UIInterfaceOrientationLandscapeRight:
--            w = (size.width > size.height) ? size.width : size.height;
--            h = (size.width < size.height) ? size.width : size.height;
--            break;
--
--        default:
--            SDL_assert(0 && "Unexpected interface orientation!");
--            return;
--    }
--
--    frame.size.width = w;
--    frame.size.height = h;
--    frame.origin.x = 0;
--    frame.origin.y = 0;
- 
-     [uiwindow setFrame:frame];
-     [data->view updateFrame];
--    SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h);
-+    SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, frame.size.width, frame.size.height);
- }
- 
- #endif /* SDL_VIDEO_DRIVER_UIKIT */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/SDL-687400b595ab.patch	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,198 @@
+diff -r 687400b595ab Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj
+--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sat Nov 19 19:23:33 2011 -0500
++++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj	Sun Nov 20 18:57:07 2011 +0100
+@@ -1596,9 +1596,12 @@
+ 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ 				GCC_C_LANGUAGE_STANDARD = c99;
+ 				GCC_DEBUGGING_SYMBOLS = full;
++				GCC_OPTIMIZATION_LEVEL = 0;
++				GCC_THUMB_SUPPORT = NO;
++				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ 				GCC_WARN_UNUSED_VARIABLE = NO;
+-				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
++				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ 				ONLY_ACTIVE_ARCH = NO;
+ 				PREBINDING = NO;
+ 				SDKROOT = iphoneos;
+@@ -1613,9 +1616,12 @@
+ 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ 				GCC_C_LANGUAGE_STANDARD = c99;
++				GCC_FAST_MATH = YES;
++				GCC_THUMB_SUPPORT = NO;
++				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ 				GCC_WARN_UNUSED_VARIABLE = NO;
+-				IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
++				IPHONEOS_DEPLOYMENT_TARGET = 3.0;
+ 				PREBINDING = NO;
+ 				SDKROOT = iphoneos;
+ 				TARGETED_DEVICE_FAMILY = "1,2";
+@@ -1630,6 +1636,7 @@
+ 				DEPLOYMENT_LOCATION = NO;
+ 				GCC_DYNAMIC_NO_PIC = NO;
+ 				GCC_OPTIMIZATION_LEVEL = 0;
++				GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT;
+ 				PREBINDING = NO;
+ 				PRODUCT_NAME = SDL;
+ 				SKIP_INSTALL = YES;
+@@ -1644,6 +1651,7 @@
+ 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ 				DEPLOYMENT_LOCATION = NO;
+ 				GCC_ENABLE_FIX_AND_CONTINUE = NO;
++				GCC_PREPROCESSOR_DEFINITIONS = SDL_NO_COMPAT;
+ 				PREBINDING = NO;
+ 				PRODUCT_NAME = SDL;
+ 				SKIP_INSTALL = YES;
+diff -r 687400b595ab include/SDL_compat.h
+--- a/include/SDL_compat.h	Sat Nov 19 19:23:33 2011 -0500
++++ b/include/SDL_compat.h	Sun Nov 20 18:57:07 2011 +0100
+@@ -40,7 +40,7 @@
+ 
+  /*@}*/
+ 
+-#ifdef SDL_NO_COMPAT
++#ifndef SDL_NO_COMPAT
+ #define _SDL_compat_h
+ #endif
+ 
+diff -r 687400b595ab include/SDL_config_iphoneos.h
+--- a/include/SDL_config_iphoneos.h	Sat Nov 19 19:23:33 2011 -0500
++++ b/include/SDL_config_iphoneos.h	Sun Nov 20 18:57:07 2011 +0100
+@@ -106,7 +106,7 @@
+ /* enable iPhone version of Core Audio driver */
+ #define SDL_AUDIO_DRIVER_COREAUDIO 1
+ /* Enable the dummy audio driver (src/audio/dummy/\*.c) */
+-#define SDL_AUDIO_DRIVER_DUMMY	1
++#define SDL_AUDIO_DRIVER_DUMMY	0
+ 
+ /* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
+ #define SDL_HAPTIC_DISABLED	1
+@@ -132,16 +132,16 @@
+ /* enable OpenGL ES */
+ #define SDL_VIDEO_OPENGL_ES	1
+ #define SDL_VIDEO_RENDER_OGL_ES	1
+-#define SDL_VIDEO_RENDER_OGL_ES2	1
++#define SDL_VIDEO_RENDER_OGL_ES2	0
+ 
+ /* Enable system power support */
+-#define SDL_POWER_UIKIT 1
++#define SDL_POWER_UIKIT 0
+ 
+ /* enable iPhone keyboard support */
+ #define SDL_IPHONE_KEYBOARD 1
+ 
+ /* enable joystick subsystem */
+-#define SDL_JOYSTICK_DISABLED 0
++#define SDL_JOYSTICK_DISABLED 1
+ 
+ /* Set max recognized G-force from accelerometer
+    See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
+diff -r 687400b595ab include/SDL_events.h
+--- a/include/SDL_events.h	Sat Nov 19 19:23:33 2011 -0500
++++ b/include/SDL_events.h	Sun Nov 20 18:57:07 2011 +0100
+@@ -107,11 +107,12 @@
+ 
+     SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
+ 
++#ifndef SDL_NO_COMPAT
+     /* Obsolete events */
+     SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
+     SDL_EVENT_COMPAT2,
+     SDL_EVENT_COMPAT3,
+-
++#endif
+ 
+     /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
+      *  and should be allocated with SDL_RegisterEvents()
+diff -r 687400b595ab src/SDL_compat.c
+--- a/src/SDL_compat.c	Sat Nov 19 19:23:33 2011 -0500
++++ b/src/SDL_compat.c	Sun Nov 20 18:57:07 2011 +0100
+@@ -29,6 +29,7 @@
+ #include "video/SDL_pixels_c.h"
+ #include "render/SDL_yuv_sw_c.h"
+ 
++#ifndef SDL_NO_COMPAT
+ 
+ static SDL_Window *SDL_VideoWindow = NULL;
+ static SDL_Surface *SDL_WindowSurface = NULL;
+@@ -1813,4 +1814,5 @@
+     return 0;
+ }
+ 
++#endif /* SDL_NO_COMPAT */
+ /* vi: set ts=4 sw=4 expandtab: */
+diff -r 687400b595ab src/video/SDL_surface.c
+--- a/src/video/SDL_surface.c	Sat Nov 19 19:23:33 2011 -0500
++++ b/src/video/SDL_surface.c	Sun Nov 20 18:57:07 2011 +0100
+@@ -195,12 +195,14 @@
+         SDL_InvalidateMap(surface->map);
+     }
+ 
++#ifndef SDL_NO_COMPAT
+     /* Compatibility mode */
+     if (surface->map->info.flags & SDL_COPY_COLORKEY) {
+         surface->flags |= SDL_SRCCOLORKEY;
+     } else {
+         surface->flags &= ~SDL_SRCCOLORKEY;
+     }
++#endif
+ 
+     return 0;
+ }
+@@ -405,12 +407,14 @@
+         SDL_InvalidateMap(surface->map);
+     }
+ 
++#ifndef SDL_NO_COMPAT
+     /* Compatibility mode */
+     if (surface->map->info.flags & SDL_COPY_BLEND) {
+         surface->flags |= SDL_SRCALPHA;
+     } else {
+         surface->flags &= ~SDL_SRCALPHA;
+     }
++#endif
+ 
+     return status;
+ }
+diff -r 687400b595ab src/video/uikit/SDL_uikitopenglview.m
+--- a/src/video/uikit/SDL_uikitopenglview.m	Sat Nov 19 19:23:33 2011 -0500
++++ b/src/video/uikit/SDL_uikitopenglview.m	Sun Nov 20 18:57:07 2011 +0100
+@@ -80,7 +80,7 @@
+ 
+         // !!! FIXME: use the screen this is on!
+         /* Use the main screen scale (for retina display support) */
+-        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
++        if ([self respondsToSelector:@selector(contentScaleFactor)])
+             self.contentScaleFactor = [UIScreen mainScreen].scale;
+ 
+         /* create the buffers */
+diff -r 687400b595ab src/video/uikit/SDL_uikitviewcontroller.m
+--- a/src/video/uikit/SDL_uikitviewcontroller.m	Sat Nov 19 19:23:33 2011 -0500
++++ b/src/video/uikit/SDL_uikitviewcontroller.m	Sun Nov 20 18:57:07 2011 +0100
+@@ -29,9 +29,8 @@
+ #include "../../events/SDL_events_c.h"
+ 
+ #include "SDL_uikitwindow.h"
+-
+-#import "SDL_uikitviewcontroller.h"
+-
++#include "SDL_uikitviewcontroller.h"
++#include "SDL_uikitvideo.h"
+ 
+ @implementation SDL_uikitviewcontroller
+ 
+@@ -114,7 +113,11 @@
+     const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation];
+     SDL_WindowData *data = self->window->driverdata;
+     UIWindow *uiwindow = data->uiwindow;
+-    UIScreen *uiscreen = [uiwindow screen];
++    UIScreen *uiscreen;
++    if (SDL_UIKit_supports_multiple_displays)
++        uiscreen = [uiwindow screen];
++    else
++        uiscreen = [UIScreen mainScreen];
+     const int noborder = (self->window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS));
+     CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame];
+     const CGSize size = frame.size;
--- a/project_files/hedgewars.pro	Sat Nov 19 23:34:09 2011 +0100
+++ b/project_files/hedgewars.pro	Mon Dec 05 18:38:07 2011 -0500
@@ -95,7 +95,8 @@
     ../QTfrontend/ui_hwform.h \
 	../QTfrontend/KB.h \
     ../QTfrontend/hwconsts.h \
-    ../QTfrontend/sdlkeys.h
+    ../QTfrontend/sdlkeys.h \
+    ../QTfrontend/ui/mouseoverfilter.h
 
 SOURCES += ../QTfrontend/model/ammoSchemeModel.cpp \
     ../QTfrontend/model/themesmodel.cpp \
@@ -169,7 +170,8 @@
     ../QTfrontend/util/SDLInteraction.cpp \
     ../QTfrontend/team.cpp \
     ../QTfrontend/ui_hwform.cpp \
-    ../QTfrontend/hwconsts.cpp
+    ../QTfrontend/hwconsts.cpp \
+    ../QTfrontend/ui/mouseoverfilter.cpp
 
 win32 {
 	SOURCES += ../QTfrontend/xfire.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Locale/da.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,533 @@
+; Danish locale
+
+00:00=Granat
+00:01=Klyngebombe
+00:02=Bazooka
+00:03=Målsøgende Bi
+00:04=Haglgevær
+00:05=Hakke
+00:06=Spring Over
+00:07=Reb
+00:08=Hakke
+00:09=Desert Eagle
+00:10=Dynamit
+00:11=Bat
+00:12=Shoryuken
+00:13=sek.
+00:14=Faldskærm
+00:15=Luftangreb
+00:16=Mineangreb
+00:17=Skærebrænder
+00:18=Konstruktion
+00:19=Teleportering
+00:20=Skift Pindsvin
+00:21=Granatkaster
+00:22=Pisk
+00:23=Kamikaze
+00:24=Kage
+00:25=Forførelse
+00:26=Vandmelon-bombe
+00:27=Helvedes håndgranat
+00:28=Boreraket
+00:29=Boldpistol
+00:30=Napalm
+00:31=Fjernstyret Modelfly
+00:32=Svag Tyngdekraft
+00:33=Ekstra Skade
+00:34=Udødelig
+00:35=Ekstra Tid
+00:36=Lasersigte
+00:37=Vampyr
+00:38=Sniperriffel
+00:39=Flyvende Tallerken
+00:40=Molotovcocktail
+00:41=Pipfugl
+00:42=HÃ¥ndholdt Portal-Pistol
+00:43=Klaveranslag
+00:44=Gamle Ole
+00:45=Sinusgevær (beta)
+00:46=Flammekaster
+00:47=Klæbrige Miner
+00:48=Hammer
+00:49=Genopliver
+00:50=Boreangreb
+00:51=Mudderklat
+00:52=Intet våben valgt
+00:53=Tidsboks
+00:54=Struktur
+00:55=Jordspray
+
+01:00=Kæmp!
+01:01=Runde uafgjort
+01:02=%1 vinder!
+01:03=Lydstyrke %1%
+01:04=Sat på pause
+01:05=Vil du virkelig forlade spillet (Y/Esc)?
+01:06=Pludselig Død!
+01:07=%1 tilbage
+01:08=Brændstof
+01:09=Synkroniserer...
+01:10=Brug af dette værktøj afslutter ikke din tur!
+01:11=Dette våben eller værktøj er ikke tilgængeligt endnu!
+01:12=Sidste runde før Pludselig Død!
+01:13=%1 runder til Pludselig Død!
+01:14=Gør dig klar, %1!
+01:15=Spinkel
+01:16=Lav
+01:17=Normal
+01:18=Høj
+01:19=Ekstrem
+01:20=%1 Tilbagespring
+
+; Event messages
+; Hog (%1) died
+02:00=%1 har stillet træskoene!
+02:00=%1 har set lyset!
+02:00=%1 så det ikke komme!
+02:00=%1 vinker farvel!
+02:00=%1 ser den anden side af græsplænen!
+02:00=%1 møder sin skaver!
+02:00=%1 kan ikke hænge på mere!
+02:00=%1 har gjort sin pligt!
+02:00=%1 gør det ultimative offer!
+02:00=%1 smutter fra de daglige lidelser!
+02:00=%1 blev en grøntsag!
+02:00=%1 gik time-out!
+02:00=%1 fik fred!
+02:00=%1 vil blive husket!
+02:00=%1 har en aneurisme!
+02:00=%1 efterlader kone og børn
+02:00=%1 har affyret sin sidste bazooka
+02:00=%1 har kastet sin sidste grenade
+02:00=%1 har bagt sin sidste kage
+02:00=%1 har svinget sig i sit sidste reb
+02:00=%1 har indkaldt sit sidste luftangreb
+02:00=%1 har ladt sit sidste haglgevær
+02:00=%1 har kastet sin sidste melon
+02:00=%1 har trukket sin sidste Desert Eagle
+02:00=%1's bægre flød over
+02:00=%1 kunne godt have brugt en bandage
+02:00=%1 er smuttet videre til et sjovere spil
+02:00=%1 forlod rasende livet
+02:00=%1 tabte
+02:00=Stakkels, stakkels %1...
+02:00=%1 kan bedre lide Warmux
+02:00=%1 hoppede ind foran et skud
+02:00=%1 er en helt blandt mæ...ehm...pindsvin
+02:00=%1 bliver budt velkommen i Valhalla
+02:00=%1 har forladt bygningen
+02:00=%1 gik samme vej som dinosaurerne
+02:00=%1 bringer pindsvin et skidt tættere på udrydelse
+02:00=%1 bringer tårerne til mine øjne
+02:00=%1 er et ex-pindsvin
+02:00=%1 smuttede
+02:00=%1 er ikke længere
+02:00=Sig farvel til %1
+02:00=Der er intet håb for %1
+02:00=%1 forsvinder bag det sorte tæppe
+02:00=%1 ligger allerede i kisten
+02:00=%1 lider under en Komplet Spontan Eksistensfejl
+02:00=%1 er gået bort
+02:00=%1 er stendød
+02:00=%1 er ikke mere
+02:00=%1 har nået sidste salgsdato
+02:00=Berøvet sit liv,hviler %1 nu i fred
+02:00=%1 er gået ud af drift
+02:00=Farvel %1, vi lærte dig næsten ikke at kende!
+02:00=%1 havde en lav smerteterskel
+02:00=%1 kunne godt have brugt ni liv
+02:00=Er der en læge i nærheden?
+
+; Hog (%1) drowned
+02:01=%1 leger ubåd!
+02:01=%1 efterligner Titanic!
+02:01=%1 svømmer som en sten!
+02:01=%1 flyder som en mursten!
+02:01=%1 tager et kig på den dybe ende
+02:01=%1 huskede ikke svømmebæltet
+02:01=%1 synker
+02:01=%1 glemte sine badevinger
+02:01=%1 burde virkelig have husket svømmeundervisningen
+02:01=%1 glemte surfbrættet derhjemme
+02:01=%1 skyller op længere nede af strømmen
+02:01=%1 er et vådt pindsvin
+02:01=%1 glemte at medbringe sin livvest
+02:01=%1 leder efter dykkerringe
+02:01=%1 sover med fiskene
+02:01=%1 hader vandfysikken i det her spil
+02:01=%1 ser tørstig ud
+02:01=Havet lagde beslag på %1
+02:01=%1 er fortabt til søs
+02:01=%1 burde have medbragt sit dykkerudstyr
+02:01=%1 får spredt sin aske over havet
+02:01=%1 har føler sig lidt tung bag i
+02:01=%1 øver sig på sin rygcrawl
+02:01=%1 leder efter Titanic
+02:01=%1 er desværre ikke Jesus
+02:01=%1 finder Nemo
+02:01=%1 er sprunget læk
+02:01=Man kan undre sig over, hvor mange pindsvin der er på bunden
+02:01=%1 gør havet lidt mere fast
+02:01=%1 er ikke i flåden
+02:01=%1 parodierer en død fisk
+02:01=I det mindste faldt du ikke i toiletkummen, %1
+02:01=Sonic kunne ikke svømme, og det kan %1 heller ikke
+02:01=%1 leger delfin
+02:01=%1 er taget til Lalandia
+02:01=%1 har fundet den forsvundne by Atlantis
+02:01=%1 håber på en hovedrolle i Bioshock 3
+02:01=Du burde arbejde lidt med din hundesvømning, %1
+02:01=%1 burde have medbragt jetski
+02:01=%1 bryder sig ikke om vandsport
+02:01=%1 blæser bobler
+02:01=%1 mangler en tømmerflåde
+02:01=%1 har hørt saltvand er godt for huden
+02:01=%1 gnider salt i sine sår
+02:01=%1 er gået planken ud
+02:01=%1 tager et bad
+02:01=%1 er meget våd
+02:01=%1 får våde pigge
+02:01=%1 synker til bunds
+
+; Round starts
+02:02=Så skal der kæmpes!
+02:02=Vis gevær!
+02:02=SÃ¥ skal der rulles!
+02:02=Så tænder vi op!
+02:02=SÃ¥ starter festen
+02:02=Sidste mand stående
+02:02=Sæt i værk!
+02:02=SÃ¥ skal der rockes!
+02:02=Musikken spiller!
+02:02=Det begynder...
+02:02=Det her er starten på noget stort
+02:02=Velkommen til Hedgewars
+02:02=Velkommen til frontlinjen
+02:02=Knus dine fjender!
+02:02=MÃ¥ det bedste pindsvin vinde
+02:02=Vind eller dø!
+02:02=Der er præmier til vinderen
+02:02=Du kan ikke give op nu
+02:02=Gør klar til dødsskrigene! Nu kommer krigspindsvinene!
+02:02=Hedgewars, produceret af Hedgewars.org
+02:02=Held og lykke, hav det sjovt
+02:02=Du er heldig ikke at være oppe mod Tiyuri
+02:02=Du er heldig ikke at være oppe mod unC0Rr
+02:02=Du er heldig ikke at være oppe mod Nemo
+02:02=Du er heldig ikke at være oppe mod Smaxx
+02:02=Du er heldig ikke at være oppe mod Jessor
+02:02=Giv den hele armen!
+02:02=Taberne ryder op!
+02:02=Lad årtusindets kamp begynde
+02:02=Lad århundredets kamp begynde
+02:02=Lad årtiets kamp begynde
+02:02=Lad årets kamp begynde
+02:02=Lad månedens kamp begynde
+02:02=Lad ugens kamp begynde
+02:02=Lad dagens kamp begynde
+02:02=Lad timens kamp begynde
+02:02=Gør dit bedste!
+02:02=Ødelæg fjenden!
+02:02=Held og lykke
+02:02=Hav det sjovt
+02:02=Kæmp en god kamp
+02:02=Brug feje tricks
+02:02=Kæmp med ære
+02:02=Giv ikke op
+02:02=Overgiv dig aldrig
+02:02=Giv den gas!
+02:02=Lad drabsfesten begynde!
+02:02=Jeg håber du er klar til et slagsmål!
+02:02=Så skal der krudt i røven!
+02:02=Pindsvin taget til næste niveau!
+02:02=Bring kampen til dem!
+02:02=Frygt intet!
+02:02=Vær modig og tapper
+
+; Round ends (win; unused atm)
+02:03=...
+
+; Round ends (draw; unused atm)
+02:04=...
+
+; New health crate
+02:05=Så er der hjælp at hente!
+02:05=Læge!
+02:05=Himmelsk førstehjælp!
+02:05=Wellness til dig
+02:05=Godt helbred... i en kasse!
+02:05=Doktoren ringe
+02:05=Friske bandager!
+02:05=Det her skal nok få dig til at føle dig godt tilpas
+02:05=SÃ¥ er der trylledrik! Ups, forkert spil
+02:05=Saml mig op!
+02:05=Tag den
+02:05=Et sundt mellemmåltid
+02:05=Smertestillende
+02:05=Korrekt dosering: alt hvad du kan finde!
+02:05=Hastelevering
+02:05=Forsyninger!
+
+; New ammo crate
+02:06=Flere våben!
+02:06=Forstærkninger!
+02:06=Tid til at skifte magasin!
+02:06=Gæt hvilket våben der er indeni?
+02:06=Forsyninger!
+02:06=Hvad mon der er i pakken?
+02:06=Julen starter tidligt i år
+02:06=En lille gave!
+02:06=Hastelevering!
+02:06=Det var et mareridt at få den her gennem tolden
+02:06=Destruktivt legetøj fra himlen
+02:06=Advarsel! Sprængfarligt indhold
+02:06=Nap eller spring, frit valg
+02:06=Godter!
+02:06=Mmmmm! Ammunition
+02:06=En lille pakke med koncentreret destruktion
+02:06=Luftpost!
+02:06=Der er ikke pizza i den der pakke
+02:06=Nap den!
+02:06=Så er der våben
+02:06=Lad ikke modstanderen få fat i den dér!
+02:06=Nyt legetøj!
+02:06=En gådefuld pakke!
+
+; New utility crate
+02:07=Værktøjstid!
+02:07=Den her kan måske være nyttig...
+02:07=Nyttige værktøjer!
+02:07=Benyt dig af den her
+02:07=Pås på ryggen
+02:07=Flere værktøjer!
+02:07=Værktøjer til dig!
+02:07=Det her burde klare ærterne!
+02:07=Brug den med omtanke
+02:07=Ã…h, den her er tung
+02:07=Måske får du brug for den her
+
+; Hog (%1) skips his turn
+02:08=%1 er sååå kedelig...
+02:08=%1 gad ikke lige
+02:08=%1 er et dovent pindsvin
+02:08=%1 er tankeløs
+02:08=%1 gav op
+02:08=%1 prøver at sove de andre ihjel
+02:08=%1 springer skamløst sin tur over
+02:08=%1 er meget doven
+02:08=%1 har brug for lidt motivation
+02:08=%1 er pacifist
+02:08=%1 tager sig et pusterum
+02:08=%1 får sig et hvil
+02:08=%1 tager sig en slapper
+02:08=%1 tror ikke på sig selv
+02:08=%1 beslutter sig for slet ikke at gøre noget
+02:08=%1 håber på at modstanderne begår selvmord
+02:08=%1 må være frygtelig at have med til fester
+02:08=%1 gemmer sig under sengen
+02:08=%1 greb ikke chancen
+02:08=%1 besluttede sig for at det bedste han kunne gøre var... ingenting
+02:08=%1 er en pivskid
+02:08=Kluk, kluk, kluk, %1 er en kylling
+02:08=%1 ser lidt uerfaren ud
+02:08=%1 er en bangebuks!
+02:08=%1 venter på Pludselig Død
+02:08=%1 er ikke rigtig den type der slås
+02:08=%1 genovervejer meningen med livet
+02:08=%1 sigter godt, men skyder sjældent
+02:08=%1 ville egentlig ikke i hæren i første omgang
+02:08=Hold op med at spilde vores tid, %1
+02:08=Jeg er skuffet over dig, %1
+02:08=Kom nu, det kan du godt klare bedre, %1
+02:08=%1 er lidt af en kujon
+02:08=%1 har åbenbart andet at lave
+02:08=%1 er stiv af skræk
+02:08=%1 er vist faldet i søvn
+
+; Hog (%1) hurts himself only
+02:09=%1 burde øve sig i at sigte!
+02:09=%1 hader vist sig selv
+02:09=%1 står på den forkerte side!
+02:09=%1 er en sortseer
+02:09=%1 pegede løbet den forkerte vej
+02:09=%1 er en lille sadist
+02:09=%1 er en masochist
+02:09=%1 har ikke nogen selvopholdelsesdrift
+02:09=%1 lavede kludder i den
+02:09=%1 kludrede i den
+02:09=Det var et sølle skud, %1
+02:09=%1 er lidt for uforsvarlige med farlige våben
+02:09=%1 både overveje et karriereskift
+02:09=Værste. Skud. Nogensinde!
+02:09=Nej, nej, nej, %1, du skal skyde på FJENDEN!
+02:09=%1 burde kun sigte efter fjenden
+02:09=%1 bevæger sig et skridt tættere på selvmord
+02:09=%1 hjælper fjenden
+02:09=Det var dumt, %1
+02:09=%1 lever efter mantraet "det skal gøre ondt, før det gør godt"
+02:09=%1 er forvirret
+02:09=%1 sårede sig selv i sin forvirrelse
+02:09=%1 har en særlig evne til at gøre sig selv til grin
+02:09=%1 er en klodsmajor!
+02:09=%1 er klodset
+02:09=%1 viser fjenden hvad han er i stand til
+02:09=Man kan ikke forvente at %1 er perfekt hver gang
+02:09=Bare rolig %1, ingen re perfekte
+02:09=%1 gjorde det med vilje, helt sikkert
+02:09=Jeg skal nok holde munden lukket hvis du også gør, %1
+02:09=Hvor pinligt!
+02:09=Det er jeg helt sikker på at ingen så, %1
+02:09=%1 burde nokke kigge på sin feltmanual igen
+02:09=%1's våben er vist i stykker
+
+; Hog shot an home run (using the bat and another hog)
+02:10=Han kørte den lige hjem!
+02:10=Er det en fugl? Er det et fly? ...
+02:10=Den der er ude!
+
+; Hog (%1) has to leave (team is gone)
+02:11=%1 skal i seng nu!
+02:11=%1 har vist for travlt til spil
+02:11=Mor er klar med aftensmaden!
+02:11=%1 bliver nød til at gå
+
+; Weapon Categories
+03:00=Tidsindstillet Granat
+03:01=Tidsindstillet Granat
+03:02=Balistisk VÃ¥ben
+03:03=Fjernstyret VÃ¥ben
+03:04=Skydevåben (flere skud)
+03:05=Graveværktøj
+03:06=Handling
+03:07=Køretøj
+03:08=Bevægelsesaktiveret Bombe
+03:09=Skydevåben (flere skud)
+03:10=BUM!
+03:11=Bonk!
+03:12=Kampsport
+03:13=UBRUGT
+03:14=Køretøj
+03:15=Luftangreb
+03:16=Luftangreb
+03:17=Graveværktøj
+03:18=Værktøj
+03:19=Køretøj
+03:20=Handling
+03:21=Balistisk VÃ¥ben
+03:22=Kald mig Indiana!
+03:23=(Seriøs) Kampsport
+03:24=Kagen findes!
+03:25=Sminkedåse
+03:26=Saftig Granat
+03:27=Hidsig Granat
+03:28=Balistisk VÃ¥ben
+03:29=Balistisk VÃ¥ben
+03:30=Luftangreb
+03:31=Fjernbetjent Bombe
+03:32=Midlertidig Effekt
+03:33=Midlertidig Effekt
+03:34=Midlertidig Effekt
+03:35=Midlertidig Effekt
+03:36=Midlertidig Effekt
+03:37=Midlertidig Effekt
+03:38=Skydevåben (flere skud)
+03:39=Køretøj
+03:40=Brændspåsættende Granat
+03:41=Stor fan af Squawks
+03:42=Jeg lægger lige en besked...
+; the misspelled "Beethoven" is intentional (-> to beat)
+03:43=Spil en himmelsk solo
+03:44=Mindst holdbar til: 1923
+03:45=Videnskab, det virker!
+03:46=Varm, varm, varm
+03:47=Sæt dem nu et brugbart sted, ikke?
+03:48=Sløjdtimerne vender tilbage
+03:49=Gør lige præcis hvad du forventer
+03:50=Ring til en muldvarp
+03:51=Lige til at samle op
+03:52=UBRUGT
+03:53=Ã…rgang 40
+03:54=Byg noget
+03:55=Værktøj
+
+; Weapon Descriptions (use |as line breaks)
+04:00=Angrib dine fjender med en simpel granat.|Den eksploderer når uret når nul.|1-5: Indstil uret|Angrib: Hold knappen inde for at kaste hårdere
+04:01=Angrib dine fjender med en klyngebombe.|Den splitter sig op i flere bomber når uret|når nul.|1-5: Indstil uret|Angrib: Hold knappen inde for at kaste hårdere
+04:02=Angrib dine fjender med et balistisk projektil|som godt kan rammes af vindstød.|Angrib: Hold knappen inde for at skyde længere
+04:03=Affyr en eksplosiv bi som forsøger at ramme det|valgte mål. Mere præcis hvis du ikke sætter fuld|knald på.|Musemarkør: Vælg mål|Angrib: Hold knappen inde for at give mere fart på
+04:04=Angrib dine fjender med et haglgevær med to skud.|Takket være spredningen behøver du ikke ramme|helt præcist for at gøre skade.|Angrib: Skyd (flere gange)
+04:05=Gå under jorden! Brug hakken til at grave|dig et hul og nå nye højder, ehm...|Angrib: Start eller stop med at grave
+04:06=Keder du dig? Mangler våben? Vil spare på ammunitionen?|Intet problem! bare spring din tur over, kryster!|Angrib: Spring din tur over uden at angribe
+04:07=Overvind store kløfter på kort tid med rebet.|Ram ind i og skub andre pindsvin af vejen|eller lad det regne med granater.|Angrib: Affyr eller slip rebet|Langt Hop: Slip granater eller lignende våben
+04:08=Hold dine fjender på afstand med en mine for foden|af dem eller i tunnelen mellem dem og dig. Husk|at trække dig lidt tilbage før du trykker på aftrækkeren!|Angrib: Læg en mine lige foran dig
+04:09=Ikke så sikker på dine sigteevner? Med Desert Eagle-|pistolen kan du skyde op til fire gange.|Angrib: Skyd (flere gange)
+04:10=Vold er altid en mulighed. Læg en stang dynamit, træd|et skridt tilbage og fjenderne er solgt til stanglakrids.|Angrib: Læg en stang dynamit lige foran dig
+04:11=Et bat der batter. Slå fjenderne ud (af banen)|eller i vandet. Du kan også sende en mine afsted|med luftpost.|Angrib: Slå på alt hvad der står foran dig
+04:12=Gå helt tæt på og slip din indre energi løs med denne|(næsten) dødbringende kampsportsteknik.|Angrib: Udfør en fantastisk Shoryuken.
+04:13=UBRUGT
+04:14=Bange for højder? Nap hellere en faldskærm.|Den folder sig ud hvis du falder for langt|og sikrer dit pindsvin mod at slå sig.|Angrib: Fold paraplyen ud|Langt Hop: Slip granater eller lignende våben
+04:15=Send et fly ind for at angribe dine fjender|med en stribe af bomber.|Venstre/Højre: Vælg angrebsretning|Musemarkør: Vælg målzonen
+04:16=Send et fly ind for at kaste adskillige|miner ned over dine fjender.|Venstre/Højre: Vælg angrebsretning|Musemarkør: Vælg målzonen
+04:17=Brug for ly? Brug skærebrænderen til hurtigt|at grave en tunnel du kan gemme dig i.|Angrib: Start eller stop med at grave
+04:18=Brug for beskyttelse eller for et lille lift?|Placer nogle bærebjælker lige som du ønsker.|Venstre/Højre: Vælg bærebjælke du vil placere|Musemarkør: Placer bærebjælken hvis der er plads til den
+04:19=Hvis den bliver brugt på det rigtige tidpunkt kan teleportation|redde pindsvin fra farlige situationer og efterlade forvirrede fjender.|Musemarkør: Vælg hvor du vil teleportere hen
+04:20=Giver dig mulighed for at bruge et|andet pindsvin denne tur.|Angrib: Muliggør skift af aktivt pindsvin
+04:21=Affyr et granat-agtigt projektil som deler|sig op i mange mindre bomber ved kollision.|Angrib: Affyr med fuld kraft
+04:22=Set på film! Nu kan du være Indiana Jones for en dag!|Pisken er brugbar i mange situationer.|Specielt hvis du lige får lyst til at kaste nogen ud fra et bjerg.|Angrib: Pisk alt hvad der står foran dig
+04:23=Har du alligevel ikke noget at tabe, kan du ofre|er pindsvin og skyde det afsted i en valgfri retning.|Skader alt hvad pindsvinet rammer og slutter af med et stort brag.|Angrib: Affyr dette altødelæggende og dødbringende angreb
+04:24=Tillykke med fødselsdagen! Bare pust lysene ud, og send|kagen hen i den anden ende af bordet|Så får dine "venner" en eksplosiv fest.|Kagen passerer selv svært terræn, men pas på!|Måske springer den lidt tidligere på den måde.|Angrib: Start kagen eller få den til at stoppe og eksplodere
+04:25=Åben sminkedåsen og husk ikke at spare på pudderet.|De andre pindsvin bliver så imponerede, at de|ikke kan undlade at løbe efter dig|(og lige ned i en sprække eller et hul efter behag).|Angrib: Brug sminkedåsen and prøv at forføre et andet pindsvin
+04:26=Kast denne saftige vandmelon efter dine fjender.|Så snart uret ramme nul, splitter den op i|flere eksplosive stykker.|1-5: Indstil uret|Angrib: Hold knappen inde for at kaste hårdere
+04:27=Lad helvedes ild regne ned over dine fjender|med dette dæmoniske sprængstof. Men kom ikke for tæt på,|for der kan godt være mindre flammer efter eksplosionen.|Angrib: Hold knappen inde for at kaste hårdere
+04:28=Kort tid efter du affyrer raketten vil den grave sig|gennem forhindringer og eksplodere så snart dens|lunte bliver antændt eller den rammer jordoverfladen|igen.|Angrib: Hold knappen inde for at affyre med mere kraft
+04:29=Ikke egnet for småbørn! Boldpistolen affyrer |(ulig dens fætter, boltpistolen) masser af små farvede kugler fyldt med sprængstof.|Angrib: Affyr med fuld kraft|Op/Ned: Fortsæt med at sigte
+04:30=Send et fly ind for at kaste napalm ned over|dine fjender. Hvis den rammer kan den destruere|store områder samt et hvilket som helst|uheldigt pindsvin der befinder sig i nærheden.|Venstre/Højre: Vælg angrebsretning|Cursor: Vælg målzone
+04:31=Det Fjernstyrede Fly er det perfekte våben til at samle|kasser op eller angribe pindsvin der er for langt væk.|Du kan enten styre den direkte mod fjenderne|eller kaste nogle bomber først.|Angrib: Send flyet afsted og kast bomber|Langt Hop: Giv en valkyrie et lift til kampens centrum|Venstre/Højre: Styr flyet
+04:32=Svag Tyngdekraft er bedre end nogen slankekur!|Hop højere, svæv længere og send endnu flere|fjender flyvende.|Angrib: Aktiver
+04:33=Nogle gange har du bare brug for lidt mere|skade for virkelig at komme igennem.|Angrib: Aktiver
+04:34=Kom bare an!|Angrib: Aktiver
+04:35=Nogen gange går tiden dræbende langsomt.|Andre gange alt for hurtigt.|Nap et par sekunder ekstra til at angribe i.|Angrib: Aktiver
+04:36=Sigter godt, men rammer skidt? FÃ¥ lidt moderne assistance.|Angrib: Aktiver
+04:37=Du behøver ikke være bange for sollyset. Det holder kun én tur,|men gør det muligt at suge liv ud af de pindsvin|du giver skade til.|Angrib: Aktiver
+04:38=Sniperriflen kan være det mest dødbringende våben i hele|dit arsenal, men virker dårligt på klods hold.|Giver mere skade jo længere der er til målet.|Angrib: Skyd (to gange)
+04:39=Flyv rundt i den Flyvende Talerken.|Den er svær at styre, men giver stor frihed og|mulighed for at bevæge sig på hele banen.|Angrib: Aktiver|Op/Venstre/Højre: Accellerer i en retning|Langt Hop: Slip granater eller lignende våben
+04:40=Tænd op for et flammehav med den (snart)|brændende væske i flasken.|Angrib: Hold inde for at kaste længere
+04:41=Måske slår naturen den Flyvende Talerken. |Pipfuglen kan bære dit pindsvin omkring|og kaste æg ned på dine fjender!|Angrib: Aktiver og kast æg|Op/Venstre/Højre: Flap vingerne i en retning
+04:42=Den Håndholdte Portal-Pistol er i stand til|øjeblikkeligt at transportere dig, dine fjender,|eller dine våben mellem to punkter på banen.|Brug den med omtanke og du vil få...|STOR SUCCES!|Angrib: Affyr en portal|Skift: Skifter mellem portalfarver
+04:43=Få en eksplosiv musikalsk debut!|Smid et klaver ned fra himlen, men husk...|en eller anden skal jo spille på det|og det kommer måske til at koste dig livet!|Musemarkør: Vælg målzone|F1-F9: Spil klaver
+04:44=Det er ikke bare en ost, det er biologisk krigsførsel!|Den giver ikke meget skade når uret rammer nul|men stanken skal nok forgifte alle i nærheden!|1-5: Indstil uret|Angrib: Hold knappen inde for at kaste længere
+04:45=Endelig betaler de endeløse fysiktimer sig.|Afspil en ødelæggende sinusbølge mod dine|modstandere. Men pas på, der er knald på!|(Dette våben er ikke færdigt)|Angrib: Skyd
+04:46=Dæk dine fjender i flydende flammer.|Hjertevarmende, ikke?|Angrib: Aktiver|Up/Down: Fortsæt med at sigte|Venstre/Højre: Ændr på affyringshastigheden
+04:47=Dobbel så meget sjov med to luskede, klæbrige miner.|Sæt en kædereaktion i gang eller forsvar dig|selv (eller begge dele!)|Angrib: Hold knappen inde for at skyde længere (to gange)
+04:48=Hvorfor er det kun muldvarpe vi mishandler?|Det er mindst lige så sjovt at slå til pindsvin!|Et ordentligt slag fra hammeren napper en tredjedel af et|pindsvins liv og slynger det samtidig ned i jorden.|Angrib: Aktiver
+04:49=Genopliv dine venner, men pas på!|Kan også ramme dine fjender|Angrib: Hold knappen inde for langsomt at genoplive|Op: Accelerer genoplivningen
+04:50=Er dine fjender gået under jorden?|Grav dig ind til dem med et Boreangreb!|Uret bestemmer hvor langt du når.
+04:51=Få et skud lige ind med en Mudderklat.|Bider en smule og slår fjender omkuld.
+04:52=UBRUGT
+04:53=Tag på et eventyr gennem tid og rum,|mens du efterlader kampen til dine kammerater.|Vær klar til at vende tilbage når som helst,|eller hvis Pludselig Død indtræder|eller alle dine andre pindsvin dør.|Advarsel! Virker ikke under Pludselig Død,|hvis du er alene eller er Konge.
+04:54=UFÆRDIG                                                                                                                                    
+04:55=Sprøjt rundt med klistrende flammer.|Byg broer, begrav fjender, luk tunneler af.|Pas på ikke selv at få noget på dig.
+
+; Game goal strings
+05:00=Spilsystemer
+05:01=De følgende regler gælder
+05:02=Forter: Forsvar din fæstning; knus dine modstandere!
+05:03=Svag Tyngdekraft: GÃ¥ forsigtigt
+05:04=Udødelighed: Pindsvin er (næsten) udødelige
+05:05=Vampyr: Pindsvin bliver helbredt når de giver skade
+05:06=Karma: Pindsvin tager skade når de giver skade
+05:07=Forsvar Kongen: Undgå at gå skakmat!|Placer din Konge: Vælg et beskyttet sted din konge kan starte
+05:08=Placer Pindsvin: Placer dine pindsvin før spillet starter
+05:09=Artilleri: Pindsvin kan ikke gå for at flytte sig rundt
+05:10=Uforgængeligt Terræn: De fleste våben kan ikke ændre på banen
+05:11=Delt Ammunition: Alle hold af samme farve deler ammunition
+05:12=Mineur: Miner detonerer efter %1 sekund(er)
+05:13=Mineur: Miner detonerer med det samme
+05:14=Mineur: Miner detonerer efter 0 - 5 sekunder
+05:15=Skademodifikator: Alle våben giver %1% skade
+05:16=Alle pindsvin bliver helbredt fuldt ud i slutningen af turen
+05:17=AI-pindsvin genopliver når de dør
+05:18=Uendelige Angreb
+05:19=VÃ¥ben nulstilles i slutningen af turen
+05:20=VÃ¥ben deles ikke mellem pindsvin
+05:21=Tagteam: Hold i en klan tager tur efter hinanden|Delt Tid: Hold i en klan deler tiden til hver tur
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Locale/hedgewars_da.ts	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,2704 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="da">
+<context>
+    <name>AmmoSchemeModel</name>
+    <message>
+        <source>new</source>
+        <translation>ny</translation>
+    </message>
+    <message>
+        <source>copy of</source>
+        <translation>kopi af</translation>
+    </message>
+</context>
+<context>
+    <name>DrawMapWidget</name>
+    <message>
+        <source>File error</source>
+        <translation>Fejl i fil</translation>
+    </message>
+    <message>
+        <source>Cannot open file &apos;%1&apos; for writing</source>
+        <translation>Kan ikke åbne filen &apos;%1&apos; til skrivning</translation>
+    </message>
+    <message>
+        <source>Cannot read file &apos;%1&apos;</source>
+        <translation>Kan ikke læse filen &apos;%1&apos;</translation>
+    </message>
+</context>
+<context>
+    <name>FreqSpinBox</name>
+    <message>
+        <source>Never</source>
+        <translation>Aldrig</translation>
+    </message>
+    <message numerus="yes">
+        <source>Every %1 turn</source>
+        <translation>
+            <numerusform>Hver %1 tur</numerusform>
+            <numerusform>Hver %1 tur</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
+    <name>GameCFGWidget</name>
+    <message>
+        <source>Edit weapons</source>
+        <translation>Rediger våben</translation>
+    </message>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>Illegal ammo scheme</source>
+        <translation>Ugyldig ammunitionssystem</translation>
+    </message>
+    <message>
+        <source>Edit schemes</source>
+        <translation>Rediger spilsystemer</translation>
+    </message>
+    <message>
+        <source>When this option is enabled selecting a game scheme will auto-select a weapon</source>
+        <translation>Når denne indstilling er aktiveret vælges automatisk et våben når et spilsystem vælges</translation>
+    </message>
+    <message>
+        <source>Game Options</source>
+        <translation>Spilindstillinger</translation>
+    </message>
+</context>
+<context>
+    <name>HWChatWidget</name>
+    <message>
+        <source>%1 *** %2 has been removed from your ignore list</source>
+        <translation>%1 *** %2 er blevet fjernet fra din ignoreringsliste</translation>
+    </message>
+    <message>
+        <source>%1 *** %2 has been added to your ignore list</source>
+        <translation>%1 *** %2 er blevet tilføjet til din ignoreringsliste</translation>
+    </message>
+    <message>
+        <source>%1 *** %2 has been removed from your friends list</source>
+        <translation>%1 *** %2 er blevet fjernet fra din venneliste</translation>
+    </message>
+    <message>
+        <source>%1 *** %2 has been added to your friends list</source>
+        <translation>%1 *** %2 er blevet tilføjet til din venneliste</translation>
+    </message>
+    <message>
+        <source>%1 has been removed from your ignore list</source>
+        <translation>%1 er blevet fjernet fra din ignoreringsliste</translation>
+    </message>
+    <message>
+        <source>%1 has been added to your ignore list</source>
+        <translation>%1 er blevet tilføjet til din ignoreringsliste</translation>
+    </message>
+    <message>
+        <source>%1 has been removed from your friends list</source>
+        <translation>%1 er blevet fjernet fra din venneliste</translation>
+    </message>
+    <message>
+        <source>%1 has been added to your friends list</source>
+        <translation>%1 er blevet tilføjet til din venneliste</translation>
+    </message>
+    <message>
+        <source>Stylesheet imported from %1</source>
+        <translation>Typografiark importeret fra %1</translation>
+    </message>
+    <message>
+        <source>Enter %1 if you want to use the current StyleSheet in future, enter %2 to reset!</source>
+        <translation>Tryk %1 hvis du vil bruge det nuværende typografiark i fremtiden, tryk %2 for at nulstille!</translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t read %1</source>
+        <translation>Kunne ikke læse %1</translation>
+    </message>
+    <message>
+        <source>StyleSheet discarded</source>
+        <translation>Typografiark kasseret</translation>
+    </message>
+    <message>
+        <source>StyleSheet saved to %1</source>
+        <translation>Typografiark gemt til %1</translation>
+    </message>
+    <message>
+        <source>Failed to save StyleSheet to %1</source>
+        <translation>Mislykkedes at gemme typografiark til %1</translation>
+    </message>
+    <message>
+        <source>%1 is not a valid command!</source>
+        <translation>%1 er ikke en gyldig kommando!</translation>
+    </message>
+    <message>
+        <source>Kicking %1 ...</source>
+        <translation>Smider %1 ud...</translation>
+    </message>
+</context>
+<context>
+    <name>HWForm</name>
+    <message>
+        <source>new</source>
+        <translation>ny</translation>
+    </message>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>OK</translation>
+    </message>
+    <message>
+        <source>Unable to start the server</source>
+        <translation>Ude af stand til at starte serveren</translation>
+    </message>
+    <message>
+        <source>Cannot save record to file %1</source>
+        <translation>Kan ikke gemme optagelse til fil %1</translation>
+    </message>
+    <message>
+        <source>Please select record from the list above</source>
+        <translation>Vælg venligst en optagelse fra den ovenstående liste</translation>
+    </message>
+    <message>
+        <source>DefaultTeam</source>
+        <translation>StandardHold</translation>
+    </message>
+    <message>
+        <source>Hedgewars Demo File</source>
+        <comment>File Types</comment>
+        <translation>Hedgewars Demofil</translation>
+    </message>
+    <message>
+        <source>Hedgewars Save File</source>
+        <comment>File Types</comment>
+        <translation>Hedgewars Spilfil</translation>
+    </message>
+    <message>
+        <source>Demo name</source>
+        <translation>Demonavn</translation>
+    </message>
+    <message>
+        <source>Demo name:</source>
+        <translation>Demonavn:</translation>
+    </message>
+    <message>
+        <source>Game aborted</source>
+        <translation>Spil afbrudt</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <translation>Kodeord</translation>
+    </message>
+    <message>
+        <source>Your nickname %1 is
+registered on Hedgewars.org
+Please provide your password below
+or pick another nickname in game config:</source>
+        <translation>Dit brugernavn %1 er
+registreret på Hedgewars.org
+Indtast venligst dit kodeord nedenfor
+eller vælg et andet brugernavn under spilkonfigurationen:</translation>
+    </message>
+    <message>
+        <source>No password supplied.</source>
+        <translation>Intet kodeord indtastet.</translation>
+    </message>
+    <message>
+        <source>Nickname</source>
+        <translation>Brugernavn</translation>
+    </message>
+    <message>
+        <source>Some one already uses
+ your nickname %1
+on the server.
+Please pick another nickname:</source>
+        <translation>En eller anden bruger allerede
+dit brugernavn %1
+på serveren.
+Vælg venligst et andet brugernavn:</translation>
+    </message>
+    <message>
+        <source>No nickname supplied.</source>
+        <translation>Intet brugernavn indtastet.</translation>
+    </message>
+</context>
+<context>
+    <name>HWGame</name>
+    <message>
+        <source>en.txt</source>
+        <translation>en.txt</translation>
+    </message>
+    <message>
+        <source>Cannot open demofile %1</source>
+        <translation>Kan ikke åbne demofil %1</translation>
+    </message>
+</context>
+<context>
+    <name>HWMapContainer</name>
+    <message>
+        <source>Map</source>
+        <translation>Bane</translation>
+    </message>
+    <message>
+        <source>Themes</source>
+        <translation>Temaer</translation>
+    </message>
+    <message>
+        <source>Filter</source>
+        <translation>Filter</translation>
+    </message>
+    <message>
+        <source>All</source>
+        <translation>Alle</translation>
+    </message>
+    <message>
+        <source>Small</source>
+        <translation>Lille</translation>
+    </message>
+    <message>
+        <source>Medium</source>
+        <translation>Medium</translation>
+    </message>
+    <message>
+        <source>Large</source>
+        <translation>Stor</translation>
+    </message>
+    <message>
+        <source>Cavern</source>
+        <translation>Grotte</translation>
+    </message>
+    <message>
+        <source>Wacky</source>
+        <translation>Skør</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Type</translation>
+    </message>
+    <message>
+        <source>Small tunnels</source>
+        <translation>Små tunneler</translation>
+    </message>
+    <message>
+        <source>Medium tunnels</source>
+        <translation>Mellemstore tunneler</translation>
+    </message>
+    <message>
+        <source>Large tunnels</source>
+        <translation>Store tunneler</translation>
+    </message>
+    <message>
+        <source>Small floating islands</source>
+        <translation>Små svævende øer</translation>
+    </message>
+    <message>
+        <source>Medium floating islands</source>
+        <translation>Mellemstore svævende øer</translation>
+    </message>
+    <message>
+        <source>Large floating islands</source>
+        <translation>Store svævende øer</translation>
+    </message>
+    <message>
+        <source>Seed</source>
+        <translation>Spire</translation>
+    </message>
+    <message>
+        <source>Set</source>
+        <translation>Indstil</translation>
+    </message>
+</context>
+<context>
+    <name>HWNetServersModel</name>
+    <message>
+        <source>Title</source>
+        <translation>Titel</translation>
+    </message>
+    <message>
+        <source>IP</source>
+        <translation>Ip</translation>
+    </message>
+    <message>
+        <source>Port</source>
+        <translation>Port</translation>
+    </message>
+</context>
+<context>
+    <name>HWNewNet</name>
+    <message>
+        <source>The host was not found. Please check the host name and port settings.</source>
+        <translation>Værtsmaskinen blev ikke fundet. Tjek venligst værtsnavnet og portindstillingerne.</translation>
+    </message>
+    <message>
+        <source>Connection refused</source>
+        <translation>Forbindelse afvist</translation>
+    </message>
+    <message>
+        <source>Room destroyed</source>
+        <translation>Rum fjernet</translation>
+    </message>
+    <message>
+        <source>Quit reason: </source>
+        <translation>Forlod fordi: </translation>
+    </message>
+    <message>
+        <source>You got kicked</source>
+        <translation>Du blev smidt ud</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <translation>Kodeord</translation>
+    </message>
+    <message>
+        <source>Your nickname %1 is
+registered on Hedgewars.org
+Please provide your password
+or pick another nickname:</source>
+        <translation type="obsolete">Your nickname %1 is
+registered on Hedgewars.org
+Please provide your password
+or pick another nickname:</translation>
+    </message>
+    <message>
+        <source>%1 *** %2 has joined the room</source>
+        <translation>%1 *** %2 har tilsluttet sig til rummet</translation>
+    </message>
+    <message>
+        <source>%1 *** %2 has joined</source>
+        <translation>%1 *** %2 har tilsluttet sig</translation>
+    </message>
+    <message>
+        <source>%1 *** %2 has left (%3)</source>
+        <translation>%1 *** %2 har forladt (%3)</translation>
+    </message>
+    <message>
+        <source>%1 *** %2 has left</source>
+        <translation>%1 *** %2 har forladt</translation>
+    </message>
+    <message>
+        <source>Your nickname %1 is
+registered on Hedgewars.org
+Please provide your password below
+or pick another nickname in game config:</source>
+        <translation type="obsolete">Your nickname %1 is
+registered on Hedgewars.org
+Please provide your password below
+or pick another nickname in game config:</translation>
+    </message>
+    <message>
+        <source>Nickname</source>
+        <translation>Brugernavn</translation>
+    </message>
+    <message>
+        <source>User quit</source>
+        <translation>En bruger forlod</translation>
+    </message>
+</context>
+<context>
+    <name>KB</name>
+    <message>
+        <source>SDL_ttf returned error while rendering text, most propably it is related to the bug in freetype2. It&apos;s recommended to update your freetype lib.</source>
+        <translation>SDL_ttf returnerede en fejl under tekstrendering, højst sandsynligt er den relateret til en fejl i freetype2. Det anbefales at opdatere dit freetype bibliotek.</translation>
+    </message>
+</context>
+<context>
+    <name>PageAdmin</name>
+    <message>
+        <source>Server message:</source>
+        <translation>Serverbesked:</translation>
+    </message>
+    <message>
+        <source>Set message</source>
+        <translation>Indstil besked</translation>
+    </message>
+    <message>
+        <source>Clear Accounts Cache</source>
+        <translation>Ryd Bruger-cache</translation>
+    </message>
+    <message>
+        <source>Fetch data</source>
+        <translation>Hent data</translation>
+    </message>
+    <message>
+        <source>Server message for latest version:</source>
+        <translation>Serverbesked for nyeste version:</translation>
+    </message>
+    <message>
+        <source>Server message for previous versions:</source>
+        <translation>Serverbesked for tidligere versioner:</translation>
+    </message>
+    <message>
+        <source>Latest version protocol number:</source>
+        <translation>Nyeste versions protokolnummer:</translation>
+    </message>
+    <message>
+        <source>MOTD preview:</source>
+        <translation>Forhåndsvisning af dagens besked:</translation>
+    </message>
+    <message>
+        <source>Set data</source>
+        <translation>Indstil data</translation>
+    </message>
+</context>
+<context>
+    <name>PageConnecting</name>
+    <message>
+        <source>Connecting...</source>
+        <translation>Opretter forbindelse...</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Annuler</translation>
+    </message>
+</context>
+<context>
+    <name>PageDrawMap</name>
+    <message>
+        <source>Undo</source>
+        <translation>Fortryd</translation>
+    </message>
+    <message>
+        <source>Clear</source>
+        <translation>Ryd</translation>
+    </message>
+    <message>
+        <source>Load</source>
+        <translation>Indlæs</translation>
+    </message>
+    <message>
+        <source>Save</source>
+        <translation>Gem</translation>
+    </message>
+    <message>
+        <source>Load drawn map</source>
+        <translation>Indlæs tegnet bane</translation>
+    </message>
+    <message>
+        <source>Save drawn map</source>
+        <translation>Gem tegnet bane</translation>
+    </message>
+    <message>
+        <source>Drawn Maps</source>
+        <translation>Tegnede Baner</translation>
+    </message>
+    <message>
+        <source>All files</source>
+        <translation>Alle filer</translation>
+    </message>
+</context>
+<context>
+    <name>PageEditTeam</name>
+    <message>
+        <source>General</source>
+        <translation>Generelt</translation>
+    </message>
+    <message>
+        <source>Advanced</source>
+        <translation>Advanceret</translation>
+    </message>
+</context>
+<context>
+    <name>PageGameStats</name>
+    <message>
+        <source>&lt;p&gt;The best shot award was won by &lt;b&gt;%1&lt;/b&gt; with &lt;b&gt;%2&lt;/b&gt; pts.&lt;/p&gt;</source>
+        <translation>&lt;p&gt;Prisen for det bedste skud gik til &lt;b&gt;%1&lt;/b&gt; med &lt;b&gt;%2&lt;/b&gt; point.&lt;/p&gt;</translation>
+    </message>
+    <message numerus="yes">
+        <source>&lt;p&gt;The best killer is &lt;b&gt;%1&lt;/b&gt; with &lt;b&gt;%2&lt;/b&gt; kills in a turn.&lt;/p&gt;</source>
+        <translation type="obsolete">
+            <numerusform>&lt;p&gt;The best killer is &lt;b&gt;%1&lt;/b&gt; with &lt;b&gt;%2&lt;/b&gt; kill in a turn.&lt;/p&gt;</numerusform>
+            <numerusform>&lt;p&gt;The best killer is &lt;b&gt;%1&lt;/b&gt; with &lt;b&gt;%2&lt;/b&gt; kills in a turn.&lt;/p&gt;</numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>&lt;p&gt;A total of &lt;b&gt;%1&lt;/b&gt; hedgehog(s) were killed during this round.&lt;/p&gt;</source>
+        <translation type="obsolete">
+            <numerusform>&lt;p&gt;A total of &lt;b&gt;%1&lt;/b&gt; hedgehog was killed during this round.&lt;/p&gt;</numerusform>
+            <numerusform>&lt;p&gt;A total of &lt;b&gt;%1&lt;/b&gt; hedgehogs were killed during this round.&lt;/p&gt;</numerusform>
+        </translation>
+    </message>
+    <message>
+        <source>Details</source>
+        <translation>Detaljer</translation>
+    </message>
+    <message>
+        <source>Health graph</source>
+        <translation>Helbredsgraf</translation>
+    </message>
+    <message>
+        <source>Ranking</source>
+        <translation>Rangliste</translation>
+    </message>
+    <message>
+        <source>The best shot award was won by &lt;b&gt;%1&lt;/b&gt; with &lt;b&gt;%2&lt;/b&gt; pts.</source>
+        <translation>Prisen for det bedste skud gik til &lt;b&gt;%1&lt;/b&gt; med &lt;b&gt;%2&lt;/b&gt; point.</translation>
+    </message>
+    <message numerus="yes">
+        <source>The best killer is &lt;b&gt;%1&lt;/b&gt; with &lt;b&gt;%2&lt;/b&gt; kills in a turn.</source>
+        <translation>
+            <numerusform>Den bedste dræber er &lt;b&gt;%1&lt;/b&gt; med &lt;b&gt;%2&lt;/b&gt; drab på én tur.</numerusform>
+            <numerusform>Den bedste dræber er &lt;b&gt;%1&lt;/b&gt; med &lt;b&gt;%2&lt;/b&gt; drab på én tur.</numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>A total of &lt;b&gt;%1&lt;/b&gt; hedgehog(s) were killed during this round.</source>
+        <translation>
+            <numerusform>&lt;b&gt;%1&lt;/b&gt; pindsvin blev dræbt i denne runde.</numerusform>
+            <numerusform>Totalt blev &lt;b&gt;%1&lt;/b&gt; pindsvin dræbt i denne runde.</numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>(%1 kill)</source>
+        <translation>
+            <numerusform>(%1 drab)</numerusform>
+            <numerusform>(%1 drab)</numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>&lt;b&gt;%1&lt;/b&gt; thought it&apos;s good to shoot his own hedgehogs with &lt;b&gt;%2&lt;/b&gt; pts.</source>
+        <translation>
+            <numerusform>&lt;b&gt;%1&lt;/b&gt; troede det var en god idé at skyde sine egne pindsvin med &lt;b&gt;%2&lt;/b&gt; point.</numerusform>
+            <numerusform>&lt;b&gt;%1&lt;/b&gt; troede det var en god idé at skyde sine egne pindsvin med &lt;b&gt;%2&lt;/b&gt; point.</numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>&lt;b&gt;%1&lt;/b&gt; killed &lt;b&gt;%2&lt;/b&gt; of his own hedgehogs.</source>
+        <translation>
+            <numerusform>&lt;b&gt;%1&lt;/b&gt; dræbte &lt;b&gt;%2&lt;/b&gt; af sine egne pindsvin.</numerusform>
+            <numerusform>&lt;b&gt;%1&lt;/b&gt; dræbte &lt;b&gt;%2&lt;/b&gt; af sine egne pindsvin.</numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>&lt;b&gt;%1&lt;/b&gt; was scared and skipped turn &lt;b&gt;%2&lt;/b&gt; times.</source>
+        <translation>
+            <numerusform>&lt;b&gt;%1&lt;/b&gt; blev bange og sprang over sin tur &lt;b&gt;%2&lt;/b&gt; gang.</numerusform>
+            <numerusform>&lt;b&gt;%1&lt;/b&gt; blev bange og sprang over sin tur &lt;b&gt;%2&lt;/b&gt; gange.</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
+    <name>PageInGame</name>
+    <message>
+        <source>In game...</source>
+        <translation>I spillet...</translation>
+    </message>
+</context>
+<context>
+    <name>PageMain</name>
+    <message>
+        <source>Local Game (Play a game on a single computer)</source>
+        <translation>Lokalt spil (Spil et spil på én enkelt computer)</translation>
+    </message>
+    <message>
+        <source>Network Game (Play a game across a network)</source>
+        <translation>Netværksspil (Spil et spil over et netværk)</translation>
+    </message>
+    <message>
+        <source>Simply pick the same color as a friend to play together as a team. Each of you will still control his or her own hedgehogs but they&apos;ll win or lose together.</source>
+        <comment>Tips</comment>
+        <translation>Bare vælg samme farve som en ven for at spille sammen som et hold. Hver af jer vil stadig kontrollere sine egne pindsvin, men vil vinde eller tabe sammen.</translation>
+    </message>
+    <message>
+        <source>Some weapons might do only low damage but they can be a lot more devastating in the right situation. Try to use the Desert Eagle to knock multiple hedgehogs into the water.</source>
+        <comment>Tips</comment>
+        <translation>Nogle våben giver måske ikke særlig meget skade, men de kan være meget mere farlige i de rigtige situationer. Prøv at bruge Desert Eagle-pistolen til at skubbe flere pindsvin i vandet.</translation>
+    </message>
+    <message>
+        <source>If you&apos;re unsure what to do and don&apos;t want to waste ammo, skip one round. But don&apos;t let too much time pass as there will be Sudden Death!</source>
+        <comment>Tips</comment>
+        <translation>Hvis du er usikker på hvad du skal gøre og ikke vil spilde ammunition, kan du springe en runde over. Men lad der ikke gå alt for meget tid, for ellers indtræffer Pludselig Død!</translation>
+    </message>
+    <message>
+        <source>If you&apos;d like to keep others from using your preferred nickname on the official server, register an account at http://www.hedgewars.org/.</source>
+        <comment>Tips</comment>
+        <translation>Hvis du ikke vil have at andre anvender dit foretrukne brugernavn på den officielle server, kan du registrere en bruger på http://www.hedgewars.org/.</translation>
+    </message>
+    <message>
+        <source>You&apos;re bored of default gameplay? Try one of the missions - they&apos;ll offer different gameplay depending on the one you picked.</source>
+        <comment>Tips</comment>
+        <translation>Er du træt af den almindelige måde at spille på? Prøv en af missionerne - de tilbyder forskellige måder at spille på afhængigt af hvilken en du vælger.</translation>
+    </message>
+    <message>
+        <source>By default the game will always record the last game played as a demo. Select &apos;Local Game&apos; and pick the &apos;Demos&apos; button on the lower right corner to play or manage them.</source>
+        <comment>Tips</comment>
+        <translation>Som standard optager spillet altid det sidste spil du har spillet som en demo. Tryk på &apos;Lokalt spil&apos; og vælg &apos;Demoer&apos;-knappen i nederste højre hjørne for at afspille eller administrere dem.</translation>
+    </message>
+    <message>
+        <source>Hedgewars is Open Source and Freeware we create in our spare time. If you&apos;ve got problems, ask on our forums but please don&apos;t expect 24/7 support!</source>
+        <comment>Tips</comment>
+        <translation>Hedgewars er Open Source og et gratis spil vi laver i vores fritid. Hvis du har problemer er du velkommen til at spørge på forummet, men forvent ikke at få hjælp 24 timer i døgnet!</translation>
+    </message>
+    <message>
+        <source>Hedgewars is Open Source and Freeware we create in our spare time. If you like it, help us with a small donation or contribute your own work!</source>
+        <comment>Tips</comment>
+        <translation>Hedgewars er Open Source og et gratis spil vi laver i vores fritid. Hvis du holder af det, kan du hjælpe os med en lille donation eller ved at indsende dine egne modifikationer!</translation>
+    </message>
+    <message>
+        <source>Hedgewars is Open Source and Freeware we create in our spare time. Share it with your family and friends as you like!</source>
+        <comment>Tips</comment>
+        <translation>Hedgewars er Open Source og et gratis spil vi laver i vores fritid. Del det med dine venner og din familie som du ønsker!</translation>
+    </message>
+    <message>
+        <source>From time to time there will be official tournaments. Upcoming events will be announced at http://www.hedgewars.org/ some days in advance.</source>
+        <comment>Tips</comment>
+        <translation>Fra tid til anden er der officielle turneringer. Kommende begivenheder vil blive annonceret på http://www.hedgewars.org/ et par dage i forvejen.</translation>
+    </message>
+    <message>
+        <source>Hedgewars is available in many languages. If the translation in your language seems to be missing or outdated, feel free to contact us!</source>
+        <comment>Tips</comment>
+        <translation>Hedgewars er tilgængeligt på mange sprog. Hvis oversættelsen på dit sprog mangler noget eller er uddateret, skal du være velkommen til at kontakte os!</translation>
+    </message>
+    <message>
+        <source>Hedgewars can be run on lots of different operating systems including Microsoft Windows, Mac OS X and Linux.</source>
+        <comment>Tips</comment>
+        <translation>Hedgewars kan køre på mange forskellige operativsystemer, herunder Microsoft Windows, Mac OS X og Linux.</translation>
+    </message>
+    <message>
+        <source>Always remember you&apos;re able to set up your own games in local and network/online play. You&apos;re not restricted to the &apos;Simple Game&apos; option.</source>
+        <comment>Tips</comment>
+        <translation>Husk altid at du kan sætte dine egne spil op under lokale-, netværks- og online-spil. Du er ikke begrænset til kun at bruge &apos;Simpelt spil&apos;-muligheden.</translation>
+    </message>
+    <message>
+        <source>While playing you should give yourself a short break at least once an hour.</source>
+        <comment>Tips</comment>
+        <translation>Mens du spiller bør du tage en kort pause mindst en gang i timen.</translation>
+    </message>
+    <message>
+        <source>If your graphics card isn&apos;t able to provide hardware accelerated OpenGL, try to enable the low quality mode to improve performance.</source>
+        <comment>Tips</comment>
+        <translation>Hvis dit grafikkort ikke understøtter hardware-accelereret OpenGL, kan du prøve at slå indstillingen &apos;Reduceret kvalitet&apos; til for at forbedre ydelsen.</translation>
+    </message>
+    <message>
+        <source>We&apos;re open to suggestions and constructive feedback. If you don&apos;t like something or got a great idea, let us know!</source>
+        <comment>Tips</comment>
+        <translation>Vi er åbne over for foreslag og konstruktive tilbagemeldinger. Fortæl os det hvis der er noget du ikke kan lide eller hvis du har en god idé!</translation>
+    </message>
+    <message>
+        <source>Especially while playing online be polite and always remember there might be some minors playing with or against you as well!</source>
+        <comment>Tips</comment>
+        <translation>Specielt når du spiller online bør du være venlig og altid huske at du måske også spiller med eller mod børn!</translation>
+    </message>
+    <message>
+        <source>Special game modes such as &apos;Vampirism&apos; or &apos;Karma&apos; allow you to develop completely new tactics. Try them in a custom game!</source>
+        <comment>Tips</comment>
+        <translation>Specielle måder at spille på som f.eks. &apos;Varmpyr&apos; eller &apos;Karma&apos; tillader dig at udvikle helt nye taktikker. Prøv dem i et brugerdefineret spil!</translation>
+    </message>
+    <message>
+        <source>You should never install Hedgewars on computers you don&apos;t own (school, university, work, etc.). Please ask the responsible person instead!</source>
+        <comment>Tips</comment>
+        <translation>Du bør aldrig installere Hedgewars på computere du ikke ejer (skole, universitet, arbejde,e.l.). Spørg venligst den ansvarlige person i stedet!</translation>
+    </message>
+    <message>
+        <source>Hedgewars can be perfect for short games during breaks. Just ensure you don&apos;t add too many hedgehogs or use an huge map. Reducing time and health might help as well.</source>
+        <comment>Tips</comment>
+        <translation>Hedgewars er perfekt til korte spil under pauser. Bare par på du ikke tilføjer for mange pindsvin eller bruger en kæmpe bane. Det kan også hjælpe at reducere tid og liv.</translation>
+    </message>
+    <message>
+        <source>No hedgehogs were harmed in making this game.</source>
+        <comment>Tips</comment>
+        <translation>Ingen pindsvin kom til skade under produktionen af dette spil.</translation>
+    </message>
+    <message>
+        <source>Hedgewars is Open Source and Freeware we create in our spare time. If someone sold you the game, you should try get a refund!</source>
+        <comment>Tips</comment>
+        <translation>Hedgewars er Open Source og et gratis spil vi laver i vores fritid. Hvis nogen solgte dig spiller skal du bede om at få pengene tilbage!</translation>
+    </message>
+    <message>
+        <source>Connect one or more gamepads before starting the game to be able to assign their controls to your teams.</source>
+        <comment>Tips</comment>
+        <translation>Tilslut en eller flere gamepads før du starter spiller for at kunne tildele dem til dit hold.</translation>
+    </message>
+    <message>
+        <source>Create an account on %1 to keep others from using your most favourite nickname while playing on the official server.</source>
+        <comment>Tips</comment>
+        <translation>Opret en bruger på %1 hvis du ikke vil have at andre anvender dit foretrukne brugernavn på den officielle server.</translation>
+    </message>
+    <message>
+        <source>If your graphics card isn&apos;t able to provide hardware accelerated OpenGL, try to update the associated drivers.</source>
+        <comment>Tips</comment>
+        <translation>Hvis du ikke er i stand til at slå hardware-accelereret OpenGL til, bør du prøve at opdatere dine grafikkort-drivere.</translation>
+    </message>
+    <message>
+        <source>There are three different jumps available. Tap [high jump] twice to do a very high/backwards jump.</source>
+        <comment>Tips</comment>
+        <translation>Der er tre forskellige typer hop tilgængelige. Tryk hurtigt på [hight jump] to gange i træk for at lave et højt, baglæns hop.</translation>
+    </message>
+    <message>
+        <source>Afraid of falling off a cliff? Hold down [precise] to turn [left] or [right] without actually moving.</source>
+        <comment>Tips</comment>
+        <translation>Er du bange for at falde ned fra en skrænt? Hold [precise] nede for at vende dig mod [left] eller [right] uden at bevæge dig.</translation>
+    </message>
+    <message>
+        <source>Some weapons require special strategies or just lots of training, so don&apos;t give up on a particular tool if you miss an enemy once.</source>
+        <comment>Tips</comment>
+        <translation>Nogle våben kræver specielle strategier eller bare masser af træning, så undlad ikke at bruge et bestemt våben bare fordi du rammer ved siden af én gang.</translation>
+    </message>
+    <message>
+        <source>Most weapons won&apos;t work once they touch the water. The Homing Bee as well as the Cake are exceptions to this.</source>
+        <comment>Tips</comment>
+        <translation>De fleste våben virker ikke så snart de har rørt vandet. Den Målsøgende Bi og Kagen er de eneste undtagelser.</translation>
+    </message>
+    <message>
+        <source>The Old Limbuger only causes a small explosion. However the wind affected smelly cloud can poison lots of hogs at once.</source>
+        <comment>Tips</comment>
+        <translation>Gamle Ole laver kun en lille eksplosion. Til gengæld kan den stænkende sky den udsender føres rundt af vinden og ramme mange pindsvin på én gang.</translation>
+    </message>
+    <message>
+        <source>The Piano Strike is the most damaging air strike. You&apos;ll lose the hedgehog performing it, so there&apos;s a huge downside as well.</source>
+        <comment>Tips</comment>
+        <translation>Klaveranslaget er det luftvåben der giver allermest skade. Til gengæld mister du det pindsvin som bruger angrebet, så der er også en bagside af medaljen.</translation>
+    </message>
+    <message>
+        <source>Sticky Mines are a perfect tool to create small chain reactions knocking enemy hedgehogs into dire situations ... or water.</source>
+        <comment>Tips</comment>
+        <translation>Klæbrige Miner er det perfekte værktøj til at lave små kædereaktioner og smide pindsvin ud i faretruende situationer... eller bare direkte i vandet.</translation>
+    </message>
+    <message>
+        <source>The Hammer is most effective when used on bridges or girders. Hit hogs will just break through the ground.</source>
+        <comment>Tips</comment>
+        <translation>Hammeren er mest effektiv når den bruges enten på broer eller bærebjælker. Sigter du mod pindsvin med den, laver du bare huller i jorden.</translation>
+    </message>
+    <message>
+        <source>If you&apos;re stuck behind an enemy hedgehog, use the Hammer to free yourself without getting damaged by an explosion.</source>
+        <comment>Tips</comment>
+        <translation>Hvis du sidder fast bag en af modstanderens pindsvin, kan du bruge Hammeren til at slå dig fri uden at tage skade under en eksplosion.</translation>
+    </message>
+    <message>
+        <source>The Cake&apos;s maximum walking distance depends on the ground it has to pass. Use [attack] to detonate it early.</source>
+        <comment>Tips</comment>
+        <translation>Kagen kan gå kortere eller længere, afhængig af hvad den skal over på vejen. Du kan brrug [attack] til at detonere den før den når sin destination.</translation>
+    </message>
+    <message>
+        <source>The Flame Thrower is a weapon but it can be used for tunnel digging as well.</source>
+        <comment>Tips</comment>
+        <translation>Flammekasteren er et våben, men den kan også bruges til hurtigt at grave tunneler.</translation>
+    </message>
+    <message>
+        <source>Want to know who&apos;s behind the game? Click on the Hedgewars logo in the main menu to see the credits.</source>
+        <comment>Tips</comment>
+        <translation>Vil du vide hvem der står bag spillet? Klik på Hedgewars-logoet i hovedmenuen for at se rulleteksterne.</translation>
+    </message>
+    <message>
+        <source>Like Hedgewars? Become a fan on %1 or follow us on %2!</source>
+        <comment>Tips</comment>
+        <translation>Er du glad for Hedgewars? Bliv fan på %1 eller følge vores opdateringer på %2!</translation>
+    </message>
+    <message>
+        <source>Feel free to draw your own graves, hats, flags or even maps and themes! But note that you&apos;ll have to share them somewhere to use them online.</source>
+        <comment>Tips</comment>
+        <translation>Du skal være velkommen til at tegne dine egne gravsten, hatte, flag eller endda baner og temaer! Men læg mærke til at du bliver nød til at dele dem med andre hvis du vil spille med dem online.</translation>
+    </message>
+    <message>
+        <source>Really want to wear a specific hat? Donate to us and receive an exclusive hat of your choice!</source>
+        <comment>Tips</comment>
+        <translation>Vil du virkelig gerne have en specifik hat? Send os en donation, så kvitterer vi med en eksklusiv hat efter eget valg!</translation>
+    </message>
+    <message>
+        <source>Keep your video card drivers up to date to avoid issues playing the game.</source>
+        <comment>Tips</comment>
+        <translation>Hold dine grafikkortdrivere opdaterede for at undgå problemmer i spillet.</translation>
+    </message>
+    <message>
+        <source>You can find your Hedgewars configuration files under &quot;My Documents\Hedgewars&quot;. Create backups or take the files with you, but don&apos;t edit them by hand.</source>
+        <comment>Tips</comment>
+        <translation>Du kan finde konfigurationsfilerne til Hedgewars under mappen &quot;(Mine) Dokumenter\Hedgewars&quot;. Opret gerne en back-up eller tag filerne med dig, men lad være med selv at ændre i dem.</translation>
+    </message>
+    <message>
+        <source>You&apos;re able to associate Hedgewars related files (savegames and demo recordings) with the game to launch them right from your favorite file or internet browser.</source>
+        <comment>Tips</comment>
+        <translation>Du kan indstille Hedgewars-filer (gemte spil og demooptagelser) til automatisk at åbne når du trykker på dem eller åbner dem i din internet-browser.</translation>
+    </message>
+    <message>
+        <source>Want to save ropes? Release the rope in mid air and then shoot again. As long as you don&apos;t touch the ground you&apos;ll reuse your rope without wasting ammo!</source>
+        <comment>Tips</comment>
+        <translation>Vil du gerne spare på dine reb? Slip rebet midt i luften og skyd straks igen. Så længe du ikke rører jorden bruger du ikke noget ammunition!</translation>
+    </message>
+    <message>
+        <source>You can find your Hedgewars configuration files under &quot;Library/Application Support/Hedgewars&quot; in your home directory. Create backups or take the files with you, but don&apos;t edit them by hand.</source>
+        <comment>Tips</comment>
+        <translation>Du kan finde konfigurationsfilerne til Hedgewars under mappen &quot;Bibliotek/Application Support/Hedgewars&quot; i din hjemmemappe. Opret gerne en back-up eller tag filerne med dig, men lad være med selv at ændre i dem.</translation>
+    </message>
+    <message>
+        <source>You can find your Hedgewars configuration files under &quot;.hedgewars&quot; in your home directory. Create backups or take the files with you, but don&apos;t edit them by hand.</source>
+        <comment>Tips</comment>
+        <translation>Du kan finde konfigurationsfilerne til Hedgewars under mappen &quot;.hedgewars&quot; i din hjemmemappe. Opret gerne en back-up eller tag filerne med dig, men lad være med selv at ændre i dem.</translation>
+    </message>
+    <message>
+        <source>The Windows version of Hedgewars supports Xfire. Make sure to add Hedgewars to its game list so your friends can see you playing.</source>
+        <comment>Tips</comment>
+        <translation>Windows-versionen af Hedgewars understøtter integrering med Xfire. Husk at tilføje Hedgewars til din liste med spil så dine venner kan se hvornår du spiller.</translation>
+    </message>
+    <message>
+        <source>Use the Molotov or Flame Thrower to temporary keep hedgehogs from passing terrain such as tunnels or platforms.</source>
+        <comment>Tips</comment>
+        <translation>Brug en Molotovcocktail eller Flammekasteren til midlertidigt at forhindre pindsvin i at passere et område, f.eks. en tunnel eller platform.</translation>
+    </message>
+    <message>
+        <source>The Homing Bee can be tricky to use. Its turn radius depends on its velocity, so try to not use full power.</source>
+        <comment>Tips</comment>
+        <translation>Den Målsøgende Bi kan være svær at bruge. Den vender lettere hvis den ikke flyver alt for hurtigt, så prøv at spare på kraften når du affyrer den.</translation>
+    </message>
+    <message>
+        <source>Downloadable Content</source>
+        <translation>Indhold der kan Downloades</translation>
+    </message>
+</context>
+<context>
+    <name>PageMultiplayer</name>
+    <message>
+        <source>Start</source>
+        <translation>Start</translation>
+    </message>
+</context>
+<context>
+    <name>PageNet</name>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>Please select server from the list above</source>
+        <translation>Vælg venligst en server fra den ovenstående liste</translation>
+    </message>
+</context>
+<context>
+    <name>PageNetGame</name>
+    <message>
+        <source>Control</source>
+        <translation>Kontrol</translation>
+    </message>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>Please enter room name</source>
+        <translation>Indtast venligst navnet på rummet</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>OK</translation>
+    </message>
+</context>
+<context>
+    <name>PageNetType</name>
+    <message>
+        <source>LAN game</source>
+        <translation>Netværksspil</translation>
+    </message>
+    <message>
+        <source>Official server</source>
+        <translation>Officiel server</translation>
+    </message>
+</context>
+<context>
+    <name>PageOptions</name>
+    <message>
+        <source>New team</source>
+        <translation>Nyt hold</translation>
+    </message>
+    <message>
+        <source>Edit team</source>
+        <translation>Rediger hold</translation>
+    </message>
+    <message>
+        <source>Delete team</source>
+        <translation>Slet hold</translation>
+    </message>
+    <message>
+        <source>New weapon scheme</source>
+        <translation>Nyt våbensystem</translation>
+    </message>
+    <message>
+        <source>Edit weapon scheme</source>
+        <translation>Rediger våbensystem</translation>
+    </message>
+    <message>
+        <source>Delete weapon scheme</source>
+        <translation>Slet våbensystem</translation>
+    </message>
+    <message>
+        <source>You can&apos;t edit teams from team selection. Go back to main menu to add, edit or delete teams.</source>
+        <translation>Du kan ikke ændre på holdene fra holdvalgsskærmen. Gå tilbage til hovedmenuen for at tilføje, redigere og slette hold.</translation>
+    </message>
+    <message>
+        <source>New scheme</source>
+        <translation>Nyt spilsystem</translation>
+    </message>
+    <message>
+        <source>Edit scheme</source>
+        <translation>Rediger spilsystem</translation>
+    </message>
+    <message>
+        <source>Delete scheme</source>
+        <translation>Slet spilsystem</translation>
+    </message>
+    <message>
+        <source>New weapon set</source>
+        <translation>Nyt våbensæt</translation>
+    </message>
+    <message>
+        <source>Edit weapon set</source>
+        <translation>Rediger våbensæt</translation>
+    </message>
+    <message>
+        <source>Delete weapon set</source>
+        <translation>Slet våbensæt</translation>
+    </message>
+</context>
+<context>
+    <name>PagePlayDemo</name>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>OK</translation>
+    </message>
+    <message>
+        <source>Rename dialog</source>
+        <translation>Dialogboks til omdøbelse</translation>
+    </message>
+    <message>
+        <source>Enter new file name:</source>
+        <translation>Indtast nyt filnavn:</translation>
+    </message>
+    <message>
+        <source>Cannot rename to</source>
+        <translation>Kan ikke omdøbe til</translation>
+    </message>
+    <message>
+        <source>Cannot delete file</source>
+        <translation>Kan ikke slette fil</translation>
+    </message>
+    <message>
+        <source>Please select record from the list</source>
+        <translation>Vælg venligst en optagelse fra listen</translation>
+    </message>
+</context>
+<context>
+    <name>PageRoomsList</name>
+    <message>
+        <source>Create</source>
+        <translation>Opret</translation>
+    </message>
+    <message>
+        <source>Join</source>
+        <translation>Tilslut</translation>
+    </message>
+    <message>
+        <source>Refresh</source>
+        <translation>Opdater</translation>
+    </message>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>OK</translation>
+    </message>
+    <message>
+        <source>Admin features</source>
+        <translation>Administratorfunktioner</translation>
+    </message>
+    <message>
+        <source>Room Name:</source>
+        <translation>Navn på Rum:</translation>
+    </message>
+    <message>
+        <source>This game is in lobby.
+You may join and start playing once the game starts.</source>
+        <translation>Dette spil er i lobbyen.
+Du kan tilslutte dig og spille med når spillet starter.</translation>
+    </message>
+    <message>
+        <source>This game is in progress.
+You may join and spectate now but you&apos;ll have to wait for the game to end to start playing.</source>
+        <translation>Dette spil er i gang.
+Du kan tilslutte dig og kigge med med det samme, men du må vente på at spillet slutter med selv at kunne spille med.</translation>
+    </message>
+    <message>
+        <source>%1 is the host. He may adjust settings and start the game.</source>
+        <translation>%1 er værten. Han kan ændre indstillingerne og starte spillet.</translation>
+    </message>
+    <message>
+        <source>Random Map</source>
+        <translation>Tilfældig Bane</translation>
+    </message>
+    <message>
+        <source>Games may be played on precreated or randomized maps.</source>
+        <translation>Man kan spille enten på allerede lavede eller tilfældigt genererede baner.</translation>
+    </message>
+    <message>
+        <source>The Game Scheme defines general options and preferences like Round Time, Sudden Death or Vampirism.</source>
+        <translation>Spilsystemet definerer generelle indstillinger og præferencer, så som rundelængden, Pludselig Død og Vampyr.</translation>
+    </message>
+    <message>
+        <source>The Weapon Scheme defines available weapons and their ammunition count.</source>
+        <translation>Våbensystemet definere hvilke våben der er tilgængelige og hvor meget ammunition de har.</translation>
+    </message>
+    <message numerus="yes">
+        <source>There are %1 clients connected to this room.</source>
+        <translation>
+            <numerusform>Der er %1 klient forbundet til dette rum.</numerusform>
+            <numerusform>Der er %1 klienter forbundet til dette rum.</numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>There are %1 teams participating in this room.</source>
+        <translation>
+            <numerusform>Der deltager %1 hold i dette rum.</numerusform>
+            <numerusform>Der deltager %1 hold i dette rum.</numerusform>
+        </translation>
+    </message>
+    <message>
+        <source>Please enter room name</source>
+        <translation>Indtast venligst rummets navn</translation>
+    </message>
+    <message>
+        <source>Please select room from the list</source>
+        <translation>Vælg venligst et rum fra listen</translation>
+    </message>
+    <message>
+        <source>Random Maze</source>
+        <translation>Tilfældig Labyrint</translation>
+    </message>
+    <message>
+        <source>Rules:</source>
+        <translation>Regler:</translation>
+    </message>
+    <message>
+        <source>Weapons:</source>
+        <translation>VÃ¥ben:</translation>
+    </message>
+    <message>
+        <source>Search:</source>
+        <translation>Søg:</translation>
+    </message>
+    <message>
+        <source>Clear</source>
+        <translation>Ryd</translation>
+    </message>
+    <message>
+        <source>Warning</source>
+        <translation>Advarsel</translation>
+    </message>
+    <message>
+        <source>The game you are trying to join has started.
+Do you still want to join the room?</source>
+        <translation>Det spil du forsøge at tilslutte dig er allerede startet.
+Har du stadig lyst til at tilslutte dig rummet?</translation>
+    </message>
+    <message numerus="yes">
+        <source>%1 players online</source>
+        <translation>
+            <numerusform>%1 spiller er online</numerusform>
+            <numerusform>%1 spillere er online</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
+    <name>PageScheme</name>
+    <message>
+        <source>Defend your fort and destroy the opponents, two team colours max!</source>
+        <translation>Forsvar dit fort og udryd dine modstandere. Maksimalt to holdfarver!</translation>
+    </message>
+    <message>
+        <source>Teams will start on opposite sides of the terrain, two team colours max!</source>
+        <translation>Hold starter på hver sin side af banen. Maksimalt to holdfarver!</translation>
+    </message>
+    <message>
+        <source>Land can not be destroyed!</source>
+        <translation>Landmassen kan ikke ødelægges!</translation>
+    </message>
+    <message>
+        <source>Add an indestructable border around the terrain</source>
+        <translation>Tilføj en kant rundt om banen som ikke kan destrueres</translation>
+    </message>
+    <message>
+        <source>Lower gravity</source>
+        <translation>Svagere tyngdekraft</translation>
+    </message>
+    <message>
+        <source>Assisted aiming with laser sight</source>
+        <translation>Lasersigte til hjælp med at ramme</translation>
+    </message>
+    <message>
+        <source>All hogs have a personal forcefield</source>
+        <translation>Alle pindsvin har deres eget personlige kraftfelt</translation>
+    </message>
+    <message>
+        <source>Enable random mines</source>
+        <translation>Aktiver tilfældige miner</translation>
+    </message>
+    <message>
+        <source>Gain 80% of the damage you do back in health</source>
+        <translation>FÃ¥ 80% af den skade du giver tilbage som liv</translation>
+    </message>
+    <message>
+        <source>Share your opponents pain, share their damage</source>
+        <translation>Del dine modstanderes lidelser, del deres skader</translation>
+    </message>
+    <message>
+        <source>Your hogs are unable to move, put your artillery skills to the test</source>
+        <translation>Dine pindsvin kan ikke bevæge sig, så nu skal du vinde kun ved artilleriet</translation>
+    </message>
+    <message>
+        <source>Random</source>
+        <translation>Tilfældig</translation>
+    </message>
+    <message>
+        <source>Seconds</source>
+        <translation>Sekunder</translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation>Ny</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Slet</translation>
+    </message>
+    <message>
+        <source>Order of play is random instead of in room order.</source>
+        <translation>Turrækkefølgen er tilfældig i stedet for rækkefølgen i rummet.</translation>
+    </message>
+    <message>
+        <source>Play with a King. If he dies, your side dies.</source>
+        <translation>Spil med en Konge. Taber du ham, taber du.</translation>
+    </message>
+    <message>
+        <source>Take turns placing your hedgehogs before the start of play.</source>
+        <translation>Tag ture med at placere pindsvinene før spillet starter.</translation>
+    </message>
+    <message>
+        <source>Ammo is shared between all teams that share a colour.</source>
+        <translation>Ammunition deles melem alle hold der deler en farve.</translation>
+    </message>
+    <message>
+        <source>Disable girders when generating random maps.</source>
+        <translation>Deaktiver bærebjælker når der genereres tilfældige baner.</translation>
+    </message>
+    <message>
+        <source>Disable land objects when generating random maps.</source>
+        <translation>Deaktiver overfladeobjekter når der genereres tilfældige baner.</translation>
+    </message>
+    <message>
+        <source>AI respawns on death.</source>
+        <translation>AI-pindsvin genopliver straks efter de dør.</translation>
+    </message>
+    <message>
+        <source>All (living) hedgehogs are fully restored at the end of turn</source>
+        <translation>Alle (levende) pindsvin bliver helbredt helt i slutningen af turen</translation>
+    </message>
+    <message>
+        <source>Attacking does not end your turn.</source>
+        <translation>Angreb slutter ikke turen.</translation>
+    </message>
+    <message>
+        <source>Weapons are reset to starting values each turn.</source>
+        <translation>Våben bliver nulstillet til startværdier hver tur.</translation>
+    </message>
+    <message>
+        <source>Each hedgehog has its own ammo. It does not share with the team.</source>
+        <translation>Hvert pindsvin har sin egen ammunition. Den deler ikke med holdet.</translation>
+    </message>
+    <message>
+        <source>You will not have to worry about wind anymore.</source>
+        <translation>Du behøver ikke længere bekymre dig om vindstød.</translation>
+    </message>
+    <message>
+        <source>Wind will affect almost everything.</source>
+        <translation>Vinden tager fat i næsten alt.</translation>
+    </message>
+    <message>
+        <source>Copy</source>
+        <translation>Kopier</translation>
+    </message>
+    <message>
+        <source>Teams in each clan take successive turns sharing their turn time.</source>
+        <translation>Hold i hver klan deler én tidspulje, som de alle bruger af i løbet af deres tur.</translation>
+    </message>
+    <message>
+        <source>Add an indestructible border around the terrain</source>
+        <translation>Tilføj en kant rundt om banen som ikke kan destrueres</translation>
+    </message>
+    <message>
+        <source>Add an indestructible border along the bottom</source>
+        <translation>Tilføj en kant under banen som ikke kan destrueres</translation>
+    </message>
+</context>
+<context>
+    <name>PageSelectWeapon</name>
+    <message>
+        <source>Default</source>
+        <translation>Standard</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Slet</translation>
+    </message>
+    <message>
+        <source>New</source>
+        <translation>Ny</translation>
+    </message>
+    <message>
+        <source>Copy</source>
+        <translation>Kopier</translation>
+    </message>
+</context>
+<context>
+    <name>PageSinglePlayer</name>
+    <message>
+        <source>Simple Game (a quick game against the computer, settings are chosen for you)</source>
+        <translation>Simpelt spil (et hurtigt spil mod computeren, hvor indstillingerne er valgt på forhånd)</translation>
+    </message>
+    <message>
+        <source>Multiplayer (play a hotseat game against your friends, or AI teams)</source>
+        <translation>Multiplayer (spil mod flere venner eller AI hold ved samme computer)</translation>
+    </message>
+    <message>
+        <source>Training Mode (Practice your skills in a range of training missions)</source>
+        <translation>Træningsspil (Rafiner dine evner i en række forskellige træningsmissioner)</translation>
+    </message>
+    <message>
+        <source>Demos (Watch recorded demos)</source>
+        <translation>Demoer (Afspil optagede demoer)</translation>
+    </message>
+    <message>
+        <source>Load (Load a previously saved game)</source>
+        <translation>Indlæs (Indlæs et tidligere gemt spil)</translation>
+    </message>
+    <message>
+        <source>Campaign Mode (...)</source>
+        <translation>Kampagnespil (...)</translation>
+    </message>
+</context>
+<context>
+    <name>PageTraining</name>
+    <message>
+        <source>No description available</source>
+        <translation>Ingen beskrivelse tilgængelig</translation>
+    </message>
+    <message>
+        <source>Select a mission!</source>
+        <translation>Vælg en mission!</translation>
+    </message>
+</context>
+<context>
+    <name>QAction</name>
+    <message>
+        <source>Kick</source>
+        <translation>Smid ud</translation>
+    </message>
+    <message>
+        <source>Info</source>
+        <translation>Info</translation>
+    </message>
+    <message>
+        <source>Start</source>
+        <translation>Start</translation>
+    </message>
+    <message>
+        <source>Restrict Joins</source>
+        <translation>Begræns tilslutninger</translation>
+    </message>
+    <message>
+        <source>Restrict Team Additions</source>
+        <translation>Begræns holdtilslutninger</translation>
+    </message>
+    <message>
+        <source>Ban</source>
+        <translation>Bandlys</translation>
+    </message>
+    <message>
+        <source>Follow</source>
+        <translation>Følg</translation>
+    </message>
+    <message>
+        <source>Ignore</source>
+        <translation>Ignorer</translation>
+    </message>
+    <message>
+        <source>Add friend</source>
+        <translation>Tilføj ven</translation>
+    </message>
+    <message>
+        <source>Unignore</source>
+        <translation>Hold op med at ignorere</translation>
+    </message>
+    <message>
+        <source>Remove friend</source>
+        <translation>Fjern ven</translation>
+    </message>
+    <message>
+        <source>Update</source>
+        <translation>Opdater</translation>
+    </message>
+</context>
+<context>
+    <name>QCheckBox</name>
+    <message>
+        <source>Check for updates at startup</source>
+        <translation>Tjek efter opdatering når spillet startes</translation>
+    </message>
+    <message>
+        <source>Fullscreen</source>
+        <translation>Fuldskærm</translation>
+    </message>
+    <message>
+        <source>Frontend fullscreen</source>
+        <translation>Fullskærm (frontend)</translation>
+    </message>
+    <message>
+        <source>Enable sound</source>
+        <translation>Aktiver lyd</translation>
+    </message>
+    <message>
+        <source>Enable music</source>
+        <translation>Aktiver musik</translation>
+    </message>
+    <message>
+        <source>Show FPS</source>
+        <translation>Fremvis antal billeder vist per sekund</translation>
+    </message>
+    <message>
+        <source>Alternative damage show</source>
+        <translation>Vis skade efter hvert skud</translation>
+    </message>
+    <message>
+        <source>Append date and time to record file name</source>
+        <translation>Tilføj dato og tidspunkt til filnavnet for optagelser</translation>
+    </message>
+    <message>
+        <source>Reduced quality</source>
+        <translation>Reduceret kvalitet</translation>
+    </message>
+    <message>
+        <source>Show ammo menu tooltips</source>
+        <translation>Vis værktøjstip i ammunitionsmenuer</translation>
+    </message>
+    <message>
+        <source>Enable frontend sounds</source>
+        <translation>Aktiver lyd (frontend)</translation>
+    </message>
+    <message>
+        <source>Enable frontend music</source>
+        <translation>Aktiver musik (frontend)</translation>
+    </message>
+    <message>
+        <source>Frontend effects</source>
+        <translation>Effekter (frontend)</translation>
+    </message>
+</context>
+<context>
+    <name>QComboBox</name>
+    <message>
+        <source>generated map...</source>
+        <translation>genereret bane...</translation>
+    </message>
+    <message>
+        <source>Human</source>
+        <translation>Menneske</translation>
+    </message>
+    <message>
+        <source>Level</source>
+        <translation>Niveau</translation>
+    </message>
+    <message>
+        <source>(System default)</source>
+        <translation>(Systemstandard)</translation>
+    </message>
+    <message>
+        <source>Mission</source>
+        <translation>Mission</translation>
+    </message>
+    <message>
+        <source>generated maze...</source>
+        <translation>genereret labyrint...</translation>
+    </message>
+    <message>
+        <source>Community</source>
+        <translation>Fællesskab</translation>
+    </message>
+    <message>
+        <source>Any</source>
+        <translation>Ethvert</translation>
+    </message>
+    <message>
+        <source>In lobby</source>
+        <translation>I lobbyen</translation>
+    </message>
+    <message>
+        <source>In progress</source>
+        <translation>I gang</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <translation>Standard</translation>
+    </message>
+    <message>
+        <source>hand drawn map...</source>
+        <translation>håndtegnet bane...</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation>Deaktiveret</translation>
+    </message>
+    <message>
+        <source>Red/Cyan</source>
+        <translation>Rød/Cyan</translation>
+    </message>
+    <message>
+        <source>Cyan/Red</source>
+        <translation>Cyan/Rød</translation>
+    </message>
+    <message>
+        <source>Red/Blue</source>
+        <translation>Rød/Blå</translation>
+    </message>
+    <message>
+        <source>Blue/Red</source>
+        <translation>Blå/Rød</translation>
+    </message>
+    <message>
+        <source>Red/Green</source>
+        <translation>Rød/Grøn</translation>
+    </message>
+    <message>
+        <source>Green/Red</source>
+        <translation>Grøn/Rød</translation>
+    </message>
+    <message>
+        <source>Side-by-side</source>
+        <translation>Side-om-side</translation>
+    </message>
+    <message>
+        <source>Top-Bottom</source>
+        <translation>Top-Bund</translation>
+    </message>
+    <message>
+        <source>Wiggle</source>
+        <translation>Vrikke</translation>
+    </message>
+    <message>
+        <source>Red/Cyan grayscale</source>
+        <translation>Rød/Cyan gråskala</translation>
+    </message>
+    <message>
+        <source>Cyan/Red grayscale</source>
+        <translation>Cyan/Rød gråskala</translation>
+    </message>
+    <message>
+        <source>Red/Blue grayscale</source>
+        <translation>Rød/Blå gråskala</translation>
+    </message>
+    <message>
+        <source>Blue/Red grayscale</source>
+        <translation>Blå/Rød gråskala</translation>
+    </message>
+    <message>
+        <source>Red/Green grayscale</source>
+        <translation>Rød/Grøn gråskala</translation>
+    </message>
+    <message>
+        <source>Green/Red grayscale</source>
+        <translation>Grøn/Rød gråskala</translation>
+    </message>
+</context>
+<context>
+    <name>QGroupBox</name>
+    <message>
+        <source>Team Members</source>
+        <translation>Holdmedlemmer</translation>
+    </message>
+    <message>
+        <source>Fort</source>
+        <translation>Fort</translation>
+    </message>
+    <message>
+        <source>Key binds</source>
+        <translation>Tasteindstillinger</translation>
+    </message>
+    <message>
+        <source>Teams</source>
+        <translation>Hold</translation>
+    </message>
+    <message>
+        <source>Weapons</source>
+        <translation>VÃ¥ben</translation>
+    </message>
+    <message>
+        <source>Audio/Graphic options</source>
+        <translation>Lyd-/Grafikindstillinger</translation>
+    </message>
+    <message>
+        <source>Net game</source>
+        <translation>Netspil</translation>
+    </message>
+    <message>
+        <source>Playing teams</source>
+        <translation>Hold i spil</translation>
+    </message>
+    <message>
+        <source>Game Modifiers</source>
+        <translation>Spilmodifikatorer</translation>
+    </message>
+    <message>
+        <source>Basic Settings</source>
+        <translation>Grundlæggende indstillinger</translation>
+    </message>
+    <message>
+        <source>Team Settings</source>
+        <translation>Holdindstillinger</translation>
+    </message>
+    <message>
+        <source>Misc</source>
+        <translation>Diverse</translation>
+    </message>
+    <message>
+        <source>Schemes and Weapons</source>
+        <translation>Spilsystemer og VÃ¥ben</translation>
+    </message>
+</context>
+<context>
+    <name>QLabel</name>
+    <message>
+        <source>Mines Time</source>
+        <translation>Mine-tid</translation>
+    </message>
+    <message>
+        <source>Mines</source>
+        <translation>Miner</translation>
+    </message>
+    <message>
+        <source>Version</source>
+        <translation>Version</translation>
+    </message>
+    <message>
+        <source>This program is distributed under the GNU General Public License</source>
+        <translation>Dette program distribueres under GNU General Public License</translation>
+    </message>
+    <message>
+        <source>Developers:</source>
+        <translation>Udviklere:</translation>
+    </message>
+    <message>
+        <source>Art:</source>
+        <translation>Grafik:</translation>
+    </message>
+    <message>
+        <source>Sounds:</source>
+        <translation>Lyde:</translation>
+    </message>
+    <message>
+        <source>Translations:</source>
+        <translation>Oversættelser:</translation>
+    </message>
+    <message>
+        <source>Special thanks:</source>
+        <translation>Særlig tak til:</translation>
+    </message>
+    <message>
+        <source>Weapons</source>
+        <translation>VÃ¥ben</translation>
+    </message>
+    <message>
+        <source>Host:</source>
+        <translation>Vært:</translation>
+    </message>
+    <message>
+        <source>Port:</source>
+        <translation>Port:</translation>
+    </message>
+    <message>
+        <source>Net nick</source>
+        <translation>Brugernavn</translation>
+    </message>
+    <message>
+        <source>Resolution</source>
+        <translation>Opløsning</translation>
+    </message>
+    <message>
+        <source>FPS limit</source>
+        <translation>Grænse over antal billeder vist i sekundet</translation>
+    </message>
+    <message>
+        <source>Server name:</source>
+        <translation>Servernavn:</translation>
+    </message>
+    <message>
+        <source>Server port:</source>
+        <translation>Serverport:</translation>
+    </message>
+    <message>
+        <source>Initial sound volume</source>
+        <translation>Lydstyrke til start</translation>
+    </message>
+    <message>
+        <source>Damage Modifier</source>
+        <translation>Skademodifikator</translation>
+    </message>
+    <message>
+        <source>Turn Time</source>
+        <translation>Tur-tid</translation>
+    </message>
+    <message>
+        <source>Initial Health</source>
+        <translation>Liv til start</translation>
+    </message>
+    <message>
+        <source>Sudden Death Timeout</source>
+        <translation>Pludselig Død Timeout</translation>
+    </message>
+    <message>
+        <source>Scheme Name:</source>
+        <translation>Spilsystems Navn:</translation>
+    </message>
+    <message>
+        <source>Crate Drops</source>
+        <translation>Antal Kasser</translation>
+    </message>
+    <message>
+        <source>Game scheme</source>
+        <translation>Spilsystem</translation>
+    </message>
+    <message>
+        <source>% Dud Mines</source>
+        <translation>% Miner er Fusere</translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation>Navn</translation>
+    </message>
+    <message>
+        <source>Type</source>
+        <translation>Type</translation>
+    </message>
+    <message>
+        <source>Grave</source>
+        <translation>Gravsten</translation>
+    </message>
+    <message>
+        <source>Flag</source>
+        <translation>Flag</translation>
+    </message>
+    <message>
+        <source>Voice</source>
+        <translation>Stemme</translation>
+    </message>
+    <message>
+        <source>Locale</source>
+        <translation>Lokalitet</translation>
+    </message>
+    <message>
+        <source>Restart game to apply</source>
+        <translation>Genstart spil for at anvende</translation>
+    </message>
+    <message>
+        <source>Explosives</source>
+        <translation>Eksplosiver</translation>
+    </message>
+    <message>
+        <source>Tip: </source>
+        <translation>Tip:</translation>
+    </message>
+    <message>
+        <source>This development build is &apos;work in progress&apos; and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!</source>
+        <translation>Denne udviklerversion er under konstruktion og er ikke nødvendigvis kompatibel med andre versioner af spillet. Nogle funktioner er måske i stykker eller ukomplette. Brug er på eget ansvar!</translation>
+    </message>
+    <message>
+        <source>Quality</source>
+        <translation>Kvalitet</translation>
+    </message>
+    <message>
+        <source>% Health Crates</source>
+        <translation>% Kasser der Helbreder</translation>
+    </message>
+    <message>
+        <source>Health in Crates</source>
+        <translation>Liv i hver kasse der helbreder</translation>
+    </message>
+    <message>
+        <source>Sudden Death Water Rise</source>
+        <translation>Pludselig Død Vandstigning</translation>
+    </message>
+    <message>
+        <source>Sudden Death Health Decrease</source>
+        <translation>Pludselig Død Skade</translation>
+    </message>
+    <message>
+        <source>% Rope Length</source>
+        <translation>% reblængde</translation>
+    </message>
+    <message>
+        <source>Stereo rendering</source>
+        <translation>3D-rendering</translation>
+    </message>
+    <message>
+        <source>Style</source>
+        <translation>Stil</translation>
+    </message>
+    <message>
+        <source>Scheme</source>
+        <translation>Spilsystem</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <translation>Kodeord</translation>
+    </message>
+    <message>
+        <source>% Get Away Time</source>
+        <translation>% Tid til at Løbe Væk</translation>
+    </message>
+    <message>
+        <source>This program is distributed under the GNU General Public License v2</source>
+        <translation>Dette program distribueres under GNU General Public License v2</translation>
+    </message>
+</context>
+<context>
+    <name>QLineEdit</name>
+    <message>
+        <source>unnamed</source>
+        <translation>unavngivet</translation>
+    </message>
+    <message>
+        <source>hedgehog %1</source>
+        <translation>pindsvin %1</translation>
+    </message>
+</context>
+<context>
+    <name>QMainWindow</name>
+    <message>
+        <source>Hedgewars %1</source>
+        <translation>Hedgewars %1</translation>
+    </message>
+</context>
+<context>
+    <name>QMessageBox</name>
+    <message>
+        <source>Network</source>
+        <translation>Netværk</translation>
+    </message>
+    <message>
+        <source>Connection to server is lost</source>
+        <translation>Forbindelse til serveren er gået tabt</translation>
+    </message>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>Failed to open data directory:
+%1
+Please check your installation</source>
+        <translation>Det mislykkedes at åbne data mappen:
+%1
+Tjek venligst om spillet er installeret korrekt</translation>
+    </message>
+    <message>
+        <source>Weapons</source>
+        <translation>VÃ¥ben</translation>
+    </message>
+    <message>
+        <source>Can not edit default weapon set</source>
+        <translation>Kan ikke ændre standardvåbensæt</translation>
+    </message>
+    <message>
+        <source>Can not delete default weapon set</source>
+        <translation>Kan ikke slette standardvåbensæt</translation>
+    </message>
+    <message>
+        <source>Really delete this weapon set?</source>
+        <translation>Vil du virkelig slette dette våbensæt?</translation>
+    </message>
+    <message>
+        <source>Can not overwrite default weapon set &apos;%1&apos;!</source>
+        <translation>Kan ikke overskrive standardvåbensættet &apos;%1&apos;!</translation>
+    </message>
+    <message>
+        <source>All file associations have been set.</source>
+        <translation>Alle filtilknytninger er blevet indstillede.</translation>
+    </message>
+    <message>
+        <source>File association failed.</source>
+        <translation>Filtilknytninger mislykkedes.</translation>
+    </message>
+    <message>
+        <source>Teams</source>
+        <translation>Hold</translation>
+    </message>
+    <message>
+        <source>Really delete this team?</source>
+        <translation>Vil du virkelig slette dette hold?</translation>
+    </message>
+    <message>
+        <source>Schemes</source>
+        <translation>Spilsystemer</translation>
+    </message>
+    <message>
+        <source>Can not delete default scheme &apos;%1&apos;!</source>
+        <translation>Kan ikke slette standardspilsystemet &apos;%1&apos;!</translation>
+    </message>
+    <message>
+        <source>Really delete this game scheme?</source>
+        <translation>Vil du virkelig slette dette spilsystem?</translation>
+    </message>
+    <message>
+        <source>Can not delete default weapon set &apos;%1&apos;!</source>
+        <translation>Kan ikke slette standardvåbensættet &apos;%1&apos;!</translation>
+    </message>
+</context>
+<context>
+    <name>QObject</name>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>Cannot create directory %1</source>
+        <translation>Kan ikke oprette mappe %1</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>OK</translation>
+    </message>
+    <message>
+        <source>Nickname</source>
+        <translation>Brugernavn</translation>
+    </message>
+    <message>
+        <source>Please enter your nickname</source>
+        <translation>Indtast venligst dit brugernavn</translation>
+    </message>
+</context>
+<context>
+    <name>QPushButton</name>
+    <message>
+        <source>default</source>
+        <translation>standard</translation>
+    </message>
+    <message>
+        <source>OK</source>
+        <translation>OK</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation>Annuler</translation>
+    </message>
+    <message>
+        <source>Start server</source>
+        <translation>Start server</translation>
+    </message>
+    <message>
+        <source>Connect</source>
+        <translation>Opretter forbindelse</translation>
+    </message>
+    <message>
+        <source>Update</source>
+        <translation>Opdater</translation>
+    </message>
+    <message>
+        <source>Specify</source>
+        <translation>Specificer</translation>
+    </message>
+    <message>
+        <source>Start</source>
+        <translation>Start</translation>
+    </message>
+    <message>
+        <source>Go!</source>
+        <translation>I gang!</translation>
+    </message>
+    <message>
+        <source>Play demo</source>
+        <translation>Afspil demo</translation>
+    </message>
+    <message>
+        <source>Rename</source>
+        <translation>Omdøb</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Slet</translation>
+    </message>
+    <message>
+        <source>Load</source>
+        <translation>Indlæs</translation>
+    </message>
+    <message>
+        <source>Setup</source>
+        <translation>Indstillinger</translation>
+    </message>
+    <message>
+        <source>Ready</source>
+        <translation>Klar</translation>
+    </message>
+    <message>
+        <source>Random Team</source>
+        <translation>Tilfældige Hold</translation>
+    </message>
+    <message>
+        <source>Associate file extensions</source>
+        <translation>Tilknyt filtyper</translation>
+    </message>
+    <message>
+        <source>more</source>
+        <translation>mere</translation>
+    </message>
+</context>
+<context>
+    <name>QTableWidget</name>
+    <message>
+        <source>Room Name</source>
+        <translation>Navn på Rum</translation>
+    </message>
+    <message>
+        <source>C</source>
+        <translation>C</translation>
+    </message>
+    <message>
+        <source>T</source>
+        <translation>T</translation>
+    </message>
+    <message>
+        <source>Owner</source>
+        <translation>Ejer</translation>
+    </message>
+    <message>
+        <source>Map</source>
+        <translation>Bane</translation>
+    </message>
+    <message>
+        <source>Rules</source>
+        <translation>Regler</translation>
+    </message>
+    <message>
+        <source>Weapons</source>
+        <translation>VÃ¥ben</translation>
+    </message>
+</context>
+<context>
+    <name>SelWeaponWidget</name>
+    <message>
+        <source>Weapon set</source>
+        <translation>Våbensæt</translation>
+    </message>
+    <message>
+        <source>Probabilities</source>
+        <translation>Sandsynligheder</translation>
+    </message>
+    <message>
+        <source>Ammo in boxes</source>
+        <translation>Ammunition i bokse</translation>
+    </message>
+    <message>
+        <source>Delays</source>
+        <translation>Forsinkelser</translation>
+    </message>
+    <message>
+        <source>new</source>
+        <translation>ny</translation>
+    </message>
+    <message>
+        <source>copy of</source>
+        <translation>kopi af</translation>
+    </message>
+</context>
+<context>
+    <name>TCPBase</name>
+    <message>
+        <source>Error</source>
+        <translation>Fejl</translation>
+    </message>
+    <message>
+        <source>Unable to start the server: %1.</source>
+        <translation>Ude af stand til at starte serveren: %1.</translation>
+    </message>
+    <message>
+        <source>Unable to run engine: %1 (</source>
+        <translation>Ude af stand til at starte spilmotoren: %1 (</translation>
+    </message>
+</context>
+<context>
+    <name>ToggleButtonWidget</name>
+    <message>
+        <source>Vampirism</source>
+        <translation>Vampyr</translation>
+    </message>
+    <message>
+        <source>Karma</source>
+        <translation>Karma</translation>
+    </message>
+    <message>
+        <source>Artillery</source>
+        <translation>Artilleri</translation>
+    </message>
+    <message>
+        <source>Fort Mode</source>
+        <translation>Brug Forter</translation>
+    </message>
+    <message>
+        <source>Divide Teams</source>
+        <translation>Opdel Hold</translation>
+    </message>
+    <message>
+        <source>Solid Land</source>
+        <translation>Fastland</translation>
+    </message>
+    <message>
+        <source>Add Border</source>
+        <translation>Tilføj Kant</translation>
+    </message>
+    <message>
+        <source>Low Gravity</source>
+        <translation>Svag Tyngdekraft</translation>
+    </message>
+    <message>
+        <source>Laser Sight</source>
+        <translation>Lasersigte</translation>
+    </message>
+    <message>
+        <source>Invulnerable</source>
+        <translation>Udødelighed</translation>
+    </message>
+    <message>
+        <source>Add Mines</source>
+        <translation>Tilføj Miner</translation>
+    </message>
+    <message>
+        <source>Random Order</source>
+        <translation>Tilfældig Rækkefølge</translation>
+    </message>
+    <message>
+        <source>King</source>
+        <translation>Konge</translation>
+    </message>
+    <message>
+        <source>Place Hedgehogs</source>
+        <translation>Placer Pindsvin</translation>
+    </message>
+    <message>
+        <source>Clan Shares Ammo</source>
+        <translation>Klan Deler Ammunition</translation>
+    </message>
+    <message>
+        <source>Disable Girders</source>
+        <translation>Deaktiver Bærebjælker</translation>
+    </message>
+    <message>
+        <source>Disable Land Objects</source>
+        <translation>Deaktiver Overfladeobjekter</translation>
+    </message>
+    <message>
+        <source>AI Survival Mode</source>
+        <translation>AI Overlevelse</translation>
+    </message>
+    <message>
+        <source>Reset Health</source>
+        <translation>Nulstil Liv</translation>
+    </message>
+    <message>
+        <source>Unlimited Attacks</source>
+        <translation>Uendelige Angreb</translation>
+    </message>
+    <message>
+        <source>Reset Weapons</source>
+        <translation>Nulstil VÃ¥ben</translation>
+    </message>
+    <message>
+        <source>Per Hedgehog Ammo</source>
+        <translation>Indivuel Ammunition per Pindsvin</translation>
+    </message>
+    <message>
+        <source>Disable Wind</source>
+        <translation>Deaktiver Vind</translation>
+    </message>
+    <message>
+        <source>More Wind</source>
+        <translation>Mere Vind</translation>
+    </message>
+    <message>
+        <source>Tag Team</source>
+        <translation>Tagteam</translation>
+    </message>
+    <message>
+        <source>Add Bottom Border</source>
+        <translation>Tilføj Kant i Bunden</translation>
+    </message>
+</context>
+<context>
+    <name>binds</name>
+    <message>
+        <source>up</source>
+        <translation>op</translation>
+    </message>
+    <message>
+        <source>left</source>
+        <translation>venstre</translation>
+    </message>
+    <message>
+        <source>right</source>
+        <translation>højre</translation>
+    </message>
+    <message>
+        <source>down</source>
+        <translation>ned</translation>
+    </message>
+    <message>
+        <source>attack</source>
+        <translation>angrib</translation>
+    </message>
+    <message>
+        <source>precise aim</source>
+        <translation>sigt præcist</translation>
+    </message>
+    <message>
+        <source>put</source>
+        <translation>læg</translation>
+    </message>
+    <message>
+        <source>switch</source>
+        <translation>skift</translation>
+    </message>
+    <message>
+        <source>find hedgehog</source>
+        <translation>find pindsvin</translation>
+    </message>
+    <message>
+        <source>ammo menu</source>
+        <translation>ammunitionsmenu</translation>
+    </message>
+    <message>
+        <source>slot 1</source>
+        <translation>Ã¥bning 1</translation>
+    </message>
+    <message>
+        <source>slot 2</source>
+        <translation>Ã¥bning 2</translation>
+    </message>
+    <message>
+        <source>slot 3</source>
+        <translation>Ã¥bning 3</translation>
+    </message>
+    <message>
+        <source>slot 4</source>
+        <translation>Ã¥bning 4</translation>
+    </message>
+    <message>
+        <source>slot 5</source>
+        <translation>Ã¥bning 5</translation>
+    </message>
+    <message>
+        <source>slot 6</source>
+        <translation>Ã¥bning 6</translation>
+    </message>
+    <message>
+        <source>slot 7</source>
+        <translation>Ã¥bning 7</translation>
+    </message>
+    <message>
+        <source>slot 8</source>
+        <translation>Ã¥bning 8</translation>
+    </message>
+    <message>
+        <source>slot 9</source>
+        <translation>Ã¥bning 9</translation>
+    </message>
+    <message>
+        <source>timer 1 sec</source>
+        <translation>timer 1 sekund</translation>
+    </message>
+    <message>
+        <source>timer 2 sec</source>
+        <translation>timer 2 sekunder</translation>
+    </message>
+    <message>
+        <source>timer 3 sec</source>
+        <translation>timer 3 sekunder</translation>
+    </message>
+    <message>
+        <source>timer 4 sec</source>
+        <translation>timer 4 sekunder</translation>
+    </message>
+    <message>
+        <source>timer 5 sec</source>
+        <translation>timer 5 sekunder</translation>
+    </message>
+    <message>
+        <source>chat</source>
+        <translation>chat</translation>
+    </message>
+    <message>
+        <source>chat history</source>
+        <translation>chathistorie</translation>
+    </message>
+    <message>
+        <source>pause</source>
+        <translation>pause</translation>
+    </message>
+    <message>
+        <source>confirmation</source>
+        <translation>bekræftelse</translation>
+    </message>
+    <message>
+        <source>volume down</source>
+        <translation>lydstyrke ned</translation>
+    </message>
+    <message>
+        <source>volume up</source>
+        <translation>lydstyrke op</translation>
+    </message>
+    <message>
+        <source>change mode</source>
+        <translation>ændre tilstand</translation>
+    </message>
+    <message>
+        <source>capture</source>
+        <translation>fang</translation>
+    </message>
+    <message>
+        <source>hedgehogs
+info</source>
+        <translation>pindsvin
+info</translation>
+    </message>
+    <message>
+        <source>quit</source>
+        <translation>afslut</translation>
+    </message>
+    <message>
+        <source>zoom in</source>
+        <translation>zoom ind</translation>
+    </message>
+    <message>
+        <source>zoom out</source>
+        <translation>zoom ud</translation>
+    </message>
+    <message>
+        <source>reset zoom</source>
+        <translation>nulstil zoom</translation>
+    </message>
+    <message>
+        <source>long jump</source>
+        <translation>langt hop</translation>
+    </message>
+    <message>
+        <source>high jump</source>
+        <translation>højt hop</translation>
+    </message>
+    <message>
+        <source>slot 10</source>
+        <translation>Ã¥bning 10</translation>
+    </message>
+</context>
+<context>
+    <name>binds (categories)</name>
+    <message>
+        <source>Basic controls</source>
+        <translation>Grundlæggende styring</translation>
+    </message>
+    <message>
+        <source>Weapon controls</source>
+        <translation>VÃ¥benstyring</translation>
+    </message>
+    <message>
+        <source>Camera and cursor controls</source>
+        <translation>Kamera og musestyring</translation>
+    </message>
+    <message>
+        <source>Other</source>
+        <translation>Andet</translation>
+    </message>
+</context>
+<context>
+    <name>binds (descriptions)</name>
+    <message>
+        <source>Move your hogs and aim:</source>
+        <translation>Bevæg dine pindsvin og sigt:</translation>
+    </message>
+    <message>
+        <source>Traverse gaps and obstacles by jumping:</source>
+        <translation>Hop over sprækker og forhinderinger:</translation>
+    </message>
+    <message>
+        <source>Fire your selected weapon or trigger an utility item:</source>
+        <translation>Affyr dit valgte våben eller udløs en hjælpeting:</translation>
+    </message>
+    <message>
+        <source>Pick a weapon or a target location under the cursor:</source>
+        <translation>Vælg et våben eller en målplacering under musemarkøren:</translation>
+    </message>
+    <message>
+        <source>Switch your currently active hog (if possible):</source>
+        <translation>Skift til et anden pindsvin (om muligt):</translation>
+    </message>
+    <message>
+        <source>Pick a weapon or utility item:</source>
+        <translation>Vælg et våben eller en hjælpeting:</translation>
+    </message>
+    <message>
+        <source>Set the timer on bombs and timed weapons:</source>
+        <translation>Indstil timeren på bomber eller tidsafhængige våben:</translation>
+    </message>
+    <message>
+        <source>Move the camera to the active hog:</source>
+        <translation>Flyt kameraet hen til det aktive pindsvin:</translation>
+    </message>
+    <message>
+        <source>Move the cursor or camera without using the mouse:</source>
+        <translation>Flyt musemarkøren eller kameraet uden at bruge musen:</translation>
+    </message>
+    <message>
+        <source>Modify the camera&apos;s zoom level:</source>
+        <translation>Ændr på kameraets zoom-niveau:</translation>
+    </message>
+    <message>
+        <source>Talk to your team or all participants:</source>
+        <translation>Tal til dit hold eller alle deltagere:</translation>
+    </message>
+    <message>
+        <source>Pause, continue or leave your game:</source>
+        <translation>Pause, fortsæt eller forlad spillet:</translation>
+    </message>
+    <message>
+        <source>Modify the game&apos;s volume while playing:</source>
+        <translation>Ændr på lydstyrken mens du spiller:</translation>
+    </message>
+    <message>
+        <source>Toggle fullscreen mode:</source>
+        <translation>Skift fra og til fuldskærm:</translation>
+    </message>
+    <message>
+        <source>Take a screenshot:</source>
+        <translation>Tag et skærmbillede:</translation>
+    </message>
+    <message>
+        <source>Toggle labels above hedgehogs:</source>
+        <translation>Slå mærkater over pindsvin fra og til:</translation>
+    </message>
+</context>
+<context>
+    <name>binds (keys)</name>
+    <message>
+        <source>Axis</source>
+        <translation>Akse</translation>
+    </message>
+    <message>
+        <source>(Up)</source>
+        <translation>(Op)</translation>
+    </message>
+    <message>
+        <source>(Down)</source>
+        <translation>(Ned)</translation>
+    </message>
+    <message>
+        <source>Hat</source>
+        <translation>Hat</translation>
+    </message>
+    <message>
+        <source>(Left)</source>
+        <translation>(Venstre)</translation>
+    </message>
+    <message>
+        <source>(Right)</source>
+        <translation>(Højre)</translation>
+    </message>
+    <message>
+        <source>Button</source>
+        <translation>Knap</translation>
+    </message>
+    <message>
+        <source>Keyboard</source>
+        <translation>Tastatur</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation>Slet</translation>
+    </message>
+    <message>
+        <source>Mouse: Left button</source>
+        <translation>Mus: Venstre knap</translation>
+    </message>
+    <message>
+        <source>Mouse: Middle button</source>
+        <translation>Mus: Midterknap</translation>
+    </message>
+    <message>
+        <source>Mouse: Right button</source>
+        <translation>Mus: Højre knap</translation>
+    </message>
+    <message>
+        <source>Mouse: Wheel up</source>
+        <translation>Mus: Hjul opad</translation>
+    </message>
+    <message>
+        <source>Mouse: Wheel down</source>
+        <translation>Mus: Hjul nedad</translation>
+    </message>
+    <message>
+        <source>Backspace</source>
+        <translation>Tilbageknap</translation>
+    </message>
+    <message>
+        <source>Tab</source>
+        <translation>Tab-knap</translation>
+    </message>
+    <message>
+        <source>Clear</source>
+        <translation>Ryd</translation>
+    </message>
+    <message>
+        <source>Return</source>
+        <translation>Enter</translation>
+    </message>
+    <message>
+        <source>Pause</source>
+        <translation>Pause</translation>
+    </message>
+    <message>
+        <source>Escape</source>
+        <translation>Escape</translation>
+    </message>
+    <message>
+        <source>Space</source>
+        <translation>Mellemrumstast</translation>
+    </message>
+    <message>
+        <source>Numpad 0</source>
+        <translation>Numpad 0</translation>
+    </message>
+    <message>
+        <source>Numpad 1</source>
+        <translation>Numpad 1</translation>
+    </message>
+    <message>
+        <source>Numpad 2</source>
+        <translation>Numpad 2</translation>
+    </message>
+    <message>
+        <source>Numpad 3</source>
+        <translation>Numpad 3</translation>
+    </message>
+    <message>
+        <source>Numpad 4</source>
+        <translation>Numpad 4</translation>
+    </message>
+    <message>
+        <source>Numpad 5</source>
+        <translation>Numpad 5</translation>
+    </message>
+    <message>
+        <source>Numpad 6</source>
+        <translation>Numpad 6</translation>
+    </message>
+    <message>
+        <source>Numpad 7</source>
+        <translation>Numpad 7</translation>
+    </message>
+    <message>
+        <source>Numpad 8</source>
+        <translation>Numpad 8</translation>
+    </message>
+    <message>
+        <source>Numpad 9</source>
+        <translation>Numpad 9</translation>
+    </message>
+    <message>
+        <source>Numpad .</source>
+        <translation>Numpad .</translation>
+    </message>
+    <message>
+        <source>Numpad /</source>
+        <translation>Numpad /</translation>
+    </message>
+    <message>
+        <source>Numpad *</source>
+        <translation>Numpad *</translation>
+    </message>
+    <message>
+        <source>Numpad -</source>
+        <translation>Numpad -</translation>
+    </message>
+    <message>
+        <source>Numpad +</source>
+        <translation>Numpad +</translation>
+    </message>
+    <message>
+        <source>Enter</source>
+        <translation>Enter</translation>
+    </message>
+    <message>
+        <source>Equals</source>
+        <translation>Lig</translation>
+    </message>
+    <message>
+        <source>Up</source>
+        <translation>Op</translation>
+    </message>
+    <message>
+        <source>Down</source>
+        <translation>Ned</translation>
+    </message>
+    <message>
+        <source>Right</source>
+        <translation>Højre</translation>
+    </message>
+    <message>
+        <source>Left</source>
+        <translation>Venstre</translation>
+    </message>
+    <message>
+        <source>Insert</source>
+        <translation>Insert</translation>
+    </message>
+    <message>
+        <source>Home</source>
+        <translation>Home</translation>
+    </message>
+    <message>
+        <source>End</source>
+        <translation>End</translation>
+    </message>
+    <message>
+        <source>Page up</source>
+        <translation>Page up</translation>
+    </message>
+    <message>
+        <source>Page down</source>
+        <translation>Page down</translation>
+    </message>
+    <message>
+        <source>Num lock</source>
+        <translation>Num lock</translation>
+    </message>
+    <message>
+        <source>Caps lock</source>
+        <translation>Caps lock</translation>
+    </message>
+    <message>
+        <source>Scroll lock</source>
+        <translation>Scroll lock</translation>
+    </message>
+    <message>
+        <source>Right shift</source>
+        <translation>Højre shift</translation>
+    </message>
+    <message>
+        <source>Left shift</source>
+        <translation>Venstre shift</translation>
+    </message>
+    <message>
+        <source>Right ctrl</source>
+        <translation>Højre ctrl</translation>
+    </message>
+    <message>
+        <source>Left ctrl</source>
+        <translation>Venstre ctrl</translation>
+    </message>
+    <message>
+        <source>Right alt</source>
+        <translation>Højre alt</translation>
+    </message>
+    <message>
+        <source>Left alt</source>
+        <translation>Venstre alt</translation>
+    </message>
+    <message>
+        <source>Right meta</source>
+        <translation>Højre meta</translation>
+    </message>
+    <message>
+        <source>Left meta</source>
+        <translation>Venstre meta</translation>
+    </message>
+    <message>
+        <source>A button</source>
+        <translation>A-knap</translation>
+    </message>
+    <message>
+        <source>B button</source>
+        <translation>B-knap</translation>
+    </message>
+    <message>
+        <source>X button</source>
+        <translation>X-knap</translation>
+    </message>
+    <message>
+        <source>Y button</source>
+        <translation>Y-knap</translation>
+    </message>
+    <message>
+        <source>LB button</source>
+        <translation>LB-knap</translation>
+    </message>
+    <message>
+        <source>RB button</source>
+        <translation>RB-knap</translation>
+    </message>
+    <message>
+        <source>Back button</source>
+        <translation>Back-knap</translation>
+    </message>
+    <message>
+        <source>Start button</source>
+        <translation>Start-knap</translation>
+    </message>
+    <message>
+        <source>Left stick</source>
+        <translation>Venstre stick</translation>
+    </message>
+    <message>
+        <source>Right stick</source>
+        <translation>Højre stick</translation>
+    </message>
+    <message>
+        <source>Left stick (Right)</source>
+        <translation>Venstre stick (Højre)</translation>
+    </message>
+    <message>
+        <source>Left stick (Left)</source>
+        <translation>Venstre stick (Venstre)</translation>
+    </message>
+    <message>
+        <source>Left stick (Down)</source>
+        <translation>Venstre stick (Ned)</translation>
+    </message>
+    <message>
+        <source>Left stick (Up)</source>
+        <translation>Venstre stick (Op)</translation>
+    </message>
+    <message>
+        <source>Left trigger</source>
+        <translation>Venstre affyringsknap</translation>
+    </message>
+    <message>
+        <source>Right trigger</source>
+        <translation>Højre affyringsknap</translation>
+    </message>
+    <message>
+        <source>Right stick (Down)</source>
+        <translation>Højre stick (Ned)</translation>
+    </message>
+    <message>
+        <source>Right stick (Up)</source>
+        <translation>Højre stick (Op)</translation>
+    </message>
+    <message>
+        <source>Right stick (Right)</source>
+        <translation>Højre stick (Højre)</translation>
+    </message>
+    <message>
+        <source>Right stick (Left)</source>
+        <translation>Højre stick (Venstre)</translation>
+    </message>
+    <message>
+        <source>DPad</source>
+        <translation>DPad</translation>
+    </message>
+</context>
+</TS>
--- a/share/hedgewars/Data/Locale/it.txt	Sat Nov 19 23:34:09 2011 +0100
+++ b/share/hedgewars/Data/Locale/it.txt	Mon Dec 05 18:38:07 2011 -0500
@@ -324,7 +324,7 @@
 02:08=%1 adotta una nuova strategia
 02:08=%1 preferisce rimanere neutrale
 02:08=%1 ha alzato la bandiera bianca
-02:08=%Che vergogna!
+02:08=Che vergogna %1!
 02:08=Se ci fosse stato Chuck Norris dietro di te, ti avrebbe preso a calci volanti
 02:08=%1 pensava troppo alle donnine nude
 
--- a/share/hedgewars/Data/Scripts/Tracker.lua	Sat Nov 19 23:34:09 2011 +0100
+++ b/share/hedgewars/Data/Scripts/Tracker.lua	Mon Dec 05 18:38:07 2011 -0500
@@ -32,19 +32,17 @@
         end
     end
     if trackingTeams and GetGearType(gear) == gtHedgehog then
-        for team, hogs in pairs(teams) do
-            if team == GetHogTeamName(gear) then
-                if table.maxn(hogs) == 1 then
-                    hogs = nil
-                else
-                    for k, hog in ipairs(hogs) do
-                        if hog == gear then
-                            table.remove(hogs, k)
-                            break
-                        end
+    	hogs = teams[GetHogTeamName(gear)]
+        if hogs ~= nil then
+            if table.maxn(hogs) == 1 then
+                hogs = nil
+            else
+				for k, hog in ipairs(hogs) do
+                    if hog == gear then
+                        table.remove(hogs, k)
+                        break
                     end
                 end
-                break
             end
         end
     elseif resurrecting and GetGearType(gear) == gtResurrector then
@@ -60,25 +58,6 @@
     end
 end
 
--- Not needed?
--- Registers when a gear is resurrected
---function trackResurrection(gear)
---    if trackingTeams then
---        if GetGearType(gear) == gtHedgehog then
---            found = false
---            for team, hogs in pairs(teams) do
---                if team == GetHogTeamName(gear) then
---                    table.insert(hogs, gear)
---                    found = true
---                end
---            end
---            if not found then
---                teams[GetHogTeamName(gear)] = { gear }
---            end
---        end
---    end
---end
-
 -- Start to keep track of teams
 function trackTeams()
     if not trackingTeams then
@@ -97,6 +76,46 @@
     end
 end
 
+-- Registers when a hog is hidden
+function trackHiding(gear)
+    for k, g in ipairs(gears) do
+        if g == gear then
+            table.remove(gears, k)
+            break
+        end
+    end
+	
+    if trackingTeams then
+    	hogs = teams[GetHogTeamName(gear)]
+    	
+        if hogs ~= nil then
+            if table.maxn(hogs) == 1 then
+                hogs = nil
+            else
+                for k, hog in ipairs(hogs) do
+                    if hog == gear then
+                        table.remove(hogs, k)
+                        break
+                    end
+                end
+            end
+        end
+    end
+end
+
+-- Registers when a hog is restored
+function trackRestoring(gear)
+	table.insert(gears, gear)
+
+    if trackingTeams then
+        team = GetHogTeamName(gear)
+        if teams[team] == nil then
+            teams[team] = {}
+        end
+        table.insert(teams[team], gear)
+    end
+end
+
 -- Get a value for a specific gear
 function getGearValue(gear, key)
     if gearValues[gear] ~= nil then
--- a/share/hedgewars/Data/Scripts/plist/Gaudy Racer.plist	Sat Nov 19 23:34:09 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/GaudyRacer.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string>Default.plist</string>
-</dict>
-</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Highlander.plist	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/Highlander.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Default.plist</string>
+	<key>weapon</key>
+	<string>Default.plist</string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/plist/Racer.plist	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>command</key>
+	<string>escript Scripts/Multiplayer/Racer.lua</string>
+	<key>description</key>
+	<string></string>
+	<key>scheme</key>
+	<string>Shoppa.plist</string>
+	<key>weapon</key>
+	<string>Shoppa.plist</string>
+</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/PascalBasics.hs	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,70 @@
+{-# LANGUAGE FlexibleContexts #-}
+module PascalBasics where
+
+import Text.Parsec.Combinator
+import Text.Parsec.Char
+import Text.Parsec.Prim
+import Text.Parsec.Token
+import Text.Parsec.Language
+import Data.Char
+
+builtin = ["succ", "pred", "low", "high", "ord"]
+    
+pascalLanguageDef
+    = emptyDef
+    { commentStart   = "(*"
+    , commentEnd     = "*)"
+    , commentLine    = "//"
+    , nestedComments = False
+    , identStart     = letter <|> oneOf "_"
+    , identLetter    = alphaNum <|> oneOf "_."
+    , reservedNames  = [
+            "begin", "end", "program", "unit", "interface"
+            , "implementation", "and", "or", "xor", "shl"
+            , "shr", "while", "do", "repeat", "until", "case", "of"
+            , "type", "var", "const", "out", "array", "packed"
+            , "procedure", "function", "with", "for", "to"
+            , "downto", "div", "mod", "record", "set", "nil"
+            , "string", "cdecl", "external", "if", "then", "else"
+            ] ++ builtin
+    , reservedOpNames= [] 
+    , caseSensitive  = False   
+    }
+
+preprocessorSwitch :: Stream s m Char => ParsecT s u m String
+preprocessorSwitch = do
+    try $ string "{$"
+    s <- manyTill (noneOf "\n") $ char '}'
+    return s
+        
+caseInsensitiveString s = do
+    mapM_ (\a -> satisfy (\b -> toUpper a == toUpper b)) s <?> s
+    return s
+    
+pas = patch $ makeTokenParser pascalLanguageDef
+    where
+    patch tp = tp {stringLiteral = stringL}
+
+comment = choice [
+        char '{' >> notFollowedBy (char '$') >> manyTill anyChar (try $ char '}')
+        , (try $ string "(*") >> manyTill anyChar (try $ string "*)")
+        , (try $ string "//") >> manyTill anyChar (try newline)
+        ]
+    
+comments = do
+    spaces
+    skipMany $ do
+        preprocessorSwitch <|> comment
+        spaces
+
+stringL = do
+    (char '\'')
+    s <- (many $ noneOf "'")
+    (char '\'')
+    ss <- many $ do
+        (char '\'')
+        s' <- (many $ noneOf "'")
+        (char '\'')
+        return $ '\'' : s'
+    comments    
+    return $ concat (s:ss)
--- a/tools/PascalParser.hs	Sat Nov 19 23:34:09 2011 +0100
+++ b/tools/PascalParser.hs	Mon Dec 05 18:38:07 2011 -0500
@@ -1,142 +1,20 @@
 module PascalParser where
 
-import Text.Parsec.Expr
+import Text.Parsec
 import Text.Parsec.Char
 import Text.Parsec.Token
 import Text.Parsec.Language
+import Text.Parsec.Expr
 import Text.Parsec.Prim
 import Text.Parsec.Combinator
 import Text.Parsec.String
 import Control.Monad
-import Data.Char
 import Data.Maybe
 
-data PascalUnit =
-    Program Identifier Implementation
-    | Unit Identifier Interface Implementation (Maybe Initialize) (Maybe Finalize)
-    deriving Show
-data Interface = Interface Uses TypesAndVars
-    deriving Show
-data Implementation = Implementation Uses TypesAndVars
-    deriving Show
-data Identifier = Identifier String
-    deriving Show
-data TypesAndVars = TypesAndVars [TypeVarDeclaration]
-    deriving Show
-data TypeVarDeclaration = TypeDeclaration Identifier TypeDecl
-    | VarDeclaration Bool ([Identifier], TypeDecl) (Maybe InitExpression)
-    | FunctionDeclaration Identifier TypeDecl (Maybe (TypesAndVars,Phrase))
-    deriving Show
-data TypeDecl = SimpleType Identifier
-    | RangeType Range
-    | Sequence [Identifier]
-    | ArrayDecl Range TypeDecl
-    | RecordType [TypeVarDeclaration]
-    | PointerTo TypeDecl
-    | String Integer
-    | UnknownType
-    deriving Show
-data Range = Range Identifier
-           | RangeFromTo InitExpression InitExpression
-    deriving Show
-data Initialize = Initialize String
-    deriving Show
-data Finalize = Finalize String
-    deriving Show
-data Uses = Uses [Identifier]
-    deriving Show
-data Phrase = ProcCall Identifier [Expression]
-        | IfThenElse Expression Phrase (Maybe Phrase)
-        | WhileCycle Expression Phrase
-        | RepeatCycle Expression [Phrase]
-        | ForCycle Identifier Expression Expression Phrase
-        | WithBlock Reference Phrase
-        | Phrases [Phrase]
-        | SwitchCase Expression [(Expression, Phrase)] (Maybe Phrase)
-        | Assignment Reference Expression
-    deriving Show
-data Expression = Expression String
-    | BuiltInFunCall [Expression] Reference
-    | PrefixOp String Expression
-    | PostfixOp String Expression
-    | BinOp String Expression Expression
-    | StringLiteral String
-    | CharCode String
-    | NumberLiteral String
-    | FloatLiteral String
-    | HexNumber String
-    | Reference Reference
-    | Null
-    deriving Show
-data Reference = ArrayElement [Expression] Reference
-    | FunCall [Expression] Reference
-    | SimpleReference Identifier
-    | Dereference Reference
-    | RecordField Reference Reference
-    | Address Reference
-    deriving Show
-data InitExpression = InitBinOp String InitExpression InitExpression
-    | InitPrefixOp String InitExpression
-    | InitReference Identifier
-    | InitArray [InitExpression]
-    | InitRecord [(Identifier, InitExpression)]
-    | InitFloat String
-    | InitNumber String
-    | InitHexNumber String
-    | InitString String
-    | InitChar String
-    | BuiltInFunction String [InitExpression]
-    | InitSet [Identifier]
-    | InitNull
-    deriving Show
-
-builtin = ["succ", "pred", "low", "high"]
+import PascalBasics
+import PascalUnitSyntaxTree
     
-pascalLanguageDef
-    = emptyDef
-    { commentStart   = "(*"
-    , commentEnd     = "*)"
-    , commentLine    = "//"
-    , nestedComments = False
-    , identStart     = letter <|> oneOf "_"
-    , identLetter    = alphaNum <|> oneOf "_."
-    , reservedNames  = [
-            "begin", "end", "program", "unit", "interface"
-            , "implementation", "and", "or", "xor", "shl"
-            , "shr", "while", "do", "repeat", "until", "case", "of"
-            , "type", "var", "const", "out", "array", "packed"
-            , "procedure", "function", "with", "for", "to"
-            , "downto", "div", "mod", "record", "set", "nil"
-            , "string", "shortstring"
-            ] ++ builtin
-    , reservedOpNames= [] 
-    , caseSensitive  = False   
-    }
-    
-caseInsensitiveString s = do
-    mapM_ (\a -> satisfy (\b -> toUpper a == toUpper b)) s <?> s
-    return s
-    
-pas = patch $ makeTokenParser pascalLanguageDef
-    where
-    patch tp = tp {stringLiteral = sl}
-    sl = do
-        (char '\'')
-        s <- (many $ noneOf "'")
-        (char '\'')
-        ss <- many $ do
-            (char '\'')
-            s' <- (many $ noneOf "'")
-            (char '\'')
-            return $ '\'' : s'
-        comments    
-        return $ concat (s:ss)
-    
-comments = do
-    spaces
-    skipMany $ do
-        comment
-        spaces
+knownTypes = ["shortstring", "char", "byte"]
 
 pascalUnit = do
     comments
@@ -144,14 +22,8 @@
     comments
     return u
 
-comment = choice [
-        char '{' >> manyTill anyChar (try $ char '}')
-        , (try $ string "(*") >> manyTill anyChar (try $ string "*)")
-        , (try $ string "//") >> manyTill anyChar (try newline)
-        ]
-
 iD = do
-    i <- liftM Identifier (identifier pas)
+    i <- liftM (flip Identifier Unknown) (identifier pas)
     comments
     return i
         
@@ -169,23 +41,29 @@
 reference = buildExpressionParser table term <?> "reference"
     where
     term = comments >> choice [
-        parens pas (reference >>= postfixes) >>= postfixes
-        , char '@' >> reference >>= postfixes >>= return . Address
+        parens pas (liftM RefExpression expression >>= postfixes) >>= postfixes
+        , try $ typeCast >>= postfixes
+        , char '@' >> liftM Address reference >>= postfixes
         , liftM SimpleReference iD >>= postfixes 
         ] <?> "simple reference"
 
     table = [ 
-            [Infix (try (char '.' >> notFollowedBy (char '.')) >> return RecordField) AssocLeft]
         ]
     
-    postfixes r = many postfix >>= return . foldl fp r
+    postfixes r = many postfix >>= return . foldl (flip ($)) r
     postfix = choice [
             parens pas (option [] parameters) >>= return . FunCall
           , char '^' >> return Dereference
           , (brackets pas) (commaSep1 pas $ expression) >>= return . ArrayElement
+          , (char '.' >> notFollowedBy (char '.')) >> liftM (flip RecordField) reference
         ]
-    fp r f = f r
 
+    typeCast = do
+        t <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) knownTypes
+        e <- parens pas expression
+        comments
+        return $ TypeCast (Identifier t Unknown) e
+        
     
 varsDecl1 = varsParser sepEndBy1    
 varsDecl = varsParser sepEndBy
@@ -194,7 +72,7 @@
     return vs
 
 aVarDecl endsWithSemi = do
-    when (not endsWithSemi) $
+    unless endsWithSemi $
         optional $ choice [
             try $ string "var"
             , try $ string "const"
@@ -224,17 +102,18 @@
     where
     aConstDecl = do
         comments
-        i <- iD <?> "const declaration"
-        optional $ do
+        i <- iD
+        t <- optionMaybe $ do
             char ':'
             comments
             t <- typeDecl
-            return ()
+            comments
+            return t
         char '='
         comments
         e <- initExpression
         comments
-        return $ VarDeclaration False ([i], UnknownType) (Just e)
+        return $ VarDeclaration False ([i], fromMaybe UnknownType t) (Just e)
         
 typeDecl = choice [
     char '^' >> typeDecl >>= return . PointerTo
@@ -242,30 +121,78 @@
     , try (string "string") >> optionMaybe (brackets pas $ integer pas) >>= return . String . fromMaybe 255
     , arrayDecl
     , recordDecl
+    , setDecl
+    , functionType
     , sequenceDecl >>= return . Sequence
-    , try (identifier pas) >>= return . SimpleType . Identifier
+    , try iD >>= return . SimpleType
     , rangeDecl >>= return . RangeType
     ] <?> "type declaration"
     where
     arrayDecl = do
-        try $ string "array"
+        try $ do
+            optional $ (try $ string "packed") >> comments
+            string "array"
         comments
-        char '['
-        r <- rangeDecl
-        char ']'
-        comments
+        r <- option [] $ do
+            char '['
+            r <- commaSep pas rangeDecl
+            char ']'
+            comments
+            return r
         string "of"
         comments
         t <- typeDecl
-        return $ ArrayDecl r t
+        if null r then
+            return $ ArrayDecl Nothing t
+            else
+            return $ foldr (\a b -> ArrayDecl (Just a) b) (ArrayDecl (Just $ head r) t) (tail r) 
     recordDecl = do
-        optional $ (try $ string "packed") >> comments
-        try $ string "record"
+        try $ do
+            optional $ (try $ string "packed") >> comments
+            string "record"
         comments
         vs <- varsDecl True
+        union <- optionMaybe $ do
+            string "case"
+            comments
+            iD
+            comments
+            string "of"
+            comments
+            many unionCase
         string "end"
-        return $ RecordType vs
-    sequenceDecl = (parens pas) $ (commaSep pas) iD
+        return $ RecordType vs union
+    setDecl = do
+        try $ string "set" >> space
+        comments
+        string "of"
+        comments
+        liftM Set typeDecl
+    unionCase = do
+        try $ commaSep pas $ (iD >> return ()) <|> (integer pas >> return ())
+        char ':'
+        comments
+        u <- parens pas $ varsDecl True
+        char ';'
+        comments
+        return u
+    sequenceDecl = (parens pas) $ (commaSep pas) (iD >>= \i -> optional (spaces >> char '=' >> spaces >> integer pas) >> return i)
+    functionType = do
+        fp <- try (string "function") <|> try (string "procedure")
+        comments
+        vs <- option [] $ parens pas $ varsDecl False
+        comments
+        ret <- if (fp == "function") then do
+            char ':'
+            comments
+            ret <- typeDecl
+            comments
+            return ret
+            else
+            return UnknownType
+        optional $ try $ char ';' >> comments >> string "cdecl"
+        comments
+        return $ FunctionType ret vs
 
 typesDecl = many (aTypeDecl >>= \t -> comments >> return t)
     where
@@ -281,6 +208,7 @@
         semi pas
         comments
         return $ TypeDeclaration i t
+
         
 rangeDecl = choice [
     try $ rangeft
@@ -291,79 +219,112 @@
     e1 <- initExpression
     string ".."
     e2 <- initExpression
-    return $ RangeFromTo e1 e2
+    return $ RangeFromTo e1 e2        
     
 typeVarDeclaration isImpl = (liftM concat . many . choice) [
     varSection,
     constSection,
     typeSection,
     funcDecl,
-    procDecl
+    operatorDecl
     ]
     where
     varSection = do
         try $ string "var"
         comments
-        v <- varsDecl1 True
+        v <- varsDecl1 True <?> "variable declaration"
         comments
         return v
 
     constSection = do
         try $ string "const"
         comments
-        c <- constsDecl
+        c <- constsDecl <?> "const declaration"
         comments
         return c
 
     typeSection = do
         try $ string "type"
         comments
-        t <- typesDecl
+        t <- typesDecl <?> "type declaration"
         comments
         return t
         
-    procDecl = do
-        try $ string "procedure"
-        comments
-        i <- iD
-        optional $ parens pas $ varsDecl False
-        comments
-        char ';'
+    operatorDecl = do
+        try $ string "operator"
         comments
-        b <- if isImpl then
-                liftM Just functionBody
-                else
-                return Nothing
+        i <- manyTill anyChar space
         comments
-        return $ [FunctionDeclaration i UnknownType b]
-        
-    funcDecl = do
-        try $ string "function"
+        vs <- parens pas $ varsDecl False
         comments
-        i <- iD
-        optional $ parens pas $ varsDecl False
+        rid <- iD
         comments
         char ':'
         comments
         ret <- typeDecl
         comments
+        return ret
         char ';'
         comments
-        b <- if isImpl then
+        forward <- liftM isJust $ optionMaybe (try (string "forward;") >> comments)
+        many functionDecorator
+        b <- if isImpl && (not forward) then
                 liftM Just functionBody
                 else
                 return Nothing
-        return $ [FunctionDeclaration i ret b]
+        return $ [OperatorDeclaration i rid ret vs b]
 
+        
+    funcDecl = do
+        fp <- try (string "function") <|> try (string "procedure")
+        comments
+        i <- iD
+        vs <- option [] $ parens pas $ varsDecl False
+        comments
+        ret <- if (fp == "function") then do
+            char ':'
+            comments
+            ret <- typeDecl
+            comments
+            return ret
+            else
+            return UnknownType
+        char ';'
+        comments
+        forward <- liftM isJust $ optionMaybe (try (string "forward;") >> comments)
+        many functionDecorator
+        b <- if isImpl && (not forward) then
+                liftM Just functionBody
+                else
+                return Nothing
+        return $ [FunctionDeclaration i ret vs b]
+        
+    functionDecorator = choice [
+        try $ string "inline;"
+        , try $ caseInsensitiveString "cdecl;"
+        , try $ string "overload;"
+        , try $ string "export;"
+        , try $ string "varargs;"
+        , try (string "external") >> comments >> iD >> optional (string "name" >> comments >> stringLiteral pas)>> string ";"
+        ] >> comments
+        
+        
 program = do
     string "program"
     comments
     name <- iD
     (char ';')
     comments
-    impl <- implementation
+    comments
+    u <- uses
+    comments
+    tv <- typeVarDeclaration True
     comments
-    return $ Program name impl
+    p <- phrase
+    comments
+    char '.'
+    comments
+    return $ Program name (Implementation u (TypesAndVars tv)) p
 
 interface = do
     string "interface"
@@ -387,15 +348,19 @@
 expression = buildExpressionParser table term <?> "expression"
     where
     term = comments >> choice [
-        builtInFunction expression >>= \(n, e) -> return $ BuiltInFunCall e (SimpleReference (Identifier n))
-        , parens pas $ expression 
-        , try $ integer pas >>= \i -> notFollowedBy (char '.') >> (return . NumberLiteral . show) i
-        , try $ float pas >>= return . FloatLiteral . show
-        , try $ integer pas >>= return . NumberLiteral . show
+        builtInFunction expression >>= \(n, e) -> return $ BuiltInFunCall e (SimpleReference (Identifier n Unknown))
+        , try (parens pas $ expression >>= \e -> notFollowedBy (comments >> char '.') >> return e)
+        , brackets pas (commaSep pas iD) >>= return . SetExpression
+        , try $ natural pas >>= \i -> notFollowedBy (char '.') >> (return . NumberLiteral . show) i
+        , float pas >>= return . FloatLiteral . show
+        , natural pas >>= return . NumberLiteral . show
         , stringLiteral pas >>= return . StringLiteral
-        , char '#' >> many digit >>= return . CharCode
-        , char '$' >> many hexDigit >>= return . HexNumber
+        , try (string "#$") >> many hexDigit >>= \c -> comments >> return (HexCharCode c)
+        , char '#' >> many digit >>= \c -> comments >> return (CharCode c)
+        , char '$' >> many hexDigit >>=  \h -> comments >> return (HexNumber h)
+        , char '-' >> expression >>= return . PrefixOp "-"
         , try $ string "nil" >> return Null
+        , try $ string "not" >> expression >>= return . PrefixOp "not"
         , reference >>= return . Reference
         ] <?> "simple expression"
 
@@ -404,10 +369,10 @@
            , Infix (char '/' >> return (BinOp "/")) AssocLeft
            , Infix (try (string "div") >> return (BinOp "div")) AssocLeft
            , Infix (try (string "mod") >> return (BinOp "mod")) AssocLeft
+           , Infix (try (string "in") >> return (BinOp "in")) AssocNone
           ]
         , [  Infix (char '+' >> return (BinOp "+")) AssocLeft
            , Infix (char '-' >> return (BinOp "-")) AssocLeft
-           , Prefix (char '-' >> return (PrefixOp "-"))
           ]
         , [  Infix (try (string "<>") >> return (BinOp "<>")) AssocNone
            , Infix (try (string "<=") >> return (BinOp "<=")) AssocNone
@@ -423,13 +388,12 @@
         , [  Infix (try $ string "shl" >> return (BinOp "shl")) AssocNone
            , Infix (try $ string "shr" >> return (BinOp "shr")) AssocNone
           ]
-        , [Prefix (try (string "not") >> return (PrefixOp "not"))]
         ]
     
 phrasesBlock = do
     try $ string "begin"
     comments
-    p <- manyTill phrase (try $ string "end")
+    p <- manyTill phrase (try $ string "end" >> notFollowedBy alphaNum)
     comments
     return $ Phrases p
     
@@ -444,6 +408,7 @@
         , forCycle
         , (try $ reference >>= \r -> string ":=" >> return r) >>= \r -> expression >>= return . Assignment r
         , procCall
+        , char ';' >> comments >> return NOP
         ]
     optional $ char ';'
     comments
@@ -459,9 +424,9 @@
     o1 <- phrase
     comments
     o2 <- optionMaybe $ do
-        try $ string "else"
+        try $ string "else" >> space
         comments
-        o <- phrase
+        o <- option NOP phrase
         comments
         return o
     return $ IfThenElse e o1 o2
@@ -477,7 +442,7 @@
     return $ WhileCycle e o
 
 withBlock = do
-    try $ string "with"
+    try $ string "with" >> space
     comments
     rs <- (commaSep1 pas) reference
     comments
@@ -487,7 +452,7 @@
     return $ foldr WithBlock o rs
     
 repeatCycle = do
-    try $ string "repeat"
+    try $ string "repeat" >> space
     comments
     o <- many phrase
     string "until"
@@ -497,7 +462,7 @@
     return $ RepeatCycle e o
 
 forCycle = do
-    try $ string "for"
+    try $ string "for" >> space
     comments
     i <- iD
     comments
@@ -524,9 +489,9 @@
     comments
     cs <- many1 aCase
     o2 <- optionMaybe $ do
-        try $ string "else"
+        try $ string "else" >> notFollowedBy alphaNum
         comments
-        o <- phrase
+        o <- many phrase
         comments
         return o
     string "end"
@@ -534,7 +499,7 @@
     return $ SwitchCase e cs o2
     where
     aCase = do
-        e <- expression
+        e <- (commaSep pas) $ (liftM InitRange rangeDecl <|> initExpression)
         comments
         char ':'
         comments
@@ -543,9 +508,9 @@
         return (e, p)
     
 procCall = do
-    i <- iD
+    r <- reference
     p <- option [] $ (parens pas) parameters
-    return $ ProcCall i p
+    return $ ProcCall r p
 
 parameters = (commaSep pas) expression <?> "parameters"
         
@@ -571,16 +536,18 @@
     where
     term = comments >> choice [
         liftM (uncurry BuiltInFunction) $ builtInFunction initExpression 
-        , try $ brackets pas (commaSep pas $ iD) >>= return . InitSet
+        , try $ brackets pas (commaSep pas $ initExpression) >>= return . InitSet
         , try $ parens pas (commaSep pas $ initExpression) >>= return . InitArray
-        , parens pas (semiSep pas $ recField) >>= return . InitRecord
+        , parens pas (sepEndBy recField (char ';' >> comments)) >>= return . InitRecord
         , try $ integer pas >>= \i -> notFollowedBy (char '.') >> (return . InitNumber . show) i
         , try $ float pas >>= return . InitFloat . show
         , try $ integer pas >>= return . InitNumber . show
         , stringLiteral pas >>= return . InitString
-        , char '#' >> many digit >>= return . InitChar
-        , char '$' >> many hexDigit >>= return . InitHexNumber
+        , char '#' >> many digit >>= \c -> comments >> return (InitChar c)
+        , char '$' >> many hexDigit >>= \h -> comments >> return (InitHexNumber h)
+        , char '@' >> initExpression >>= \c -> comments >> return (InitAddress c)
         , try $ string "nil" >> return InitNull
+        , itypeCast
         , iD >>= return . InitReference
         ]
         
@@ -620,9 +587,16 @@
         , [Prefix (try (string "not") >> return (InitPrefixOp "not"))]
         ]
 
+    itypeCast = do
+        t <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) knownTypes
+        i <- parens pas initExpression
+        comments
+        return $ InitTypeCast (Identifier t Unknown) i
+        
 builtInFunction e = do
     name <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) builtin
     spaces
     exprs <- parens pas $ commaSep1 pas $ e
     spaces
     return (name, exprs)
+        
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/PascalPreprocessor.hs	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,130 @@
+module PascalPreprocessor where
+
+import Text.Parsec
+import Control.Monad.IO.Class
+import Control.Monad
+import System.IO
+import qualified Data.Map as Map
+import Data.Char
+
+
+-- comments are removed
+comment = choice [
+        char '{' >> notFollowedBy (char '$') >> manyTill anyChar (try $ char '}') >> return ""
+        , (try $ string "(*") >> manyTill anyChar (try $ string "*)") >> return ""
+        , (try $ string "//") >> manyTill anyChar (try newline) >> return "\n"
+        ]
+
+initDefines = Map.fromList [("FPC", "")]
+        
+preprocess :: String -> IO String
+preprocess fn = do
+    r <- runParserT (preprocessFile fn) (initDefines, [True]) "" ""
+    case r of
+         (Left a) -> do
+             hPutStrLn stderr (show a)
+             return ""
+         (Right a) -> return a
+    
+    where
+    preprocessFile fn = do
+        f <- liftIO (readFile fn)
+        setInput f
+        preprocessor
+        
+    preprocessor, codeBlock, switch :: ParsecT String (Map.Map String String, [Bool]) IO String
+    
+    preprocessor = chainr codeBlock (return (++)) ""
+    
+    codeBlock = do
+        s <- choice [
+            switch
+            , comment
+            , char '\'' >> many (noneOf "'\n") >>= \s -> char '\'' >> return ('\'' : s ++ "'")
+            , identifier >>= replace
+            , noneOf "{" >>= \a -> return [a]
+            ]
+        (_, ok) <- getState
+        return $ if and ok then s else ""
+
+    --otherChar c = c `notElem` "{/('_" && not (isAlphaNum c)
+    identifier = do
+        c <- letter <|> oneOf "_"
+        s <- many (alphaNum <|> oneOf "_")
+        return $ c:s
+            
+    switch = do
+        try $ string "{$"
+        s <- choice [
+            include
+            , ifdef
+            , if'
+            , elseSwitch
+            , endIf
+            , define
+            , unknown
+            ]
+        return s
+        
+    include = do
+        try $ string "INCLUDE"
+        spaces
+        (char '"')
+        fn <- many1 $ noneOf "\"\n"
+        char '"'
+        spaces
+        char '}'
+        f <- liftIO (readFile fn)
+        c <- getInput
+        setInput $ f ++ c
+        return ""
+
+    ifdef = do
+        s <- try (string "IFDEF") <|> try (string "IFNDEF")
+        let f = if s == "IFNDEF" then not else id
+        
+        spaces
+        d <- identifier
+        spaces
+        char '}'
+        
+        updateState $ \(m, b) ->
+            (m, (f $ d `Map.member` m) : b)
+      
+        return ""
+
+    if' = do
+        s <- try (string "IF" >> notFollowedBy alphaNum)
+        
+        manyTill anyChar (char '}')
+        --char '}'
+        
+        updateState $ \(m, b) ->
+            (m, False : b)
+      
+        return ""
+
+    elseSwitch = do
+        try $ string "ELSE}"
+        updateState $ \(m, b:bs) -> (m, (not b):bs)
+        return ""
+    endIf = do
+        try $ string "ENDIF}"
+        updateState $ \(m, b:bs) -> (m, bs)
+        return ""
+    define = do
+        try $ string "DEFINE"
+        spaces
+        i <- identifier        
+        d <- ((string ":=" >> return ())<|> spaces) >> many (noneOf "}")
+        char '}'
+        updateState $ \(m, b) -> (if and b then Map.insert i d m else m, b)
+        return ""
+    replace s = do
+        (m, _) <- getState
+        return $ Map.findWithDefault s s m
+        
+    unknown = do
+        fn <- many1 $ noneOf "}\n"
+        char '}'
+        return $ "{$" ++ fn ++ "}"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/PascalUnitSyntaxTree.hs	Mon Dec 05 18:38:07 2011 -0500
@@ -0,0 +1,108 @@
+module PascalUnitSyntaxTree where
+
+import Data.Traversable
+
+data PascalUnit =
+    Program Identifier Implementation Phrase
+    | Unit Identifier Interface Implementation (Maybe Initialize) (Maybe Finalize)
+    | System
+    deriving Show
+data Interface = Interface Uses TypesAndVars
+    deriving Show
+data Implementation = Implementation Uses TypesAndVars
+    deriving Show
+data Identifier = Identifier String BaseType
+    deriving Show
+data TypesAndVars = TypesAndVars [TypeVarDeclaration]
+    deriving Show
+data TypeVarDeclaration = TypeDeclaration Identifier TypeDecl
+    | VarDeclaration Bool ([Identifier], TypeDecl) (Maybe InitExpression)
+    | FunctionDeclaration Identifier TypeDecl [TypeVarDeclaration] (Maybe (TypesAndVars, Phrase))
+    | OperatorDeclaration String Identifier TypeDecl [TypeVarDeclaration] (Maybe (TypesAndVars, Phrase))
+    deriving Show
+data TypeDecl = SimpleType Identifier
+    | RangeType Range
+    | Sequence [Identifier]
+    | ArrayDecl (Maybe Range) TypeDecl
+    | RecordType [TypeVarDeclaration] (Maybe [[TypeVarDeclaration]])
+    | PointerTo TypeDecl
+    | String Integer
+    | Set TypeDecl
+    | FunctionType TypeDecl [TypeVarDeclaration]
+    | UnknownType
+    deriving Show
+data Range = Range Identifier
+           | RangeFromTo InitExpression InitExpression
+    deriving Show
+data Initialize = Initialize String
+    deriving Show
+data Finalize = Finalize String
+    deriving Show
+data Uses = Uses [Identifier]
+    deriving Show
+data Phrase = ProcCall Reference [Expression]
+        | IfThenElse Expression Phrase (Maybe Phrase)
+        | WhileCycle Expression Phrase
+        | RepeatCycle Expression [Phrase]
+        | ForCycle Identifier Expression Expression Phrase
+        | WithBlock Reference Phrase
+        | Phrases [Phrase]
+        | SwitchCase Expression [([InitExpression], Phrase)] (Maybe [Phrase])
+        | Assignment Reference Expression
+        | NOP
+    deriving Show
+data Expression = Expression String
+    | BuiltInFunCall [Expression] Reference
+    | PrefixOp String Expression
+    | PostfixOp String Expression
+    | BinOp String Expression Expression
+    | StringLiteral String
+    | CharCode String
+    | HexCharCode String
+    | NumberLiteral String
+    | FloatLiteral String
+    | HexNumber String
+    | Reference Reference
+    | SetExpression [Identifier]
+    | Null
+    deriving Show
+data Reference = ArrayElement [Expression] Reference
+    | FunCall [Expression] Reference
+    | TypeCast Identifier Expression
+    | SimpleReference Identifier
+    | Dereference Reference
+    | RecordField Reference Reference
+    | Address Reference
+    | RefExpression Expression
+    deriving Show
+data InitExpression = InitBinOp String InitExpression InitExpression
+    | InitPrefixOp String InitExpression
+    | InitReference Identifier
+    | InitArray [InitExpression]
+    | InitRecord [(Identifier, InitExpression)]
+    | InitFloat String
+    | InitNumber String
+    | InitHexNumber String
+    | InitString String
+    | InitChar String
+    | BuiltInFunction String [InitExpression]
+    | InitSet [InitExpression]
+    | InitAddress InitExpression
+    | InitNull
+    | InitRange Range
+    | InitTypeCast Identifier InitExpression
+    deriving Show
+
+data BaseType = Unknown
+    | BTChar
+    | BTString
+    | BTInt
+    | BTRecord
+    | BTArray
+    | BTFunction
+    | BTPointerTo BaseType
+    | BTSet
+    | BTEnum [String]
+    | Void
+    deriving Show
+    
\ No newline at end of file
--- a/tools/pas2c.hs	Sat Nov 19 23:34:09 2011 +0100
+++ b/tools/pas2c.hs	Mon Dec 05 18:38:07 2011 -0500
@@ -1,54 +1,136 @@
 module Pas2C where
 
-import PascalParser
 import Text.PrettyPrint.HughesPJ
 import Data.Maybe
 import Data.Char
-import Text.Parsec.String
+import Text.Parsec.Prim
+import Control.Monad.State
+import System.IO
+import System.Directory
+import Control.Monad.IO.Class
+import PascalPreprocessor
+import Control.Exception
+import System.IO.Error
+import qualified Data.Map as Map
+import Control.Monad.Reader
+
+import PascalParser
+import PascalUnitSyntaxTree
+
+pas2C :: String -> IO ()
+pas2C fn = do
+    setCurrentDirectory "../hedgewars/"
+    s <- flip execStateT initState $ f fn
+    mapM_ toCFiles (Map.toList s)
+    where
+    printLn = liftIO . hPutStrLn stderr
+    print = liftIO . hPutStr stderr
+    initState = Map.empty
+    f :: String -> StateT (Map.Map String PascalUnit) IO ()
+    f fileName = do
+        processed <- gets $ Map.member fileName
+        unless processed $ do
+            print ("Preprocessing '" ++ fileName ++ ".pas'... ")
+            fc' <- liftIO 
+                $ tryJust (guard . isDoesNotExistError) 
+                $ preprocess (fileName ++ ".pas")
+            case fc' of
+                (Left a) -> do
+                    modify (Map.insert fileName System)
+                    printLn "doesn't exist"
+                (Right fc) -> do
+                    print "ok, parsing... "
+                    let ptree = parse pascalUnit fileName fc
+                    case ptree of
+                         (Left a) -> do
+                            liftIO $ writeFile "preprocess.out" fc
+                            printLn $ show a ++ "\nsee preprocess.out for preprocessed source"
+                            fail "stop"
+                         (Right a) -> do
+                            printLn "ok"
+                            modify (Map.insert fileName a)
+                            mapM_ f (usesFiles a)
+
+toCFiles :: (String, PascalUnit) -> IO ()
+toCFiles (_, System) = return ()
+toCFiles p@(fn, pu) = do
+    hPutStrLn stderr $ "Rendering '" ++ fn ++ "'..."
+    toCFiles' p
+    where
+    toCFiles' (fn, p@(Program {})) = writeFile (fn ++ ".c") $ (render2C . pascal2C) p
+    toCFiles' (fn, (Unit _ interface implementation _ _)) = do
+        writeFile (fn ++ ".h") $ "#pragma once\n" ++ (render2C . interface2C $ interface)
+        writeFile (fn ++ ".c") $ (render2C . implementation2C) implementation
+
+system :: [(String, String)]
+system = []
+        
+render2C = render . flip runReader system
+
+usesFiles :: PascalUnit -> [String]
+usesFiles (Program _ (Implementation uses _) _) = uses2List uses
+usesFiles (Unit _ (Interface uses1 _) (Implementation uses2 _) _ _) = uses2List uses1 ++ uses2List uses2
 
 
-pas2C :: String -> IO String
-pas2C fileName = do
-    ptree <- parseFromFile pascalUnit fileName
-    case ptree of
-         (Left a) -> return (show a)
-         (Right a) -> (return . render . pascal2C) a
 
-pascal2C :: PascalUnit -> Doc
-pascal2C (Unit unitName interface implementation init fin) = 
-    interface2C interface
-    $+$ 
-    implementation2C implementation
+pascal2C :: PascalUnit -> Reader a Doc
+pascal2C (Unit _ interface implementation init fin) =
+    liftM2 ($+$) (interface2C interface) (implementation2C implementation)
+    
+pascal2C (Program _ implementation mainFunction) = do
+    impl <- implementation2C implementation
+    main <- tvar2C True 
+        (FunctionDeclaration (Identifier "main" BTInt) (SimpleType $ Identifier "int" BTInt) [] (Just (TypesAndVars [], mainFunction)))
+    return $ impl $+$ main
 
-interface2C :: Interface -> Doc
-interface2C (Interface uses tvars) = typesAndVars2C tvars
+    
+    
+interface2C :: Interface -> Reader a Doc
+interface2C (Interface uses tvars) = liftM2 ($+$) (uses2C uses) (typesAndVars2C True tvars)
 
-implementation2C :: Implementation -> Doc
-implementation2C (Implementation uses tvars) = typesAndVars2C tvars
+implementation2C :: Implementation -> Reader a Doc
+implementation2C (Implementation uses tvars) = liftM2 ($+$) (uses2C uses) (typesAndVars2C True tvars)
 
 
-typesAndVars2C :: TypesAndVars -> Doc
-typesAndVars2C (TypesAndVars ts) = vcat $ map tvar2C ts
+typesAndVars2C :: Bool -> TypesAndVars -> Reader a Doc
+typesAndVars2C b (TypesAndVars ts) = liftM vcat $ mapM (tvar2C b) ts
 
+uses2C :: Uses -> Reader a Doc
+uses2C uses = return $ vcat . map (\i -> text $ "#include \"" ++ i ++ ".h\"") $ uses2List uses
+
+uses2List :: Uses -> [String]
+uses2List (Uses ids) = map (\(Identifier i _) -> i) ids
 
-tvar2C :: TypeVarDeclaration -> Doc
-tvar2C (FunctionDeclaration (Identifier name) returnType Nothing) = 
-    type2C returnType <+> text (name ++ "();")
-tvar2C (FunctionDeclaration (Identifier name) returnType (Just (tvars, phrase))) = 
-    type2C returnType <+> text (name ++ "()") 
-    $$
-    text "{" $+$ (nest 4 $ typesAndVars2C tvars)
-    $+$
-    phrase2C phrase
-    $+$ 
-    text "}"
-tvar2C (TypeDeclaration (Identifier i) t) = text "type" <+> text i <+> type2C t <> text ";"
-tvar2C (VarDeclaration isConst (ids, t) mInitExpr) = 
+tvar2C :: Bool -> TypeVarDeclaration -> Reader a Doc
+tvar2C _ (FunctionDeclaration (Identifier name _) returnType params Nothing) = do
+    t <- type2C returnType 
+    p <- liftM hcat $ mapM (tvar2C False) params
+    return $ t <+> text name <> parens p <> text ";"
+tvar2C True (FunctionDeclaration (Identifier name _) returnType params (Just (tvars, phrase))) = do
+    t <- type2C returnType 
+    p <- liftM hcat $ mapM (tvar2C False) params
+    ph <- liftM2 ($+$) (typesAndVars2C False tvars) (phrase2C' phrase)
+    return $ 
+        t <+> text name <> parens p
+        $+$
+        text "{" 
+        $+$ 
+        nest 4 ph
+        $+$
+        text "}"
+    where
+    phrase2C' (Phrases p) = liftM vcat $ mapM phrase2C p
+    phrase2C' p = phrase2C p
+tvar2C False (FunctionDeclaration (Identifier name _) _ _ _) = error $ "nested functions not allowed: " ++ name
+tvar2C _ (TypeDeclaration (Identifier i _) t) = do
+    tp <- type2C t
+    return $ text "type" <+> text i <+> tp <> text ";"
+tvar2C _ (VarDeclaration isConst (ids, t) mInitExpr) = 
     if isConst then text "const" else empty
     <+>
     type2C t
     <+>
-    (hsep . punctuate (char ',') . map (\(Identifier i) -> text i) $ ids)
+    (hsep . punctuate (char ',') . map (\(Identifier i _) -> text i) $ ids)
     <+>
     initExpr mInitExpr
     <>
@@ -56,32 +138,36 @@
     where
     initExpr Nothing = empty
     initExpr (Just e) = text "=" <+> initExpr2C e
+tvar2C f (OperatorDeclaration op _ ret params body) = 
+    tvar2C f (FunctionDeclaration (Identifier ("<op " ++ op ++ ">") Unknown) ret params body)
 
-initExpr2C :: InitExpression -> Doc
+initExpr2C :: InitExpression -> Reader a Doc
 initExpr2C (InitBinOp op expr1 expr2) = parens $ (initExpr2C expr1) <+> op2C op <+> (initExpr2C expr2)
 initExpr2C (InitNumber s) = text s
 initExpr2C (InitFloat s) = text s
 initExpr2C (InitHexNumber s) = text "0x" <> (text . map toLower $ s)
 initExpr2C (InitString s) = doubleQuotes $ text s 
-initExpr2C (InitReference (Identifier i)) = text i
+initExpr2C (InitReference (Identifier i _)) = text i
 
 
 initExpr2C _ = text "<<expression>>"
 
-type2C :: TypeDecl -> Doc
+type2C :: TypeDecl -> Reader a Doc
 type2C UnknownType = text "void"
 type2C (String l) = text $ "string" ++ show l
-type2C (SimpleType (Identifier i)) = text i
+type2C (SimpleType (Identifier i _)) = text i
 type2C (PointerTo t) = type2C t <> text "*"
-type2C (RecordType tvs) = text "{" $+$ (nest 4 . vcat . map tvar2C $ tvs) $+$ text "}"
+type2C (RecordType tvs union) = text "{" $+$ (nest 4 . vcat . map (tvar2C False) $ tvs) $+$ text "}"
 type2C (RangeType r) = text "<<range type>>"
 type2C (Sequence ids) = text "<<sequence type>>"
 type2C (ArrayDecl r t) = text "<<array type>>"
-
+type2C (Set t) = text "<<set>>"
+type2C (FunctionType returnType params) = text "<<function>>"
 
-phrase2C :: Phrase -> Doc
+phrase2C :: Phrase -> Reader a Doc
 phrase2C (Phrases p) = text "{" $+$ (nest 4 . vcat . map phrase2C $ p) $+$ text "}"
-phrase2C (ProcCall (Identifier name) params) = text name <> parens (hsep . punctuate (char ',') . map expr2C $ params) <> semi
+phrase2C (ProcCall f@(FunCall {}) []) = ref2C f <> semi
+phrase2C (ProcCall ref params) = ref2C ref <> parens (hsep . punctuate (char ',') . map expr2C $ params) <> semi
 phrase2C (IfThenElse (expr) phrase1 mphrase2) = text "if" <> parens (expr2C expr) $+$ (phrase2C . wrapPhrase) phrase1 $+$ elsePart
     where
     elsePart | isNothing mphrase2 = empty
@@ -90,44 +176,45 @@
 phrase2C (WhileCycle expr phrase) = text "while" <> parens (expr2C expr) $$ (phrase2C $ wrapPhrase phrase)
 phrase2C (SwitchCase expr cases mphrase) = text "switch" <> parens (expr2C expr) <> text "of" $+$ (nest 4 . vcat . map case2C) cases
     where
-    case2C :: (Expression, Phrase) -> Doc
-    case2C (e, p) = text "case" <+> parens (expr2C e) <> char ':' <> nest 4 (phrase2C p $+$ text "break;")
+    case2C :: ([InitExpression], Phrase) -> Doc
+    case2C (e, p) = text "case" <+> parens (hsep . punctuate (char ',') . map initExpr2C $ e) <> char ':' <> nest 4 (phrase2C p $+$ text "break;")
 phrase2C (WithBlock ref p) = text "namespace" <> parens (ref2C ref) $$ (phrase2C $ wrapPhrase p)
-phrase2C (ForCycle (Identifier i) e1 e2 p) = 
+phrase2C (ForCycle (Identifier i _) e1 e2 p) = 
     text "for" <> (parens . hsep . punctuate (char ';') $ [text i <+> text "=" <+> expr2C e1, text i <+> text "<=" <+> expr2C e2, text "++" <> text i])
     $$
     phrase2C (wrapPhrase p)
 phrase2C (RepeatCycle e p) = text "do" <+> phrase2C (Phrases p) <+> text "while" <> parens (text "!" <> parens (expr2C e))
+phrase2C NOP = text ";"
 
 
 wrapPhrase p@(Phrases _) = p
 wrapPhrase p = Phrases [p]
 
 
-expr2C :: Expression -> Doc
+expr2C :: Expression -> Reader a Doc
 expr2C (Expression s) = text s
 expr2C (BinOp op expr1 expr2) = parens $ (expr2C expr1) <+> op2C op <+> (expr2C expr2)
 expr2C (NumberLiteral s) = text s
+expr2C (FloatLiteral s) = text s
 expr2C (HexNumber s) = text "0x" <> (text . map toLower $ s)
 expr2C (StringLiteral s) = doubleQuotes $ text s 
 expr2C (Reference ref) = ref2C ref
 expr2C (PrefixOp op expr) = op2C op <+> expr2C expr
-    {-
-    | PostfixOp String Expression
-    | CharCode String
-    -}            
-expr2C _ = empty
+expr2C Null = text "NULL"
+expr2C (BuiltInFunCall params ref) = ref2C ref <> parens (hsep . punctuate (char ',') . map expr2C $ params)
+expr2C _ = text "<<expression>>"
 
 
-ref2C :: Reference -> Doc
+ref2C :: Reference -> Reader a Doc
 ref2C (ArrayElement exprs ref) = ref2C ref <> (brackets . hcat) (punctuate comma $ map expr2C exprs)
-ref2C (SimpleReference (Identifier name)) = text name
+ref2C (SimpleReference (Identifier name _)) = text name
 ref2C (RecordField (Dereference ref1) ref2) = ref2C ref1 <> text "->" <> ref2C ref2
 ref2C (RecordField ref1 ref2) = ref2C ref1 <> text "." <> ref2C ref2
 ref2C (Dereference ref) = parens $ text "*" <> ref2C ref
 ref2C (FunCall params ref) = ref2C ref <> parens (hsep . punctuate (char ',') . map expr2C $ params)
-ref2C (Address ref) = text "&" <> ref2C ref
-
+ref2C (Address ref) = text "&" <> parens (ref2C ref)
+ref2C (TypeCast (Identifier t _) expr) = parens (text t) <> expr2C expr
+ref2C (RefExpression expr) = expr2C expr
 
 op2C "or" = text "|"
 op2C "and" = text "&"