예제 #1
0
파일: elevator.c 프로젝트: sigmax6/sigmav
void show_message(void)
{	
	int loop = 5;
	int new_get = 0;
	int des_get = 0;
	int next_floor = 0;
	
	printf("#%d : stop\n", floor);

	while(1)
	{
		if(state == UP)
		{
			next_floor = get_up_next_floor();
			if(next_floor == floor)
			{ open_door(UP, next_floor); }
			else if(next_floor > floor)
			{ move_up(); }
			else if(next_floor < 1)
			{ move_stop(); }
		}
		else if(state == DOWN)
		{
			next_floor = get_down_next_floor();
			if(next_floor == floor)
			{ open_door(DOWN, next_floor); }
			else if(next_floor < floor)
			{ move_down(); }
			else if(next_floor > NUM)
			{ move_stop(); }
		}
		else if(state == STOP)
		{
			if(open_flag)
			{
				open_door(NONE, 0);
				open_flag = 0;
			}
			else
			{
				next_floor = get_up_next_floor();
				if(next_floor == floor)
				{ open_door(UP, next_floor); }
				else if(next_floor > floor)
				{ move_up(); }
				else if(next_floor < 1)
				{
					next_floor = get_down_next_floor();
					if(next_floor == floor)
					{ open_door(DOWN, next_floor); }
					else if(next_floor < floor)
					{ move_down(); }				
				}
			}
		}
	}	
}
예제 #2
0
void touch( void )
{

    freeze(1);
    move_stop(1, 6, 300,1 );
    sp_dir(1,4);
    if (&caveguy == 2)
    {
        say_stop("This looks like the place, but it's locked.", 1);
        say_stop("Maybe I should try knocking..", 1);
        unfreeze(1);

        return;
    }

    if (&caveguy == 3)
    {
        say_stop("I hope that damn old man gives me that spell.", 1);
        unfreeze(1);
        return;
    }

    say("It's locked.", 1);
    unfreeze(1);
}
예제 #3
0
/*** get keypad input ****/
void get_keypad_input() {  
  char keypad_key;
  keypad_enable();
  while(training) {
    keypad_key=getkey();          // get value from keypad
    wait_keyup();
    lcd_init();
    set_lcd_addr(0x00);
    if(keypad_key==1) {           // 1 = forward
      move_forward();               
    }else if(keypad_key==4) {     // 4 = left
      move_left();
    }else if(keypad_key==7) {     // 7 = right
      move_right();
    }else if(keypad_key==0) {     // 0 = reverse
      move_reverse();
    }else if(keypad_key==6) {     // 7 = pause
      move_pause();
    }else if(keypad_key==9) {     // break out of training mode
      training=0;
      move_stop();
      display_movement(&stop_training);
      break;
    }else{
      display_movement(&error);
    }
    ms_delay(50);
  }
}
예제 #4
0
void move_smart_car(int left_ms, int right_ms) {
    
    while (left_ms != 0 || right_ms != 0)
    {
        // Handle Left Side Wheels.
            
        // Run left wheel motors forward/counter-clockwise if ms is positive, 
        // reverse if negative, 
        // nothing if zero.
        if (left_ms > 0)
        {
            digitalWrite(LEFT_MD_A, HIGH);
            digitalWrite(LEFT_MD_B, LOW);
            left_ms = left_ms - 1;
            analogWrite(LEFT_MOTOR_EN, motor_speed);
        }
        else if (left_ms < 0)
        {
            digitalWrite(LEFT_MD_A, LOW);
            digitalWrite(LEFT_MD_B, HIGH);
            left_ms = left_ms + 1;
            analogWrite(LEFT_MOTOR_EN, motor_speed);
        }
        else
        {
        	analogWrite(LEFT_MOTOR_EN, 0);
        }
        
   
        // Handle Right Side Wheels.
        
        // Run right wheel motors forward/clockwise if ms is positive, 
        // reverse if negative, 
        // nothing if zero.
     	if (right_ms > 0)
     	{
            digitalWrite(RIGHT_MD_A, LOW);
            digitalWrite(RIGHT_MD_B, HIGH);
            right_ms = right_ms - 1;
            analogWrite(RIGHT_MOTOR_EN, motor_speed);
        }
        else if (right_ms < 0)
        {
            digitalWrite(RIGHT_MD_A, HIGH);
            digitalWrite(RIGHT_MD_B, LOW);
            right_ms = right_ms + 1;
            analogWrite(RIGHT_MOTOR_EN, motor_speed);
        }
        else
        {
        	analogWrite(RIGHT_MOTOR_EN, 0);
        }

        // Run the motors for one ms.
	    delay(1);
    }
    
    move_stop();
    delay(change_in_direction_pause_time);
}
예제 #5
0
파일: agent.cpp 프로젝트: destrojan/wotwar
void AGENT::update_fight(GROUP* target_group)
{
	// get target
	AGENT * t = find_target(target_group); //group->is_single_unit() ? find_target(target_group) : find_target_random(target_group);
	if (!t) return; // didn't find one

	// fight
	move_mult(collision ? 3.0 : 1.0);
	set_dest(t->get_x(), t->get_y());
	if (dist_dest() > (t->getRadius() + getRadius()) * 2) { // move to target
		fight_timer--;
		if (!collision) move((int)get_dest_x(), (int)get_dest_y(), true); // move
		else collision_avoid(); // collision avoid
		state = AGENT::READY_FIGHT;
		setAnimation(is_stuckcounter() ? ANIMATION_DATA::STAND : ANIMATION_DATA::MOVE, true);
	} else { // at target
		move_stop();
		state = AGENT::FIGHTING;
		if (is_near_dest_angle(45)) { // deal damage
			set_dest(x, y);
			t->hurt_by(unitData->damage, this);
			setAnimation(ANIMATION_DATA::ATTACK, true);
		} else { // face target
			fight_timer--;
			rotate_towards((int)get_angle_dest());
			if (!is_near_dest_angle(90)) setAnimation(ANIMATION_DATA::STAND, true);
		}
	}

	// single units sync group position with their own
	if (group->is_single_unit()) group->sync_to(this);

	// update gemeric stuff
	update();
}
예제 #6
0
/*** Move pause ***/
void move_pause() {
  display_movement(&pause);
  MOTORDDR=0xFF;                  // enable motor port as output
  MOTORPORT=0xFF;
  ms_delay(2000);
  if(training) {
    add_to_array(5);              // if training mode boolean is 1, add direction to array
  }
  move_stop();                    // turn off all motor ports
}
예제 #7
0
/*** Move right ***/
void move_right() {
  int i=0;
  for(i=0; i!=1; i++) {
    display_movement(&right);
    MOTORDDR=0xFF;                // enable motor port as output
    MOTORPORT=0xFB;               // turn on motor port(1)
    ms_delay(850);
  }
  if(training) {                  // if training mode boolean is 1, add direction to array
    add_to_array(3);
  }
  move_stop();
}
예제 #8
0
파일: continue.c 프로젝트: wijnen/pydink
void click ()
{
	freeze (1);
	load_game (-1);
	// This is reached if the game didn't exist.
	sp_brain (g_dink, "person");
	sp_base_idle (g_dink, "idle");
	sp_base_walk (g_dink, "walk");
	sp_timing (g_dink, 33);
	sp_speed (g_dink, 2);
	freeze (g_dink);
	move_stop (g_dink, 2, 400, 1);
	sp_dir (g_dink, 2);
	say_stop ("Continue?", g_dink);
	say_stop ("You haven't even started yet!", g_dink);
	say_stop ("Hmpf!", g_dink);
	move_stop (g_dink, 8, 350, 1);
	sp_y (g_dink, 350);
	sp_seq (g_dink, collection_code ("walk") + 3);
	sp_brain (g_dink, "repeat");
	sp_brain (1, "pointer");
	unfreeze (1);
}
예제 #9
0
파일: main.c 프로젝트: texane/dibal
static void light_tracker_stop(light_tracker_state_t* lts)
{
  if (lts->is_done)
    return ;

  move_stop();

  if (lts->timer != NULL)
    {
      sched_del_timer(lts->timer);
      lts->timer = NULL;
    }

  lts->is_done = 1;
}
예제 #10
0
파일: main.c 프로젝트: texane/dibal
static void object_avoider_stop(object_avoider_state_t* oas)
{
  if (oas->is_done)
    return ;

  move_stop();

  if (oas->timer != NULL)
    {
      sched_del_timer(oas->timer);
      oas->timer = NULL;
    }

  oas->is_done = 1;
}
예제 #11
0
void talk( void )
{
 freeze(1);
 say_stop("`0To get passage on the boat with Death", &current_sprite);
 say_stop("`0please order the full version.", &current_sprite);
 wait(200);
 say_stop("`0You'll be glad you did!", &current_sprite);
 move_stop(1, 2, 147, 1);
 wait(200);
 say_stop("Buy me please!", 1);
 if(&story > 4)
 {
 say_stop("My Mom's dead and I need a home.", 1);
 }
 unfreeze(1);
}
예제 #12
0
파일: agent.cpp 프로젝트: destrojan/wotwar
void AGENT::update_normal(void)
{
	int tx, ty;

	state = AGENT::NORMAL;

	// Logic
	if (!is_dest() && !at_unreachable_dest()) {
		// move faster if out of position
		if (within_dist_dest(unitData->radius * 2)) move_mult(1.0);
		else if (within_dist_dest(unitData->radius * 4)) move_mult(1.1);
		else move_mult(1.8);
		// animation
		setAnimation(ANIMATION_DATA::MOVE, true);
	} else {
		// clear last swap memory
		last_swap = -1;
		// don't move
		if (!is_dest_angle() && group->task_type() == TASK::MOVE) rotate_towards((int)group->get_angle_dest()); // rotate towards target
		else if (rotate_to_group) {
			if (!is_angle(group->get_rotation())) rotate_towards((int)group->get_rotation()); // rotate to group direction
			else end_rotate_to_group();
		}
		move_stop();
		if (!is_moving()) setAnimation(ANIMATION_DATA::STAND, true);
	}

	// Movement
	if (group->is_single_unit()) sync_to(group);
	else {
		swap_count--;
		if (!collision) move((int)get_dest_x(), (int)get_dest_y(), !group->is_moving()); // no collision
		else if (!is_dest() && (!agent_collided || agent_collided->getGroup() != getGroup()) && dist_dest() < group->get_radius()) {
		    if (agent_collided) shorten_dest(2 * getRadius());
		    else {
		        set_dest(group->get_x(), group->get_y());
		        shorten_dest(100);
		    }
		} else if (agent_collided && !is_dest() && group->is_dest_angle() && agent_collided->is_near_dest_angle(35) && agent_collided->is_near_dest() && is_near_angle(agent_collided->get_rotation(), 35) && agent_collided->getGroup() == getGroup() && ((!is_last_swap(agent_collided->get_sort_id()) && !agent_collided->is_last_swap(sort_id)) || swap_count < 0)) { // swap group positions
			swap_positions(agent_collided); // in same group, do it
		}
		else collision_avoid(); // collision
	}

	// generic update
	update();
}
예제 #13
0
파일: agent.cpp 프로젝트: destrojan/wotwar
void AGENT::update_rangedfight(GROUP* target_group)
{
	// get target
	AGENT * t = find_target_random(target_group);
	if (!t) return; // didn't find one

	// fight
	move_mult(collision ? 3.0 : 1.0);
	set_dest(t->get_x(), t->get_y());
	if (dist_dest() > unitData->range - group->get_radius()/2) { // move to target
		fight_timer--;
		if (!collision) move((int)get_dest_x(), (int)get_dest_y(), true); // move
		else collision_avoid(); // collision avoid
		state = AGENT::READY_FIGHT;
		setAnimation(is_stuckcounter() ? ANIMATION_DATA::STAND : ANIMATION_DATA::MOVE, true);
	} else { // close enough to target
		move_stop();
		state = AGENT::FIGHTING;
		double angle = rotation * M_PI / 180.;
		double angle_target = angle_to(t->get_x() - unitData->r_horiz_offset*cos(angle + M_PI/2), t->get_y() - unitData->r_horiz_offset*sin(angle + M_PI/2));
		if (is_near_angle(angle_target, 15) || group->is_building()) { // deal damage
			// create projectile
			if (frame_num() == unitData->rattack_frame) {
			    if (is_first_frame_display()) {
			        double t_angle = angle_target*M_PI/180;
			        int plife = (int)(dist_to(t->get_x(), t->get_y()) - getRadius() - 2*t->getRadius());
                    part_sys.add(attack_type->particle, x + getRadius()*cos(t_angle) + unitData->r_horiz_offset*cos(t_angle + M_PI/2), y + getRadius()*sin(t_angle) + unitData->r_horiz_offset*sin(t_angle + M_PI/2), angle_target, (plife > 0) ? plife : t->getRadius(), attack_type, t->getGroup(), t->get_id(), group->get_id());
			    }
			}
            // unit stuff
            set_dest(x, y);
			setAnimation(ANIMATION_DATA::RANGED, true);
		} else { // face target
			fight_timer--;
			rotate_towards((int)angle_target);
			if (!is_near_angle(angle_target, 20)) setAnimation(ANIMATION_DATA::STAND, true);
		}
	}

	// single units sync group position with their own
	if (group->is_single_unit()) group->sync_to(this);

	// update gemeric stuff
	update();
}
예제 #14
0
void loop()
{
    if (Serial.available() > 0)
    {
        int command = Serial.read();
        Serial.print(command, DEC);
        Serial.print(" ");
        switch (command)
        {
            case 1:
            move_stop();
            delay(500);
            move_forward();
            break;
            case 2:
            move_stop();
            delay(500);
            turn_left();
            break;
            case 3:
            move_stop();
            delay(500);
            turn_right();
            break;
            case 4:
            move_stop();
            delay(500);
            move_backward();
            break;
            case 5:
            move_stop();
            break;
            case 6:
            front_led_control(true);
            break;
            case 7:
            front_led_control(false);
            break;
            case 8:
            rear_led_control(true);
            break;
            case 9:
            rear_led_control(false);
            break;
            default:
            move_stop();
            front_led_control(false);
            rear_led_control(false);
        }
    }
}
예제 #15
0
void talk( void )
{
freeze(1);
freeze(&current_sprite);
    choice_start();
   "Tell the duck to go home"
   "Yell at it"
    choice_end();
   if (&result == 1)
   {
 wait(500);
 say_stop("Hey little duck, you gotta get home to Ethel.", 1);
 wait(500);
 say_stop("`0QUACK!!", &current_sprite);
 wait(500);
   }
   if (&result == 2)
   {
 wait(500);
 say_stop("You suck little duck guy, not even I run away from home.", 1);
 wait(250);
 say_stop("You should be ashamed.", 1);
 wait(500);
 say_stop("`0Bite me", &current_sprite);
 wait(250);
 say_stop("`0But fine, I'll go home...", &current_sprite);
 wait(500);
 &old_womans_duck = 2;
 sp_speed(&current_sprite, 2);
 sp_timing(&current_sprite, 0);

 move_stop(&current_sprite, 8, -12, 1);
 sp_active(&current_sprite, 0);

   }
unfreeze(1);
unfreeze(&current_sprite);
}
예제 #16
0
/*** Move forward ***/
void move_forward() {
  int i=0;
  int sensor_detect=0;
  for(i=0; i!=8; i++) {           // loop 8 times and detect objects every 250 ms
    display_movement(&forward);
    
    /* Detect any objects in the way */
    sensor_detect = get_sensor_data();
    while(sensor_detect){
      MOTORPORT=0xFF;
      //stop execution of queue
      ms_delay(250);
      sensor_detect = get_sensor_data();
    }
    
    MOTORDDR=0xFF;                // enable motor port as output
    MOTORPORT=0xFA;               // turn on motor port(0)
    ms_delay(250);
  }
  if(training) {                  // if training mode boolean is 1, add direction to array
    add_to_array(1);
  }
  move_stop();
}
예제 #17
0
void main( void )
{

 preload_seq(251);
 preload_seq(253);
 preload_seq(257);
 preload_seq(259);

 if (&mayor == 1)
 {
  return;
 }

 if (&mayor == 2)
 {
  return;
 }

 if (&mayor == 5)
 {
  playmidi("lovin.mid");

  freeze(1);
  preload_seq(253);
  preload_seq(251);
  preload_seq(257);
  preload_seq(259);
  preload_seq(271);
  preload_seq(273);
  preload_seq(277);
  preload_seq(279);
  preload_seq(281);
  preload_seq(283);
  preload_seq(287);
  preload_seq(289);
  preload_seq(371);
  preload_seq(373);
  preload_seq(377);
  preload_seq(379);
  preload_seq(361);
  preload_seq(363);
  preload_seq(367);
  preload_seq(369);
  preload_seq(411);
  preload_seq(413);
  preload_seq(417);
  preload_seq(419);
  preload_seq(291);
  preload_seq(293);
  preload_seq(297);
  preload_seq(299);
  int &pp1;
  int &pp2;
  int &pp3;
  int &pp4;
  int &pp5;
  int &pp6;
  int &pp7;
  int &pp8;
  int &pp9;
  int &woman;
  int &mp1;
  int &mp2;
  int &mp3;
  int &mp4;
  int &mp5;
  int &mp6;
  int &mp7;
  //Actually Spawn the girl, and her script
  &woman = create_sprite(400, 110, 0, 0, 0);
  sp_brain(&woman, 16);
  sp_base_walk(&woman, 250);
  sp_speed(&woman, 1);
  sp_timing(&woman, 0);
  //set starting pic
  sp_pseq(&woman, 253);
  sp_pframe(&woman, 1);
  //Create more & more & more!!
  &pp1 = create_sprite(125, 115, 0, 0, 0);
  sp_brain(&pp1, 16);
  sp_base_walk(&pp1, 270);
  sp_speed(&pp1, 1);
  sp_timing(&pp1, 0);
sp_script(&pp1, "s3-peeps");
  //set starting pic
  sp_pseq(&pp1, 273);
  sp_pframe(&pp1, 1);
  &pp2 = create_sprite(250, 141, 0, 0, 0);
  sp_brain(&pp2, 16);
sp_script(&pp2, "s3-peeps");

  sp_base_walk(&pp2, 280);
  sp_speed(&pp2, 1);
  sp_timing(&pp2, 0);
  //set starting pic
  sp_pseq(&pp2, 283);
  sp_pframe(&pp2, 1);
  &pp3 = create_sprite(45, 370, 0, 0, 0);
  sp_brain(&pp3, 16);
  sp_base_walk(&pp3, 370);
  sp_speed(&pp3, 1);
sp_script(&pp3, "s3-peeps");

  sp_timing(&pp3, 0);
  //set starting pic
  sp_pseq(&pp3, 379);
  sp_pframe(&pp3, 1);
  &pp4 = create_sprite(410, 380, 0, 0, 0);
  sp_brain(&pp4, 16);
  sp_base_walk(&pp4, 360);
  sp_speed(&pp4, 1);
  sp_timing(&pp4, 0);
  //set starting pic
  sp_pseq(&pp4, 367);
  sp_pframe(&pp4, 1);
sp_script(&pp4, "s3-peeps");

  &pp5 = create_sprite(520, 360, 0, 0, 0);
  sp_brain(&pp5, 16);
  sp_base_walk(&pp5, 410);
  sp_speed(&pp5, 1);
  sp_timing(&pp5, 0);
  //set starting pic
  sp_pseq(&pp5, 417);
  sp_pframe(&pp5, 1);
sp_script(&pp5, "s3-peeps");

  &pp6 = create_sprite(70, 180, 0, 0, 0);
  sp_brain(&pp6, 16);
  sp_base_walk(&pp6, 220);
  sp_speed(&pp6, 1);
  sp_timing(&pp6, 0);
  //set starting pic
  sp_pseq(&pp6, 223);
  sp_pframe(&pp6, 1);
sp_script(&pp6, "s3-peeps");

  &pp7 = create_sprite(320, 400, 0, 0, 0);
  sp_brain(&pp7, 16);
  sp_base_walk(&pp7, 220);
  sp_speed(&pp7, 1);
  sp_timing(&pp7, 0);
  //set starting pic
  sp_pseq(&pp7, 229);
  sp_pframe(&pp7, 1);
sp_script(&pp7, "s3-peeps");

  &pp8 = create_sprite(295, 50, 0, 0, 0);
  sp_brain(&pp8, 16);
  sp_base_walk(&pp8, 370);
  sp_speed(&pp8, 1);
  sp_timing(&pp8, 0);
  //set starting pic
  sp_pseq(&pp8, 373);
  sp_pframe(&pp8, 1);
sp_script(&pp8, "s3-peeps");

  &pp9 = create_sprite(175, 350, 0, 0, 0);
  sp_brain(&pp9, 16);
  sp_base_walk(&pp9, 390);
  sp_speed(&pp9, 1);
  sp_timing(&pp9, 0);
  //set starting pic
  sp_pseq(&pp9, 399);
  sp_pframe(&pp9, 1);
sp_script(&pp9, "s3-peeps");

  //Let's Go movers!!
  &mp1 = create_sprite(640, 200, 0, 0, 0);
  sp_brain(&mp1, 16);
  sp_base_walk(&mp1, 290);
  sp_speed(&mp1, 1);
  sp_timing(&mp1, 0);
  //set starting pic
  sp_pseq(&mp1, 291);
  sp_pframe(&mp1, 1);
  &mp2 = create_sprite(640, 305, 0, 0, 0);
  sp_brain(&mp2, 16);
  sp_base_walk(&mp2, 290);
  sp_speed(&mp2, 1);
  sp_timing(&mp2, 33);
  //set starting pic
  sp_pseq(&mp2, 291);
  sp_pframe(&mp2, 1);
  &mp3 = create_sprite(640, 320, 0, 0, 0);
  sp_brain(&mp3, 16);
  sp_base_walk(&mp3, 380);
  sp_speed(&mp3, 1);
  sp_timing(&mp3, 20);
  //set starting pic
  sp_pseq(&mp3, 381);
  sp_pframe(&mp3, 1);
  &mp4 = create_sprite(700, 340, 0, 0, 0);
  sp_brain(&mp4, 16);
  sp_base_walk(&mp4, 370);
  sp_speed(&mp4, 1);
  sp_timing(&mp4, 0);
  //set starting pic
  sp_pseq(&mp4, 371);
  sp_pframe(&mp4, 1);
  &mp5 = create_sprite(670, 210, 0, 0, 0);
  sp_brain(&mp5, 16);
  sp_base_walk(&mp5, 390);
  sp_speed(&mp5, 1);
  sp_timing(&mp5, 33);
  //set starting pic
  sp_pseq(&mp5, 391);
  sp_pframe(&mp5, 1);
  &mp6 = create_sprite(710, 180, 0, 0, 0);
  sp_brain(&mp6, 16);
  sp_base_walk(&mp6, 410);
  sp_speed(&mp6, 1);
  sp_timing(&mp6, 0);
  //set starting pic
  sp_pseq(&mp6, 411);
  sp_pframe(&mp6, 1);
  &mp7 = create_sprite(640, 175, 0, 0, 0);
  sp_brain(&mp7, 16);
  sp_base_walk(&mp7, 290);
  sp_speed(&mp7, 1);
  sp_timing(&mp7, 16);
  //set starting pic
  sp_pseq(&mp7, 291);
  sp_pframe(&mp7, 1);
  //Let's Go
  freeze(&woman);
  freeze(&pp1);
  freeze(&pp2);
  //wait(1);
  freeze(&pp3);
  freeze(&pp4);
  freeze(&pp5);
  freeze(&pp6);
  freeze(&pp7);
  freeze(&pp8);
  freeze(&pp9);
	
  freeze(&mp1);
  freeze(&mp2);
  freeze(&mp3);
  freeze(&pp4);
  freeze(&mp4);
  freeze(&mp6);
  freeze(&mp7);
  move(&mp1, 4, -1500, 1);
  move(&mp2, 4, -1500, 1);
  move(&mp3, 4, -1500, 1);
  move(&mp4, 4, -1500, 1);
  move(&mp5, 4, -1500, 1);
  move(&mp6, 4, -1500, 1);
  move(&mp7, 4, -1500, 1);
  wait(500);
  say_stop("`9Dink, Dink, over here.", &woman);
  move_stop(1, 2, 105, 1);
  move_stop(1, 6, 450, 1);
  say_stop("`9Isn't it just beautiful?", &woman);
  sp_dir(1, 4);
  wait(250);
  say_stop("Yup, it's a parade allright.", 1);
  wait(250);
  say_stop("A lot of people too, I shudder at what could've happened.", 1);
  wait(250);
  say_stop("`9You really saved the town Dink...", &woman);
  wait(250);
  say_stop("`9I'm really proud of you.", &woman);
  wait(250);
  say_stop("Thanks, but I couldn't have done it without you.", 1);
  wait(250);
  say_stop("`9Well I have to be going, I have to meet with my father.", &woman);
  wait(250);
  say_stop("`9Take care Dink, I hope I'll see you again.", &woman);
  wait(1000);
  unfreeze(&pp1);
  unfreeze(&pp2);
  unfreeze(&pp3);
  unfreeze(&pp4);
  unfreeze(&pp5);
  unfreeze(&pp6);
  unfreeze(&pp7);
  unfreeze(&pp8);
  unfreeze(&pp9);
  sp_dir(1, 2);
  move_stop(&woman, 3, 660, 1);
  say_stop("Oh, you will baby, you will...", 1);
  &story = 10;
  &mayor = 6;
  unfreeze(1);
  return;
 }

 if (&mayor == 6)
 {
  int &loser;
  &loser = create_sprite(350, 210, 0, 0, 0);
  sp_brain(&loser, 16);
  sp_base_walk(&loser, 410);
  sp_speed(&loser, 1);
  sp_timing(&loser, 0);
  sp_pseq(&loser, 413);
  sp_pframe(&loser, 1);
  sp_script(&loser, "s3-loser");
  return;
 }

 if (&mayor == 7)
 {
  return;
 }
  int &poopy;
  int &woman;
  //Actually Spawn the girl, and her script
  &woman = create_sprite(300, 130, 0, 0, 0);
  sp_brain(&woman, 16);
  sp_base_walk(&woman, 250);
  sp_speed(&woman, 1);
  sp_timing(&woman, 0);
  //set starting pic
  sp_pseq(&woman, 253);
  sp_pframe(&woman, 1);
  sp_script(&woman, "s3-chick");
}
예제 #18
0
파일: intro.c 프로젝트: wijnen/pydink
void main ()
{
	if (debug)
	{
		player_map = 400;
		sp_x (1, 320);
		sp_y (1, 200);
		kill_this_task ();
	}
	script_attach (1000);
	player_map = 1;
	dink_can_walk_off_screen (1);
	sp_x (1, 320);
	sp_y (1, 500);
	load_screen ();
	draw_screen ();
	wait (1);
	int daniel = sp ("daniel-intro");
	int knight = create_sprite (320, 500, "none", "silverknight 7", 1);
	sp_base_walk (knight, "silverknight");
	freeze (1);
	sp_speed (knight, 3);
	freeze (knight);
	move_stop (knight, 8, 270, 1);
	say_stop ("`7Sire! Listen!", knight);
	say_stop ("`3What is it, John?", daniel);
	say_stop ("`7The maid in the bar says Dink has been rude to her!", knight);
	say_stop ("`3What?! That's outrageous!", daniel);
	say_stop ("`3Fetch him for me!", daniel);
	say_stop ("`7At once, sire!", knight);
	move_stop (knight, 2, 500, 1);
	sp_active (knight, 0);
	say_stop ("`3What would be a good punishment...", daniel);
	sp_x (1, 320);
	sp_y (1, 500);
	move_stop (1, 8, 270, 1);
	say_stop ("`3SMALLWOOD HAS RETURNED!", daniel);
	say_stop ("And his ears hurt...", 1);
	say_stop ("`3Dink! Your behaviour is intolerable!", daniel);
	say_stop ("`3You are banished from the kingdom!", daniel);
	say_stop ("Whatever you say, Danny. Bye!", 1);
	move_stop (1, 2, 500, 1);
	say_stop ("`3I hope that was a good idea...", daniel);
	fade_down_stop ();
	player_map = 400;
	load_screen ();
	draw_screen ();
	wait (1);
	bedink.main ();
	freeze (1);
	sp_x (1, 320);
	sp_y (1, -50);
	fade_up_stop ();
	move_stop (1, 2, 200, 1);
	say_stop ("Hmm, what to do now?", 1);
	say_stop ("I need money to buy food...", 1);
	say_stop ("Stealing is too evil for me...", 1);
	say_stop ("Unless... That's an idea!", 1);
	fade_down_stop ();
	say_stop_xy ("Dink decided to steal only from those who could spare it.", 10, 200);
	say_stop_xy ("When he wasn't 'working', he wore armour to hide himself.", 10, 200);
	say_stop_xy ("After a few years, he had become a very skilled thief.", 10, 200);
	say_stop_xy ("Then, one night...", 10, 200);
	beknight.main ();
	save_game (-1);
	kill_this_task ();
}
예제 #19
0
파일: ordering.c 프로젝트: wijnen/pydink
void order()
{
	sp_brain (g_adelbrecht, "person");
	sp_brain (g_dink, "person");
	sp_brain (g_eggeric, "person");
	sp_brain (g_machteld, "person");
	freeze (g_adelbrecht);
	freeze (g_dink);
	freeze (g_eggeric);
	freeze (g_machteld);
	sp_base_walk (g_adelbrecht, "soldier");
	sp_base_walk (g_dink, "walk");
	sp_base_walk (g_eggeric, "merchant");
	sp_base_walk (g_machteld, "bluemaiden");
	sp_timing (g_dink, 33);
	sp_speed (g_dink, 2);
	move_stop (g_dink, 2, 400, 1);
	say_stop ("I'll do some ordering for you!", g_dink);
	sp_pseq (g_dink, "walk 7");
	sp_pseq (g_eggeric, "merchant 1");
	sp_pseq (g_machteld, "bluemaiden 1");
	say_stop ("Adelbrecht, turn around!", g_dink);
	say_stop ("`9Allright, relax.", g_adelbrecht);
	sp_pseq (g_adelbrecht, "soldier 7");
	sp_pseq (g_dink, "walk 9");
	say_stop ("Eggeric, sit down!", g_dink);
	sp_brain (g_eggeric, "none");
	say_stop ("`0I don't take orders from you!", g_eggeric);
	sp_pseq (g_dink, "walk 4");
	say_stop ("Daniel, sit straight!", g_dink);
	sp_pseq (g_machteld, "bluemaiden 1");
	say_stop ("`#Er, excuse me, Dink?", g_machteld);
	sp_pseq (g_dink, "walk 6");
	sp_pseq (g_adelbrecht, "soldier 3");
	say_stop ("Yes, dear?", g_dink);
	sp_pseq (g_eggeric, "merchant 3");
	say_stop ("`#I think 'ordering' is about buying this game.", g_machteld);
	sp_pseq (g_eggeric, "merchant 1");
	say_stop ("Buying?", g_dink);
	say_stop ("You mean it's not free?", g_dink);
	sp_pseq (g_eggeric, "merchant 3");
	say_stop ("`#I think so...", g_machteld);
	sp_pseq (g_eggeric, "merchant 1");
	say_stop ("No way!", g_dink);
	say_stop ("Don't you know who wrote this?", g_dink);
	say_stop ("Bas Wijnen, [email protected]!", g_dink);
	say_stop ("`9I thought it was shevek", g_adelbrecht);
	sp_pseq (g_dink, "walk 7");
	say_stop ("That's his nickname.", g_dink);
	say_stop ("`9Oh, right. Sorry.", g_adelbrecht);
	sp_pseq (g_dink, "walk 6");
	say_stop ("He's a free software freak!", g_dink);
	say_stop ("Anything he writes is free and open source.", g_dink);
	sp_pseq (g_eggeric, "merchant 3");
	say_stop ("`#But why did he put this button in then?", g_machteld);
	say_stop ("`#I'm sure he doesn't want you to give orders.", g_machteld);
	sp_pseq (g_eggeric, "merchant 1");
	say_stop ("No, that's true.", g_dink);
	say_stop ("I suppose he just used all the available buttons", g_dink);
	say_stop ("His editor doesn't support custom artwork yet, you know.", g_dink);
	sp_pseq (g_eggeric, "merchant 3");
	say_stop ("`#Oh, really?", g_machteld);
	say_stop ("`#He should fix that.", g_machteld);
	sp_pseq (g_eggeric, "merchant 1");
	say_stop ("Indeed.", g_dink);
	say_stop ("`0Hey you, with the ugly clothes!", g_eggeric);
	sp_pseq (g_dink, "walk 9");
	say_stop ("Are you talking to me?", g_dink);
	say_stop ("`0You bet I am!", g_eggeric);
	say_stop ("`0Are you done talking to my wife?", g_eggeric);
	say_stop ("`0Why are you called Dink, and the king Daniel?", g_eggeric);
	say_stop ("`0And why is my wife called Machteld?", g_eggeric);
	say_stop ("Of course the king really should be called emperor Karel", g_dink);
	say_stop ("Or Charlemagne in English.", g_dink);
	say_stop ("And I should be called Elegast.", g_dink);
	say_stop ("Or Elbegast in English.", g_dink);
	say_stop ("But then faithful Dink-players would get confused.", g_dink);
	say_stop ("Now Machteld is a different story.", g_dink);
	say_stop ("She doesn't have a name in the original story.", g_dink);
	say_stop ("But this game is made in honour of her birthday.", g_dink);
	say_stop ("`3You told me it was to test your dmod builder!", g_daniel);
	sp_pseq (g_dink, "walk 4");
	say_stop ("Yes, that too.", g_dink);
	sp_pseq (g_adelbrecht, "soldier 1");
	say_stop ("`#What?", g_machteld);
	sp_pseq (g_adelbrecht, "soldier 3");
	sp_pseq (g_eggeric, "merchant 3");
	sp_pseq (g_dink, "walk 6");
	say_stop ("`#But I thought it was for me!", g_machteld);
	sp_pseq (g_eggeric, "merchant 1");
	say_stop ("It is!", g_dink);
	sp_pseq (g_eggeric, "merchant 3");
	say_stop ("`#Pff, you just say that!", g_machteld);
	sp_pseq (g_eggeric, "merchant 1");
	say_stop ("No, really!", g_dink);
	say_stop ("Oh, forget it!", g_dink);
	move_stop (g_dink, 8, 350, 1);
	sp_y (g_dink, 350);
	sp_brain (g_dink, "repeat");
	sp_seq (g_dink, "walk 3");
	sp_pseq (g_adelbrecht, "soldier 3");
	sp_brain (g_adelbrecht, "repeat");
	sp_pseq (g_eggeric, "merchant 3");
	sp_brain (g_eggeric, "repeat");
	sp_pseq (g_machteld, "bluemaiden 3");
	sp_brain (g_machteld, "repeat");
}
예제 #20
0
void main( void )
{

//playsound(43, 22050,0,0,0);

&s4-duck = 2;
&story = 11;
freeze(1);
//cutscene

//create man
int &man = create_sprite(290, 460, 0, 0, 0);
sp_base_walk(&man, 380);
sp_speed(&man, 1);
sp_timing(&man, 33);
preload_seq(381);
preload_seq(383);
preload_seq(387);
preload_seq(389);

//create little girl
int &girl = create_sprite(290, 460, 0, 0, 0);
sp_base_walk(&girl, 250);
sp_speed(&girl, 1);
sp_timing(&girl, 33);
preload_seq(251);
preload_seq(253);
preload_seq(257);
preload_seq(259);

int &junk = sp_y(1, -1);
if (&junk < 220)
   sp_dir(1, 2);

say("`0Hurry up, Kelly!", &man);
move_stop(&man, 8, 430, 1);
move_stop(&man, 9, 380, 1);
say_stop("`0This is gonna be so great and...", &man);
wait(250);
say_stop("`0WHAT THE!?!?!", &man);
sp_pseq(&man,387);
sp_pframe(&man,1);
sp_seq(&man,0);
wait(250);
sp_pseq(&man,381);
sp_pframe(&man,1);
sp_seq(&man,0);
say_stop("Uh oh.", 1);
wait(250);
sp_pseq(&man,383);
sp_pframe(&man,1);
sp_seq(&man,0);

wait(250);
sp_pseq(&man,389);
sp_pframe(&man,1);
sp_seq(&man,0);
say_stop("`0NO!!!!!", &man);
move_stop(&girl, 9, 350, 1);
move_stop(&girl, 7, 280, 1);
say_stop("`#Daddy, what happened?", &girl);
wait(250);
say_stop("`0GUARDS!!!!!!!", &man);
wait(250);
say_stop("`0HELP!", &man);
wait(250);
say_stop("`0THIS GUY KILLED THE BLESSED FOWL!", &man);
wait(250);


int &guard = create_sprite(290, 460, 0, 0, 0);
sp_base_walk(&guard, 290);
sp_speed(&guard, 1);
sp_timing(&guard, 33);
preload_seq(291);
preload_seq(293);
preload_seq(297);
preload_seq(299);

move_stop(&guard, 8, 380, 1);
say_stop("`5I MUST AVENGE THE WINGED GODDESS!", &guard);
wait(300);
say_stop("`0Kelly, what are you doing?", &man);
wait(300);
say_stop("`#I'm eating.", &girl);
wait(300);
move_stop(&guard, 9, 330, 1);
say_stop("`5Sir, your daughter is eating our god.", &guard);
wait(300);
say_stop("`5I guess we have to kill her too.", &guard);
wait(300);
say_stop("`#This meat.. tastes good!", &girl);
wait(300);
say_stop("`0Wait..isn't it all raw and such?", &man);
wait(300);
say_stop("`5I guess one piece won't hurt...", &guard);
wait(1000);
say_stop("`5IT TASTES GREAT!", &guard);
say_stop("`0LESS FILLING TOO!", &man);
wait(300);
say_stop("`5Dink, you magically changed our supreme beings into food!", &guard);
wait(300);
say_stop("No.. there is a perfect explanation, you see, the friction seemed to cook and...", 1);

wait(300);
say_stop("`0Who cares about that!", &man);
wait(300);
say_stop("`5Dink is a hero!  WE MUST GO TELL THE OTHERS!", &guard);
unfreeze(1);
move(&guard, 1, 300, 1);
move_stop(&man, 4, 300, 1);
move(&guard, 2, 480, 1);
move_stop(&man, 2, 480, 1);
move_stop(&girl, 3, 310, 1);
say_stop("`#Bye, Dink.", &girl);
move_stop(&girl, 2, 470, 1);

}
예제 #21
0
파일: ia.cpp 프로젝트: lucas8/TIPE1
void mainloop(Robot* robot)
{
    /*** Initialisation ***/
    rb = robot;
    oldE = 0.0f;
    /* Generate a random genom */
    genom = 0;
    for(int i = 0; i < 3; ++i) {
        GENOM_SET (genom, rand_act(), i);
    }
    /* First movement */
    move_reset();
    switch(rand_act()) {
        case ACT_TURN_RIGHT:
            move_turn(PI/2.0f);
            break;
        case ACT_TURN_LEFT:
            move_turn(-PI/2.0f);
            break;
    }
    move_go();

    /*** Loop ***/
    for(;;) {
        if(rb->discover()) {
            char buffer[256];
            int size;

            move_stop();
            buffer[0] = 0xaa;
            rb->send(buffer, 1);
            size = rb->receive(buffer, 256);
            if(size != 1) {
                /* Taille invalide, on ignore */
                rb->close();
                move_go();
                continue;
            } else {
                if(buffer[0] == (char)0xFF) { /* Connection à l'ordi central */
                    /* TODO */
                    rb->close();
                    move_go();
                    continue;
                } else {
                    float E = evalue();
                    buffer[0] = ((genom & 0x3f) << 1);
                    rb->memcpy(buffer + 1, &dist, 4);
                    rb->memcpy(buffer + 5, &E, 4);
                    rb->send(buffer, 9);

                    float rdist;
                    size = rb->receive(buffer, 256);
                    rb->close();
                    if(size != 9 || (buffer[0] & 0x7e) != 0) {
                        move_go();
                        continue;
                    }

                    rb->memcpy(&rdist, buffer + 1, 4);
                    rb->memcpy(&E, buffer + 5, 4);
                    if(evolve((buffer[0] & 0x3f) >> 1, E, rdist)) {
                        move_reset();
                    }
                    move_go();
                    continue;
                }
            }
        }

        float sc = rb->scan();
        Action act;
        if(sc < DNEXT) {
            act = GENOM_GET(genom, NEXT);
            move_stop();
            switch(act) {
                case ACT_TURN_RIGHT:
                    move_turn(PI/2.0f);
                    break;
                case ACT_TURN_LEFT:
                    move_turn(-PI/2.0f);
                    break;
                case ACT_STRAIGHT:
                    move_turn(PI);
                    break;
            }
            move_go();
        } else if(sc < DNEAR) {
            act = GENOM_GET(genom, NEAR);
            move_stop();
            switch(act) {
                case ACT_TURN_RIGHT:
                    move_turn(PI/2.0f);
                    break;
                case ACT_TURN_LEFT:
                    move_turn(-PI/2.0f);
                    break;
            }
            move_go();
        } else if(sc < DFAR) {
            act = GENOM_GET(genom, FAR);
            move_stop();
            switch(act) {
                case ACT_TURN_RIGHT:
                    move_turn(PI/2.0f);
                    break;
                case ACT_TURN_LEFT:
                    move_turn(-PI/2.0f);
                    break;
            }
            move_go();
        }
    }
예제 #22
0
void main( void )
{
 int &crap;
 int &jcrap;
 sp_brain(&current_sprite, 0);
 sp_base_walk(&current_sprite, 370);
 sp_speed(&current_sprite, 2);
 sp_timing(&current_sprite, 0);
//set starting pic
 sp_pseq(&current_sprite, 377);
 sp_pframe(&current_sprite, 1);
 //Ok Go
 freeze(1);
 move_stop(1, 8, 375, 1);
 move_stop(1, 4, 300, 1);
 move_stop(1, 8, 350, 1);
 move_stop(&current_sprite, 8, 330, 1);
 //playmidi("mystery.mid");
 say_stop("`2Ok, it's up here", &current_sprite);
 move_stop(&current_sprite, 8, 200, 1);
 say_stop("`2Follow me...", &current_sprite);
 move_stop(&current_sprite, 6, 399, 1);
 move_stop(&current_sprite, 8, 165, 1);
 playsound(19, 22052, 0, 0, 0);
 wait(100);
 playsound(19, 44102, 0, 0, 0);
 wait(100);
 playsound(19, 44102, 0, 0, 0);
 say("`2Now if I can just pick this lock...", &current_sprite);
 move_stop(1, 8, 190, 1);
 move_stop(1, 6, 350, 1);
 say_stop("What are we doing?", 1);
 playsound(19, 44102, 0, 0, 0);
 wait(100);
 playsound(19, 44102, 0, 0, 0);
 say_stop("`2Just one more second...", &current_sprite);
 playmidi("battle.mid");
 //build guards
 preload_seq(291);
 preload_seq(293);
 preload_seq(297);
 preload_seq(299);
 preload_seq(722);
 preload_seq(724);
 preload_seq(725);
 preload_seq(726);
 &crap = create_sprite(380,450, 9, 0, 0);
 freeze(&crap);
 sp_base_walk(&crap, 290);
 sp_base_attack(&crap, 720); 
 sp_speed(&crap, 1);
 sp_strength(&crap, 10);
 sp_touch_damage(&crap, 2);
 sp_timing(&crap, 0);
 move(&crap, 7,250, 1);
 sp_target(&crap, 1);
 sp_hitpoints(&crap, 40);
 &jcrap = create_sprite(280,450, 9, 0, 0);
 freeze(&jcrap);
 sp_base_walk(&jcrap, 290);
 sp_base_attack(&jcrap, 720); 
 sp_strength(&jcrap, 10);
 sp_distance(&crap, 50);

 sp_touch_damage(&jcrap, 2);

 sp_speed(&jcrap, 1);
 sp_timing(&jcrap, 0);
 move_stop(&jcrap, 9,400, 1);
 sp_distance(&jcrap, 50);
 sp_target(&jcrap, 1);
 sp_hitpoints(&jcrap, 40);
 say_stop("`2Oh no, guards!!  Run for it!", &current_sprite);
 wait(250);
 sp_dir(1, 2);
 &thief = 3;
 say_stop("This ain't good.", 1);
 unfreeze(1);
 unfreeze(&jcrap);
 unfreeze(&crap);
 move_stop(&current_sprite, 6, 700, 1);
 sp_active(&current_sprite, 0);
}
예제 #23
0
void loop()
{


    if (line_tracing == true)
    {
        unsigned char sensor_data = 0;
        int z;
        for(z=0;z<8;z++)
        {
            unsigned int val = digitalRead(SensorD[z]);
            sensor_data |= (val << z);
        }
        
        sensor_data = ~sensor_data;
        
        Serial.print(sensor_data, HEX);
        
        Serial.write(" ");
        
        switch (sensor_data)
        {
            //our move forward situations.
            case 0x18:
            case 0x10:
            case 0x08:
            case 0x38:
            case 0x1c:
            case 0x3c:
            move_forward_speed(100, 100);
            break;
            
            //our turn right situations.
            case 0x0c:
            case 0x04:
            case 0x06:
            case 0x0e:
            case 0x1e:
            case 0x0f:
            turn_right_speed(150, 10);
            break;
            
            //our turn left situations.
            case 0x30:
            case 0x20:
            case 0x60:
            case 0x70:
            case 0x78:
            case 0xf0:
            turn_left_speed(10, 150);
            break;
            
             //our spin right situations.
           case 0x07:
            case 0x03:
            case 0x02:
            case 0x01:
            turn_pivot_right_speed(-100, 100);
            break;
            
             //our spin left situations.
           case 0xc0:
            case 0x40:
            case 0x80:
            case 0xe0:
            turn_pivot_left_speed(100, -100);
            break;
            
            case 0x00:
            case 0xff:
            move_stop();
            break;
            default:
            move_stop();
            break;
        }
        delay(5);
    }
}
예제 #24
0
void line_tracing_disable()
{
    line_tracing = false;
    move_stop();
    Serial.write("Line tracing is disabled..");
}
예제 #25
0
void main( void )
{
 if (&caveguy == 5)
 {
  script_attach(1000);
  //preload_seq(740);  <-- for sucking.
preload_seq(375);
  preload_seq(168);
  int &junk;
  int &dude;
  int &evil;
  int &evil2;
  int &evil3;
  freeze(1);
  &dude = create_sprite(551, 157, 0, 0, 0);
  sp_brain(&dude, 0);
  sp_base_walk(&dude, 370);
  sp_speed(&dude, 2);
  sp_timing(&dude, 0);
  //set starting pic
  sp_pseq(&dude, 371);
  sp_pframe(&dude, 1);
  //Now EVIL
  &evil = create_sprite(-20, 130, 0, 0, 0);
  sp_brain(&evil, 0);
  sp_base_walk(&evil, 300);
  sp_speed(&evil, 1);
  sp_timing(&evil, 0);
  //set starting pic
  sp_pseq(&evil, 303);
  sp_pframe(&evil, 1);
  //Now EVIL's friend
  &evil2 = create_sprite(-20, 210, 0, 0, 0);
  sp_brain(&evil2, 0);
  sp_base_walk(&evil2, 300);
  sp_speed(&evil2, 1);
  sp_timing(&evil2, 0);
  //set starting pic
  sp_pseq(&evil2, 303);
  sp_pframe(&evil2, 1);
  //And the third EVIL
  &evil3 = create_sprite(300, 470, 0, 0, 0);
  sp_brain(&evil3, 0);
  sp_base_walk(&evil3, 300);
  sp_speed(&evil3, 1);
  sp_timing(&evil3, 0);
  //set starting pic
  sp_pseq(&evil3, 307);
  sp_pframe(&evil3, 1);
  Playmidi("1004.mid");
  say_stop("`5Ok, let's get going before they come.", &dude);
  wait(500);
  say_stop("`5This way.", &dude);
  move(&dude, 4, 500, 1);
  wait(50);
  move(1, 4, 550, 1);
  wait(150);
  say("`4Not so fast.", &evil);
  move(&evil, 6, 100, 1);
  wait(850);
  move(&evil3, 8, 380, 1);
  move_stop(&evil2, 6, 67, 1);
  say_stop("`4We have a small matter to discuss with your friend.", &evil);
  say("`4Hahahaaahaha", &evil);
  say("`4Haha ha ha", &evil2);
  say_stop("`4Ha ha haaa", &evil3);
  wait(800);
  sp_dir(&dude, 3);
  say_stop("`5It's okay Dink, I can take 'em.", &dude);
  wait(250);
  say("`5Allright.", &dude);
  move_stop(&dude, 4, 400, 1);
  sp_dir(&dude, 1);
  say_stop("`5Which one of you is first?", &dude);
  wait(250);
  say("`4Haha ha ha", &evil2);
  wait(500);
  say_stop("`4Ha ha haaa", &evil3);
  wait(500);
  say_stop("`4I am!!", &evil);
  move_stop(&evil, 2, 157, 1);
  move_stop(&evil, 6, 170, 1);
  wait(500);
  //say("`4I'm attacking now...", &evil);
  &junk = create_sprite(240, 157, 11, 506, 1);
  sp_seq(&junk, 506); 
  sp_dir(&junk, 6);
  sp_speed(&junk, 6);
  sp_flying(&junk, 1);
  wait(390);
  sp_active(&junk, 0);
  &junk = create_sprite(390, 157, 7, 168, 1);
  sp_seq(&junk, 168);
  sp_pseq(&dude, 375);
  sp_pframe(&dude, 1);

  say_stop("`5Ahhhhhh!", &dude);
  wait(50);
  sp_active(&junk, 0);
  //Kill guy too

  say("Noooo!!", 1);
  move(1, 4, 450, 1);
  wait(500);
  say("`4Haha ha ha", &evil2);
  say_stop("`4Ha ha haaa", &evil3);
  wait(500);
  say_stop("`4Our work is done here.", &evil);
  wait(500);
  say_stop("`4You may live, if you forget all that you've seen here.", &evil);
  wait(250);
  say_stop("Forget ...", 1);
  wait(500);
  say_stop("I'll forget allright.", 1);
  wait(250);
  move(&evil, 4, -20, 1);
  wait(360);
  move(&evil2, 4, -20, 1);
  move_stop(&evil3, 4, 180, 1);
  move_stop(&evil3, 2, 470, 1);
  sp_active(&evil, 0);
  sp_active(&evil2, 0);
  sp_active(&evil3, 0);
  wait(250);
  say_stop("Forget to remove my foot from your ASS!!", 1);
  wait(500);
  say_stop("Are you okay?", 1);
  wait(500);
  say_stop("`5I just got hit by a fireball", &dude);
  wait(500);
  say_stop("`5I'm going to die!", &dude);
  wait(250);
  say_stop("I'm sorry I wasn't fast enough.", 1);
  wait(500);
  say_stop("`5It's not your fault", &dude);
  wait(500);
  say_stop("`5Just .. just be careful... also, take this...", &dude);
  wait(500);
  say_stop("Alright.. what is it?", 1);
  wait(500);
  say_stop("`5The Mordavia scroll.  It contains magic I needed to...", &dude);
  say_stop("`5Ahhhhhh.", &dude);
  wait(1000);
  say_stop("Ah man...", 1);
  sp_active(&dude, 0);
  &caveguy = 6;
  add_magic("item-p1", 438,14);
  &story = 7;
  unfreeze(1);
  //Fade
  fade_down();
  fill_screen(0);
  //move Dink
  &player_map = 625;
  sp_x(1, 268);
  sp_y(1, 173);
  sp_dir(1, 8);
  load_screen();
  draw_screen();
  draw_status();
  fade_up();
  kill_this_task();
 }
}
예제 #26
0
void main(void)
{
    int &whob = sp(26);
    sp_hitpoints(&current_sprite, 0);


    if (&story > 2)
    {
        sp_active(&whob,0);
// draw_hard_map();
        return;
    }

    if (&old_womans_duck > 2)
    {
        if (&pig_story == 0)
        {
            move_stop(&current_sprite, 2, 160, 1);
            freeze(&current_sprite);
            wait(200);
            say_stop("`#Dink, it's getting late!  No food until you feed the pigs!", &current_sprite);
            wait(200);
            unfreeze(&current_sprite);
            return;
        }
        &story = 2;
        move_stop(1, 8, 370, 1);
        freeze(1);
        move_stop(&current_sprite, 2, 200, 1);
        freeze(&current_sprite);
        wait(1000);
        say_stop("`#Dink, can you do something for me?", &current_sprite);
        wait(500);
        say_stop("Yes, what is it?", 1);
        wait(500);
        say_stop("`#Can you go out to the woods and see if you can get,", &current_sprite);
        wait(500);
        say_stop("`#some AlkTree nuts, I think they're in season.", &current_sprite);
        wait(500);
        say_stop("No problem, I'll be right back.", 1);
        wait(250);
        say_stop("`#You're a dear.", &current_sprite);
        unfreeze(1);
        unfreeze(&current_sprite);
        return;
    }



    if (&story == 0)
    {
//new game was just started.
//make script live on
        int &cur_sprite = &current_sprite;
        playmidi("dance.mid");
        freeze(1);
        freeze(&cur_sprite);
        wait(1000);
        say_stop("`#Dink, would you go feed the pigs?", &cur_sprite);
        wait(200);
        say_stop("What, now?", 1);
        wait(200);
        say_stop("`#YES, NOW.", &cur_sprite);
        unfreeze(1);
        unfreeze(&cur_sprite);
        playsound(22, 22050, 0,0,0);
        &update_status = 1;
        draw_status();
        &story = 1;
        return;
    }

}
예제 #27
0
파일: main.c 프로젝트: texane/dibal
static void light_tracker_next(light_tracker_state_t* lts)
{
  switch (lts->state)
    {
    case LIGHT_TRACKER_STATE_INIT:
      {
	lts->state = LIGHT_TRACKER_STATE_SENSE;

	/* fallthru */
      }

    case LIGHT_TRACKER_STATE_SENSE:
      {
	void (*rotate)(void);
	unsigned short cur_level;
	unsigned short cur_delta;

	cur_level = adc_read(LIGHT_ADC_CHANNEL);

	if (cur_level >= ADC_QUANTIZE_5_10(2.35))
	  if (cur_level <= ADC_QUANTIZE_5_10(2.65))
	    {
	      /* found, we are done */

	      lts->state = LIGHT_TRACKER_STATE_DONE;

	      break;
	    }

	if (cur_level >= ADC_QUANTIZE_5_10(2.5))
	  {
	    cur_delta = cur_level - ADC_QUANTIZE_5_10(2.5);
	    rotate = move_rotate_left;
	  }
	else
	  {
	    cur_delta = ADC_QUANTIZE_5_10(2.5) - cur_level;
	    rotate = move_rotate_right;
	  }

	if (lts->prev_delta < cur_delta)
	  {
	    /* diverging, we are done */

	    lts->state = LIGHT_TRACKER_STATE_DONE;

	    break;
	  }

	lts->prev_delta = cur_delta;
	lts->rem_delta = cur_delta;

	rotate();

	lts->timer = sched_add_timer(0, on_light_tracker_timer, 0);

	lts->state = LIGHT_TRACKER_STATE_ROTATE;

	break;
      }

    case LIGHT_TRACKER_STATE_ROTATE:
      {
	unsigned int tmp;

	if (!lts->rem_delta)
	  {
	    /* rotation done */

	    move_stop();

	    sched_del_timer(lts->timer);
	    lts->timer = NULL;

	    lts->state = LIGHT_TRACKER_STATE_SENSE;

	    break;
	  }

	tmp = delta_to_freq(lts->rem_delta);
	if (tmp > SCHED_MAX_FREQ)
	  tmp = SCHED_MAX_FREQ;

	sched_set_timer_freq(lts->timer, tmp);

	tmp = freq_to_delta(tmp);
	if (tmp > lts->rem_delta)
	  tmp = lts->rem_delta;

	lts->rem_delta -= tmp;

	lts->state = LIGHT_TRACKER_STATE_WAIT;
	is_rotation_done = 0;
	sched_enable_timer(lts->timer);

	break;
      }

    case LIGHT_TRACKER_STATE_WAIT:
      {
	/* wait for the rotation to finish */

	if (!is_rotation_done)
	  break;

	sched_disable_timer(lts->timer);

	lts->state = LIGHT_TRACKER_STATE_ROTATE;

	break;
      }

    case LIGHT_TRACKER_STATE_DONE:
    default:
      {
	light_tracker_stop(lts);

	break;
      }
    }
}
예제 #28
0
파일: main.c 프로젝트: texane/dibal
static void land_explorer_stop(land_explorer_state_t* les)
{
  move_stop();

  les->is_done = 1;
}
예제 #29
0
void main( void )
{
 int &guy;
 int &what;
 &what = random(3,1);
 //Spawn the guy...
 &guy = create_sprite(258, 146, 0, 0, 0);
 sp_brain(&guy, 0);
 sp_base_walk(&guy, 410);
 sp_speed(&guy, 1);
 sp_timing(&guy, 0);
 //set starting pic
 sp_pseq(&guy, 417);
 sp_pframe(&guy, 1);
 //Coversation
 freeze(1);
 freeze(&guy);
 move_stop(1, 8, 222, 1);
 move_stop(&guy, 3, 265, 1);
 wait(250);
 if (&what == 1)
 {
  say_stop("`9Can I HELP you?", &guy);
  wait(250);
  say_stop("Uhh ... maybe.", 1);
  wait(1000);
  say_stop("`9Yeah well, what the hell are you doing??", &guy);
  wait(250);
  say_stop("What do you mean?", 1);
  wait(250);
  say_stop("`9I mean you just barging in here, no knocking, nothing!", &guy);
  say_stop("`9What's with that?", &guy);
  wait(500);
  sp_dir(1, 2);
  wait(500);
  sp_dir(1, 8);
  wait(1000);
  say_stop("And there's like ... something WRONG with that?", 1);
  wait(250);
  say_stop("`9YES, now get the HELL OUT!!", &guy);
 }
 if (&what == 2)
 {
  say_stop("`9Can I HELP you?", &guy);
  wait(250);
  say_stop("Nope, just looking through houses and stuff.", 1);
  wait(750);
  say_stop("`9You know, you've got a lot of nerve.", &guy);
  wait(250);
  say_stop("Yea whatever ...", 1);
  wait(250);
  say_stop("`9Hmmmph.", &guy);
  wait(250);
  say_stop("Hey old man, the funeral house called ...", 1);
  say_stop("they're ready for you now!", 1);
  wait(250);
  say_stop("`9WHAT, now get OUT!!", &guy);
 }
 if (&what == 3)
 {
  say_stop("`9What do you want?", &guy);
  wait(250);
  say_stop("I've come for your daughter.", 1);
  wait(250);
  say_stop("`9Just ... just please leave.", &guy);
 }
 //Leave.
 unfreeze(1);
 move_stop(1, 2, 640, 0);
  unfreeze(&guy);
}
예제 #30
0
파일: main.c 프로젝트: TLoebner/apbteam
/** Handle received commands. */
void
proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
{
#define c(cmd, size) (cmd << 8 | size)
    switch (c (cmd, size))
      {
      case c ('z', 0):
	/* Reset */
	utils_reset ();
	break;
      case c ('j', 0):
	/* Simulate jack insertion. */
	fsm_queue_post_event (FSM_EVENT (jack_inserted));
	break;
      case c ('w', 3):
	/* Set PWM.
	 * - 1b: index.
	 * - 1w: value. */
	pwm_set (args[0], v8_to_v16 (args[1], args[2]));
	break;
      case c ('w', 7):
	/* Set timed PWM.
	 * - 1b: index.
	 * - 1w: value.
	 * - 1w: time.
	 * - 1w: rest value. */
	pwm_set_timed (args[0], v8_to_v16 (args[1], args[2]),
		       v8_to_v16 (args[3], args[4]),
		       v8_to_v16 (args[5], args[6]));
	break;
      case c ('m', 5):
	/* Go to position.
	 * - 2w: x, y.
	 * - 1b: backward. */
	  {
	    vect_t position = { v8_to_v16 (args[0], args[1]),
		v8_to_v16 (args[2], args[3]) };
	    move_stop ();
	    move_start_noangle (position, args[4], 0);
	  }
	break;
      case c ('c', 1):
	/* Move clamp.
	 * - 1b: position. */
	clamp_move (args[0]);
	break;
      case c ('c', 2):
	/* Move element using clamp.
	 * - 1b: source.
	 * - 1b: destination. */
	clamp_move_element (args[0], args[1]);
	break;
      case c ('n', 2):
	/* Simulate the presence of a new element.
	 * - 1b: position.
	 * - 1b: type. */
	clamp_new_element (args[0], args[1]);
	break;
      case c ('d', 0):
	/* Open all doors. */
	pwm_set_timed (BOT_PWM_DOOR_FRONT_BOTTOM,
		       BOT_PWM_DOOR_OPEN (CLAMP_SLOT_FRONT_BOTTOM));
	pwm_set_timed (BOT_PWM_DOOR_FRONT_TOP,
		       BOT_PWM_DOOR_OPEN (CLAMP_SLOT_FRONT_TOP));
	pwm_set_timed (BOT_PWM_DOOR_BACK_BOTTOM,
		       BOT_PWM_DOOR_OPEN (CLAMP_SLOT_BACK_BOTTOM));
	pwm_set_timed (BOT_PWM_DOOR_BACK_TOP,
		       BOT_PWM_DOOR_OPEN (CLAMP_SLOT_BACK_TOP));
	break;
      case c ('d', 1):
	/* Drop elements.
	 * - 1b: 00: drop clear, 01: drop forward, 02: drop backward. */
	if (args[0] == 0x00)
	    clamp_drop_clear ();
	else
	    clamp_drop (args[0]);
	break;
      case c ('d', 2):
	/* Open or close door or clamp.
	 * - 1b: pos, or 0xff for clamp.
	 * - 1b: non zero to open. */
	clamp_door (args[0], args[1]);
	break;
      case c ('w', 0):
	/* Disable all motor control. */
	mimot_motor_free (0, 0);
	mimot_motor_free (1, 0);
	asserv_free_motor ();
	break;
	/* Stats commands.
	 * - b: interval between stats. */
      case c ('A', 1):
	/* Position stats. */
	main_stats_asserv_ = main_stats_asserv_cpt_ = args[0];
	break;
      case c ('P', 1):
	/* Contact stats. */
	main_stats_contact_ = main_stats_contact_cpt_ = args[0];
	break;
      case c ('B', 1):
	/* Codebar stats. */
	main_stats_codebar_ = main_stats_codebar_cpt_ = args[0];
	break;
      case c ('U', 1):
	/* US sensors stats. */
	main_stats_usdist_ = main_stats_usdist_cpt_ = args[0];
	break;
      default:
	/* Unknown commands */
	proto_send0 ('?');
	return;
      }
    /* When no error, acknowledge commands */
    proto_send (cmd, size, args);
#undef c
}