[Maintenance] Only define pi_load_put_8_free() a single time

The change of pi_free() from a macro to a function in TH05 doesn't
require a complete redefinition.

Part of P0124, funded by [Anonymous] and Blue Bolt.
This commit is contained in:
nmlgc 2020-10-25 14:02:12 +01:00
parent 3ee848f456
commit 774b172028
6 changed files with 15 additions and 28 deletions

View File

@ -15,6 +15,9 @@ int DEFCONV pi_load(int slot, const char *fn);
void DEFCONV pi_palette_apply(int slot);
#define pi_free(slot) \
graph_pi_free(&pi_headers[slot], pi_buffers[slot]);
// Displays the PI image in slot #[slot] at (⌊left/8⌋*8, top). Horizontally,
// the image is cut off at 640 pixels; vertically, it is wrapped if it exceeds
// the clipping frame defined via grc_setclip().
@ -24,4 +27,4 @@ void DEFCONV pi_put_8(screen_x_t left, vram_y_t top, int slot);
pi_load(slot, (fn)); \
pi_palette_apply(slot); \
pi_put_8(0, 0, slot); \
graph_pi_free(&pi_headers[slot], pi_buffers[slot]);
pi_free(slot); \

View File

@ -1,14 +1,6 @@
; PI-related macros. Need to be in a separate file because TASM doesn't seem
; to like macro definitions inside segments...
freePISlot macro slot
push ds
push offset _pi_headers + (slot * size PiHeader)
push word ptr _pi_buffers + (slot * dPtrSize) + 2
push word ptr _pi_buffers + (slot * dPtrSize)
call graph_pi_free
endm
freePISlotLarge macro slot
push ds
push offset _pi_headers + (slot * size PiHeader)

View File

@ -110,7 +110,7 @@ void pascal near pi_load_put_8_free_to(const char near *fn, char page)
graph_accesspage(page);
pi_palette_apply(0);
pi_put_8(0, 0, 0);
graph_pi_free(&pi_headers[0], pi_buffers[0]);
pi_free(0);
}
void op_animate(void)
@ -231,9 +231,9 @@ void start_demo(void)
resident->shottype = 0;
cfg_save();
text_clear();
graph_pi_free(&pi_headers[0], pi_buffers[0]);
graph_pi_free(&pi_headers[1], pi_buffers[1]);
graph_pi_free(&pi_headers[2], pi_buffers[2]);
pi_free(0);
pi_free(1);
pi_free(2);
gaiji_restore();
super_free();
game_exit();

View File

@ -34,7 +34,7 @@ void title_flash(void)
frame_delay(1);
}
graph_showpage(0);
graph_pi_free(&pi_headers[0], pi_buffers[0]);
graph_pi_free(&pi_headers[1], pi_buffers[1]);
graph_pi_free(&pi_headers[2], pi_buffers[2]);
pi_free(0);
pi_free(1);
pi_free(2);
}

View File

@ -213,9 +213,9 @@ void pascal shottype_menu(void)
input_delay = 0;
}
} while(1);
graph_pi_free(&pi_headers[0], pi_buffers[0]);
graph_pi_free(&pi_headers[1], pi_buffers[1]);
graph_pi_free(&pi_headers[2], pi_buffers[2]);
pi_free(0);
pi_free(1);
pi_free(2);
palette_black_out(1);
}

View File

@ -1,16 +1,8 @@
#include "th03/formats/pi.h"
#undef pi_free
int pascal pi_free(int slot);
#undef pi_load_put_8_free
static inline void pi_load_put_8_free(int slot, const char *fn) {
pi_load(slot, fn);
pi_palette_apply(slot);
pi_put_8(0, 0, slot);
pi_free(0);
}
// Like pi_put_8() and pi_put_quarter_8(), but applying the mask with the given
// ID while blitting.
int pascal pi_put_mask_8(screen_x_t left, vram_y_t top, int slot, int mask_id);