Commits

mcc committed 30e445c

TWIST1_DEBUG, twists actually work

Comments (0)

Files changed (3)

     }
 }
 
+void display_points() {
+	if (!gl2) {
+		States(false, false);
+		int stride = VERT_STRIDE;
+		jcColor4f(1.0/3, 1.0/3, 1.0/3, 1.0);
+		glPointSize(8);
+		jcVertexPointer(2, GL_FLOAT, stride*sizeof(float), &_scratch_points[0]);
+		glDrawArrays(GL_POINTS, 0, pushed_points);                    
+	}	
+}
+
 // This is called when it is time to draw a new frame.
 void display(void)
 {	
 	// Build arrays
 	_scratch.clear(); pushed = 0;
 	_scratch_lines.clear(); pushed_lines = 0;
+#if !TWIST1_DEBUG
 	_scratch_points.clear(); pushed_points = 0;	
+#endif
 	
 	if (display_board) {
 	// Feed space objects into arrays:
 	}		
 		
 	// Arrays are built, now draw points:
-	if (!gl2) {
-		States(false, false);
-		int stride = VERT_STRIDE;
-		jcColor4f(1.0/3, 1.0/3, 1.0/3, 1.0);
-		glPointSize(8);
-		jcVertexPointer(2, GL_FLOAT, stride*sizeof(float), &_scratch_points[0]);
-		glDrawArrays(GL_POINTS, 0, pushed_points);                    
-	}
-	
+	display_points();
+		
 	// Then polys:
 	{
 		States(true, true);
 	}
 	} // display_board
         
+#if TWIST1_DEBUG
+	display_points();
+#endif
+	
 	// Interface is drawn separately [less efficiently]
 #if 1
 	if (board_obscured) {
 #endif
 }
 
+#if TWIST1_DEBUG
+void twisthit(cpVect v) {
+	ERR("TEST %d: %lf, %lf\n", ticks, (double)v.x, (double)v.y);
+	_scratch_points.push(v);
+	pushed_points++;
+}
+#endif
+
 // ------------ AUDIO ---------------
 
 #include "sound.h"
 
 unsigned int chip::updated_gen = 0;
 
-bool do_grid = true, do_dupe = false;
+bool do_dupe = false, do_grid = 
+#if TWIST1_DEBUG
+false
+#else
+true
+#endif
+;
 
 // Disk/interface stuff
 bool diskDirection = false; // If true: Saving
                 
                 program_metamouse(newstate.d, kind, i->at);
 				
+				ERR("Special? %d (not %d)\n", (int) newstate.d.special, (int)dragtouch::not_special);
+				
 				// Check for twister
 				if (newstate.d.special == dragtouch::not_special) for (alltouches_iter a = allTouches.begin(); a != allTouches.end(); a++) {
+#if TWIST1_DEBUG
+					twisthit(cpvmult(cpvadd(a->second.d.lastClick, newstate.d.lastClick), 0.5));
+#endif
 					if (a->first == i->tid || a->second.d.special != dragtouch::not_special)
 						continue;
 					cpVect center = cpvmult(cpvadd(a->second.d.lastClick, newstate.d.lastClick), 0.5);
 #define FPS 60.0
 #endif
 
+#define TWIST1_DEBUG 0
+extern void twisthit(cpVect);
+
 #define TPF ((int)(1000/FPS))
 extern int ticks;
 extern int sinceLastFrame;
 	void updateTwistOff(); // calls updateTwistLast
 	void forgetTwist();
 #endif
-    dragtouch() : dragging(NULL), draggingInto(cpvzero), lastClick(cpvzero)
+    dragtouch() : special(not_special), button(0), dragging(NULL), draggingInto(cpvzero), lastClick(cpvzero)
 #ifdef TARGET_MOBILE
 		, twistDrag(NULL), twistPartner(NULL),twistOff(0)
 #endif