dolphin.c.tmpl 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 * const _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 uint8_t {{animation.name}}_frame_order[] = { {{ "%s" % ", ".join(str(i) for i in animation.meta['Frames order']) }} };
  47. const BubbleAnimation BA_{{animation.name}} = {
  48. .icon_animation = {
  49. .width = {{ animation.meta['Width'] }},
  50. .height = {{ animation.meta['Height'] }},
  51. .frame_count = {{ "%d" % len(animation.frames) }},
  52. .frame_rate = {{ animation.meta['Frame rate'] }},
  53. .frames = _A_{{ animation.name }}
  54. },
  55. .frame_order = {{animation.name}}_frame_order,
  56. .passive_frames = {{ animation.meta['Passive frames'] }},
  57. .active_frames = {{ animation.meta['Active frames'] }},
  58. .active_cooldown = {{ animation.meta['Active cooldown'] }},
  59. .active_cycles = {{ animation.meta['Active cycles'] }},
  60. .duration = {{ animation.meta['Duration'] }},
  61. {% if animation.bubble_slots > 0: %}
  62. .frame_bubble_sequences = {{ animation.name }}_bubble_sequences,
  63. .frame_bubble_sequences_count = COUNT_OF({{ animation.name }}_bubble_sequences),
  64. {% :else: %}
  65. .frame_bubble_sequences = NULL,
  66. .frame_bubble_sequences_count = 0,
  67. {% :endif %}
  68. };
  69. {% :endfor %}
  70. const StorageAnimation {{symbol_name}}[] = {
  71. {% for animation in animations: %}
  72. {
  73. .animation = &BA_{{animation.name}},
  74. .manifest_info = {
  75. .name = "{{animation.name}}",
  76. .min_butthurt = {{animation.min_butthurt}},
  77. .max_butthurt = {{animation.max_butthurt}},
  78. .min_level = {{animation.min_level}},
  79. .max_level = {{animation.max_level}},
  80. .weight = {{animation.weight}},
  81. }
  82. },
  83. {% :endfor %}
  84. };
  85. const size_t {{symbol_name}}_size = COUNT_OF({{symbol_name}});