Reworking global frames

This commit is contained in:
Remnants of Forgotten Disney
2024-03-27 12:04:18 -05:00
parent 59d82496b4
commit 6bef2b58f2
12 changed files with 72 additions and 57 deletions

View File

@@ -1,9 +1,9 @@
#ifndef DEBUG_MODE_H
#define DEBUG_MODE_H
#define DEBUG_MODE true
#define IGNORE_GAME_PAK false
#define IGNORE_LINK_CABLE false
#define DEBUG_MODE false
#define IGNORE_GAME_PAK true
#define IGNORE_LINK_CABLE true
#define IGNORE_MG_E4_FLAGS true
#define DEBUG_GAME RUBY_ID

View File

@@ -0,0 +1,8 @@
#ifndef GLOBAL_FRAME_CONTROLLER_H
#define GLOBAL_FRAME_CONTROLLER_H
void global_next_frame();
int get_frame_count();
#endif

View File

@@ -1,9 +0,0 @@
#ifndef GLOBAL_FRAME_COUNTER_H
#define GLOBAL_FRAME_COUNTER_H
void global_next_frame();
int get_frame_count();
#endif

View File

@@ -32,6 +32,8 @@ void main_menu_enter();
void main_menu_exit();
void show_lang_btns();
void hide_lang_btns();
void show_main_btns();
void hide_main_btns();
void highlight_lang_btn(int index, bool highlight);
void set_arrow_point(int index);

View File

@@ -47,4 +47,5 @@ void load_btn_lang_ita();
void load_btn_lang_ger();
void load_btn_lang_spa();
void load_btn_lang_kor();
void load_lang_arrow();
void load_lang_arrow();
#define NUM_SPRITES 35

View File

@@ -11,6 +11,7 @@
#include "payload.h"
#include "interrupt.h"
#include "text_engine.h"
#include "global_frame_controller.h"
#define TIMEOUT 2
#define TIMEOUT_ONE_LENGTH 1000000 // Maybe keep a 10:1 ratio between ONE and TWO?
@@ -233,8 +234,7 @@ int loop(byte *box_data_storage)
counter++;
for (int i = 0; i < mosi_delay; i++)
{
key_poll();
VBlankIntrWait();
global_next_frame();
}
if (counter > (60 * 10))

View File

@@ -0,0 +1,28 @@
#include <tonc.h>
#include "global_frame_controller.h"
#include "random.h"
#include "background_engine.h"
#include "text_engine.h"
#include "sprite_data.h"
int global_frame_count = 0;
void global_next_frame()
{
key_poll();
rand_next_frame();
// tte_set_pos(0, 0);
// tte_write(std::to_string(get_rand_u32()).c_str());
background_frame();
text_next_frame();
oam_copy(oam_mem, obj_buffer, NUM_SPRITES);
VBlankIntrWait();
// mmFrame(); //Music
global_frame_count++;
};
int get_frame_count()
{
return global_frame_count;
}

View File

@@ -1,11 +0,0 @@
#include "global_frame_counter.h"
int global_frame_count = 0;
void global_next_frame(){
global_frame_count++;
}
int get_frame_count(){
return global_frame_count;
}

View File

