diff --git a/pc98.h b/pc98.h index 4d01df6b..ceba7d06 100644 --- a/pc98.h +++ b/pc98.h @@ -17,9 +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; +typedef unsigned int uvram_byte_amount_t; +typedef unsigned int uvram_word_amount_t; +typedef unsigned int uvram_dword_amount_t; // TRAM widths and object-space coordinates typedef int tram_ank_amount_t; diff --git a/th03/sprite16.cpp b/th03/sprite16.cpp index a58f5e26..1d6b5b7a 100644 --- a/th03/sprite16.cpp +++ b/th03/sprite16.cpp @@ -34,8 +34,8 @@ void pascal sprite16_sprites_commit(void) #define put_w_words (_AL) #define should_draw_column (_SI) -#define SETUP_VARS(left, top, sprite_offset) \ - sprite_offset_local = sprite_offset; \ +#define SETUP_VARS(left, top, so) \ + sprite_offset_local = so; \ putpos_left = left; \ put_w_words = sprite16_put_w.v; \ putpos_right_high ^= putpos_right_high; \ @@ -45,14 +45,14 @@ void pascal sprite16_sprites_commit(void) clip_left = sprite16_clip_left; \ clip_right = sprite16_clip_right; -#define CALL_PUT(left, top, put_w_words, sprite_offset) \ +#define CALL_PUT(left, top, put_w_words, so) \ _AH = SPRITE16_PUT; \ _DX = left; \ _BX = top; \ static_cast(_BX) >>= 1; \ _AL = put_w_words; \ _CX = sprite16_put_h; \ - _DI = sprite_offset; \ + _DI = so; \ geninterrupt(SPRITE16); \ #define CLIP_LEFT_PART \ @@ -74,9 +74,9 @@ void pascal sprite16_sprites_commit(void) } \ } while(putpos_right >= clip_right); -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) { - SETUP_VARS(left, top, sprite_offset); + SETUP_VARS(left, top, so); if(putpos_right < clip_right) { if(putpos_left >= clip_left) { put: @@ -99,10 +99,13 @@ put: #pragma codestring "\x90" 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 ) { - SETUP_VARS(left, top, sprite_offset); + SETUP_VARS(left, top, so); if(putpos_right < clip_right) { if(putpos_left >= clip_left) { put: @@ -142,12 +145,12 @@ end: #pragma codestring "\x90" 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 ) { // A completely useless SETUP_VARS variant without the `put_w_words` // assignment, which actually makes it incorrect... - sprite_offset_local = sprite_offset; + sprite_offset_local = so; putpos_left = left; putpos_right_high ^= putpos_right_high; static_cast(putpos_right) = put_w_words; diff --git a/th03/sprite16.hpp b/th03/sprite16.hpp index 3ba5f518..accc61e3 100644 --- a/th03/sprite16.hpp +++ b/th03/sprite16.hpp @@ -34,6 +34,7 @@ void pascal sprite16_sprites_commit(void); // 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, sprite16_offset_t so); + // Like sprite16_put(), but using an optional drawing function. void pascal sprite16_putx( screen_x_t left, @@ -41,6 +42,7 @@ void pascal sprite16_putx( 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, sprite16_offset_t so