Browse Source

Merge branch 'test'

SBird1337 7 years ago
parent
commit
4a2785391a

+ 90
- 0
.clang-format View File

1
+---
2
+Language:        Cpp
3
+# BasedOnStyle:  LLVM
4
+AccessModifierOffset: -2
5
+AlignAfterOpenBracket: Align
6
+AlignConsecutiveAssignments: false
7
+AlignConsecutiveDeclarations: false
8
+AlignEscapedNewlinesLeft: false
9
+AlignOperands:   true
10
+AlignTrailingComments: true
11
+AllowAllParametersOfDeclarationOnNextLine: true
12
+AllowShortBlocksOnASingleLine: false
13
+AllowShortCaseLabelsOnASingleLine: false
14
+AllowShortFunctionsOnASingleLine: All
15
+AllowShortIfStatementsOnASingleLine: false
16
+AllowShortLoopsOnASingleLine: false
17
+AlwaysBreakAfterDefinitionReturnType: None
18
+AlwaysBreakAfterReturnType: None
19
+AlwaysBreakBeforeMultilineStrings: false
20
+AlwaysBreakTemplateDeclarations: false
21
+BinPackArguments: true
22
+BinPackParameters: true
23
+BraceWrapping:   
24
+  AfterClass:      false
25
+  AfterControlStatement: false
26
+  AfterEnum:       false
27
+  AfterFunction:   false
28
+  AfterNamespace:  false
29
+  AfterObjCDeclaration: false
30
+  AfterStruct:     false
31
+  AfterUnion:      false
32
+  BeforeCatch:     false
33
+  BeforeElse:      false
34
+  IndentBraces:    false
35
+BreakBeforeBinaryOperators: None
36
+BreakBeforeBraces: Attach
37
+BreakBeforeTernaryOperators: true
38
+BreakConstructorInitializersBeforeComma: false
39
+ColumnLimit:     120
40
+CommentPragmas:  '^ IWYU pragma:'
41
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
42
+ConstructorInitializerIndentWidth: 4
43
+ContinuationIndentWidth: 4
44
+Cpp11BracedListStyle: true
45
+DerivePointerAlignment: false
46
+DisableFormat:   false
47
+ExperimentalAutoDetectBinPacking: false
48
+ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
49
+IncludeCategories: 
50
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
51
+    Priority:        2
52
+  - Regex:           '^(<|"(gtest|isl|json)/)'
53
+    Priority:        3
54
+  - Regex:           '.*'
55
+    Priority:        1
56
+IndentCaseLabels: false
57
+IndentWidth:     4
58
+IndentWrappedFunctionNames: false
59
+KeepEmptyLinesAtTheStartOfBlocks: true
60
+MacroBlockBegin: ''
61
+MacroBlockEnd:   ''
62
+MaxEmptyLinesToKeep: 1
63
+NamespaceIndentation: None
64
+ObjCBlockIndentWidth: 2
65
+ObjCSpaceAfterProperty: false
66
+ObjCSpaceBeforeProtocolList: true
67
+PenaltyBreakBeforeFirstCallParameter: 19
68
+PenaltyBreakComment: 300
69
+PenaltyBreakFirstLessLess: 120
70
+PenaltyBreakString: 1000
71
+PenaltyExcessCharacter: 1000000
72
+PenaltyReturnTypeOnItsOwnLine: 60
73
+PointerAlignment: Right
74
+ReflowComments:  true
75
+SortIncludes:    true
76
+SpaceAfterCStyleCast: false
77
+SpaceBeforeAssignmentOperators: true
78
+SpaceBeforeParens: ControlStatements
79
+SpaceInEmptyParentheses: false
80
+SpacesBeforeTrailingComments: 1
81
+SpacesInAngles:  false
82
+SpacesInContainerLiterals: true
83
+SpacesInCStyleCastParentheses: false
84
+SpacesInParentheses: false
85
+SpacesInSquareBrackets: false
86
+Standard:        Cpp11
87
+TabWidth:        8
88
+UseTab:          Never
89
+...
90
+

+ 3
- 0
.gitmodules View File

1
 [submodule "sots-private"]
1
 [submodule "sots-private"]
2
 	path = sots-private
2
 	path = sots-private
3
 	url = ssh://sotshost:/home/sots/sots-private.git
3
 	url = ssh://sotshost:/home/sots/sots-private.git
4
+[submodule "battle_engine"]
5
+	path = battle_engine
6
+	url = https://github.com/EternalCode/battle_engine

+ 10
- 4
.vscode/launch.json View File

2
     "version": "0.2.0",
2
     "version": "0.2.0",
3
     "configurations": [
3
     "configurations": [
4
         {
4
         {
5
-            "name": "Debug",
6
             "type": "gdb",
5
             "type": "gdb",
7
-            "request": "launch",
8
-            "target": "./bin/executable",
9
-            "cwd": "${workspaceRoot}"
6
+            "request": "attach",
7
+            "name": "Debug",
8
+            "preLaunchTask": "start",
9
+            "executable": "object/linked.o",
10
+            "gdbpath": "arm-none-eabi-gdb",
11
+            "target": "localhost:2345",
12
+            "remote": true,
13
+            "cwd": "${workspaceRoot}",
14
+            "autorun": [
15
+            ]
10
         }
16
         }
11
     ]
17
     ]
12
 }
18
 }

+ 154
- 1
.vscode/settings.json View File

