dolphin.c.tmpl 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #include <assets_{{symbol_name}}.h>
  2. #include <desktop/animations/animation_storage_i.h>
  3. #include <desktop/animations/animation_manager.h>
  4. #include <gui/icon_i.h>
  5. {% for animation in animations: %}
  6. {% for frame_number, frame in enumerate(animation.frames): %}
  7. const uint8_t _A_{{ animation.name }}_{{ frame_number }}[] = {
  8. {{ "%s" % ",".join("0x%x" % i for i in frame)}}
  9. };
  10. {% :endfor %}
  11. const uint8_t *_A_{{animation.name}}[] = {
  12. {% for frame_number, frame in enumerate(animation.frames): %}
  13. _A_{{ animation.name }}_{{ frame_number }},
  14. {% :endfor %}
  15. };
  16. {% if animation.bubble_slots > 0: %}
  17. {% for bubble in animation.bubbles: %}
  18. const FrameBubble {{ animation.name }}_bubble_{{ bubble["Slot"] }}_{{ bubble["_BubbleIndex"] }};
  19. {% :endfor %}
  20. const FrameBubble* const {{animation.name}}_bubble_sequences[] = {
  21. {% for i in range(animation.bubble_slots): %}
  22. &{{animation.name}}_bubble_{{i}}_0,
  23. {% :endfor %}
  24. };
  25. {% for bubble in animation.bubbles: %}
  26. {%
  27. if "_NextBubbleIndex" in bubble:
  28. next_bubble = f'&{animation.name}_bubble_{bubble["Slot"]}_{bubble["_NextBubbleIndex"]}'
  29. else:
  30. next_bubble = "NULL"
  31. %}
  32. const FrameBubble {{animation.name}}_bubble_{{bubble["Slot"]}}_{{bubble["_BubbleIndex"]}} = {
  33. .bubble = {
  34. .x = {{bubble["X"]}},
  35. .y = {{bubble["Y"]}},
  36. .text = "{{bubble["Text"]}}",
  37. .align_h = Align{{bubble["AlignH"]}},
  38. .align_v = Align{{bubble["AlignV"]}},
  39. },
  40. .start_frame = {{bubble["StartFrame"]}},
  41. .end_frame = {{bubble["EndFrame"]}},
  42. .next_bubble = {{next_bubble}},
  43. };
  44. {% :endfor %}
  45. {% :endif %}
  46. const BubbleAnimation BA_{{animation.name}} = {
  47. .icon_animation = {
  48. .width = {{ animation.meta['Width'] }},
  49. .height = {{ animation.meta['Height'] }},
  50. .frame_count = {{ "%d" % len(animation.frames) }},
  51. .frame_rate = {{ animation.meta['Frame rate'] }},
  52. .frames = _A_{{ animation.name }}
  53. },
  54. .frame_order = { {{ "%s" % ", ".join(str(i) for i in animation.meta['Frames order']) }} },
  55. .passive_frames = {{ animation.meta['Passive frames'] }},
  56. .active_frames = {{ animation.meta['Active frames'] }},
  57. .active_cooldown = {{ animation.meta['Active cooldown'] }},
  58. .active_cycles = {{ animation.meta['Active cycles'] }},
  59. .duration = {{ animation.meta['Duration'] }},
  60. {% if animation.bubble_slots > 0: %}
  61. .frame_bubble_sequences = {{ animation.name }}_bubble_sequences,
  62. .frame_bubble_sequences_count = COUNT_OF({{ animation.name }}_bubble_sequences),
  63. {% :else: %}
  64. .frame_bubble_sequences = NULL,
  65. .frame_bubble_sequences_count = 0,
  66. {% :endif %}
  67. };
  68. {% :endfor %}
  69. const StorageAnimation {{symbol_name}}[] = {
  70. {% for animation in animations: %}
  71. {
  72. .animation = &BA_{{animation.name}},
  73. .manifest_info = {
  74. .name = "{{animation.name}}",
  75. .min_butthurt = {{animation.min_butthurt}},
  76. .max_butthurt = {{animation.max_butthurt}},
  77. .min_level = {{animation.min_level}},
  78. .max_level = {{animation.max_level}},
  79. .weight = {{animation.weight}},
  80. }
  81. },
  82. {% :endfor %}
  83. };
  84. const size_t {{symbol_name}}_size = COUNT_OF({{symbol_name}});