コード例 #1
0
void AMapPlayerController::MouseMoving(float d)
{
  if (Cast<AMapPlayerPawn>(GetPawn()) == NULL || Cast<AMapPlayerState>(PlayerState) == NULL) { return; }

  float x; float y; FVector2D CurrentPosition; AMapPlayerPawn * pawn = NULL; TArray<AMapBasicEntity*>* SelectedEntity = NULL;

  if (PressingRightClick || Cast<AMapHUD>(MyHUD)->MovingEntity || IsChoosingTargets) {
    GetMousePosition(x, y);
    CurrentPosition = FVector2D(x, y);
    pawn = Cast<AMapPlayerPawn>(GetPawn());
    SelectedEntity = &Cast<AMapPlayerState>(PlayerState)->SelectedEntity;
  }

  if (PressingRightClick) {
    if (FVector2D::Distance(CurrentPosition, CameraFirstRightClick) > CameraDragDeadZone) {
      CameraDragging = true;
      bShowMouseCursor = false;
      FVector2D t = pawn->SpringArm->TargetArmLength/500 * (CurrentPosition - CameraFirstRightClick);
      pawn->SetActorLocation(FVector(t.Y, -t.X, 0) + CameraInitialPosition);
      pawn->MovingEntityMesh->SetVisibility(false);
    } else {
      CameraDragging = false;
    }
  }

  if (Cast<AMapHUD>(MyHUD)->MovingEntity && !(*SelectedEntity)[0]->EntityMoving) {
    AMapTile * tile = GetTileUnderCursor();
    if (tile) {
      if (tile->Clearance >= (*SelectedEntity)[0]->EntitySize) {
        pawn->MovingEntityMesh->SetStaticMesh((*SelectedEntity)[0]->Mesh->StaticMesh);
        pawn->MovingEntityMesh->SetWorldLocation(tile->EntityPosition() + (*SelectedEntity)[0]->CenterLocation - (*SelectedEntity)[0]->AssignedTiles[0]->EntityPosition());
        pawn->MovingEntityMesh->SetVisibility(true);
      }
    }
  } else { Cast<AMapPlayerPawn>(GetPawn())->MovingEntityMesh->SetVisibility(false); }

  if (IsChoosingTargets) {
    AMapTile * tile = GetTileUnderCursor();
    if (tile) {
    }
  }
}
コード例 #2
0
void AMapPlayerController::RightClickReleased()
{
  /** Movin' entity **/
  if (Cast<AMapPlayerState>(PlayerState) != NULL && Cast<AMapHUD>(MyHUD)->MovingEntity) {
    TArray<AMapBasicEntity*>& SelectedEntity = Cast<AMapPlayerState>(PlayerState)->SelectedEntity;
    if (SelectedEntity.Num() == 1 && !CameraDragging) {
      AMapTile * tile = GetTileUnderCursor();
      if (tile) { MoveSelectionToTile(SelectedEntity[0], tile->Index); }
    }
  }

  PressingRightClick = false;
  CameraDragging = false;
  bShowMouseCursor = true;
}
コード例 #3
0
ファイル: pacman.c プロジェクト: neiderm/turaco
void Maped_Info_PacMan(int mode)
{
#if 0
    char text[80];
    int max;
#ifdef SNOOP_ENABLE
    struct ROMDATA * rd = Driver.RomData;
#endif

    sprintf(text, "Size %04x", Maped_TotalMap_PacMan());
    if (Maped_TotalMap_PacMan() > 0x17d)
	textout(screen, font, text, SCREEN_W - 90, 40, PAL_RED);
    else
	textout(screen, font, text, SCREEN_W - 90, 40, PAL_GREEN);

    max = Driver.RomData->MapData[mapno].OverlayCount;
    sprintf(text, "#p %3d/%3d", Maped_TotalOverlay_PacMan(), max);

    if (Maped_TotalOverlay_PacMan() != max)
	textout(screen, font, text, SCREEN_W - 90, 50, PAL_RED);
    else
	textout(screen, font, text, SCREEN_W - 90, 50, PAL_GREEN);

#ifdef SNOOP_ENABLE
    sprintf(text, "O %08lx", snoop_offset);
    textout(screen, font, text, SCREEN_W - 90, 60, PAL_GREY);

    sprintf(text, "T %08lx", snoop_offset + rd->MapData[mapno].StartAddress);
    textout(screen, font, text, SCREEN_W - 90, 70, PAL_GREY);
#endif

    if (mode == MODE_EDIT)
	textout(screen, font, "M: Map Edit", SCREEN_W - 90, 95, PAL_YELLOW);
    else
	textout(screen, font, "M: Tile Sel", SCREEN_W - 90, 95, PAL_GREEN);

    sprintf(text, " 0x%02x ", GetTileUnderCursor());
    textout_centre(screen, font, text, SCREEN_W - 45, 105, PAL_LTGREY);
#endif
}