Browse Source

variable battle bg loading

SBird1337 7 years ago
parent
commit
89b1d49235

+ 1
- 1
battle_engine

@@ -1 +1 @@
1
-Subproject commit a201b518834f0208efdb82ac95b08675f5279950
1
+Subproject commit 4a4fb7ac2ac3def1d4270796bdd2c04e8231d382

+ 1
- 1
g3headers

@@ -1 +1 @@
1
-Subproject commit 7522abc1b9b557bd8a2ac643ac44adefa4eb28a2
1
+Subproject commit d31c1af54121a32dc22fd8101492383b844a9dbe

+ 10
- 0
patches/battle_engine/battle_engine.asm View File

@@ -22,4 +22,14 @@ bx r3
22 22
 .org 0x080146AC
23 23
 ldr r0, =battle_m_flee_hook+1
24 24
 bx r0
25
+.pool
26
+
27
+.org 0x0800F260
28
+ldr r1, =battle_load_background+1
29
+bx r1
30
+.pool
31
+
32
+.org 0x0800F2AC
33
+ldr r1, =battle_load_decals+1
34
+bx r1
25 35
 .pool

+ 0
- 16
patches/hooks.asm View File

@@ -71,22 +71,6 @@ _call_via_r1 equ 0x081E3BAC
71 71
 //.org 0x0800f268
72 72
 //    .halfword 0xE000
73 73
 
74
-//Battle bg use new table
75
-.org 0x0800F2A0
76
-    .word battle_bg_table
77
-
78
-.org 0x0800F2E0
79
-    .word battle_bg_table
80
-
81
-.org 0x0800F320
82
-    .word battle_bg_table
83
-
84
-.org 0x0800F40E
85
-    ldr r0, =battle_bg_hook|1
86
-    bx r0
87
-    lsl r0, #0
88
-	.pool
89
-
90 74
 .org 0x0800FD5C
91 75
     .word battle_bg_table
92 76
 

+ 1
- 1
sots-private

@@ -1 +1 @@
1
-Subproject commit 1e41bcd48f05000de9ac0459ea370209c601c1a4
1
+Subproject commit a939744eddbf3a54ee47240630aaaf01320016bc

+ 2
- 1
src/battle_bg/battle_bg_hook.s View File

@@ -1,4 +1,4 @@
1
-#include <config.h>
1
+/*#include <config.h>
2 2
 .align 2
3 3
 .thumb
4 4
 .text
@@ -47,3 +47,4 @@ bxr1:
47 47
 	bx r1
48 48
 bxr0:
49 49
 	bx r0
50
+*/

+ 88
- 0
src/battle_engine/battle_load_elements/battle_load_elements.c View File

