Changeset 665 for abuse/trunk/src/particle.cpp
- Timestamp:
- May 15, 2011, 5:32:56 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/particle.cpp
r643 r665 171 171 void part_frame::draw(image *screen, int x, int y, int dir) 172 172 { 173 int cx1, cy1, cx2, cy2; 174 screen->GetClip(cx1, cy1, cx2, cy2); 175 if (x + x1 >= cx2 || x + x2 < cx1 || y + y1 >= cy2 || y + y2 < cy1) return; 173 vec2i caa, cbb; 174 screen->GetClip(caa, cbb); 175 176 if (x + x1 >= cbb.x || x + x2 < caa.x || y + y1 >= cbb.y || y + y2 < caa.y) 177 return; 176 178 177 179 part *pon=data; 178 c y1-= y;179 c y2-= y;180 caa.y -= y; 181 cbb.y -= y; 180 182 181 183 int i=t; 182 while (i && pon->y<c y1) { pon++; i--; }184 while (i && pon->y<caa.y) { pon++; i--; } 183 185 if (!i) return ; 184 186 screen->Lock(); 185 187 if (dir>0) 186 188 { 187 while (i && pon->y < c y2)189 while (i && pon->y < cbb.y) 188 190 { 189 191 long dx=x-pon->x; 190 if (dx >= c x1 && dx < cx2)192 if (dx >= caa.x && dx < cbb.x) 191 193 *(screen->scan_line(pon->y+y)+dx)=pon->color; 192 194 i--; … … 195 197 } else 196 198 { 197 while (i && pon->y < c y2)199 while (i && pon->y < cbb.y) 198 200 { 199 201 long dx=pon->x+x; 200 if (dx >= c x1 && dx < cx2)202 if (dx >= caa.x && dx < cbb.x) 201 203 *(screen->scan_line(pon->y+y)+dx)=pon->color; 202 204 i--; … … 209 211 void scatter_line(int x1, int y1, int x2, int y2, int c, int s) 210 212 { 211 int cx1, cy1, cx2, cy2;212 main_screen->GetClip(c x1, cy1, cx2, cy2);213 vec2i caa, cbb; 214 main_screen->GetClip(caa, cbb); 213 215 214 216 int t = abs( x2 - x1 ) > abs( y2 - y1 ) ? abs( x2 - x1 ) + 1 : abs( y2 - y1 ) + 1; … … 224 226 x = ( xo >> 16 ) + ( jrand() >> s ) - xm; 225 227 y = ( yo >> 16 ) + ( jrand() >> s ) - ym; 226 if( !( x < c x1 || y < cy1 || x >= cx2 || y >= cy2) )228 if( !( x < caa.x || y < caa.y || x >= cbb.x || y >= cbb.y ) ) 227 229 { 228 230 *(main_screen->scan_line( y ) + x ) = c; … … 238 240 void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s) 239 241 { 240 int cx1, cy1, cx2, cy2;241 main_screen->GetClip(c x1, cy1, cx2, cy2);242 vec2i caa, cbb; 243 main_screen->GetClip(caa, cbb); 242 244 243 245 int t = abs( x2 - x1 ) > abs( y2 - y1 ) ? abs( x2 - x1 ) + 1 : abs( y2 - y1 ) + 1; … … 259 261 // FIXME: these clip values seemed wrong to me before the GetClip 260 262 // refactoring. 261 if( !( x <= c x1 || y <= cy1 || x >= cx2 - 1 || y >= cy2- 1) )263 if( !( x <= caa.x || y <= caa.y || x >= cbb.x - 1 || y >= cbb.y - 1) ) 262 264 { 263 265 addr = main_screen->scan_line( y ) + x;
Note: See TracChangeset
for help on using the changeset viewer.