void ZCursor::Render(ZMap &the_map, SDL_Surface *dest, int &x, int &y, bool restrict_to_map) { SDL_Rect from_rect, to_rect; int x_shift, y_shift; if(!current_surface) return; if(current_cursor > CURSOR_C) { x_shift = -8; y_shift = -8; } else { x_shift = 0; y_shift = 0; } if(restrict_to_map) { if(the_map.GetBlitInfo(current_surface->GetBaseSurface(), x + x_shift, y + y_shift, from_rect, to_rect)) current_surface->BlitSurface(&from_rect, &to_rect); //SDL_BlitSurface( current_surface, &from_rect, dest, &to_rect); } else { to_rect.x = x + x_shift; to_rect.y = y + y_shift; current_surface->BlitSurface(NULL, &to_rect); //SDL_BlitSurface( current_surface, NULL, dest, &to_rect); } }
void OHut::DoRender(ZMap &the_map, SDL_Surface *dest, int shift_x, int shift_y) { int &x = loc.x; int &y = loc.y; SDL_Rect from_rect, to_rect; if(the_map.GetBlitInfo( render_img[palette].GetBaseSurface(), x, y, from_rect, to_rect)) { to_rect.x += shift_x; to_rect.y += shift_y; render_img[palette].BlitSurface(&from_rect, &to_rect); //SDL_BlitSurface( render_img[palette], &from_rect, dest, &to_rect); } }
void RLaser::DoRender(ZMap &the_map, SDL_Surface *dest, int shift_x, int shift_y) { int &x = loc.x; int &y = loc.y; ZSDL_Surface *base_surface; SDL_Rect from_rect, to_rect; int lx, ly; if(owner != NULL_TEAM) { switch(mode) { case R_WALKING: base_surface = &walk[owner][direction][move_i]; break; case R_STANDING: base_surface = &stand[owner][direction]; break; case R_BEER: base_surface = &beer[owner][action_i]; break; case R_CIGARETTE: base_surface = &cigarette[owner][action_i]; break; case R_FULLSCAN: base_surface = &full_area_scan[owner][action_i]; break; case R_HEADSTRETCH: base_surface = &head_stretch[owner][action_i]; break; case R_PICKUP_UP_GRENADES: base_surface = &pickup_up[owner][action_i]; break; case R_PICKUP_DOWN_GRENADES: base_surface = &pickup_down[owner][action_i]; break; case R_ATTACKING: if(this->CanThrowGrenades() || (m_attacked_object && m_attacked_object->AttackedOnlyByExplosives())) base_surface = &throw_something[owner][direction][grenade_i]; else base_surface = &fire[owner][direction][action_i]; break; default: base_surface = &null_img; } } else base_surface = &null_img; if(!base_surface) return; submerge_amount = the_map.SubmergeAmount(loc.x+8,loc.y+8); //if(the_map.GetBlitInfo(base_surface, x, y, from_rect, to_rect)) if(the_map.GetBlitInfo(x, y + submerge_amount, 16, 16 - submerge_amount, from_rect, to_rect)) { to_rect.x += shift_x; to_rect.y += shift_y; base_surface->BlitHitSurface(&from_rect, &to_rect, NULL, do_hit_effect); //ZSDL_BlitHitSurface( base_surface, &from_rect, dest, &to_rect, do_hit_effect); } do_hit_effect = false; }
void OMapObject::DoRender(ZMap &the_map, /*SDL_Surface *dest,*/ int shift_x, int shift_y) { int &x = loc.x; int &y = loc.y; SDL_Rect from_rect, to_rect; if(!render_img[object_i].GetBaseSurface()) return; if(the_map.GetBlitInfo( render_img[object_i].GetBaseSurface(), x, y + (16 - render_img[object_i].GetBaseSurface()->h), from_rect, to_rect)) { to_rect.x += shift_x; to_rect.y += shift_y; render_img[object_i].BlitSurface(&from_rect, &to_rect); //SDL_BlitSurface( render_img[object_i], &from_rect, dest, &to_rect); } }
void GWFactoryList::DoRenderEntries(ZMap &the_map, SDL_Surface *dest) { int ty; ty = y + main_top_img.GetBaseSurface()->h; for(int ei=show_start_entry; ei<entry_list.size() && (ei-show_start_entry)<show_able_entries; ei++) { gwfl_render_entry *e = &entry_list[ei]; int bx, by; //since it rendered put in its render locations e->x = 0; e->y = ty - y; e->h = main_entry_img.GetBaseSurface()->h; e->w = 120; //render its main peice the_map.RenderZSurface(&main_entry_img, x, ty); //begin rendering the labels bx = x + 12; by = ty + 7; for(int i=0;i<3;i++) { if(!e->colored[i]) the_map.RenderZSurface(&entry_bar_grey_img, bx, by); else { if(e->percent[i] > 0.99) the_map.RenderZSurface(&entry_bar_green_img, bx, by); else { int gw; int wx; SDL_Rect from_rect, to_rect; gw = entry_bar_green_img.GetBaseSurface()->w * e->percent[i]; if(gw <= 0) gw = 0; if(the_map.GetBlitInfo(entry_bar_green_img.GetBaseSurface(), bx, by, from_rect, to_rect)) { if(from_rect.w > gw) from_rect.w = gw; entry_bar_green_img.BlitSurface(&from_rect, &to_rect); } //the white line wx = bx + gw - 1; if(wx < bx) wx = bx; the_map.RenderZSurface(&entry_bar_white_i_img, wx, by); } } //left text if(e->message_left[i].size()) { ZSDL_Surface message_img; message_img.LoadBaseImage(ZFontEngine::GetFont(SMALL_WHITE_FONT).Render(e->message_left[i].c_str())); the_map.RenderZSurface(&message_img, bx + 2, by + 3); } //right text if(e->message_right[i].size()) { ZSDL_Surface message_img; message_img.LoadBaseImage(ZFontEngine::GetFont(SMALL_WHITE_FONT).Render(e->message_right[i].c_str())); if(message_img.GetBaseSurface()) the_map.RenderZSurface(&message_img, bx + 101 - message_img.GetBaseSurface()->w, by + 3); } by += 17; } ty += main_entry_img.GetBaseSurface()->h; } }