44 static n_int mouse_x, mouse_y;
45 static n_byte mouse_option, mouse_identification;
49 static n_int mouse_drag_x , mouse_drag_y;
51 static n_byte key_identification;
58 static n_int toggle_pause = 0;
60 static n_int control_toggle_pause(
n_byte actual_toggle)
85 #ifdef MULTITOUCH_CONTROLS
87 touch_control_state tc_state = TCS_SHOW_NOTHING;
88 touch_control_state tc_temp_state = TCS_SHOW_NOTHING;
89 n_int tc_countdown = 0;
106 if (local_sim->
select == 0L)
111 local = local_sim->
select;
129 while (loop < local_sim->num)
134 n_uint current_squ = (screen_x * screen_x) + (screen_y * screen_y);
135 if (high_squ > current_squ)
137 high_squ = current_squ;
138 desired_ape = current_ape;
142 if (local_sim->
select != desired_ape)
159 n_int upper_x, upper_y;
161 #ifdef MULTITOUCH_CONTROLS
162 if ((tc_state & 1) == 0)
164 tc_temp_state = tc_state + 1;
173 if ((px > (upper_x/4)) && (px < ((upper_x * 3)/4)))
175 if (py < (upper_y/4))
179 else if (py < ((upper_y * 3)/4))
187 n_int sx = px - ((upper_x)>>1);
188 #ifdef MULTITOUCH_CONTROLS
189 if (px < TC_FRACTION_X)
191 if (tc_state == TCS_LEFT_STATE_CONTROLS)
193 tc_temp_state = TCS_SHOW_CONTROLS;
198 tc_temp_state = TCS_RIGHT_STATE_CONTROLS;
204 if (px > (upper_x - TC_FRACTION_X))
206 if (tc_state == TCS_RIGHT_STATE_CONTROLS)
208 tc_temp_state = TCS_SHOW_CONTROLS;
213 tc_temp_state = TCS_LEFT_STATE_CONTROLS;
240 if (local_sim->
select == 0L)
245 local = local_sim->
select;
247 if ((num > 27) && (num < 32))
252 being_move(local, (1 - ((num - 28) << 1)), 0);
254 being_move(local, (160-((num - 28) << 6)), 1);
261 if ((num > 2075) && (num < 2078))
263 being_move(local, ( -1 + ((2077-num) << 1)), 0);
265 if ((num > 2077) && (num < 2080))
273 static n_int script_entry = 1;
275 static n_int shared_script_debug_ready(
void)
277 if (script_entry == 0)
311 void * sim_return = 0L;
328 ticks = ticks & 67108863;
333 if ((mouse_down == 1) && (mouse_identification == fIdentification))
339 control_mouse(mouse_identification, mouse_x/2, mouse_y/2, mouse_option);
341 control_mouse(mouse_identification, mouse_x, mouse_y, mouse_option);
346 control_mouse(mouse_identification, mouse_x, mouse_y, mouse_option);
350 #ifdef MULTITOUCH_CONTROLS
351 if ((mouse_down == 0) && (mouse_identification == fIdentification))
353 if (tc_temp_state != tc_state)
355 tc_state = tc_temp_state;
360 if((key_down == 1) && (key_identification == fIdentification))
364 control_key(key_identification, key_value);
370 #ifdef MULTITOUCH_CONTROLS
374 if (tc_countdown == 0)
376 if ((tc_state & 1) == 1)
378 tc_temp_state = tc_state - 1;
388 if (shared_script_debug_ready())
413 return SHOW_ERROR(
"Initialization failed lack of memory");
429 key_identification = fIdentification;
439 mouse_option = option;
445 mouse_identification = fIdentification;
463 sprintf(full_value,
"%s %ld Cores", value, cores);
467 sprintf(full_value,
"%s 1 Core", value);
479 static n_int NewBlock = 0;
480 if (NewBlock)
return 0;
492 (void)control_toggle_pause(0);
503 (void)control_toggle_pause(0);
511 n_int integer_rotation_256 = (
n_int)((num * 256) / 360);
525 return control_toggle_pause(1);
537 (void)control_key(0, 2079);
540 (void)control_key(0, 2078);
564 n_int loopColors = 0;
569 n_c_uint * offscreenBuffer = (n_c_uint *) outputBuffer;
570 n_c_uint colorLookUp[256];
572 n_byte colorLookUp[256][3];
574 if (index == 0L)
return;
584 while(loopColors < 256)
587 n_byte colR = fit[loop++] >> 8;
588 n_byte colG = fit[loop++] >> 8;
589 n_byte colB = fit[loop++] >> 8;
590 colorLookUp[ loopColors ] = (colR << 16) | (colG << 8) | (colB << 0);
592 colorLookUp[loopColors][0] = fit[loop++] >> 8;
593 colorLookUp[loopColors][1] = fit[loop++] >> 8;
594 colorLookUp[loopColors][2] = fit[loop++] >> 8;
606 n_byte * indexLocalX = &index[(255-(ly>>1))*256];
610 io_copy(&outputBuffer[loop - (3*512)], &outputBuffer[loop], (3*512));
618 unsigned char value = indexLocalX[lx++] ;
619 outputBuffer[loop++] = colorLookUp[value][0];
620 outputBuffer[loop++] = colorLookUp[value][1];
621 outputBuffer[loop++] = colorLookUp[value][2];
622 outputBuffer[loop++] = colorLookUp[value][0];
623 outputBuffer[loop++] = colorLookUp[value][1];
624 outputBuffer[loop++] = colorLookUp[value][2];
642 n_byte * indexLocalX = &index[(dim_y-ly-1)*dim_x];
646 offscreenBuffer[loop++] = colorLookUp[ indexLocalX[ lx++ ] ];
648 unsigned char value = indexLocalX[lx++] ;
649 outputBuffer[loop++] = colorLookUp[value][0];
650 outputBuffer[loop++] = colorLookUp[value][1];
651 outputBuffer[loop++] = colorLookUp[value][2];