diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..9cb06d92 --- /dev/null +++ b/build.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +check_source_files() +{ + if [[ ! -f "$1" ]]; then + echo "Extracting source files..." + unzip build_source &> /dev/null + fi +} + +[[ ! -d bin ]] && mkdir bin + +if [[ ! -f bin/s2p2bin ]]; then + echo "Compiling s2p2bin..." + check_source_files build_source/s2p2bin.cpp + check_source_files build_source/KensSaxComp/S-Compressor.cpp + g++ -O3 -s -o bin/s2p2bin build_source/s2p2bin.cpp build_source/KensSaxComp/S-Compressor.cpp &> /dev/null +fi + +if [[ ! -f bin/fixpointer ]]; then + echo "Compiling fixpointer..." + check_source_files build_source/fixpointer.cpp + g++ -O3 -s -o bin/fixpointer build_source/fixpointer.cpp &> /dev/null +fi + +if [[ ! -f bin/fixheader ]]; then + echo "Compiling fixheader..." + check_source_files build_source/fixheader.cpp + g++ -O3 -s -o bin/fixheader build_source/fixheader.cpp &> /dev/null +fi + +[[ -f s2.bin ]] && mv -f s2.bin s2.prev.bin +rm -f s2.p s2.h s2.log + +debug_syms="" +print_err="-E -q" + +for n in `seq 1 2`; do + if [[ "$1" == "-ds" ]]; then + debug_syms="-g MAP" + echo "Will generate debug symbols" + elif [[ "$1" == "-pe" ]]; then + print_err="" + echo "Selected detailed assembler output" + fi + shift +done + +echo Assembling... + +asl -xx -c $debug_syms $print_err -A -U s2.asm + +if [[ -f s2.log ]]; then + echo + echo "*****************************************" + echo "* *" + echo "* There were build errors/warnings. *" + echo "* *" + echo "*****************************************" + echo + cat s2.log + exit 1 +fi + +[[ -f s2.p ]] && bin/s2p2bin s2.p s2.bin s2.h +[[ -f s2.bin ]] && bin/fixpointer s2.h s2built.bin off_3A294 MapRUnc_Sonic \$2D 0 4 word_728C_user Obj5F_MapUnc_7240 2 2 1 +[[ -f s2.bin ]] && bin/fixheader s2.bin + diff --git a/s2.asm b/s2.asm index d1348fee..eb837d38 100644 --- a/s2.asm +++ b/s2.asm @@ -32844,7 +32844,7 @@ SuperSonic_BalanceOnObjLeft: bset #0,status(a0) loc_1A57C: - move.b #6,anim(a0) + move.b #AniIDSonAni_Balance,anim(a0) bra.s Obj01_ResetScr ; --------------------------------------------------------------------------- ; loc_1A584: diff --git a/s2.macros.asm b/s2.macros.asm index 166b61f0..f6b504f8 100644 --- a/s2.macros.asm +++ b/s2.macros.asm @@ -144,7 +144,7 @@ __LABEL__ zoneOrderedTable entryLen,zoneEntries ; macro to declare one or more entries in a zone-ordered table zoneTableEntry macro value - if "VALUE"<>"" + if "value"<>"" if zone_entries_left dc.ATTRIBUTE value zone_entries_left := zone_entries_left-1 diff --git a/s2.macrosetup.asm b/s2.macrosetup.asm index 71b992a6..02bcd82b 100644 --- a/s2.macrosetup.asm +++ b/s2.macrosetup.asm @@ -107,7 +107,7 @@ tracenum := 0 ; 1-arg instruction that's self-patching to remove 0-offset optimization insn1op macro oper,x - if (substr("x",0,2)<>"0(") && (substr("x",0,3)<>"ID(") && (substr("x",0,9)<>"SLOT_ROUT(") + if (substr("x",0,2)<>"0(") && (substr("x",0,3)<>"id(") && (substr("x",0,9)<>"slot_rout(") !oper x else !oper 1+x @@ -118,8 +118,8 @@ insn1op macro oper,x ; 2-arg instruction that's self-patching to remove 0-offset optimization insn2op macro oper,x,y - if (substr("x",0,2)<>"0(") && (substr("x",0,3)<>"ID(") && (substr("x",0,10)<>"SLOT_ROUT(") - if (substr("y",0,2)<>"0(") && (substr("y",0,3)<>"ID(") && (substr("y",0,10)<>"SLOT_ROUT(") + if (substr("x",0,2)<>"0(") && (substr("x",0,3)<>"id(") && (substr("x",0,10)<>"slot_rout(") + if (substr("y",0,2)<>"0(") && (substr("y",0,3)<>"id(") && (substr("y",0,10)<>"slot_rout(") !oper x,y else !oper x,1+y @@ -127,8 +127,8 @@ insn2op macro oper,x,y !dc.b 0 endif else - if substr("y",0,1)<>"D" - if (substr("y",0,2)<>"0(") && (substr("y",0,3)<>"ID(") && (substr("y",0,10)<>"SLOT_ROUT(") + if substr("y",0,1)<>"d" + if (substr("y",0,2)<>"0(") && (substr("y",0,3)<>"id(") && (substr("y",0,10)<>"slot_rout(") start: !oper 1+x,y end: