/* Player hit animation */ void game::draw_hit_player(player *p, const int iDam, bool dead) { (void)dead; //unused if (use_tiles) { // get base name of player id std::string pname = (p->is_npc() ? "npc_" : "player_"); // get sex of player pname += (p->male ? "male" : "female"); tilecontext->init_draw_hit(p->posx, p->posy, pname); wrefresh(w_terrain); try_update(); timespec tspec; tspec.tv_sec = 0; tspec.tv_nsec = 1000000 * OPTIONS["ANIMATION_DELAY"]; if( tspec.tv_nsec != 0 ) { nanosleep(&tspec, NULL); } } else { hit_animation(POSX + (p->posx - (u.posx + u.view_offset_x)), POSY + (p->posy - (u.posy + u.view_offset_y)), (iDam == 0) ? yellow_background(p->symbol_color()) : red_background(p->symbol_color()), "@"); } }
/* Player hit animation */ void game::draw_hit_player(player *p, const int iDam, bool dead) { (void)dead; //unused hit_animation(POSX + (p->posx - (u.posx + u.view_offset_x)), POSY + (p->posy - (u.posy + u.view_offset_y)), (iDam == 0) ? yellow_background(p->color()) : red_background(p->color()), '@'); }
/* Player hit animation */ void game::draw_hit_player(player *p, const int iDam, bool dead) { (void)dead; //unused const std::string &sMonSym = p->symbol(); hit_animation(POSX + (p->posx - (u.posx + u.view_offset_x)), POSY + (p->posy - (u.posy + u.view_offset_y)), (iDam == 0) ? yellow_background(p->symbol_color()) : red_background(p->symbol_color()), sMonSym); }
std::vector<std::string> requirement_data::get_folded_list( int width, const inventory &crafting_inv, const std::vector< std::vector<T> > &objs, int batch, std::string hilite ) const { // hack: ensure 'cached' availability is up to date can_make_with_inventory( crafting_inv ); std::vector<std::string> out_buffer; for( const auto &comp_list : objs ) { const bool has_one = any_marked_available( comp_list ); std::ostringstream buffer; std::vector<std::string> buffer_has; bool already_has; for( auto a = comp_list.begin(); a != comp_list.end(); ++a ) { already_has = false; for( auto cont : buffer_has ) { if( cont == a->to_string( batch ) + a->get_color( has_one, crafting_inv, batch ) ) { already_has = true; break; } } if( already_has ) { continue; } if( a != comp_list.begin() ) { buffer << "<color_white> " << _( "OR" ) << "</color> "; } const std::string col = a->get_color( has_one, crafting_inv, batch ); if( !hilite.empty() && lcmatch( a->to_string( batch ), hilite ) ) { buffer << get_tag_from_color( yellow_background( color_from_string( col ) ) ); } else { buffer << "<color_" << col << ">"; } buffer << a->to_string( batch ) << "</color>" << "</color>"; buffer_has.push_back( a->to_string( batch ) + a->get_color( has_one, crafting_inv, batch ) ); } std::vector<std::string> folded = foldstring( buffer.str(), width - 2 ); for( size_t i = 0; i < folded.size(); i++ ) { if( i == 0 ) { out_buffer.push_back( std::string( "> " ).append( folded[i] ) ); } else { out_buffer.push_back( std::string( " " ).append( folded[i] ) ); } } } return out_buffer; }