Exemple #1
0
bool
FlarmTrafficControl::OnKeyDown(unsigned key_code)
{
  switch (key_code) {
  case KEY_UP:
    if (!HasPointer())
      break;

    ZoomIn();
    return true;

  case KEY_DOWN:
    if (!HasPointer())
      break;

    ZoomOut();
    return true;

#ifdef GNAV
  case '6':
    PrevTarget();
    return true;

  case '7':
    NextTarget();
    return true;
#endif
  }

  return FlarmTrafficWindow::OnKeyDown(key_code) ||
    InputEvents::processKey(key_code);
}
static void
RicochetNext (void)
{
    if (!Solved ())
        while (Undo());
    NextTarget ();
}
Exemple #3
0
void
TrafficWidget::OnAction(int id)
{
  switch ((Action)id) {
  case CLOSE:
    PageActions::Restore();
    break;

  case DETAILS:
    OpenDetails();
    break;

  case PREVIOUS_ITEM:
    PreviousTarget();
    break;

  case NEXT_ITEM:
    NextTarget();
    break;

  case ZOOM_IN:
    ZoomIn();
    break;

  case ZOOM_OUT:
    ZoomOut();
    break;
  }
}
bool
FlarmTrafficControl::on_mouse_gesture(const TCHAR* gesture)
{
  if (StringIsEqual(gesture, _T("U"))) {
    ZoomIn();
    return true;
  }
  if (StringIsEqual(gesture, _T("D"))) {
    ZoomOut();
    return true;
  }
  if (StringIsEqual(gesture, _T("L"))) {
    PrevTarget();
    return true;
  }
  if (StringIsEqual(gesture, _T("R"))) {
    NextTarget();
    return true;
  }
  if (StringIsEqual(gesture, _T("UD"))) {
    SetAutoZoom(true);
    return true;
  }
  if (StringIsEqual(gesture, _T("DR"))) {
    OpenDetails();
    return true;
  }
  if (StringIsEqual(gesture, _T("RL"))) {
    SwitchData();
    return true;
  }

  return false;
}
bool
FlarmTrafficControl::OnMouseGesture(const TCHAR* gesture)
{
  if (StringIsEqual(gesture, _T("U"))) {
    ZoomIn();
    return true;
  }
  if (StringIsEqual(gesture, _T("D"))) {
    ZoomOut();
    return true;
  }
  if (StringIsEqual(gesture, _T("L"))) {
    PrevTarget();
    return true;
  }
  if (StringIsEqual(gesture, _T("R"))) {
    NextTarget();
    return true;
  }
  if (StringIsEqual(gesture, _T("UD"))) {
    SetAutoZoom(true);
    return true;
  }
  if (StringIsEqual(gesture, _T("DR"))) {
    OpenDetails();
    return true;
  }
  if (StringIsEqual(gesture, _T("RL"))) {
    SwitchData();
    return true;
  }

  return InputEvents::processGesture(gesture);
}
/**
 * Checks whether the selection is still on the valid target and if not tries
 * to select the next one
 */
void
FlarmTrafficWindow::UpdateSelector()
{
  if (small || !data.FLARM_Available)
    SetTarget(-1);
  else if (selection < 0 || (!data.FLARM_Traffic[selection].defined() &&
                             !SelectNearTarget(sc[selection].x, sc[selection].y,
                                               radius * 2)))
    NextTarget();
}
/**
 * Checks whether the selection is still on the valid target and if not tries
 * to select the next one
 */
