Browse Source

refractor some stuff

SBird1337 7 years ago
parent
commit
d618e4e195
2 changed files with 9 additions and 11 deletions
  1. 1
    1
      g3headers
  2. 8
    10
      src/overworld/tileset_animation/main_animator.c

+ 1
- 1
g3headers

1
-Subproject commit 04e8a122f208ca1ee8052fef39f2dca51dcffe10
1
+Subproject commit 3934c9b2ba672863275d517403a558278e549786

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

3
 
3
 
4
 struct TilesetAnimation {
4
 struct TilesetAnimation {
5
     u16 tile_start;
5
     u16 tile_start;
6
-    u16 frame_lenght;
6
+    u16 frame_length;
7
     u16 tile_length;
7
     u16 tile_length;
8
     u16 frame_count;
8
     u16 frame_count;
9
     const void *image;
9
     const void *image;
10
 };
10
 };
11
 
11
 
12
 const struct TilesetAnimation hesperia_second_animations[] = {
12
 const struct TilesetAnimation hesperia_second_animations[] = {
13
-    {0x114, 7, 4, 5, smokeTiles}, {0, 0, 0, 0, (void *)0xFFFFFFFF},
13
+    {.tile_start = 0x114, .frame_length = 7, .tile_length = 4, .frame_count = 5, .image = smokeTiles},
14
+    {.tile_start = 0, .frame_length = 0, .tile_length = 0, .frame_count = 0, .image = (void *)0xFFFFFFFF},
14
 };
15
 };
15
 
16
 
16
 void animate_from_structure(const struct TilesetAnimation *anim, u16 tile_skip, u16 current_frame) {
17
 void animate_from_structure(const struct TilesetAnimation *anim, u16 tile_skip, u16 current_frame) {
17
     void *vram_address = (void *)(0x06000000 + (tile_skip * 0x20));
18
     void *vram_address = (void *)(0x06000000 + (tile_skip * 0x20));
18
     u8 current_animation = 0;
19
     u8 current_animation = 0;
19
-    while (anim[current_animation].image != (void*)0xFFFFFFFF) {
20
+    while (anim[current_animation].image != (void *)0xFFFFFFFF) {
20
         void *current_vram = vram_address + (0x20 * anim[current_animation].tile_start);
21
         void *current_vram = vram_address + (0x20 * anim[current_animation].tile_start);
21
-        u16 max_frame = anim[current_animation].frame_lenght * anim[current_animation].frame_count;
22
+        u16 max_frame = anim[current_animation].frame_length * anim[current_animation].frame_count;
22
         u16 used_frame = current_frame % max_frame;
23
         u16 used_frame = current_frame % max_frame;
23
-        used_frame /= anim[current_animation].frame_lenght;
24
-        memcpy(current_vram,
25
-               anim[current_animation].image + (0x20 * anim[current_animation].tile_length * used_frame),
24
+        used_frame /= anim[current_animation].frame_length;
25
+        memcpy(current_vram, anim[current_animation].image + (0x20 * anim[current_animation].tile_length * used_frame),
26
                anim[current_animation].tile_length * 0x20);
26
                anim[current_animation].tile_length * 0x20);
27
         current_animation++;
27
         current_animation++;
28
     }
28
     }
29
 }
29
 }
30
 
30
 
31
-void main_animator(u16 current_frame) {
32
-    (void)current_frame;
33
-}
31
+void main_animator(u16 current_frame) { (void)current_frame; }
34
 
32
 
35
 extern struct MapBlockset maptileset128;
33
 extern struct MapBlockset maptileset128;
36
 extern struct MapBlockset maptileset0;
34
 extern struct MapBlockset maptileset0;