2
     "files.associations": {
2
     "files.associations": {
3
         "filesystem": "cpp",
3
         "filesystem": "cpp",
4
         "regex": "cpp",
4
         "regex": "cpp",
5
-        "xlocmon": "cpp"
5
+        "xlocmon": "cpp",
6
+        "functional": "cpp",
7
+        "chrono": "cpp",
8
+        "future": "cpp",
9
+        "random": "cpp",
10
+        "ratio": "cpp",
11
+        "scoped_allocator": "cpp",
12
+        "tuple": "cpp",
13
+        "type_traits": "cpp",
14
+        "utility": "cpp",
15
+        "xmemory0": "cpp",
16
+        "xstddef": "cpp",
17
+        "xtr1common": "cpp",
18
+        "xutility": "cpp",
19
+        "ios": "cpp",
20
+        "iosfwd": "cpp",
21
+        "sstream": "cpp",
22
+        "strstream": "cpp",
23
+        "system_error": "cpp",
24
+        "typeindex": "cpp",
25
+        "xlocale": "cpp",
26
+        "array": "cpp",
27
+        "bitset": "cpp",
28
+        "deque": "cpp",
29
+        "forward_list": "cpp",
30
+        "initializer_list": "cpp",
31
+        "iterator": "cpp",
32
+        "list": "cpp",
33
+        "map": "cpp",
34
+        "queue": "cpp",
35
+        "set": "cpp",
36
+        "stack": "cpp",
37
+        "unordered_map": "cpp",
38
+        "unordered_set": "cpp",
39
+        "vector": "cpp",
40
+        "xhash": "cpp",
41
+        "xstring": "cpp",
42
+        "xtree": "cpp",
43
+        "xiosbase": "cpp",
44
+        "xfunctional": "cpp",
45
+        "streambuf": "cpp",
46
+        "xlocmes": "cpp",
47
+        "memory": "cpp",
48
+        "xlocbuf": "cpp",
49
+        "atomic": "cpp",
50
+        "valarray": "cpp",
51
+        "locale": "cpp",
52
+        "thread": "cpp",
53
+        "xlocnum": "cpp",
54
+        "xloctime": "cpp",
55
+        "corecrt_io.h": "c",
56
+        "corecrt_wio.h": "c",
57
+        "ocidl.h": "c",
58
+        "wingdi.h": "c",
59
+        "m4a.h": "c",
60
+        "background.h": "c",
61
+        "sprites.h": "c",
62
+        "berry.h": "c",
63
+        "fieldmap.h": "c",
64
+        "flash_internal.h": "c",
65
+        "m4a_internal.h": "c",
66
+        "types.h": "c",
67
+        "sprite.h": "c",
68
+        "lcd.h": "c",
69
+        "objects.h": "c",
70
+        "map.h": "c",
71
+        "dns_core.h": "c",
72
+        "task.h": "c",
73
+        "xkeycheck.h": "c",
74
+        "pkmn_bank.h": "c",
75
+        "bios.h": "c",
76
+        "gba_video.h": "c",
77
+        "compression.h": "c",
78
+        "switch_bg.h": "c",
79
+        "flags.h": "c",
80
+        "battle_structs.h": "c",
81
+        "palette.h": "c",
82
+        "string.h": "c",
83
+        "callback.h": "c",
84
+        "gba_types.h": "c",
85
+        "text.h": "c",
86
+        "base.h": "c",
87
+        "oam_types.h": "c",
88
+        "debug.h": "c",
89
+        "common.h": "c",
90
+        "ole.h": "c",
91
+        "oleidl.h": "c",
92
+        "battle_state.h": "c",
93
+        "crtdbg.h": "c",
94
+        "useful-bped.h": "c",
95
+        "pokeagb.h": "c",
96
+        "graphics.h": "c",
97
+        "version.h": "c",
98
+        "core.h": "c",
99
+        "pokemon.h": "c",
100
+        "save.h": "c",
101
+        "battle.h": "c",
102
+        "overworld.h": "c",
103
+        "audio.h": "c",
104
+        "memory.h": "c",
105
+        "io.h": "c",
106
+        "battle_pick_message.h": "c",
107
+        "battle_abilities.h": "c",
108
+        "moves.h": "c",
109
+        "pkmn_bank_stats.h": "c",
110
+        "constants.h": "c",
111
+        "math.h": "c",
112
+        "objidl.h": "c",
113
+        "objidlbase.h": "c",
114
+        "winuser.h": "c",
115
+        "winnt.h": "c",
116
+        "internal.h": "c",
117
+        "item.h": "c",
118
+        "evolution.h": "c",
119
+        "move.h": "c",
120
+        "game_engine.h": "c",
121
+        "agile.h": "c",
122
+        "xtgmath.h": "c",
123
+        "stdbool.h": "c",
124
+        "stdint.h": "c",
125
+        "grass_bg.h": "c",
126
+        "fade.h": "c",
127
+        "block.h": "c",
128
+        "gba_keys.h": "c",
129
+        "data.h": "c",
130
+        "ability.h": "c",
131
+        "battle_common.h": "c",
132
+        "nb30.h": "c",
133
+        "trainer.h": "c",
134
+        "decoration.h": "c",
135
+        "link.h": "c",
136
+        "vcruntime_typeinfo.h": "c",
137
+        "msxml.h": "c",
138
+        "wmp.h": "c",
139
+        "minwindef.h": "c",
140
+        "corecrt.h": "c",
141
+        "vcruntime.h": "c",
142
+        "virtual_map.h": "c",
143
+        "wincrypt.h": "c",
144
+        "gba_compress.h": "c",
145
+        "windef.h": "c",
146
+        "wtypes.h": "c",
147
+        "effects.h": "c",
148
+        "npc.h": "c",
149
+        "global.h": "c",
150
+        "save_one.h": "c",
151
+        "type.h": "c",
152
+        "pkmn_types.h": "c",
153
+        "type_icons.h": "c",
154
+        "ppltasks.h": "c",
155
+        "stat.h": "c",
156
+        "pokedex.h": "c",
157
+        "config.h": "c",
158
+        "agb_debug.h": "c"
6
     }
159
     }
7
 }
160
 }

+ 17
- 10
.vscode/tasks.json View File

1
 {
1
 {
2
-    "version": "0.1.0",
3
-    "command": "make",
4
-    "isShellCommand": true,
5
-    "args": [],
6
-    "showOutput": "always",
7
-    "echoCommand": true,
2
+    "version": "2.0.0",
3
+    "command": "C:/cygwin64/bin/bash",
4
+    "args": ["-lc", "make"],
8
     "suppressTaskName": true,
5
     "suppressTaskName": true,
9
     "tasks": [
6
     "tasks": [
10
         {
7
         {
11
-            "isBuildCommand": true,
8
+            "type": "shell",
9
+            "group": "build",
12
             "taskName": "build",
10
             "taskName": "build",
13
-            "args": ["-j4", "all"]
11
+            "args": [],
12
+            "problemMatcher": [],
13
+            "presentation": {
14
+                "reveal": "always",
15
+                "echo": true
16
+            }
14
         },
17
         },
15
         {
18
         {
16
-            "taskName": "clean",
17
-            "args": ["clean"]
19
+            "type": "shell",
20
+            "group": "none",
21
+            "taskName": "start",
22
+            "command": "~/sots/source_of_the_sovereign/debug.sh",
23
+            "args":[],
24
+            "problemMatcher": []
18
         }
25
         }
19
     ]
26
     ]
20
 }
27
 }

+ 8
- 2
bpre.sym View File

81
 dp_01_prepare_buffer = 0x0800D8B1;
81
 dp_01_prepare_buffer = 0x0800D8B1;
82
 wram_decompress = 0x081E3B70|1;
82
 wram_decompress = 0x081E3B70|1;
83
 battle_script_push = 0x08017544|1;
83
 battle_script_push = 0x08017544|1;
84
+objects = 0x0202063C;
84
 
85
 
85
 fade_screen = 0x08070589;
86
 fade_screen = 0x08070589;
86
 fade_update = 0x080704D1;
87
 fade_update = 0x080704D1;
199
 
200
 
200
 current_oe_state = 0x020386E0;
201
 current_oe_state = 0x020386E0;
201
 
202
 
202
-__aeabi_idiv = 0x081E4018|1;
203
+/*__aeabi_idiv = 0x081E4018|1;
203
 __aeabi_idivmod = 0x081E40F4|1;
204
 __aeabi_idivmod = 0x081E40F4|1;
204
 __aeabi_uidiv = 0x081E460C|1;
205
 __aeabi_uidiv = 0x081E460C|1;
205
-__aeabi_uidivmod = 0x081E4684|1;
206
+__aeabi_uidivmod = 0x081E4684|1;*/
207
+
208
+__aeabi_idiv = 0x081E3B68|1;
209
+__aeabi_idivmod = 0x081E3B68|1;
210
+__aeabi_uidiv = 0x081E3B68|1;
211
+__aeabi_uidivmod = 0x081E3B68|1;

+ 9
- 9
data/overworld/overworld_frames.S View File

15143
 
15143
 
15144
 .align 2
15144
 .align 2
15145
 ow_frames_540:
15145
 ow_frames_540:
15146
-.word ow_0539Tiles+(0*0x800)
15146
+.word ow_00000Tiles+(0*0x800)
15147
 .hword 0x800
15147
 .hword 0x800
15148
 .hword 0x0
15148
 .hword 0x0
15149
-.word ow_0539Tiles+(1*0x800)
15149
+.word ow_00000Tiles+(1*0x800)
15150
 .hword 0x800
15150
 .hword 0x800
15151
 .hword 0x0
15151
 .hword 0x0
15152
-.word ow_0539Tiles+(2*0x800)
15152
+.word ow_00000Tiles+(2*0x800)
15153
 .hword 0x800
15153
 .hword 0x800
15154
 .hword 0x0
15154
 .hword 0x0
15155
-.word ow_0539Tiles+(0*0x800)
15155
+.word ow_00000Tiles+(0*0x800)
15156
 .hword 0x800
15156
 .hword 0x800
15157
 .hword 0x0
15157
 .hword 0x0
15158
-.word ow_0539Tiles+(0*0x800)
15158
+.word ow_00000Tiles+(0*0x800)
15159
 .hword 0x800
15159
 .hword 0x800
15160
 .hword 0x0
15160
 .hword 0x0
15161
-.word ow_0539Tiles+(0*0x800)
15161
+.word ow_00000Tiles+(0*0x800)
15162
 .hword 0x800
15162
 .hword 0x800
15163
 .hword 0x0
15163
 .hword 0x0
15164
-.word ow_0539Tiles+(0*0x800)
15164
+.word ow_00000Tiles+(0*0x800)
15165
 .hword 0x800
15165
 .hword 0x800
15166
 .hword 0x0
15166
 .hword 0x0
