| 1 | /* |
| 2 | * OpenTyrian: A modern cross-platform port of Tyrian |
| 3 | * Copyright (C) 2007-2009 The OpenTyrian Development Team |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | #include "sprite.h"cxx . . $ `<file>/src/sprite.h`/ |
| 20 | |
| 21 | #include "file.h"cxx . . $ `<file>/src/file.h`/ |
| 22 | #include "opentyr.h"cxx . . $ `<file>/src/opentyr.h`/ |
| 23 | #include "video.h"cxx . . $ `<file>/src/video.h`/ |
| 24 | |
| 25 | #include <assert.h> |
| 26 | #include <ctype.h> |
| 27 | #include <stdlib.h> |
| 28 | |
| 29 | Sprite_arraycxx . . $ Sprite_array# sprite_tablecxx . . $ sprite_table.[SPRITE_TABLES_MAXcxx . . $ `src/sprite.h:38:9`!]; |
| 30 | |
| 31 | Sprite2_arraycxx . . $ Sprite2_array# shopSpriteSheetcxx . . $ shopSpriteSheet.; |
| 32 | |
| 33 | Sprite2_arraycxx . . $ Sprite2_array# explosionSpriteSheetcxx . . $ explosionSpriteSheet.; |
| 34 | |
| 35 | Sprite2_arraycxx . . $ Sprite2_array# enemySpriteSheetscxx . . $ enemySpriteSheets.[4]; |
| 36 | Uint8cxx . . $ Uint8# enemySpriteSheetIdscxx . . $ enemySpriteSheetIds.[4]; |
| 37 | |
| 38 | Sprite2_arraycxx . . $ Sprite2_array# destructSpriteSheetcxx . . $ destructSpriteSheet.; |
| 39 | |
| 40 | Sprite2_arraycxx . . $ Sprite2_array# spriteSheet8cxx . . $ spriteSheet8.; |
| 41 | Sprite2_arraycxx . . $ Sprite2_array# spriteSheet9cxx . . $ spriteSheet9.; |
| 42 | Sprite2_arraycxx . . $ Sprite2_array# spriteSheet10cxx . . $ spriteSheet10.; |
| 43 | Sprite2_arraycxx . . $ Sprite2_array# spriteSheet11cxx . . $ spriteSheet11.; |
| 44 | Sprite2_arraycxx . . $ Sprite2_array# spriteSheet12cxx . . $ spriteSheet12.; |
| 45 | |
| 46 | void load_sprites_filecxx . . $ load_sprites_file(d7adf5cfafc0e15a).(unsigned int table, const char *filename) |
| 47 | { |
| 48 | free_spritescxx . . $ free_sprites(cb2f890c2fdad230).(table); |
| 49 | |
| 50 | FILEcxx . . $ FILE# *f = dir_fopen_diecxx . . $ dir_fopen_die(2493aa730c89ee72).(data_dircxx . . $ data_dir(33a1f659e94feb42).(), filename, "rb"); |
| 51 | |
| 52 | load_spritescxx . . $ load_sprites(60af6e60da050086).(table, f); |
| 53 | |
| 54 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(f); |
| 55 | } |
| 56 | |
| 57 | void load_spritescxx . . $ load_sprites(60af6e60da050086).(unsigned int table, FILEcxx . . $ FILE# *f) |
| 58 | { |
| 59 | free_spritescxx . . $ free_sprites(cb2f890c2fdad230).(table); |
| 60 | |
| 61 | Uint16cxx . . $ Uint16# temp; |
| 62 | fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&temp, 1, f); |
| 63 | |
| 64 | sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count. = temp; |
| 65 | |
| 66 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(sprite_table[table].count <= SPRITES_PER_TABLE_MAX); |
| 67 | |
| 68 | for (unsigned int i = 0; i < sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count.; ++i) |
| 69 | { |
| 70 | Spritecxx . . $ Sprite# * const cur_sprite = spritecxx . . $ sprite(d067a90ab23634af).(table, i); |
| 71 | |
| 72 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! populated; |
| 73 | fread_bool_diecxx . . $ fread_bool_die(907b9e3ee78d059).(&populated, f); |
| 74 | if (!populated) // sprite is empty |
| 75 | continue; |
| 76 | |
| 77 | fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&cur_sprite->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width., 1, f); |
| 78 | fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&cur_sprite->heightcxx . . $ $anonymous_type_297934740aeafb7d_0#height., 1, f); |
| 79 | fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size., 1, f); |
| 80 | |
| 81 | cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size.); |
| 82 | |
| 83 | fread_u8_diecxx . . $ fread_u8_die(77ebc59a7bf9f340).(cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data., cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size., f); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void free_spritescxx . . $ free_sprites(cb2f890c2fdad230).(unsigned int table) |
| 88 | { |
| 89 | for (unsigned int i = 0; i < sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count.; ++i) |
| 90 | { |
| 91 | Spritecxx . . $ Sprite# * const cur_sprite = spritecxx . . $ sprite(d067a90ab23634af).(table, i); |
| 92 | |
| 93 | cur_sprite->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width. = 0; |
| 94 | cur_sprite->heightcxx . . $ $anonymous_type_297934740aeafb7d_0#height. = 0; |
| 95 | cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size. = 0; |
| 96 | |
| 97 | freecxx . . $ free(5d22bdacc48458e8).(cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data.); |
| 98 | cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 99 | } |
| 100 | |
| 101 | sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count. = 0; |
| 102 | } |
| 103 | |
| 104 | // does not clip on left or right edges of surface |
| 105 | void blit_spritecxx . . $ blit_sprite(ee201c8e1efc2766).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, unsigned int table, unsigned int index) |
| 106 | { |
| 107 | if (index >= sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count. || !sprite_existscxx . . $ sprite_exists(8e1b545ea3aecce3).(table, index)) |
| 108 | { |
| 109 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(false); |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | const Spritecxx . . $ Sprite# * const cur_sprite = spritecxx . . $ sprite(d067a90ab23634af).(table, index); |
| 114 | |
| 115 | const Uint8cxx . . $ Uint8# *data = cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data.; |
| 116 | const Uint8cxx . . $ Uint8# * const data_ul = data + cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size.; |
| 117 | |
| 118 | const unsigned int width = cur_sprite->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width.; |
| 119 | unsigned int x_offset = 0; |
| 120 | |
| 121 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 122 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 123 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 124 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 125 | |
| 126 | for (; data < data_ul; ++data) |
| 127 | { |
| 128 | switch (*data) |
| 129 | { |
| 130 | case 255: // transparent pixels |
| 131 | data++; // next byte tells how many |
| 132 | pixels += *data; |
| 133 | x_offset += *data; |
| 134 | break; |
| 135 | |
| 136 | case 254: // next pixel row |
| 137 | pixels += width - x_offset; |
| 138 | x_offset = width; |
| 139 | break; |
| 140 | |
| 141 | case 253: // 1 transparent pixel |
| 142 | pixels++; |
| 143 | x_offset++; |
| 144 | break; |
| 145 | |
| 146 | default: // set a pixel |
| 147 | if (pixels >= pixels_ul) |
| 148 | return; |
| 149 | if (pixels >= pixels_ll) |
| 150 | *pixels = *data; |
| 151 | |
| 152 | pixels++; |
| 153 | x_offset++; |
| 154 | break; |
| 155 | } |
| 156 | if (x_offset >= width) |
| 157 | { |
| 158 | pixels += surface->pitchcxx . . $ SDL_Surface#pitch. - x_offset; |
| 159 | x_offset = 0; |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | // does not clip on left or right edges of surface |
| 165 | void blit_sprite_blendcxx . . $ blit_sprite_blend(ee201c8e1efc2766).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, unsigned int table, unsigned int index) |
| 166 | { |
| 167 | if (index >= sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count. || !sprite_existscxx . . $ sprite_exists(8e1b545ea3aecce3).(table, index)) |
| 168 | { |
| 169 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(false); |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | const Spritecxx . . $ Sprite# * const cur_sprite = spritecxx . . $ sprite(d067a90ab23634af).(table, index); |
| 174 | |
| 175 | const Uint8cxx . . $ Uint8# *data = cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data.; |
| 176 | const Uint8cxx . . $ Uint8# * const data_ul = data + cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size.; |
| 177 | |
| 178 | const unsigned int width = cur_sprite->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width.; |
| 179 | unsigned int x_offset = 0; |
| 180 | |
| 181 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 182 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 183 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 184 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 185 | |
| 186 | for (; data < data_ul; ++data) |
| 187 | { |
| 188 | switch (*data) |
| 189 | { |
| 190 | case 255: // transparent pixels |
| 191 | data++; // next byte tells how many |
| 192 | pixels += *data; |
| 193 | x_offset += *data; |
| 194 | break; |
| 195 | |
| 196 | case 254: // next pixel row |
| 197 | pixels += width - x_offset; |
| 198 | x_offset = width; |
| 199 | break; |
| 200 | |
| 201 | case 253: // 1 transparent pixel |
| 202 | pixels++; |
| 203 | x_offset++; |
| 204 | break; |
| 205 | |
| 206 | default: // set a pixel |
| 207 | if (pixels >= pixels_ul) |
| 208 | return; |
| 209 | if (pixels >= pixels_ll) |
| 210 | *pixels = (*data & 0xf0) | (((*pixels & 0x0f) + (*data & 0x0f)) / 2); |
| 211 | |
| 212 | pixels++; |
| 213 | x_offset++; |
| 214 | break; |
| 215 | } |
| 216 | if (x_offset >= width) |
| 217 | { |
| 218 | pixels += surface->pitchcxx . . $ SDL_Surface#pitch. - x_offset; |
| 219 | x_offset = 0; |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | // does not clip on left or right edges of surface |
| 225 | // unsafe because it doesn't check that value won't overflow into hue |
| 226 | // we can replace it when we know that we don't rely on that 'feature' |
| 227 | void blit_sprite_hv_unsafecxx . . $ blit_sprite_hv_unsafe(62f96868ab2f1929).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, unsigned int table, unsigned int index, Uint8cxx . . $ Uint8# hue, Sint8cxx . . $ Sint8# value) |
| 228 | { |
| 229 | if (index >= sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count. || !sprite_existscxx . . $ sprite_exists(8e1b545ea3aecce3).(table, index)) |
| 230 | { |
| 231 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(false); |
| 232 | return; |
| 233 | } |
| 234 | |
| 235 | hue <<= 4; |
| 236 | |
| 237 | const Spritecxx . . $ Sprite# * const cur_sprite = spritecxx . . $ sprite(d067a90ab23634af).(table, index); |
| 238 | |
| 239 | const Uint8cxx . . $ Uint8# *data = cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data.; |
| 240 | const Uint8cxx . . $ Uint8# * const data_ul = data + cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size.; |
| 241 | |
| 242 | const unsigned int width = cur_sprite->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width.; |
| 243 | unsigned int x_offset = 0; |
| 244 | |
| 245 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 246 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 247 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 248 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 249 | |
| 250 | for (; data < data_ul; ++data) |
| 251 | { |
| 252 | switch (*data) |
| 253 | { |
| 254 | case 255: // transparent pixels |
| 255 | data++; // next byte tells how many |
| 256 | pixels += *data; |
| 257 | x_offset += *data; |
| 258 | break; |
| 259 | |
| 260 | case 254: // next pixel row |
| 261 | pixels += width - x_offset; |
| 262 | x_offset = width; |
| 263 | break; |
| 264 | |
| 265 | case 253: // 1 transparent pixel |
| 266 | pixels++; |
| 267 | x_offset++; |
| 268 | break; |
| 269 | |
| 270 | default: // set a pixel |
| 271 | if (pixels >= pixels_ul) |
| 272 | return; |
| 273 | if (pixels >= pixels_ll) |
| 274 | *pixels = hue | ((*data & 0x0f) + value); |
| 275 | |
| 276 | pixels++; |
| 277 | x_offset++; |
| 278 | break; |
| 279 | } |
| 280 | if (x_offset >= width) |
| 281 | { |
| 282 | pixels += surface->pitchcxx . . $ SDL_Surface#pitch. - x_offset; |
| 283 | x_offset = 0; |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | // does not clip on left or right edges of surface |
| 289 | void blit_sprite_hvcxx . . $ blit_sprite_hv(62f96868ab2f1929).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, unsigned int table, unsigned int index, Uint8cxx . . $ Uint8# hue, Sint8cxx . . $ Sint8# value) |
| 290 | { |
| 291 | if (index >= sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count. || !sprite_existscxx . . $ sprite_exists(8e1b545ea3aecce3).(table, index)) |
| 292 | { |
| 293 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(false); |
| 294 | return; |
| 295 | } |
| 296 | |
| 297 | hue <<= 4; |
| 298 | |
| 299 | const Spritecxx . . $ Sprite# * const cur_sprite = spritecxx . . $ sprite(d067a90ab23634af).(table, index); |
| 300 | |
| 301 | const Uint8cxx . . $ Uint8# *data = cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data.; |
| 302 | const Uint8cxx . . $ Uint8# * const data_ul = data + cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size.; |
| 303 | |
| 304 | const unsigned int width = cur_sprite->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width.; |
| 305 | unsigned int x_offset = 0; |
| 306 | |
| 307 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 308 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 309 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 310 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 311 | |
| 312 | for (; data < data_ul; ++data) |
| 313 | { |
| 314 | switch (*data) |
| 315 | { |
| 316 | case 255: // transparent pixels |
| 317 | data++; // next byte tells how many |
| 318 | pixels += *data; |
| 319 | x_offset += *data; |
| 320 | break; |
| 321 | |
| 322 | case 254: // next pixel row |
| 323 | pixels += width - x_offset; |
| 324 | x_offset = width; |
| 325 | break; |
| 326 | |
| 327 | case 253: // 1 transparent pixel |
| 328 | pixels++; |
| 329 | x_offset++; |
| 330 | break; |
| 331 | |
| 332 | default: // set a pixel |
| 333 | if (pixels >= pixels_ul) |
| 334 | return; |
| 335 | if (pixels >= pixels_ll) |
| 336 | { |
| 337 | Uint8cxx . . $ Uint8# temp_value = (*data & 0x0f) + value; |
| 338 | if (temp_value > 0xf) |
| 339 | temp_value = (temp_value >= 0x1f) ? 0x0 : 0xf; |
| 340 | |
| 341 | *pixels = hue | temp_value; |
| 342 | } |
| 343 | |
| 344 | pixels++; |
| 345 | x_offset++; |
| 346 | break; |
| 347 | } |
| 348 | if (x_offset >= width) |
| 349 | { |
| 350 | pixels += surface->pitchcxx . . $ SDL_Surface#pitch. - x_offset; |
| 351 | x_offset = 0; |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | // does not clip on left or right edges of surface |
| 357 | void blit_sprite_hv_blendcxx . . $ blit_sprite_hv_blend(62f96868ab2f1929).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, unsigned int table, unsigned int index, Uint8cxx . . $ Uint8# hue, Sint8cxx . . $ Sint8# value) |
| 358 | { |
| 359 | if (index >= sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count. || !sprite_existscxx . . $ sprite_exists(8e1b545ea3aecce3).(table, index)) |
| 360 | { |
| 361 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(false); |
| 362 | return; |
| 363 | } |
| 364 | |
| 365 | hue <<= 4; |
| 366 | |
| 367 | const Spritecxx . . $ Sprite# * const cur_sprite = spritecxx . . $ sprite(d067a90ab23634af).(table, index); |
| 368 | |
| 369 | const Uint8cxx . . $ Uint8# *data = cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data.; |
| 370 | const Uint8cxx . . $ Uint8# * const data_ul = data + cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size.; |
| 371 | |
| 372 | const unsigned int width = cur_sprite->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width.; |
| 373 | unsigned int x_offset = 0; |
| 374 | |
| 375 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 376 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 377 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 378 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 379 | |
| 380 | for (; data < data_ul; ++data) |
| 381 | { |
| 382 | switch (*data) |
| 383 | { |
| 384 | case 255: // transparent pixels |
| 385 | data++; // next byte tells how many |
| 386 | pixels += *data; |
| 387 | x_offset += *data; |
| 388 | break; |
| 389 | |
| 390 | case 254: // next pixel row |
| 391 | pixels += width - x_offset; |
| 392 | x_offset = width; |
| 393 | break; |
| 394 | |
| 395 | case 253: // 1 transparent pixel |
| 396 | pixels++; |
| 397 | x_offset++; |
| 398 | break; |
| 399 | |
| 400 | default: // set a pixel |
| 401 | if (pixels >= pixels_ul) |
| 402 | return; |
| 403 | if (pixels >= pixels_ll) |
| 404 | { |
| 405 | Uint8cxx . . $ Uint8# temp_value = (*data & 0x0f) + value; |
| 406 | if (temp_value > 0xf) |
| 407 | temp_value = (temp_value >= 0x1f) ? 0x0 : 0xf; |
| 408 | |
| 409 | *pixels = hue | (((*pixels & 0x0f) + temp_value) / 2); |
| 410 | } |
| 411 | |
| 412 | pixels++; |
| 413 | x_offset++; |
| 414 | break; |
| 415 | } |
| 416 | if (x_offset >= width) |
| 417 | { |
| 418 | pixels += surface->pitchcxx . . $ SDL_Surface#pitch. - x_offset; |
| 419 | x_offset = 0; |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | // does not clip on left or right edges of surface |
| 425 | void blit_sprite_darkcxx . . $ blit_sprite_dark(34bc9a7b28a4eeec).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, unsigned int table, unsigned int index, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! black) |
| 426 | { |
| 427 | if (index >= sprite_tablecxx . . $ sprite_table.[table].countcxx . . $ $anonymous_type_297934740aeafb7d_1#count. || !sprite_existscxx . . $ sprite_exists(8e1b545ea3aecce3).(table, index)) |
| 428 | { |
| 429 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(false); |
| 430 | return; |
| 431 | } |
| 432 | |
| 433 | const Spritecxx . . $ Sprite# * const cur_sprite = spritecxx . . $ sprite(d067a90ab23634af).(table, index); |
| 434 | |
| 435 | const Uint8cxx . . $ Uint8# *data = cur_sprite->datacxx . . $ $anonymous_type_297934740aeafb7d_0#data.; |
| 436 | const Uint8cxx . . $ Uint8# * const data_ul = data + cur_sprite->sizecxx . . $ $anonymous_type_297934740aeafb7d_0#size.; |
| 437 | |
| 438 | const unsigned int width = cur_sprite->widthcxx . . $ $anonymous_type_297934740aeafb7d_0#width.; |
| 439 | unsigned int x_offset = 0; |
| 440 | |
| 441 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 442 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 443 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 444 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 445 | |
| 446 | for (; data < data_ul; ++data) |
| 447 | { |
| 448 | switch (*data) |
| 449 | { |
| 450 | case 255: // transparent pixels |
| 451 | data++; // next byte tells how many |
| 452 | pixels += *data; |
| 453 | x_offset += *data; |
| 454 | break; |
| 455 | |
| 456 | case 254: // next pixel row |
| 457 | pixels += width - x_offset; |
| 458 | x_offset = width; |
| 459 | break; |
| 460 | |
| 461 | case 253: // 1 transparent pixel |
| 462 | pixels++; |
| 463 | x_offset++; |
| 464 | break; |
| 465 | |
| 466 | default: // set a pixel |
| 467 | if (pixels >= pixels_ul) |
| 468 | return; |
| 469 | if (pixels >= pixels_ll) |
| 470 | *pixels = black ? 0x00 : ((*pixels & 0xf0) | ((*pixels & 0x0f) / 2)); |
| 471 | |
| 472 | pixels++; |
| 473 | x_offset++; |
| 474 | break; |
| 475 | } |
| 476 | if (x_offset >= width) |
| 477 | { |
| 478 | pixels += surface->pitchcxx . . $ SDL_Surface#pitch. - x_offset; |
| 479 | x_offset = 0; |
| 480 | } |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | void JE_loadCompShapescxx . . $ JE_loadCompShapes(676db0deaa5c5c40).(Sprite2_arraycxx . . $ Sprite2_array# *sprite2s, char s) |
| 485 | { |
| 486 | free_sprite2scxx . . $ free_sprite2s(da72ff5ad2e190db).(sprite2s); |
| 487 | |
| 488 | char buffer[20]; |
| 489 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(buffer, sizeof(buffer), "newsh%c.shp", tolowercxx . . $ `<external>/17904084882347303253/ctype.h:220:11`!((unsigned char)s)); |
| 490 | |
| 491 | FILEcxx . . $ FILE# *f = dir_fopen_diecxx . . $ dir_fopen_die(2493aa730c89ee72).(data_dircxx . . $ data_dir(33a1f659e94feb42).(), buffer, "rb"); |
| 492 | |
| 493 | sprite2s->sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size. = ftell_eofcxx . . $ ftell_eof(1dcafcd8ef4c6e6c).(f); |
| 494 | |
| 495 | JE_loadCompShapesBcxx . . $ JE_loadCompShapesB(95a3c161ef275fb3).(sprite2s, f); |
| 496 | |
| 497 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(f); |
| 498 | } |
| 499 | |
| 500 | void JE_loadCompShapesBcxx . . $ JE_loadCompShapesB(95a3c161ef275fb3).(Sprite2_arraycxx . . $ Sprite2_array# *sprite2s, FILEcxx . . $ FILE# *f) |
| 501 | { |
| 502 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(sprite2s->data == NULL); |
| 503 | |
| 504 | sprite2s->datacxx . . $ $anonymous_type_297934740aeafb7d_2#data. = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sprite2s->sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size.); |
| 505 | fread_u8_diecxx . . $ fread_u8_die(77ebc59a7bf9f340).(sprite2s->datacxx . . $ $anonymous_type_297934740aeafb7d_2#data., sprite2s->sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size., f); |
| 506 | } |
| 507 | |
| 508 | void free_sprite2scxx . . $ free_sprite2s(da72ff5ad2e190db).(Sprite2_arraycxx . . $ Sprite2_array# *sprite2s) |
| 509 | { |
| 510 | freecxx . . $ free(5d22bdacc48458e8).(sprite2s->datacxx . . $ $anonymous_type_297934740aeafb7d_2#data.); |
| 511 | sprite2s->datacxx . . $ $anonymous_type_297934740aeafb7d_2#data. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!; |
| 512 | |
| 513 | sprite2s->sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size. = 0; |
| 514 | } |
| 515 | |
| 516 | // does not clip on left or right edges of surface |
| 517 | void blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index) |
| 518 | { |
| 519 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 520 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 521 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 522 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 523 | |
| 524 | const Uint8cxx . . $ Uint8# *data = sprite2s.datacxx . . $ $anonymous_type_297934740aeafb7d_2#data. + SDL_SwapLE16cxx . . $ `<external>/7875807700584907893/SDL_endian.h:368:9`!(((Uint16 *)sprite2s.data)[index - 1]); |
| 525 | |
| 526 | for (; *data != 0x0f; ++data) |
| 527 | { |
| 528 | pixels += *data & 0x0f; // second nibble: transparent pixel count |
| 529 | unsigned int count = (*data & 0xf0) >> 4; // first nibble: opaque pixel count |
| 530 | |
| 531 | if (count == 0) // move to next pixel row |
| 532 | { |
| 533 | pixels += VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch. - 12; |
| 534 | } |
| 535 | else |
| 536 | { |
| 537 | while (count--) |
| 538 | { |
| 539 | ++data; |
| 540 | |
| 541 | if (pixels >= pixels_ul) |
| 542 | return; |
| 543 | if (pixels >= pixels_ll) |
| 544 | *pixels = *data; |
| 545 | |
| 546 | ++pixels; |
| 547 | } |
| 548 | } |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | void blit_sprite2_clipcxx . . $ blit_sprite2_clip(b5d0f2be3b000a5b).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index) |
| 553 | { |
| 554 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 555 | |
| 556 | const Uint8cxx . . $ Uint8# *data = sprite2s.datacxx . . $ $anonymous_type_297934740aeafb7d_2#data. + SDL_SwapLE16cxx . . $ `<external>/7875807700584907893/SDL_endian.h:368:9`!(((Uint16 *)sprite2s.data)[index - 1]); |
| 557 | |
| 558 | for (; *data != 0x0f; ++data) |
| 559 | { |
| 560 | if (y >= surface->hcxx . . $ SDL_Surface#h.) |
| 561 | return; |
| 562 | |
| 563 | Uint8cxx . . $ Uint8# skip_count = *data & 0x0f; |
| 564 | Uint8cxx . . $ Uint8# fill_count = (*data >> 4) & 0x0f; |
| 565 | |
| 566 | x += skip_count; |
| 567 | |
| 568 | if (fill_count == 0) // move to next pixel row |
| 569 | { |
| 570 | y += 1; |
| 571 | x -= 12; |
| 572 | } |
| 573 | else if (y >= 0) |
| 574 | { |
| 575 | Uint8cxx . . $ Uint8# *const pixel_row = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.); |
| 576 | do |
| 577 | { |
| 578 | ++data; |
| 579 | |
| 580 | if (x >= 0 && x < surface->pitchcxx . . $ SDL_Surface#pitch.) |
| 581 | pixel_row[x] = *data; |
| 582 | x += 1; |
| 583 | } while (--fill_count); |
| 584 | } |
| 585 | else |
| 586 | { |
| 587 | data += fill_count; |
| 588 | x += fill_count; |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | // does not clip on left or right edges of surface |
| 594 | void blit_sprite2_blendcxx . . $ blit_sprite2_blend(b5d0f2be3b000a5b).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index) |
| 595 | { |
| 596 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 597 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 598 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 599 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 600 | |
| 601 | const Uint8cxx . . $ Uint8# *data = sprite2s.datacxx . . $ $anonymous_type_297934740aeafb7d_2#data. + SDL_SwapLE16cxx . . $ `<external>/7875807700584907893/SDL_endian.h:368:9`!(((Uint16 *)sprite2s.data)[index - 1]); |
| 602 | |
| 603 | for (; *data != 0x0f; ++data) |
| 604 | { |
| 605 | pixels += *data & 0x0f; // second nibble: transparent pixel count |
| 606 | unsigned int count = (*data & 0xf0) >> 4; // first nibble: opaque pixel count |
| 607 | |
| 608 | if (count == 0) // move to next pixel row |
| 609 | { |
| 610 | pixels += VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch. - 12; |
| 611 | } |
| 612 | else |
| 613 | { |
| 614 | while (count--) |
| 615 | { |
| 616 | ++data; |
| 617 | |
| 618 | if (pixels >= pixels_ul) |
| 619 | return; |
| 620 | if (pixels >= pixels_ll) |
| 621 | *pixels = (((*data & 0x0f) + (*pixels & 0x0f)) / 2) | (*data & 0xf0); |
| 622 | |
| 623 | ++pixels; |
| 624 | } |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | // does not clip on left or right edges of surface |
| 630 | void blit_sprite2_darkencxx . . $ blit_sprite2_darken(b5d0f2be3b000a5b).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index) |
| 631 | { |
| 632 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 633 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 634 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 635 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 636 | |
| 637 | const Uint8cxx . . $ Uint8# *data = sprite2s.datacxx . . $ $anonymous_type_297934740aeafb7d_2#data. + SDL_SwapLE16cxx . . $ `<external>/7875807700584907893/SDL_endian.h:368:9`!(((Uint16 *)sprite2s.data)[index - 1]); |
| 638 | |
| 639 | for (; *data != 0x0f; ++data) |
| 640 | { |
| 641 | pixels += *data & 0x0f; // second nibble: transparent pixel count |
| 642 | unsigned int count = (*data & 0xf0) >> 4; // first nibble: opaque pixel count |
| 643 | |
| 644 | if (count == 0) // move to next pixel row |
| 645 | { |
| 646 | pixels += VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch. - 12; |
| 647 | } |
| 648 | else |
| 649 | { |
| 650 | while (count--) |
| 651 | { |
| 652 | ++data; |
| 653 | |
| 654 | if (pixels >= pixels_ul) |
| 655 | return; |
| 656 | if (pixels >= pixels_ll) |
| 657 | *pixels = ((*pixels & 0x0f) / 2) + (*pixels & 0xf0); |
| 658 | |
| 659 | ++pixels; |
| 660 | } |
| 661 | } |
| 662 | } |
| 663 | } |
| 664 | |
| 665 | // does not clip on left or right edges of surface |
| 666 | void blit_sprite2_filtercxx . . $ blit_sprite2_filter(2b2597c85c53621a).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index, Uint8cxx . . $ Uint8# filter) |
| 667 | { |
| 668 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 669 | Uint8cxx . . $ Uint8# * pixels = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.) + x; |
| 670 | const Uint8cxx . . $ Uint8# * const pixels_ll = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels., // lower limit |
| 671 | * const pixels_ul = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (surface->hcxx . . $ SDL_Surface#h. * surface->pitchcxx . . $ SDL_Surface#pitch.); // upper limit |
| 672 | |
| 673 | const Uint8cxx . . $ Uint8# *data = sprite2s.datacxx . . $ $anonymous_type_297934740aeafb7d_2#data. + SDL_SwapLE16cxx . . $ `<external>/7875807700584907893/SDL_endian.h:368:9`!(((Uint16 *)sprite2s.data)[index - 1]); |
| 674 | |
| 675 | for (; *data != 0x0f; ++data) |
| 676 | { |
| 677 | pixels += *data & 0x0f; // second nibble: transparent pixel count |
| 678 | unsigned int count = (*data & 0xf0) >> 4; // first nibble: opaque pixel count |
| 679 | |
| 680 | if (count == 0) // move to next pixel row |
| 681 | { |
| 682 | pixels += VGAScreencxx . . $ VGAScreen.->pitchcxx . . $ SDL_Surface#pitch. - 12; |
| 683 | } |
| 684 | else |
| 685 | { |
| 686 | while (count--) |
| 687 | { |
| 688 | ++data; |
| 689 | |
| 690 | if (pixels >= pixels_ul) |
| 691 | return; |
| 692 | if (pixels >= pixels_ll) |
| 693 | *pixels = filter | (*data & 0x0f); |
| 694 | |
| 695 | ++pixels; |
| 696 | } |
| 697 | } |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | void blit_sprite2_filter_clipcxx . . $ blit_sprite2_filter_clip(2b2597c85c53621a).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index, Uint8cxx . . $ Uint8# filter) |
| 702 | { |
| 703 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(surface->format->BitsPerPixel == 8); |
| 704 | |
| 705 | const Uint8cxx . . $ Uint8# *data = sprite2s.datacxx . . $ $anonymous_type_297934740aeafb7d_2#data. + SDL_SwapLE16cxx . . $ `<external>/7875807700584907893/SDL_endian.h:368:9`!(((Uint16 *)sprite2s.data)[index - 1]); |
| 706 | |
| 707 | for (; *data != 0x0f; ++data) |
| 708 | { |
| 709 | if (y >= surface->hcxx . . $ SDL_Surface#h.) |
| 710 | return; |
| 711 | |
| 712 | Uint8cxx . . $ Uint8# skip_count = *data & 0x0f; |
| 713 | Uint8cxx . . $ Uint8# fill_count = (*data >> 4) & 0x0f; |
| 714 | |
| 715 | x += skip_count; |
| 716 | |
| 717 | if (fill_count == 0) // move to next pixel row |
| 718 | { |
| 719 | y += 1; |
| 720 | x -= 12; |
| 721 | } |
| 722 | else if (y >= 0) |
| 723 | { |
| 724 | Uint8cxx . . $ Uint8# *const pixel_row = (Uint8cxx . . $ Uint8# *)surface->pixelscxx . . $ SDL_Surface#pixels. + (y * surface->pitchcxx . . $ SDL_Surface#pitch.); |
| 725 | do |
| 726 | { |
| 727 | ++data; |
| 728 | |
| 729 | if (x >= 0 && x < surface->pitchcxx . . $ SDL_Surface#pitch.) |
| 730 | pixel_row[x] = filter | (*data & 0x0f);; |
| 731 | x += 1; |
| 732 | } while (--fill_count); |
| 733 | } |
| 734 | else |
| 735 | { |
| 736 | data += fill_count; |
| 737 | x += fill_count; |
| 738 | } |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | // does not clip on left or right edges of surface |
| 743 | void blit_sprite2x2cxx . . $ blit_sprite2x2(b5d0f2be3b000a5b).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index) |
| 744 | { |
| 745 | blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(surface, x, y, sprite2s, index); |
| 746 | blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(surface, x + 12, y, sprite2s, index + 1); |
| 747 | blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(surface, x, y + 14, sprite2s, index + 19); |
| 748 | blit_sprite2cxx . . $ blit_sprite2(b5d0f2be3b000a5b).(surface, x + 12, y + 14, sprite2s, index + 20); |
| 749 | } |
| 750 | |
| 751 | void blit_sprite2x2_clipcxx . . $ blit_sprite2x2_clip(b5d0f2be3b000a5b).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index) |
| 752 | { |
| 753 | blit_sprite2_clipcxx . . $ blit_sprite2_clip(b5d0f2be3b000a5b).(surface, x, y, sprite2s, index); |
| 754 | blit_sprite2_clipcxx . . $ blit_sprite2_clip(b5d0f2be3b000a5b).(surface, x + 12, y, sprite2s, index + 1); |
| 755 | blit_sprite2_clipcxx . . $ blit_sprite2_clip(b5d0f2be3b000a5b).(surface, x, y + 14, sprite2s, index + 19); |
| 756 | blit_sprite2_clipcxx . . $ blit_sprite2_clip(b5d0f2be3b000a5b).(surface, x + 12, y + 14, sprite2s, index + 20); |
| 757 | } |
| 758 | |
| 759 | // does not clip on left or right edges of surface |
| 760 | void blit_sprite2x2_blendcxx . . $ blit_sprite2x2_blend(b5d0f2be3b000a5b).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index) |
| 761 | { |
| 762 | blit_sprite2_blendcxx . . $ blit_sprite2_blend(b5d0f2be3b000a5b).(surface, x, y, sprite2s, index); |
| 763 | blit_sprite2_blendcxx . . $ blit_sprite2_blend(b5d0f2be3b000a5b).(surface, x + 12, y, sprite2s, index + 1); |
| 764 | blit_sprite2_blendcxx . . $ blit_sprite2_blend(b5d0f2be3b000a5b).(surface, x, y + 14, sprite2s, index + 19); |
| 765 | blit_sprite2_blendcxx . . $ blit_sprite2_blend(b5d0f2be3b000a5b).(surface, x + 12, y + 14, sprite2s, index + 20); |
| 766 | } |
| 767 | |
| 768 | // does not clip on left or right edges of surface |
| 769 | void blit_sprite2x2_darkencxx . . $ blit_sprite2x2_darken(b5d0f2be3b000a5b).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index) |
| 770 | { |
| 771 | blit_sprite2_darkencxx . . $ blit_sprite2_darken(b5d0f2be3b000a5b).(surface, x, y, sprite2s, index); |
| 772 | blit_sprite2_darkencxx . . $ blit_sprite2_darken(b5d0f2be3b000a5b).(surface, x + 12, y, sprite2s, index + 1); |
| 773 | blit_sprite2_darkencxx . . $ blit_sprite2_darken(b5d0f2be3b000a5b).(surface, x, y + 14, sprite2s, index + 19); |
| 774 | blit_sprite2_darkencxx . . $ blit_sprite2_darken(b5d0f2be3b000a5b).(surface, x + 12, y + 14, sprite2s, index + 20); |
| 775 | } |
| 776 | |
| 777 | // does not clip on left or right edges of surface |
| 778 | void blit_sprite2x2_filtercxx . . $ blit_sprite2x2_filter(2b2597c85c53621a).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index, Uint8cxx . . $ Uint8# filter) |
| 779 | { |
| 780 | blit_sprite2_filtercxx . . $ blit_sprite2_filter(2b2597c85c53621a).(surface, x, y, sprite2s, index, filter); |
| 781 | blit_sprite2_filtercxx . . $ blit_sprite2_filter(2b2597c85c53621a).(surface, x + 12, y, sprite2s, index + 1, filter); |
| 782 | blit_sprite2_filtercxx . . $ blit_sprite2_filter(2b2597c85c53621a).(surface, x, y + 14, sprite2s, index + 19, filter); |
| 783 | blit_sprite2_filtercxx . . $ blit_sprite2_filter(2b2597c85c53621a).(surface, x + 12, y + 14, sprite2s, index + 20, filter); |
| 784 | } |
| 785 | |
| 786 | void blit_sprite2x2_filter_clipcxx . . $ blit_sprite2x2_filter_clip(2b2597c85c53621a).(SDL_Surfacecxx . . $ SDL_Surface# *surface, int x, int y, Sprite2_arraycxx . . $ Sprite2_array# sprite2s, unsigned int index, Uint8cxx . . $ Uint8# filter) |
| 787 | { |
| 788 | blit_sprite2_filter_clipcxx . . $ blit_sprite2_filter_clip(2b2597c85c53621a).(surface, x, y, sprite2s, index, filter); |
| 789 | blit_sprite2_filter_clipcxx . . $ blit_sprite2_filter_clip(2b2597c85c53621a).(surface, x + 12, y, sprite2s, index + 1, filter); |
| 790 | blit_sprite2_filter_clipcxx . . $ blit_sprite2_filter_clip(2b2597c85c53621a).(surface, x, y + 14, sprite2s, index + 19, filter); |
| 791 | blit_sprite2_filter_clipcxx . . $ blit_sprite2_filter_clip(2b2597c85c53621a).(surface, x + 12, y + 14, sprite2s, index + 20, filter); |
| 792 | } |
| 793 | |
| 794 | void JE_loadMainShapeTablescxx . . $ JE_loadMainShapeTables(85c52e162fed56f9).(const char *shpfile) |
| 795 | { |
| 796 | enumcxx . . $ JE_loadMainShapeTables(85c52e162fed56f9).$anonymous_type_0# { SHP_NUMcxx . . $ JE_loadMainShapeTables(85c52e162fed56f9).SHP_NUM. = 12 }; |
| 797 | |
| 798 | FILEcxx . . $ FILE# *f = dir_fopen_diecxx . . $ dir_fopen_die(2493aa730c89ee72).(data_dircxx . . $ data_dir(33a1f659e94feb42).(), shpfile, "rb"); |
| 799 | |
| 800 | JE_wordcxx . . $ JE_word# shpNumb; |
| 801 | JE_longintcxx . . $ JE_longint# shpPos[SHP_NUMcxx . . $ JE_loadMainShapeTables(85c52e162fed56f9).SHP_NUM. + 1]; // +1 for storing file length |
| 802 | |
| 803 | fread_u16_diecxx . . $ fread_u16_die(c6228d4965a46ad0).(&shpNumb, 1, f); |
| 804 | assertcxx . . $ `<external>/4398592474888995393/assert.h:50:10`!(shpNumb + 1u == COUNTOF(shpPos)); |
| 805 | |
| 806 | fread_s32_diecxx . . $ fread_s32_die(4b35c8e6f923dc9d).(shpPos, shpNumb, f); |
| 807 | |
| 808 | fseekcxx . . $ fseek(543fae30d249f6b1).(f, 0, SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!); |
| 809 | for (unsigned int i = shpNumb; i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(shpPos); ++i) |
| 810 | shpPos[i] = ftellcxx . . $ ftell(1dcafcd8ef4c6e6c).(f); |
| 811 | |
| 812 | int i; |
| 813 | // fonts, interface, option sprites |
| 814 | for (i = 0; i < 7; i++) |
| 815 | { |
| 816 | fseekcxx . . $ fseek(543fae30d249f6b1).(f, shpPos[i], SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!); |
| 817 | load_spritescxx . . $ load_sprites(60af6e60da050086).(i, f); |
| 818 | } |
| 819 | |
| 820 | // player shot sprites |
| 821 | spriteSheet8cxx . . $ spriteSheet8..sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size. = shpPos[i + 1] - shpPos[i]; |
| 822 | JE_loadCompShapesBcxx . . $ JE_loadCompShapesB(95a3c161ef275fb3).(&spriteSheet8cxx . . $ spriteSheet8., f); |
| 823 | i++; |
| 824 | |
| 825 | // player ship sprites |
| 826 | spriteSheet9cxx . . $ spriteSheet9..sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size. = shpPos[i + 1] - shpPos[i]; |
| 827 | JE_loadCompShapesBcxx . . $ JE_loadCompShapesB(95a3c161ef275fb3).(&spriteSheet9cxx . . $ spriteSheet9. , f); |
| 828 | i++; |
| 829 | |
| 830 | // power-up sprites |
| 831 | spriteSheet10cxx . . $ spriteSheet10..sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size. = shpPos[i + 1] - shpPos[i]; |
| 832 | JE_loadCompShapesBcxx . . $ JE_loadCompShapesB(95a3c161ef275fb3).(&spriteSheet10cxx . . $ spriteSheet10., f); |
| 833 | i++; |
| 834 | |
| 835 | // coins, datacubes, etc sprites |
| 836 | spriteSheet11cxx . . $ spriteSheet11..sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size. = shpPos[i + 1] - shpPos[i]; |
| 837 | JE_loadCompShapesBcxx . . $ JE_loadCompShapesB(95a3c161ef275fb3).(&spriteSheet11cxx . . $ spriteSheet11., f); |
| 838 | i++; |
| 839 | |
| 840 | // more player shot sprites |
| 841 | spriteSheet12cxx . . $ spriteSheet12..sizecxx . . $ $anonymous_type_297934740aeafb7d_2#size. = shpPos[i + 1] - shpPos[i]; |
| 842 | JE_loadCompShapesBcxx . . $ JE_loadCompShapesB(95a3c161ef275fb3).(&spriteSheet12cxx . . $ spriteSheet12., f); |
| 843 | |
| 844 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(f); |
| 845 | } |
| 846 | |
| 847 | void free_main_shape_tablescxx . . $ free_main_shape_tables(49f6e7a06ebc5aa8).(void) |
| 848 | { |
| 849 | for (uintcxx . . $ uint# i = 0; i < COUNTOFcxx . . $ `src/opentyr.h:27:9`!(sprite_table); ++i) |
| 850 | free_spritescxx . . $ free_sprites(cb2f890c2fdad230).(i); |
| 851 | |
| 852 | free_sprite2scxx . . $ free_sprite2s(da72ff5ad2e190db).(&spriteSheet8cxx . . $ spriteSheet8.); |
| 853 | free_sprite2scxx . . $ free_sprite2s(da72ff5ad2e190db).(&spriteSheet9cxx . . $ spriteSheet9.); |
| 854 | free_sprite2scxx . . $ free_sprite2s(da72ff5ad2e190db).(&spriteSheet10cxx . . $ spriteSheet10.); |
| 855 | free_sprite2scxx . . $ free_sprite2s(da72ff5ad2e190db).(&spriteSheet11cxx . . $ spriteSheet11.); |
| 856 | free_sprite2scxx . . $ free_sprite2s(da72ff5ad2e190db).(&spriteSheet12cxx . . $ spriteSheet12.); |
| 857 | } |