Implementing new sprites and temp sprite loading

This commit is contained in:
Remnants of Forgotten Disney 2024-03-29 13:20:10 -05:00
parent de40daa51e
commit 0b041caf75
19 changed files with 116 additions and 28 deletions

View File

@ -0,0 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

View File

@ -0,0 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

View File

@ -0,0 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

After

Width:  |  Height:  |  Size: 898 B

View File

@ -0,0 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

View File

@ -0,0 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

View File

@ -0,0 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

View File

@ -0,0 +1,3 @@
#
# Button : 4bpp, not compressed. Pallet 2, copy from 32 to 48.
-gB4 -ps32 -pe48

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

View File

@ -28,6 +28,7 @@ extern OBJ_ATTR *btn_d_l;
#include "btn_d_r.h"
extern OBJ_ATTR *btn_d_r;
#define SPRITE_BATCH_DEX 0
#include "dex_l.h"
#define DEX_SPRITE_LEFT 0
#include "dex_m.h"
@ -36,6 +37,7 @@ extern OBJ_ATTR *btn_d_r;
#define DEX_SPRITE_RIGHT 2
extern OBJ_ATTR *dex_sprites[3][6];
#define SPRITE_BATCH_LANG 1
#include "btn_lang_eng.h"
extern OBJ_ATTR *btn_lang_eng;
#include "btn_lang_fre.h"
@ -48,8 +50,27 @@ extern OBJ_ATTR *btn_lang_ger;
extern OBJ_ATTR *btn_lang_spa;
#include "btn_lang_kor.h"
extern OBJ_ATTR *btn_lang_kor;
#include "lang_arrow.h"
extern OBJ_ATTR *lang_arrow;
#define SPRITE_BATCH_GAMES 2
#include "button_red_green_left.h"
extern OBJ_ATTR *button_red_green_left;
extern OBJ_ATTR *button_red_green_right;
#include "button_blue_left.h"
extern OBJ_ATTR *button_blue_left;
extern OBJ_ATTR *button_blue_right;
#include "button_red_blue_left.h"
extern OBJ_ATTR *button_red_blue_left;
extern OBJ_ATTR *button_red_blue_right;
#include "button_yellow_left.h"
extern OBJ_ATTR *button_yellow_left;
extern OBJ_ATTR *button_yellow_right;
#include "button_gold_silver_left.h"
extern OBJ_ATTR *button_gold_silver_left;
extern OBJ_ATTR *button_gold_silver_right;
#include "button_crystal_left.h"
extern OBJ_ATTR *button_crystal_left;
extern OBJ_ATTR *button_crystal_right;
#include "button_game_select_edge.h"
#define METR_PAL 0
#define PROF_PAL 1
@ -61,7 +82,8 @@ void load_sprite(OBJ_ATTR *sprite, const unsigned int objTiles[], int objTilesLe
void load_background();
void load_textbox_background();
void load_opening_background();
void load_sprites();
void load_eternal_sprites();
void load_temp_sprites(int sprite_batch_id);
void load_btn_lang_eng();
void load_btn_lang_fre();
void load_btn_lang_ita();

View File

@ -95,7 +95,7 @@ void load_graphics()
load_opening_background();
load_background();
load_textbox_background();
load_sprites();
load_eternal_sprites();
// Set up main menu
main_menu.add_button(Button(btn_t_l, btn_t_r), BTN_TRANSFER);
@ -132,9 +132,6 @@ void initalization_script(void)
populate_buttons();
init_text_engine();
// Initalize the Pokedex
pokedex_init();
// Set the random seed
rand_set_seed(0x1216);
};

View File

