diff --git a/Makefile.mak b/Makefile.mak index e195e139..c4df29d6 100644 --- a/Makefile.mak +++ b/Makefile.mak @@ -152,17 +152,17 @@ bin\th05\res_kso.com: th05\res_kso.cpp $** | masters.lib -bin\th05\op.exe: th05\op010.cpp bin\th05\op.obj th05\op011.cpp th05\m_char.cpp bin\th05\musicp_c.obj bin\th05\musicp_a.obj bin\th05\bgimager.obj bin\th05\snd_load.obj bin\th05\snd_kaja.obj bin\th05\pi_cpp_1.obj bin\th05\pi_asm_1.obj bin\th05\pi_cpp_2.obj bin\th05\pi_asm_2.obj bin\th05\initop.obj bin\th05\input_s.obj bin\th05\inp_h_w.obj bin\th05\snd_dlym.obj th05\cdg_p_nc.cpp bin\th05\frmdelay.obj bin\th04\cdg_load.obj bin\th05\egcrect.obj bin\hfliplut.obj +bin\th05\op.exe: th05\op010.cpp bin\th05\op.obj th05\op011.cpp th05\m_char.cpp bin\th05\vector.obj bin\th05\musicp_c.obj bin\th05\musicp_a.obj bin\th05\bgimager.obj bin\th05\snd_load.obj bin\th05\snd_kaja.obj bin\th05\pi_cpp_1.obj bin\th05\pi_asm_1.obj bin\th05\pi_cpp_2.obj bin\th05\pi_asm_2.obj bin\th05\initop.obj bin\th05\input_s.obj bin\th05\inp_h_w.obj bin\th05\snd_dlym.obj th05\cdg_p_nc.cpp bin\th05\frmdelay.obj bin\th04\cdg_load.obj bin\th05\egcrect.obj bin\hfliplut.obj $(CC) $(CFLAGS) $(LARGE_LFLAGS) -DGAME=5 -DBINARY='O' -3 -Z -nbin\th05\ -eOP.EXE @&&| $** | -bin\th05\main.exe: bin\th05\main.obj th05\main010.cpp th05\main011.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\main012.cpp th05\main013.cpp bin\hfliplut.obj bin\th05\bullet.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 th05\main031.cpp th05\main032.cpp th05\main033.cpp th05\main034.cpp +bin\th05\main.exe: bin\th05\main.obj th05\main010.cpp th05\main011.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\main012.cpp th05\main013.cpp bin\hfliplut.obj bin\th05\bullet.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 th05\main031.cpp th05\main032.cpp th05\main033.cpp th05\main034.cpp $(CC) $(CFLAGS) $(LARGE_LFLAGS) -3 -Z -DGAME=5 -DBINARY='M' -nbin\th05\ -eMAIN.EXE @&&| $** | -bin\th05\maine.exe: bin\th05\maine.obj th05\maine011.cpp th05\regist.cpp th05\staff.cpp bin\th05\bgimager.obj bin\th05\snd_load.obj bin\th05\snd_kaja.obj bin\th05\pi_cpp_1.obj bin\th05\pi_asm_1.obj bin\th05\pi_cpp_2.obj bin\th05\pi_asm_2.obj bin\th05\initmain.obj bin\th05\input_s.obj bin\th05\inp_h_w.obj bin\th05\snd_dlym.obj bin\th05\frmdelay.obj bin\th04\cdg_load.obj bin\th05\egcrect.obj bin\hfliplut.obj +bin\th05\maine.exe: bin\th05\maine.obj th05\maine011.cpp th05\regist.cpp th05\staff.cpp bin\th05\vector.obj bin\th05\bgimager.obj bin\th05\snd_load.obj bin\th05\snd_kaja.obj bin\th05\pi_cpp_1.obj bin\th05\pi_asm_1.obj bin\th05\pi_cpp_2.obj bin\th05\pi_asm_2.obj bin\th05\initmain.obj bin\th05\input_s.obj bin\th05\inp_h_w.obj bin\th05\snd_dlym.obj bin\th05\frmdelay.obj bin\th04\cdg_load.obj bin\th05\egcrect.obj bin\hfliplut.obj $(CC) $(CFLAGS) $(LARGE_LFLAGS) -DGAME=5 -DBINARY='E' -Z -nbin\th05\ -eMAINE.EXE @&&| $** | diff --git a/th04/math/vector.cpp b/th04/math/vector.cpp new file mode 100644 index 00000000..a7d65c1e --- /dev/null +++ b/th04/math/vector.cpp @@ -0,0 +1,54 @@ +#pragma codeseg SHARED_ +#pragma option -3 + +extern "C" { +#include +#include "platform.h" +#include "pc98.h" +#include "master.hpp" +#include "th01/math/subpixel.hpp" +#include "th01/math/vector.hpp" +#include "th04/math/vector.hpp" + +#define polar_by_offset(radius, table, offset) ( \ + static_cast(radius) * *reinterpret_cast( \ + reinterpret_cast(table) + offset \ + )) + +static inline pixel_t polar_x_fast_unsafe( + pixel_t center, pixel_t &radius, size_t table_offset +) { + return ((polar_by_offset(radius, CosTable8, table_offset) >> 8) + center); +} + +static inline pixel_t polar_y_fast_unsafe( + pixel_t center, pixel_t &radius, size_t table_offset +) { + return ((polar_by_offset(radius, SinTable8, table_offset) >> 8) + center); +} + +#undef polar_by_offset + +int pascal vector1_at(int origin, int length, int angle) +{ + return (((static_cast(length) * angle) >> 8) + origin); +} + +void pascal vector2_at( + SPPoint near &ret, + subpixel_t origin_x, + subpixel_t origin_y, + subpixel_t length, + int angle +) +{ + _BX = angle; + #if (GAME == 5) + _BH ^= _BH; + #endif + _BX += _BX; // *= sizeof(short) + ret.x.v = polar_x_fast_unsafe(origin_x, length, _BX); + ret.y.v = polar_y_fast_unsafe(origin_y, length, _BX); +} + +} diff --git a/th04/math/vector.hpp b/th04/math/vector.hpp index 0590465f..b7241784 100644 --- a/th04/math/vector.hpp +++ b/th04/math/vector.hpp @@ -7,7 +7,7 @@ int pascal near vector2_near( SPPoint near &ret, unsigned char angle, int length ); -int pascal vector2_at( +void pascal vector2_at( SPPoint near &ret, subpixel_t origin_x, subpixel_t origin_y, diff --git a/th04/vector.cpp b/th04/vector.cpp new file mode 100644 index 00000000..6077793c --- /dev/null +++ b/th04/vector.cpp @@ -0,0 +1 @@ +#include "th04/math/vector.cpp" diff --git a/th05/vector.cpp b/th05/vector.cpp new file mode 100644 index 00000000..6077793c --- /dev/null +++ b/th05/vector.cpp @@ -0,0 +1 @@ +#include "th04/math/vector.cpp" diff --git a/th05_main.asm b/th05_main.asm index 2513aa05..2a49382b 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -10559,8 +10559,8 @@ include th04/formats/cdg_put_noalpha.asm include th04/snd/se.asm include th04/formats/cdg_put.asm include th02/exit.asm -include th04/math/vector1_at.asm -include th04/math/vector2_at.asm + extern VECTOR1_AT:proc + extern VECTOR2_AT:proc extern SND_LOAD:proc extern SND_KAJA_INTERRUPT:proc extern GAME_INIT_MAIN:proc diff --git a/th05_maine.asm b/th05_maine.asm index bc1d6ec9..d66aab10 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -7533,8 +7533,7 @@ include th04/formats/cdg_put_noalpha.asm include th04/snd/se.asm include th04/hardware/bgimage.asm include th02/exit.asm -include th04/math/vector1_at.asm -include th04/math/vector2_at.asm + extern VECTOR2_AT:proc extern BGIMAGE_PUT_RECT:proc extern SND_LOAD:proc extern SND_KAJA_INTERRUPT:proc diff --git a/th05_op.asm b/th05_op.asm index 9c996108..3844bea4 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -2535,8 +2535,7 @@ include th04/snd/se.asm include th04/hardware/bgimage.asm include th04/formats/cdg_put.asm include th02/exit.asm -include th04/math/vector1_at.asm -include th04/math/vector2_at.asm + extern VECTOR1_AT:proc extern _piano_render:proc extern _piano_setup_and_put_initial:proc extern BGIMAGE_PUT_RECT:proc