ソースを参照

more overworlds

SBird1337 8 年 前
コミット
1f84892dd5
共有10 個のファイルを変更した515 個の追加283 個の削除を含む
  1. 3
    1
      bpre.sym
  2. 2
    0
      main.asm
  3. 1
    1
      makefile
  4. 16
    0
      nbproject/configurations.xml
  5. 10
    0
      nbproject/private/configurations.xml
  6. 282
    0
      patches/move_table.asm
  7. 0
    281
      patches/moves.asm
  8. 61
    0
      patches/overworlds/overworld.asm
  9. 38
    0
      src/overworld/overworld.c
  10. 102
    0
      src/overworld/overworld_hooks.S

+ 3
- 1
bpre.sym ファイルの表示

@@ -71,6 +71,8 @@ superstate = 0x030030F0;
71 71
 
72 72
 fade_controller = 0x02037AB8;
73 73
 
74
+npc_states = 0x02036E38;
75
+
74 76
 weather_turns = 0x02023F48;
75 77
 battle_type_flags = 0x02022B4C;
76 78
 battle_active_bank = 0x02023BC4;
@@ -97,7 +99,7 @@ battle_stat_changer = 0x02023FDE;
97 99
 battle_menu_chosen_item = 0x02023D7C;
98 100
 battle_stuff_ptr = 0x02023FE8;
99 101
 battle_enigma_berry = 0x02023F54;
100
-battle_turn_random = 0x02033e80;
102
+battle_turn_random = 0x02023e80;
101 103
 side_affecting_halfword = 0x2023DDE;
102 104
 
103 105
 item_get_quality = 0x0809A948|1;

+ 2
- 0
main.asm ファイルの表示

@@ -29,6 +29,8 @@
29 29
 .include "patches/pokemon_data/pokemon_icons.asm"
30 30
 .include "patches/pokemon_data/pokemon_habitats.asm"
31 31
 
32
+.include "patches/overworlds/overworld.asm"
33
+
32 34
 .include "patches/battle_engine/malloc.asm"
33 35
 .include "patches/battle_engine/battle_engine.asm"
34 36
 

+ 1
- 1
makefile ファイルの表示

@@ -13,7 +13,7 @@ export PATH := $(realpath ../tools):$(PATH)
13 13
 
14 14
 DEFINES   := -DBPRE -DSOFTWARE_VERSION=0
15 15
 ASFLAGS   := -mthumb
16
-CFLAGS    := -g -mthumb -mno-thumb-interwork -mcpu=arm7tdmi -fno-inline -mlong-calls -march=armv4t -O3 -std=c99 -Wall -Isrc/include $(DEFINES)
16
+CFLAGS    := -mthumb -mno-thumb-interwork -mcpu=arm7tdmi -fno-inline -mlong-calls -march=armv4t -O3 -std=c99 -Wall -Isrc/include $(DEFINES)
17 17
 GRITFLAGS := -ftc -fa
18 18
 LDFLAGS   := -z muldefs
19 19
 BLDPATH   := object

+ 16
- 0
nbproject/configurations.xml ファイルの表示

@@ -3773,6 +3773,9 @@
3773 3773
           <in>items.asm</in>
3774 3774
           <in>tm_fixes.asm</in>
3775 3775
         </df>
3776
+        <df name="overworlds">
3777
+          <in>overworld.asm</in>
3778
+        </df>
3776 3779
         <df name="pokemon_data">
3777 3780
           <in>altitude_table.asm</in>
3778 3781
           <in>enemy_y_table.asm</in>
@@ -3799,6 +3802,7 @@
3799 3802
         <in>disable_cry_table_blocks.s</in>
3800 3803
         <in>dynamic_overworld_hooks.asm</in>
3801 3804
         <in>hooks.asm</in>
3805
+        <in>move_table.asm</in>
3802 3806
         <in>moves.asm</in>
3803 3807
         <in>music.asm</in>
