1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> |
---|
5 | * |
---|
6 | * This software was released into the Public Domain. As with most public |
---|
7 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
8 | * Jonathan Clark. |
---|
9 | */ |
---|
10 | |
---|
11 | #include "config.h" |
---|
12 | |
---|
13 | #include <stdlib.h> |
---|
14 | |
---|
15 | #include "common.h" |
---|
16 | |
---|
17 | #include "image.h" |
---|
18 | #include "video.h" |
---|
19 | |
---|
20 | void update_dirty(image *im, int xoff, int yoff) |
---|
21 | { |
---|
22 | // make sure the image has the ability to contain dirty areas |
---|
23 | CHECK(im->m_special); |
---|
24 | |
---|
25 | if(im->m_special->keep_dirt == 0) |
---|
26 | { |
---|
27 | put_image(im, xoff, yoff); |
---|
28 | } |
---|
29 | else |
---|
30 | { |
---|
31 | int count = im->m_special->dirties.Count(); |
---|
32 | dirty_rect *dr = (dirty_rect *)(im->m_special->dirties.first()); |
---|
33 | while(count > 0) |
---|
34 | { |
---|
35 | put_part_image(im, xoff + dr->dx1, yoff + dr->dy1, |
---|
36 | dr->dx1, dr->dy1, dr->dx2 + 1, dr->dy2 + 1); |
---|
37 | dirty_rect *tmp = dr; |
---|
38 | dr = (dirty_rect *)(dr->Next()); |
---|
39 | im->m_special->dirties.unlink(tmp); |
---|
40 | delete tmp; |
---|
41 | count--; |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | update_window_done(); |
---|
46 | } |
---|
47 | |
---|
48 | void put_image(image * im, int x, int y) |
---|
49 | { |
---|
50 | put_part_image(im, x, y, 0, 0, im->Size().x - 1, im->Size().y - 1); |
---|
51 | } |
---|
52 | |
---|