Converting graphics with each change can be a pain. You have to open it it in GIMP, change the color settings and then save it. Then you have to run gconvert, then go through and do a find/replace to set the transparent regions. This Windows batch file makes this much easier!
The XVI32 hex-editor can be scripted so the transparency conversion can be automatic! It just replaces the color values. In my case, I use a dark gray color (MS Paint) (HEX 0x5b) and convert that value to 0xfe. If you use a different color just look up 0, x, 5, and b on an ASCII chart and find the hex values. You should only need to change the last two values.
Makeit.bat
Code: Select all
@echo off
SET initidir=%cd%
SET datadir=..\data
SET binsdir=..\..\..\bin
SET emulator=..\..\..\bin\uzem2.exe
:: Run or compile?
if [%1] EQU [] (
echo.
) ELSE (
echo Will now run the specified game...
%emulator% %1
exit
)
:MENU
CLS
echo *************************************************************************
echo Welcome to the MAKEIT program.
echo Function Description
echo --------------- ------------------------
echo (1) Gconvert Convert graphics assets (use first!)
echo (2) Compile Compile program then run Uzem
echo (3) Gconvert and Compile Do options 1 and then 2
echo (4) EXIT Exit out of this program
echo.
echo Chose your option from the list above.
echo.
echo *************************************************************************
echo.
:WHATchoice
set /p whichchoice={ Press the NUMBER of the choice that you want. }
cls
echo.
if '%whichchoice%'=='1' GOTO OPTION-1
if '%whichchoice%'=='2' GOTO OPTION-2
if '%whichchoice%'=='3' GOTO OPTION-3
if '%whichchoice%'=='4' GOTO OPTION-4
GOTO MENU
:OPTION-1
:: Run Gconvert
echo.
echo.
echo Running gconvert for TILES
cd %datadir%
%binsdir%\gconvert.exe convert_tiles.xml
echo.
echo Running gconvert for SPRITES
cd %datadir%
%binsdir%\gconvert.exe convert_sprites.xml
echo.
echo.
echo Running XVI32.exe with script to replace the transparent regions.
echo REMEMBER: Dark gray (0x5b) will be replaced with 0xfe !
%binsdir%\XVI32.exe %datadir%\sprites.inc /S=%binsdir%\universalrepl.xsc "30 78 35 62" "30 78 66 65"
echo Done converting graphics!!
pause
GOTO END
:OPTION-2
:: COMPILE
:: Delete anything left over from previous compile.
if exist *.hex del *.hex /q
if exist *.epp del *.eep /q
if exist *.elf del *.elf /q
if exist *.lss del *.lss /q
if exist *.map del *.map /q
if exist *.o del *.o /q
if exist *.uze del *.uze /q
if exist *.eep del *.eep /q
if exist *.eep del *.eep /q
echo.
:: Compile the program. The "Makefile" will be used.
echo.
echo Compiling program...
cd %initidir%
make
echo.
:: Remove all resulting files other than the .hex or .uze file.
if exist *.epp del *.eep /q
if exist *.elf del *.elf /q
if exist *.lss del *.lss /q
if exist *.map del *.map /q
if exist *.o del *.o /q
if exist *.eep del *.eep /q
if exist *.eep del *.eep /q
if exist dep rmdir dep /s /q
echo.
echo List of .HEX files:
FOR /F %%I IN ('DIR *.hex /B') DO SET newrom=%%I
echo %newrom%
pause
echo Starting Uzem emulator
echo.
%emulator% %newrom%
GOTO END
:OPTION-3
CALL :OPTION-1
CALL :OPTION-2
GOTO END
:OPTION-4
:END
Code: Select all
REM goto begin of file (always zero-based)
ADR 0
REM in above example %1 is 0A
REM and %2 is 0D 0A
REPLACEALL %1 BY %2