2020-12-13 19:57:49 +00:00
|
|
|
/// Stage 5 Boss - SinGyoku
|
|
|
|
/// -----------------------
|
|
|
|
|
2022-06-17 21:43:48 +00:00
|
|
|
#include <stddef.h>
|
2020-12-06 12:38:41 +00:00
|
|
|
#include "platform.h"
|
2020-12-17 20:28:17 +00:00
|
|
|
#include "pc98.h"
|
2022-06-17 21:43:48 +00:00
|
|
|
#include "th01/math/area.hpp"
|
2022-06-18 19:14:43 +00:00
|
|
|
#include "th01/math/subpixel.hpp"
|
2022-06-17 21:43:48 +00:00
|
|
|
#include "th01/formats/pf.hpp"
|
|
|
|
#include "th01/main/playfld.hpp"
|
2021-08-03 13:50:52 +00:00
|
|
|
#include "th01/main/vars.hpp"
|
2020-12-10 18:55:36 +00:00
|
|
|
#define boss_hp singyoku_hp
|
2020-12-13 19:57:49 +00:00
|
|
|
#define boss_phase_frame singyoku_phase_frame
|
|
|
|
#include "th01/main/boss/boss.hpp"
|
2022-06-17 21:43:48 +00:00
|
|
|
#include "th01/main/boss/entity_a.hpp"
|
|
|
|
|
|
|
|
// Entities
|
|
|
|
// --------
|
|
|
|
|
|
|
|
static const int SPHERE_CELS = 8;
|
|
|
|
|
|
|
|
#define ent_sphere \
|
|
|
|
reinterpret_cast<CBossEntitySized<SINGYOKU_W, SINGYOKU_H> &>( \
|
|
|
|
boss_entities[0] \
|
|
|
|
)
|
|
|
|
|
|
|
|
// And that's how you avoid the entity position synchronization code that
|
|
|
|
// plagues Elis: By simply only using a single set of coordinates.
|
|
|
|
#define ent ent_sphere
|
|
|
|
|
|
|
|
#define ent_unput_and_put(ent_with_cel, cel) { \
|
|
|
|
ent_with_cel.unput_and_put_8(ent.cur_left, ent.cur_top, cel); \
|
|
|
|
}
|
|
|
|
// --------
|
2020-12-06 12:38:41 +00:00
|
|
|
|
2022-06-18 14:26:06 +00:00
|
|
|
// Patterns
|
|
|
|
// --------
|
|
|
|
|
|
|
|
#define pattern_state singyoku_pattern_state
|
|
|
|
extern union {
|
|
|
|
int pellet_count;
|
|
|
|
pixel_t speed_in_pixels;
|
|
|
|
subpixel_t speed_in_subpixels;
|
|
|
|
int unknown;
|
|
|
|
} pattern_state;
|
|
|
|
// --------
|
|
|
|
|
2020-12-17 20:28:17 +00:00
|
|
|
#define flash_colors singyoku_flash_colors
|
|
|
|
#define invincible singyoku_invincible
|
|
|
|
#define invincibility_frame singyoku_invincibility_frame
|
2020-12-09 20:42:10 +00:00
|
|
|
#define initial_hp_rendered singyoku_initial_hp_rendered
|
2020-12-17 20:28:17 +00:00
|
|
|
extern bool16 invincible;
|
|
|
|
extern int invincibility_frame;
|
2020-12-09 20:42:10 +00:00
|
|
|
extern bool16 initial_hp_rendered;
|
|
|
|
|
2022-06-17 21:43:48 +00:00
|
|
|
// Rotates the sphere by the given [cel_delta]. [interval] could be used to
|
|
|
|
// restrict this function to certain [boss_phase_frame] intervals, but it's
|
|
|
|
// always either 1 or -1 in the original game.
|
|
|
|
void sphere_rotate_and_render(int interval, int cel_delta)
|
|
|
|
{
|
|
|
|
if((boss_phase_frame % interval) != 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Yeah, why is the CBossEntity image variable 16 bits anywhere else to
|
|
|
|
// begin with?
|
|
|
|
int8_t image_new = (ent_sphere.image() + cel_delta);
|
|
|
|
if(image_new > (SPHERE_CELS - 1)) {
|
|
|
|
image_new = 0;
|
|
|
|
} else if(image_new < 0) {
|
|
|
|
image_new = (SPHERE_CELS - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
ent_sphere.set_image(image_new);
|
|
|
|
ent_unput_and_put(ent_sphere, image_new);
|
|
|
|
}
|
|
|
|
|
2020-12-06 12:38:41 +00:00
|
|
|
#define select_for_rank singyoku_select_for_rank
|
|
|
|
#include "th01/main/select_r.cpp"
|