15167
-.word ow_0539Tiles+(0*0x800)
15167
+.word ow_00000Tiles+(0*0x800)
15168
 .hword 0x800
15168
 .hword 0x800
15169
 .hword 0x0
15169
 .hword 0x0
15170
-.word ow_0539Tiles+(0*0x800)
15170
+.word ow_00000Tiles+(0*0x800)
15171
 .hword 0x800
15171
 .hword 0x800
15172
 .hword 0x0
15172
 .hword 0x0
15173
 
15173
 

+ 2
- 2
data/pkmn_tables/pokemon_back_sprites.S View File

1
 .text
1
 .text
2
 .align 2
2
 .align 2
3
-.global pokemon_back_sprites
4
-pokemon_back_sprites:
3
+.global pokemon_graphics_back
4
+pokemon_graphics_back:
5
 
5
 
6
 .word back_0000Tiles, 0
6
 .word back_0000Tiles, 0
7
 .word back_0001Tiles, 1
7
 .word back_0001Tiles, 1

+ 2
- 2
data/pkmn_tables/pokemon_front_sprites.S View File

1
 .text
1
 .text
2
 .align 2
2
 .align 2
3
-.global pokemon_front_sprites
4
-pokemon_front_sprites:
3
+.global pokemon_graphics_front
4
+pokemon_graphics_front:
5
 
5
 
6
 .word front_0000Tiles, 0
6
 .word front_0000Tiles, 0
7
 .word front_0001Tiles, 1
7
 .word front_0001Tiles, 1

+ 2
- 2
data/pkmn_tables/pokemon_normal_pal.S View File

1
 .text
1
 .text
2
 .align 2
2
 .align 2
3
-.global pokemon_normal_pal
4
-pokemon_normal_pal:
3
+.global pokemon_palette_normal
4
+pokemon_palette_normal:
5
 
5
 
6
 .word n_p_0000Pal, 0x0
6
 .word n_p_0000Pal, 0x0
7
 .word n_p_0001Pal, 0x0
7
 .word n_p_0001Pal, 0x0

+ 2
- 2
data/pkmn_tables/pokemon_player_y_table.s View File

2
 .thumb
2
 .thumb
3
 .text
3
 .text
4
 
4
 
5
-.global pokemon_player_y_table
6
-pokemon_player_y_table:
5
+.global pokemon_player_xy_table
6
+pokemon_player_xy_table:
7
 .incbin "data/pkmn_tables/pkmn_player_y_table_dump.bin"
7
 .incbin "data/pkmn_tables/pkmn_player_y_table_dump.bin"

+ 2
- 2
data/pkmn_tables/pokemon_shiny_pal.S View File

1
 .text
1
 .text
2
 .align 2
2
 .align 2
3
-.global pokemon_shiny_pal
4
-pokemon_shiny_pal:
3
+.global pokemon_palette_shiny
4
+pokemon_palette_shiny:
5
 
5
 
6
 .word s_p_0000Pal, 0x0
6
 .word s_p_0000Pal, 0x0
7
 .word s_p_0001Pal, 0x0
7
 .word s_p_0001Pal, 0x0

+ 2
- 2
data/pkmn_tables/pokemon_stats.S View File

1
 .text
1
 .text
2
 .align 2
2
 .align 2
3
-.global pokemon_stats
4
-pokemon_stats:
3
+.global pokemon_base_stats
4
+pokemon_base_stats:
5
 
5
 
6
 .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
6
 .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
7
 .hword 0, 0
7
 .hword 0, 0

+ 2
- 2
data/raw_defines.s View File

2
 .thumb
2
 .thumb
3
 .text
3
 .text
4
 
4
 
5
-.global objects
5
+/*.global objects
6
 objects:
6
 objects:
7
-    .word 0x0202063C
7
+    .word 0x0202063C*/
8
 
8
 
9
 .global evolutions
9
 .global evolutions
10
 evolutions:
10
 evolutions:

+ 7
- 0
debug.sh View File

1
+EMULATOR=E:/OneDrive/Hacking/Romhacking/Emulator/mGBA-0.5.2-2016-12-31-win32/mgba.exe
2
+
3
+# Start mGBA in the background
4
+pwd
5
+cygstart $EMULATOR -g sots/source_of_the_sovereign/build/pkmn_sots.gba
6
+sleep 4
7
+exit

+ 9
- 8
main.asm View File

5
 //exclude for now
5
 //exclude for now
6
 //.include "patches/split_physical_special.asm"
6
 //.include "patches/split_physical_special.asm"
7
 .include "patches/hooks.asm"
7
 .include "patches/hooks.asm"
8
-.include "patches/dynamic_overworld_hooks.asm"
8
+
9
+
10
+//no dynamic overworlds, sorry :T
11
+//.include "patches/dynamic_overworld_hooks.asm"
12
+
13
+
9
 .include "patches/special.asm"
14
 .include "patches/special.asm"
10
 .include "patches/moves.asm"
15
 .include "patches/moves.asm"
11
 .include "patches/music.asm"
16
 .include "patches/music.asm"
37
 .include "patches/pokemon_data/pokemon_habitats.asm"
42
 .include "patches/pokemon_data/pokemon_habitats.asm"
38
 .include "patches/pokemon_data/pokemon_evolution.asm"
43
 .include "patches/pokemon_data/pokemon_evolution.asm"
39
 
44
 
40
-//.include "patches/overworlds/pkm_wild.asm"
45
+.include "patches/overworlds/pkm_wild.asm"
41
 //.include "patches/dns/core.asm"
46
 //.include "patches/dns/core.asm"
42
 
47
 
43
 .include "patches/overworlds/overworld.asm"
48
 .include "patches/overworlds/overworld.asm"
54
 
59
 
55
 .include "patches/game_engine/quick_hacks.asm"
60
 .include "patches/game_engine/quick_hacks.asm"
56
 
61
 
62
+//.include "battle_engine/patches/battle_hooks.s"
63
+
57
 .org 0x0815F9B8
64
 .org 0x0815F9B8
58
     .word 0x08069ED5 // fix nop1 for now...
65
     .word 0x08069ED5 // fix nop1 for now...
59
 
66
 
60
-.org 0x083522F4
61
-    .word mapheader_alabastia
62
-
63
-.org 0x0834ECC0
64
-    .word mapfooter_alabastia
65
-
66
 .org 0x09000000
67
 .org 0x09000000
67
 .importobj "object/linked.o"
68
 .importobj "object/linked.o"
68
 .close
69
 .close

+ 11
- 3
makefile View File

12
 
12
 
13
 export PATH := $(realpath ../tools):$(PATH)
13
 export PATH := $(realpath ../tools):$(PATH)
14
 
14
 
15
+PAGB_MAIN := battle_engine/deps/pokeagb
16
+PAGB_INCLUDE := $(PAGB_MAIN)/build/include/
17
+PAGB_LINK := $(PAGB_MAIN)/build/linker/BPRE.ld
18
+
15
 DEFINES   := -DBPRE -DSOFTWARE_VERSION=0
19
 DEFINES   := -DBPRE -DSOFTWARE_VERSION=0
16
 ASFLAGS   := -mthumb
20
 ASFLAGS   := -mthumb
17
-CFLAGS    := -mthumb -mthumb-interwork -g -mcpu=arm7tdmi -fno-inline -mlong-calls -march=armv4t -O0 -std=c99 -Wall -Wextra -Wunreachable-code -Isrc/include $(DEFINES)
21
+CFLAGS    := -mthumb -mthumb-interwork -g -mcpu=arm7tdmi -fno-inline -mlong-calls -march=armv4t -Og -std=c11 -Wall -Wextra -Wunreachable-code -I$(PAGB_INCLUDE) -Isrc/include -fdiagnostics-color $(DEFINES)
18
 GRITFLAGS := -ftc -fa
22
 GRITFLAGS := -ftc -fa
19
 LDFLAGS   := -z muldefs
23
 LDFLAGS   := -z muldefs
20
 BLDPATH   := object
24
 BLDPATH   := object
23
 STRINGDIR := string
27
 STRINGDIR := string
24
 
28
 
