Changeset 666
- Timestamp:
- May 16, 2011, 2:37:11 AM (11 years ago)
- Location:
- abuse/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/TODO
r665 r666 61 61 - scale_put, scale_put_trans 62 62 - tint_area, darken_area 63 - fg_width, etc. 63 64 64 65 Jwindow::_x1 _x2 … … 70 71 71 72 x, y in game_object? 72 get_fg ?73 73 snap_x() snap_y() 74 74 scatter_line, ascatter_line -
abuse/trunk/src/clisp.cpp
r658 r666 1668 1668 lbreak("%d %d is out of range of fg map",x,y); 1669 1669 else 1670 current_level-> put_fg(x,y,type);1670 current_level->PutFg(vec2i(x, y), type); 1671 1671 } break; 1672 1672 case 193 : … … 1676 1676 if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width()) 1677 1677 lbreak("%d %d is out of range of fg map",x,y); 1678 else return current_level-> get_fg(x,y);1678 else return current_level->GetFg(vec2i(x, y)); 1679 1679 } break; 1680 1680 case 194 : … … 1686 1686 lbreak("%d %d is out of range of fg map",x,y); 1687 1687 else 1688 current_level-> put_bg(x,y,type);1688 current_level->PutBg(vec2i(x, y), type); 1689 1689 } break; 1690 1690 case 195 : … … 1694 1694 if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width()) 1695 1695 lbreak("%d %d is out of range of fg map",x,y); 1696 else return current_level-> get_bg(x,y);1696 else return current_level->GetBg(vec2i(x, y)); 1697 1697 } break; 1698 1698 case 196 : load_tiles(args); break; -
abuse/trunk/src/dev.cpp
r665 r666 1057 1057 for (y=0,i=cur_bg; y<h; y++) 1058 1058 for (x=0; x<l; x++) 1059 the_game-> put_bg(tile.x+x,tile.y+y,i++);1059 the_game->PutBg(tile + vec2i(x, y), i++); 1060 1060 dprintf("%dx%d\n",l,h); 1061 1061 } else dprintf(symbol_str("unchop1")); … … 1217 1217 tile.y < current_level->foreground_height()) 1218 1218 { 1219 cur_fg=current_level-> get_fg(tile.x, tile.y);1219 cur_fg=current_level->GetFg(tile); 1220 1220 if (forew) 1221 1221 ((tile_picker *)forew->read(DEV_FG_PICKER))->recenter(forew->m_surf); … … 1862 1862 if (tile.x>=0 && tile.y>=0 && tile.x<current_level->foreground_width() && 1863 1863 tile.y<current_level->foreground_height()) 1864 current_level-> put_fg(tile.x,tile.y,raise_all ? make_above_tile(cur_fg) : cur_fg);1864 current_level->PutFg(tile, raise_all ? make_above_tile(cur_fg) : cur_fg); 1865 1865 the_game->need_refresh(); 1866 1866 } else if (ev.mouse_button==1 && !selected_object && !selected_light) … … 1869 1869 if (tile.x>=0 && tile.y>=0 && tile.x<current_level->background_width() && 1870 1870 tile.y<current_level->background_height()) 1871 current_level-> put_bg(tile.x,tile.y,cur_fg);1871 current_level->PutBg(tile, cur_fg); 1872 1872 the_game->need_refresh(); 1873 1873 } … … 1954 1954 if (tile.x>=0 && tile.y>=0 && tile.x<current_level->foreground_width() && 1955 1955 tile.y<current_level->foreground_height()) 1956 the_game-> put_fg(tile.x,tile.y,raise_all ? make_above_tile(cur_fg) : cur_fg);1956 the_game->PutFg(tile, raise_all ? make_above_tile(cur_fg) : cur_fg); 1957 1957 } 1958 1958 if ((dev & DRAW_BG_LAYER) && ev.mouse_button==2) … … 1961 1961 if (tile.x>=0 && tile.y>=0 && tile.x<current_level->background_width() && 1962 1962 tile.y<current_level->background_height()) 1963 the_game-> put_bg(tile.x,tile.y,cur_bg);1963 the_game->PutBg(tile, cur_bg); 1964 1964 } 1965 1965 } … … 3109 3109 if (xx>=0 && yy>=0 && xx<current_level->foreground_width() && 3110 3110 yy<current_level->foreground_height()) 3111 the_game-> put_fg(xx,yy,raise_all ? make_above_tile(pat[xx-tile.x+(yy-tile.y)*w]) : pat[xx-tile.x+(yy-tile.y)*w] );3111 the_game->PutFg(vec2i(xx, yy), raise_all ? make_above_tile(pat[xx-tile.x+(yy-tile.y)*w]) : pat[xx-tile.x+(yy-tile.y)*w] ); 3112 3112 } 3113 3113 } -
abuse/trunk/src/game.cpp
r665 r666 544 544 } 545 545 546 void Game::put_block_fg(int x, int y, TransImage *im)547 {548 for(view *f = first_view; f; f = f->next)549 {550 if(f->drawable())551 {552 int xoff = f->xoff(), yoff = f->yoff(), viewx1 = f->cx1, viewy1 = f->cy1, viewx2 = f->cx2, viewy2 = f->cy2;553 if(xoff / ftile_width()>x || xoff / ftile_width()+(viewx2 - viewx1)/ftile_width()+1 < x ||554 yoff / ftile_height()>y || yoff / ftile_height()+(viewy2 - viewy1)/ftile_height()+1 < y) return;555 vec2i caa, cbb;556 main_screen->GetClip(caa, cbb);557 main_screen->SetClip(vec2i(viewx1, viewy1), vec2i(viewx2 + 1, viewy2 + 1));558 im->PutImage(main_screen, vec2i((x - xoff / ftile_width())*ftile_width()+viewx1 - xoff % ftile_width(),559 (y - yoff / ftile_height())*ftile_height()+viewy1 - yoff % ftile_height()));560 main_screen->SetClip(caa, cbb);561 }562 }563 }564 565 void Game::put_block_bg(int x, int y, image *im)566 {567 for(view *f = first_view; f; f = f->next)568 {569 if(f->drawable())570 {571 int xoff = f->xoff(), yoff = f->yoff(), viewx1 = f->cx1, viewy1 = f->cy1, viewx2 = f->cx2, viewy2 = f->cy2;572 int xo = xoff * bg_xmul / bg_xdiv;573 int yo = yoff * bg_ymul / bg_ydiv;574 575 if(xo / btile_width()>x || xo / btile_width()+(viewx2 - viewx1)/btile_width()+1 < x ||576 yo / btile_height()>y || yo / btile_height()+(viewy2 - viewy1)/btile_height()+1 < y) return;577 vec2i caa, cbb;578 main_screen->GetClip(caa, cbb);579 main_screen->SetClip(vec2i(viewx1, viewy1), vec2i(viewx2 + 1, viewy2 + 1));580 main_screen->PutImage(im, vec2i((x - xo / btile_width())*btile_width()+viewx1 - xo % btile_width(),581 (y - yo / btile_height())*btile_height()+viewy1 - yo % btile_height()), 0);582 main_screen->SetClip(caa, cbb);583 }584 }585 }586 587 546 int need_delay = 1; 588 547 … … 1099 1058 } 1100 1059 1101 void Game::put_fg(int x, int y, int type) 1102 { 1103 if(current_level->get_fg(x, y)!=type) 1104 { 1105 current_level->put_fg(x, y, type); 1060 void Game::PutFg(vec2i pos, int type) 1061 { 1062 if (current_level->GetFg(pos) == type) 1063 return; 1064 1065 current_level->PutFg(pos, type); 1106 1066 for(view *f = first_view; f; f = f->next) 1107 if(f->drawable())1108 draw_map(f);1109 1110 } 1111 1112 void Game::put_bg(int x, int y, int type) 1113 { 1114 if(current_level->get_bg(x, y)!=type)1115 { 1116 current_level-> put_bg(x, y, type);1067 if(f->drawable()) 1068 draw_map(f); 1069 } 1070 1071 void Game::PutBg(vec2i pos, int type) 1072 { 1073 if (current_level->GetBg(pos) == type) 1074 return; 1075 1076 current_level->PutBg(pos, type); 1117 1077 for(view *f = first_view; f; f = f->next) 1118 if(f->drawable()) 1119 draw_map(f); 1120 } 1078 if(f->drawable()) 1079 draw_map(f); 1121 1080 } 1122 1081 -
abuse/trunk/src/game.h
r657 r666 125 125 126 126 127 void put_fg(int x, int y, int type);128 void put_bg(int x, int y, int type);127 void PutFg(vec2i pos, int type); 128 void PutBg(vec2i pos, int type); 129 129 void draw_map(view *v, int interpolate=0); 130 130 void dev_scroll(); 131 void put_block_fg(int x, int y, TransImage *im);132 void put_block_bg(int x, int y, image *im);133 134 131 135 132 int in_area(Event &ev, int x1, int y1, int x2, int y2); … … 137 134 void set_level(level *nl); 138 135 void show_time(); 139 tile_type get_map_bg(int x, int y) { return current_level->get_bg(x,y); }140 tile_type get_map_fg(int x, int y) { return current_level->get_fg(x,y); }136 tile_type GetMapBg(vec2i pos) { return current_level->GetBg(pos); } 137 tile_type GetMapFg(vec2i pos) { return current_level->GetFg(pos); } 141 138 void end_session(); 142 139 void need_refresh() { refresh=1; } // for development mode only … … 156 153 void request_level_load(char *name); 157 154 void request_end(); 158 } 155 }; 159 156 160 157 extern int playing_state(int state); -
abuse/trunk/src/level.cpp
r657 r666 844 844 for (y=0; y<miny; y++) 845 845 for (x=0; x<minx; x++) 846 new_fg[x+y*w]= get_fg(x,y);846 new_fg[x+y*w]=GetFg(vec2i(x, y)); 847 847 848 848 miny=(nbh<bg_height) ? nbh : bg_height; … … 851 851 for (y=0; y<miny; y++) 852 852 for (x=0; x<minx; x++) 853 new_bg[x+y*nbw]= get_bg(x,y);853 new_bg[x+y*nbw]=GetBg(vec2i(x, y)); 854 854 855 855 free(map_fg); … … 2638 2638 for (by=blocky1; by<=blocky2; by++) 2639 2639 { 2640 block=the_game-> get_map_fg(bx,by);2640 block=the_game->GetMapFg(vec2i(bx, by)); 2641 2641 if (block>BLACK) // don't check BLACK, should be no points in it 2642 2642 { … … 2712 2712 for (by=blocky1; by<=blocky2; by++,y1-=f_hi,y2-=f_hi,y_addback+=f_hi) 2713 2713 { 2714 block=the_game-> get_map_fg(bx,by);2714 block=the_game->GetMapFg(vec2i(bx, by)); 2715 2715 2716 2716 // now check the all the line segments in the block -
abuse/trunk/src/level.h
r555 r666 117 117 uint16_t *get_fgline(int y) { CHECK(y>=0 && y<fg_height); return map_fg+y*fg_width; } 118 118 uint16_t *get_bgline(int y) { CHECK(y>=0 && y<bg_height); return map_bg+y*bg_width; } 119 uint16_t get_fg(int x, int y) { if (x>=0 && y>=0 && x<fg_width && y<fg_height)120 return fgvalue(*(map_fg+ x+y*fg_width));119 uint16_t GetFg(vec2i pos) { if (pos >= vec2i(0) && pos < vec2i(fg_width, fg_height)) 120 return fgvalue(*(map_fg+pos.x+pos.y*fg_width)); 121 121 else return 0; 122 122 } 123 uint16_t get_bg(int x, int y) { if (x>=0 && y>=0 && x<bg_width && y<bg_height)124 return *(map_bg+ x+y*bg_width);123 uint16_t GetBg(vec2i pos) { if (pos >= vec2i(0) && pos < vec2i(bg_width, bg_height)) 124 return *(map_bg+pos.x+pos.y*bg_width); 125 125 else return 0; 126 126 } 127 void put_fg(int x, int y, uint16_t tile) { *(map_fg+x+y*fg_width)=tile; }128 void put_bg(int x, int y, uint16_t tile) { *(map_bg+x+y*bg_width)=tile; }127 void PutFg(vec2i pos, uint16_t tile) { *(map_fg+pos.x+pos.y*fg_width)=tile; } 128 void PutBg(vec2i pos, uint16_t tile) { *(map_bg+pos.x+pos.y*bg_width)=tile; } 129 129 void draw_objects(view *v); 130 130 void interpolate_draw_objects(view *v);
Note: See TracChangeset
for help on using the changeset viewer.