2019-09-15 17:36:17 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
|
|
|
* Types shared between TH04 and TH05
|
|
|
|
*/
|
|
|
|
|
2020-02-20 18:11:53 +00:00
|
|
|
#include "th04/common.h"
|
|
|
|
|
2019-09-15 17:36:17 +00:00
|
|
|
/// Math
|
|
|
|
/// ----
|
2020-06-24 12:16:34 +00:00
|
|
|
#include "th01/math/subpixel.hpp"
|
2019-12-20 19:06:42 +00:00
|
|
|
#include "th04/math/motion.hpp"
|
2019-10-13 19:52:02 +00:00
|
|
|
#include "th03/math/randring.h"
|
2019-09-15 17:36:17 +00:00
|
|
|
/// ----
|
|
|
|
|
2019-09-16 11:01:53 +00:00
|
|
|
/// Formats
|
|
|
|
/// -------
|
[Decompilation] [th05] Stage setup
"Yeah, let's do this real quick, how can this possibly be hard, it's
just MOVs and a few function calls"…
…except that these MOVs access quite a lot of data, which we now all
have to declare in the C world, hooray.
Once it came to midbosses and bosses, I just turned them into C structs
after all. Despite what I said in 260edd8… after all, the ASM world
doesn't care about the representation in the C world, so they don't
necessarily have to be the same.
Since these structs can't contain everything related to midbosses and
bosses (really, why did all those variables have to be spread out like
this, ZUN?), it also made for a nice occasion to continue the "stuff"
naming scheme, describing "an obviously incomplete collection of
variables related to a thing", first seen in 160d4eb.
Also, PROCDESC apparently is the only syntactically correct option to
declare an extern near proc?
Also, that `boss_phase_timed_out` variable only needs to be here
already because TCC enforces word alignment for the .data segment…
yeah, it's technically not related to this commit, but why waste time
working around it if we can just include that one variable.
Completes P0030, funded by zorg.
2019-09-15 18:14:00 +00:00
|
|
|
#include "th03/formats/cdg.h"
|
2019-09-16 11:01:53 +00:00
|
|
|
#include "th04/formats/bb.h"
|
|
|
|
/// -------
|
[Decompilation] [th05] Stage setup
"Yeah, let's do this real quick, how can this possibly be hard, it's
just MOVs and a few function calls"…
…except that these MOVs access quite a lot of data, which we now all
have to declare in the C world, hooray.
Once it came to midbosses and bosses, I just turned them into C structs
after all. Despite what I said in 260edd8… after all, the ASM world
doesn't care about the representation in the C world, so they don't
necessarily have to be the same.
Since these structs can't contain everything related to midbosses and
bosses (really, why did all those variables have to be spread out like
this, ZUN?), it also made for a nice occasion to continue the "stuff"
naming scheme, describing "an obviously incomplete collection of
variables related to a thing", first seen in 160d4eb.
Also, PROCDESC apparently is the only syntactically correct option to
declare an extern near proc?
Also, that `boss_phase_timed_out` variable only needs to be here
already because TCC enforces word alignment for the .data segment…
yeah, it's technically not related to this commit, but why waste time
working around it if we can just include that one variable.
Completes P0030, funded by zorg.
2019-09-15 18:14:00 +00:00
|
|
|
|
2019-10-06 12:25:54 +00:00
|
|
|
/// Player
|
|
|
|
/// ------
|
2020-04-05 14:17:33 +00:00
|
|
|
#include "th04/main/player/player.h"
|
2020-01-01 20:17:50 +00:00
|
|
|
#include "th04/score.h"
|
2019-10-06 12:25:54 +00:00
|
|
|
/// ------
|
|
|
|
|
[Decompilation] [th05] Stage setup
"Yeah, let's do this real quick, how can this possibly be hard, it's
just MOVs and a few function calls"…
…except that these MOVs access quite a lot of data, which we now all
have to declare in the C world, hooray.
Once it came to midbosses and bosses, I just turned them into C structs
after all. Despite what I said in 260edd8… after all, the ASM world
doesn't care about the representation in the C world, so they don't
necessarily have to be the same.
Since these structs can't contain everything related to midbosses and
bosses (really, why did all those variables have to be spread out like
this, ZUN?), it also made for a nice occasion to continue the "stuff"
naming scheme, describing "an obviously incomplete collection of
variables related to a thing", first seen in 160d4eb.
Also, PROCDESC apparently is the only syntactically correct option to
declare an extern near proc?
Also, that `boss_phase_timed_out` variable only needs to be here
already because TCC enforces word alignment for the .data segment…
yeah, it's technically not related to this commit, but why waste time
working around it if we can just include that one variable.
Completes P0030, funded by zorg.
2019-09-15 18:14:00 +00:00
|
|
|
/// Stages
|
|
|
|
/// ------
|
|
|
|
extern nearfunc_t_near stage_invalidate;
|
|
|
|
extern nearfunc_t_near stage_render;
|
|
|
|
/// ------
|
|
|
|
|
|
|
|
/// Midbosses
|
|
|
|
/// ---------
|
|
|
|
typedef struct {
|
|
|
|
motion_t pos;
|
|
|
|
unsigned int frames_until;
|
|
|
|
int hp;
|
|
|
|
unsigned char sprite;
|
|
|
|
unsigned char phase;
|
|
|
|
int phase_frame;
|
|
|
|
// Treated as a bool in TH04
|
|
|
|
unsigned char damage_this_frame;
|
|
|
|
unsigned char angle;
|
|
|
|
} midboss_stuff_t;
|
|
|
|
|
|
|
|
extern midboss_stuff_t midboss;
|
|
|
|
|
|
|
|
// Callbacks
|
|
|
|
extern farfunc_t_near midboss_update_func;
|
|
|
|
extern nearfunc_t_near midboss_render_func;
|
|
|
|
|
|
|
|
#define MIDBOSS_DEC(stage) \
|
|
|
|
void pascal far midboss##stage##_update(void); \
|
|
|
|
void pascal near midboss##stage##_render(void);
|
|
|
|
/// ---------
|
|
|
|
|
2019-09-15 17:36:17 +00:00
|
|
|
/// Score
|
|
|
|
/// -----
|
|
|
|
extern unsigned long score_delta;
|
|
|
|
|
|
|
|
void pascal near score_update_and_render(void);
|
|
|
|
|
|
|
|
// Adds the entire score delta at once to the current score.
|
|
|
|
void pascal score_delta_commit(void);
|
|
|
|
/// -----
|