diff --git a/Makefile.mak b/Makefile.mak index d370159e..31e9d866 100644 --- a/Makefile.mak +++ b/Makefile.mak @@ -33,7 +33,7 @@ bin\Pipeline\grzview.com: Pipeline\grzview.cpp th01\formats\grz.cpp $** | masters.lib -bin\th01\zunsoft.com: th01\zunsoft.c +bin\th01\zunsoft.com: th01\zunsoft.cpp $(CC) $(CFLAGS) -mt -lt -DGAME=1 -nbin\th01\ $** masters.lib # Shared (game-independent code) diff --git a/master.hpp b/master.hpp index 3ef17470..d5e2095b 100644 --- a/master.hpp +++ b/master.hpp @@ -373,6 +373,12 @@ void MASTER_RET pfend(void); // Palette // ------- +#ifdef __cplusplus + inline char tone_black() { return 0; } + inline char tone_100() { return 100; } + inline char tone_white() { return 200; } +#endif + void MASTER_RET palette_show(void); #if !defined(__MASTER_H) diff --git a/th01/zunsoft.c b/th01/zunsoft.cpp similarity index 85% rename from th01/zunsoft.c rename to th01/zunsoft.cpp index af6505c9..f041a028 100644 --- a/th01/zunsoft.c +++ b/th01/zunsoft.cpp @@ -3,11 +3,15 @@ * ZUN Soft logo used in TH01, TH02 and TH03 */ -#include +extern "C" { +#include #include "platform.h" #include "pc98.h" #include "decomp.h" +#include "master.hpp" #include "th01/hardware/egc.h" +#include "th01/math/vector.hpp" +} #define CIRCLE_COUNT 4 #define STAR_COUNT 50 @@ -23,8 +27,8 @@ char wave_len; char wave_phase; char wave_amp; char wave_padding; -Point circle_pos[CIRCLE_COUNT]; -Point star_pos[STAR_COUNT]; +screen_point_t circle_pos[CIRCLE_COUNT]; +screen_point_t star_pos[STAR_COUNT]; int frame; int circle_speed_x[CIRCLE_COUNT]; int circle_speed_y[CIRCLE_COUNT]; @@ -69,12 +73,14 @@ void zunsoft_exit(void) egc_start(); } -void pascal vector2( - pixel_t *ret_x, pixel_t *ret_y, unsigned char angle, pixel_t length +// Different parameter list compared to the one from vector.hpp, but still +// similar enough that Borland C++ can't resolve the ambiguity. +void pascal zunsoft_vector2( + pixel_t &ret_x, pixel_t &ret_y, unsigned char angle, pixel_t length ) { - *ret_x = (length * (long)Cos8(angle)) >> 8; - *ret_y = (length * (long)Sin8(angle)) >> 8; + ret_x = polar_x(0, length, angle); + ret_y = polar_y(0, length, angle); } void objects_setup(void) @@ -137,7 +143,7 @@ void stars_render_and_update(void) grcg_pset(star_pos[i].x, star_pos[i].y); - vector2(&dx, &dy, star_angle, star_speed[i]); + zunsoft_vector2(dx, dy, star_angle, star_speed[i]); star_pos[i].x += dx; star_pos[i].y += dy; if(star_pos[i].x < 0) { @@ -226,11 +232,11 @@ hw_setup_done: objects_setup(); while(1) { if(frame > 180) { - if(tone <= 0) { + if(tone <= tone_black()) { break; } palette_settone(tone -= 2); - } else if(tone < 100) { + } else if(tone < tone_100()) { palette_settone(tone += 2); }