Browse Source

block wild battle fleeing

SBird1337 7 years ago
parent
commit
0ce763f215

+ 4
- 0
bpre.sym View File

@@ -105,8 +105,12 @@ npc_states = 0x02036E38;
105 105
 sav_one = 0x03005008;
106 106
 
107 107
 weather_turns = 0x02023F48;
108
+
109
+battle_call_bc_move_exec = 0x0801BBE4|1;
110
+battle_preparation_phase = 0x02023E82;
108 111
 battle_type_flags = 0x02022B4C;
109 112
 battle_active_bank = 0x02023BC4;
113
+battle_buffer_b = 0x020233C4;
110 114
 battle_num_active_sides = 0x02023BCC;
111 115
 battle_mode = 0x02023BE3;
112 116
 battle_participants	= 0x02023BE4;

+ 6
- 0
nbproject/configurations.xml View File

@@ -36,6 +36,7 @@
36 36
           <in>battle_end_of_turn.c</in>
37 37
           <in>battle_help.c</in>
38 38
           <in>battle_initiative.c</in>
39
+          <in>battle_m_flee_hook.S</in>
39 40
           <in>battle_test.c</in>
40 41
           <in>custom_structs_malloc.c</in>
41 42
           <in>entry_hazards.c</in>
@@ -539,6 +540,11 @@
539 540
         <cTool flags="0">
540 541
         </cTool>
541 542
       </item>
543
+      <item path="src/battle_engine/battle_m_flee_hook.S"
544
+            ex="false"
545
+            tool="4"
546
+            flavor2="0">
547
+      </item>
542 548
       <item path="src/battle_engine/battle_test.c" ex="false" tool="0" flavor2="3">
543 549
         <cTool flags="0">
544 550
         </cTool>

+ 5601
- 0
nbproject/private/configurations.xml
File diff suppressed because it is too large
View File


+ 6
- 1
patches/battle_engine/battle_engine.asm View File

@@ -17,4 +17,9 @@ bx r3
17 17
 .word battle_end_of_turn_hook+1
18 18
 
19 19
 .org 0x08018254
20
-.word battle_end_of_turn_hook+1
20
+.word battle_end_of_turn_hook+1
21
+
22
+.org 0x080146AC
23
+ldr r0, =battle_m_flee_hook+1
24
+bx r0
25
+.pool

+ 54
- 0
src/battle_engine/battle_m_flee_hook.S View File

@@ -0,0 +1,54 @@
1
+.text
2
+.align 2
3
+.thumb
4
+
5
+.global battle_m_flee_hook
6
+battle_m_flee_hook:
7
+
8
+ldr r0, =battle_type_flags
9
+ldr r0, [r0]
10
+mov r1, #0xA
11
+and r0, r1
12
+cmp r0, #8
13
+bne no_trainer
14
+ldr r0, =battle_buffer_b
15
+ldr r4, =battle_active_side
16
+ldrb r1, [r4]
17
+lsl r1, #9
18
+add r0, #1
19
+add r1, r1, r0
20
+ldrb r0, [r1]
21
+cmp r0, #3
22
+bne no_flee
23
+ldr r0, =0x080146CB
24
+bx r0
25
+no_trainer:
26
+/* here we have a wild battle (hopefully) and want to intercept on flag */
27
+@for testing: intercept everything!
28
+
29
+@only intercept the flee command though...
30
+ldr r0, =battle_buffer_b
31
+ldr r4, =battle_active_side
32
+ldrb r1, [r4]
33
+lsl r1, #9
34
+add r0, #1
35
+add r1, r1, r0
36
+ldrb r0, [r1]
37
+cmp r0, #3
38
+bne no_flee
39
+
40
+ldr r0, =0x081D8924 @some move script change later
41
+bl call_battle_call_move_something
42
+ldr r1, =battle_preparation_phase
43
+ldrb r0, [r4]
44
+add r0, r0, r1
45
+ldr r1, =0x08014927
46
+bx r1
47
+no_flee:
48
+ldr r0, =0x080146ED
49
+bx r0
50
+
51
+.align 2
52
+call_battle_call_move_something:
53
+ldr r1, =battle_call_bc_move_exec
54
+bx r1

+ 3
- 3
string/de/trainers/trainer_data.txt View File

@@ -259,19 +259,19 @@ str_trainer_name_42=Hanah
259 259
 @word pokemon_von_id_42
260 260
 
261 261
 @byte 0, 48, 1, 56
262
-str_trainer_name_43=Jörg
262
+str_trainer_name_43=Jörg
263 263
 @hword 0, 0, 0, 0
264 264
 @byte 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0
265 265
 @word pokemon_von_id_43
266 266
 
267 267
 @byte 0, 48, 1, 56
268
-str_trainer_name_44=Jörg
268
+str_trainer_name_44=Jörg
269 269
 @hword 0, 0, 0, 0
270 270
 @byte 0, 0, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0
271 271
 @word pokemon_von_id_44
272 272
 
273 273
 @byte 0, 48, 1, 56
274
-str_trainer_name_45=Jörg
274
+str_trainer_name_45=Jörg
275 275
 @hword 0, 0, 0, 0
276 276
 @byte 0, 0, 0, 0, 0, 7, 0, 0, 1, 0, 0, 0
277 277
 @word pokemon_von_id_45