2019-12-03 21:45:08 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
2022-02-15 13:19:07 +00:00
|
|
|
* 2nd part of code segment #1 of TH03's MAIN.EXE
|
2019-12-03 21:45:08 +00:00
|
|
|
*/
|
|
|
|
|
2021-11-22 10:48:24 +00:00
|
|
|
#include "th03/main/player/shot.hpp"
|
2019-12-03 21:45:08 +00:00
|
|
|
|
[Maintenance] Remove `extern "C"` from more areas of code
Much more than usual, now that we've got a snappy build system! This
commit covers
• All .PI functions across all games
• TH02's High Score entry functions
• TH03's shots_update() and shots_render()
• All functions declared in `th04/op/op.hpp`
• TH04/TH05's bb_txt_put_8_raw(), bullet_template_clip(),
player_pos_update_and_clamp(), score_update_and_render(), and
slowdown_frame_delay()
• TH05's reimu_stars_update_and_render(), score_delta_commit(),
stage2_invalidate(), stage2_update(), and space_window_set()
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-05-23 20:04:35 +00:00
|
|
|
void near shots_update(void)
|
2019-12-03 21:45:08 +00:00
|
|
|
{
|
|
|
|
shotpair_t near *shotpair = shotpairs;
|
|
|
|
for(int i = 0; i < SHOTPAIR_COUNT; i++, shotpair++) {
|
2023-03-19 22:08:05 +00:00
|
|
|
if(shotpair->alive) {
|
2019-12-03 21:45:08 +00:00
|
|
|
shotpair->topleft.y.v += shotpair->velocity_y.v;
|
|
|
|
if(shotpair->topleft.y.v <= to_sp(-1.0f)) {
|
2023-03-19 22:08:05 +00:00
|
|
|
shotpair->alive = false;
|
2019-12-03 21:45:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[Maintenance] Remove `extern "C"` from more areas of code
Much more than usual, now that we've got a snappy build system! This
commit covers
• All .PI functions across all games
• TH02's High Score entry functions
• TH03's shots_update() and shots_render()
• All functions declared in `th04/op/op.hpp`
• TH04/TH05's bb_txt_put_8_raw(), bullet_template_clip(),
player_pos_update_and_clamp(), score_update_and_render(), and
slowdown_frame_delay()
• TH05's reimu_stars_update_and_render(), score_delta_commit(),
stage2_invalidate(), stage2_update(), and space_window_set()
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-05-23 20:04:35 +00:00
|
|
|
void near shots_render(void)
|
2019-12-03 21:45:08 +00:00
|
|
|
{
|
|
|
|
shotpair_t near *shotpair = shotpairs;
|
|
|
|
|
2024-04-16 13:31:17 +00:00
|
|
|
sprite16_put_size.set(SHOT_W, SHOT_H);
|
2024-04-16 14:05:19 +00:00
|
|
|
sprite16_clip.reset();
|
2019-12-03 21:45:08 +00:00
|
|
|
|
|
|
|
for(int i = 0; i < SHOTPAIR_COUNT; i++, shotpair++) {
|
2023-03-19 22:08:05 +00:00
|
|
|
if(shotpair->alive) {
|
2022-02-10 03:39:40 +00:00
|
|
|
sprite16_offset_t so = (shotpair->so_anim + shotpair->so_pid);
|
2020-08-20 19:59:45 +00:00
|
|
|
screen_x_t left = playfield_fg_x_to_screen(
|
2019-12-03 21:45:08 +00:00
|
|
|
shotpair->topleft.x, shotpair->pid
|
|
|
|
);
|
2020-08-25 18:29:24 +00:00
|
|
|
screen_y_t top = shotpair->topleft.y.to_pixel() + PLAYFIELD_TOP;
|
2019-12-03 21:45:08 +00:00
|
|
|
|
|
|
|
sprite16_put(left + 0, top, so);
|
|
|
|
sprite16_put(left + SHOTPAIR_DISTANCE, top, so);
|
|
|
|
|
|
|
|
shotpair->so_anim += SHOT_VRAM_W;
|
|
|
|
if(shotpair->so_anim >= (SHOT_VRAM_W * SHOT_SPRITE_COUNT)) {
|
|
|
|
shotpair->so_anim = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|