From c8997cd5004faa0526342b86d8b3f9c17b21361b Mon Sep 17 00:00:00 2001 From: nmlgc Date: Tue, 10 Jan 2023 10:14:42 +0100 Subject: [PATCH] [Maintenance] [th05] Lasers: Prepare for two segments in one translation unit Part of P0228, funded by [Anonymous] and nrook. --- Makefile.mak | 2 +- th05/laser.cpp | 1 + th05/laser_sc.cpp | 1 - th05/main/bullet/{laser_sc.cpp => laser.cpp} | 4 ++++ th05/main/bullet/laser.hpp | 8 ++++++++ th05_main.asm | 4 ++-- 6 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 th05/laser.cpp delete mode 100644 th05/laser_sc.cpp rename th05/main/bullet/{laser_sc.cpp => laser.cpp} (97%) diff --git a/Makefile.mak b/Makefile.mak index 3e13939c..4bb973d2 100644 --- a/Makefile.mak +++ b/Makefile.mak @@ -149,7 +149,7 @@ bin\th05\op.exe: th05\op010.cpp bin\th05\op.obj th05\op011.cpp th05\m_char.cpp b $** | -bin\th05\main.exe: bin\th05\main.obj bin\th04\slowdown.obj th05\demo.cpp th05\ems.cpp bin\th05\cfg_lres.obj th05\main010.cpp th05\f_dialog.cpp th05\dialog.cpp th05\playfld.cpp bin\th04\mb_inv.obj bin\th04\boss_bd.obj th05\boss_bg.cpp th05\laser_rh.cpp th05\p_common.cpp th05\p_reimu.cpp th05\p_marisa.cpp th05\p_mima.cpp th05\p_yuuka.cpp bin\th05\player.obj bin\th05\hud_bar.obj bin\th05\scoreupd.obj th05\midboss5.cpp th05\hud_ovrl.cpp bin\th04\player_p.obj bin\th04\vector2n.obj bin\th05\spark_a.obj th05\bullet_p.cpp bin\th04\grcg_3.obj th05\player_a.cpp bin\th05\bullet_1.obj th05\bullet_c.cpp bin\th03\vector2.obj bin\th03\hfliplut.obj bin\th04\snd_pmdr.obj bin\th04\snd_mmdr.obj bin\th04\snd_mode.obj bin\th05\bullet.obj th05\bullet_t.cpp bin\th04\cdg_p_na.obj bin\th04\snd_se_r.obj bin\th04\snd_se.obj bin\th05\cdg_put.obj bin\th04\exit.obj bin\th05\vector.obj bin\th05\snd_load.obj bin\th05\snd_kaja.obj bin\th05\initmain.obj bin\th05\input_s.obj bin\th05\inp_h_w.obj bin\th05\frmdelay.obj bin\th04\cdg_load.obj bin\th04\scrolly3.obj bin\th04\motion_3.obj th05\gather.cpp th05\main032.cpp th05\midboss.cpp bin\th04\hud_hp.obj th05\mb_dft.cpp th05\laser_sc.cpp th05\cheeto_u.cpp bin\th04\it_spl_u.obj th05\bullet_u.cpp th05\midboss1.cpp th05\boss_1.cpp th05\boss_4.cpp th05\boss_6.cpp th05\boss_x.cpp th05\boss.cpp th05\main014.cpp +bin\th05\main.exe: bin\th05\main.obj bin\th04\slowdown.obj th05\demo.cpp th05\ems.cpp bin\th05\cfg_lres.obj th05\main010.cpp th05\f_dialog.cpp th05\dialog.cpp th05\playfld.cpp bin\th04\mb_inv.obj bin\th04\boss_bd.obj th05\boss_bg.cpp th05\laser_rh.cpp th05\p_common.cpp th05\p_reimu.cpp th05\p_marisa.cpp th05\p_mima.cpp th05\p_yuuka.cpp bin\th05\player.obj bin\th05\hud_bar.obj bin\th05\scoreupd.obj th05\midboss5.cpp th05\hud_ovrl.cpp bin\th04\player_p.obj bin\th04\vector2n.obj bin\th05\spark_a.obj th05\bullet_p.cpp bin\th04\grcg_3.obj th05\player_a.cpp bin\th05\bullet_1.obj th05\bullet_c.cpp bin\th03\vector2.obj bin\th03\hfliplut.obj bin\th04\snd_pmdr.obj bin\th04\snd_mmdr.obj bin\th04\snd_mode.obj bin\th05\bullet.obj th05\bullet_t.cpp bin\th04\cdg_p_na.obj bin\th04\snd_se_r.obj bin\th04\snd_se.obj bin\th05\cdg_put.obj bin\th04\exit.obj bin\th05\vector.obj bin\th05\snd_load.obj bin\th05\snd_kaja.obj bin\th05\initmain.obj bin\th05\input_s.obj bin\th05\inp_h_w.obj bin\th05\frmdelay.obj bin\th04\cdg_load.obj bin\th04\scrolly3.obj bin\th04\motion_3.obj th05\gather.cpp th05\main032.cpp th05\midboss.cpp bin\th04\hud_hp.obj th05\mb_dft.cpp th05\laser.cpp th05\cheeto_u.cpp bin\th04\it_spl_u.obj th05\bullet_u.cpp th05\midboss1.cpp th05\boss_1.cpp th05\boss_4.cpp th05\boss_6.cpp th05\boss_x.cpp th05\boss.cpp th05\main014.cpp $(CC) $(CFLAGS) $(LARGE_LFLAGS) -3 -Z -DGAME=5 -DBINARY='M' -nbin\th05\ -eMAIN.EXE @&&| $** | diff --git a/th05/laser.cpp b/th05/laser.cpp new file mode 100644 index 00000000..83674089 --- /dev/null +++ b/th05/laser.cpp @@ -0,0 +1 @@ +#include "th05/main/bullet/laser.cpp" diff --git a/th05/laser_sc.cpp b/th05/laser_sc.cpp deleted file mode 100644 index 75accbb3..00000000 --- a/th05/laser_sc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "th05/main/bullet/laser_sc.cpp" diff --git a/th05/main/bullet/laser_sc.cpp b/th05/main/bullet/laser.cpp similarity index 97% rename from th05/main/bullet/laser_sc.cpp rename to th05/main/bullet/laser.cpp index 4149dba4..dc9659a6 100644 --- a/th05/main/bullet/laser_sc.cpp +++ b/th05/main/bullet/laser.cpp @@ -12,6 +12,9 @@ extern "C" { } #include "th05/main/bullet/laser.hpp" +// Segment 3 (as allocated in the header) +// --------- + void near lasers_shootout_add(void) { Laser near *laser; @@ -98,3 +101,4 @@ void pascal near laser_stop(int slot) lasers[slot].flag = LF_FREE; } } +// --------- diff --git a/th05/main/bullet/laser.hpp b/th05/main/bullet/laser.hpp index 6a49fd1b..ef6c4f88 100644 --- a/th05/main/bullet/laser.hpp +++ b/th05/main/bullet/laser.hpp @@ -73,6 +73,8 @@ extern Laser laser_template; /// ------- /// "Manual" lasers ignore any age fields from the laser template. +#pragma codeseg LASER_SC_TEXT + // Spawns a new shoot-out laser based on the [laser_template]. void near lasers_shootout_add(void); @@ -90,6 +92,8 @@ void pascal near laser_manual_grow(int slot); // Transitions the laser at [slot] to a stopping phase appropriate for its // current one. void pascal near laser_stop(int slot); + +#pragma codeseg /// ------- // Returns `true` if the laser is entirely off-screen. @@ -98,5 +102,9 @@ bool16 pascal near laser_render_ray(const laser_coords_t near& coords); // Processes any collision between the given [laser] and the player. void pascal near laser_hittest(Laser near& laser); +#pragma codeseg main__TEXT main_01 + void near lasers_update(void); void near lasers_render(void); + +#pragma codeseg diff --git a/th05_main.asm b/th05_main.asm index c2279161..498274c2 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -4368,7 +4368,9 @@ loc_FBF7: leave retn sub_FAA3 endp +main__TEXT ends +PLAYFLD_TEXT segment byte public 'CODE' use16 include th05/main/bullet/lasers_update_render.asm include th05/main/bullet/cheetos_render.asm include th04/main/item/splashes_render.asm @@ -4584,9 +4586,7 @@ loc_10282: pop bp retn sub_10214 endp -main__TEXT ends -PLAYFLD_TEXT segment byte public 'CODE' use16 @playfield_shake_update_and_rende$qv procdesc pascal near PLAYFLD_TEXT ends