3804 3808
         <in>special.asm</in>
@@ -4663,6 +4667,10 @@
4663 4667
           <in>main_mixer.S</in>
4664 4668
           <in>music_override.c</in>
4665 4669
         </df>
4670
+        <df name="overworld">
4671
+          <in>overworld.c</in>
4672
+          <in>overworld_hooks.S</in>
4673
+        </df>
4666 4674
         <df name="player_interaction">
4667 4675
           <in>jump_behavior.S</in>
4668 4676
           <in>on_step.S</in>
@@ -23419,10 +23427,14 @@
23419 23427
       </item>
23420 23428
       <item path="patches/items/tm_fixes.asm" ex="false" tool="4" flavor2="0">
23421 23429
       </item>
23430
+      <item path="patches/move_table.asm" ex="false" tool="4" flavor2="0">
23431
+      </item>
23422 23432
       <item path="patches/moves.asm" ex="false" tool="4" flavor2="0">
23423 23433
       </item>
23424 23434
       <item path="patches/music.asm" ex="false" tool="4" flavor2="0">
23425 23435
       </item>
23436
+      <item path="patches/overworlds/overworld.asm" ex="false" tool="4" flavor2="0">
23437
+      </item>
23426 23438
       <item path="patches/pokemon_data/altitude_table.asm"
23427 23439
             ex="false"
23428 23440
             tool="4"
@@ -27328,6 +27340,10 @@
27328 27340
       </item>
27329 27341
       <item path="src/music/music_override.c" ex="false" tool="0" flavor2="0">
27330 27342
       </item>
27343
+      <item path="src/overworld/overworld.c" ex="false" tool="0" flavor2="0">
27344
+      </item>
27345
+      <item path="src/overworld/overworld_hooks.S" ex="false" tool="4" flavor2="0">
27346
+      </item>
27331 27347
       <item path="src/player_interaction/jump_behavior.S"
27332 27348
             ex="false"
27333 27349
             tool="4"

+ 10
- 0
nbproject/private/configurations.xml ファイルの表示

@@ -3824,6 +3824,8 @@
3824 3824
           </df>
3825 3825
           <df name="music">
3826 3826
           </df>
3827
+          <df name="overworld">
3828
+          </df>
3827 3829
           <df name="player_interaction">
3828 3830
           </df>
3829 3831
           <df name="savefile">
@@ -3848,6 +3850,9 @@
3848 3850
           <in>items.asm</in>
3849 3851
           <in>tm_fixes.asm</in>
3850 3852
         </df>
3853
+        <df name="overworlds">
3854
+          <in>overworld.asm</in>
3855
+        </df>
3851 3856
         <df name="pokemon_data">
3852 3857
           <in>altitude_table.asm</in>
3853 3858
           <in>enemy_y_table.asm</in>
@@ -3874,6 +3879,7 @@
3874 3879
         <in>disable_cry_table_blocks.s</in>
3875 3880
         <in>dynamic_overworld_hooks.asm</in>
3876 3881
         <in>hooks.asm</in>
3882
+        <in>move_table.asm</in>
3877 3883
         <in>moves.asm</in>
3878 3884
         <in>music.asm</in>
3879 3885
         <in>special.asm</in>
@@ -5564,6 +5570,10 @@
5564 5570
           <in>main_mixer.S</in>
5565 5571
           <in>music_override.c</in>
5566 5572
         </df>
5573
+        <df name="overworld">
5574
+          <in>overworld.c</in>
5575
+          <in>overworld_hooks.S</in>
5576
+        </df>
5567 5577
         <df name="player_interaction">
5568 5578
           <in>jump_behavior.S</in>
5569 5579
           <in>on_step.S</in>

+ 282
- 0
patches/move_table.asm ファイルの表示

