예제 #1
0
bool Player::Quick(Game_Manager* gm_, coord_def c, float focus_)
{
	if(GetStop())
		return false;
	if(berserker)
		return false;
	switch(quick_menu)
	{
	case 1:
		Special(gm_, c, focus_);
		break;
	case 2:
		Shot(gm_, c, focus_, 2);
		break;
	case 3:
		Shot(gm_, c, focus_, 3);
		break;
	case 4:
		Shot(gm_, c, focus_, 4);
		break;
	case 5:
		UseAbility(gm_, 0);
		break;
	case 6:
		UseAbility(gm_, 1);
		break;
	default:
		return false;
	}
	return true;
}
예제 #2
0
void Plotter::MouseMotion(View& view, int x, int y, int button_state)
{
    const int d[2] = {x-last_mouse_pos[0], y-last_mouse_pos[1]};
    const float is[2] = {rview.x.Size(), rview.y.Size() };
    const float df[2] = {is[0]*d[0]/(float)v.w, is[1]*d[1]/(float)v.h};

    // Update hover status (after potential resizing)
    ScreenToPlot(x, y, hover[0], hover[1]);

    if( button_state == MouseButtonLeft )
    {
        // Update selected range
        selection.x.max = hover[0];
        selection.y.max = hover[1];
    }else if(button_state == MouseButtonMiddle )
    {
        Special(view, InputSpecialScroll, df[0], df[1], 0.0f, 0.0f, 0.0f, 0.0f, button_state);
    }else if(button_state == MouseButtonRight )
    {
        const float c[2] = {
            track || trigger_edge ? last_track_val[0] : hover[0],
            hover[1]
        };

        const float scale[2] = {
            1.0f + (float)d[0] / (float)v.w,
            1.0f - (float)d[1] / (float)v.h,
        };
        ScaleView(scale[0], scale[1], c[0], c[1]);
    }

    last_mouse_pos[0] = x;
    last_mouse_pos[1] = y;
}
예제 #3
0
Special makeSpec(int x, int y, int type, sf::Texture *worldtextures, int id){
    sf::Sprite cursprite;
    cursprite.setTexture(*worldtextures);
    cursprite.setOrigin(TILE/2, TILE/2);
    cursprite.setTextureRect(sf::IntRect(type / 10 * 32, type % 10 * 32 , TILE, TILE));
    cursprite.setPosition((y + 0.5) * TILE, (x + 0.5) * TILE);
    return Special(type, cursprite, id);
}
예제 #4
0
파일: htadd.c 프로젝트: acralfs/fricas
static void
add_new_pages(FILE *temp_db, FILE *new_file, char *addname, char *fullname)
{
    char type[15];
    int pos;
    int present_type;
    int pages = 0;
    struct stat fstats;

    stat(fullname, &fstats);
    fprintf(temp_db, "\t%s %d\n", addname, (int)fstats.st_mtime);
    cfile = new_file;
    init_scanner();
    while (get_token() != EOF) {
        if (Special(token.type)) {
            ptype(type, token.id);
            present_type = token.type;
            pos = keyword_fpos;
            get_token();
            if (token.type != Lbrace) {
                fprintf(stderr, "missing left brace after a page, macro or patch \
                         declaration\n");
                fprintf(stderr, "In the file %s on line %d\n", fullname, line_number);
                exit(-1);
            }
            get_token();
            if (present_type == Page && token.type != Word) {
                fprintf(stderr, "missing page name after \\begin{page}\n");
                fprintf(stderr, "In the file %s on line %d\n", fullname, line_number);
                exit(-1);
            }
            else if (present_type == Macro && token.type != Macro) {
                fprintf(stderr, "Expected a \\macro name after newcommand, got %s\n",
                        token.id);
                fprintf(stderr, "In the file %s on line %d\n", fullname, line_number);
                exit(-1);
            }
            else if (present_type == Patch && token.type != Word) {
                fprintf(stderr, "Missing patch name after a \\begin{patch}\n");
                fprintf(stderr, "In the file %s on line %d\n", fullname, line_number);
                exit(-1);
            }
            fprintf(temp_db, "\\%s %s %d %d\n", type,
                    token.id, pos, line_number);
            pages++;
        }
void CopyPropagationPass2::do_procedure_definition(ProcedureDefinition* proc_def)
{
  procDef = proc_def ;
  assert(procDef != NULL) ;

  OutputInformation("Copy propagation pass 2.0 begins") ;
  totalDefinitions = 0 ;

  Initialize() ;

  if (Special())
  {
    ProcessSpecialIfs() ;
  }
  else
  { 
    // First, find all the possible copy instructions.  These
    //  can only be store variable statements

    list<StoreVariableStatement*>* allStoreVars =
      collect_objects<StoreVariableStatement>(procDef->get_body()) ;
    assert(allStoreVars != NULL) ;

    list<StoreVariableStatement*>::iterator storeVarIter = 
      allStoreVars->begin();
    while(storeVarIter != allStoreVars->end())
    {
      ProcessPossibleCopy(*storeVarIter) ;
      ++storeVarIter ;
    }
  
    delete allStoreVars ;
  }
  
  CleanUp() ;

  OutputInformation("Copy propagation pass 2.0 ends") ;
}