DynamicModelVertex *TranslationMatrix::getVertex(int x, int y, int z, int normal) { if (x < 0) { x = _width - 1 ; } if (y < 0) { y = _height - 1 ; } ASSERT_LE(x, _width - 1); ASSERT_LE(y, _height - 1); ZMap *zmap = _matrix + (normal * _width * _height) + (y * _width) + x; ZMap::iterator itr = zmap->find(z); return itr == zmap->end() ? NULL : itr->second; }
void EMissileCRockets::DoRender(ZMap &zmap, SDL_Surface *dest) { SDL_Rect from_rect, to_rect; if(killme) return; zmap.RenderZSurface(&bullet_img, x, y, false, true); //if(zmap.GetBlitInfo(bullet_img, x, y, from_rect, to_rect)) // SDL_BlitSurface( bullet_img, &from_rect, dest, &to_rect); zmap.RenderZSurface(&bullet_img, x + other_x_shift, y + other_y_shift, false, true); //if(zmap.GetBlitInfo(bullet_img, x + other_x_shift, y + other_y_shift, from_rect, to_rect)) // SDL_BlitSurface( bullet_img, &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 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 OMapObject::SetMapImpassables(ZMap &tmap) { int tx, ty; tx = loc.x / 16; ty = loc.y / 16; tmap.SetImpassable(tx, ty, true, true); }
void OHut::UnSetMapImpassables(ZMap &tmap) { int tx, ty; tx = loc.x / 16; ty = loc.y / 16; tmap.SetImpassable(tx, ty, false, true); }
void ELightInitFire::DoRender(ZMap &zmap/*, SDL_Surface *dest*/) { //SDL_Rect from_rect, to_rect; if(killme) return; zmap.RenderZSurface(&render_img[render_i], x, y); //if(zmap.GetBlitInfo( render_img[render_i], x, y, from_rect, to_rect)) // SDL_BlitSurface( render_img[render_i], &from_rect, dest, &to_rect); }
void EToughSmoke::DoRender(ZMap &zmap, SDL_Surface *dest) { SDL_Rect from_rect, to_rect; if(killme) return; zmap.RenderZSurface(&render_img[render_i], x, y, false, true); //if(zmap.GetBlitInfo( render_img[render_i], x, y, from_rect, to_rect)) // SDL_BlitSurface( render_img[render_i], &from_rect, dest, &to_rect); }
void ETankSpark::DoPreRender(ZMap &zmap, SDL_Surface *dest) { ZSDL_Surface *render_img; if(killme) return; render_img = &tank_spark[ni]; if(!render_img) return; zmap.RenderZSurface(render_img, cx, cy, false, true); }
void EDeath::DoRender(ZMap &zmap/*, SDL_Surface *dest*/) { //SDL_Rect from_rect, to_rect; if(killme) return; zmap.RenderZSurface(wasted_img, x, y); //if(zmap.GetBlitInfo( wasted_img, x, y, from_rect, to_rect)) // SDL_BlitSurface( wasted_img, &from_rect, dest, &to_rect); for(vector<EStandard*>::iterator i=extra_effects.begin(); i!=extra_effects.end(); i++) (*i)->DoRender(zmap/*, dest*/); }
void GWProduction::DoRender(ZMap &the_map, SDL_Surface *dest) { int lx, ly; SDL_Rect from_rect, to_rect; if(killme) return; if(!building_obj) { killme = true; return; } if(!is_expanded) the_map.RenderZSurface(&base_img, x, y); else the_map.RenderZSurface(&base_expanded_img, x, y); lx = x + 9; ly = y + 6; the_map.RenderZSurface(&name_label[type], lx, ly); //if(the_map.GetBlitInfo(name_label[type], x + lx, y + ly, from_rect, to_rect)) // SDL_BlitSurface( name_label[type], &from_rect, dest, &to_rect); lx = x + 64; ly = y + 19; the_map.RenderZSurface(&state_label[state][state_i], lx, ly); //if(the_map.GetBlitInfo( state_label[state][state_i], x + lx, y + ly, from_rect, to_rect)) // SDL_BlitSurface( state_label[state][state_i], &from_rect, dest, &to_rect); //buttons ok_button.DoRender(the_map, dest, x, y); cancel_button.DoRender(the_map, dest, x, y); place_button.DoRender(the_map, dest, x, y); small_plus_button.DoRender(the_map, dest, x, y); small_minus_button.DoRender(the_map, dest, x, y); queue_button.DoRender(the_map, dest, x, y); //queue_list buttons RenderQueueButtonList(the_map, dest); lx = x + 90; ly = y + 35; the_map.RenderZSurface(&show_time_img, lx, ly); //if(show_time_img) // if(the_map.GetBlitInfo( show_time_img, x + 90, y + 35, from_rect, to_rect)) // SDL_BlitSurface( show_time_img, &from_rect, dest, &to_rect); if(health_percent_img.GetBaseSurface()) { lx = x + 86 - (health_percent_img.GetBaseSurface()->w >> 1); ly = y + 6; the_map.RenderZSurface(&health_percent_img, lx, ly); }
void EDeathSparks::DoRender(ZMap &zmap, SDL_Surface *dest) { SDL_Rect from_rect, to_rect; //SDL_Surface *render_img; if(killme) return; //render_img = base_img[render_i].GetImage(size); base_img[render_i].SetSize(size); zmap.RenderZSurface(&base_img[render_i], x, y, false, true); //if(zmap.GetBlitInfo( render_img, x, y, from_rect, to_rect)) // SDL_BlitSurface( render_img, &from_rect, dest, &to_rect); }
void EToughRocket::DoRender(ZMap &zmap, SDL_Surface *dest) { SDL_Rect from_rect, to_rect; if(killme) return; zmap.RenderZSurface(&bullet_img[0], x, y, false, true); //if(zmap.GetBlitInfo(bullet_img[0], x, y, from_rect, to_rect)) // SDL_BlitSurface( bullet_img[bullet_i], &from_rect, dest, &to_rect); //always new bullet_i++; if(bullet_i) bullet_i = 0; }
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 ORockets::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; the_map.RenderZSurface(&render_img, x, y); //if(the_map.GetBlitInfo( render_img, x, y, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // SDL_BlitSurface( render_img, &from_rect, dest, &to_rect); //} }
void ETankSmoke::DoPreRender(ZMap &zmap, SDL_Surface *dest) { ZSDL_Surface *render_img; if(killme) return; if(do_spark && ni<4) render_img = &tank_spark[direction][ni]; else render_img = &tank_smoke[direction][ni]; if(!render_img) return; if(!render_img->GetBaseSurface()) return; zmap.RenderZSurface(render_img, x, y); }
void ERockParticle::DoRender(ZMap &zmap, SDL_Surface *dest) { SDL_Rect from_rect, to_rect; //SDL_Surface *surface; if(killme) return; //surface = render_img[render_i].GetImage(size); render_img[render_i].SetSize(size); //if(!surface) return; zmap.RenderZSurface(&render_img[render_i], x, y, false, true); //if(zmap.GetBlitInfo( surface, x - (surface->w >> 1), y - (surface->h >> 1), from_rect, to_rect)) // SDL_BlitSurface( surface, &from_rect, dest, &to_rect); }
void EMapObjectTurrent::DoRender(ZMap &zmap, SDL_Surface *dest) { SDL_Rect from_rect, to_rect; //SDL_Surface *render_img; if(killme) return; //render_img = object_img[object].GetImage(angle, size); object_img[object].SetAngle(angle); object_img[object].SetSize(size); //if(!render_img) return; zmap.RenderZSurface(&object_img[object], x, y, false, true); //if(zmap.GetBlitInfo(render_img, x - (render_img->w >> 1), y - (render_img->h >> 1), from_rect, to_rect)) // SDL_BlitSurface( render_img, &from_rect, dest, &to_rect); }
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 ERockTurrent::DoRender(ZMap &zmap, SDL_Surface *dest) { SDL_Rect from_rect, to_rect; //SDL_Surface *surface; if(killme) return; //surface = debri_large_img[large_i][palette][render_i].GetImage(angle, size); debri_large_img[large_i][palette][render_i].SetAngle(angle); debri_large_img[large_i][palette][render_i].SetSize(size); //if(!surface) return; zmap.RenderZSurface(&debri_large_img[large_i][palette][render_i], x, y, false, true); //if(zmap.GetBlitInfo( surface, x - (surface->w >> 1), y - (surface->h >> 1), from_rect, to_rect)) // SDL_BlitSurface( surface, &from_rect, dest, &to_rect); }
void ZVote::DoRender(ZMap &the_map) { if(in_progress && vote_in_progress_img.GetBaseSurface()) { int shift_x, shift_y, view_w, view_h; int x, y; the_map.GetViewShiftFull(shift_x, shift_y, view_w, view_h); x = view_w - vote_in_progress_img.GetBaseSurface()->w; //y = view_h - vote_in_progress_img.GetBaseSurface()->h; x -= 4; y = 4; x += shift_x; y += shift_y; vote_in_progress_img.SetAlpha(200); description_img.SetAlpha(200); have_img.SetAlpha(200); needed_img.SetAlpha(200); for_img.SetAlpha(200); against_img.SetAlpha(200); the_map.RenderZSurface(&vote_in_progress_img, x, y); //the_map.RenderZSurface(&description_img, x+7, y+37, false, true); the_map.RenderZSurface(&description_img, x+57, y+36+5, false, true); the_map.RenderZSurface(&have_img, x+57, y+46+7, false, true); the_map.RenderZSurface(&needed_img, x+57, y+57+7, false, true); the_map.RenderZSurface(&for_img, x+22, y+57+7, false, true); the_map.RenderZSurface(&against_img, x+91, y+57+7, false, true); } }
void GWFactoryList::DoRender(ZMap &the_map, SDL_Surface *dest) { int shift_x, shift_y, view_w, view_h; int tx, ty; if(!show) return; if(!finished_init) return; if(!ols) return; if(our_team == NULL_TEAM) return; the_map.GetViewShiftFull(shift_x, shift_y, view_w, view_h); x = shift_x; y = shift_y + view_h; DetermineHeight(view_h); y -= height; //top the_map.RenderZSurface(&main_top_img, x, y); //entries DoRenderEntries(the_map, dest); //right { tx = x + (main_top_img.GetBaseSurface()->w - main_right_img.GetBaseSurface()->w); ty = y + main_top_img.GetBaseSurface()->h; while(ty < shift_y + view_h) { the_map.RenderZSurface(&main_right_img, tx, ty); ty += main_right_img.GetBaseSurface()->h; } } if(entry_list.size()) { int scroll_top; int scroll_bottom; int scroll_missing_entries; //buttons up_button.SetOffsets(123, main_top_img.GetBaseSurface()->h + 2); up_button.DoRender(the_map, dest, x, y); down_button.SetOffsets(123, height - 11); down_button.DoRender(the_map, dest, x, y); //scrollbar scroll_top = main_top_img.GetBaseSurface()->h + 14; scroll_bottom = height - 14; scroll_bar.SetOffsets(123, scroll_top); scroll_bar.SetHeight(scroll_bottom - scroll_top); scroll_missing_entries = entry_list.size() - show_able_entries; if(scroll_missing_entries > 0) scroll_bar.SetPercentDown(1.0 * show_start_entry / scroll_missing_entries); else scroll_bar.SetPercentDown(0); scroll_bar.SetPercentViewable(1.0 * show_able_entries / entry_list.size()); scroll_bar.DoRender(the_map, dest, x, y); } }
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; } }
void ZVehicle::RenderLid(ZMap &the_map, /*SDL_Surface *dest,*/ int &lx, int &ly, int &shift_x, int &shift_y) { const int robot_shift_x[8] = {3, -1, -3, -7, -10, -7, -4, 0}; const int robot_shift_y[8] = {0, -4, -6, -4, 0, 1, 1, 1}; int rx, ry; ZSDL_Surface *lid_surface; ZSDL_Surface *robot_surface; //SDL_Rect from_rect, to_rect; lid_surface = &lid[t_direction][lid_i]; if(show_robot) { robot_surface = &tank_robot[owner][t_direction][robot_i]; rx = lx + robot_shift_x[t_direction]; ry = ly + robot_shift_y[t_direction]; //render order is different depending on the direction if(t_direction > 3 || !t_direction) { the_map.RenderZSurface(lid_surface, lx, ly, do_hit_effect); //if(the_map.GetBlitInfo(lid_surface, lx, ly, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface(lid_surface, &from_rect, dest, &to_rect, do_hit_effect); //} the_map.RenderZSurface(robot_surface, rx, ry, do_driver_hit_effect); //if(the_map.GetBlitInfo(robot_surface, rx, ry, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface(robot_surface, &from_rect, dest, &to_rect, do_driver_hit_effect); //} } else { the_map.RenderZSurface(robot_surface, rx, ry, do_driver_hit_effect); //if(the_map.GetBlitInfo(robot_surface, rx, ry, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface(robot_surface, &from_rect, dest, &to_rect, do_driver_hit_effect); //} the_map.RenderZSurface(lid_surface, lx, ly, do_hit_effect); //if(the_map.GetBlitInfo(lid_surface, lx, ly, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface(lid_surface, &from_rect, dest, &to_rect, do_hit_effect); //} } } else { //just the lid the_map.RenderZSurface(lid_surface, lx, ly, do_hit_effect); //if(the_map.GetBlitInfo(lid_surface, lx, ly, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface(lid_surface, &from_rect, dest, &to_rect, do_hit_effect); //} } do_driver_hit_effect = false; }
void ETurrentMissile::DoRender(ZMap &zmap/*, SDL_Surface *dest*/) { //SDL_Rect from_rect, to_rect; if(killme) return; switch(object) { case ETURRENTMISSILE_LIGHT: render_img = &light_turrent[render_i]; break; case ETURRENTMISSILE_MEDIUM: render_img = &medium_turrent[render_i]; break; case ETURRENTMISSILE_HEAVY: render_img = &heavy_turrent[team][render_i]; break; case ETURRENTMISSILE_GATLING: render_img = &gatling_wasted; break; case ETURRENTMISSILE_GUN: render_img = &gun_wasted; break; case ETURRENTMISSILE_HOWITZER: render_img = &howitzer_wasted; break; case ETURRENTMISSILE_MISSILE_CANNON: render_img = &missile_wasted; break; case ETURRENTMISSILE_BUILDING_PEICE0: render_img = &building_piece[0][render_i]; break; case ETURRENTMISSILE_BUILDING_PEICE1: render_img = &building_piece[1][render_i]; break; case ETURRENTMISSILE_FORT_BUILDING_PEICE0: render_img = &fort_building_piece[0][render_i]; break; case ETURRENTMISSILE_FORT_BUILDING_PEICE1: render_img = &fort_building_piece[1][render_i]; break; case ETURRENTMISSILE_FORT_BUILDING_PEICE2: render_img = &fort_building_piece[2][render_i]; break; case ETURRENTMISSILE_FORT_BUILDING_PEICE3: render_img = &fort_building_piece[3][render_i]; break; case ETURRENTMISSILE_FORT_BUILDING_PEICE4: render_img = &fort_building_piece[4][render_i]; break; case ETURRENTMISSILE_GRENADE: render_img = &grenade_img[render_i]; break; default: return; break; } if(!render_img) return; render_img->SetAngle(angle); render_img->SetSize(size); zmap.RenderZSurface(render_img, x, y, false, true); //if(zmap.GetBlitInfo(render_img, x - (render_img->w >> 1), y - (render_img->h >> 1), from_rect, to_rect)) // SDL_BlitSurface( render_img, &from_rect, dest, &to_rect); }
void VMedium::DoRender(ZMap &the_map, /*SDL_Surface *dest,*/ int shift_x, int shift_y) { int &x = loc.x; int &y = loc.y; //const int unit_x[8] = {0, 0, 0, 0, 0, 0, 0, 0}; const int unit_y[8] = {6, 0, 5, 0, 6, 0, 5, 0}; const int turrent_x[8] = {0, 0, -1, -2, 0, 0, -1, -2}; const int turrent_y[8] = {0, 6, 0, 6, 0, 6, 0, 6}; const int turrent_shift_x[8] = { 4, 5, 7, 5, 2, 6, 7, 5}; const int turrent_shift_y[8] = {-5, -3, -4, -5, -5, -5, -5, -5}; const int lid_shift_x = 12; const int lid_shift_y = -5; ZSDL_Surface *base_surface; //SDL_Rect from_rect, to_rect; int lx, ly; if(IsDestroyed()) { the_map.RenderZSurface(&base_damaged[owner][direction][move_i], x, y); //if(the_map.GetBlitInfo(base_damaged[owner][direction][move_i], x, y, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // SDL_BlitSurface( base_damaged[owner][direction][move_i], &from_rect, dest, &to_rect); //} return; } if(!ShowDamaged()) base_surface = &base[owner][direction][move_i]; else base_surface = &base_damaged[owner][direction][move_i]; lx = x;// + unit_x[direction]; ly = y + unit_y[direction]; the_map.RenderZSurface(base_surface, lx, ly, do_hit_effect); //if(the_map.GetBlitInfo(base_surface, lx, ly, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface( base_surface, &from_rect, dest, &to_rect, do_hit_effect); //} if(owner != NULL_TEAM) { lx = x + turrent_x[direction] + turrent_shift_x[t_direction];// + unit_x[direction]; ly = y + turrent_y[direction] + turrent_shift_y[t_direction] + unit_y[direction]; the_map.RenderZSurface(&top[t_direction], lx, ly, do_hit_effect); //if(the_map.GetBlitInfo(top[t_direction], lx, ly, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface(top[t_direction], &from_rect, dest, &to_rect, do_hit_effect); //} lx = x + turrent_x[direction] + lid_shift_x;// + unit_x[direction]; ly = y + turrent_y[direction] + lid_shift_y + unit_y[direction]; RenderLid(the_map, /*dest,*/ lx, ly, shift_x, shift_y); } do_hit_effect = false; }
void VHeavy::DoRender(ZMap &the_map, SDL_Surface *dest, int shift_x, int shift_y) { int &x = loc.x; int &y = loc.y; const int turrent_x[MAX_ANGLE_TYPES] = {4, 2, -1, -3, 4, 2, -1, -3}; const int turrent_y[MAX_ANGLE_TYPES] = {0, -3, -5, -4, 0, -3, -5, -4}; const int turrent_shift_x[MAX_ANGLE_TYPES] = {4, 0, 0, 0, -4, 0, 0, 0}; const int turrent_shift_y[MAX_ANGLE_TYPES] = {0, -2, -2, -2, 0, 0, 0, 0}; const int lid_shift_x[MAX_ANGLE_TYPES] = {8, 13, 16, 17, 16, 11, 7, 7}; const int lid_shift_y[MAX_ANGLE_TYPES] = {9, 9, 7, 4, 3, 2, 4, 7}; ZSDL_Surface *base_surface; SDL_Rect from_rect, to_rect; int lx, ly; if(IsDestroyed()) { the_map.RenderZSurface(&base_damaged[owner][direction][move_i], x, y); //if(the_map.GetBlitInfo(base_damaged[owner][direction][move_i], x, y, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // SDL_BlitSurface( base_damaged[owner][direction][move_i], &from_rect, dest, &to_rect); //} return; } if(!ShowDamaged()) base_surface = &base[owner][direction][move_i]; else base_surface = &base_damaged[owner][direction][move_i]; the_map.RenderZSurface(base_surface, x, y, do_hit_effect); //if(the_map.GetBlitInfo(base_surface, x, y, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface( base_surface, &from_rect, dest, &to_rect, do_hit_effect); //} if(owner != NULL_TEAM && !destroyed) { lx = x + turrent_x[direction] + turrent_shift_x[t_direction]; ly = y + turrent_y[direction] + turrent_shift_y[t_direction]; the_map.RenderZSurface(&top[owner][t_direction], lx, ly, do_hit_effect); //if(the_map.GetBlitInfo(top[owner][t_direction], lx, ly, from_rect, to_rect)) //{ // to_rect.x += shift_x; // to_rect.y += shift_y; // ZSDL_BlitHitSurface(top[owner][t_direction], &from_rect, dest, &to_rect, do_hit_effect); //} lx = x + turrent_x[direction] + lid_shift_x[t_direction]; ly = y + turrent_y[direction] + lid_shift_y[t_direction]; RenderLid(the_map, dest, lx, ly, shift_x, shift_y); } do_hit_effect = false; }