@@ -21,7 +21,7 @@
#include "soundbank_bin.h"
#include "dex_handler.h"
#include "pokedex.h"
#include "global_frame_counter.h"
#include "global_frame_controller.h"
#include "pkmn_font.h"
#include "save_data_manager.h"
#include "mystery_gift_injector.h"
@@ -178,8 +178,7 @@ void game_load_error(void)
key_poll();
while (!key_hit(KEY_A))
{
key_poll();
VBlankIntrWait();
global_next_frame();
}
tte_erase_screen();
delay_counter = 0;
@@ -187,7 +186,7 @@ void game_load_error(void)
while (delay_counter < 60)
{
delay_counter++;
VBlankIntrWait();
global_next_frame();
}
}
@@ -196,11 +195,9 @@ void first_load_message(void)
tte_set_pos(8, 0);
tte_set_ink(10);
tte_write("#{cx:0xE000}Hello! Thank you for using\nPok@ Transporter GB!\n\nJust as a word of caution- \nPok@ Transporter GB WILL modify\nyour generation 3 save file.\nThe program is designed to\nnot corrupt anything, but if\nyou do not wish to modify\nyour save file, please turn\noff your Game Boy Advance.\n\nPlease note that Pok@mon\nMirror is still in beta, so\nsave file backups are HIGHLY\nrecommended before using.\nWith that all out of the\nway, please enjoy!\n\n -The Gears of Progress");
key_poll();
while (!key_hit(KEY_A))
{
key_poll();
VBlankIntrWait();
global_next_frame();
}
tte_erase_rect(0, 0, H_MAX, V_MAX);
}
@@ -233,16 +230,13 @@ int main(void)
tte_write("#{cx:0xF000}"); // Set the color to grey
while (delay_counter < (15 * 60))
{
global_next_frame();
delay_counter++;
rand_next_frame();
key_poll();
if (key_hit(KEY_A))
{
delay_counter = (15 * 60);
}
VBlankIntrWait();
}
key_poll();
// Gears of Progress
tte_erase_rect(0, 0, 240, 160);
@@ -250,20 +244,19 @@ int main(void)
delay_counter = 0;
while (delay_counter < (15 * 60))
{
global_next_frame();
delay_counter++;
rand_next_frame();
key_poll();
if (key_hit(KEY_A))
{
delay_counter = (15 * 60);
}
VBlankIntrWait();
}
key_poll();
REG_BG1CNT = REG_BG1CNT | BG_PRIO(3);
// Set up blend to fade to white/black
global_next_frame();
show_main_btns();
int curr_lang_btn_num = get_def_lang_num();
int old_lang_btn_num = -1;
set_arrow_point(curr_lang_btn_num);
@@ -378,17 +371,6 @@ int main(void)
}
break;
}
key_poll();
rand_next_frame();
tte_set_pos(0, 0);
// tte_write(std::to_string(get_rand_u32()).c_str());
background_frame();
text_next_frame();
oam_copy(oam_mem, obj_buffer, 35);
VBlankIntrWait();
// mmFrame(); //Music
global_next_frame();
}
}

View File

@@ -3,7 +3,7 @@
#include "button_handler.h"
#include "save_data_manager.h"
#define MAX_X_CORD 72 //128
#define MAX_X_CORD 72 // 128
int menu_slot = 1;
int old_menu_slot = 0;
@@ -22,7 +22,7 @@ void main_menu_btn_init(Button nButton, int index)
{
wide_button_array[index] = nButton;
wide_button_array[index].set_location(MAX_X_CORD, 7 + (38 * (index - 1)));
wide_button_array[index].show();
wide_button_array[index].hide();
}
else
{
@@ -134,6 +134,22 @@ void hide_lang_btns()
}
}
void show_main_btns()
{
for (int i = 0; i < WIDE_BUTTON_ARRAY_SIZE; i++)
{
wide_button_array[i].show();
}
}
void hide_main_btns()
{
for (int i = 0; i < WIDE_BUTTON_ARRAY_SIZE; i++)
{
wide_button_array[i].hide();
}
}
void highlight_lang_btn(int index, bool highlight)
{
lang_button_array[index].set_highlight(highlight);

View File

@@ -6,7 +6,7 @@
#include "dex_handler.h"
#include "sprite_data.h"
#include "pokemon_data.h"
#include "global_frame_counter.h"
#include "global_frame_controller.h"
#include "save_data_manager.h"
Dex dex_array[DEX_MAX];

View File

@@ -480,5 +480,3 @@ void load_lang_arrow()
// obj_unhide(lang_arrow, 0);
}
// Don't forget to increase the number of sprites loaded in main!!