@@ -0,0 +1,282 @@
1
+.org 0x080001CC
2
+.word move_table
3
+.org 0x0800E3D8
4
+.word move_table
5
+.org 0x080128CC
6
+.word move_table
7
+.org 0x08012BA4
8
+.word move_table
9
+.org 0x08015060
10
+.word move_table
11
+.org 0x08015FBC
12
+.word move_table
13
+.org 0x080160F0
14
+.word move_table
15
+.org 0x08016238
16
+.word move_table
17
+.org 0x08016368
18
+.word move_table
19
+.org 0x080176D8
20
+.word move_table
21
+.org 0x08017990
22
+.word move_table
23
+.org 0x08019544
24
+.word move_table
25
+.org 0x080197A4
26
+.word move_table
27
+.org 0x08019BF0
28
+.word move_table
29
+.org 0x0801A0D0
30
+.word move_table
31
+.org 0x0801A6E8
32
+.word move_table
33
+.org 0x0801A740
34
+.word move_table
35
+.org 0x0801AA40
36
+.word move_table
37
+.org 0x0801AB0C
38
+.word move_table
39
+.org 0x0801AC00
40
+.word move_table
41
+.org 0x0801ACDC
42
+.word move_table
43
+.org 0x0801ADB8
44
+.word move_table
45
+.org 0x0801AE8C
46
+.word move_table
47
+.org 0x0801AFF8
48
+.word move_table
49
+.org 0x0801CF00
50
+.word move_table
51
+.org 0x0801D098
52
+.word move_table
53
+.org 0x0801D29C
54
+.word move_table
55
+.org 0x0801D934
56
+.word move_table
57
+.org 0x0801D9D0
58
+.word move_table
59
+.org 0x0801DA90
60
+.word move_table
61
+.org 0x0801DBF0
62
+.word move_table
63
+.org 0x0801DC6C
64
+.word move_table
65
+.org 0x0801DDB4
66
+.word move_table
67
+.org 0x0801DE68
68
+.word move_table
69
+.org 0x0801DF88
70
+.word move_table
71
+.org 0x0801E100
72
+.word move_table
73
+.org 0x0801E1A8
74
+.word move_table
75
+.org 0x0801E288
76
+.word move_table
77
+.org 0x0801E4D8
78
+.word move_table
79
+.org 0x0801E680
80
+.word move_table
81
+.org 0x0801E768
82
+.word move_table
83
+.org 0x0801E7F0
84
+.word move_table
85
+.org 0x0801E830
86
+.word move_table
87
+.org 0x0801E910
88
+.word move_table
89
+.org 0x0801EA9C
90
+.word move_table
91
+.org 0x0801EAFC
92
+.word move_table
93
+.org 0x0801ED30
94
+.word move_table
95
+.org 0x0801EDB4
96
+.word move_table
97
+.org 0x0801EDE4
98
+.word move_table
99
+.org 0x0801EE94
100
+.word move_table
101
+.org 0x0801EFC8
102
+.word move_table
103
+.org 0x0801F030
104
+.word move_table
105
+.org 0x0801F0C4
106
+.word move_table
107
+.org 0x0801F258
108
+.word move_table
109
+.org 0x0801F53C
110
+.word move_table
111
+.org 0x0801F750
112
+.word move_table
113
+.org 0x08021158
114
+.word move_table
115
+.org 0x08021190
116
+.word move_table
117
+.org 0x0802334C
118
+.word move_table
119
+.org 0x08023490
120
+.word move_table
121
+.org 0x0802393C
122
+.word move_table
123
+.org 0x08023B14
124
+.word move_table
125
+.org 0x08023C20
126
+.word move_table
127
+.org 0x08023C9C
128
+.word move_table
129
+.org 0x08023E6C
130
+.word move_table
131
+.org 0x080240C4
132
+.word move_table
133
+.org 0x08025CFC
134
+.word move_table
135
+.org 0x08026100
136
+.word move_table
137
+.org 0x0802704C
138
+.word move_table
139
+.org 0x08027468
140
+.word move_table
141
+.org 0x080286A0
142
+.word move_table
143
+.org 0x08028744
144
+.word move_table
145
+.org 0x08028A6C
146
+.word move_table
147
+.org 0x08028B4C
148
+.word move_table
149
+.org 0x08029434
150
+.word move_table
151
+.org 0x080296AC
152
+.word move_table
153
+.org 0x080297F4
154
+.word move_table
155
+.org 0x0802A180
156
+.word move_table
157
+.org 0x0802A1F0
158
+.word move_table
159
+.org 0x0802A27C
160
+.word move_table
161
+.org 0x0802AD00
162
+.word move_table
163
+.org 0x0802AE18
164
+.word move_table
165
+.org 0x0802AE50
166
+.word move_table
167
+.org 0x0802BAC0
168
+.word move_table
169
+.org 0x0802BE84
170
+.word move_table
171
+.org 0x0802C6C0
172
+.word move_table
173
+.org 0x0802D014
174
+.word move_table
175
+.org 0x0802E8B4
176
+.word move_table
177
+.org 0x0802E9F4
178
+.word move_table
179
+.org 0x0802EA9C
180
+.word move_table
181
+.org 0x080309C0
182
+.word move_table
183
+.org 0x08033B40
184
+.word move_table
185
+.org 0x08038670
186
+.word move_table
187
+.org 0x080386BC
188
+.word move_table
189
+.org 0x0803941C
190
+.word move_table
191
+.org 0x08039468
192
+.word move_table
193
+.org 0x0803962C
194
+.word move_table
195
+.org 0x080398C4
196
+.word move_table
197
+.org 0x0803A194
198
+.word move_table
199
+.org 0x0803E94C
200
+.word move_table
201
+.org 0x0803E9D0
202
+.word move_table
203
+.org 0x0803EC3C
204
+.word move_table
205
+.org 0x0803ECE8
206
+.word move_table
207
+.org 0x0803ED3C
208
+.word move_table
209
+.org 0x0803ED60
210
+.word move_table
211
+.org 0x0803F254
212
+.word move_table
213
+.org 0x0803F3B4
214
+.word move_table
215
+.org 0x0803F510
216
+.word move_table
217
+.org 0x0804105C
218
+.word move_table
219
+.org 0x080C7D90
220
+.word move_table
221
+.org 0x080C7E00
222
+.word move_table
223
+.org 0x080C7F34
224
+.word move_table
225
+.org 0x080C7F5C
226
+.word move_table
227
+.org 0x080C80AC
228
+.word move_table
229
+.org 0x080C8414
230
+.word move_table
231
+.org 0x080C8924
232
+.word move_table
233
+.org 0x080C8970
234
+.word move_table
235
+.org 0x080C8BD4
236
+.word move_table
237
+.org 0x080C8CBC
238
+.word move_table
239
+.org 0x080C8F2C
240
+.word move_table
241
+.org 0x080C8FA4
242
+.word move_table
243
+.org 0x080C9030
244
+.word move_table
245
+.org 0x080C9084
246
+.word move_table
247
+.org 0x080C946C
248
+.word move_table
249
+.org 0x080C9498
250
+.word move_table
251
+.org 0x080C94C4
252
+.word move_table
253
+.org 0x080E5380
254
+.word move_table
255
+.org 0x080E53CC
256
+.word move_table
257
+.org 0x080E543C
258
+.word move_table
259
+.org 0x081334D8
260
+.word move_table
261
+.org 0x08133528
262
+.word move_table
263
+.org 0x081335AC
264
+.word move_table
265
+.org 0x081336F0
266
+.word move_table
267
+.org 0x08133878
268
+.word move_table
269
+.org 0x08136950
270
+.word move_table
271
+.org 0x08136A64
272
+.word move_table
273
+.org 0x08136AB4
274
+.word move_table
275
+.org 0x0803E8F8
276
+.word move_table+4
277
+.org 0x0803E9A0
278
+.word move_table+4
279
+.org 0x08040EE0
280
+.word move_table+4
281
+
282
+

