Added pgm_sprite.h generator to makefiles

This commit is contained in:
Barry Harris 2011-12-15 11:27:03 +00:00
parent f5d4ad591b
commit 40731d9433
4 changed files with 155 additions and 10815 deletions

View File

@ -119,6 +119,7 @@ neo_sprite_func.h = $(srcdir)depend/generated/neo_sprite_func.h
cave_tile_func.h = $(srcdir)depend/generated/cave_tile_func.h
cave_sprite_func.h = $(srcdir)depend/generated/cave_sprite_func.h
psikyo_tile_func.h = $(srcdir)depend/generated/psikyo_tile_func.h
pgm_sprite.h = $(srcdir)depend/generated/pgm_sprite.h
build_details.h = $(srcdir)depend/generated/build_details.h
allobj = $(objdir)cpu/m68k/m68kcpu.o $(objdir)cpu/m68k/m68kopnz.o $(objdir)cpu/m68k/m68kopdm.o $(objdir)cpu/m68k/m68kopac.o $(objdir)cpu/m68k/m68kops.o \
@ -570,6 +571,19 @@ psikyo_tile.d psikyo_tile.o psikyosprite.d psikyo_sprite.o: $(psikyo_tile_func.h
$(psikyo_tile_func.h): $(srcdir)depend/scripts/psikyo_tile_func.pl
$(srcdir)depend/scripts/psikyo_tile_func.pl -o $(psikyo_tile_func.h)
#
# Extra rules for generated header file pgm_sprite.h, needed by pgm_draw.cpp
#
pgm_draw.d pgm_draw.o: $(pgm_sprite.h)
$(pgm_sprite.h): pgm_sprite_create.cpp
@echo Generating $(srcdir)depend/generated/$(@F)...
@$(CC) -mconsole $(CXXFLAGS) $(LDFLAGS) $< \
-o $(subst $(srcdir),$(objdir),$(<D))/$(<F:.cpp=.exe)
@$(subst $(srcdir),$(objdir),$(<D))/$(<F:.cpp=.exe) >$@
ifeq ($(MAKELEVEL),2)
ifdef DEPEND

View File

@ -116,7 +116,7 @@ neo_sprite_func.h = $(srcdir)depend/generated/neo_sprite_func.h
cave_tile_func.h = $(srcdir)depend/generated/cave_tile_func.h
cave_sprite_func.h = $(srcdir)depend/generated/cave_sprite_func.h
psikyo_tile_func.h = $(srcdir)depend/generated/psikyo_tile_func.h
# psikyo_sprite_func.h = $(srcdir)depend/generated/psikyo_sprite_func.h
pgm_sprite.h = $(srcdir)depend/generated/pgm_sprite.h
build_details.h = $(srcdir)depend/generated/build_details.h
allobj = $(objdir)cpu/m68k/m68kcpu.o $(objdir)cpu/m68k/m68kopnz.o $(objdir)cpu/m68k/m68kopdm.o $(objdir)cpu/m68k/m68kopac.o $(objdir)cpu/m68k/m68kops.o $(objdir)burner/win32/resource.res \
@ -447,6 +447,18 @@ psikyo_tile.o psikyo_sprite.o: $(psikyo_tile_func.h)
$(psikyo_tile_func.h): $(srcdir)depend/scripts/psikyo_tile_func.pl
$(srcdir)depend/scripts/psikyo_tile_func.pl -o $(psikyo_tile_func.h)
#
# Extra rules for generated header file pgm_sprite.h, needed by pgm_draw.cpp
#
pgm_draw.d pgm_draw.o: $(pgm_sprite.h)
$(pgm_sprite.h): pgm_sprite_create.cpp
@echo Generating $(srcdir)depend/generated/$(@F)...
@$(CC) -mconsole $(CXXFLAGS) $(LDFLAGS) $< \
-o $(subst $(srcdir),$(objdir),$(<D))/$(<F:.cpp=.exe)
@$(subst $(srcdir),$(objdir),$(<D))/$(<F:.cpp=.exe) >$@
#
# Generic rule for resource files
#

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,128 @@
#include <stdio.h>
int main()
{
printf ("typedef INT32 (*sprite_draw_function)(UINT16 *dest, UINT8 *adata, INT32 pal);\n");
printf ("typedef INT32 (*sprite_draw_nozoom_function)(UINT16 *dest, UINT8 *pdest, UINT8 *adata, INT32 pal, INT32 pri);\n\n");
int i,j;
for (i = 0; i < 0x100; i++)
{
if (i == 0xff)
printf ("static INT32 zoom_draw_%2.2x(UINT16 *dest, UINT8 *, INT32 )\n", i);
else
printf ("static INT32 zoom_draw_%2.2x(UINT16 *dest, UINT8 *adata, INT32 pal)\n", i);
printf ("{\n");
int cntr = 0;
for (j = 0; j < 8; j++)
{
if (i & (1 << j))
{
printf ("\tdest[%d] = 0x8000;\n", j);
}
else
{
printf ("\tdest[%d] = adata[%d] + pal;\n", j, cntr);
cntr++;
}
}
printf ("\n\treturn 0x%2.2x;\n}\n\n", cntr);
}
for (i = 0; i < 0x100; i++)
{
if (i == 0xff)
printf ("static INT32 nozoom_draw_%2.2x(UINT16 *, UINT8 *, UINT8 *, INT32 , INT32)\n", i);
else
printf ("static INT32 nozoom_draw_%2.2x(UINT16 *dest, UINT8 *pdest, UINT8 *adata, INT32 pal, INT32 prio)\n", i);
printf ("{\n");
int cntr = 0;
for (j = 0; j < 8; j++)
{
if (~i & (1 << j))
{
printf ("\tdest[%d] = adata[%d] + pal;\n", j, cntr);
printf ("\tpdest[%d] = prio;\n", j);
cntr++;
}
}
printf ("\n\treturn 0x%2.2x;}\n\n\n", cntr);
}
for (i = 0; i < 0x100; i++)
{
if (i == 0xff)
printf ("static INT32 nozoom_draw_flipx_%2.2x(UINT16 *, UINT8 *, UINT8 *, INT32 , INT32)\n", i);
else
printf ("static INT32 nozoom_draw_flipx_%2.2x(UINT16 *dest, UINT8 *pdest, UINT8 *adata, INT32 pal, INT32 prio)\n", i);
printf ("{\n");
int cntr = 0;
for (j = 0; j < 8; j++)
{
if (~i & (1 << j))
{
printf ("\tdest[%d] = adata[%d] + pal;\n", 7-j, cntr);
printf ("\tpdest[%d] = prio;\n", 7-j);
cntr++;
}
}
printf ("\n\treturn 0x%2.2x;\n}\n\n", cntr);
}
printf ("static sprite_draw_function zoom_draw_table[0x100] = {\n");
for (i = 0; i < 0x100; i++)
{
if ((i & 0x0f) == 0) printf ("\t");
printf ("&zoom_draw_%2.2x", i);
if (i != 0xff) printf (",");
if ((i & 0x0f)==0x0f) {
printf ("\n");
} else {
printf (" ");
}
}
printf ("};\n\n");
printf ("static sprite_draw_nozoom_function nozoom_draw_table[2][0x100] =\n{\n");
printf ("\t{\t\n");
for (i = 0; i < 0x100; i++)
{
if ((i & 0x0f) == 0) printf ("\t\t");
printf ("&nozoom_draw_%2.2x", i);
if (i != 0xff) printf (",");
if ((i & 0x0f)==0x0f) {
printf ("\n");
} else {
printf (" ");
}
}
printf ("\t},\n");
printf ("\t{\t\n");
for (i = 0; i < 0x100; i++)
{
if ((i & 0x0f) == 0) printf ("\t\t");
printf ("&nozoom_draw_flipx_%2.2x", i);
if (i != 0xff) printf (",");
if ((i & 0x0f)==0x0f) {
printf ("\n");
} else {
printf (" ");
}
}
printf ("\t}\n};\n\n");
return 0;
}