|
@@ -29,13 +29,8 @@
|
29
|
29
|
*/
|
30
|
30
|
|
31
|
31
|
/* === INCLUDES === */
|
32
|
|
-#include <objects.h>
|
33
|
|
-#include <callback.h>
|
|
32
|
+#include <pokeagb/pokeagb.h>
|
34
|
33
|
#include <config/core.h>
|
35
|
|
-#include <lcd.h>
|
36
|
|
-#include <debug.h>
|
37
|
|
-#include <game_engine.h>
|
38
|
|
-#include <memory.h>
|
39
|
34
|
|
40
|
35
|
/* === PROTOTYPES === */
|
41
|
36
|
|
|
@@ -43,7 +38,7 @@
|
43
|
38
|
* @brief null callback
|
44
|
39
|
* @param self object
|
45
|
40
|
*/
|
46
|
|
-void mug_cb_null(struct obj_entity *self);
|
|
41
|
+void mug_cb_null(struct Object *self);
|
47
|
42
|
|
48
|
43
|
/**
|
49
|
44
|
* @brief called when tb is opened to create mugshot
|
|
@@ -58,24 +53,33 @@ void mug_delete();
|
58
|
53
|
|
59
|
54
|
/* === STRUCTURES === */
|
60
|
55
|
|
61
|
|
-typedef struct mug_mugshot {
|
|
56
|
+typedef struct Mugshot {
|
62
|
57
|
void *gfx;
|
63
|
58
|
void *pal;
|
64
|
|
-} mug_mugshot;
|
|
59
|
+} Mugshot;
|
65
|
60
|
|
66
|
61
|
/* === STATIC GLOBALS === */
|
67
|
62
|
|
68
|
|
-extern mug_mugshot mugshots[0xFF];
|
|
63
|
+extern Mugshot mugshots[0xFF];
|
69
|
64
|
|
70
|
65
|
u8 *temp_obj_id1 = (u8*) OBJ_1_TEMP;
|
71
|
66
|
u8 *temp_obj_id2 = (u8*) OBJ_2_TEMP;
|
72
|
67
|
|
73
|
|
-struct obj_oam_attributes mug_sprite = {0, 0x8000, 0, 0};
|
74
|
|
-
|
75
|
|
-struct obj_template mugshot_1_template = {MUGSHOT_1_TAG, MUGSHOT_1_TAG, &mug_sprite, (struct obj_frame **) 0x08231CF0, 0, (struct obj_rotscale_frame **) 0x08231CFC, mug_cb_null};
|
76
|
|
-struct obj_template mugshot_2_template = {MUGSHOT_2_TAG, MUGSHOT_2_TAG, &mug_sprite, (struct obj_frame **) 0x08231CF0, 0, (struct obj_rotscale_frame **) 0x08231CFC, mug_cb_null};
|
|
68
|
+struct OamData mug_sprite = {.size = 3};
|
77
|
69
|
|
|
70
|
+struct Template mugshot_1_template = {.tiles_tag = MUGSHOT_1_TAG,
|
|
71
|
+ .pal_tag = MUGSHOT_1_TAG,
|
|
72
|
+ .oam = &mug_sprite, .graphics = NULL,
|
|
73
|
+ .animation=SPRITE_NO_ANIMATION,
|
|
74
|
+ .rotscale = SPRITE_NO_ROTSCALE,
|
|
75
|
+ .callback=mug_cb_null};
|
78
|
76
|
|
|
77
|
+struct Template mugshot_2_template = {.tiles_tag = MUGSHOT_2_TAG,
|
|
78
|
+ .pal_tag = MUGSHOT_2_TAG,
|
|
79
|
+ .oam = &mug_sprite, .graphics = NULL,
|
|
80
|
+ .animation=SPRITE_NO_ANIMATION,
|
|
81
|
+ .rotscale = SPRITE_NO_ROTSCALE,
|
|
82
|
+ .callback=mug_cb_null};
|
79
|
83
|
|
80
|
84
|
/* === IMPLEMENTATIONS === */
|
81
|
85
|
|
|
@@ -90,22 +94,22 @@ void mug_create_on_variable() {
|
90
|
94
|
u16 *mug1_y = var_access(MUGSHOT_1_Y);
|
91
|
95
|
|
92
|
96
|
mug_id_1--;
|
93
|
|
- struct obj_resource gfx_mugshot_1 = {(mugshots[mug_id_1].gfx), 0x1C00, MUGSHOT_1_TAG};
|
94
|
|
- struct obj_resource pal_mugshot_1 = {(mugshots[mug_id_1].pal), MUGSHOT_1_TAG};
|
|
97
|
+ struct SpriteTiles gfx_mugshot_1 = {(mugshots[mug_id_1].gfx), 0x1C00, MUGSHOT_1_TAG};
|
|
98
|
+ struct SpritePalette pal_mugshot_1 = {(mugshots[mug_id_1].pal), MUGSHOT_1_TAG};
|
95
|
99
|
|
96
|
100
|
|
97
|
|
- obj_gpu_pal_alloc_tag_and_apply(&pal_mugshot_1);
|
98
|
|
- obj_gpu_tile_decompress_alloc_tag_and_upload(&gfx_mugshot_1);
|
|
101
|
+ gpu_pal_obj_alloc_tag_and_apply(&pal_mugshot_1);
|
|
102
|
+ gpu_tile_obj_decompress_alloc_tag_and_upload(&gfx_mugshot_1);
|
99
|
103
|
|
100
|
|
- *temp_obj_id1 = (u16) obj_template_instanciate_forward_search(&mugshot_1_template, 0, 100, 1);
|
|
104
|
+ *temp_obj_id1 = (u16) template_instanciate_forward_search(&mugshot_1_template, 0, 100, 1);
|
101
|
105
|
|
102
|
106
|
if (h_flip)
|
103
|
|
- objects[*temp_obj_id1].final_oam.attr1 |= 0x1000;
|
|
107
|
+ objects[*temp_obj_id1].final_oam.h_flip = true;
|
104
|
108
|
if (v_flip)
|
105
|
|
- objects[*temp_obj_id1].final_oam.attr1 |= 0x2000;
|
|
109
|
+ objects[*temp_obj_id1].final_oam.v_flip = true;
|
106
|
110
|
|
107
|
|
- objects[*temp_obj_id1].x = *mug1_x;
|
108
|
|
- objects[*temp_obj_id1].y = *mug1_y;
|
|
111
|
+ objects[*temp_obj_id1].pos1.x = *mug1_x;
|
|
112
|
+ objects[*temp_obj_id1].pos1.y = *mug1_y;
|
109
|
113
|
}
|
110
|
114
|
u16 *mug2_var = var_access(MUGHSOT_2_TABLE);
|
111
|
115
|
u16 c_mug2_var = *mug2_var;
|
|
@@ -117,23 +121,23 @@ void mug_create_on_variable() {
|
117
|
121
|
u16 *mug2_y = var_access(MUGSHOT_2_Y);
|
118
|
122
|
|
119
|
123
|
mug_id_2--;
|
120
|
|
- struct obj_resource gfx_mugshot_2 = {(mugshots[mug_id_2].gfx), 0x1C00, MUGSHOT_2_TAG};
|
121
|
|
- struct obj_resource pal_mugshot_2 = {(mugshots[mug_id_2].pal), MUGSHOT_2_TAG};
|
|
124
|
+ struct SpriteTiles gfx_mugshot_2 = {(mugshots[mug_id_2].gfx), 0x1C00, MUGSHOT_2_TAG};
|
|
125
|
+ struct SpritePalette pal_mugshot_2 = {(mugshots[mug_id_2].pal), MUGSHOT_2_TAG};
|
122
|
126
|
|
123
|
127
|
|
124
|
|
- obj_gpu_pal_alloc_tag_and_apply(&pal_mugshot_2);
|
125
|
|
- obj_gpu_tile_decompress_alloc_tag_and_upload(&gfx_mugshot_2);
|
|
128
|
+ gpu_pal_obj_alloc_tag_and_apply(&pal_mugshot_2);
|
|
129
|
+ gpu_tile_obj_decompress_alloc_tag_and_upload(&gfx_mugshot_2);
|
126
|
130
|
|
127
|
131
|
c_mug2_var = *mug2_var;
|
128
|
|
- *temp_obj_id2 = (u16) obj_template_instanciate_forward_search(&mugshot_2_template, 0, 100, 1);
|
|
132
|
+ *temp_obj_id2 = (u16) template_instanciate_forward_search(&mugshot_2_template, 0, 100, 1);
|
129
|
133
|
|
130
|
134
|
if (h_flip)
|
131
|
|
- objects[*temp_obj_id2].final_oam.attr1 |= 0x1000;
|
|
135
|
+ objects[*temp_obj_id2].final_oam.h_flip = true;
|
132
|
136
|
if (v_flip)
|
133
|
|
- objects[*temp_obj_id2].final_oam.attr1 |= 0x2000;
|
|
137
|
+ objects[*temp_obj_id2].final_oam.v_flip = true;
|
134
|
138
|
|
135
|
|
- objects[*temp_obj_id2].x = *mug2_x;
|
136
|
|
- objects[*temp_obj_id2].y = *mug2_y;
|
|
139
|
+ objects[*temp_obj_id2].pos1.x = *mug2_x;
|
|
140
|
+ objects[*temp_obj_id2].pos1.y = *mug2_y;
|
137
|
141
|
}
|
138
|
142
|
}
|
139
|
143
|
|
|
@@ -143,7 +147,7 @@ void mug_delete() {
|
143
|
147
|
|
144
|
148
|
if (*temp_obj_id1 != 0) {
|
145
|
149
|
gpu_pal_free_by_tag(MUGSHOT_1_TAG);
|
146
|
|
- obj_gpu_tile_free_by_tag(MUGSHOT_1_TAG);
|
|
150
|
+ gpu_tile_obj_free_by_tag(MUGSHOT_1_TAG);
|
147
|
151
|
|
148
|
152
|
//*mug1_var = 0;
|
149
|
153
|
//do reset mugshot var ; set it to old value instead
|
|
@@ -157,7 +161,7 @@ void mug_delete() {
|
157
|
161
|
//return;
|
158
|
162
|
if (*temp_obj_id2 != 0) {
|
159
|
163
|
gpu_pal_free_by_tag(MUGSHOT_2_TAG);
|
160
|
|
- obj_gpu_tile_free_by_tag(MUGSHOT_2_TAG);
|
|
164
|
+ gpu_tile_obj_free_by_tag(MUGSHOT_2_TAG);
|
161
|
165
|
|
162
|
166
|
//*mug2_var = 0;
|
163
|
167
|
//do reset mugshot var ; set it to old value instead
|
|
@@ -170,6 +174,7 @@ void mug_delete() {
|
170
|
174
|
|
171
|
175
|
}
|
172
|
176
|
|
173
|
|
-void mug_cb_null(struct obj_entity *self) {
|
|
177
|
+void mug_cb_null(struct Object *self) {
|
|
178
|
+ (void)self;
|
174
|
179
|
return;
|
175
|
180
|
}
|