Browse Source

clean up some old code, fix warnings

SBird1337 6 years ago
parent
commit
dc169f1442

+ 3
- 3
icons.makefile View File

17
 	@echo -e "TRYING TO CLEAN ICONS FROM WRONG MAKEFILE"
17
 	@echo -e "TRYING TO CLEAN ICONS FROM WRONG MAKEFILE"
18
 
18
 
19
 #$(ICON_AR): $(OBJ_FILES)
19
 #$(ICON_AR): $(OBJ_FILES)
20
-#	@echo -e "\e[1;32mCreating archive $@\e[0m"
20
+#	@echo "\033[1;32mCreating archive $@\033[0m"
21
 #	$(AR) rcs $@ $^
21
 #	$(AR) rcs $@ $^
22
 
22
 
23
 #$(GFX_BUILD_DIR)/icons/%.o: $(GFX_BUILD_DIR)/icons/%.s
23
 #$(GFX_BUILD_DIR)/icons/%.o: $(GFX_BUILD_DIR)/icons/%.s
24
-#	@echo -e "\e[32mAssembling $<\e[0m"
24
+#	@echo "\033[32mAssembling $<\033[0m"
25
 #	$(AS) -o $@ $<
25
 #	$(AS) -o $@ $<
26
 
26
 
27
 #$(GFX_BUILD_DIR)/icons/%.s: $(I_ASSET_ROOT)/pkmn_icons/%.png
27
 #$(GFX_BUILD_DIR)/icons/%.s: $(I_ASSET_ROOT)/pkmn_icons/%.png
28
-#	@echo -e "\e[34mProcessing image $<\e[0m"
28
+#	@echo  "\033[34mProcessing image $<\033[0m"
29
 #	$(GRIT) $< -fts -fh! -g -gB 4 -gt -gz! -m! -p! -s icon_$(notdir $(basename $<)) -o $@
29
 #	$(GRIT) $< -fts -fh! -g -gB 4 -gt -gz! -m! -p! -s icon_$(notdir $(basename $<)) -o $@

+ 1
- 1
makefile View File

30
 
30
 
31
 DEFINES   := -DBPRE -DSOFTWARE_VERSION=0 -DLAN_DE
31
 DEFINES   := -DBPRE -DSOFTWARE_VERSION=0 -DLAN_DE
32
 ASFLAGS   := -mthumb
32
 ASFLAGS   := -mthumb
33
-CFLAGS    := -mthumb -mthumb-interwork -g -mcpu=arm7tdmi -fdiagnostics-show-option -mlong-calls -march=armv4t -Og -std=c11 -Wall -Wextra -Wunreachable-code -I$(PAGB_INCLUDE) -Isrc/include -Igenerated_image -fdiagnostics-color=always $(DEFINES)
33
+CFLAGS    := -mthumb -mthumb-interwork -g -mcpu=arm7tdmi -fdiagnostics-show-option -mlong-calls -march=armv4t -Og -std=c11 -Werror -Wall -Wextra -Wunreachable-code -I$(PAGB_INCLUDE) -Isrc/include -Igenerated_image -fdiagnostics-color=always $(DEFINES)
34
 GRITFLAGS := -ftc -fa
34
 GRITFLAGS := -ftc -fa
35
 LDFLAGS   := -z muldefs
35
 LDFLAGS   := -z muldefs
36
 BLDPATH   := object
36
 BLDPATH   := object

+ 6
- 0
src/battle_engine/battle_help.c View File

68
 /* === IMPLEMENTATIONS === */
68
 /* === IMPLEMENTATIONS === */
