Rev 1 | Rev 7 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1 | Rev 2 | ||
|---|---|---|---|
| Line 9... | Line 9... | ||
| 9 | * terms of this license. |
9 | * terms of this license. |
| 10 | * |
10 | * |
| 11 | * You must not remove this notice, or any other, from this software. |
11 | * You must not remove this notice, or any other, from this software. |
| 12 | */ |
12 | */ |
| 13 | 13 | ||
| 14 | #include < |
14 | #include <stdlib.h> // malloc |
| 15 | #include < |
15 | #include <string.h> // memset |
| 16 | 16 | ||
| 17 | #include <SDL.h> |
17 | #include <SDL.h> |
| 18 | 18 | ||
| 19 | #include "system.h" |
19 | #include "system.h" |
| 20 | #include "game.h" |
20 | #include "game.h" |
| 21 | #include "img.h" |
21 | #include "img.h" |
| 22 | 22 | ||
| 23 | #define SYSVID_WIDTH 640 |
23 | #define SYSVID_WIDTH 640 |
| 24 | #define SYSVID_HEIGHT 480 |
24 | #define SYSVID_HEIGHT 480 |
| 25 | #define SYSVID_BPP 32 |
25 | #define SYSVID_BPP 32 |
| - | 26 | ||
| - | 27 | #ifdef __APPLE__ |
|
| - | 28 | #define INDEX_A 0 |
|
| - | 29 | #define INDEX_R 1 |
|
| - | 30 | #define INDEX_G 2 |
|
| - | 31 | #define INDEX_B 3 |
|
| - | 32 | #else // !__APPLE__ |
|
| - | 33 | #define INDEX_B 0 |
|
| - | 34 | #define INDEX_G 1 |
|
| - | 35 | #define INDEX_R 2 |
|
| - | 36 | #define INDEX_A 3 |
|
| - | 37 | #endif // __APPLE__ |
|
| 26 | 38 | ||
| 27 | U8 *sysvid_fb; // frame buffer |
39 | U8 *sysvid_fb; // frame buffer |
| 28 | U8 want_fullscreen = TRUE |
40 | U8 want_fullscreen = FALSE;// TRUE; |
| 29 | U8 want_filter = TRUE; |
41 | U8 want_filter = TRUE; |
| 30 | U8 redraw_screen = FALSE; |
42 | U8 redraw_screen = FALSE; |
| 31 | 43 | ||
| 32 | static SDL_Surface *screen; |
44 | static SDL_Surface *screen; |
| 33 | 45 | ||
| Line 133... | Line 145... | ||
| 133 | { |
145 | { |
| 134 | for (xz = 0; xz < zoom; xz++) |
146 | for (xz = 0; xz < zoom; xz++) |
| 135 | { |
147 | { |
| 136 | if (want_filter && (y + yz < 220)) |
148 | if (want_filter && (y + yz < 220)) |
| 137 | { |
149 | { |
| 138 | *(q + |
150 | *(q + INDEX_B) = (U8) (( (U32) ((zoom - xz) * (U32) palette[*( p )][2] |
| 139 | + xz * (U32) palette[*( p + 1 )][2]) |
151 | + xz * (U32) palette[*( p + 1 )][2]) |
| 140 | + (U32) ((zoom - yz) * (U32) palette[*( p )][2] |
152 | + (U32) ((zoom - yz) * (U32) palette[*( p )][2] |
| 141 | + yz * (U32) palette[*(p + 320)][2])) |
153 | + yz * (U32) palette[*(p + 320)][2])) |
| 142 | / (zoom * zoom)); |
154 | / (zoom * zoom)); |
| 143 | 155 | ||
| 144 | *(q + |
156 | *(q + INDEX_G) = (U8) (( (U32) ((zoom - xz) * (U32) palette[*( p )][1] |
| 145 | + xz * (U32) palette[*( p + 1 )][1]) |
157 | + xz * (U32) palette[*( p + 1 )][1]) |
| 146 | + (U32) ((zoom - yz) * (U32) palette[*( p )][1] |
158 | + (U32) ((zoom - yz) * (U32) palette[*( p )][1] |
| 147 | + yz * (U32) palette[*(p + 320)][1])) |
159 | + yz * (U32) palette[*(p + 320)][1])) |
| 148 | / (zoom * zoom)); |
160 | / (zoom * zoom)); |
| 149 | 161 | ||
| 150 | *(q + |
162 | *(q + INDEX_R) = (U8) (( (U32) ((zoom - xz) * (U32) palette[*( p )][0] |
| 151 | + xz * (U32) palette[*( p + 1 )][0]) |
163 | + xz * (U32) palette[*( p + 1 )][0]) |
| 152 | + (U32) ((zoom - yz) * (U32) palette[*( p )][0] |
164 | + (U32) ((zoom - yz) * (U32) palette[*( p )][0] |
| 153 | + yz * (U32) palette[*(p + 320)][0])) |
165 | + yz * (U32) palette[*(p + 320)][0])) |
| 154 | / (zoom * zoom)); |
166 | / (zoom * zoom)); |
| 155 | *(q + |
167 | *(q + INDEX_A) = 0; |
| 156 | } |
168 | } |
| 157 | else |
169 | else |
| 158 | { |
170 | { |
| 159 | *(q + |
171 | *(q + INDEX_B) = palette[*p][2]; // pc: blue. mac: alpha |
| 160 | *(q + |
172 | *(q + INDEX_G) = palette[*p][1]; // pc: green. mac: red |
| 161 | *(q + |
173 | *(q + INDEX_R) = palette[*p][0]; // pc: red. mac: green |
| 162 | *(q + |
174 | *(q + INDEX_A) = 0; // pc: alpha. mac: blue |
| 163 | } |
175 | } |
| 164 | 176 | ||
| 165 | q += pixel_size; |
177 | q += pixel_size; |
| 166 | } |
178 | } |
| 167 | 179 | ||