GameBoy (Color) port of the GTA San Andreas arcade game Duality
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sprite_data.h 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * sprite_data.h
  3. * Duality
  4. *
  5. * Copyright (C) 2025 Thomas Buck <thomas@xythobuz.de>
  6. *
  7. * Based on examples from gbdk-2020:
  8. * https://github.com/gbdk-2020/gbdk-2020/blob/develop/gbdk-lib/examples/cross-platform/metasprites/src/metasprites.c
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * See <http://www.gnu.org/licenses/>.
  21. */
  22. #ifndef __SPRITE__DATA_H
  23. #define __SPRITE__DATA_H
  24. #include <gbdk/platform.h>
  25. #include <gbdk/metasprites.h>
  26. #include <stdint.h>
  27. #include "sprites.h"
  28. // Metasprite tiles are loaded into VRAM starting at tile number 0
  29. #define TILE_NUM_START 0
  30. #define PALETTE_PRELOAD 0x00
  31. #define PALETTE_DYNAMIC_LOAD 0x10
  32. #define PALETTE_DYNAMIC_LOAD_IP 0x20
  33. #define PALETTE_NO_FLAGS 0x0F
  34. #define PALETTE_ALL_FLAGS 0xF0
  35. #define ARR_LEN(x) (sizeof(x) / sizeof(x[0]))
  36. struct sprites {
  37. const metasprite_t * const * ms;
  38. uint8_t ms_n;
  39. const uint8_t * ti;
  40. const palette_color_t * pa;
  41. uint8_t pa_n;
  42. uint8_t pa_i;
  43. uint8_t cnt;
  44. uint8_t off;
  45. uint8_t bank;
  46. };
  47. extern struct sprites metasprites[SPRITE_COUNT];
  48. BANKREF_EXTERN(power_palettes)
  49. extern const palette_color_t power_palettes[4];
  50. #endif // __SPRITE__DATA_H