mirror of https://github.com/nmlgc/ReC98.git
[Debloating] [th01] REIIDEN.EXE main(): Inline or remove dumb one-off functions
Part of P0229, funded by Ember2528.
This commit is contained in:
parent
994dc1597b
commit
5d67c658a7
|
@ -38,10 +38,13 @@ struct scoredat_t {
|
|||
// Returns 0 on success, 1 on failure.
|
||||
int scoredat_load();
|
||||
|
||||
// Loads only the high score for the current [rank] into the resident
|
||||
// structure.
|
||||
void scoredat_load_hiscore();
|
||||
// Returns the high score for the difficulty previously loaded by
|
||||
// scoredat_load().
|
||||
score_t scoredat_hiscore_get();
|
||||
|
||||
// Sets [str] to the null-terminated name at the given [place] for the
|
||||
// difficulty previously loaded by scoredat_load().
|
||||
void scoredat_name_get(int place, unsigned char str[SCOREDAT_NAME_BYTES + 1]);
|
||||
|
||||
// Frees the previously loaded score file data.
|
||||
void scoredat_free(void);
|
||||
|
|
|
@ -82,7 +82,7 @@ print_stats:
|
|||
frame_delay(3);
|
||||
input_sense(false);
|
||||
if(input_shot) {
|
||||
stageobj_bgs_free_wrap(); // For the third time, that's not *all*...
|
||||
stageobj_bgs_free(); // For the third time, that's not *all*...
|
||||
recurse();
|
||||
} else if(input_strike) {
|
||||
for(int i = 0; i < BOS_ENTITY_SLOT_COUNT; i++) {
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
void scoredat_load_hiscore(void)
|
||||
{
|
||||
scoredat_load();
|
||||
resident->hiscore = scoredat_hiscore_get();
|
||||
scoredat_free();
|
||||
}
|
|
@ -214,7 +214,6 @@ extern unsigned long stageobj_bgs_size;
|
|||
|
||||
// Frees any previously allocated [stageobj_bgs]. Always returns 0.
|
||||
bool16 stageobj_bgs_free(void);
|
||||
bool16 stageobj_bgs_free_wrap(void); // ZUN bloat: Just call the real function.
|
||||
|
||||
// Blits the backgrounds for all cards and obstacles at their respective
|
||||
// positions, effectively removing those sprites from VRAM.
|
||||
|
|
|
@ -322,19 +322,6 @@ void pascal stage_num_animate(unsigned int stage_num)
|
|||
z_text_clear_inlined();
|
||||
}
|
||||
|
||||
void load_and_init_stuff_used_in_all_stages(void)
|
||||
{
|
||||
scoredat_load_hiscore();
|
||||
hud_bg_load("mask.grf");
|
||||
player_48x48.load("miko_ac.bos");
|
||||
player_48x32.load("miko_ac2.bos");
|
||||
ptn_load(PTN_SLOT_STG, PTN_STG_CARDFLIP_FN);
|
||||
ptn_load(PTN_SLOT_MIKO, "miko.ptn");
|
||||
ptn_new(PTN_SLOT_BG_HUD, ((PTN_BG_last - PTN_BG_first) + 1));
|
||||
bomb_kuji_load();
|
||||
ptn_slot_stg.has_reduced_sprites = false;
|
||||
}
|
||||
|
||||
void stage_entrance(int stage_id, const char* bg_fn, bool16 clear_vram_page_0)
|
||||
{
|
||||
int x;
|
||||
|
@ -398,11 +385,6 @@ void stage_entrance(int stage_id, const char* bg_fn, bool16 clear_vram_page_0)
|
|||
#include "th01/main/extend.cpp"
|
||||
#include "th01/main/debug.cpp"
|
||||
|
||||
bool16 stageobj_bgs_free_wrap(void)
|
||||
{
|
||||
return stageobj_bgs_free();
|
||||
}
|
||||
|
||||
// ZUN bloat: This function is only ever (meaningfully) called before process
|
||||
// termination when the standard library heap is destroyed anyway. You might
|
||||
// argue that it's cleaner to free all memory, but then, why doesn't it free
|
||||
|
@ -423,13 +405,6 @@ void error_resident_invalid(void)
|
|||
printf(ERROR_RESIDENT_INVALID);
|
||||
}
|
||||
|
||||
void pellet_destroy_score_delta_commit(void)
|
||||
{
|
||||
score += pellet_destroy_score_delta;
|
||||
hud_score_and_cardcombo_render();
|
||||
pellet_destroy_score_delta = 0;
|
||||
}
|
||||
|
||||
int8_t boss_id = BID_NONE; // ACTUAL TYPE: boss_id_t
|
||||
|
||||
void boss_free(void)
|
||||
|
@ -563,9 +538,6 @@ int main(void)
|
|||
debug_startup_delay();
|
||||
}
|
||||
|
||||
// ZUN bloat: We just started the program, these are still empty!
|
||||
graphics_free_redundant_and_incomplete();
|
||||
|
||||
rem_lives = resident->rem_lives;
|
||||
rem_bombs = resident->rem_bombs;
|
||||
player_left = PLAYER_LEFT_START;
|
||||
|
@ -582,7 +554,19 @@ int main(void)
|
|||
}
|
||||
|
||||
coreleft_prev = coreleft();
|
||||
load_and_init_stuff_used_in_all_stages();
|
||||
|
||||
scoredat_load();
|
||||
resident->hiscore = scoredat_hiscore_get();
|
||||
scoredat_free();
|
||||
hud_bg_load("mask.grf");
|
||||
player_48x48.load("miko_ac.bos");
|
||||
player_48x32.load("miko_ac2.bos");
|
||||
ptn_load(PTN_SLOT_STG, PTN_STG_CARDFLIP_FN);
|
||||
ptn_load(PTN_SLOT_MIKO, "miko.ptn");
|
||||
ptn_new(PTN_SLOT_BG_HUD, ((PTN_BG_last - PTN_BG_first) + 1));
|
||||
bomb_kuji_load();
|
||||
ptn_slot_stg.has_reduced_sprites = false;
|
||||
|
||||
z_graph_init();
|
||||
graph_accesspage_func(0);
|
||||
z_graph_clear();
|
||||
|
@ -887,7 +871,9 @@ int main(void)
|
|||
// the player of the pellet destroy points gained on the last
|
||||
// frame of a final boss.
|
||||
if(pellet_destroy_score_delta) {
|
||||
pellet_destroy_score_delta_commit();
|
||||
score += pellet_destroy_score_delta;
|
||||
hud_score_and_cardcombo_render();
|
||||
pellet_destroy_score_delta = 0;
|
||||
}
|
||||
}
|
||||
// At this point, the player either lost a life or cleared a
|
||||
|
@ -952,7 +938,7 @@ int main(void)
|
|||
stageobj_bgs_put_all();
|
||||
graph_accesspage_func(0);
|
||||
}
|
||||
stageobj_bgs_free_wrap();
|
||||
stageobj_bgs_free();
|
||||
cards.free();
|
||||
obstacles.free();
|
||||
} else {
|
||||
|
@ -967,7 +953,7 @@ int main(void)
|
|||
player_gameover_animate();
|
||||
Shots.unput_and_reset();
|
||||
Pellets.unput_and_reset();
|
||||
stageobj_bgs_free_wrap();
|
||||
stageobj_bgs_free();
|
||||
extend_next = 1;
|
||||
if(boss_id != BID_NONE) {
|
||||
boss_free();
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#define scoredat_close() file_close()
|
||||
#include "th01/hiscore/scorelod.cpp"
|
||||
|
||||
// Returns the high score for the difficulty previously loaded by
|
||||
// scoredat_load().
|
||||
score_t scoredat_hiscore_get()
|
||||
{
|
||||
return scoredat_score[0];
|
||||
|
@ -114,4 +112,3 @@ void pascal near str_from_swapped_kanji(
|
|||
}
|
||||
|
||||
#include "th01/hiscore/regist.cpp"
|
||||
#include "th01/main/hiscore.cpp"
|
||||
|
|
Loading…
Reference in New Issue