[Maintenance] [th03] Add a separate type for SPRITE16 sprite area offsets

Part of P0182, funded by Lmocinemod and [Anonymous].
This commit is contained in:
nmlgc 2022-02-10 04:39:40 +01:00
parent 49b898b6fb
commit 9b28791c7f
7 changed files with 21 additions and 11 deletions

View File

@ -38,4 +38,4 @@ static const vram_y_t SPRITE16_RES_Y = 200;
static const vram_byte_amount_t SPRITE16_PLANE_SIZE = (
SPRITE16_RES_Y * ROW_SIZE
);
static const vram_offset_t SPRITE16_SPRITES_OFFSET = SPRITE16_PLANE_SIZE;
static const vram_offset_t SPRITE16_OFFSET = SPRITE16_PLANE_SIZE;

View File

@ -13,4 +13,4 @@ OVERLAP_OR = 0
SPRITE16_RES_Y = 200
SPRITE16_PLANE_SIZE = (SPRITE16_RES_Y * ROW_SIZE)
SPRITE16_SPRITES_OFFSET = SPRITE16_PLANE_SIZE
SPRITE16_OFFSET = SPRITE16_PLANE_SIZE

3
pc98.h
View File

@ -17,6 +17,9 @@ typedef unsigned int upixel_t;
typedef int vram_byte_amount_t;
typedef int vram_word_amount_t;
typedef int vram_dword_amount_t;
typedef int uvram_byte_amount_t;
typedef int uvram_word_amount_t;
typedef int uvram_dword_amount_t;
// TRAM widths and object-space coordinates
typedef int tram_kanji_amount_t;

View File

@ -33,16 +33,16 @@ arg_bx far, @dst_page:word
push si
push di
push ds
mov src_seg, (SEG_PLANE_B + (SPRITE16_SPRITES_OFFSET / 16))
mov src_seg, (SEG_PLANE_B + (SPRITE16_OFFSET / 16))
call page_blit
call page_blit
mov src_seg, (SEG_PLANE_R + (SPRITE16_SPRITES_OFFSET / 16))
mov src_seg, (SEG_PLANE_R + (SPRITE16_OFFSET / 16))
call page_blit
call page_blit
mov src_seg, (SEG_PLANE_G + (SPRITE16_SPRITES_OFFSET / 16))
mov src_seg, (SEG_PLANE_G + (SPRITE16_OFFSET / 16))
call page_blit
call page_blit
mov src_seg, (SEG_PLANE_E + (SPRITE16_SPRITES_OFFSET / 16))
mov src_seg, (SEG_PLANE_E + (SPRITE16_OFFSET / 16))
call page_blit
call page_blit
pop ds

View File

@ -26,7 +26,7 @@ struct shotpair_t {
char unused_1;
PlayfieldPoint topleft;
Subpixel velocity_y;
unsigned int so_pid;
sprite16_offset_t so_pid;
unsigned char so_anim;
char unused_2;
unsigned char pid;

View File

@ -34,7 +34,7 @@ void pascal near shots_render(void)
for(int i = 0; i < SHOTPAIR_COUNT; i++, shotpair++) {
if(shotpair->flag) {
int so = shotpair->so_anim + shotpair->so_pid;
sprite16_offset_t so = (shotpair->so_anim + shotpair->so_pid);
screen_x_t left = playfield_fg_x_to_screen(
shotpair->topleft.x, shotpair->pid
);

View File

@ -1,5 +1,9 @@
#include "th03/hardware/vram.hpp"
// Relative offset inside the SPRITE16 sprite area, with 0 corresponding to
// SPRITE16_OFFSET.
typedef uvram_byte_amount_t sprite16_offset_t;
extern pixel_t sprite16_put_h;
extern VRAMWord sprite16_put_w;
extern screen_x_t sprite16_clip_left;
@ -29,12 +33,15 @@ void pascal sprite16_sprites_commit(void);
// the left and right clipping points, so make sure to hide at least 16 more
// pixels right of `sprite16_clip_left` and left of `sprite16_clip_right` on
// purpose.
void pascal sprite16_put(screen_x_t left, screen_y_t top, int sprite_offset);
void pascal sprite16_put(screen_x_t left, screen_y_t top, sprite16_offset_t so);
// Like sprite16_put(), but using an optional drawing function.
void pascal sprite16_putx(
screen_x_t left, screen_y_t top, int sprite_offset, sprite16_put_func_t func
screen_x_t left,
screen_y_t top,
sprite16_offset_t so,
sprite16_put_func_t func
);
// Like sprite16_put(), but ignores the clipping points.
void pascal sprite16_put_noclip(
screen_x_t left, screen_y_t top, int sprite_offset
screen_x_t left, screen_y_t top, sprite16_offset_t so
);