@ -28,7 +28,11 @@ void pokedex_init()
int pokedex_loop()
{
load_temp_sprites(SPRITE_BATCH_DEX);
pokedex_init();
pokedex_show();
// TODO: For some reason there is screen tearing here. Probably not noticable on console,
// but it should be removed at some point
while (true)
{
if (key_hit(KEY_B)){

View File

@ -117,12 +117,12 @@ void populate_buttons()
lang_select.add_button(Button(btn_lang_kor), BTN_KOR);
game_select.set_xy_min_max(48, 240, 0, 120);
game_select.add_button(Button(btn_lang_eng), BTN_ENG);
game_select.add_button(Button(btn_lang_fre), BTN_FRE);
game_select.add_button(Button(btn_lang_ita), BTN_ITA);
game_select.add_button(Button(btn_lang_ger), BTN_GER);
game_select.add_button(Button(btn_lang_spa), BTN_SPA);
game_select.add_button(Button(btn_lang_kor), BTN_KOR);
game_select.add_button(Button(button_red_green_left, button_red_green_right), 0);
game_select.add_button(Button(button_blue_left, button_blue_right), 0);
game_select.add_button(Button(button_red_blue_left, button_red_blue_right), 0);
game_select.add_button(Button(button_yellow_left, button_yellow_right), 0);
game_select.add_button(Button(button_gold_silver_left, button_gold_silver_right), 0);
game_select.add_button(Button(button_crystal_left, button_crystal_right), 0);
}
bool run_conditional(int index)
@ -202,10 +202,12 @@ bool run_conditional(int index)
return true;
case CMD_LANG_MENU:
load_temp_sprites(SPRITE_BATCH_LANG);
party_data.set_lang(lang_select.button_main());
return true;
case CMD_GAME_MENU:
load_temp_sprites(SPRITE_BATCH_GAMES);
party_data.set_game(game_select.button_main());
return true;

View File

@ -86,9 +86,23 @@ OBJ_ATTR *btn_lang_ita = &obj_buffer[num_sprites++];
OBJ_ATTR *btn_lang_ger = &obj_buffer[num_sprites++];
OBJ_ATTR *btn_lang_spa = &obj_buffer[num_sprites++];
OBJ_ATTR *btn_lang_kor = &obj_buffer[num_sprites++];
OBJ_ATTR *lang_arrow = &obj_buffer[num_sprites++];
void load_sprites()
OBJ_ATTR *button_red_green_left = &obj_buffer[num_sprites++];
OBJ_ATTR *button_red_green_right = &obj_buffer[num_sprites++];
OBJ_ATTR *button_blue_left = &obj_buffer[num_sprites++];
OBJ_ATTR *button_blue_right = &obj_buffer[num_sprites++];
OBJ_ATTR *button_red_blue_left = &obj_buffer[num_sprites++];
OBJ_ATTR *button_red_blue_right = &obj_buffer[num_sprites++];
OBJ_ATTR *button_yellow_left = &obj_buffer[num_sprites++];
OBJ_ATTR *button_yellow_right = &obj_buffer[num_sprites++];
OBJ_ATTR *button_gold_silver_left = &obj_buffer[num_sprites++];
OBJ_ATTR *button_gold_silver_right = &obj_buffer[num_sprites++];
OBJ_ATTR *button_crystal_left = &obj_buffer[num_sprites++];
OBJ_ATTR *button_crystal_right = &obj_buffer[num_sprites++];
u32 global_tile_id_end = 0;
void load_eternal_sprites()
{
memcpy(pal_obj_mem + (METR_PAL * 16), metrPal, metrPalLen);
memcpy(pal_obj_mem + (PROF_PAL * 16), profPal, profPalLen);
@ -106,20 +120,48 @@ void load_sprites()
load_sprite(btn_c_r, btn_c_rTiles, btn_c_rTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_d_l, btn_d_lTiles, btn_d_lTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_d_r, btn_d_rTiles, btn_d_rTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
for (int col = 0; col < 6; col++)
{
load_sprite(dex_sprites[DEX_SPRITE_LEFT][col], dex_lTiles, dex_lTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 2);
load_sprite(dex_sprites[DEX_SPRITE_MID][col], dex_mTiles, dex_mTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 2);
load_sprite(dex_sprites[DEX_SPRITE_RIGHT][col], dex_rTiles, dex_rTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_16x32, 2);
}
global_tile_id_end = curr_tile_id;
}
load_sprite(btn_lang_eng, btn_lang_engTiles, btn_lang_engTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_fre, btn_lang_freTiles, btn_lang_freTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_ita, btn_lang_itaTiles, btn_lang_itaTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_ger, btn_lang_gerTiles, btn_lang_gerTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_spa, btn_lang_spaTiles, btn_lang_spaTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_kor, btn_lang_korTiles, btn_lang_korTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(lang_arrow, lang_arrowTiles, lang_arrowTilesLen, curr_tile_id, BTN_PAL, ATTR0_SQUARE, ATTR1_SIZE_8x8, 1);
void load_temp_sprites(int sprite_batch_id)
{
u32 curr_tile_id = global_tile_id_end;
switch (sprite_batch_id)
{
case SPRITE_BATCH_DEX:
for (int col = 0; col < 6; col++)
{
load_sprite(dex_sprites[DEX_SPRITE_LEFT][col], dex_lTiles, dex_lTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 2);
load_sprite(dex_sprites[DEX_SPRITE_MID][col], dex_mTiles, dex_mTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 2);
load_sprite(dex_sprites[DEX_SPRITE_RIGHT][col], dex_rTiles, dex_rTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_16x32, 2);
}
break;
case SPRITE_BATCH_LANG:
load_sprite(btn_lang_eng, btn_lang_engTiles, btn_lang_engTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_fre, btn_lang_freTiles, btn_lang_freTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_ita, btn_lang_itaTiles, btn_lang_itaTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_ger, btn_lang_gerTiles, btn_lang_gerTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_spa, btn_lang_spaTiles, btn_lang_spaTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(btn_lang_kor, btn_lang_korTiles, btn_lang_korTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
break;
case SPRITE_BATCH_GAMES:
load_sprite(button_red_green_left, button_red_green_leftTiles, button_red_green_leftTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(button_red_green_right, button_game_select_edgeTiles, button_game_select_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
load_sprite(button_blue_left, button_blue_leftTiles, button_blue_leftTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(button_blue_right, button_game_select_edgeTiles, button_game_select_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
load_sprite(button_red_blue_left, button_red_blue_leftTiles, button_red_blue_leftTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(button_red_blue_right, button_game_select_edgeTiles, button_game_select_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
load_sprite(button_yellow_left, button_yellow_leftTiles, button_yellow_leftTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(button_yellow_right, button_game_select_edgeTiles, button_game_select_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
load_sprite(button_gold_silver_left, button_gold_silver_leftTiles, button_gold_silver_leftTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(button_gold_silver_right, button_game_select_edgeTiles, button_game_select_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
load_sprite(button_crystal_left, button_crystal_leftTiles, button_crystal_leftTilesLen, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite(button_crystal_right, button_game_select_edgeTiles, button_game_select_edgeTilesLen, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
break;
}
}
void load_sprite(OBJ_ATTR *sprite, const unsigned int objTiles[], int objTilesLen,