Revision 212
now working
graph.c | ||
---|---|---|
260 | 260 |
int (graph_draw)(void){ memcpy(video_mem, video_buf, graph_get_vram_size()); return SUCCESS; } |
261 | 261 |
|
262 | 262 |
///SPRITE |
263 |
#include "sprite.h" |
|
264 |
|
|
263 | 265 |
#include "utils.h" |
264 | 266 |
#include "fast_math.h" |
265 | 267 |
#include <math.h> |
... | ... | |
363 | 365 |
const uint8_t *map = basic_sprite_get_map(p->bsp); |
364 | 366 |
const uint16_t bytes_pixel = graph_get_bytes_pixel(); |
365 | 367 |
for(int16_t u, v, y = ymin; y < ymax; ++y){ |
366 |
unsigned pos = (xmin + y*graph_get_XRes())*bytes_pixel;
|
|
367 |
for(int16_t x = xmin; x < xmax; ++x, pos += bytes_pixel){
|
|
368 |
uint8_t *place = video_buf + (xmin + y*graph_get_XRes())*bytes_pixel;
|
|
369 |
for(int16_t x = xmin; x < xmax; ++x, place += bytes_pixel){
|
|
368 | 370 |
sprite_src2pic(p, x, y, &u, &v); |
369 | 371 |
if(0 <= u && u < w && 0 <= v && v < h){ |
370 |
uint32_t c = *(uint32_t*)(map + (v*w + u)*4);
|
|
371 |
if(GET_ALP(c) < 0x7F)
|
|
372 |
graph_set_pixel_pos(pos, c);
|
|
372 |
const uint8_t *c_p = map+(v*w+u)*4;
|
|
373 |
if(*(c_p+3) < 0x7F) //alpha
|
|
374 |
memcpy(place, c_p, bytes_pixel);
|
|
373 | 375 |
} |
374 | 376 |
} |
375 | 377 |
} |
Also available in: Unified diff