25
 MAIN_OBJ  := $(BLDPATH)/linked.o
29
 MAIN_OBJ  := $(BLDPATH)/linked.o
30
+B_ENGINE  := battle_engine/build/linked.o
26
 SPRITES   := $(BLDPATH)/pkmn_sprites.o
31
 SPRITES   := $(BLDPATH)/pkmn_sprites.o
27
 ICONS_AR  := $(BLDPATH)/pkmn_icons.a
32
 ICONS_AR  := $(BLDPATH)/pkmn_icons.a
28
 DYN_OVER  := built/dynamic_overworld.o
33
 DYN_OVER  := built/dynamic_overworld.o
78
 		sed -e '{s/^/0x/g};{/.*\sA\s.*/d};{s/\sT\s/ /g}' > $(OUTPATH)/__symbols.sym
83
 		sed -e '{s/^/0x/g};{/.*\sA\s.*/d};{s/\sT\s/ /g}' > $(OUTPATH)/__symbols.sym
79
 	@echo "*** SUCCESSFULLY BUILT PROJECT ***"
84
 	@echo "*** SUCCESSFULLY BUILT PROJECT ***"
80
 	
85
 	
81
-$(MAIN_OBJ): $(ALL_OBJ) $(ICONS_AR) $(SPRITES) $(MUSIC_AR) $(SMPL_AR) $(VOICE_AR) $(LIST_AR) $(CRY_AR) $(STRING_OBJ) $(DYN_OVER)
86
+$(MAIN_OBJ): $(ALL_OBJ) $(ICONS_AR) $(SPRITES) $(MUSIC_AR) $(SMPL_AR) $(VOICE_AR) $(LIST_AR) $(CRY_AR) $(STRING_OBJ)#$(B_ENGINE)
82
 	$(MAKE) -f assets.makefile
87
 	$(MAKE) -f assets.makefile
83
 	$(LD) $(LDFLAGS) -T linker.ld -T bpre.sym --whole-archive -r -o $@ --start-group $^ --end-group
88
 	$(LD) $(LDFLAGS) -T linker.ld -T bpre.sym --whole-archive -r -o $@ --start-group $^ --end-group
84
-	$(LD) $(LDFLAGS) -T linker.ld -T bpre.sym -o object/debug.o object/linked.o
89
+
90
+.PHONY: $(B_ENGINE)
91
+$(B_ENGINE):
92
+	$(MAKE) -C battle_engine build/linked.o
85
 
93
 
86
 .PHONY: clean
94
 .PHONY: clean
87
 clean:
95
 clean:

+ 8
- 8
patches/pokemon_data/player_y_table.asm View File

1
 .org 0x08074634
1
 .org 0x08074634
2
-.word pokemon_player_y_table
2
+.word pokemon_player_xy_table
3
 
3
 
4
 .org 0x08074664
4
 .org 0x08074664
5
-.word pokemon_player_y_table
5
+.word pokemon_player_xy_table
6
 
6
 
7
 .org 0x08074670
7
 .org 0x08074670
8
-.word pokemon_player_y_table
8
+.word pokemon_player_xy_table
9
 
9
 
10
 .org 0x08076564
10
 .org 0x08076564
11
-.word pokemon_player_y_table
11
+.word pokemon_player_xy_table
12
 
12
 
13
 .org 0x08076B1C
13
 .org 0x08076B1C
14
-.word pokemon_player_y_table
14
+.word pokemon_player_xy_table
15
 
15
 
16
 .org 0x08076BE8
16
 .org 0x08076BE8
17
-.word pokemon_player_y_table
17
+.word pokemon_player_xy_table
18
 
18
 
19
 .org 0x08076BF8
19
 .org 0x08076BF8
20
-.word pokemon_player_y_table
20
+.word pokemon_player_xy_table
21
 
21
 
22
 .org 0x08076C04
22
 .org 0x08076C04
23
-.word pokemon_player_y_table
23
+.word pokemon_player_xy_table
24
 
24
 

+ 10
- 10
patches/pokemon_data/pokemon_back_sprites.asm View File

1
 .org 0x0800012C
1
 .org 0x0800012C
2
-.word pokemon_back_sprites
2
+.word pokemon_graphics_back
3
 
3
 
4
 .org 0x0800ED58
4
 .org 0x0800ED58
5
-.word pokemon_back_sprites
5
+.word pokemon_graphics_back
6
 
6
 
7
 .org 0x0800F19C
7
 .org 0x0800F19C
8
-.word pokemon_back_sprites
8
+.word pokemon_graphics_back
9
 
9
 
10
 .org 0x08034540
10
 .org 0x08034540
11
-.word pokemon_back_sprites
11
+.word pokemon_graphics_back
12
 
12
 
13
 .org 0x08034584
13
 .org 0x08034584
14
-.word pokemon_back_sprites
14
+.word pokemon_graphics_back
15
 
15
 
16
 .org 0x08034F04
16
 .org 0x08034F04
17
-.word pokemon_back_sprites
17
+.word pokemon_graphics_back
18
 
18
 
19
 .org 0x08076A58
19
 .org 0x08076A58
20
-.word pokemon_back_sprites
20
+.word pokemon_graphics_back
21
 
21
 
22
 .org 0x08076AC8
22
 .org 0x08076AC8
23
-.word pokemon_back_sprites
23
+.word pokemon_graphics_back
24
 
24
 
25
 .org 0x0810BC0C
25
 .org 0x0810BC0C
26
-.word pokemon_back_sprites
26
+.word pokemon_graphics_back
27
 
27
 
28
 .org 0x0810BC24
28
 .org 0x0810BC24
29
-.word pokemon_back_sprites
29
+.word pokemon_graphics_back
30
 
30
 

+ 28
- 28
patches/pokemon_data/pokemon_front_sprites.asm View File

1
 .org 0x08000128
1
 .org 0x08000128
2
-.word pokemon_front_sprites
2
+.word pokemon_graphics_front
3
 
3
 
4
 .org 0x0800ECA8
4
 .org 0x0800ECA8
5
-.word pokemon_front_sprites
5
+.word pokemon_graphics_front
6
 
6
 
7
 .org 0x0800ECEC
7
 .org 0x0800ECEC
8
-.word pokemon_front_sprites
8
+.word pokemon_graphics_front
9
 
9
 
10
 .org 0x0800ED68
10
 .org 0x0800ED68
11
-.word pokemon_front_sprites
11
+.word pokemon_graphics_front
12
 
12
 
13
 .org 0x0800ED80
13
 .org 0x0800ED80
14
-.word pokemon_front_sprites
14
+.word pokemon_graphics_front
15
 
15
 
16
 .org 0x0800F0F8
16
 .org 0x0800F0F8
17
-.word pokemon_front_sprites
17
+.word pokemon_graphics_front
18
 
18
 
19
 .org 0x0800F130
19
 .org 0x0800F130
20
-.word pokemon_front_sprites
20
+.word pokemon_graphics_front
21
 
21
 
22
 .org 0x0800F1AC
22
 .org 0x0800F1AC
23
-.word pokemon_front_sprites
23
+.word pokemon_graphics_front
24
 
24
 
25
 .org 0x0800F1C4
25
 .org 0x0800F1C4
26
-.word pokemon_front_sprites
26
+.word pokemon_graphics_front
27
 
27
 
28
 .org 0x080343C4
28
 .org 0x080343C4
29
-.word pokemon_front_sprites
29
+.word pokemon_graphics_front
30
 
30
 
31
 .org 0x08034D60
31
 .org 0x08034D60
32
-.word pokemon_front_sprites
32
+.word pokemon_graphics_front
33
 
33
 
34
 .org 0x0803507C
34
 .org 0x0803507C
35
-.word pokemon_front_sprites
35
+.word pokemon_graphics_front
36
 
36
 
37
 .org 0x08046F64
37
 .org 0x08046F64
38
-.word pokemon_front_sprites
38
+.word pokemon_graphics_front
39
 
39
 
40
 .org 0x08050074
40
 .org 0x08050074
41
-.word pokemon_front_sprites
41
+.word pokemon_graphics_front
42
 
42
 
