Browse Source

changed modulo and updated battle_engine

Philipp Auer 7 years ago
parent
commit
7bcfe1727f

+ 40
- 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"
6
     }
45
     }
7
 }
46
 }

+ 1
- 1
battle_engine

1
-Subproject commit b592aa051cd69667879b31b7247ed6c5fe275dcd
1
+Subproject commit 781351a52a4f4b118ddf09c9b27f4f8ffdf4f520

+ 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/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;

+ 1
- 1
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
     {

+ 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/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
 }