+ 0
- 281
patches/moves.asm ファイルの表示

@@ -100,285 +100,4 @@
100 100
 
101 101
 //move table
102 102
 
103
-.org 0x080001CC
104
-.word move_table
105
-.org 0x0800E3D8
106
-.word move_table
107
-.org 0x080128CC
108
-.word move_table
109
-.org 0x08012BA4
110
-.word move_table
111
-.org 0x08015060
112
-.word move_table
113
-.org 0x08015FBC
114
-.word move_table
115
-.org 0x080160F0
116
-.word move_table
117
-.org 0x08016238
118
-.word move_table
119
-.org 0x08016368
120
-.word move_table
121
-.org 0x080176D8
122
-.word move_table
123
-.org 0x08017990
124
-.word move_table
125
-.org 0x08019544
126
-.word move_table
127
-.org 0x080197A4
128
-.word move_table
129
-.org 0x08019BF0
130
-.word move_table
131
-.org 0x0801A0D0
132
-.word move_table
133
-.org 0x0801A6E8
134
-.word move_table
135
-.org 0x0801A740
136
-.word move_table
137
-.org 0x0801AA40
138
-.word move_table
139
-.org 0x0801AB0C
140
-.word move_table
141
-.org 0x0801AC00
142
-.word move_table
143
-.org 0x0801ACDC
144
-.word move_table
145
-.org 0x0801ADB8
146
-.word move_table
147
-.org 0x0801AE8C
148
-.word move_table
149
-.org 0x0801AFF8
150
-.word move_table
151
-.org 0x0801CF00
152
-.word move_table
153
-.org 0x0801D098
154
-.word move_table
155
-.org 0x0801D29C
156
-.word move_table
157
-.org 0x0801D934
158
-.word move_table
159
-.org 0x0801D9D0
160
-.word move_table
161
-.org 0x0801DA90
162
-.word move_table
163
-.org 0x0801DBF0
164
-.word move_table
165
-.org 0x0801DC6C
166
-.word move_table
167
-.org 0x0801DDB4
168
-.word move_table
169
-.org 0x0801DE68
170
-.word move_table
171
-.org 0x0801DF88
172
-.word move_table
173
-.org 0x0801E100
174
-.word move_table
175
-.org 0x0801E1A8
176
-.word move_table
177
-.org 0x0801E288
178
-.word move_table
179
-.org 0x0801E4D8
180
-.word move_table
181
-.org 0x0801E680
182
-.word move_table
183
-.org 0x0801E768
184
-.word move_table
185
-.org 0x0801E7F0
186
-.word move_table
187
-.org 0x0801E830
188
-.word move_table
189
-.org 0x0801E910
190
-.word move_table
191
-.org 0x0801EA9C
192
-.word move_table
193
-.org 0x0801EAFC
194
-.word move_table
195
-.org 0x0801ED30
196
-.word move_table
197
-.org 0x0801EDB4
198
-.word move_table
199
-.org 0x0801EDE4
200
-.word move_table
201
-.org 0x0801EE94
202
-.word move_table
203
-.org 0x0801EFC8
204
-.word move_table
205
-.org 0x0801F030
206
-.word move_table
207
-.org 0x0801F0C4
208
-.word move_table
209
-.org 0x0801F258
210
-.word move_table
211
-.org 0x0801F53C
212
-.word move_table
213
-.org 0x0801F750
214
-.word move_table
215
-.org 0x08021158
216
-.word move_table
217
-.org 0x08021190
218
-.word move_table
219
-.org 0x0802334C
220
-.word move_table
221
-.org 0x08023490
222
-.word move_table
223
-.org 0x0802393C
224
-.word move_table
225
-.org 0x08023B14
226
-.word move_table
227
-.org 0x08023C20
228
-.word move_table
229
-.org 0x08023C9C
230
-.word move_table
231
-.org 0x08023E6C
232
-.word move_table
233
-.org 0x080240C4
234
-.word move_table
235
-.org 0x08025CFC
236
-.word move_table
237
-.org 0x08026100
238
-.word move_table
239
-.org 0x0802704C
240
-.word move_table
241
-.org 0x08027468
242
-.word move_table
243
-.org 0x080286A0
244
-.word move_table
245
-.org 0x08028744
246
-.word move_table
247
-.org 0x08028A6C
248
-.word move_table
249
-.org 0x08028B4C
250
-.word move_table
251
-.org 0x08029434
252
-.word move_table
253
-.org 0x080296AC
254
-.word move_table
255
-.org 0x080297F4
256
-.word move_table
257
-.org 0x0802A180
258
-.word move_table
259
-.org 0x0802A1F0
260
-.word move_table
261
-.org 0x0802A27C
262
-.word move_table
263
-.org 0x0802AD00
264
-.word move_table
265
-.org 0x0802AE18
266
-.word move_table
267
-.org 0x0802AE50
268
-.word move_table
269
-.org 0x0802BAC0
270
-.word move_table
271
-.org 0x0802BE84
272
-.word move_table
273
-.org 0x0802C6C0
274
-.word move_table
275
-.org 0x0802D014
276
-.word move_table
277
-.org 0x0802E8B4
278
-.word move_table
279
-.org 0x0802E9F4
280
-.word move_table
281
-.org 0x0802EA9C
282
-.word move_table
283
-.org 0x080309C0
284
-.word move_table
285
-.org 0x08033B40
286
-.word move_table
287
-.org 0x08038670
288
-.word move_table
289
-.org 0x080386BC
290
-.word move_table
291
-.org 0x0803941C
292
-.word move_table
293
-.org 0x08039468
294
-.word move_table
295
-.org 0x0803962C
296
-.word move_table
297
-.org 0x080398C4
298
-.word move_table
299
-.org 0x0803A194
300
-.word move_table
301
-.org 0x0803E94C
302
-.word move_table
303
-.org 0x0803E9D0
304
-.word move_table
305
-.org 0x0803EC3C
306
-.word move_table
307
-.org 0x0803ECE8
308
-.word move_table
309
-.org 0x0803ED3C
310
-.word move_table
311
-.org 0x0803ED60
312
-.word move_table
313
-.org 0x0803F254
314
-.word move_table
315
-.org 0x0803F3B4
316
-.word move_table
317
-.org 0x0803F510
318
-.word move_table
319
-.org 0x0804105C
320
-.word move_table
321
-.org 0x080C7D90
322
-.word move_table
323
-.org 0x080C7E00
324
-.word move_table
325
-.org 0x080C7F34
326
-.word move_table
327
-.org 0x080C7F5C
328
-.word move_table
329
-.org 0x080C80AC
330
-.word move_table
331
-.org 0x080C8414
332
-.word move_table
333
-.org 0x080C8924
334
-.word move_table
335
-.org 0x080C8970
336
-.word move_table
337
-.org 0x080C8BD4
338
-.word move_table
339
-.org 0x080C8CBC
340
-.word move_table
341
-.org 0x080C8F2C
342
-.word move_table
343
-.org 0x080C8FA4
344
-.word move_table
345
-.org 0x080C9030
346
-.word move_table
347
-.org 0x080C9084
348
-.word move_table
349
-.org 0x080C946C
350
-.word move_table
351
-.org 0x080C9498
352
-.word move_table
353
-.org 0x080C94C4
354
-.word move_table
355
-.org 0x080E5380
356
-.word move_table
357
-.org 0x080E53CC
358
-.word move_table
359
-.org 0x080E543C
360
-.word move_table
361
-.org 0x081334D8
362
-.word move_table
363
-.org 0x08133528
364
-.word move_table
365
-.org 0x081335AC
366
-.word move_table
367
-.org 0x081336F0
368
-.word move_table
369
-.org 0x08133878
370
-.word move_table
371
-.org 0x08136950
372
-.word move_table
373
-.org 0x08136A64
374
-.word move_table
375
-.org 0x08136AB4
376
-.word move_table
377
-.org 0x0803E8F8
378
-.word move_table+4
379
-.org 0x0803E9A0
380
-.word move_table+4
381
-.org 0x08040EE0
382
-.word move_table+4
383
-
384 103
 //end of move table

