浏览代码

changed modulo and updated battle_engine

Philipp Auer 7 年前
父节点
当前提交
7bcfe1727f

+ 40
- 1
.vscode/settings.json 查看文件

@@ -2,6 +2,45 @@
2 2
     "files.associations": {
3 3
         "filesystem": "cpp",
4 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 +1 @@
1
-Subproject commit b592aa051cd69667879b31b7247ed6c5fe275dcd
1
+Subproject commit 781351a52a4f4b118ddf09c9b27f4f8ffdf4f520

+ 2
- 1
src/agb_debug/agb_debug.c 查看文件

@@ -70,7 +70,8 @@ u32 mini_itoa(int value, u32 radix, u32 uppercase, u32 unsig, char * buffer, u32
70 70
     }
71 71
     /* This builds the string back to front ... */
72 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 75
         value /= radix;
75 76
     } while (value > 0);
76 77
     for (i = (pbuffer - buffer); i < zero_pad; i++)

+ 1
- 1
src/battle_engine/battle_initiative.c 查看文件

@@ -102,7 +102,7 @@ u16 get_speed(u8 bank) {
102 102
 u8 speed_alt_from_item(u8 bank, u8 item_effect) {
103 103
     switch (item_effect) {
104 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 106
                 return 1;
107 107
             }
108 108
             break;

+ 2
- 2
src/debug/debug.c 查看文件

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

+ 1
- 1
src/evolution/evolution_methods.c 查看文件

@@ -181,7 +181,7 @@ struct evo_result evolve_random(struct evo_call_arguments arguments)
181 181
     }
182 182
     u32 pid = pokemon_get_attribute(arguments.poke, ATTR_PID, NULL);
183 183
     pid = pid & 0xFFFF;
184
-    u8 mod = __aeabi_uidivmod(pid, 10);
184
+    u8 mod = (pid % 10);
185 185
     dprintf("A pokemon tries to evolve at random: pid: %d, low: %d, mod: %d\n", pid, pid, mod);
186 186
     if (mod >= 5)
187 187
     {

+ 0
- 8
src/include/math.h 查看文件

@@ -39,14 +39,6 @@
39 39
 
40 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 42
 u16 random();
51 43
 
52 44
 #endif /* MATH_H */

+ 1
- 1
src/specials/custom_specials.c 查看文件

@@ -120,5 +120,5 @@ void sp_clear_variables()
120 120
 
121 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
 }