43
 .org 0x080500BC
43
 .org 0x080500BC
44
-.word pokemon_front_sprites
44
+.word pokemon_graphics_front
45
 
45
 
46
 .org 0x08052068
46
 .org 0x08052068
47
-.word pokemon_front_sprites
47
+.word pokemon_graphics_front
48
 
48
 
49
 .org 0x080534C4
49
 .org 0x080534C4
50
-.word pokemon_front_sprites
50
+.word pokemon_graphics_front
51
 
51
 
52
 .org 0x080769C0
52
 .org 0x080769C0
53
-.word pokemon_front_sprites
53
+.word pokemon_graphics_front
54
 
54
 
55
 .org 0x080769E4
55
 .org 0x080769E4
56
-.word pokemon_front_sprites
56
+.word pokemon_graphics_front
57
 
57
 
58
 .org 0x0808F470
58
 .org 0x0808F470
59
-.word pokemon_front_sprites
59
+.word pokemon_graphics_front
60
 
60
 
61
 .org 0x080CE0B8
61
 .org 0x080CE0B8
62
-.word pokemon_front_sprites
62
+.word pokemon_graphics_front
63
 
63
 
64
 .org 0x080CE2B8
64
 .org 0x080CE2B8
65
-.word pokemon_front_sprites
65
+.word pokemon_graphics_front
66
 
66
 
67
 .org 0x080CE454
67
 .org 0x080CE454
68
-.word pokemon_front_sprites
68
+.word pokemon_graphics_front
69
 
69
 
70
 .org 0x080CE6C4
70
 .org 0x080CE6C4
71
-.word pokemon_front_sprites
71
+.word pokemon_graphics_front
72
 
72
 
73
 .org 0x0810BBE4
73
 .org 0x0810BBE4
74
-.word pokemon_front_sprites
74
+.word pokemon_graphics_front
75
 
75
 
76
 .org 0x0810BBF0
76
 .org 0x0810BBF0
77
-.word pokemon_front_sprites
77
+.word pokemon_graphics_front
78
 
78
 
79
 .org 0x0811D900
79
 .org 0x0811D900
80
-.word pokemon_front_sprites
80
+.word pokemon_graphics_front
81
 
81
 
82
 .org 0x0814AED8
82
 .org 0x0814AED8
83
-.word pokemon_front_sprites
83
+.word pokemon_graphics_front
84
 
84
 

+ 5
- 5
patches/pokemon_data/pokemon_normal_pal.asm View File

1
 .org 0x08000130
1
 .org 0x08000130
2
-.word pokemon_normal_pal
2
+.word pokemon_palette_normal
3
 
3
 
4
 .org 0x0804410C
4
 .org 0x0804410C
5
-.word pokemon_normal_pal
5
+.word pokemon_palette_normal
6
 
6
 
7
 .org 0x08044130
7
 .org 0x08044130
8
-.word pokemon_normal_pal
8
+.word pokemon_palette_normal
9
 
9
 
10
 .org 0x080441A4
10
 .org 0x080441A4
11
-.word pokemon_normal_pal
11
+.word pokemon_palette_normal
12
 
12
 
13
 .org 0x080839C0
13
 .org 0x080839C0
14
-.word pokemon_normal_pal
14
+.word pokemon_palette_normal
15
 
15
 

+ 3
- 3
patches/pokemon_data/pokemon_shiny_pal.asm View File

1
 .org 0x08000134
1
 .org 0x08000134
2
-.word pokemon_shiny_pal
2
+.word pokemon_palette_shiny
3
 
3
 
4
 .org 0x08044144
4
 .org 0x08044144
5
-.word pokemon_shiny_pal
5
+.word pokemon_palette_shiny
6
 
6
 
7
 .org 0x080441B4
7
 .org 0x080441B4
8
-.word pokemon_shiny_pal
8
+.word pokemon_palette_shiny
9
 
9
 

+ 58
- 58
patches/pokemon_data/pokemon_stats.asm View File

1
 .org 0x080001BC
1
 .org 0x080001BC
2
-.word pokemon_stats
2
+.word pokemon_base_stats
3
 
3
 
4
 .org 0x08012754
4
 .org 0x08012754
5
-.word pokemon_stats
5
+.word pokemon_base_stats
6
 
6
 
7
 .org 0x08012FA8
7
 .org 0x08012FA8
8
-.word pokemon_stats
8
+.word pokemon_base_stats
9
 
9
 
10
 .org 0x08013230
10
 .org 0x08013230
11
-.word pokemon_stats
11
+.word pokemon_base_stats
12
 
12
 
13
 .org 0x08016A60
13
 .org 0x08016A60
14
-.word pokemon_stats
14
+.word pokemon_base_stats
15
 
15
 
16
 .org 0x0801F008
16
 .org 0x0801F008
17
-.word pokemon_stats
17
+.word pokemon_base_stats
18
 
18
 
19
 .org 0x08021C28
19
 .org 0x08021C28
20
-.word pokemon_stats
20
+.word pokemon_base_stats
21
 
21
 
22
 .org 0x080240B4
22
 .org 0x080240B4
23
-.word pokemon_stats
23
+.word pokemon_base_stats
24
 
24
 
25
 .org 0x0802BABC
25
 .org 0x0802BABC
26
-.word pokemon_stats
26
+.word pokemon_base_stats
27
 
27
 
28
 .org 0x0802CE90
28
 .org 0x0802CE90
29
-.word pokemon_stats
29
+.word pokemon_base_stats
30
 
30
 
31
 .org 0x0802D53C
31
 .org 0x0802D53C
32
-.word pokemon_stats
32
+.word pokemon_base_stats
33
 
33
 
34
 .org 0x0802FFBC
34
 .org 0x0802FFBC
35
-.word pokemon_stats
35
+.word pokemon_base_stats
36
 
36
 
37
 .org 0x080300E8
37
 .org 0x080300E8
38
-.word pokemon_stats
38
+.word pokemon_base_stats
39
 
39
 
40
 .org 0x080301F8
40
 .org 0x080301F8
41
-.word pokemon_stats
41
+.word pokemon_base_stats
42
 
42
 
43
 .org 0x08039558
43
 .org 0x08039558
44
-.word pokemon_stats
44
+.word pokemon_base_stats
45
 
45
 
46
 .org 0x080399BC
46
 .org 0x080399BC
47
-.word pokemon_stats
47
+.word pokemon_base_stats
48
 
48
 
49
 .org 0x08039A68
49
 .org 0x08039A68
50
-.word pokemon_stats
50
+.word pokemon_base_stats
51
 
51
 
52
 .org 0x08039FE8
52
 .org 0x08039FE8
53
-.word pokemon_stats
53
+.word pokemon_base_stats
54
 
54
 
55
 .org 0x0803DCC4
55
 .org 0x0803DCC4
56
-.word pokemon_stats
56
+.word pokemon_base_stats
57
 
57
 
58
 .org 0x0803DD94
58
 .org 0x0803DD94
59
-.word pokemon_stats
59
+.word pokemon_base_stats
60
 
60
 
61
 .org 0x0803E734
61
 .org 0x0803E734
62
-.word pokemon_stats
62
+.word pokemon_base_stats
63
 
63
 
64
 .org 0x0803E82C
64
 .org 0x0803E82C
65
-.word pokemon_stats
65
+.word pokemon_base_stats
66
 
66
 
67
 .org 0x0803E898
67
 .org 0x0803E898
68
-.word pokemon_stats
68
+.word pokemon_base_stats
69
 
69
 
70
 .org 0x0803F780
70
 .org 0x0803F780
71
-.word pokemon_stats
71
+.word pokemon_base_stats
72
 
72
 
73
 .org 0x0803F7C8
73
 .org 0x0803F7C8
74
-.word pokemon_stats
74
+.word pokemon_base_stats
75
 
75
 
76
 .org 0x08040D58
76
 .org 0x08040D58
77
-.word pokemon_stats
77
+.word pokemon_base_stats
78
 
78
 
79
 .org 0x08040D78
79
 .org 0x08040D78
80
-.word pokemon_stats
80
+.word pokemon_base_stats
81
 
