Parcourir la source

some refractoring and optimization

SBird1337 il y a 7 ans
Parent
révision
c473022e21
4 fichiers modifiés avec 8 ajouts et 4 suppressions
  1. 1
    1
      g3headers
  2. 1
    1
      sots-private
  3. 1
    0
      src/include/config.h
  4. 5
    2
      src/overworld/tileset_animation/text_animator.c

+ 1
- 1
g3headers

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

+ 1
- 1
sots-private

@@ -1 +1 @@
1
-Subproject commit c1c7449630ff2756ff7ce11339a850ae79e6821f
1
+Subproject commit 71c2436a1f5ed193506491e9a70aea2fa696461f

+ 1
- 0
src/include/config.h Voir le fichier

@@ -40,6 +40,7 @@
40 40
 #define HEALING_BANK_MAP_VAR    0x500E
41 41
 #define HEALING_X_VAR           0x500F
42 42
 #define HEALING_Y_VAR           0x5010
43
+#define TEXT_ANIMATION_VAR      0x8000
43 44
 
44 45
 /*Variables to control the music overrides*/
45 46
 #define VAR_FROM_1              0x51FA

+ 5
- 2
src/overworld/tileset_animation/text_animator.c Voir le fichier

@@ -60,11 +60,13 @@ void set_pixel(u8 x, u8 y, u16 *start, u16 pixel) {
60 60
     if (x % 2 == 0)
61 61
         *addr = (*addr & 0xFF00) | (pixel);
62 62
     else
63
-        *addr = (*addr & 0x00FF) | (pixel << 8);
63
+        *addr = (*((u8*)addr)) | (pixel << 8);
64 64
 }
65 65
 
66
+#define ANIMATION_FRAME_SPEED 2
67
+
66 68
 void text_animator(u16 current_frame) {
67
-    if ((current_frame % 7) == 0) {
69
+    if ((current_frame % ANIMATION_FRAME_SPEED) == 0) {
68 70
         u8 outer_pixels[16] = {
69 71
             *(CANVAS_FIRST + 0),   *(CANVAS_FIRST + 4),   *(CANVAS_FIRST + 8),   *(CANVAS_FIRST + 12),
70 72
             *(CANVAS_FIRST + 16),  *(CANVAS_FIRST + 20),  *(CANVAS_FIRST + 24),  *(CANVAS_FIRST + 28),
@@ -89,6 +91,7 @@ void anim_init_text(void) {
89 91
     blockset_one_current_tile = 0;
90 92
     blockset_one_max_tile = 0x280;
91 93
     blockset_one_animator = text_animator;
94
+    dprintf("%d\n", var_8000);
92 95
     if(var_8000 != 0)
93 96
         draw_text_on_canvas(map_texts[var_8000]);
94 97
 }