[Maintenance] Clean up PI function declarations and comments

This commit is contained in:
nmlgc 2019-12-15 20:17:00 +01:00
parent deb1b73016
commit 75a779e82a
25 changed files with 39 additions and 37 deletions

View File

@ -1,8 +1,26 @@
#include "defconv.h"
#if GAME == 5
# define PI_COUNT 8
#else
# define PI_COUNT 6
#endif
// Global PI file slots.
extern PiHeader pi_slot_headers[PI_COUNT];
extern void far *pi_slot_buffers[PI_COUNT];
// ≥TH03 free any previously loaded PI in the given slot before loading [fn].
int DEFCONV pi_slot_load(int slot, const char *fn);
void DEFCONV pi_slot_palette_apply(int slot);
// Displays the PI image in slot #[slot] at ([x], [y]). If the image exceeds
// the screen resolution, it is wrapped vertically and cut off horizontally.
void DEFCONV pi_slot_put(int x, int y, int slot);
#define pi_load_put_free(slot, fn) \
pi_slot_load(slot, (fn)); \
pi_slot_palette_apply(slot); \
pi_slot_put(0, 0, slot); \
graph_pi_free(&pi_slot_headers[slot], pi_slot_buffers[slot]);

View File

@ -4,8 +4,6 @@ void pi_slot_palette_apply(int slot)
palette_show();
}
// Displays the PI image in slot #[slot] at [x],[y]. If the image exceeds the
// screen resolution, it is wrapped vertically and cut off horizontally.
void pi_slot_put(int x, int y, int slot)
{
char *row_p = pi_slot_buffers[slot];

View File

@ -1,4 +1,3 @@
; int DEFCONV pi_slot_load(int slot, char *fn)
proc_defconv pi_slot_load
arg @@slot:word, @@fn:dword
local @@ret

View File

@ -1,4 +1,3 @@
; int DEFCONV pi_slot_palette_apply(int slot)
if GAME ge 3
align 2
endif

View File

@ -1,7 +1,3 @@
; Displays the PI image in slot #[slot] at [x],[y]. If the image exceeds the
; screen resolution, it is wrapped vertically and cut off horizontally.
; int DEFCONV pi_slot_put(int x, int y, int slot)
proc_defconv pi_slot_put
arg @@x:word, @@y:word, @@slot:word
if GAME ge 3

View File

@ -1,5 +1,3 @@
; Global PI file slots.
public _pi_slot_buffers, _pi_slot_headers
_pi_slot_buffers dd 6 dup(?)
_pi_slot_headers PiHeader 6 dup(<?>)

View File

@ -4,6 +4,7 @@
*/
#include "th02/th02.h"
#include "th02/formats/pi.h"
#pragma codeseg main_02_TEXT
#pragma option -3

View File

@ -4,6 +4,7 @@
*/
#include "th02/th02.h"
#include "th02/formats/pi.h"
#include "th02/mem.h"
#pragma codeseg main_02_TEXT

View File

@ -6,6 +6,7 @@
#pragma codeseg maine_02_TEXT
#include "th02/th02.h"
#include "th02/formats/pi.h"
#include "th02/hardware/grppsafx.c"
#include "th02/hardware/keydelay.c"

View File

@ -5,6 +5,7 @@
#include "th02/th02.h"
#include "th02/mem.h"
#include "th02/formats/pi.h"
#pragma codeseg maine_02_TEXT

View File

@ -6,6 +6,7 @@
#include <process.h>
#include "th02/th02.h"
#include "th02/initexit.h"
#include "th02/formats/pi.h"
#pragma option -d

View File

@ -5,6 +5,7 @@
#include "th02/th02.h"
#include "th02/initexit.h"
#include "th02/formats/pi.h"
#pragma codeseg op_02_TEXT
#pragma option -3

View File

@ -6,6 +6,7 @@
#include "th02/th02.h"
#include "th02/mem.h"
#include "th02/initexit.h"
#include "th02/formats/pi.h"
#pragma codeseg op_02_TEXT
#pragma option -3

View File

@ -4,6 +4,7 @@
*/
#include "th02\th02.h"
#include "th02/formats/pi.h"
void title_flash(void)
{

View File

@ -4,6 +4,7 @@
*/
#include "th02\th02.h"
#include "th02/formats/pi.h"
char sel = 1;

View File

@ -4,6 +4,7 @@
*/
#include "th02\th02.h"
#include "th02/formats/pi.h"
#define TRACK_COUNT sizeof(MUSIC_FILES) / sizeof(MUSIC_FILES[0])
#define SEL_QUIT TRACK_COUNT + 1

View File

@ -25,21 +25,6 @@ int pascal mptn_load(const char *fn);
void pascal mptn_palette_show(void);
void pascal mptn_free(void);
#define PI_SLOTS 6
extern void far *pi_slot_buffers[PI_SLOTS];
extern PiHeader pi_slot_headers[PI_SLOTS];
int pi_slot_load(int slot, const char *fn);
void pi_slot_palette_apply(int slot);
void pi_slot_put(int x, int y, int slot);
#define pi_load_put_free(slot, fn) \
pi_slot_load(slot, (fn)); \
pi_slot_palette_apply(slot); \
pi_slot_put(0, 0, slot); \
graph_pi_free(&pi_slot_headers[slot], pi_slot_buffers[slot]);
// "東方封魔.録" in Shift-JIS
#define PF_FN "\x93\x8C\x95\xFB\x95\x95\x96\x82\x2E\x98\x5E"
#define PF_KEY 0x12

8
th03/formats/pi.h Normal file
View File

@ -0,0 +1,8 @@
#include "th02/formats/pi.h"
// Like pi_slot_put(), but only displays every second row in the given PI.
int pascal pi_slot_put_interlace(int x, int y, int slot);
// Displays the n-th 320x200 [quarter], counted from the top left, of the PI
// image in slot #[slot] at ([x], [y]).
int pascal pi_slot_put_quarter(int x, int y, int slot, int quarter);

View File

@ -1,6 +1,3 @@
; Copy of pi_slot_put() that only displays every second row in the given PI.
; int DEFCONV pi_slot_put_interlace(int x, int y, int slot)
proc_defconv pi_slot_put_interlace
arg @@x:word, @@y:word, @@slot:word
local @@row_num:word, @@row_buf:dword

View File

@ -1,7 +1,3 @@
; Displays the n-th 320x200 [quarter], counted from the top left, of the PI
; image in slot #[slot] at [x],[y].
; int DEFCONV pi_slot_put_quarter(int x, int y, int slot, int quarter)
proc_defconv pi_slot_put_quarter
arg @@x:word, @@y:word, @@slot:word, @@quarter:word
local @@row_num:word, @@row_buf:dword

3
th05/formats/pi.h Normal file
View File

@ -0,0 +1,3 @@
#include "th03/formats/pi.h"
int pascal pi_slot_free(int slot);

View File

@ -1,4 +1,3 @@
; int __pascal pi_slot_free(int slot)
func pi_slot_free
@@slot = word ptr 4

View File

@ -1,4 +1,3 @@
; int __stdcall pi_load(char *fn, int slot)
func pi_slot_load
@@fn = DPTR_ (cPtrSize + 2)
@@slot = word ptr (cPtrSize + 2 + dPtrSize)

View File

@ -1,4 +1,3 @@
; int __cdecl pi_slot_palette_apply(int slot)
pi_slot_palette_apply proc
@@slot = word ptr cPtrSize

View File

@ -1,4 +1,3 @@
; int DEFCONV pi_slot_put(int x, int y, int slot)
proc_defconv pi_slot_put
@@slot = word ptr [bp + (cPtrSize + 2)]
@@y = word ptr [bp + (cPtrSize + 4)]
@ -30,7 +29,6 @@ endp_defconv
; ---------------------------------------------------------------------------
; int DEFCONV pi_slot_put_quarter(int x, int y, int slot, int quarter)
proc_defconv pi_slot_put_quarter
@@quarter = byte ptr [bp + (cPtrSize + 2)]
@@slot = word ptr [bp + (cPtrSize + 4)]