Browse Source

add sfx to pokedex

ipatix 6 years ago
parent
commit
c6498b0258
6 changed files with 25 additions and 34 deletions
  1. 1
    1
      g3headers
  2. 1
    1
      sots-private
  3. 0
    24
      src/include/sound.h
  4. 1
    1
      src/music/battle_music_lookup.c
  5. 7
    2
      src/pokedex/pokedex.c
  6. 15
    5
      src/pokedex/pokedex_region.c

+ 1
- 1
g3headers

1
-Subproject commit ef2af052b8e5436da9efb035e06ee091b8d53e69
1
+Subproject commit 97a084e3bbd1cfc31adf94c50a045c35e1044fa0

+ 1
- 1
sots-private

1
-Subproject commit 9591179a8d396b2343650dc1058a63b6288cea7b
1
+Subproject commit a62fe65e951ad5a563755d48d628f0607ab09d39

+ 0
- 24
src/include/sound.h View File

36
 
36
 
37
 #include "types.h"
37
 #include "types.h"
38
 
38
 
39
-typedef struct music_player_area music_player_area;
40
-typedef struct music_player_track music_player_track;
41
-typedef struct song_header song_header;
42
-
43
-typedef struct
44
-{
45
-    music_player_area *ma;
46
-    music_player_track *ta;
47
-    u32 tn;
48
-} m_play_table;
49
-
50
-typedef struct
51
-{
52
-    song_header *so;
53
-    u16 ms, me;
54
-} song_table;
55
-
56
-extern m_play_table mplay_table[];
57
-extern song_table _songtable[];
58
-void m4aSongNumStart(u16 songid);
59
-void MPlayStart_rev01(music_player_area *ma, song_header *so);
60
-void MPlayContinue(music_player_area *ma);
61
-void MPlayAllStop(void);
62
-
63
 // battle and map related stuff
39
 // battle and map related stuff
64
 void current_map_music_set(u16);
40
 void current_map_music_set(u16);
65
 void current_map_music_set_to_zero(void);
41
 void current_map_music_set_to_zero(void);

+ 1
- 1
src/music/battle_music_lookup.c View File

5
 #include <battle_common.h>
5
 #include <battle_common.h>
6
 #include <pokemon.h>
6
 #include <pokemon.h>
7
 #include <agb_debug.h>
7
 #include <agb_debug.h>
8
-#include <sound.h>
9
 #include <config/core.h>
8
 #include <config/core.h>
9
+#include <pokeagb/core/m4a.h>
10
 
10
 
11
 #define SONG_ID_SKIP_PLAY 0xFFFF
11
 #define SONG_ID_SKIP_PLAY 0xFFFF
12
 
12
 

+ 7
- 2
src/pokedex/pokedex.c View File

365
     if (reverse) {
365
     if (reverse) {
366
         if (pokedex_context->cursor_position_internal > 0) {
366
         if (pokedex_context->cursor_position_internal > 0) {
367
             pokedex_context->cursor_position_internal--;
367
             pokedex_context->cursor_position_internal--;
368
+            m4aSongNumStart(600);
368
         } else if ((pokedex_context->cursor_position_top) > (pokedex_context->first_seen)) {
369
         } else if ((pokedex_context->cursor_position_top) > (pokedex_context->first_seen)) {
369
             pdex_fill_previous_slot();
370
             pdex_fill_previous_slot();
370
             pokedex_context->cursor_position_top--;
371
             pokedex_context->cursor_position_top--;
371
-
372
             pdex_hardware_scroll(true);
372
             pdex_hardware_scroll(true);
373
+            m4aSongNumStart(600);
373
         }
374
         }
374
     } else {
375
     } else {
375
         if (pokedex_context->cursor_position_internal < 7) {
376
         if (pokedex_context->cursor_position_internal < 7) {
376
             pokedex_context->cursor_position_internal++;
377
             pokedex_context->cursor_position_internal++;
378
+            m4aSongNumStart(600);
377
         } else if (pokedex_context->cursor_position_top < (PDEX_LAST_SHOWN - 7)) {
379
         } else if (pokedex_context->cursor_position_top < (PDEX_LAST_SHOWN - 7)) {
378
             pdex_fill_next_slot();
380
             pdex_fill_next_slot();
379
             pokedex_context->cursor_position_top++;
381
             pokedex_context->cursor_position_top++;
380
             pdex_hardware_scroll(false);
382
             pdex_hardware_scroll(false);
383
+            m4aSongNumStart(600);
381
         }
384
         }
382
     }
385
     }
