Checkpoint new rollo scripts.  Not currently in use.
diff --git a/res/raw/rollo2.c b/res/raw/rollo2.c
index d907785..cc273b1 100644
--- a/res/raw/rollo2.c
+++ b/res/raw/rollo2.c
@@ -19,11 +19,40 @@
 int g_LastTime;
 int g_PageCount;
 float g_Zoom;
-float g_ZoomTarget;
+float g_OldPosPage;
+float g_OldPosVelocity;
+float g_OldZoom;
 
 // Drawing constants, should be parameters ======
 #define VIEW_ANGLE 1.28700222f
 
+int g_DrawLastFrame;
+int lastFrame(int draw) {
+    // We draw one extra frame to work around the last frame post bug.
+    // We also need to track if we drew the last frame to deal with large DT
+    // in the physics.
+    int ret = g_DrawLastFrame | draw;
+    g_DrawLastFrame = draw;
+    return ret;  // should return draw instead.
+}
+
+void updateReadback() {
+    if ((g_OldPosPage != g_PosPage) ||
+        (g_OldPosVelocity != g_PosVelocity) ||
+        (g_OldZoom != g_Zoom)) {
+
+        g_OldPosPage = g_PosPage;
+        g_OldPosVelocity = g_PosVelocity;
+        g_OldZoom = g_Zoom;
+
+        int i[3];
+        i[0] = g_PosPage * (1 << 16);
+        i[1] = g_PosVelocity * (1 << 16);
+        i[2] = g_OldZoom * (1 << 16);
+        sendToClient(&i[0], 1, 12, 1);
+    }
+}
+
 void init() {
     g_AttractionTable[0] = 6.5f;
     g_AttractionTable[1] = 6.5f;
@@ -50,7 +79,6 @@
     g_LastTouchDown = 0;
     g_LastPositionX = 0;
     g_Zoom = 0;
-    g_ZoomTarget = 0;
 }
 
 void move() {
@@ -97,16 +125,6 @@
     g_LastTouchDown = 0;
 }
 
-void setZoomTarget() {
-    g_ZoomTarget = state->zoomTarget;
-    //debugF("zoom target", g_ZoomTarget);
-}
-
-void setZoom() {
-    readback->zoom = g_Zoom = g_ZoomTarget = state->zoom;
-    //debugF("zoom", g_ZoomTarget);
-}
-
 int
 count_pages(int iconCount)
 {
@@ -246,9 +264,19 @@
     g_DT = (newTime - g_LastTime) / 1000.f;
     g_LastTime = newTime;
 
-    //debugF("zoom", g_Zoom);
-    if (g_Zoom != g_ZoomTarget) {
-        float dz = (g_ZoomTarget - g_Zoom) * g_DT * 5;
+    if (!g_DrawLastFrame) {
+        // If we stopped rendering we cannot use DT.
+        // assume 30fps in this case.
+        g_DT = 0.033f;
+    }
+    if (g_DT > 0.2f) {
+        // physics may break if DT is large.
+        g_DT = 0.2f;
+    }
+
+    debugF("zoom", g_Zoom);
+    if (g_Zoom != state->zoomTarget) {
+        float dz = (state->zoomTarget - g_Zoom) * g_DT * 5;
         if (dz && (fabsf(dz) < 0.03f)) {
             if (dz > 0) {
                 dz = 0.03f;
@@ -256,26 +284,26 @@
                 dz = -0.03f;
             }
         }
-        if (fabsf(g_Zoom - g_ZoomTarget) < fabsf(dz)) {
-            g_Zoom = g_ZoomTarget;
+        if (fabsf(g_Zoom - state->zoomTarget) < fabsf(dz)) {
+            g_Zoom = state->zoomTarget;
         } else {
             g_Zoom += dz;
         }
-        readback->zoom = g_Zoom;
+        updateReadback();
     }
 
     // Set clear value to dim the background based on the zoom position.
-    if (g_Zoom < 0.001f) {
+    if ((g_Zoom < 0.001f) && (state->zoomTarget < 0.001f)) {
         pfClearColor(0.0f, 0.0f, 0.0f, 0.0f);
         // When we're zoomed out and not tracking motion events, reset the pos to 0.
         if (!g_LastTouchDown) {
             g_PosPage = 0;
         }
-        return 1; // 0;
-    } else if (g_Zoom < 0.99f) {
+        return lastFrame(0);
+    } else if (g_Zoom < 0.85f) {
         pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
     } else {
-        pfClearColor(0.0f, 0.0f, 0.0f, 0.99f);
+        pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
     }
 
     // icons & labels
@@ -283,10 +311,9 @@
     g_PageCount = count_pages(iconCount);
 
     updatePos(0.1f);
-    readback->posX = g_PosPage;
-    readback->velocity = g_PosVelocity;
+    updateReadback();
 
-    //debugF("    draw g_PosPage", g_PosPage);
+    debugF("    draw g_PosPage", g_PosPage);
 
     // Draw the icons ========================================
 
@@ -357,6 +384,13 @@
 
     }
 
+    {
+        float mat1[16];
+        matrixLoadIdentity(mat1);
+        vpLoadModelMatrix(mat1);
+        vpLoadTextureMatrix(mat1);
+    }
+
     // Draw the home button ========================================
     //draw_home_button();