ソースを参照

add encounter music hook

ipatix 7 年 前
コミット
5483f96a1c
共有3 個のファイルを変更した106 個の追加14 個の削除を含む
  1. 19
    14
      patches/hooks.asm
  2. 60
    0
      src/include/songlist.h
  3. 27
    0
      src/music/encounter_lookup.c

+ 19
- 14
patches/hooks.asm ファイルの表示

@@ -1,36 +1,41 @@
1 1
 //Ipatix sound stuff
2
-  .org 0x080007B4
2
+.org 0x080007B4
3 3
     .word  0x0203E000   // new PCM work area
4
-  .org 0x081DD0B4
4
+.org 0x081DD0B4
5 5
     .word  main_mixer   // new mixer ROM location
6 6
     .word  0x03005F50   // new mixer RAM location (used for loading)
7 7
     .halfword mixer_size
8 8
     .halfword 0x400        // CpuSet, copy code by 32 bit units
9 9
     .word  0x0203E000   // new PCM work area
10
-  .org 0x081DD0C8
10
+.org 0x081DD0C8
11 11
      // set correct sound driver operation mode
12 12
      // 12 channels at 26758 Hz samplerate
13 13
     .byte  0x00, 0xCC, 0x98, 0x00
14
-  .org 0x081DC094
14
+.org 0x081DC094
15 15
     .word  0x03005F50+1 // new mixer RAM location (used for branch)
16 16
 
17 17
    // repoint correctly to the new cry tables
18
-  .org 0x080720C8
19
-  .include "patches/disable_cry_table_blocks.s"
18
+.org 0x080720C8
19
+    .include "patches/disable_cry_table_blocks.s"
20 20
 
21 21
    // cry-ID = poke-ID
22
-  .org 0x08043304
23
-  LSL	R0, R0, #0x10
24
-  LSR	R0, R0, #0x10
25
-  BX  LR
22
+.org 0x08043304
23
+    LSL R0, R0, #0x10
24
+    LSR R0, R0, #0x10
25
+    BX  LR
26 26
 
27 27
    // music overrides
28
-  .org 0x081DD0F4
28
+.org 0x081DD0F4
29 29
     LDR R1, =music_override|1
30
-    BX R1
31
-   .pool
32
-
30
+    BX  R1
31
+    .pool
33 32
 
33
+.org 0x0808064C
34
+    LDR R1, =trainer_intro_music_id_to_song|1
35
+    LDR R2, =0x080806BA|1 // return location
36
+    MOV LR, R2
37
+    BX  R1
38
+    .pool
34 39
 
35 40
 //End of sound stuff
36 41
 

+ 60
- 0
src/include/songlist.h ファイルの表示

@@ -0,0 +1,60 @@
1
+#pragma once
2
+
3
+// TODO add missing FR/LG song IDs
4
+
5
+// Towns
6
+
7
+#define SEQ_BGM_TOWN_HESPERIA       267
8
+
9
+// Cities
10
+
11
+#define SEQ_BGM_CITY_CARUN          272
12
+#define SEQ_BGM_CITY_URBANIA        273
13
+
14
+// Routes
15
+
16
+#define SEQ_BGM_ROUTE_1             302
17
+#define SEQ_BGM_ROUTE_2             303
18
+
19
+// Special Buildings
20
+
21
+#define SEQ_BGM_PC                  347
22
+#define SEQ_BGM_LAB                 382
23
+
24
+// Special Places
25
+
26
+#define SEQ_BGM_DESERT              350
27
+
28
+// Forests
29
+
30
+#define SEQ_BGM_FOREST_YELINA       352
31
+
32
+// Encounter
33
+
34
+#define SEQ_BGM_E_RIV_F             368
35
+#define SEQ_BGM_E_RIV_M             369
36
+#define SEQ_BGM_E_TT                385
37
+#define SEQ_BGM_E_TT_BOSS           386
38
+#define SEQ_FRLG_E_1                283
39
+#define SEQ_FRLG_E_2                284
40
+#define SEQ_FRLG_E_3                285
41
+
42
+// Battles
43
+
44
+#define SEQ_BGM_VS_RIVAL            379
45
+#define SEQ_BGM_VS_TT_ADMIN         381
46
+#define SEQ_BGM_VS_TT_BOSS_JANA     384
47
+#define SEQ_BGM_VS_TT_BOSS_NORMAN   388
48
+
49
+// Victories
50
+
51
+#define SEQ_BGM_VIC_TT              387
52
+#define SEQ_BGM_VIC_TRAINER         310
53
+
54
+// Various Events
55
+
56
+#define SEQ_BGM_EVENT_TT_RAID       375
57
+
58
+// Misc
59
+
60
+#define SEQ_BGM_TITLE_SCREEN        278

+ 27
- 0
src/music/encounter_lookup.c ファイルの表示

@@ -0,0 +1,27 @@
1
+#include <songlist.h>
2
+#include <game_engine.h>
3
+
4
+u16 trainer_intro_music_id_to_song(u8 introid) {
5
+    u16 res = 0;
6
+    switch (introid) {
7
+        case 0:
8
+        case 4:
9
+        case 5:
10
+        case 8:
11
+        case 10:
12
+        case 11:
13
+        case 12:
14
+        case 13:
15
+            res = SEQ_FRLG_E_3;
16
+            break;
17
+        case 1:
18
+        case 2:
19
+        case 9:
20
+            res = SEQ_FRLG_E_2;
21
+            break;
22
+        default:
23
+            res = SEQ_FRLG_E_3;
24
+            break;
25
+    }
26
+    return res;
27
+}