@@ -0,0 +1,88 @@
1
+#include <config.h>
2
+#include <pokeagb/pokeagb.h>
3
+#include <battlescreen/battlescreen_0.h>
4
+#include <battlescreen/battlescreen_1.h>
5
+#include <battlescreen/battlescreen_2.h>
6
+#include <battlescreen/battlescreen_3.h>
7
+#include <battlescreen/battlescreen_4.h>
8
+#include <battlescreen/battlescreen_5.h>
9
+#include <battlescreen/battlescreen_6.h>
10
+#include <battlescreen/battlescreen_7.h>
11
+#include <battlescreen/battlescreen_8.h>
12
+#include <battlescreen/battlescreen_9.h>
13
+#include <battlescreen/battlescreen_10.h>
14
+#include <battlescreen/battlescreen_11.h>
15
+#include <battlescreen/battlescreen_12.h>
16
+#include <battlescreen/battlescreen_13.h>
17
+#include <battlescreen/battlescreen_14.h>
18
+#include <battlescreen/battlescreen_15.h>
19
+#include <battlescreen/battlescreen_16.h>
20
+#include <battlescreen/battlescreen_17.h>
21
+#include <battlescreen/battlescreen_18.h>
22
+#include <battlescreen/battlescreen_19.h>
23
+#include <battlescreen/battlescreen_20.h>
24
+#include <battlescreen/battlescreen_21.h>
25
+#include <battlescreen/battlescreen_22.h>
26
+#include <battlescreen/battlescreen_23.h>
27
+#include <battlescreen/battlescreen_24.h>
28
+
29
+
30
+#define SIZEOF_ARR(a) (sizeof(a) / sizeof(a[0]))
31
+#define BATTLE_ELEMENT(n)                                                                                              \
32
+    (n > SIZEOF_ARR(battle_screen_elements) ? battle_screen_elements[0] : battle_screen_elements[n])
33
+#define BATTLE_ELEMENT_VAR (walkrun_state.is_surfing ? BATTLE_SEA_VAR : BATTLE_NORMAL_VAR)
34
+
35
+struct BattleScreenElements {
36
+    const void *gfx_bg;
37
+    const void *map_bg;
38
+    const void *gfx_grass;
39
+    const void *map_grass;
40
+    const void *palette;
41
+};
42
+
43
+const struct BattleScreenElements battle_screen_elements[] = {
44
+    {battlescreen_0Tiles, battlescreen_0Map, NULL, NULL, battlescreen_0Pal},
45
+    {battlescreen_1Tiles, battlescreen_1Map, NULL, NULL, battlescreen_1Pal},
46
+    {battlescreen_2Tiles, battlescreen_2Map, NULL, NULL, battlescreen_2Pal},
47
+    {battlescreen_3Tiles, battlescreen_3Map, NULL, NULL, battlescreen_3Pal},
48
+    {battlescreen_4Tiles, battlescreen_4Map, NULL, NULL, battlescreen_4Pal},
49
+    {battlescreen_5Tiles, battlescreen_5Map, NULL, NULL, battlescreen_5Pal},
50
+    {battlescreen_6Tiles, battlescreen_6Map, NULL, NULL, battlescreen_6Pal},
51
+    {battlescreen_7Tiles, battlescreen_7Map, NULL, NULL, battlescreen_7Pal},
52
+    {battlescreen_8Tiles, battlescreen_8Map, NULL, NULL, battlescreen_8Pal},
53
+    {battlescreen_9Tiles, battlescreen_9Map, NULL, NULL, battlescreen_9Pal},
54
+    {battlescreen_10Tiles, battlescreen_10Map, NULL, NULL, battlescreen_10Pal},
55
+    {battlescreen_11Tiles, battlescreen_11Map, NULL, NULL, battlescreen_11Pal},
56
+    {battlescreen_12Tiles, battlescreen_12Map, NULL, NULL, battlescreen_12Pal},
57
+    {battlescreen_13Tiles, battlescreen_13Map, NULL, NULL, battlescreen_13Pal},
58
+    {battlescreen_14Tiles, battlescreen_14Map, NULL, NULL, battlescreen_14Pal},
59
+    {battlescreen_15Tiles, battlescreen_15Map, NULL, NULL, battlescreen_15Pal},
60
+    {battlescreen_16Tiles, battlescreen_16Map, NULL, NULL, battlescreen_16Pal},
61
+    {battlescreen_17Tiles, battlescreen_17Map, NULL, NULL, battlescreen_17Pal},
62
+    {battlescreen_18Tiles, battlescreen_18Map, NULL, NULL, battlescreen_18Pal},
63
+    {battlescreen_19Tiles, battlescreen_19Map, NULL, NULL, battlescreen_19Pal},
64
+    {battlescreen_20Tiles, battlescreen_20Map, NULL, NULL, battlescreen_20Pal},
65
+    {battlescreen_21Tiles, battlescreen_21Map, NULL, NULL, battlescreen_21Pal},
66
+    {battlescreen_22Tiles, battlescreen_22Map, NULL, NULL, battlescreen_22Pal},
67
+    {battlescreen_23Tiles, battlescreen_23Map, NULL, NULL, battlescreen_23Pal},
68
+    {battlescreen_24Tiles, battlescreen_24Map, NULL, NULL, battlescreen_24Pal},
69
+};
70
+
71
+void battle_load_background(u16 idx) {
72
+    (void)idx;
73
+
74
+    struct BattleScreenElements element = BATTLE_ELEMENT(var_load(BATTLE_ELEMENT_VAR));
75
+    lz77UnCompVram(element.gfx_bg, (void *)0x06008000);
76
+    lz77UnCompVram(element.map_bg, (void *)0x0600D000);
77
+    gpu_pal_apply_compressed(element.palette, 32, 96);
78
+}
79
+
80
+void battle_load_decals(u16 idx) {
81
+    (void)idx;
82
+
83
+    struct BattleScreenElements element = BATTLE_ELEMENT(var_load(BATTLE_ELEMENT_VAR));
84
+    if (element.gfx_grass == NULL | element.map_grass == NULL)
85
+        return;
86
+    lz77UnCompVram(element.gfx_grass, (void *)0x06004000);
87
+    lz77UnCompVram(element.map_grass, (void *)0x0600E000);
88
+}

+ 6
- 6
src/include/config.h View File

@@ -5,11 +5,6 @@
5 5
 #define OBJ_1_TEMP              0x0203FFFE
6 6
 #define OBJ_2_TEMP              0x0203FFFF
7 7
 
8
-
9
-/*Variables regarding battle background loading*/
10
-#define NORMAL_VAR              0x4000
11
-#define SEA_VAR                 0x4001
12
-
13 8
 /*Variables and Tags regarding mugshots*/
14 9
 #define MUGHSOT_1_TABLE         0x5000
15 10
 #define MUGSHOT_1_X             0x5001
@@ -40,7 +35,12 @@
40 35
 #define HEALING_BANK_MAP_VAR    0x500E
41 36
 #define HEALING_X_VAR           0x500F
42 37
 #define HEALING_Y_VAR           0x5010
43
-#define TEXT_ANIMATION_VAR      0x8000
38
+
39
+/*Variables regarding battle background loading*/
40
+#define BATTLE_NORMAL_VAR       0x5011
41
+#define BATTLE_SEA_VAR          0x5012
42
+
43
+#define TEXT_ANIMATION_VAR      0x5013
44 44
 
45 45
 /*Variables to control the music overrides*/
46 46
 #define VAR_FROM_1              0x51FA

+ 0
- 2
src/test/test.s View File

@@ -2,8 +2,6 @@
2 2
 .text
3 3
 .thumb
4 4
 
5
-#define LAN_DE
6
-
7 5
 .align 2
8 6
 .global test_some_test
9 7
 test_some_test: