Bladeren bron

prep battle engine

Philipp Auer 8 jaren geleden
bovenliggende
commit
57b755f0b2

+ 1
- 0
.gitignore Bestand weergeven

@@ -6,3 +6,4 @@ temp
6 6
 *.wav
7 7
 *.mid
8 8
 *.a
9
+base/*.*

+ 1
- 0
bpre.sym Bestand weergeven

@@ -86,6 +86,7 @@ battle_status3_bits_pbs = 0x02023DFC;
86 86
 
87 87
 mugshots = 0x097007E0;
88 88
 battle_bg_table = 0x0824ee34;
89
+custom_battle_struct = 0x0203FE00;
89 90
 
90 91
 
91 92
 mplay_table = 0x084A329C;

+ 3
- 4
makefile Bestand weergeven

@@ -5,7 +5,7 @@ GRIT    := grit
5 5
 CC      := arm-none-eabi-gcc
6 6
 ARS     := armips
7 7
 MAKE    := make
8
-NM      := arm-none-eabi-nm
8
+NM      := @arm-none-eabi-nm
9 9
 LAN		:= de
10 10
 STRAGB	:= string2agb
11 11
 
@@ -54,7 +54,6 @@ ALL_OBJ     := $(C_OBJ) $(ASM_OBJ_PP) $(ASM_OBJ) $(DATA_OBJ_PP) $(DATA_OBJ)
54 54
 
55 55
 
56 56
 $(STRINGDIR)/%.S: $(STRINGDIR)/%.txt
57
-	@echo hello
58 57
 	$(STRAGB) -o $@ -i $< -t string/table.tbl -e 0xFF
59 58
 
60 59
 $(BLDPATH)/%.o: %.c $(ASSETS)
@@ -74,8 +73,8 @@ all: rom
74 73
 .PHONY: rom
75 74
 rom: main.asm $(MAIN_OBJ)
76 75
 	$(ARS) $<
77
-	#$(NM) $(BLDPATH)/linked.o -n -g --defined-only | \
78
-	#	sed -e '{s/^/0x/g};{/.*\sA\s.*/d};{s/\sT\s/ /g}' > $(OUTPATH)/__symbols.sym
76
+	$(NM) $(BLDPATH)/linked.o -n -g --defined-only | \
77
+		sed -e '{s/^/0x/g};{/.*\sA\s.*/d};{s/\sT\s/ /g}' > $(OUTPATH)/__symbols.sym
79 78
 	@echo "*** SUCCESSFULLY BUILT PROJECT ***"
80 79
 	
81 80
 $(MAIN_OBJ): $(ALL_OBJ) $(ICONS_AR) $(SPRITES) $(DYN_OVER) $(MUSIC_AR) $(SMPL_AR) $(VOICE_AR) $(LIST_AR) $(CRY_AR) $(STRING_OBJ)

+ 5
- 0
patches/battle_engine/malloc.asm Bestand weergeven

@@ -0,0 +1,5 @@
1
+.org 0x0802E224
2
+.word alloc_res_hook|1
3
+
4
+.org 0x0802E1F8
5
+bx r0

+ 122
- 0
src/battle_engine/custom_structs.h Bestand weergeven

