Skip to content

Commit

Permalink
[Separate translation units] [th02] game_exit()
Browse files Browse the repository at this point in the history
Part of P0133, funded by [Anonymous].
  • Loading branch information
nmlgc committed Jan 31, 2021
1 parent 84d4914 commit e8588b1
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 42 deletions.
6 changes: 3 additions & 3 deletions Makefile.mak
Expand Up @@ -78,17 +78,17 @@ bin\th02\zun_res.com: th02\zun_res1.c th02\zun_res2.c th02\zun_res3.c
$**
| masters.lib

bin\th02\op.exe: th02\op_01.cpp bin\exit_dos.obj bin\th02\zunerror.obj bin\th02\grppsafx.obj bin\th02\op.obj th02\op_02_1.cpp bin\th02\pi_load.obj bin\th02\grp_rect.obj bin\frmdely2.obj th02\op_02_2.cpp bin\th02\snd_mmdr.obj bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_load.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj th02\op_02_3.cpp bin\th02\snd_se.obj bin\frmdely1.obj th02\op_03.cpp th02\op_04.cpp th02\op_05.cpp th02\op_06.cpp
bin\th02\op.exe: th02\op_01.cpp bin\exit_dos.obj bin\th02\zunerror.obj bin\th02\grppsafx.obj bin\th02\op.obj th02\op_02_1.cpp bin\th02\pi_load.obj bin\th02\grp_rect.obj bin\frmdely2.obj th02\op_02_2.cpp bin\th02\exit.obj bin\th02\snd_mmdr.obj bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_load.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj th02\op_02_3.cpp bin\th02\snd_se.obj bin\frmdely1.obj th02\op_03.cpp th02\op_04.cpp th02\op_05.cpp th02\op_06.cpp
$(CC) $(CFLAGS) -ml -Z -DGAME=2 -nbin\th02\ -eOP.EXE @&&|
$**
|

bin\th02\main.exe: bin\th02\main.obj bin\th02\zunerror.obj th02\main02_1.cpp bin\th02\pi_load.obj bin\th02\vector.obj bin\frmdely1.obj th02\main02_2.cpp bin\th02\snd_mmdr.obj bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_dlyv.obj bin\th02\snd_load.obj th02\mptn_i.cpp bin\th02\initmain.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj bin\th02\snd_dlym.obj bin\th02\snd_se.obj th02\main_03.cpp
bin\th02\main.exe: bin\th02\main.obj bin\th02\zunerror.obj th02\main02_1.cpp bin\th02\pi_load.obj bin\th02\vector.obj bin\frmdely1.obj th02\main02_2.cpp bin\th02\exit.obj bin\th02\snd_mmdr.obj bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_dlyv.obj bin\th02\snd_load.obj th02\mptn_i.cpp bin\th02\initmain.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj bin\th02\snd_dlym.obj bin\th02\snd_se.obj th02\main_03.cpp
$(CC) $(CFLAGS) -ml -Z -DGAME=2 -nbin\th02\ -eMAIN.EXE @&&|
$**
|

bin\th02\maine.exe: bin\th02\maine.obj bin\th02\grppsafx.obj th02\maine021.cpp bin\th02\pi_load.obj bin\frmdely1.obj th02\maine022.cpp bin\th02\snd_mmdr.obj bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_load.obj bin\th02\initmain.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj bin\th02\snd_dlym.obj th02\maine_03.c th02\maine_04.cpp th02\maine_05.cpp
bin\th02\maine.exe: bin\th02\maine.obj bin\th02\grppsafx.obj th02\maine021.cpp bin\th02\pi_load.obj bin\frmdely1.obj th02\maine022.cpp bin\th02\exit.obj bin\th02\snd_mmdr.obj bin\th02\snd_mode.obj bin\th02\snd_pmdr.obj bin\th02\snd_load.obj bin\th02\initmain.obj bin\th02\pi_put.obj bin\th02\snd_kaja.obj bin\th02\snd_dlym.obj th02\maine_03.c th02\maine_04.cpp th02\maine_05.cpp
$(CC) $(CFLAGS) -ml -3 -Z -DGAME=2 -nbin\th02\ -eMAINE.EXE @&&|
$**
|
Expand Down
31 changes: 31 additions & 0 deletions th02/core/exit.c
@@ -0,0 +1,31 @@
#pragma codeseg SHARED

#include <dos.h>
#include "master.hpp"
#include "th02/core/initexit.h"

void game_exit(void)
{
pfend();
graph_clear_both();

#if (GAME >= 4)
mem_unassign();
vsync_end();
#else
vsync_end();
mem_unassign();
#endif

text_clear();

#if (GAME >= 3)
js_end();
#endif

egc_start();

#if (GAME >= 4)
bgm_finish();
#endif
}
5 changes: 5 additions & 0 deletions th02/core/initexit.h
Expand Up @@ -5,3 +5,8 @@

void game_exit(void);
void game_exit_to_dos(void);

#define graph_clear_both() \
graph_accesspage(1); graph_clear(); \
graph_accesspage(0); graph_clear(); \
graph_accesspage(0); graph_showpage(0);
1 change: 1 addition & 0 deletions th02/core/initop.cpp
@@ -1,3 +1,4 @@
#include <dos.h>
#include "th01/hardware/vplanset.h"

int game_init_op(void)
Expand Down
26 changes: 1 addition & 25 deletions th02/exit.c
@@ -1,25 +1 @@
void game_exit(void)
{
pfend();
graph_clear_both();

#if GAME >= 4
mem_unassign();
vsync_end();
#else
vsync_end();
mem_unassign();
#endif

text_clear();

#if GAME >= 3
js_end();
#endif

egc_start();

#if GAME >= 4
bgm_finish();
#endif
}
#include "th02/core/exit.c"
4 changes: 1 addition & 3 deletions th02/main02_2.cpp
Expand Up @@ -7,12 +7,10 @@
#pragma option -3

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

#include "th02/hardware/input.c"
#include "th02/exit.c"
}
4 changes: 1 addition & 3 deletions th02/maine022.cpp
Expand Up @@ -6,8 +6,7 @@
#pragma codeseg SHARED

extern "C" {
#include <dos.h>
#include "th02/th02.h"
#include "platform.h"
#include "master.hpp"
#include "th02/hardware/frmdelay.h"
#include "th02/hardware/input.hpp"
Expand All @@ -17,5 +16,4 @@ extern "C" {
extern const char pf_fn[] = PF_FN;

#include "th02/hardware/input.c"
#include "th02/exit.c"
}
4 changes: 1 addition & 3 deletions th02/op_02_2.cpp
Expand Up @@ -7,8 +7,7 @@
#pragma option -3

extern "C" {
#include <dos.h>
#include "th02/th02.h"
#include "platform.h"
#include "master.hpp"
#include "th02/mem.h"
#include "th02/core/initexit.h"
Expand All @@ -22,5 +21,4 @@ const char pf_fn[] = PF_FN;

#include "th02/hardware/input.c"
#include "th02/core/initop.cpp"
#include "th02/exit.c"
}
5 changes: 0 additions & 5 deletions th02/th02.h
Expand Up @@ -10,11 +10,6 @@

// Hardware
// -------
#define graph_clear_both() \
graph_accesspage(1); graph_clear(); \
graph_accesspage(0); graph_clear(); \
graph_accesspage(0); graph_showpage(0);

#include "th01/hardware/grppsafx.h"
// -------

Expand Down

0 comments on commit e8588b1

Please sign in to comment.