2022-02-20 11:32:49 +00:00
|
|
|
|
#pragma option -zCBULLET_A_TEXT -zPmain_03 -k-
|
2021-07-27 18:40:21 +00:00
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
#include "platform.h"
|
|
|
|
|
#include "pc98.h"
|
|
|
|
|
#include "th01/math/overlap.hpp"
|
|
|
|
|
#include "th01/math/subpixel.hpp"
|
|
|
|
|
#include "th04/math/motion.hpp"
|
|
|
|
|
#include "th04/main/playfld.hpp"
|
|
|
|
|
#include "th04/main/player/player.hpp"
|
|
|
|
|
#include "th04/main/bullet/bullet.hpp"
|
2022-03-23 22:15:34 +00:00
|
|
|
|
#include "th04/main/bullet/clearzap.hpp"
|
2021-07-27 18:40:21 +00:00
|
|
|
|
#include "th05/main/playperf.hpp"
|
|
|
|
|
|
|
|
|
|
bool near bullet_template_clip(void)
|
|
|
|
|
{
|
|
|
|
|
extern bool group_fixedspeed;
|
|
|
|
|
|
|
|
|
|
if(
|
|
|
|
|
(bullet_clear_time != 0) &&
|
|
|
|
|
// If a newly spawned bullet wouldn't fully decay during the remaining
|
|
|
|
|
// time, let's simply not spawn it at all? This way, they don't award
|
2021-12-17 21:19:17 +00:00
|
|
|
|
// score points either.
|
2021-07-27 18:40:21 +00:00
|
|
|
|
(bullet_clear_time < (BMS_DECAY_FRAMES + 1)) // differs from TH04!
|
|
|
|
|
) {
|
|
|
|
|
clipped:
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Also applies to 8×8 pellets, because why wouldn't you combine both
|
|
|
|
|
// cases. #goodcode
|
|
|
|
|
_AX = bullet_template.origin.x;
|
|
|
|
|
_DX = bullet_template.origin.y;
|
|
|
|
|
if(!playfield_encloses(_AX, _DX, BULLET16_W, BULLET16_H)) {
|
|
|
|
|
goto clipped;
|
|
|
|
|
}
|
|
|
|
|
_AX -= player_pos.cur.x;
|
|
|
|
|
if(overlap_1d_inplace_fast(_AX, BULLET_KILLBOX_W)) {
|
|
|
|
|
_DX -= player_pos.cur.y;
|
|
|
|
|
if(overlap_1d_inplace_fast(_DX, BULLET_KILLBOX_H)) {
|
|
|
|
|
player_is_hit = true;
|
|
|
|
|
// Yes, no `return true` - TH05 does in fact *not* clip bullets
|
|
|
|
|
// that are spawned on top of the player.
|
|
|
|
|
// This might sound like it has a different effect on gameplay.
|
|
|
|
|
// Until you realize that the player got hit in this case and will
|
|
|
|
|
// either lose a life or deathbomb, both of which will cause all
|
|
|
|
|
// on-screen bullets to get cleared anyway.
|
|
|
|
|
// So it's at most a visual glitch.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!group_fixedspeed) {
|
2022-02-26 23:36:22 +00:00
|
|
|
|
bullet_template.speed.v = playperf_speedtune(bullet_template.speed.v);
|
2021-07-27 18:40:21 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|