[Decompilation] [th05] Stage-related .BB file loading boilerplate

Yay for alignment, allowing us once again to only move unrelated
variable declarations over to C…

Part of P0031, funded by zorg.
This commit is contained in:
nmlgc 2019-09-16 13:01:53 +02:00
parent e33ccd7ea6
commit b0c2122eec
6 changed files with 44 additions and 12 deletions

5
th04/formats/bb.h Normal file
View File

@ -0,0 +1,5 @@
#define BB_SIZE 2048
typedef char __seg* bb_seg_t;
void pascal near bb_stage_load(const char far* fn);

25
th04/formats/bb_stage.c Normal file
View File

@ -0,0 +1,25 @@
extern bb_seg_t bb_stage_seg;
void pascal near bb_stage_load(const char far* fn)
{
#if GAME == 5
bb_stage_seg = bb_load(fn);
#else
file_ropen(fn);
bb_stage_seg = (bb_seg_t)hmem_allocbyte(BB_SIZE);
file_read(bb_stage_seg, BB_SIZE);
file_close(fn);
#endif
}
#if GAME == 5
void pascal near bb_stage_free(void)
#else
void pascal far bb_stage_free(void)
#endif
{
if(bb_stage_seg) {
hmem_free((unsigned int)bb_stage_seg);
bb_stage_seg = 0;
}
}

View File

@ -50,15 +50,11 @@ int pascal far select_for_rank(
);
/// ----
/// Formats - .BB
/// -------------
void pascal near bb_stage_load(const char far* fn);
/// -------------
/// Formats - .CDG/.CD2
/// -------------------
/// Formats
/// -------
#include "th03/formats/cdg.h"
/// -------------------
#include "th04/formats/bb.h"
/// -------
/// Stages
/// ------

View File

@ -20,6 +20,7 @@ char boss_phase_timed_out = 0;
void pascal near boss_reset(void);
#include "th04/formats/bb_stage.c"
#include "th05/stage/setup.cpp"
// Adds the entire score delta at once to the current score.
@ -30,4 +31,6 @@ void pascal score_delta_commit(void)
}
}
static int unused_6CAC[3];
}

View File

@ -6,6 +6,11 @@
#include "ReC98.h"
#include "th04/shared.hpp"
/// Formats
/// -------
bb_seg_t pascal near bb_load(const char far *fn);
/// -------
/// Stages
/// ------
void pascal near stage2_update(void);

View File

@ -17886,7 +17886,8 @@ boss_reset proc near
retn
boss_reset endp
include th04/formats/bb_stage.asm
BB_STAGE_LOAD procdesc near
BB_STAGE_FREE procdesc near
STAGE1_SETUP procdesc near
STAGE2_SETUP procdesc near
STAGE3_SETUP procdesc near
@ -45513,8 +45514,5 @@ byte_2D084 db ?
byte_2D085 db ?
include th04/formats/bb_stage[bss].asm
include th04/boss/hitbox[bss].asm
dd ? ;
db ? ;
db ? ;
end