Browse Source

added new animation functions

SBird1337 6 years ago
parent
commit
a664ab06aa

+ 1
- 1
g3headers

@@ -1 +1 @@
1
-Subproject commit 252b211d9c1cefed1ed41ae2a42a34043a1145cc
1
+Subproject commit 62f31b413bc364b5616d2240e0a4cbb050902f31

+ 1
- 0
main.asm View File

@@ -46,6 +46,7 @@
46 46
 
47 47
 .include "patches/overworlds/pkm_wild.asm"
48 48
 .include "patches/overworlds/trainer.asm"
49
+.include "patches/overworlds/npc_walk.asm"
49 50
 
50 51
 .include "patches/dns/core.asm"
51 52
 

+ 8
- 0
patches/overworlds/npc_walk.asm View File

@@ -0,0 +1,8 @@
1
+.org 0x08064540
2
+.word npc_walk_animations
3
+
4
+.org 0x08064584
5
+.word npc_walk_animations
6
+
7
+.org 0x080645B4
8
+.word npc_walk_animations

+ 0
- 8
patches/overworlds/overworld.asm View File

@@ -104,14 +104,6 @@ strb r0, [r4, #0x1A]
104 104
 .org 0x08083484
105 105
     .word oe_effect_table
106 106
 
107
-.org 0x08064540
108
-    .word movement_animations
109
-
110
-.org 0x08064584
111
-    .word movement_animations
112
-.org 0x080645B4
113
-    .word movement_animations
114
-
115 107
 .org 0x0805F5CC
116 108
 .halfword 0xC3FF
117 109
 

+ 3
- 3
src/overworld/dns/dns.c View File

@@ -22,9 +22,9 @@ union Color dns_color_multiply(union Color a, union Color b);
22 22
 
23 23
 
24 24
 void dns_blockset_load_palette(struct MapBlockset* blockset, u16 offset, u16 size){
25
-    struct RtcTimestamp stamp;
26
-    rtc_get_time(&stamp);
27
-    dprintf("rtc data was read: %x.%x.%x\n", stamp.day, stamp.month, stamp.year);
25
+    //struct RtcTimestamp stamp;
26
+    //rtc_get_time(&stamp);
27
+    //dprintf("rtc data was read: %x.%x.%x\n", stamp.day, stamp.month, stamp.year);
28 28
     if(blockset != NULL){
29 29
         union Color *dns_buffer = malloc(DNS_BUF_SIZE*2);
30 30
         if(blockset->secondary > 0)

+ 2
- 2
src/overworld/movement_execution/movement_execution.c View File

@@ -1,4 +1,4 @@
1
-#include <pokeagb/pokeagb.h>
1
+/*#include <pokeagb/pokeagb.h>
2 2
 
3 3
 typedef bool (*MovementCallback)(struct NpcState *npc, struct Object *obj);
4 4
 
@@ -249,4 +249,4 @@ const MovementCallback *movement_animations[] = {
249 249
     mv_set_frame_eighteen,
250 250
     mv_set_frame_nineteen,
251 251
     mv_set_frame_twenty,
252
-};
252
+};*/

+ 88
- 0
src/player_interaction/npc_walk.c View File

@@ -0,0 +1,88 @@
1
+#include <pokeagb/pokeagb.h>
2
+
3
+typedef bool (*MoveCallback)(struct NpcState* npc, struct Object* obj);
4
+
5
+void npc_walk_modify_diagonal(struct NpcState* npc, struct Object* obj, u8 direction) {
6
+    npc->to.x = walking_directions[direction].x + npc->from.x;
7
+    npc->to.y = walking_directions[direction].y + npc->from.y;
8
+    obj->priv[3] = direction;
9
+}
10
+
11
+bool npc_walk_mdia_ul(struct NpcState* npc, struct Object* obj) {
12
+    npc_run_any(npc, obj, 3, 0);
13
+    npc_walk_modify_diagonal(npc,obj,7);
14
+    return npc_run_is_finished(npc,obj);
15
+}
16
+
17
+bool npc_walk_mdia_ur(struct NpcState* npc, struct Object* obj) {
18
+    npc_run_any(npc, obj, 4, 0);
19
+    npc_walk_modify_diagonal(npc,obj,8);
20
+    return npc_run_is_finished(npc,obj);
21
+}
22
+
23
+bool npc_walk_mdia_dl(struct NpcState* npc, struct Object* obj) {
24
+    npc_run_any(npc, obj, 3, 0);
25
+    npc_update_direction(npc, 3);
26
+    npc_walk_modify_diagonal(npc,obj,5);
27
+    return npc_run_is_finished(npc,obj);
28
+}
29
+
30
+bool npc_walk_mdia_dr(struct NpcState* npc, struct Object* obj) {
31
+    npc_run_any(npc, obj, 4, 0);
32
+    npc_walk_modify_diagonal(npc,obj,6);
33
+    return npc_run_is_finished(npc,obj);
34
+}
35
+
36
+MoveCallback npc_walk_anim_mdia_ul[3] = {npc_walk_mdia_ul, npc_run_is_finished, npc_move_end};
37
+MoveCallback npc_walk_anim_mdia_ur[3] = {npc_walk_mdia_ur, npc_run_is_finished, npc_move_end};
38
+MoveCallback npc_walk_anim_mdia_dl[3] = {npc_walk_mdia_dl, npc_run_is_finished, npc_move_end};
39
+MoveCallback npc_walk_anim_mdia_dr[3] = {npc_walk_mdia_dr, npc_run_is_finished, npc_move_end};
40
+
41
+/* first new is 170 */
42
+const MoveCallback* npc_walk_animations[174] =
43
+{
44
+    (MoveCallback*)0x83a6864u, (MoveCallback*)0x83a686cu, (MoveCallback*)0x83a6874u, (MoveCallback*)0x83a687cu, 
45
+    (MoveCallback*)0x83a6a30u, (MoveCallback*)0x83a6a38u, (MoveCallback*)0x83a6a40u, (MoveCallback*)0x83a6a48u, 
46
+    (MoveCallback*)0x83a68c8u, (MoveCallback*)0x83a68d4u, (MoveCallback*)0x83a68e0u, (MoveCallback*)0x83a68ecu, 
47
+    (MoveCallback*)0x83a6904u, (MoveCallback*)0x83a68f8u, (MoveCallback*)0x83a6910u, (MoveCallback*)0x83a691cu, 
48
+    (MoveCallback*)0x83a6928u, (MoveCallback*)0x83a6934u, (MoveCallback*)0x83a6940u, (MoveCallback*)0x83a694cu, 
49
+    (MoveCallback*)0x83a6964u, (MoveCallback*)0x83a6970u, (MoveCallback*)0x83a697cu, (MoveCallback*)0x83a6988u, 
50
+    (MoveCallback*)0x83a6994u, (MoveCallback*)0x83a69a0u, (MoveCallback*)0x83a69acu, (MoveCallback*)0x83a69b8u, 
51
+    (MoveCallback*)0x83a69c4u, (MoveCallback*)0x83a69d0u, (MoveCallback*)0x83a69dcu, (MoveCallback*)0x83a69e8u, 
52
+    (MoveCallback*)0x83a69f4u, (MoveCallback*)0x83a6a50u, (MoveCallback*)0x83a6a5cu, (MoveCallback*)0x83a6a68u, 
53
+    (MoveCallback*)0x83a6a74u, (MoveCallback*)0x83a6a80u, (MoveCallback*)0x83a6a8cu, (MoveCallback*)0x83a6a98u, 
54
+    (MoveCallback*)0x83a6aa4u, (MoveCallback*)0x83a6ab0u, (MoveCallback*)0x83a6abcu, (MoveCallback*)0x83a6ac8u, 
55
+    (MoveCallback*)0x83a6ad4u, (MoveCallback*)0x83a6ae0u, (MoveCallback*)0x83a6aecu, (MoveCallback*)0x83a6af8u, 
56
+    (MoveCallback*)0x83a6b04u, (MoveCallback*)0x83a6b10u, (MoveCallback*)0x83a6b1cu, (MoveCallback*)0x83a6b28u, 
57
+    (MoveCallback*)0x83a6b34u, (MoveCallback*)0x83a6b40u, (MoveCallback*)0x83a6b4cu, (MoveCallback*)0x83a6b58u, 
58
+    (MoveCallback*)0x83a6b64u, (MoveCallback*)0x83a6b70u, (MoveCallback*)0x83a6b7cu, (MoveCallback*)0x83a6b88u, 
59
+    (MoveCallback*)0x83a6b94u, (MoveCallback*)0x83a6ba0u, (MoveCallback*)0x83a6bacu, (MoveCallback*)0x83a6bb8u, 
60
+    (MoveCallback*)0x83a6bc4u, (MoveCallback*)0x83a6bd0u, (MoveCallback*)0x83a6bdcu, (MoveCallback*)0x83a6be8u, 
61
+    (MoveCallback*)0x83a6bf4u, (MoveCallback*)0x83a6c00u, (MoveCallback*)0x83a6c0cu, (MoveCallback*)0x83a6c18u, 
62
+    (MoveCallback*)0x83a6c24u, (MoveCallback*)0x83a6c30u, (MoveCallback*)0x83a6c6cu, (MoveCallback*)0x83a6c74u, 
63
+    (MoveCallback*)0x83a6c7cu, (MoveCallback*)0x83a6c84u, (MoveCallback*)0x83a6c8cu, (MoveCallback*)0x83a6c98u, 
64
+    (MoveCallback*)0x83a6ca4u, (MoveCallback*)0x83a6cb0u, (MoveCallback*)0x83a6cbcu, (MoveCallback*)0x83a6cc8u, 
65
+    (MoveCallback*)0x83a6cd4u, (MoveCallback*)0x83a6ce0u, (MoveCallback*)0x83a6cecu, (MoveCallback*)0x83a6cf8u, 
66
+    (MoveCallback*)0x83a6d04u, (MoveCallback*)0x83a6d10u, (MoveCallback*)0x83a6d1cu, (MoveCallback*)0x83a6d24u, 
67
+    (MoveCallback*)0x83a6d30u, (MoveCallback*)0x83a6d38u, (MoveCallback*)0x83a6d40u, (MoveCallback*)0x83a6d48u, 
68
+    (MoveCallback*)0x83a6d50u, (MoveCallback*)0x83a6d58u, (MoveCallback*)0x83a6d60u, (MoveCallback*)0x83a6d68u, 
69
+    (MoveCallback*)0x83a6d70u, (MoveCallback*)0x83a6d78u, (MoveCallback*)0x83a6d80u, (MoveCallback*)0x83a6d88u, 
70
+    (MoveCallback*)0x83a6d94u, (MoveCallback*)0x83a6da4u, (MoveCallback*)0x83a6db4u, (MoveCallback*)0x83a6dbcu, 
71
+    (MoveCallback*)0x83a6dc4u, (MoveCallback*)0x83a6dccu, (MoveCallback*)0x83a6dd4u, (MoveCallback*)0x83a6de0u, 
72
+    (MoveCallback*)0x83a6decu, (MoveCallback*)0x83a6df4u, (MoveCallback*)0x83a6dfcu, (MoveCallback*)0x83a6e04u, 
73
+    (MoveCallback*)0x83a6e0cu, (MoveCallback*)0x83a6e18u, (MoveCallback*)0x83a6e24u, (MoveCallback*)0x83a6e30u, 
74
+    (MoveCallback*)0x83a6e3cu, (MoveCallback*)0x83a6e48u, (MoveCallback*)0x83a6e54u, (MoveCallback*)0x83a6e60u, 
75
+    (MoveCallback*)0x83a6e9cu, (MoveCallback*)0x83a6ea8u, (MoveCallback*)0x83a6eb4u, (MoveCallback*)0x83a6ec0u, 
76
+    (MoveCallback*)0x83a6eccu, (MoveCallback*)0x83a6ed8u, (MoveCallback*)0x83a6ee4u, (MoveCallback*)0x83a6ef0u, 
77
+    (MoveCallback*)0x83a6efcu, (MoveCallback*)0x83a6f08u, (MoveCallback*)0x83a6f14u, (MoveCallback*)0x83a6f20u, 
78
+    (MoveCallback*)0x83a6f2cu, (MoveCallback*)0x83a6f38u, (MoveCallback*)0x83a6f44u, (MoveCallback*)0x83a6f50u, 
79
+    (MoveCallback*)0x83a6f5cu, (MoveCallback*)0x83a6f68u, (MoveCallback*)0x83a6f74u, (MoveCallback*)0x83a6f80u, 
80
+    (MoveCallback*)0x83a6f8cu, (MoveCallback*)0x83a6f98u, (MoveCallback*)0x83a6fa4u, (MoveCallback*)0x83a6fb0u, 
81
+    (MoveCallback*)0x83a6fbcu, (MoveCallback*)0x83a6fc8u, (MoveCallback*)0x83a6fd4u, (MoveCallback*)0x83a6fe0u, 
82
+    (MoveCallback*)0x83a6fecu, (MoveCallback*)0x83a6ff4u, (MoveCallback*)0x83a6ffcu, (MoveCallback*)0x83a6898u, 
83
+    (MoveCallback*)0x83a68a4u, (MoveCallback*)0x83a68b0u, (MoveCallback*)0x83a68bcu, (MoveCallback*)0x83a7004u, 
84
+    (MoveCallback*)0x83a6a00u, (MoveCallback*)0x83a6a0cu, (MoveCallback*)0x83a6a18u, (MoveCallback*)0x83a6a24u, 
85
+    (MoveCallback*)0x83a700cu, (MoveCallback*)0x83a7018u, (MoveCallback*)0x83a6c3cu, (MoveCallback*)0x83a6c48u, 
86
+    (MoveCallback*)0x83a6c54u, (MoveCallback*)0x83A6C60u, npc_walk_anim_mdia_ul, npc_walk_anim_mdia_ur,
87
+    npc_walk_anim_mdia_dl, npc_walk_anim_mdia_dr
88
+};