Browse Source

added hesperia animations, resolves #89

SBird1337 6 years ago
parent
commit
127024238d
1 changed files with 21 additions and 8 deletions
  1. 21
    8
      src/overworld/tileset_animation/main_animator.c

+ 21
- 8
src/overworld/tileset_animation/main_animator.c View File

@@ -1,9 +1,14 @@
1
-#include <pokeagb/pokeagb.h>
2 1
 #include <agb_debug.h>
3
-#include <tileset_animation/smoke.h>
4
-#include <tileset_animation/water_stone.h>
2
+#include <pokeagb/pokeagb.h>
5 3
 #include <tileset_animation/flowers_mag.h>
6 4
 #include <tileset_animation/flowers_ora.h>
5
+#include <tileset_animation/smoke.h>
6
+#include <tileset_animation/water_deep.h>
7
+#include <tileset_animation/water_normal.h>
8
+#include <tileset_animation/water_sea.h>
9
+#include <tileset_animation/water_edge.h>
10
+#include <tileset_animation/water_stone.h>
11
+#include <tileset_animation/waterfall.h>
7 12
 
8 13
 #define NUM_MAX_ANIMATIONS 16
9 14
 
@@ -22,11 +27,18 @@ struct TilesetAnimation {
22 27
     const void *image;
23 28
 };
24 29
 
30
+#define AS_WATER 9
31
+
25 32
 const struct TilesetAnimation hesperia_second_animations[] = {
26 33
     {.tile_start = 0x10C, .frame_length = 14, .tile_length = 4, .frame_count = 10, .image = flowers_magTiles},
27 34
     {.tile_start = 0x110, .frame_length = 14, .tile_length = 4, .frame_count = 15, .image = flowers_oraTiles},
28 35
     {.tile_start = 0x114, .frame_length = 7, .tile_length = 4, .frame_count = 8, .image = smokeTiles},
29 36
     {.tile_start = 0x13C, .frame_length = 7, .tile_length = 4, .frame_count = 4, .image = water_stoneTiles},
37
+    {.tile_start = 0x118, .frame_length = 4, .tile_length = 36, .frame_count = 8, .image = waterfallTiles},
38
+    {.tile_start = 0x140, .frame_length = AS_WATER, .tile_length = 36, .frame_count = 8, .image = water_normalTiles},
39
+    {.tile_start = 0x168, .frame_length = AS_WATER, .tile_length = 4, .frame_count = 8, .image = water_seaTiles},
40
+    {.tile_start = 0x16C, .frame_length = AS_WATER, .tile_length = 4, .frame_count = 8, .image = water_deepTiles},
41
+    {.tile_start = 0x164, .frame_length = AS_WATER, .tile_length = 4, .frame_count = 8, .image = water_edgeTiles},
30 42
     {.tile_start = 0, .frame_length = 0, .tile_length = 0, .frame_count = 0, .image = (void *)0xFFFFFFFF},
31 43
 };
32 44
 
@@ -37,9 +49,9 @@ void animate_from_structure(const struct TilesetAnimation *anim, u16 tile_skip,
37 49
         void *current_vram = vram_address + (0x20 * anim[cur_anim].tile_start);
38 50
 
39 51
         if (anim_state->cur_frame[cur_anim] == 0) {
40
-            memcpy(current_vram, anim[cur_anim].image +
41
-                    (0x20 * anim[cur_anim].tile_length * anim_state->cur_tile[cur_anim]),
42
-                    anim[cur_anim].tile_length * 0x20);
52
+            memcpy(current_vram,
53
+                   anim[cur_anim].image + (0x20 * anim[cur_anim].tile_length * anim_state->cur_tile[cur_anim]),
54
+                   anim[cur_anim].tile_length * 0x20);
43 55
         }
44 56
 
45 57
         anim_state->cur_frame[cur_anim] += 1;
@@ -55,7 +67,8 @@ void animate_from_structure(const struct TilesetAnimation *anim, u16 tile_skip,
55 67
     }
56 68
     if (cur_anim >= NUM_MAX_ANIMATIONS) {
57 69
         dprintf("Warning! Animation State array not big enough to play all animations\n"
58
-                "Please increase the limit in %s\n", __FILE__);
70
+                "Please increase the limit in %s\n",
71
+                __FILE__);
59 72
     }
60 73
 }
61 74
 
@@ -76,7 +89,7 @@ void main_animator_init(void) {
76 89
 
77 90
 void main_second_animator_init(void) {
78 91
     blockset_two_current_frame = 0;
79
-    blockset_two_max_frame = 0x3C0;
92
+    blockset_two_max_frame = 0x3624;
80 93
     blockset_two_animator = main_second_animator;
81 94
 
82 95
     for (int i = 0; i < NUM_MAX_ANIMATIONS; i++) {