@@ -0,0 +1,122 @@
1
+#ifndef B_NEW_STRUCT
2
+#define B_NEW_STRUCT
3
+
4
+#include <types.h>
5
+
6
+struct bank_affecting {
7
+	u8 embargo : 3;
8
+    u8 electrify : 1;
9
+    u8 telekinesis: 3;
10
+    u8 magnet_rise : 3;
11
+    u8 heal_block : 3;
12
+    u8 aqua_ring : 1;
13
+    u8 powder : 1;
14
+    u8 smacked_down : 1;
15
+    u8 quashed : 1;
16
+    u8 just_switched_in : 1;
17
+    u8 ally_fainted_last_turn : 1;
18
+    u8 miracle_eyed : 1;
19
+    u8 spiky_shield : 1;
20
+    u8 kings_shield : 1;
21
+    u8 life_orbed : 1;
22
+    u8 sheerforce_bonus : 1;
23
+    u8 eaten_berry : 1;
24
+    u8 sunshine_form : 1;
25
+    u8 cherrim_transformed : 1;
26
+    u8 gastro_acided : 1;
27
+    u8 sky_drop_attacker : 1;
28
+    u8 sky_drop_target : 1;
29
+    u8 gem_boost : 1;
30
+    u8 me_first : 1;
31
+    u8 weakness2 : 1;
32
+    u8 ate_bonus : 1;
33
+    u8 entry_message : 1;
34
+    u8 powertrick : 1;
35
+    u8 kingsshield_damage : 1;
36
+    u8 spikyshield_damage : 1;
37
+    u8 grassyterrain_heal : 1;
38
+    u8 item_used : 1;
39
+    u8 slowstart_duration : 3;
40
+    u8 aegislash_form : 2; //0 = not aegi, 1 = defensive, 2 = attacking
41
+    u8 killer_bank : 2;
42
+    u8 same_move_used : 3;
43
+    u8 wrap_bank : 2;
44
+    u8 move_failed : 1;
45
+    u8 type3 : 5;
46
+    u8 stat_lowered : 1;
47
+    u8 roost : 3;
48
+    u8 bugbite : 1;
49
+    s8 stockpile_def_changes;
50
+    s8 stockpile_sp_def_changes;
51
+    u8 autonomize_uses;
52
+    u16 wish_hp;
53
+};
54
+
55
+struct side_affecting {
56
+	u8 sticky_web : 1;
57
+    u8 sticky_web_done : 1;
58
+    u8 toxic_spikes_psn : 1;
59
+    u8 toxic_spikes_badpsn : 1;
60
+    u8 toxic_spikes_done : 1;
61
+    u8 stealthrock : 1;
62
+    u8 stealthrock_done : 1;
63
+    u8 lucky_chant : 3;
64
+    u8 lucky_chant_bank : 2;
65
+    u8 tailwind : 3;
66
+    u8 tailwind_bank : 2;
67
+    u8 wide_guard : 1;
68
+    u8 quick_guard : 1;
69
+    u8 crafty_shield : 1;
70
+    u8 combo_waterpledge : 1;
71
+    u8 combo_firepledge : 1;
72
+    u8 combo_grasspledge : 1;
73
+    u8 swamp_spd_halving : 3;
74
+    u8 sea_of_fire : 3;
75
+    u8 rainbow : 3;
76
+    u8 mat_block : 1;
77
+    u8 lunardance : 1;
78
+    u8 lunardance_done : 1;
79
+    u8 echo_voice_counter : 3;
80
+    u8 mega_evo_state : 2; //0 = neither mega evolved nor triggered, 1 = triggered to mega evolve(if set, should reset next turn in case poke didn't mega evolve), 2 = mega evolved
81
+};
82
+
83
+struct field_affecting {
84
+	u8 trick_room : 3;
85
+    u8 wonder_room : 3;
86
+    u8 magic_room : 3;
87
+    u8 grassy_terrain : 3;
88
+    u8 electic_terrain : 3;
89
+    u8 misty_terrain : 3;
90
+    u8 ion_deluge : 3;
91
+    u8 gravity : 3;
92
+    u8 round_chosen : 1;
93
+    u8 fairy_lock : 1;
94
+};
95
+
96
+struct various {
97
+	u8 eaten_berry_player : 6;
98
+    u8 eaten_berry_opponent : 6;
99
+    u8 active_bank : 2;
100
+    u8 inverse_battle : 1;
101
+    u8 magicbounce : 1;
102
+    u8 stormdrain : 1;
103
+    u16 var1;
104
+    u16 var2;
105
+    u16 recently_used_item;
106
+    u16 previous_move;
107
+};
108
+
109
+struct custom_battle_struct{
110
+    struct bank_affecting bank_affecting[4];
111
+    struct side_affecting side_affecting[2];
112
+    struct field_affecting field_affecting;
113
+    struct various various;
114
+};
115
+
116
+struct custom_battle_struct_ptr{
117
+    struct custom_battle_struct *ptr;
118
+};
119
+
120
+extern struct custom_battle_struct_ptr custom_battle_struct;
121
+
122
+#endif

+ 12
- 0
src/battle_engine/custom_structs_malloc.c Bestand weergeven

@@ -0,0 +1,12 @@
1
+#include <bpre.h>
2
+#include "custum_structs_malloc.h"
3
+
4
+void malloc_battle_structs()
5
+{
6
+	
7
+}
8
+
9
+void free_battle_structs()
10
+{
11
+	
12
+}

+ 7
- 0
src/battle_engine/custom_structs_malloc.h Bestand weergeven

@@ -0,0 +1,7 @@
1
+#ifndef CUSTOM_S_MAL_H_
2
+#define CUSTOM_S_MAL_H_
3
+
4
+void malloc_battle_structs();
5
+void free_battle_structs();
6
+
7
+#endif

+ 19
- 0
src/battle_engine/custom_structs_malloc_hook.S Bestand weergeven

@@ -0,0 +1,19 @@
1
+.text
2
+.align 2
3
+.thumb
4
+
5
+.global alloc_res_hook
6
+alloc_res_hook:
7
+
8
+bl malloc_battle_structs
9
+ldr r0, =0x0802E084|1
10
+bx r0
11
+
12
+.align 2
13
+
14
+.global free_res_hook
15
+free_res_hook:
16
+
17
+bl free_battle_structs
18
+ldr r0, =0x0802E200|1
19
+bx r0

+ 0
- 1
string/de/more_string.txt Bestand weergeven

@@ -1 +0,0 @@
1
-label=Text

+ 1
- 1
string/de/some_string.txt Bestand weergeven

@@ -1 +1 @@
1
-first_string=Hello darkness my old friend!
1
+first_string=Hallo Dunkelheit, du alter Freund.

+ 1
- 0
string/en/some_string.txt Bestand weergeven

@@ -0,0 +1 @@
1
+first_string=Hello darkness my old friend.