81
 
82
 .org 0x080413B8
82
 .org 0x080413B8
83
-.word pokemon_stats
83
+.word pokemon_base_stats
84
 
84
 
85
 .org 0x080419A0
85
 .org 0x080419A0
86
-.word pokemon_stats
86
+.word pokemon_base_stats
87
 
87
 
88
 .org 0x08043914
88
 .org 0x08043914
89
-.word pokemon_stats
89
+.word pokemon_base_stats
90
 
90
 
91
 .org 0x08043928
91
 .org 0x08043928
92
-.word pokemon_stats
92
+.word pokemon_base_stats
93
 
93
 
94
 .org 0x0804393C
94
 .org 0x0804393C
95
-.word pokemon_stats
95
+.word pokemon_base_stats
96
 
96
 
97
 .org 0x08043950
97
 .org 0x08043950
98
-.word pokemon_stats
98
+.word pokemon_base_stats
99
 
99
 
100
 .org 0x08043964
100
 .org 0x08043964
101
-.word pokemon_stats
101
+.word pokemon_base_stats
102
 
102
 
103
 .org 0x080439A4
103
 .org 0x080439A4
104
-.word pokemon_stats
104
+.word pokemon_base_stats
105
 
105
 
106
 .org 0x08043B8C
106
 .org 0x08043B8C
107
-.word pokemon_stats
107
+.word pokemon_base_stats
108
 
108
 
109
 .org 0x08043C10
109
 .org 0x08043C10
110
-.word pokemon_stats
110
+.word pokemon_base_stats
111
 
111
 
112
 .org 0x08044208
112
 .org 0x08044208
113
-.word pokemon_stats
113
+.word pokemon_base_stats
114
 
114
 
115
 .org 0x08044458
115
 .org 0x08044458
116
-.word pokemon_stats
116
+.word pokemon_base_stats
117
 
117
 
118
 .org 0x08046600
118
 .org 0x08046600
119
-.word pokemon_stats
119
+.word pokemon_base_stats
120
 
120
 
121
 .org 0x08049F4C
121
 .org 0x08049F4C
122
-.word pokemon_stats
122
+.word pokemon_base_stats
123
 
123
 
124
 .org 0x0804FC88
124
 .org 0x0804FC88
125
-.word pokemon_stats
125
+.word pokemon_base_stats
126
 
126
 
127
 .org 0x080C84E0
127
 .org 0x080C84E0
128
-.word pokemon_stats
128
+.word pokemon_base_stats
129
 
129
 
130
 .org 0x080CA850
130
 .org 0x080CA850
131
-.word pokemon_stats
131
+.word pokemon_base_stats
132
 
132
 
133
 .org 0x080E7F14
133
 .org 0x080E7F14
134
-.word pokemon_stats
134
+.word pokemon_base_stats
135
 
135
 
136
 .org 0x080E8040
136
 .org 0x080E8040
137
-.word pokemon_stats
137
+.word pokemon_base_stats
138
 
138
 
139
 .org 0x080E8150
139
 .org 0x080E8150
140
-.word pokemon_stats
140
+.word pokemon_base_stats
141
 
141
 
142
 .org 0x08103AC4
142
 .org 0x08103AC4
143
-.word pokemon_stats
143
+.word pokemon_base_stats
144
 
144
 
145
 .org 0x081066B4
145
 .org 0x081066B4
146
-.word pokemon_stats
146
+.word pokemon_base_stats
147
 
147
 
148
 .org 0x0811AE48
148
 .org 0x0811AE48
149
-.word pokemon_stats
149
+.word pokemon_base_stats
150
 
150
 
151
 .org 0x081361F8
151
 .org 0x081361F8
152
-.word pokemon_stats
152
+.word pokemon_base_stats
153
 
153
 
154
 .org 0x08136794
154
 .org 0x08136794
155
-.word pokemon_stats
155
+.word pokemon_base_stats
156
 
156
 
157
 .org 0x0813AAE0
157
 .org 0x0813AAE0
158
-.word pokemon_stats
158
+.word pokemon_base_stats
159
 
159
 
160
 .org 0x081569EC
160
 .org 0x081569EC
161
-.word pokemon_stats
161
+.word pokemon_base_stats
162
 
162
 
163
 .org 0x08156B18
163
 .org 0x08156B18
164
-.word pokemon_stats
164
+.word pokemon_base_stats
165
 
165
 
166
 .org 0x08156C28
166
 .org 0x08156C28
167
-.word pokemon_stats
167
+.word pokemon_base_stats
168
 
168
 
169
 //EGG HATCHING TIME
169
 //EGG HATCHING TIME
170
 .org 0x08046204
170
 .org 0x08046204
171
-.word pokemon_stats + 0x11
171
+.word pokemon_base_stats + 0x11
172
 
172
 
173
 .org 0x080462A8
173
 .org 0x080462A8
174
-.word pokemon_stats + 0x11
174
+.word pokemon_base_stats + 0x11

+ 2
- 1
src/agb_debug/agb_debug.c View File

70
     }
70
     }
71
     /* This builds the string back to front ... */
71
     /* This builds the string back to front ... */
72
     do {
72
     do {
73
-        u32 digit = __aeabi_uidivmod(value, radix); * (pbuffer++) = (digit < 10 ? '0' + digit : (uppercase ? 'A' : 'a') + digit - 10);
73
+        u32 digit = value % radix;
74
+        * (pbuffer++) = (digit < 10 ? '0' + digit : (uppercase ? 'A' : 'a') + digit - 10);
74
         value /= radix;
75
         value /= radix;
75
     } while (value > 0);
76
     } while (value > 0);
76
     for (i = (pbuffer - buffer); i < zero_pad; i++)
77
     for (i = (pbuffer - buffer); i < zero_pad; i++)

+ 1
- 1
src/battle_engine/battle_initiative.c View File