69
 u16 battle_damage_type_effectiveness_update(u8 attacking_type, u8 defending_type, u8 atk_bank, u8 def_bank,
69
 u16 battle_damage_type_effectiveness_update(u8 attacking_type, u8 defending_type, u8 atk_bank, u8 def_bank,
70
                                             u16 chained_effect, u8 airstatus) {
70
                                             u16 chained_effect, u8 airstatus) {
71
+
72
+    (void)airstatus; //TODO
73
+
71
     u8 effect, atype = attacking_type, dtype = defending_type;
74
     u8 effect, atype = attacking_type, dtype = defending_type;
72
     if (!chained_effect || atype == TYPE_EGG || dtype == TYPE_EGG)
75
     if (!chained_effect || atype == TYPE_EGG || dtype == TYPE_EGG)
73
         return chained_effect;
76
         return chained_effect;
124
 
127
 
125
 u16 battle_type_effectiveness_calc(u16 move, u8 move_type, u8 atk_bank, u8 def_bank,
128
 u16 battle_type_effectiveness_calc(u16 move, u8 move_type, u8 atk_bank, u8 def_bank,
126
                                    u8 effects_handling_and_recording) {
129
                                    u8 effects_handling_and_recording) {
130
+    (void)move;
131
+    (void)effects_handling_and_recording;
132
+    
127
     u16 chained_effect = 64;
133
     u16 chained_effect = 64;
128
     // TODO: double_type moves
134
     // TODO: double_type moves
129
     // TODO: get air status
135
     // TODO: get air status

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

19
 #include <stddef.h>
19
 #include <stddef.h>
20
 #include <stdbool.h>
20
 #include <stdbool.h>
21
 
21
 
22
-#define rgb5(r,g,b)                 (u16)( r | ( g << 5) | ( b << 10) )
22
+//#define rgb5(r,g,b)                 (u16)( r | ( g << 5) | ( b << 10) )
23
 
23
 
24
 #endif
24
 #endif

+ 40
- 35
src/interface/textbox_mugshots.c View File

29
  */
29
  */
30
 
30
 
31
 /* === INCLUDES === */
31
 /* === INCLUDES === */
32
-#include <objects.h>
33
-#include <callback.h>
32
+#include <pokeagb/pokeagb.h>
34
 #include <config/core.h>
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
 /* === PROTOTYPES === */
35
 /* === PROTOTYPES === */
41
 
36
 
43
  * @brief null callback
38
  * @brief null callback
44
  * @param self object
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
  * @brief called when tb is opened to create mugshot
44
  * @brief called when tb is opened to create mugshot
58
 
53
 
59
 /* === STRUCTURES === */
54
 /* === STRUCTURES === */
60
 
55
 
61
-typedef struct mug_mugshot {
56
+typedef struct Mugshot {
62
     void *gfx;
57
     void *gfx;
63
     void *pal;
58
     void *pal;
64
-} mug_mugshot;
59
+} Mugshot;
65
 
60
 
66
 /* === STATIC GLOBALS === */
61
 /* === STATIC GLOBALS === */
67
 
62
 
68
-extern mug_mugshot mugshots[0xFF];
63
+extern Mugshot mugshots[0xFF];
69
 
64
 
70
 u8 *temp_obj_id1 = (u8*) OBJ_1_TEMP;
65
 u8 *temp_obj_id1 = (u8*) OBJ_1_TEMP;
71
 u8 *temp_obj_id2 = (u8*) OBJ_2_TEMP;
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
 /* === IMPLEMENTATIONS === */
84
 /* === IMPLEMENTATIONS === */
81
 
85
 
90
         u16 *mug1_y = var_access(MUGSHOT_1_Y);
94
         u16 *mug1_y = var_access(MUGSHOT_1_Y);
91
 
95
 
92
         mug_id_1--;
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
         if (h_flip)
106
         if (h_flip)
103
-            objects[*temp_obj_id1].final_oam.attr1 |= 0x1000;
107
+            objects[*temp_obj_id1].final_oam.h_flip = true;
104
         if (v_flip)
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
     u16 *mug2_var = var_access(MUGHSOT_2_TABLE);
114
     u16 *mug2_var = var_access(MUGHSOT_2_TABLE);
111
     u16 c_mug2_var = *mug2_var;
115
     u16 c_mug2_var = *mug2_var;
117
         u16 *mug2_y = var_access(MUGSHOT_2_Y);
121
         u16 *mug2_y = var_access(MUGSHOT_2_Y);
118
 
122
 
119
         mug_id_2--;
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
         c_mug2_var = *mug2_var;
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
         if (h_flip)
134
         if (h_flip)
131
-            objects[*temp_obj_id2].final_oam.attr1 |= 0x1000;
135
+            objects[*temp_obj_id2].final_oam.h_flip = true;
132
         if (v_flip)
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
 
147
 
144
     if (*temp_obj_id1 != 0) {
148
     if (*temp_obj_id1 != 0) {
145
         gpu_pal_free_by_tag(MUGSHOT_1_TAG);
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
         //*mug1_var = 0;
152
         //*mug1_var = 0;
149
         //do reset mugshot var ; set it to old value instead
153
         //do reset mugshot var ; set it to old value instead
157
     //return;
161
     //return;
158
     if (*temp_obj_id2 != 0) {
162
     if (*temp_obj_id2 != 0) {
159
         gpu_pal_free_by_tag(MUGSHOT_2_TAG);
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
         //*mug2_var = 0;
166
         //*mug2_var = 0;
163
         //do reset mugshot var ; set it to old value instead
167
         //do reset mugshot var ; set it to old value instead
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
     return;
179
     return;
175
 }
180
 }

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

31
 /* === INCLUDES === */
31
 /* === INCLUDES === */
32
 
32
 
33
 #include "camera_move.h"
33
 #include "camera_move.h"
34
-#include "cutscene_meteor.h"
34
+//#include "cutscene_meteor.h"
35
 #include <config/core.h>
35
 #include <config/core.h>
36
 #include <pokeagb/pokeagb.h>
36
 #include <pokeagb/pokeagb.h>
37
 
37
 
81
 /* === STATICS === */
81
 /* === STATICS === */
82
 
82
 
83
 static special_func special_routines[10] = {
83
 static special_func special_routines[10] = {
84
-    met_play,         cam_sp_move_camera, sp_init_script,  NULL, NULL,
84
+    NULL,         cam_sp_move_camera, sp_init_script,  NULL, NULL,
85
     sp_random_number, sp_check_tileset,   sp_batchmaptile, sp_crystal_fade, sp_set_rival,
85
     sp_random_number, sp_check_tileset,   sp_batchmaptile, sp_crystal_fade, sp_set_rival,
86
 };
86
 };
87
 
87
 

src/specials/cutscene_meteor.c → src/specials/cutscene_meteor.c.old View File


src/specials/cutscene_meteor.h → src/specials/cutscene_meteor.h.old View File