383
 
386
 
432
         if(super.buttons_new & KEY_A)
435
         if(super.buttons_new & KEY_A)
433
         {
436
         {
434
             pokedex_context->state = 15;
437
             pokedex_context->state = 15;
438
+            m4aSongNumStart(5);
435
         }
439
         }
436
         if (super.buttons_new & KEY_B) {
440
         if (super.buttons_new & KEY_B) {
437
             pokedex_context->state = 10;
441
             pokedex_context->state = 10;
442
+            m4aSongNumStart(601);
438
         }
443
         }
439
         if ((super.buttons_new & KEY_DOWN) || (super.buttons_held & KEY_DOWN)) {
444
         if ((super.buttons_new & KEY_DOWN) || (super.buttons_held & KEY_DOWN)) {
440
             pdex_try_advance(false);
445
             pdex_try_advance(false);
502
     pokedex_context->state = 0;
507
     pokedex_context->state = 0;
503
     task_add(pdex_loop, 0);
508
     task_add(pdex_loop, 0);
504
     set_callback2(pdex_cb_handler);
509
     set_callback2(pdex_cb_handler);
505
-}
510
+}

+ 15
- 5
src/pokedex/pokedex_region.c View File

162
     case 3:
162
     case 3:
163
         switch (super.buttons_new) {
163
         switch (super.buttons_new) {
164
         case KEY_RIGHT:
164
         case KEY_RIGHT:
165
-            if (pokedex_context->region_selected < 6)
165
+            if (pokedex_context->region_selected < 6) {
166
                 pokedex_context->region_selected++;
166
                 pokedex_context->region_selected++;
167
+                m4aSongNumStart(102);
168
+            }
167
             break;
169
             break;
168
         case KEY_DOWN:
170
         case KEY_DOWN:
169
-            if (pokedex_context->region_selected < 3)
171
+            if (pokedex_context->region_selected < 3) {
170
                 pokedex_context->region_selected += 3;
172
                 pokedex_context->region_selected += 3;
173
+                m4aSongNumStart(102);
174
+            }
171
             break;
175
             break;
172
         case KEY_LEFT:
176
         case KEY_LEFT:
173
-            if (pokedex_context->region_selected > 0)
177
+            if (pokedex_context->region_selected > 0) {
174
                 pokedex_context->region_selected--;
178
                 pokedex_context->region_selected--;
179
+                m4aSongNumStart(102);
180
+            }
175
             break;
181
             break;
176
         case KEY_UP:
182
         case KEY_UP:
177
-            if ((pokedex_context->region_selected > 2) && (pokedex_context->region_selected < 6))
183
+            if ((pokedex_context->region_selected > 2) && (pokedex_context->region_selected < 6)) {
178
                 pokedex_context->region_selected -= 3;
184
                 pokedex_context->region_selected -= 3;
185
+                m4aSongNumStart(102);
186
+            }
179
             break;
187
             break;
180
         case KEY_A:
188
         case KEY_A:
181
             fade_screen(0xFFFFFFFF, PDEX_FADEIN_SPD, 0, 16, 0x0000);
189
             fade_screen(0xFFFFFFFF, PDEX_FADEIN_SPD, 0, 16, 0x0000);
182
             pokedex_context->state = 10;
190
             pokedex_context->state = 10;
191
+            m4aSongNumStart(5);
183
             break;
192
             break;
184
         case KEY_B:
193
         case KEY_B:
185
             fade_screen(0xFFFFFFFF, PDEX_FADEIN_SPD, 0, 16, 0x0000);
194
             fade_screen(0xFFFFFFFF, PDEX_FADEIN_SPD, 0, 16, 0x0000);
186
             pokedex_context->state = 11;
195
             pokedex_context->state = 11;
196
+            m4aSongNumStart(601);
187
         default:
197
         default:
188
             break;
198
             break;
189
         }
199
         }
220
     region_select_load_gfx();
230
     region_select_load_gfx();
221
     task_add(region_loop, 0);
231
     task_add(region_loop, 0);
222
     set_callback2(pdex_cb_handler);
232
     set_callback2(pdex_cb_handler);
223
-}
233
+}