102
 u8 speed_alt_from_item(u8 bank, u8 item_effect) {
102
 u8 speed_alt_from_item(u8 bank, u8 item_effect) {
103
     switch (item_effect) {
103
     switch (item_effect) {
104
         case ITEM_EFFECT_QUICKCLAW:
104
         case ITEM_EFFECT_QUICKCLAW:
105
-            if (__aeabi_uidivmod(battle_turn_random, 100) > item_get_quality(battle_participants[bank].held_item)) {
105
+            if ((battle_turn_random % 100) > item_get_quality(battle_participants[bank].held_item)) {
106
                 return 1;
106
                 return 1;
107
             }
107
             }
108
             break;
108
             break;

+ 2
- 2
src/battle_engine/battle_m_flee_hook.S View File

15
 cmp r0, #8
15
 cmp r0, #8
16
 bne no_trainer
16
 bne no_trainer
17
 ldr r0, =battle_buffer_b
17
 ldr r0, =battle_buffer_b
18
-ldr r4, =battle_active_side
18
+ldr r4, =battle_active_bank
19
 ldrb r1, [r4]
19
 ldrb r1, [r4]
20
 lsl r1, #9
20
 lsl r1, #9
21
 add r0, #1
21
 add r0, #1
31
 
31
 
32
 @only intercept the flee command though...
32
 @only intercept the flee command though...
33
 ldr r0, =battle_buffer_b
33
 ldr r0, =battle_buffer_b
34
-ldr r4, =battle_active_side
34
+ldr r4, =battle_active_bank
35
 ldrb r1, [r4]
35
 ldrb r1, [r4]
36
 lsl r1, #9
36
 lsl r1, #9
37
 add r0, #1
37
 add r0, #1

+ 2
- 2
src/debug/debug.c View File

367
     u32 len = debug_dec_len(i);
367
     u32 len = debug_dec_len(i);
368
     while (i > 0) {
368
     while (i > 0) {
369
 
369
 
370
-        ref[len - 1] = '0' + (__aeabi_uidivmod(i, 10));
370
+        ref[len - 1] = '0' + (i % 10);
371
         i /= 10;
371
         i /= 10;
372
         len--;
372
         len--;
373
     }
373
     }
377
 
377
 
378
 u32 debug_power(u32 n, u32 power) {
378
 u32 debug_power(u32 n, u32 power) {
379
     u32 out = 1;
379
     u32 out = 1;
380
-    for (int i = 0; i < power; ++i) {
380
+    for (u32 i = 0; i < power; ++i) {
381
         out = out * n;
381
         out = out * n;
382
     }
382
     }
383
     return out;
383
     return out;

+ 3
- 3
src/evolution/evolution_methods.c View File

181
     }
181
     }
182
     u32 pid = pokemon_get_attribute(arguments.poke, ATTR_PID, NULL);
182
     u32 pid = pokemon_get_attribute(arguments.poke, ATTR_PID, NULL);
183
     pid = pid & 0xFFFF;
183
     pid = pid & 0xFFFF;
184
-    u8 mod = __aeabi_uidivmod(pid, 10);
184
+    u8 mod = (pid % 10);
185
     dprintf("A pokemon tries to evolve at random: pid: %d, low: %d, mod: %d\n", pid, pid, mod);
185
     dprintf("A pokemon tries to evolve at random: pid: %d, low: %d, mod: %d\n", pid, pid, mod);
186
     if (mod >= 5)
186
     if (mod >= 5)
187
     {
187
     {
291
         u16 current_species = pokemon_get_attribute(&(pokemon_party_player[i]), ATTR_SPECIES, NULL);
291
         u16 current_species = pokemon_get_attribute(&(pokemon_party_player[i]), ATTR_SPECIES, NULL);
292
         if (current_species == 0)
292
         if (current_species == 0)
293
             continue;
293
             continue;
294
-        u8 type_one = pokemon_stats[current_species].type_one;
295
-        u8 type_two = pokemon_stats[current_species].type_two;
294
+        u8 type_one = pokemon_base_stats[current_species].type_one;
295
+        u8 type_two = pokemon_base_stats[current_species].type_two;
296
         dprintf("Found type: %d/%d\n", type_one, type_two);
296
         dprintf("Found type: %d/%d\n", type_one, type_two);
297
         if (type_one == type_required || type_two == type_required)
297
         if (type_one == type_required || type_two == type_required)
298
         {
298
         {

+ 1
- 4
src/include/assets/interface/arrows.img.h View File

7
 //	+ 24 tiles not compressed
7
 //	+ 24 tiles not compressed
8
 //	Total size: 768 = 768
8
 //	Total size: 768 = 768
9
 //
9
 //
10
-<<<<<<< HEAD
11
-//	Time-stamp: 2017-05-24, 23:53:39
12
-=======
13
->>>>>>> 287c7ea0c11e046fe6fb8f2f68178aeca2fa326b
10
+//	Time-stamp: 2017-05-29, 22:25:28
14
 //	Exported by Cearn's GBA Image Transmogrifier, v0.8.6
11
 //	Exported by Cearn's GBA Image Transmogrifier, v0.8.6
15
 //	( http://www.coranac.com/projects/#grit )
12
 //	( http://www.coranac.com/projects/#grit )
16
 //
13
 //

+ 0
- 8
src/include/math.h View File

39
 
39
 
40
 /* === EXTERN METHODS === */
40
 /* === EXTERN METHODS === */
41
 
41
 
42
-/**
43
- * @brief gets the a mod b
44
- * @param a dividend
45
- * @param b divisor
46
- * @return a % b
47
- */
48
-u32 __aeabi_uidivmod(u32 a, u32 b);
49
-
50
 u16 random();
42
 u16 random();
51
 
43
 
52
 #endif /* MATH_H */
44
 #endif /* MATH_H */

+ 1
- 1
src/include/objects.h View File

84
   u8 field43;
84
   u8 field43;
85
 };
85
 };
86
 
86
 
87
-extern struct obj_entity* objects;
87
+extern struct obj_entity objects[64];
88
 
88
 
89
 typedef void (*object_callback)(struct obj_entity*);
89
 typedef void (*object_callback)(struct obj_entity*);
90
 
90
 

+ 1
- 1
src/include/pokemon.h View File

51
     u16 padding;
51
     u16 padding;
52
 };
52
 };
53
 
53
 
54
-extern struct pokemon_data pokemon_stats[1300];
54
+extern struct pokemon_data pokemon_base_stats[1300];
55
 
55
 
56
 #endif /* POKE_INDICES_H */
56
 #endif /* POKE_INDICES_H */

+ 6
- 0
src/overworld/dynamic_overworld.c View File

1
+#include <pokeagb/pokeagb.h>
2
+
3
+void npc_spawn()
4
+{
5
+    //placeholder for now
6
+}

+ 2
- 1
src/savefile/flag_manipulation.c View File

34
 #include <stdbool.h>
34
 #include <stdbool.h>
35
 #include <game_engine.h>
35
 #include <game_engine.h>
36
 #include <battle_structs.h>
36
 #include <battle_structs.h>
37
+#include <config.h>
37
 
38
 
38
 u16 trainerflag_fix_difficulty(u16 flag_id);
39
 u16 trainerflag_fix_difficulty(u16 flag_id);
39
 
40
 
48
 u16 trainerflag_fix_difficulty(u16 flag_id)
49
 u16 trainerflag_fix_difficulty(u16 flag_id)
49
 {
50
 {
50
     u16 new_flag = ((flag_id - TRAINER_FLAG_SPACE_START + 1) / 3) + TRAINER_FLAG_SPACE_START;
51
     u16 new_flag = ((flag_id - TRAINER_FLAG_SPACE_START + 1) / 3) + TRAINER_FLAG_SPACE_START;
51
-    dprintf("trainerflag_fix_difficulty;; flag_id: 0x%x, reduced: 0x%x\n", flag_id, new_flag);
52
+    dprintf("trainerflag_fix_difficulty;; flag_id: 0x%x, reduced: 0x%x, status: %s\n", flag_id, new_flag, flag_check(new_flag) ? "true" : "false");
52
     return new_flag;
53
     return new_flag;
53
 }
54
 }
54
 
55
 

+ 1
- 1
src/specials/custom_specials.c View File

120
 
120
 
121
 void sp_random_number()
121
 void sp_random_number()
122
 {
122
 {
123
-    var_set(0x800D, (__aeabi_uidivmod(random(), var_get(0x8000))));
123
+    var_set(0x800D, (random() % var_get(0x8000)));
124
 }
124
 }

+ 82
- 33
src/test/alabastia.S View File

1
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2
-@                                                                                 @
3
-@           file: C:\Users\Philipp\Desktop\sots tilesets\alabastia.tmx            @
4
-@                            converted using tiled2agb                            @
5
-@                             converted on 29.05.2017                             @
6
-@                          program created by Sturmvogel                          @
7
-@                                                                                 @
8
-@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
2
+@                                                                    @
3
+@           file: E:\OneDrive\sots tilesets\alabastia.tmx            @
4
+@                     converted using tiled2agb                      @
5
+@                      converted on 31.05.2017                       @
6
+@                   program created by Sturmvogel                    @
7
+@                                                                    @
8
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
9
 
9
 
10
 @@@  SECTION: MAPHEADER  @@@
10
 @@@  SECTION: MAPHEADER  @@@
11
 
11
 
20
 	.hword 0x004E @index
20
 	.hword 0x004E @index
21
 	.byte 0x58 @name
21
 	.byte 0x58 @name
22
 	.byte 0x00 @cave
22
 	.byte 0x00 @cave
23
-	.byte 0x07 @weather
23
+	.byte 0x02 @weather
24
 	.byte 0x01 @light
24
 	.byte 0x01 @light
25
 	.byte 0x01 @unknown
25
 	.byte 0x01 @unknown
26
 	.hword 0x0006 @showName
26
 	.hword 0x0006 @showName
45
 
45
 
46
 .global mapblocks_alabastia
46
 .global mapblocks_alabastia
47
 mapblocks_alabastia:
47
 mapblocks_alabastia:
48
-	.hword 0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041C,0x041F,0x32A6,0x32A7,0x041E,0x041D,0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041E,0x041F
49
-	.hword 0x0414,0x0415,0x0424,0x0425,0x0424,0x0425,0x0424,0x0425,0x0424,0x0425,0x0424,0x0427,0x32AE,0x32AF,0x0426,0x0425,0x0424,0x0425,0x0424,0x0425,0x0424,0x0425,0x0416,0x0417
48
+	.hword 0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x32A6,0x32A7,0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041C,0x041D,0x041E,0x041F
49
+	.hword 0x0414,0x0415,0x0424,0x0425,0x0424,0x0425,0x0424,0x0425,0x0424,0x0425,0x0424,0x0425,0x32AE,0x32AF,0x0424,0x0425,0x0424,0x0425,0x0424,0x0425,0x0424,0x0425,0x0416,0x0417
50
 	.hword 0x041C,0x041D,0x32A6,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x3285,0x3286,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328F,0x041E,0x041F
50
 	.hword 0x041C,0x041D,0x32A6,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x3285,0x3286,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328E,0x328F,0x041E,0x041F
51
 	.hword 0x0414,0x0415,0x32AE,0x3296,0x3296,0x3281,0x3282,0x3282,0x3282,0x3283,0x3296,0x3296,0x3296,0x3296,0x3281,0x3282,0x3282,0x3282,0x3283,0x3296,0x3296,0x3297,0x0416,0x0417
51
 	.hword 0x0414,0x0415,0x32AE,0x3296,0x3296,0x3281,0x3282,0x3282,0x3282,0x3283,0x3296,0x3296,0x3296,0x3296,0x3281,0x3282,0x3282,0x3282,0x3283,0x3296,0x3296,0x3297,0x0416,0x0417
52
 	.hword 0x041C,0x041D,0x32AE,0x32C7,0x329E,0x0689,0x068A,0x068A,0x068A,0x068B,0x329E,0x329E,0x329E,0x329E,0x0689,0x068A,0x068A,0x068A,0x068B,0x32C6,0x3296,0x3297,0x041E,0x041F
52
 	.hword 0x041C,0x041D,0x32AE,0x32C7,0x329E,0x0689,0x068A,0x068A,0x068A,0x068B,0x329E,0x329E,0x329E,0x329E,0x0689,0x068A,0x068A,0x068A,0x068B,0x32C6,0x3296,0x3297,0x041E,0x041F
72
 mapborderblocks_alabastia:
72
 mapborderblocks_alabastia:
73
 	.hword 0x001C,0x001D
73
 	.hword 0x001C,0x001D
74
 	.hword 0x0014,0x0015
74
 	.hword 0x0014,0x0015
75
-@@@  SECTION: MAPFOOTER  @@@
75
+@@@  SECTION: MAPEVENTS  @@@
76
 
76
 
77
 .align 2
77
 .align 2
78
 .global mapevents_alabastia
78
 .global mapevents_alabastia
79
 mapevents_alabastia:
79
 mapevents_alabastia:
80
-.byte	0x02, 0x00, 0x00, 0x00
80
+.byte	0x02, 0x03, 0x02, 0x00
81
 .word 	mapevents_persons_alabastia
81
 .word 	mapevents_persons_alabastia
82
-.word 	00000000
83
-.word 	00000000
82
+.word 	mapevents_warps_alabastia
83
+.word 	mapevents_triggers_alabastia
84
 .word 	00000000
84
 .word 	00000000
85
 
85
 
86
 @@@ SECTION: PERSON EVENTS @@@
86
 @@@ SECTION: PERSON EVENTS @@@
87
 .align 2
87
 .align 2
88
 mapevents_persons_alabastia:
88
 mapevents_persons_alabastia:
89
-@//new structure
90
-	.byte 0x01
91
-	.byte 0x1E
92
-	.byte 0x00
89
+@PERSON ID: 0
90
+
91
+	.byte 0x09
92
+	.byte 0x14
93
 	.byte 0x00
93
 	.byte 0x00
94
-	.hword 0x0014
95
-	.hword 0x0003
96
 	.byte 0x00
94
 	.byte 0x00
95
+	.hword 0x000A
96
+	.hword 0x0004
97
 	.byte 0x00
97
 	.byte 0x00
98
+	.byte 0x01
98
 	.byte 0x40
99
 	.byte 0x40
99
 	.byte 0x00
100
 	.byte 0x00
100
-	.byte 0x01
101
 	.byte 0x00
101
 	.byte 0x00
102
-	.hword 0x0004
103
-	.word scr_trainer_test
102
+	.byte 0x00
103
+	.hword 0x0000
104
+	.word scr_map_test
104
 	.hword 0x0500
105
 	.hword 0x0500
105
 	.hword 0x0000
106
 	.hword 0x0000
106
-@//new structure
107
-	.byte 0x00
108
-	.byte 0x20
109
-	.byte 0x00
107
+@PERSON ID: 1
108
+
109
+	.byte 0x07
110
+	.byte 0x0A
110
 	.byte 0x00
111
 	.byte 0x00
111
-	.hword 0x000A
112
-	.hword 0x0005
113
 	.byte 0x00
112
 	.byte 0x00
113
+	.hword 0x000E
114
+	.hword 0x0002
114
 	.byte 0x00
115
 	.byte 0x00
116
+	.byte 0x03
115
 	.byte 0x40
117
 	.byte 0x40
116
 	.byte 0x00
118
 	.byte 0x00
119
+	.byte 0x01
117
 	.byte 0x00
120
 	.byte 0x00
118
-	.byte 0x00
119
-	.hword 0x0000
120
-	.word scr_map_test
121
+	.hword 0x0004
122
+	.word 0x00000000
121
 	.hword 0x0501
123
 	.hword 0x0501
122
 	.hword 0x0000
124
 	.hword 0x0000
125
+@@@ SECTION: WARP EVENTS @@@
126
+.align 2
127
+mapevents_warps_alabastia:
128
+@WARP ID: 0
129
+	.hword 6
130
+	.hword 7
131
+	.byte 0
132
+	.byte 1
133
+	.byte 0
134
+	.byte 4
135
+@WARP ID: 1
136
+	.hword 15
137
+	.hword 7
138
+	.byte 0
139
+	.byte 0
140
+	.byte 2
141
+	.byte 4
142
+@WARP ID: 2
143
+	.hword 16
144
+	.hword 13
145
+	.byte 0
146
+	.byte 0
147
+	.byte 3
148
+	.byte 4
149
+@@@ SECTION: TRIGGER EVENTS @@@
150
+.align 2
151
+mapevents_triggers_alabastia:
152
+@WARP ID: 0
153
+	.hword 12
154
+	.hword 1
155
+	.byte 0
156
+	.byte 0
157
+	.hword 20497
158
+	.hword 0
159
+	.byte 0
160
+	.byte 0
161
+	.word scr_trigger_test_two
162
+@WARP ID: 1
163
+	.hword 13
164
+	.hword 1
165
+	.byte 0
166
+	.byte 0
167
+	.hword 20498
168
+	.hword 0
169
+	.byte 0
170
+	.byte 0
171
+	.word scr_trigger_test

+ 23
- 1
src/test/test_scripts.S View File

13
 
13
 
14
 .global scr_trainer_test
14
 .global scr_trainer_test
15
 scr_trainer_test:
15
 scr_trainer_test:
16
-trainerbattle 0 5 0 str_test_text str_test_text
16
+trainerbattle 0 5 0 str_test_text str_test_text
17
+
18
+.global scr_trigger_test
19
+scr_trigger_test:
20
+lockall
21
+msgbox str_test_text 6
22
+applymovement 0xFF move_data
23
+waitmovement 0x0
24
+releaseall
25
+end
26
+
27
+.global scr_trigger_test_two
28
+scr_trigger_test_two:
29
+lockall
30
+msgbox str_test_text_two 6
31
+applymovement 0xFF move_data
32
+waitmovement 0x0
33
+setvar 0x5011
34
+releaseall
35
+end
36
+
37
+move_data:
38
+.byte APPLYMOVE_JUMP_ONE_DOWN, APPLYMOVE_END

+ 2
- 1
string/de/debugging.txt View File

1
-str_test_text=Tremble, before the majesty\nof the emperor!
1
+str_test_text=Tremble, before the majesty\nof the emperor!
2
+str_test_text_two=Maybe next time...