Browse Source

block wild battle fleeing

SBird1337 7 years ago
parent
commit
0ce763f215

+ 4
- 0
bpre.sym View File

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

+ 6
- 0
nbproject/configurations.xml View File

36
           <in>battle_end_of_turn.c</in>
36
           <in>battle_end_of_turn.c</in>
37
           <in>battle_help.c</in>
37
           <in>battle_help.c</in>
38
           <in>battle_initiative.c</in>
38
           <in>battle_initiative.c</in>
39
+          <in>battle_m_flee_hook.S</in>
39
           <in>battle_test.c</in>
40
           <in>battle_test.c</in>
40
           <in>custom_structs_malloc.c</in>
41
           <in>custom_structs_malloc.c</in>
41
           <in>entry_hazards.c</in>
42
           <in>entry_hazards.c</in>
539
         <cTool flags="0">
540
         <cTool flags="0">
540
         </cTool>
541
         </cTool>
541
       </item>
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
       <item path="src/battle_engine/battle_test.c" ex="false" tool="0" flavor2="3">
548
       <item path="src/battle_engine/battle_test.c" ex="false" tool="0" flavor2="3">
543
         <cTool flags="0">
549
         <cTool flags="0">
544
         </cTool>
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
 .word battle_end_of_turn_hook+1
17
 .word battle_end_of_turn_hook+1
18
 
18
 
19
 .org 0x08018254
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

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