+ 61
- 0
patches/overworlds/overworld.asm ファイルの表示

@@ -0,0 +1,61 @@
1
+.org 0x0805E5D4
2
+    bx r1
3
+
4
+.org 0x0805E5F4
5
+    .word overworld_h_one+1
6
+
7
+.org 0x0805F2C8
8
+    ldr r1, =npc_get_type+1
9
+    bx r1
10
+    .pool
11
+
12
+.org 0x0805e152
13
+mov r1, #5
14
+orr r0, r1
15
+strb r0, [r4]
16
+ldrb r0, [r5, #3]
17
+strb r0, [r4, #0x1A]
18
+
19
+.org 0x0805E510
20
+    ldr r1, =overworld_h_two+1
21
+    bx r1
22
+    .pool
23
+
24
+.org 0x0805E744
25
+    lsl r4, r4, #0x10
26
+    lsr r4, r4, #0x10
27
+    lsl r5, r5, #0x10
28
+    lsr r5, r5, #0x10
29
+    mov r0, #0x0
30
+    str r0, [SP, #0x20] 
31
+    mov r1, r9
32
+    ldrb r0, [r1, #0x1]
33
+    ldrb r1, [r1, #0x3]
34
+    lsl r1, r1, #0x18
35
+    lsr r1, r1, #0x10
36
+    orr r0, r1
37
+
38
+.org 0x0805e964
39
+    ldr r4, =overworld_h_three+1
40
+    bx r4
41
+    .pool
42
+
43
+.org 0x0805E8F0
44
+    lsl r0, #0x10
45
+    lsr r0, #0x10
46
+
47
+.org 0x0805ee84
48
+    bx r1
49
+
50
+.org 0x0805EFE4
51
+    .word overworld_h_four+1
52
+
53
+.org 0x08067A12
54
+    ldr r5, =overworld_h_five+1
55
+    bx r5
56
+    .pool
57
+
58
+.org 0x08067F92
59
+    ldr r5, =overworld_h_six+1
60
+    bx r5
61
+    .pool

+ 38
- 0
src/overworld/overworld.c ファイルの表示

@@ -0,0 +1,38 @@
1
+#include <bpre.h>
2
+
3
+#define OW_REPLACE_VAR  0x500A
4
+#define OW_REPLACE_TO_VAR   0x500B
5
+
6
+struct coords16{
7
+    u16 x;
8
+    u16 y;
9
+};
10
+
11
+struct npc_type {
12
+    u16 tiles_tag;
13
+    u16 pal_num;
14
+    u16 pal_tag_2;
15
+    u16 field_6;
16
+    struct coords16 pos_neg_center;
17
+    u8 pal_slot_unk;
18
+    u8 field_D;
19
+    u16 pal_table;
20
+    u32 oam;
21
+    u32 field_14;
22
+    u32 image_anims;
23
+    u32 gfx_table;
24
+    u32 rot_scale_anims;
25
+};
26
+
27
+struct npc_type** npc_tables[] = {(struct npc_type**)0x0839FDB0, (struct npc_type**)0x09E00000};
28
+
29
+struct npc_type* npc_get_type(u16 npc_id)
30
+{
31
+    u16* replace_ow = var_access(OW_REPLACE_VAR);
32
+    if(*replace_ow > 0 && *replace_ow - 1 == npc_id)
33
+    {
34
+        npc_id = *var_access(OW_REPLACE_TO_VAR);
35
+    }
36
+    u8 table = (npc_id >> 8);
37
+    return (npc_tables[table][npc_id & 0xFF]);
38
+}

+ 102
- 0
src/overworld/overworld_hooks.S ファイルの表示

@@ -0,0 +1,102 @@
1
+.align 2
2
+.thumb
3
+.text
4
+
5
+.global overworld_h_one
6
+
7
+overworld_h_one:
8
+    ldr r1, =npc_states
9
+    add r5, r0, r1
10
+    ldrb r0, [r5, #5] @image number
11
+    ldrb r1, [r5, #0x1A] @table index
12
+    lsl r1, #8
13
+    orr r0, r1
14
+    bl npc_get_type
15
+    ldr r1, =0x0805E5DD
16
+    bx r1
17
+
18
+.global overworld_h_two
19
+
20
+overworld_h_two:
21
+    push {r4, lr}
22
+    sub sp, #8
23
+    add r4, r0, #0
24
+    ldrb r0, [r4, #5] @image number
25
+    ldrb r1, [r4, #0x1A] @table index
26
+    lsl r1, #8
27
+    orr r0, r1
28
+    bl npc_get_type
29
+    ldr r1, =0x0805e51D
30
+    bx r1
31
+    
32
+.global overworld_h_three
33
+overworld_h_three:
34
+    add r4, r0, #0x0
35
+    add r5, r1, #0x0
36
+    add r3, r2, #0x0
37
+    ldrb r0, [r4, #0x1]
38
+    lsl r0, r0, #0x18
39
+    lsr r0, r0, #0x18
40
+    ldrb r1, [r4, #0x3]
41
+    lsl r1, r1, #0x18
42
+    lsr r1, r1, #0x10
43
+    orr r0, r0, r1
44
+    ldrb r1, [r4, #0x9]
45
+    add r2, r5, #0x0
46
+    ldr r4, =0x0805e96f
47
+    bx r4
48
+
49
+.global overworld_h_four
50
+overworld_h_four:
51
+    ldr r6, =npc_states
52
+    add r6, r0
53
+    mov r0, #0
54
+    str r0, [sp, #0x20]
55
+    ldrb r0, [r6, #5]
56
+    ldrb r1, [r6, #0x1A]
57
+    lsl r1, #8
58
+    orr r0, r1
59
+    bl npc_get_type
60
+    add r5, r0, #0x0
61
+    ldrh r2, [r5, #0x6]
62
+    add r4, SP, #0x18
63
+    ldr r0, [r4, #0x4]
64
+    lsr r0, r0, #0x10
65
+    lsl r0, r0, #0x10
66
+    orr r0, r2
67
+    str r0, [r4, #0x4]
68
+    ldrb r0, [r6, #0x5] 
69
+    ldrb r1, [r6, #0x1a]
70
+    lsl r1, r1, #0x8
71
+    orr r0, r1
72
+    ldr r1, =0x0805eea3
73
+    bx r1
74
+
75
+.global overworld_h_five
76
+overworld_h_five:
77
+    add r5, r0, #0
78
+    add r4, r1, #0
79
+    ldrb r1, [r5, #1]
80
+    mov r0, #0x41
81
+    neg r0, r0
82
+    and r0, r1
83
+    strb r0, [r5,#1]
84
+    ldrb r0, [r5, #0x5]
85
+    ldrb r1, [r5, #0x1a]
86
+    lsl r1, r1, #0x8
87
+    orr r0, r1
88
+    bl npc_get_type
89
+    ldr r1, =0x08067A27
90
+    bx r1
91
+
92
+.global overworld_h_six
93
+overworld_h_six:
94
+    add r5, r0, #0x0
95
+    mov r4, #0x0
96
+    ldrb r0, [r5, #0x5] 
97
+    ldrb r1, [r5, #0x1a]
98
+    lsl r1, r1, #0x8
99
+    orr r0, r1
100
+    bl npc_get_type
101
+    ldr r1, =0x08067f9d
102
+    bx r1