void
FlarmTrafficWindow::UpdateSelector(const FlarmId id, const RasterPoint pt)
{
  // Update #selection
  if (!id.IsDefined())
    SetTarget(-1);
  else
    SetTarget(id);

  // If we don't have a valid selection and we can't find
  // a target close to to the RasterPoint we select the next one
  // on the internal list
  if (selection < 0 && (
      pt.x < 0 || pt.y < 0 ||
      !SelectNearTarget(pt.x, pt.y, radius * 2)) )
    NextTarget();
}
Exemple #8
0
bool
FlarmTrafficControl::on_mouse_gesture(const char* gesture)
{
  if (!XCSoarInterface::SettingsComputer().EnableGestures)
    return false;

  if (strcmp(gesture, "U") == 0) {
    ZoomIn();
    return true;
  }
  if (strcmp(gesture, "D") == 0) {
    ZoomOut();
    return true;
  }
  if (strcmp(gesture, "L") == 0) {
    PrevTarget();
    return true;
  }
  if (strcmp(gesture, "R") == 0) {
    NextTarget();
    return true;
  }
  if (strcmp(gesture, "UD") == 0) {
    SetAutoZoom(true);
    return true;
  }
  if (strcmp(gesture, "DR") == 0) {
    OpenDetails();
    return true;
  }
  if (strcmp(gesture, "RL") == 0) {
    SwitchData();
    return true;
  }

  return false;
}
static void
NewGame (void)
{
    int	color, shape, i;

    DIAG (("NewGame\n"));
    game.seed = TimGetTicks ();
    RandomBoard (game.board);
    DamageBoard ();
    i = 0;
    for (color = RED; color <= BLUE; color = COLOR_NEXT(color))
        for (shape = TARGET_TRIANGLE;
                shape <= TARGET_CIRCLE;
                shape = TARGET_NEXT(shape))
        {
            game.targets[i++] = shape|color;
        }
    game.targets[i++] = TARGET_WHIRL|COLOR_ANY;
    DIAG (("Generated %d targets\n", i));
    Shuffle (game.targets, i);
    game.ntarget = 0;
    DIAG (("NextTarget\n"));
    NextTarget ();
}
// load animations, start sound
void Projectile::Setup()
{
	tint.r=128;
	tint.g=128;
	tint.b=128;
	tint.a=255;

	ieDword time = core->GetGame()->Ticks;
	timeStartStep = time;

	if(ExtFlags&PEF_TEXT) {
		Actor *act = area->GetActorByGlobalID(Caster);
		if(act) {
			displaymsg->DisplayStringName(StrRef, DMC_LIGHTGREY, act,0);
		}
	}

	//falling = vertical
	//incoming = right side
	//both = left side
	if(ExtFlags&(PEF_FALLING|PEF_INCOMING) ) {
		if (ExtFlags&PEF_INCOMING) {
			if (ExtFlags&PEF_FALLING) {
				Pos.x=Destination.x-200;
			} else {
				Pos.x=Destination.x+200;
			}
		}
		else {
			Pos.x=Destination.x;
		}
		Pos.y=Destination.y-200;
		NextTarget(Destination);
	}

	if(ExtFlags&PEF_WALL) {
		SetupWall();
	}

	//cone area of effect always disables the travel flag
	//but also makes the caster immune to the effect
	if (Extension) {
		if (Extension->AFlags&PAF_CONE) {
			NewOrientation = Orientation = GetOrient(Destination, Pos);
			Destination=Pos;
			ExtFlags|=PEF_NO_TRAVEL;
		}

		//this flag says the first explosion is delayed
		//(works for delaying triggers too)
		//getting the explosion count here, so an absent caster won't cut short
		//on the explosion count
		if(Extension->AFlags&PAF_DELAY) {
			extension_delay=Extension->Delay;
		} else {
			extension_delay=0;
		}
		extension_explosioncount=CalculateExplosionCount();
	}

	//set any static tint
	if(ExtFlags&PEF_TINT) {
		Color tmpColor[PALSIZE];

		core->GetPalette( Gradients[0], PALSIZE, tmpColor );
		StaticTint(tmpColor[PALSIZE/2]);
	}

	CreateAnimations(travel, BAMRes1, Seq1);

	if (TFlags&PTF_SHADOW) {
		CreateAnimations(shadow, BAMRes2, Seq2);
	}

	if (TFlags&PTF_SMOKE) {
		GetSmokeAnim();
	}

	//there is no travel phase, create the projectile right at the target
	if (ExtFlags&PEF_NO_TRAVEL) {
		Pos = Destination;

		//the travel projectile should linger after explosion
		if(ExtFlags&PEF_POP) {
			//the explosion consists of a pop in/hold/pop out of the travel projectile (dimension door)
			if(travel[0] && shadow[0]) {
				extension_delay = travel[0]->GetFrameCount()*2+shadow[0]->GetFrameCount();
				//SetDelay( travel[0]->GetFrameCount()*2+shadow[0]->GetFrameCount());
				travel[0]->Flags|=A_ANI_PLAYONCE;
				shadow[0]->Flags|=A_ANI_PLAYONCE;
			}
		} else {
			if(travel[0]) {
				extension_delay = travel[0]->GetFrameCount();
				travel[0]->Flags|=A_ANI_PLAYONCE;
				//SetDelay(travel[0]->GetFrameCount() );
			}
		}
	}

	if (TFlags&PTF_COLOUR) {
		SetupPalette(travel, palette, Gradients);
	} else {
		gamedata->FreePalette(palette, PaletteRes);
		palette=gamedata->GetPalette(PaletteRes);
	}

	if (TFlags&PTF_LIGHT) {
		light = core->GetVideoDriver()->CreateLight(LightX, LightZ);
	}
	if (TFlags&PTF_BLEND) {
		SetBlend(TFlags&PTF_BRIGHTEN);
	}
	if (SFlags&PSF_FLYING) {
		ZPos = FLY_HEIGHT;
	}
	phase = P_TRAVEL;
	travel_handle = core->GetAudioDrv()->Play(SoundRes1, Pos.x, Pos.y, (SFlags & PSF_LOOPING ? GEM_SND_LOOPING : 0));

	//create more projectiles
	if(ExtFlags&PEF_ITERATION) {
		CreateIteration();
	}
}