Skip to content

Commit

Permalink
[Maintenance] Complete the master.hpp transition
Browse files Browse the repository at this point in the history
Part of P0133, funded by [Anonymous].
  • Loading branch information
nmlgc committed Jan 30, 2021
1 parent eeb4e7e commit 0ce869c
Show file tree
Hide file tree
Showing 44 changed files with 90 additions and 25 deletions.
1 change: 0 additions & 1 deletion ReC98.h
Expand Up @@ -6,7 +6,6 @@
#ifndef REC98_H
#define REC98_H

#include <master.h>
#include <stddef.h>
#include "platform.h"
#include "pc98.h"
Expand Down
5 changes: 5 additions & 0 deletions decomp.h
Expand Up @@ -57,6 +57,11 @@
// types.
#ifdef __cplusplus
}
#if defined(__TURBOC__) && defined(__MSDOS__)
// Declared in <dos.h> in these compilers.
void __emit__(unsigned char __byte, ...);
#endif

struct Decomp_ES { void __seg* value() { return (void __seg *)(_ES); } };
struct Decomp_FS { void __seg* value() { return (void __seg *)(_FS); } };
struct Decomp_GS { void __seg* value() { return (void __seg *)(_GS); } };
Expand Down
12 changes: 10 additions & 2 deletions master.hpp
Expand Up @@ -69,6 +69,9 @@ struct point_t {
/// ----------------------------------------------------------------------
/// TODO: Remove the `!defined(__MASTER_H)` branches once we've gotten rid of
/// of master.h.
#ifdef __cplusplus
extern "C" {
#endif

// DOS
// ---
Expand Down Expand Up @@ -208,8 +211,10 @@ void MASTER_RET grcg_off(void);

#define grcg_setmode(mode) \
outportb(0x7C, mode)
#define grcg_off() \
outportb(0x7C, 0)
#if (GAME != 2)
#define grcg_off() \
outportb(0x7C, 0)
#endif
#endif

#if defined(PC98_H) && defined(__cplusplus)
Expand Down Expand Up @@ -578,6 +583,9 @@ extern unsigned volatile int vsync_Count1, vsync_Count2;
void MASTER_RET vsync_start(void);
void MASTER_RET vsync_end(void);
// -----
#ifdef __cplusplus
}
#endif
/// ----------------------------------------------------------------------

/// Inlined extensions
Expand Down
3 changes: 3 additions & 0 deletions th01/fuuin_02.cpp
Expand Up @@ -6,11 +6,14 @@
#pragma option -O- -1 -Z-

extern "C" {
#include <dos.h>
#include <io.h>
#include <stdio.h>
#include <string.h>
#include "ReC98.h"
#include "pc98kbd.h"
#include "twobyte.h"
#include "master.hpp"
#include "th01/ranks.h"
#include "th01/hardware/graph.h"
#include "th01/hardware/input.hpp"
Expand Down
1 change: 1 addition & 0 deletions th01/fuuin_04.cpp
Expand Up @@ -7,6 +7,7 @@

extern "C" {
#include "ReC98.h"
#include "master.hpp"
#include "th01/formats/grp.h"
#include "th01/hardware/graph.h"
#include "th01/hardware/palette.h"
Expand Down
8 changes: 5 additions & 3 deletions th01/hardware/graph.cpp
@@ -1,8 +1,10 @@
extern "C" {
#include <dos.h>
#include <mem.h>
#include <mbctype.h>
#include <mbstring.h>
#include "ReC98.h"
#include "master.hpp"
#include "th01/hardware/egc.h"
#include "th01/hardware/vsync.h"
#include "th01/hardware/graph.h"
Expand Down Expand Up @@ -394,7 +396,7 @@ int z_graph_readdot(screen_x_t x, vram_y_t y)
/// Restorable line drawing
/// -----------------------
// Never read from, so it's supposedly only there for debugging purposes?
extern Point graph_r_last_line_end;
extern screen_point_t graph_r_last_line_end;
// `true` copies the pixels to be drawn from the same position on page 1, thus
// restoring them with the background image. `false` (the default) draws them
// regularly in the given [col].
Expand All @@ -417,7 +419,7 @@ void graph_r_hline(screen_x_t left, screen_x_t right, vram_y_t y, int col)
graph_r_last_line_end.x = right;
graph_r_last_line_end.y = y;

vram_row = (dots8_t *)(MK_FP(GRAM_400, vram_offset_muldiv(left, y)));
vram_row = (dots8_t *)(MK_FP(SEG_PLANE_B, vram_offset_muldiv(left, y)));
full_bytes_to_put = (right / BYTE_DOTS) - (left / BYTE_DOTS);
left_pixels = 0xFF >> (left & (BYTE_DOTS - 1));
right_pixels = 0xFF << ((BYTE_DOTS - 1) - (right & (BYTE_DOTS - 1)));
Expand Down Expand Up @@ -663,7 +665,7 @@ void z_grcg_boxfill(
clip_y(top, bottom);

grcg_setcolor_rmw(col);
vram_row = (dots8_t *)(MK_FP(GRAM_400, vram_offset_mulshift(left, top)));
vram_row = (dots8_t *)(MK_FP(SEG_PLANE_B, vram_offset_mulshift(left, top)));
for(y = top; y <= bottom; y++) {
full_bytes_to_put = (right >> 3) - (left >> 3);
left_pixels = 0xFF >> (left & (BYTE_DOTS - 1));
Expand Down
2 changes: 1 addition & 1 deletion th01/hardware/grppsafx.cpp
@@ -1,7 +1,7 @@
// Shared parts from all graph_putsa_fx() implementations

#define set_vram_ptr(vram, first_bit, left, top) \
vram = (dots8_t *)(MK_FP(GRAM_400, vram_offset_muldiv(left, top))); \
vram = (dots8_t *)(MK_FP(SEG_PLANE_B, vram_offset_muldiv(left, top))); \
first_bit = (left % BYTE_DOTS); \

#define get_glyph(glyph, codepoint, fullwidth, str, left, line) \
Expand Down
2 changes: 1 addition & 1 deletion th01/main/bullet/laser_s.cpp
@@ -1,8 +1,8 @@
extern "C" {
#include "libs/master.lib/master.h"
#include "platform.h"
#include "pc98.h"
#include "planar.h"
#include "master.hpp"
#include "th01/sprites/laser_s.h"
#include "th01/hardware/egc.h"
#include "th01/hardware/graph.h"
Expand Down
1 change: 1 addition & 0 deletions th01/main_01_.cpp
Expand Up @@ -7,6 +7,7 @@

extern "C" {
#include "ReC98.h"
#include "master.hpp"
#include "th01/hardware/egc.h"
#include "th01/main/playfld.hpp"
#include "th01/main/player/player.hpp"
Expand Down
2 changes: 2 additions & 0 deletions th01/main_07.cpp
Expand Up @@ -4,7 +4,9 @@
*/

extern "C" {
#include <dos.h>
#include "ReC98.h"
#include "master.hpp"
#include "th01/hardware/graph.h"

#include "th01/formats/ptn_0to1.cpp"
Expand Down
2 changes: 1 addition & 1 deletion th01/main_13.cpp
Expand Up @@ -8,11 +8,11 @@
extern "C" {

#include <dos.h>
#include "libs/master.lib/master.h"
#include "platform.h"
#include "pc98.h"
#include "planar.h"
#include "decomp.h"
#include "master.hpp"
#include "th01/hardware/egc.h"
#include "th01/hardware/graph.h"

Expand Down
3 changes: 3 additions & 0 deletions th01/main_19.cpp
Expand Up @@ -6,10 +6,13 @@
#pragma option -d

extern "C" {
#include <dos.h>
#include <io.h>
#include <stdio.h>
#include <string.h>
#include "ReC98.h"
#include "twobyte.h"
#include "master.hpp"
#include "th01/ranks.h"
#include "th01/formats/grp.h"
#include "th01/hardware/palette.h"
Expand Down
3 changes: 2 additions & 1 deletion th01/main_23.cpp
Expand Up @@ -4,7 +4,8 @@
*/

extern "C" {
#include "libs/master.lib/master.h"
#include <dos.h>
#include "master.hpp"
#include "th01/formats/grc.cpp"
#include "th01/hardware/grcg8x8m.cpp"
#include "th01/hardware/egc.h"
Expand Down
2 changes: 1 addition & 1 deletion th01/math/vector.cpp
@@ -1,8 +1,8 @@
extern "C" {

#include <master.h>
#include "platform.h"
#include "pc98.h"
#include "master.hpp"
#include "th01/math/vector.hpp"

void vector2_between(
Expand Down
3 changes: 3 additions & 0 deletions th01/op_01.cpp
Expand Up @@ -4,9 +4,12 @@
*/

extern "C" {
#include <dos.h>
#include <mem.h>
#include <stdio.h>
#include "ReC98.h"
#include "pc98kbd.h"
#include "master.hpp"
#include "th01/ranks.h"
#include "th01/hardware/egc.h"
#include "th01/hardware/graph.h"
Expand Down
2 changes: 2 additions & 0 deletions th01/op_07.cpp
Expand Up @@ -4,7 +4,9 @@
*/

extern "C" {
#include <dos.h>
#include "ReC98.h"
#include "master.hpp"
#include "th01/hardware/graph.h"

#include "th01/formats/ptn_0to1.cpp"
Expand Down
6 changes: 3 additions & 3 deletions th02/exit_dos.c
@@ -1,12 +1,12 @@
#pragma codeseg SHARED

#include "libs/master.lib/master.h"
#include "master.hpp"
#include "th02/core/initexit.h"

void game_exit_to_dos(void)
{
game_exit();
key_beep_on();
text_systemline_on();
text_cursor_on();
text_systemline_show();
text_cursor_show();
}
2 changes: 1 addition & 1 deletion th02/frmdely2.c
@@ -1,6 +1,6 @@
#pragma codeseg SHARED

#include "libs/master.lib/master.h"
#include "master.hpp"
#include "th02/hardware/frmdelay.h"

void pascal far frame_delay_2(int frames)
Expand Down
2 changes: 1 addition & 1 deletion th02/hardware/frmdely1.c
@@ -1,6 +1,6 @@
#pragma codeseg SHARED

#include "libs/master.lib/master.h"
#include "master.hpp"
#include "th02/hardware/frmdelay.h"

void pascal frame_delay(int frames)
Expand Down
3 changes: 2 additions & 1 deletion th02/hardware/grppsafx.cpp
Expand Up @@ -2,12 +2,13 @@
#pragma option -3

extern "C" {
#include <dos.h>
#include <mbctype.h>
#include <mbstring.h>
#include "libs/master.lib/master.h"
#include "platform.h"
#include "pc98.h"
#include "planar.h"
#include "master.hpp"
#include "th01/hardware/grppsafx.h"

#include "th01/hardware/grppsafx.cpp"
Expand Down
4 changes: 2 additions & 2 deletions th02/initop.c
Expand Up @@ -17,8 +17,8 @@ int game_init_op(void)
graph_clear_both();
vsync_start();
key_beep_off();
text_systemline_off();
text_cursor_off();
text_systemline_hide();
text_cursor_hide();
egc_start();
pfkey = PF_KEY;
pfstart(pf_fn);
Expand Down
3 changes: 2 additions & 1 deletion th02/main02_1.cpp
Expand Up @@ -7,8 +7,9 @@
#pragma option -3

extern "C" {

#include <dos.h>
#include "th02/th02.h"
#include "master.hpp"
#include "th02/hardware/frmdelay.h"

#include "th02/hardware/keydelay.c"
Expand Down
3 changes: 3 additions & 0 deletions th02/main02_2.cpp
Expand Up @@ -7,8 +7,11 @@
#pragma option -3

extern "C" {
#include <dos.h>
#include <mem.h>
#include "libs/kaja/kaja.h"
#include "th02/th02.h"
#include "master.hpp"
#include "th02/hardware/frmdelay.h"
#include "th02/hardware/input.hpp"
#include "th02/mem.h"
Expand Down
2 changes: 2 additions & 0 deletions th02/maine022.cpp
Expand Up @@ -6,8 +6,10 @@
#pragma codeseg SHARED

extern "C" {
#include <dos.h>
#include "libs/kaja/kaja.h"
#include "th02/th02.h"
#include "master.hpp"
#include "th02/hardware/frmdelay.h"
#include "th02/hardware/input.hpp"
#include "th02/mem.h"
Expand Down
2 changes: 2 additions & 0 deletions th02/maine_04.cpp
Expand Up @@ -4,7 +4,9 @@
*/

extern "C" {
#include <dos.h>
#include "th02/th02.h"
#include "master.hpp"
#include "th02/resident.hpp"
#include "th02/hardware/frmdelay.h"
#include "th02/hardware/input.hpp"
Expand Down
2 changes: 2 additions & 0 deletions th02/maine_05.cpp
Expand Up @@ -4,7 +4,9 @@
*/

extern "C" {
#include <dos.h>
#include "th02/th02.h"
#include "master.hpp"
#include "th02/math/vector.hpp"
#include "th02/hardware/frmdelay.h"

Expand Down
1 change: 1 addition & 0 deletions th02/op_01.cpp
Expand Up @@ -4,6 +4,7 @@
*/

extern "C" {
#include <dos.h>
#include <process.h>
#include "libs/kaja/kaja.h"
#include "th02/th02.h"
Expand Down
2 changes: 2 additions & 0 deletions th02/op_02_2.cpp
Expand Up @@ -7,8 +7,10 @@
#pragma option -3

extern "C" {
#include <dos.h>
#include "libs/kaja/kaja.h"
#include "th02/th02.h"
#include "master.hpp"
#include "th02/mem.h"
#include "th02/core/initexit.h"
#include "th02/snd/snd.h"
Expand Down
2 changes: 2 additions & 0 deletions th02/op_03.cpp
Expand Up @@ -4,7 +4,9 @@
*/

extern "C" {
#include <dos.h>
#include "th02/th02.h"
#include "master.hpp"
#include "th02/hardware/frmdelay.h"
#include "th02/formats/pi.h"
#include "th02/snd/snd.h"
Expand Down
1 change: 1 addition & 0 deletions th02/op_04.cpp
Expand Up @@ -4,6 +4,7 @@
*/

extern "C" {
#include <dos.h>
#include <mbctype.h>
#include <mbstring.h>
#include "th02/th02.h"
Expand Down
2 changes: 2 additions & 0 deletions th02/op_05.cpp
Expand Up @@ -4,7 +4,9 @@
*/

extern "C" {
#include <dos.h>
#include "th02/th02.h"
#include "master.hpp"
#include "th02/resident.hpp"
#include "th02/hardware/frmdelay.h"
#include "th02/hardware/grp_rect.h"
Expand Down
1 change: 1 addition & 0 deletions th02/op_06.cpp
Expand Up @@ -4,6 +4,7 @@
*/

extern "C" {
#include <dos.h>
#include "libs/kaja/kaja.h"
#include "th02/th02.h"
#include "master.hpp"
Expand Down
2 changes: 2 additions & 0 deletions th02/zun_res1.c
Expand Up @@ -4,8 +4,10 @@
* configuration file required in order to run TH02.
*/

#include <dos.h>
#include <stddef.h>
#include "th02/th02.h"
#include "master.hpp"
#include "th02/resident.hpp"
#include "th02/snd/snd.h"
#include "th02/formats/cfg.h"
Expand Down

0 comments on commit 0ce869c

Please sign in to comment.