Merge branch 'tic_0.46.0'
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -77,3 +77,5 @@ build/android/bin/
 | 
			
		||||
build/windows/test/Release/
 | 
			
		||||
build/uwp/tic80/x64/
 | 
			
		||||
build/uwp/tic80/ARM/
 | 
			
		||||
build/uwp/tic/Package.StoreAssociation.xml
 | 
			
		||||
build/uwp/tic/tic_StoreKey.pfx
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -4,8 +4,8 @@
 | 
			
		||||
-->
 | 
			
		||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
      package="com.nesbox.tic"
 | 
			
		||||
      android:versionCode="4500"
 | 
			
		||||
      android:versionName="0.45.0"
 | 
			
		||||
      android:versionCode="4600"
 | 
			
		||||
      android:versionName="0.46.0"
 | 
			
		||||
      android:installLocation="auto">
 | 
			
		||||
 | 
			
		||||
    <!-- Android 2.3.3 -->
 | 
			
		||||
 
 | 
			
		||||
@@ -19,9 +19,9 @@
 | 
			
		||||
  <key>CFBundlePackageType</key>
 | 
			
		||||
  <string>APPL</string>
 | 
			
		||||
  <key>CFBundleShortVersionString</key>
 | 
			
		||||
  <string>0.45.0</string>
 | 
			
		||||
  <string>0.46.0</string>
 | 
			
		||||
  <key>CFBundleVersion</key>
 | 
			
		||||
  <string>0.45.0</string>
 | 
			
		||||
  <string>0.46.0</string>
 | 
			
		||||
  <key>NSHumanReadableCopyright</key>
 | 
			
		||||
  <string>http://tic.computer © 2017</string>
 | 
			
		||||
</dict>
 | 
			
		||||
 
 | 
			
		||||
@@ -27,14 +27,14 @@
 | 
			
		||||
    </ProjectConfiguration>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\dgif_lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\egif_lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\gifalloc.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\gif_err.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\gif_font.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\gif_hash.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\openbsd-reallocarray.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\quantize.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\dgif_lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\egif_lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\gifalloc.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\gif_err.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\gif_font.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\gif_hash.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\openbsd-reallocarray.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\quantize.c" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <PropertyGroup Label="Globals">
 | 
			
		||||
    <ProjectGuid>{bc1084df-210a-48d6-a077-761d8c16947b}</ProjectGuid>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,13 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\dgif_lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\egif_lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\gif_err.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\gif_font.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\gif_hash.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\gifalloc.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\openbsd-reallocarray.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\giflib-5.1.4\lib\quantize.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\dgif_lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\egif_lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\gif_err.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\gif_font.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\gif_hash.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\gifalloc.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\openbsd-reallocarray.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\giflib-5.1.4\lib\quantize.c" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
</Project>
 | 
			
		||||
@@ -27,41 +27,41 @@
 | 
			
		||||
    </ProjectConfiguration>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lapi.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lauxlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lbaselib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lbitlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lcode.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lcorolib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lctype.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ldblib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ldebug.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ldo.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ldump.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lfunc.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lgc.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\llex.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lmathlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lmem.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\loadlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lobject.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lopcodes.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lparser.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lpcap.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lpcode.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lpprint.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lptree.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lpvm.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lstate.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lstring.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lstrlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ltable.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ltablib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ltm.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lundump.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lutf8lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lvm.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lzio.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lapi.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lauxlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lbaselib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lbitlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lcode.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lcorolib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lctype.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ldblib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ldebug.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ldo.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ldump.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lfunc.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lgc.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\llex.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lmathlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lmem.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\loadlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lobject.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lopcodes.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lparser.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lpcap.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lpcode.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lpprint.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lptree.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lpvm.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lstate.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lstring.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lstrlib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ltable.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ltablib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ltm.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lundump.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lutf8lib.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lvm.c" />
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lzio.c" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <PropertyGroup Label="Globals">
 | 
			
		||||
    <ProjectGuid>{53802f21-41da-4ac1-8b62-0dac2ccb8af8}</ProjectGuid>
 | 
			
		||||
 
 | 
			
		||||
@@ -16,109 +16,109 @@
 | 
			
		||||
    </Filter>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lapi.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lapi.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lcode.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lcode.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lctype.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lctype.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ldblib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ldblib.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ldebug.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ldebug.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ldo.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ldo.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ldump.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ldump.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lfunc.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lfunc.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lgc.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lgc.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\llex.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\llex.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lmem.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lmem.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lobject.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lobject.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lopcodes.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lopcodes.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lparser.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lparser.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lstate.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lstate.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lstring.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lstring.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ltable.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ltable.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ltm.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ltm.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lundump.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lundump.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lvm.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lvm.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lzio.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lzio.c">
 | 
			
		||||
      <Filter>lua</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lauxlib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lauxlib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lbaselib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lbaselib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lbitlib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lbitlib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lcorolib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lcorolib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lmathlib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lmathlib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lstrlib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lstrlib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\ltablib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\ltablib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lutf8lib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lutf8lib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\loadlib.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\loadlib.c">
 | 
			
		||||
      <Filter>lua\lib</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lpcap.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lpcap.c">
 | 
			
		||||
      <Filter>lpeg</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lpcode.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lpcode.c">
 | 
			
		||||
      <Filter>lpeg</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lpprint.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lpprint.c">
 | 
			
		||||
      <Filter>lpeg</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lptree.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lptree.c">
 | 
			
		||||
      <Filter>lpeg</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\lua-5.3.1\src\lpvm.c">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\lua-5.3.1\src\lpvm.c">
 | 
			
		||||
      <Filter>lpeg</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
 | 
			
		||||
  <Identity Name="50446Nesbox.TICcomputer" Publisher="CN=1040DC4A-04A1-4B33-9107-C1A9D74775D4" Version="0.45.1.0" />
 | 
			
		||||
  <Identity Name="50446Nesbox.TICcomputer" Publisher="CN=1040DC4A-04A1-4B33-9107-C1A9D74775D4" Version="0.46.0.0" />
 | 
			
		||||
  <mp:PhoneIdentity PhoneProductId="93515db0-8ee3-478b-933a-5776b58247b2" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
 | 
			
		||||
  <Properties>
 | 
			
		||||
    <DisplayName>TIC-80</DisplayName>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,16 +5,16 @@ VisualStudioVersion = 14.0.25420.1
 | 
			
		||||
MinimumVisualStudioVersion = 10.0.40219.1
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tic", "tic.vcxproj", "{7F895641-6C8F-4481-BD81-57785A4BEB09}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib-uwp", "..\..\..\..\..\sdk\zlib-1.2.8\winrt\zlib-uwp\zlib-uwp.vcxproj", "{978F53DB-F959-4CB4-84A7-463AF29949BE}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2-UWP", "..\..\..\..\..\sdk\SDL2-2.0.5\VisualC-WinRT\UWP_VS2015\SDL-UWP.vcxproj", "{89E9B32E-A86A-47C3-A948-D2B1622925CE}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua", "..\lua\lua.vcxproj", "{53802F21-41DA-4AC1-8B62-0DAC2CCB8AF8}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gif", "..\gif\gif.vcxproj", "{BC1084DF-210A-48D6-A077-761D8C16947B}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tic80", "..\tic80\tic80.vcxproj", "{9C39ACF1-5F52-4A2B-A467-9F2805D6174B}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2-UWP", "..\..\..\..\3rd-party\SDL2-2.0.5\VisualC-WinRT\UWP_VS2015\SDL-UWP.vcxproj", "{89E9B32E-A86A-47C3-A948-D2B1622925CE}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib-uwp", "..\..\..\..\3rd-party\zlib-1.2.8\winrt\zlib-uwp\zlib-uwp.vcxproj", "{978F53DB-F959-4CB4-84A7-463AF29949BE}"
 | 
			
		||||
EndProject
 | 
			
		||||
Global
 | 
			
		||||
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
			
		||||
		Debug|ARM = Debug|ARM
 | 
			
		||||
@@ -43,30 +43,6 @@ Global
 | 
			
		||||
		{7F895641-6C8F-4481-BD81-57785A4BEB09}.Release|x86.ActiveCfg = Release|Win32
 | 
			
		||||
		{7F895641-6C8F-4481-BD81-57785A4BEB09}.Release|x86.Build.0 = Release|Win32
 | 
			
		||||
		{7F895641-6C8F-4481-BD81-57785A4BEB09}.Release|x86.Deploy.0 = Release|Win32
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|ARM.ActiveCfg = Debug|ARM
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|ARM.Build.0 = Debug|ARM
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|x64.ActiveCfg = Debug|x64
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|x64.Build.0 = Debug|x64
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|x86.ActiveCfg = Debug|Win32
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|x86.Build.0 = Debug|Win32
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|ARM.ActiveCfg = Release|ARM
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|ARM.Build.0 = Release|ARM
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|x64.ActiveCfg = Release|x64
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|x64.Build.0 = Release|x64
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|x86.ActiveCfg = Release|Win32
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|x86.Build.0 = Release|Win32
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.ActiveCfg = Debug|ARM
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.Build.0 = Debug|ARM
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.ActiveCfg = Debug|x64
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.Build.0 = Debug|x64
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.ActiveCfg = Debug|Win32
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.Build.0 = Debug|Win32
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.ActiveCfg = Release|ARM
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.Build.0 = Release|ARM
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.ActiveCfg = Release|x64
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.Build.0 = Release|x64
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.ActiveCfg = Release|Win32
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.Build.0 = Release|Win32
 | 
			
		||||
		{53802F21-41DA-4AC1-8B62-0DAC2CCB8AF8}.Debug|ARM.ActiveCfg = Debug|ARM
 | 
			
		||||
		{53802F21-41DA-4AC1-8B62-0DAC2CCB8AF8}.Debug|ARM.Build.0 = Debug|ARM
 | 
			
		||||
		{53802F21-41DA-4AC1-8B62-0DAC2CCB8AF8}.Debug|x64.ActiveCfg = Debug|x64
 | 
			
		||||
@@ -103,6 +79,30 @@ Global
 | 
			
		||||
		{9C39ACF1-5F52-4A2B-A467-9F2805D6174B}.Release|x64.Build.0 = Release|x64
 | 
			
		||||
		{9C39ACF1-5F52-4A2B-A467-9F2805D6174B}.Release|x86.ActiveCfg = Release|Win32
 | 
			
		||||
		{9C39ACF1-5F52-4A2B-A467-9F2805D6174B}.Release|x86.Build.0 = Release|Win32
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.ActiveCfg = Debug|ARM
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.Build.0 = Debug|ARM
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.ActiveCfg = Debug|x64
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.Build.0 = Debug|x64
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.ActiveCfg = Debug|Win32
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.Build.0 = Debug|Win32
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.ActiveCfg = Release|ARM
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.Build.0 = Release|ARM
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.ActiveCfg = Release|x64
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.Build.0 = Release|x64
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.ActiveCfg = Release|Win32
 | 
			
		||||
		{89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.Build.0 = Release|Win32
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|ARM.ActiveCfg = Debug|ARM
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|ARM.Build.0 = Debug|ARM
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|x64.ActiveCfg = Debug|x64
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|x64.Build.0 = Debug|x64
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|x86.ActiveCfg = Debug|Win32
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Debug|x86.Build.0 = Debug|Win32
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|ARM.ActiveCfg = Release|ARM
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|ARM.Build.0 = Release|ARM
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|x64.ActiveCfg = Release|x64
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|x64.Build.0 = Release|x64
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|x86.ActiveCfg = Release|Win32
 | 
			
		||||
		{978F53DB-F959-4CB4-84A7-463AF29949BE}.Release|x86.Build.0 = Release|Win32
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(SolutionProperties) = preSolution
 | 
			
		||||
		HideSolutionNode = FALSE
 | 
			
		||||
 
 | 
			
		||||
@@ -216,10 +216,10 @@
 | 
			
		||||
    <Image Include="Assets\Wide310x150Logo.scale-200.png" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ProjectReference Include="..\..\..\..\..\sdk\SDL2-2.0.5\VisualC-WinRT\UWP_VS2015\SDL-UWP.vcxproj">
 | 
			
		||||
    <ProjectReference Include="..\..\..\..\3rd-party\SDL2-2.0.5\VisualC-WinRT\UWP_VS2015\SDL-UWP.vcxproj">
 | 
			
		||||
      <Project>{89e9b32e-a86a-47c3-a948-d2b1622925ce}</Project>
 | 
			
		||||
    </ProjectReference>
 | 
			
		||||
    <ProjectReference Include="..\..\..\..\..\sdk\zlib-1.2.8\winrt\zlib-uwp\zlib-uwp.vcxproj">
 | 
			
		||||
    <ProjectReference Include="..\..\..\..\3rd-party\zlib-1.2.8\winrt\zlib-uwp\zlib-uwp.vcxproj">
 | 
			
		||||
      <Project>{978f53db-f959-4cb4-84a7-463af29949be}</Project>
 | 
			
		||||
    </ProjectReference>
 | 
			
		||||
    <ProjectReference Include="..\gif\gif.vcxproj">
 | 
			
		||||
@@ -233,7 +233,7 @@
 | 
			
		||||
    </ProjectReference>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\SDL2-2.0.5\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\SDL2-2.0.5\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
 | 
			
		||||
      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
 | 
			
		||||
      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
 | 
			
		||||
      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
 | 
			
		||||
@@ -279,7 +279,7 @@
 | 
			
		||||
    <None Include="Package.StoreAssociation.xml" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ResourceCompile Include="..\..\..\..\..\sdk\SDL2-2.0.5\src\main\winrt\SDL2-WinRTResources.rc" />
 | 
			
		||||
    <ResourceCompile Include="..\..\..\..\3rd-party\SDL2-2.0.5\src\main\winrt\SDL2-WinRTResources.rc" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 | 
			
		||||
  <ImportGroup Label="ExtensionTargets">
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,6 @@
 | 
			
		||||
    <ClCompile Include="..\..\..\src\ext\file_dialog.cpp">
 | 
			
		||||
      <Filter>src\ext</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\..\sdk\SDL2-2.0.5\src\main\winrt\SDL_winrt_main_NonXAML.cpp" />
 | 
			
		||||
    <ClCompile Include="..\..\..\src\history.c">
 | 
			
		||||
      <Filter>src</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
@@ -126,8 +125,9 @@
 | 
			
		||||
    <ClCompile Include="..\..\..\src\surf.c">
 | 
			
		||||
      <Filter>src</Filter>
 | 
			
		||||
    </ClCompile>
 | 
			
		||||
    <ClCompile Include="..\..\..\..\3rd-party\SDL2-2.0.5\src\main\winrt\SDL_winrt_main_NonXAML.cpp" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ResourceCompile Include="..\..\..\..\..\sdk\SDL2-2.0.5\src\main\winrt\SDL2-WinRTResources.rc" />
 | 
			
		||||
    <ResourceCompile Include="..\..\..\..\3rd-party\SDL2-2.0.5\src\main\winrt\SDL2-WinRTResources.rc" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
</Project>
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								config.tic
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								config.tic
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -847,7 +847,7 @@ static void onConsoleInstallDemosCommand(Console* console, const char* param)
 | 
			
		||||
 | 
			
		||||
static void onConsoleSurfCommand(Console* console, const char* param)
 | 
			
		||||
{
 | 
			
		||||
	setStudioMode(TIC_SURF_MODE);
 | 
			
		||||
	gotoSurf();
 | 
			
		||||
 | 
			
		||||
	commandDone(console);
 | 
			
		||||
}
 | 
			
		||||
@@ -2241,6 +2241,9 @@ static void tick(Console* console)
 | 
			
		||||
			embed.yes = false;
 | 
			
		||||
			embed.fast = false;
 | 
			
		||||
			studioRomLoaded();
 | 
			
		||||
 | 
			
		||||
			console->tic->api.reset(console->tic);
 | 
			
		||||
 | 
			
		||||
			printLine(console);
 | 
			
		||||
			commandDone(console);
 | 
			
		||||
			console->active = true;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								src/jsapi.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								src/jsapi.c
									
									
									
									
									
								
							@@ -644,6 +644,29 @@ static duk_ret_t duk_tri(duk_context* duk)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static duk_ret_t duk_textri(duk_context* duk)
 | 
			
		||||
{
 | 
			
		||||
	s32 pt[12];
 | 
			
		||||
 | 
			
		||||
	for (s32 i = 0; i < COUNT_OF(pt); i++)
 | 
			
		||||
		pt[i] = duk_to_int(duk, i);
 | 
			
		||||
	tic_mem* memory = (tic_mem*)getDukMachine(duk);
 | 
			
		||||
	bool use_map = duk_is_null_or_undefined(duk, 12) ? false : duk_to_boolean(duk, 12);
 | 
			
		||||
	u8 chroma = duk_is_null_or_undefined(duk, 13) ? 0xff : duk_to_int(duk, 13);
 | 
			
		||||
 | 
			
		||||
	memory->api.textri(memory, pt[0], pt[1],	//	xy 1
 | 
			
		||||
						pt[2], pt[3],	//	xy 2
 | 
			
		||||
						pt[4], pt[5],	//  xy 3
 | 
			
		||||
						pt[6], pt[7],	//	uv 1
 | 
			
		||||
						pt[8], pt[9],	//	uv 2
 | 
			
		||||
						pt[10], pt[11],//  uv 3
 | 
			
		||||
						use_map, // usemap
 | 
			
		||||
						chroma);	//	chroma
 | 
			
		||||
	
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static duk_ret_t duk_clip(duk_context* duk)
 | 
			
		||||
{
 | 
			
		||||
	s32 x = duk_to_int(duk, 0);
 | 
			
		||||
@@ -724,6 +747,7 @@ static const struct{duk_c_function func; s32 params;} ApiFunc[] =
 | 
			
		||||
	{duk_circ, 4},
 | 
			
		||||
	{duk_circb, 4},
 | 
			
		||||
	{duk_tri, 7},
 | 
			
		||||
	{duk_textri,12},
 | 
			
		||||
	{duk_clip, 4},
 | 
			
		||||
	{duk_music, 4},
 | 
			
		||||
	{duk_sync, 0},
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								src/luaapi.c
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								src/luaapi.c
									
									
									
									
									
								
							@@ -290,6 +290,42 @@ static s32 lua_tri(lua_State* lua)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static s32 lua_textri(lua_State* lua)
 | 
			
		||||
{
 | 
			
		||||
	s32 top = lua_gettop(lua);
 | 
			
		||||
 | 
			
		||||
	if (top >= 12)
 | 
			
		||||
	{
 | 
			
		||||
		float pt[12];
 | 
			
		||||
 | 
			
		||||
		for (s32 i = 0; i < COUNT_OF(pt); i++)
 | 
			
		||||
			pt[i] = getLuaNumber(lua, i + 1);
 | 
			
		||||
 | 
			
		||||
		tic_mem* memory = (tic_mem*)getLuaMachine(lua);
 | 
			
		||||
		u8 chroma = 0xff;
 | 
			
		||||
		bool use_map = false;
 | 
			
		||||
 | 
			
		||||
		//	check for use map 
 | 
			
		||||
		if (top >= 13)
 | 
			
		||||
			use_map = lua_toboolean(lua, 13);
 | 
			
		||||
		//	check for chroma 
 | 
			
		||||
		if (top >= 14)
 | 
			
		||||
			chroma = (u8)getLuaNumber(lua, 14);
 | 
			
		||||
 | 
			
		||||
		memory->api.textri(memory, pt[0], pt[1],	//	xy 1
 | 
			
		||||
									pt[2], pt[3],	//	xy 2
 | 
			
		||||
									pt[4], pt[5],	//  xy 3
 | 
			
		||||
									pt[6], pt[7],	//	uv 1
 | 
			
		||||
									pt[8], pt[9],	//	uv 2
 | 
			
		||||
									pt[10], pt[11], //  uv 3
 | 
			
		||||
									use_map,		// use map
 | 
			
		||||
									chroma);		// chroma
 | 
			
		||||
	}
 | 
			
		||||
	else luaL_error(lua, "invalid parameters, textri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v2,u3,v3,[use_map=false],[chroma=off])\n");
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static s32 lua_clip(lua_State* lua)
 | 
			
		||||
{
 | 
			
		||||
	s32 top = lua_gettop(lua);
 | 
			
		||||
@@ -1013,7 +1049,7 @@ static const lua_CFunction ApiFunc[] =
 | 
			
		||||
	lua_rectb, lua_spr, lua_btn, lua_btnp, lua_sfx, lua_map, lua_mget, 
 | 
			
		||||
	lua_mset, lua_peek, lua_poke, lua_peek4, lua_poke4, lua_memcpy, 
 | 
			
		||||
	lua_memset, lua_trace, lua_pmem, lua_time, lua_exit, lua_font, lua_mouse, 
 | 
			
		||||
	lua_circ, lua_circb, lua_tri, lua_clip, lua_music, lua_sync
 | 
			
		||||
	lua_circ, lua_circb, lua_tri, lua_textri, lua_clip, lua_music, lua_sync
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
STATIC_ASSERT(api_func, COUNT_OF(ApiKeywords) == COUNT_OF(ApiFunc));
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										369
									
								
								src/music.c
									
									
									
									
									
								
							
							
						
						
									
										369
									
								
								src/music.c
									
									
									
									
									
								
							@@ -329,6 +329,8 @@ static void doTab(Music* music)
 | 
			
		||||
	s32 channel = (music->tracker.col / CHANNEL_COLS + 1) % TIC_SOUND_CHANNELS;
 | 
			
		||||
 | 
			
		||||
	music->tracker.col = channel * CHANNEL_COLS + music->tracker.col % CHANNEL_COLS;
 | 
			
		||||
 | 
			
		||||
	updateTracker(music);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void upFrame(Music* music)
 | 
			
		||||
@@ -376,36 +378,6 @@ static tic_track_pattern* getChannelPattern(Music* music)
 | 
			
		||||
	return getPattern(music, channel);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void resetCol(Music* music)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
	s32 col = music->tracker.col % CHANNEL_COLS;
 | 
			
		||||
 | 
			
		||||
	switch (col)
 | 
			
		||||
	{
 | 
			
		||||
	case ColumnNote:
 | 
			
		||||
	case ColumnSemitone:
 | 
			
		||||
	case ColumnOctave:		
 | 
			
		||||
			memset(&pattern->rows[music->tracker.row], 0, sizeof(pattern->rows[music->tracker.row]));
 | 
			
		||||
		break;
 | 
			
		||||
	case ColumnSfxHi:
 | 
			
		||||
	case ColumnSfxLow:
 | 
			
		||||
		pattern->rows[music->tracker.row].sfxhi = 0;
 | 
			
		||||
		pattern->rows[music->tracker.row].sfxlow = 0;
 | 
			
		||||
		break;
 | 
			
		||||
	case ColumnVolume:
 | 
			
		||||
		pattern->rows[music->tracker.row].volume = 0;
 | 
			
		||||
	case ColumnEffect:
 | 
			
		||||
	case ColumnParameter:
 | 
			
		||||
		pattern->rows[music->tracker.row].effect = 0;
 | 
			
		||||
		pattern->rows[music->tracker.row].param = 0;
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	history_add(music->history);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static s32 getNote(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
@@ -482,14 +454,14 @@ static void setStopNote(Music* music)
 | 
			
		||||
	pattern->rows[music->tracker.row].octave = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void setNote(Music* music, s32 note, s32 octave, s32 volume)
 | 
			
		||||
static void setNote(Music* music, s32 note, s32 octave, s32 volume, s32 sfx)
 | 
			
		||||
{
 | 
			
		||||
	tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
 | 
			
		||||
	pattern->rows[music->tracker.row].note = note + NoteStart;
 | 
			
		||||
	pattern->rows[music->tracker.row].octave = octave;
 | 
			
		||||
	pattern->rows[music->tracker.row].volume = volume;
 | 
			
		||||
	setSfxId(pattern, music->tracker.row, music->tracker.last.sfx);
 | 
			
		||||
	setSfxId(pattern, music->tracker.row, sfx);
 | 
			
		||||
 | 
			
		||||
	playNote(music);
 | 
			
		||||
}
 | 
			
		||||
@@ -537,37 +509,116 @@ static void stopTrack(Music* music)
 | 
			
		||||
	music->tic->api.music(music->tic, -1, -1, -1, false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void copyToClipboard(Music* music)
 | 
			
		||||
static void resetSelection(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
 | 
			
		||||
	toClipboard(pattern, sizeof(tic_track_pattern), true);
 | 
			
		||||
	music->tracker.select.start = (SDL_Point){-1, -1};
 | 
			
		||||
	music->tracker.select.rect = (SDL_Rect){0, 0, 0, 0};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void resetPattern(Music* music)
 | 
			
		||||
static void deleteSelection(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
 | 
			
		||||
	if(pattern)
 | 
			
		||||
	{
 | 
			
		||||
		memset(pattern, 0, sizeof(tic_track_pattern));
 | 
			
		||||
		SDL_Rect rect = music->tracker.select.rect;
 | 
			
		||||
 | 
			
		||||
		history_add(music->history);		
 | 
			
		||||
		if(rect.h <= 0)
 | 
			
		||||
		{
 | 
			
		||||
			rect.y = music->tracker.row;
 | 
			
		||||
			rect.h = 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		enum{RowSize = sizeof(tic_track_pattern) / MUSIC_PATTERN_ROWS};
 | 
			
		||||
		SDL_memset(&pattern->rows[rect.y], 0, RowSize * rect.h);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void cutToClipboard(Music* music)
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
	copyToClipboard(music);
 | 
			
		||||
	resetPattern(music);
 | 
			
		||||
	u8 size;
 | 
			
		||||
} ClipboardHeader;
 | 
			
		||||
 | 
			
		||||
static void copyToClipboard(Music* music, bool cut)
 | 
			
		||||
{
 | 
			
		||||
	tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
 | 
			
		||||
	if(pattern)
 | 
			
		||||
	{
 | 
			
		||||
		SDL_Rect rect = music->tracker.select.rect;
 | 
			
		||||
 | 
			
		||||
		if(rect.h <= 0)
 | 
			
		||||
		{
 | 
			
		||||
			rect.y = music->tracker.row;
 | 
			
		||||
			rect.h = 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ClipboardHeader header = {rect.h};
 | 
			
		||||
 | 
			
		||||
		enum{RowSize = sizeof(tic_track_pattern) / MUSIC_PATTERN_ROWS, HeaderSize = sizeof(ClipboardHeader)};
 | 
			
		||||
 | 
			
		||||
		s32 size = rect.h * RowSize + HeaderSize;
 | 
			
		||||
		u8* data = SDL_malloc(size);
 | 
			
		||||
 | 
			
		||||
		if(data)
 | 
			
		||||
		{
 | 
			
		||||
			SDL_memcpy(data, &header, HeaderSize);
 | 
			
		||||
			SDL_memcpy(data + HeaderSize, &pattern->rows[rect.y], RowSize * rect.h);
 | 
			
		||||
 | 
			
		||||
			toClipboard(data, size, true);
 | 
			
		||||
 | 
			
		||||
			SDL_free(data);
 | 
			
		||||
 | 
			
		||||
			if(cut)
 | 
			
		||||
			{
 | 
			
		||||
				deleteSelection(music);
 | 
			
		||||
				history_add(music->history);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			resetSelection(music);
 | 
			
		||||
		}		
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void copyFromClipboard(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
 | 
			
		||||
	if(fromClipboard(pattern, sizeof(tic_track_pattern), true))
 | 
			
		||||
	if(pattern && SDL_HasClipboardText())
 | 
			
		||||
	{
 | 
			
		||||
		char* clipboard = SDL_GetClipboardText();
 | 
			
		||||
 | 
			
		||||
		if(clipboard)
 | 
			
		||||
		{
 | 
			
		||||
			s32 size = strlen(clipboard)/2;
 | 
			
		||||
 | 
			
		||||
			enum{RowSize = sizeof(tic_track_pattern) / MUSIC_PATTERN_ROWS, HeaderSize = sizeof(ClipboardHeader)};
 | 
			
		||||
 | 
			
		||||
			if(size > HeaderSize)
 | 
			
		||||
			{
 | 
			
		||||
				u8* data = SDL_malloc(size);
 | 
			
		||||
 | 
			
		||||
				str2buf(clipboard, data, true);
 | 
			
		||||
 | 
			
		||||
				ClipboardHeader header = {0};
 | 
			
		||||
 | 
			
		||||
				SDL_memcpy(&header, data, HeaderSize);
 | 
			
		||||
 | 
			
		||||
				if(header.size * RowSize == size - HeaderSize)
 | 
			
		||||
				{
 | 
			
		||||
					if(header.size + music->tracker.row > MUSIC_PATTERN_ROWS)
 | 
			
		||||
						header.size = MUSIC_PATTERN_ROWS - music->tracker.row;
 | 
			
		||||
 | 
			
		||||
					SDL_memcpy(&pattern->rows[music->tracker.row], data + HeaderSize, header.size * RowSize);
 | 
			
		||||
					history_add(music->history);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				SDL_free(data);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			SDL_free(clipboard);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void setChannelPatternValue(Music* music, s32 patternId, s32 channel)
 | 
			
		||||
@@ -629,11 +680,53 @@ static void patternColRight(Music* music)
 | 
			
		||||
	else nextPattern(music);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void checkSelection(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	if(music->tracker.select.start.x < 0 || music->tracker.select.start.y < 0)
 | 
			
		||||
	{
 | 
			
		||||
		music->tracker.select.start.x = music->tracker.col;
 | 
			
		||||
		music->tracker.select.start.y = music->tracker.row;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void updateSelection(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	s32 rl = SDL_min(music->tracker.col, music->tracker.select.start.x);
 | 
			
		||||
	s32 rt = SDL_min(music->tracker.row, music->tracker.select.start.y);
 | 
			
		||||
	s32 rr = SDL_max(music->tracker.col, music->tracker.select.start.x);
 | 
			
		||||
	s32 rb = SDL_max(music->tracker.row, music->tracker.select.start.y);
 | 
			
		||||
 | 
			
		||||
	SDL_Rect* rect = &music->tracker.select.rect;
 | 
			
		||||
	*rect = (SDL_Rect){rl, rt, rr - rl + 1, rb - rt + 1};
 | 
			
		||||
 | 
			
		||||
	if(rect->x % CHANNEL_COLS + rect->w > CHANNEL_COLS)
 | 
			
		||||
		resetSelection(music);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
 | 
			
		||||
{
 | 
			
		||||
	SDL_Keycode keycode = keysum->sym;
 | 
			
		||||
	SDL_Scancode scancode = keysum->scancode;
 | 
			
		||||
 | 
			
		||||
	bool shift = SDL_GetModState() & KMOD_SHIFT;
 | 
			
		||||
 | 
			
		||||
	if(shift)
 | 
			
		||||
	{
 | 
			
		||||
		switch (keycode)
 | 
			
		||||
		{
 | 
			
		||||
		case SDLK_UP:
 | 
			
		||||
		case SDLK_DOWN:
 | 
			
		||||
		case SDLK_LEFT:
 | 
			
		||||
		case SDLK_RIGHT:
 | 
			
		||||
		case SDLK_HOME:
 | 
			
		||||
		case SDLK_END:
 | 
			
		||||
		case SDLK_PAGEUP:
 | 
			
		||||
		case SDLK_PAGEDOWN:
 | 
			
		||||
		case SDLK_TAB:
 | 
			
		||||
			checkSelection(music);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	switch (keycode)
 | 
			
		||||
	{
 | 
			
		||||
	case SDLK_UP: 			upRow(music); break;
 | 
			
		||||
@@ -646,7 +739,8 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
 | 
			
		||||
	case SDLK_PAGEDOWN: 	pageDown(music); break;
 | 
			
		||||
	case SDLK_TAB: 			doTab(music); break;
 | 
			
		||||
	case SDLK_DELETE:
 | 
			
		||||
		resetCol(music);
 | 
			
		||||
		deleteSelection(music);
 | 
			
		||||
		history_add(music->history);
 | 
			
		||||
		downRow(music);
 | 
			
		||||
		break;
 | 
			
		||||
	case SDLK_SPACE:	playNote(music); break;
 | 
			
		||||
@@ -655,12 +749,30 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
 | 
			
		||||
		{
 | 
			
		||||
		const tic_music_pos* pos = getMusicPos(music);
 | 
			
		||||
		pos->track < 0
 | 
			
		||||
				? (SDL_GetModState() & KMOD_SHIFT ? playFrameRow(music) : playFrame(music))
 | 
			
		||||
			? (shift ? playFrameRow(music) : playFrame(music))
 | 
			
		||||
			: stopTrack(music);        
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(shift)
 | 
			
		||||
	{
 | 
			
		||||
		switch (keycode)
 | 
			
		||||
		{
 | 
			
		||||
		case SDLK_UP:
 | 
			
		||||
		case SDLK_DOWN:
 | 
			
		||||
		case SDLK_LEFT:
 | 
			
		||||
		case SDLK_RIGHT:
 | 
			
		||||
		case SDLK_HOME:
 | 
			
		||||
		case SDLK_END:
 | 
			
		||||
		case SDLK_PAGEUP:
 | 
			
		||||
		case SDLK_PAGEDOWN:
 | 
			
		||||
		case SDLK_TAB:
 | 
			
		||||
			updateSelection(music);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else resetSelection(music);
 | 
			
		||||
 | 
			
		||||
	static const SDL_Scancode Piano[] =
 | 
			
		||||
	{
 | 
			
		||||
		SDL_SCANCODE_Z,
 | 
			
		||||
@@ -705,19 +817,34 @@ static void processTrackerKeydown(Music* music, SDL_Keysym* keysum)
 | 
			
		||||
				downRow(music);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
 | 
			
		||||
				for (s32 i = 0; i < COUNT_OF(Piano); i++)
 | 
			
		||||
				{
 | 
			
		||||
					if (scancode == Piano[i])
 | 
			
		||||
					{
 | 
			
		||||
						s32 note = i % NOTES;
 | 
			
		||||
 | 
			
		||||
						if(pattern->rows[music->tracker.row].note > NoteNone)
 | 
			
		||||
						{
 | 
			
		||||
							pattern->rows[music->tracker.row].note = note + NoteStart;
 | 
			
		||||
							playNote(music);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							s32 octave = i / NOTES + music->tracker.last.octave;
 | 
			
		||||
							s32 volume = music->tracker.last.volume;
 | 
			
		||||
							s32 sfx = music->tracker.last.sfx;
 | 
			
		||||
							setNote(music, note, octave, volume, sfx);
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
						setNote(music, note, octave, volume);
 | 
			
		||||
						downRow(music);
 | 
			
		||||
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
				
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		case ColumnOctave:
 | 
			
		||||
@@ -825,18 +952,30 @@ static void processPatternKeydown(Music* music, SDL_Keysym* keysum)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void selectAll(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	resetSelection(music);
 | 
			
		||||
 | 
			
		||||
	s32 col = music->tracker.col - music->tracker.col % CHANNEL_COLS;
 | 
			
		||||
 | 
			
		||||
	music->tracker.select.start = (SDL_Point){col, 0};
 | 
			
		||||
	music->tracker.col = col + CHANNEL_COLS-1;
 | 
			
		||||
	music->tracker.row = MUSIC_PATTERN_ROWS-1;
 | 
			
		||||
 | 
			
		||||
	updateSelection(music);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void processKeydown(Music* music, SDL_Keysym* keysum)
 | 
			
		||||
{
 | 
			
		||||
	SDL_Keycode keycode = keysum->sym;
 | 
			
		||||
 | 
			
		||||
	switch(getClipboardEvent(keycode))
 | 
			
		||||
	{
 | 
			
		||||
	case TIC_CLIPBOARD_CUT: cutToClipboard(music); break;
 | 
			
		||||
	case TIC_CLIPBOARD_COPY: copyToClipboard(music); break;
 | 
			
		||||
	case TIC_CLIPBOARD_CUT: copyToClipboard(music, true); break;
 | 
			
		||||
	case TIC_CLIPBOARD_COPY: copyToClipboard(music, false); break;
 | 
			
		||||
	case TIC_CLIPBOARD_PASTE: copyFromClipboard(music); break;
 | 
			
		||||
	default: break;
 | 
			
		||||
	}
 | 
			
		||||
@@ -847,6 +986,7 @@ static void processKeydown(Music* music, SDL_Keysym* keysum)
 | 
			
		||||
	{
 | 
			
		||||
		switch (keycode)
 | 
			
		||||
		{
 | 
			
		||||
		case SDLK_a:	selectAll(music); break;
 | 
			
		||||
		case SDLK_z: 	undo(music); break;
 | 
			
		||||
		case SDLK_y: 	redo(music); break;
 | 
			
		||||
		case SDLK_UP: 	upFrame(music); break;
 | 
			
		||||
@@ -1029,6 +1169,8 @@ static void setChannelPattern(Music* music, s32 delta, s32 channel)
 | 
			
		||||
 | 
			
		||||
static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
 | 
			
		||||
{
 | 
			
		||||
	tic_mem* tic = music->tic;
 | 
			
		||||
 | 
			
		||||
	enum
 | 
			
		||||
	{
 | 
			
		||||
		Border = 1,
 | 
			
		||||
@@ -1047,8 +1189,29 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
 | 
			
		||||
			s32 mx = getMouseX() - rect.x - Border;
 | 
			
		||||
			s32 my = getMouseY() - rect.y - Border;
 | 
			
		||||
 | 
			
		||||
			music->tracker.col = channel * CHANNEL_COLS + mx / TIC_FONT_WIDTH;
 | 
			
		||||
			music->tracker.row = my / TIC_FONT_HEIGHT + music->tracker.scroll;
 | 
			
		||||
			s32 col = music->tracker.col = channel * CHANNEL_COLS + mx / TIC_FONT_WIDTH;
 | 
			
		||||
			s32 row = music->tracker.row = my / TIC_FONT_HEIGHT + music->tracker.scroll;
 | 
			
		||||
 | 
			
		||||
			if(music->tracker.select.drag)
 | 
			
		||||
			{
 | 
			
		||||
				updateSelection(music);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				resetSelection(music);
 | 
			
		||||
				music->tracker.select.start = (SDL_Point){col, row};
 | 
			
		||||
 | 
			
		||||
				music->tracker.select.drag = true;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(music->tracker.select.drag)
 | 
			
		||||
	{
 | 
			
		||||
		SDL_Rect rect = {0, 0, TIC80_WIDTH, TIC80_HEIGHT};
 | 
			
		||||
		if(!checkMouseDown(&rect, SDL_BUTTON_LEFT))
 | 
			
		||||
		{
 | 
			
		||||
			music->tracker.select.drag = false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1056,6 +1219,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
 | 
			
		||||
 | 
			
		||||
	s32 start = music->tracker.scroll;
 | 
			
		||||
	s32 end = start + Rows;
 | 
			
		||||
	bool selectedChannel = music->tracker.select.rect.x / CHANNEL_COLS == channel;
 | 
			
		||||
 | 
			
		||||
	tic_track_pattern* pattern = getPattern(music, channel);
 | 
			
		||||
 | 
			
		||||
@@ -1068,6 +1232,17 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
 | 
			
		||||
			music->tic->api.rect(music->tic, x - 1, rowy - 1, Width, TIC_FONT_HEIGHT + 1, systemColor(tic_color_dark_red));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// draw selection
 | 
			
		||||
		if (selectedChannel)
 | 
			
		||||
		{
 | 
			
		||||
			SDL_Rect rect = music->tracker.select.rect;
 | 
			
		||||
			if (rect.h > 1 && i >= rect.y && i < rect.y + rect.h)
 | 
			
		||||
			{
 | 
			
		||||
				s32 sx = x - 1;
 | 
			
		||||
				tic->api.rect(tic, sx, rowy - 1, CHANNEL_COLS * TIC_FONT_WIDTH + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_yellow));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (checkPlayRow(music, i))
 | 
			
		||||
		{
 | 
			
		||||
			music->tic->api.rect(music->tic, x - 1, rowy - 1, Width, TIC_FONT_HEIGHT + 1, systemColor(tic_color_white));
 | 
			
		||||
@@ -1126,20 +1301,52 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void drawTumbler(Music* music, s32 x, s32 y, s32 index)
 | 
			
		||||
{
 | 
			
		||||
	tic_mem* tic = music->tic;
 | 
			
		||||
 | 
			
		||||
	enum{On=36, Off = 52, Size=5, Chroma=14};
 | 
			
		||||
	
 | 
			
		||||
	SDL_Rect rect = {x, y, Size, Size};
 | 
			
		||||
 | 
			
		||||
	if(checkMousePos(&rect))
 | 
			
		||||
	{
 | 
			
		||||
		setCursor(SDL_SYSTEM_CURSOR_HAND);
 | 
			
		||||
 | 
			
		||||
		showTooltip("on/off channel");
 | 
			
		||||
 | 
			
		||||
		if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
 | 
			
		||||
		{
 | 
			
		||||
			if (SDL_GetModState() & KMOD_CTRL)
 | 
			
		||||
			{
 | 
			
		||||
				for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++)
 | 
			
		||||
					music->tracker.patterns[i] = i == index;
 | 
			
		||||
			}
 | 
			
		||||
			else music->tracker.patterns[index] = !music->tracker.patterns[index];
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	u8 color = Chroma;
 | 
			
		||||
	tic->api.sprite(tic, &tic->config.gfx, music->tracker.patterns[index] ? On : Off, x, y, &color, 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void drawTracker(Music* music, s32 x, s32 y)
 | 
			
		||||
{
 | 
			
		||||
	drawTrackerFrames(music, x, y);
 | 
			
		||||
 | 
			
		||||
	x += TIC_FONT_WIDTH * 3;
 | 
			
		||||
 | 
			
		||||
	enum{ChannelWidth = TIC_FONT_WIDTH * 9};
 | 
			
		||||
 | 
			
		||||
	for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++)
 | 
			
		||||
	{
 | 
			
		||||
		s32 patternId = tic_tool_get_pattern_id(getTrack(music), music->tracker.frame, i);
 | 
			
		||||
		drawEditbox(music, x + TIC_FONT_WIDTH * 9 * i + 2*TIC_FONT_WIDTH, y - 9, patternId, setChannelPattern, i);
 | 
			
		||||
		drawEditbox(music, x + ChannelWidth * i + 2*TIC_FONT_WIDTH, y - 9, patternId, setChannelPattern, i);
 | 
			
		||||
		drawTumbler(music, x + ChannelWidth * i + 7*TIC_FONT_WIDTH, y - 9, i);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++)
 | 
			
		||||
		drawTrackerChannel(music, x + TIC_FONT_WIDTH * 9 * i, y, i);
 | 
			
		||||
		drawTrackerChannel(music, x + ChannelWidth * i, y, i);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void enableFollowMode(Music* music)
 | 
			
		||||
@@ -1288,6 +1495,37 @@ static void drawPianoLayout(Music* music)
 | 
			
		||||
	music->tic->api.fixed_text(music->tic, Wip, (TIC80_WIDTH - (sizeof Wip - 1) * TIC_FONT_WIDTH) / 2, TIC80_HEIGHT / 2, systemColor(tic_color_white));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void scrollNotes(Music* music, s32 delta)
 | 
			
		||||
{
 | 
			
		||||
	tic_track_pattern* pattern = getChannelPattern(music);
 | 
			
		||||
 | 
			
		||||
	if(pattern)
 | 
			
		||||
	{
 | 
			
		||||
		SDL_Rect rect = music->tracker.select.rect;
 | 
			
		||||
 | 
			
		||||
		if(rect.h <= 0)
 | 
			
		||||
		{
 | 
			
		||||
			rect.y = music->tracker.row;
 | 
			
		||||
			rect.h = 1;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for(s32 i = rect.y; i < rect.y + rect.h; i++)
 | 
			
		||||
		{
 | 
			
		||||
			s32 note = pattern->rows[i].note + pattern->rows[i].octave * NOTES - NoteStart;
 | 
			
		||||
 | 
			
		||||
			note += delta;
 | 
			
		||||
 | 
			
		||||
			if(note >= 0 && note < NOTES*OCTAVES)
 | 
			
		||||
			{
 | 
			
		||||
				pattern->rows[i].note = note % NOTES + NoteStart;
 | 
			
		||||
				pattern->rows[i].octave = note / NOTES;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		history_add(music->history);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void drawTrackerLayout(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	SDL_Event* event = NULL;
 | 
			
		||||
@@ -1296,6 +1534,11 @@ static void drawTrackerLayout(Music* music)
 | 
			
		||||
		switch (event->type)
 | 
			
		||||
		{
 | 
			
		||||
		case SDL_MOUSEWHEEL:
 | 
			
		||||
			if(SDL_GetModState() & TIC_MOD_CTRL)
 | 
			
		||||
			{
 | 
			
		||||
				scrollNotes(music, event->wheel.y > 0 ? 1 : -1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{		
 | 
			
		||||
				enum{Scroll = NOTES_PER_BEET};
 | 
			
		||||
				s32 delta = event->wheel.y > 0 ? -Scroll : Scroll;
 | 
			
		||||
@@ -1336,6 +1579,12 @@ static void drawTrackerLayout(Music* music)
 | 
			
		||||
 | 
			
		||||
static void tick(Music* music)
 | 
			
		||||
{
 | 
			
		||||
	tic_mem* tic = music->tic;
 | 
			
		||||
 | 
			
		||||
	for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++)
 | 
			
		||||
		if(!music->tracker.patterns[i])
 | 
			
		||||
			tic->ram.registers[i].volume = 0;
 | 
			
		||||
 | 
			
		||||
	switch (music->tab)
 | 
			
		||||
	{
 | 
			
		||||
	case MUSIC_TRACKER_TAB: drawTrackerLayout(music); break;
 | 
			
		||||
@@ -1350,8 +1599,8 @@ static void onStudioEvent(Music* music, StudioEvent event)
 | 
			
		||||
{
 | 
			
		||||
	switch (event)
 | 
			
		||||
	{
 | 
			
		||||
	case TIC_TOOLBAR_CUT: cutToClipboard(music); break;
 | 
			
		||||
	case TIC_TOOLBAR_COPY: copyToClipboard(music); break;
 | 
			
		||||
	case TIC_TOOLBAR_CUT: copyToClipboard(music, true); break;
 | 
			
		||||
	case TIC_TOOLBAR_COPY: copyToClipboard(music, false); break;
 | 
			
		||||
	case TIC_TOOLBAR_PASTE: copyFromClipboard(music); break;
 | 
			
		||||
	case TIC_TOOLBAR_UNDO: undo(music); break;
 | 
			
		||||
	case TIC_TOOLBAR_REDO: redo(music); break;
 | 
			
		||||
@@ -1383,10 +1632,20 @@ void initMusic(Music* music, tic_mem* tic)
 | 
			
		||||
				.sfx = 0,
 | 
			
		||||
				.volume = 0,
 | 
			
		||||
			},
 | 
			
		||||
 | 
			
		||||
			.patterns = {true, true, true, true},
 | 
			
		||||
			.select = 
 | 
			
		||||
			{
 | 
			
		||||
				.start = {0, 0},
 | 
			
		||||
				.rect = {0, 0, 0, 0},
 | 
			
		||||
				.drag = false,
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		.tab = MUSIC_TRACKER_TAB,
 | 
			
		||||
		.history = history_create(&tic->cart.sound.music, sizeof tic->cart.sound.music),
 | 
			
		||||
		.event = onStudioEvent,
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	resetSelection(music);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -49,6 +49,15 @@ struct Music
 | 
			
		||||
			s32 volume;
 | 
			
		||||
		} last;
 | 
			
		||||
 | 
			
		||||
		struct
 | 
			
		||||
		{
 | 
			
		||||
			SDL_Point start;
 | 
			
		||||
			SDL_Rect rect;
 | 
			
		||||
			bool drag;
 | 
			
		||||
		} select;
 | 
			
		||||
 | 
			
		||||
		bool patterns[TIC_SOUND_CHANNELS];
 | 
			
		||||
 | 
			
		||||
	} tracker;
 | 
			
		||||
 | 
			
		||||
	enum
 | 
			
		||||
 
 | 
			
		||||
@@ -59,10 +59,10 @@ static void drawSelection(Sprite* sprite, s32 x, s32 y, s32 w, s32 h)
 | 
			
		||||
	u8 color = systemColor(tic_color_white);
 | 
			
		||||
 | 
			
		||||
	s32 index = sprite->tickCounter / 10;
 | 
			
		||||
	for(s32 i = x; i < (x+w); i++) 		sprite->tic->api.pixel(sprite->tic, i, y, index++ % Step ? color : 0); index++;
 | 
			
		||||
	for(s32 i = y; i < (y+h); i++) 		sprite->tic->api.pixel(sprite->tic, x + w-1, i, index++ % Step ? color : 0); index++;
 | 
			
		||||
	for(s32 i = (x+w-1); i >= x; i--) 	sprite->tic->api.pixel(sprite->tic, i, y + h-1, index++ % Step ? color : 0); index++;
 | 
			
		||||
	for(s32 i = (y+h-1); i >= y; i--) 	sprite->tic->api.pixel(sprite->tic, x, i, index++ % Step ? color : 0);
 | 
			
		||||
	for(s32 i = x; i < (x+w); i++) 		{ sprite->tic->api.pixel(sprite->tic, i, y, index++ % Step ? color : 0);} index++;
 | 
			
		||||
	for(s32 i = y; i < (y+h); i++) 		{ sprite->tic->api.pixel(sprite->tic, x + w-1, i, index++ % Step ? color : 0);} index++;
 | 
			
		||||
	for(s32 i = (x+w-1); i >= x; i--) 	{ sprite->tic->api.pixel(sprite->tic, i, y + h-1, index++ % Step ? color : 0);} index++;
 | 
			
		||||
	for(s32 i = (y+h-1); i >= y; i--) 	{ sprite->tic->api.pixel(sprite->tic, x, i, index++ % Step ? color : 0);}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static SDL_Rect getSpriteRect(Sprite* sprite)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								src/studio.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/studio.c
									
									
									
									
									
								
							@@ -719,6 +719,12 @@ static void initSurfMode()
 | 
			
		||||
	initSurf(&studio.surf, studio.tic, &studio.console);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void gotoSurf()
 | 
			
		||||
{
 | 
			
		||||
	initSurfMode();
 | 
			
		||||
	setStudioMode(TIC_SURF_MODE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void initMenuMode()
 | 
			
		||||
{
 | 
			
		||||
	initMenu(&studio.menu, studio.tic, studio.fs);
 | 
			
		||||
@@ -911,7 +917,7 @@ static void updateHash()
 | 
			
		||||
	md5(&studio.tic->cart, sizeof(tic_cartridge), studio.hash.data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void studioRomSaved()
 | 
			
		||||
static void updateTitle()
 | 
			
		||||
{
 | 
			
		||||
	char name[FILENAME_MAX] = TIC_TITLE;
 | 
			
		||||
 | 
			
		||||
@@ -919,17 +925,19 @@ void studioRomSaved()
 | 
			
		||||
		sprintf(name, "%s [%s]", TIC_TITLE, studio.console.romName);
 | 
			
		||||
 | 
			
		||||
	SDL_SetWindowTitle(studio.window, name);	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void studioRomSaved()
 | 
			
		||||
{
 | 
			
		||||
	updateTitle();
 | 
			
		||||
	updateHash();
 | 
			
		||||
 | 
			
		||||
	studio.tic->api.pause(studio.tic);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void studioRomLoaded()
 | 
			
		||||
{
 | 
			
		||||
	initModules();
 | 
			
		||||
	studioRomSaved();
 | 
			
		||||
 | 
			
		||||
	updateTitle();
 | 
			
		||||
	updateHash();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -197,4 +197,5 @@ bool studioCartChanged();
 | 
			
		||||
void playSystemSfx(s32 id);
 | 
			
		||||
 | 
			
		||||
void runGameFromSurf();
 | 
			
		||||
void gotoSurf();
 | 
			
		||||
void exitFromGameMenu();
 | 
			
		||||
							
								
								
									
										134
									
								
								src/tic.c
									
									
									
									
									
								
							
							
						
						
									
										134
									
								
								src/tic.c
									
									
									
									
									
								
							@@ -295,6 +295,7 @@ static void channelSfx(tic_mem* memory, s32 index, s32 note, s32 octave, s32 dur
 | 
			
		||||
 | 
			
		||||
	c->volume = volume;
 | 
			
		||||
 | 
			
		||||
	if(index >= 0)
 | 
			
		||||
	{
 | 
			
		||||
		struct {s8 speed:SFX_SPEED_BITS;} temp = {speed};
 | 
			
		||||
		c->speed = speed == temp.speed ? speed : machine->soundSrc->sfx.data[index].speed;
 | 
			
		||||
@@ -324,7 +325,6 @@ static void resetMusic(tic_mem* memory)
 | 
			
		||||
		musicSfx(memory, -1, 0, 0, 0, c);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void setMusic(tic_machine* machine, s32 index, s32 frame, s32 row, bool loop)
 | 
			
		||||
{
 | 
			
		||||
	tic_mem* memory = (tic_mem*)machine;
 | 
			
		||||
@@ -711,6 +711,10 @@ static struct
 | 
			
		||||
{
 | 
			
		||||
	s16 Left[TIC80_HEIGHT];
 | 
			
		||||
	s16 Right[TIC80_HEIGHT];	
 | 
			
		||||
	float ULeft[TIC80_HEIGHT];
 | 
			
		||||
	float VLeft[TIC80_HEIGHT];
 | 
			
		||||
	float URight[TIC80_HEIGHT];
 | 
			
		||||
	float VRight[TIC80_HEIGHT];
 | 
			
		||||
} SidesBuffer;
 | 
			
		||||
 | 
			
		||||
static void initSidesBuffer()
 | 
			
		||||
@@ -728,6 +732,26 @@ static void setSidePixel(s32 x, s32 y)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void setSideTexPixel(s32 x, s32 y, float u, float v)
 | 
			
		||||
{
 | 
			
		||||
	s32 yy = (s32)y;
 | 
			
		||||
	if (yy >= 0 && yy < TIC80_HEIGHT)
 | 
			
		||||
	{
 | 
			
		||||
		if (x < SidesBuffer.Left[yy])
 | 
			
		||||
		{
 | 
			
		||||
			SidesBuffer.Left[yy] = x;
 | 
			
		||||
			SidesBuffer.ULeft[yy] = u;
 | 
			
		||||
			SidesBuffer.VLeft[yy] = v;
 | 
			
		||||
		}
 | 
			
		||||
		if (x > SidesBuffer.Right[yy])
 | 
			
		||||
		{
 | 
			
		||||
			SidesBuffer.Right[yy] = x;
 | 
			
		||||
			SidesBuffer.URight[yy] = u;
 | 
			
		||||
			SidesBuffer.VRight[yy] = v;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void api_circle(tic_mem* memory, s32 xm, s32 ym, u32 radius, u8 color)
 | 
			
		||||
{
 | 
			
		||||
	tic_machine* machine = (tic_machine*)memory;
 | 
			
		||||
@@ -735,7 +759,7 @@ static void api_circle(tic_mem* memory, s32 xm, s32 ym, u32 radius, u8 color)
 | 
			
		||||
	initSidesBuffer();
 | 
			
		||||
 | 
			
		||||
	s32 r = radius;
 | 
			
		||||
	int x = -r, y = 0, err = 2-2*r;
 | 
			
		||||
	s32 x = -r, y = 0, err = 2-2*r;
 | 
			
		||||
	do 
 | 
			
		||||
	{
 | 
			
		||||
		setSidePixel(xm-x, ym+y);
 | 
			
		||||
@@ -756,7 +780,7 @@ static void api_circle(tic_mem* memory, s32 xm, s32 ym, u32 radius, u8 color)
 | 
			
		||||
static void api_circle_border(tic_mem* memory, s32 xm, s32 ym, u32 radius, u8 color)
 | 
			
		||||
{
 | 
			
		||||
	s32 r = radius;
 | 
			
		||||
	int x = -r, y = 0, err = 2-2*r;
 | 
			
		||||
	s32 x = -r, y = 0, err = 2-2*r;
 | 
			
		||||
	do {
 | 
			
		||||
		api_pixel(memory, xm-x, ym+y, color);
 | 
			
		||||
		api_pixel(memory, xm-y, ym-x, color);
 | 
			
		||||
@@ -805,6 +829,109 @@ static void api_tri(tic_mem* memory, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32
 | 
			
		||||
			setPixel(machine, x, y, color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
	float x, y, u, v;
 | 
			
		||||
} TexVert;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void ticTexLine(tic_mem* memory, TexVert *v0, TexVert *v1)
 | 
			
		||||
{
 | 
			
		||||
	TexVert *top = v0;
 | 
			
		||||
	TexVert *bot = v1;
 | 
			
		||||
 | 
			
		||||
	if (bot->y < top->y)
 | 
			
		||||
	{
 | 
			
		||||
		top = v1;
 | 
			
		||||
		bot = v0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	float dy = bot->y - top->y;
 | 
			
		||||
	if ((s32)dy == 0)	return;
 | 
			
		||||
 | 
			
		||||
	float step_x = (bot->x - top->x) / dy;
 | 
			
		||||
	float step_u = (bot->u - top->u) / dy;
 | 
			
		||||
	float step_v = (bot->v - top->v) / dy;
 | 
			
		||||
 | 
			
		||||
	float x = top->x;
 | 
			
		||||
	float y = top->y;
 | 
			
		||||
	float u = top->u;
 | 
			
		||||
	float v = top->v;
 | 
			
		||||
	for (; y < (s32)bot->y; y++)
 | 
			
		||||
	{
 | 
			
		||||
		setSideTexPixel(x, y, u, v);
 | 
			
		||||
		x += step_x;
 | 
			
		||||
		u += step_u;
 | 
			
		||||
		v += step_v;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void api_textri(tic_mem* memory, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32 y3, s32 u1, s32 v1, s32 u2, s32 v2, s32 u3, s32 v3,bool use_map,u8 chroma)
 | 
			
		||||
{
 | 
			
		||||
	tic_machine* machine = (tic_machine*)memory;
 | 
			
		||||
	TexVert V0, V1, V2;
 | 
			
		||||
	const u8* ptr = memory->ram.gfx.tiles[0].data;
 | 
			
		||||
	const u8* map = memory->ram.gfx.map.data;
 | 
			
		||||
 | 
			
		||||
	V0.x = (float)x1; 	V0.y = (float)y1; 	V0.u = (float)u1; 	V0.v = (float)v1;
 | 
			
		||||
	V1.x = (float)x2; 	V1.y = (float)y2; 	V1.u = (float)u2; 	V1.v = (float)v2;
 | 
			
		||||
	V2.x = (float)x3; 	V2.y = (float)y3; 	V2.u = (float)u3; 	V2.v = (float)v3;
 | 
			
		||||
	initSidesBuffer();
 | 
			
		||||
 | 
			
		||||
	ticTexLine(memory, &V0, &V1);
 | 
			
		||||
	ticTexLine(memory, &V1, &V2);
 | 
			
		||||
	ticTexLine(memory, &V2, &V0);
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		for (s32 y = 0; y < TIC80_HEIGHT; y++)
 | 
			
		||||
		{
 | 
			
		||||
			float width = SidesBuffer.Right[y] - SidesBuffer.Left[y];
 | 
			
		||||
			if (width > 0)
 | 
			
		||||
			{
 | 
			
		||||
				float du = (SidesBuffer.URight[y] - SidesBuffer.ULeft[y]) / width;
 | 
			
		||||
				float dv = (SidesBuffer.VRight[y] - SidesBuffer.VLeft[y]) / width;
 | 
			
		||||
				float u = SidesBuffer.ULeft[y];
 | 
			
		||||
				float v = SidesBuffer.VLeft[y];
 | 
			
		||||
 | 
			
		||||
				for (s32 x = (s32)SidesBuffer.Left[y]; x <= (s32)SidesBuffer.Right[y]; ++x)
 | 
			
		||||
				{
 | 
			
		||||
					if ((x >= 0) && (x < TIC80_WIDTH))
 | 
			
		||||
					{
 | 
			
		||||
						if (use_map == true)
 | 
			
		||||
						{
 | 
			
		||||
							enum {MapWidth = TIC_MAP_WIDTH * TIC_SPRITESIZE, MapHeight = TIC_MAP_HEIGHT * TIC_SPRITESIZE};
 | 
			
		||||
 | 
			
		||||
							s32 iu = (s32)u % MapWidth;
 | 
			
		||||
							s32 iv = (s32)v % MapHeight;
 | 
			
		||||
 | 
			
		||||
							u8 tile = map[(iv>>3) * TIC_MAP_WIDTH + (iu>>3)];
 | 
			
		||||
							const u8 *buffer = &ptr[tile << 5];
 | 
			
		||||
							u8 color = tic_tool_peek4(buffer, (iu & 7) + ((iv & 7) << 3));
 | 
			
		||||
							if (color != chroma)
 | 
			
		||||
								setPixel(machine, x, y, color);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							enum{SheetWidth = TIC_SPRITESHEET_SIZE, SheetHeight = TIC_SPRITESHEET_SIZE * TIC_SPRITE_BANKS};
 | 
			
		||||
 | 
			
		||||
							s32 iu = (s32)(u) & (SheetWidth - 1);
 | 
			
		||||
							s32 iv = (s32)(v) & (SheetHeight - 1);
 | 
			
		||||
							const u8 *buffer = &ptr[((iu >> 3) + ((iv >> 3) << 4)) << 5];
 | 
			
		||||
							u8 color = tic_tool_peek4(buffer, (iu & 7) + ((iv & 7) << 3));
 | 
			
		||||
							if (color != chroma)
 | 
			
		||||
								setPixel(machine, x, y, color);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					u += du;
 | 
			
		||||
					v += dv;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void api_sprite(tic_mem* memory, const tic_gfx* src, s32 index, s32 x, s32 y, u8* colors, s32 count)
 | 
			
		||||
{
 | 
			
		||||
	drawSprite(memory, src, index, x, y, colors, count, 1, tic_no_flip, tic_no_rotate);
 | 
			
		||||
@@ -1536,6 +1663,7 @@ static void initApi(tic_api* api)
 | 
			
		||||
	INIT_API(circle);
 | 
			
		||||
	INIT_API(circle_border);
 | 
			
		||||
	INIT_API(tri);
 | 
			
		||||
	INIT_API(textri);
 | 
			
		||||
	INIT_API(clip);
 | 
			
		||||
	INIT_API(sfx);
 | 
			
		||||
	INIT_API(sfx_stop);
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@
 | 
			
		||||
#include "defines.h"
 | 
			
		||||
 | 
			
		||||
#define TIC_VERSION_MAJOR 0
 | 
			
		||||
#define TIC_VERSION_MINOR 45
 | 
			
		||||
#define TIC_VERSION_MINOR 46
 | 
			
		||||
#define TIC_VERSION_PATCH 0
 | 
			
		||||
#define TIC_VERSION_STATUS ""
 | 
			
		||||
 | 
			
		||||
@@ -57,7 +57,8 @@
 | 
			
		||||
 | 
			
		||||
#define BITS_IN_BYTE 8
 | 
			
		||||
#define TIC_BANK_SPRITES (1 << BITS_IN_BYTE)
 | 
			
		||||
#define TIC_SPRITES (TIC_BANK_SPRITES * 2)
 | 
			
		||||
#define TIC_SPRITE_BANKS 2
 | 
			
		||||
#define TIC_SPRITES (TIC_BANK_SPRITES * TIC_SPRITE_BANKS)
 | 
			
		||||
 | 
			
		||||
#define TIC_SPRITESHEET_SIZE 128
 | 
			
		||||
 | 
			
		||||
@@ -104,7 +105,7 @@
 | 
			
		||||
 | 
			
		||||
#define API_KEYWORDS {"TIC", "scanline", "print", "cls", "pix", "line", "rect", "rectb", \
 | 
			
		||||
	"spr", "btn", "btnp", "sfx", "map", "mget", "mset", "peek", "poke", "peek4", "poke4", \
 | 
			
		||||
	"memcpy", "memset", "trace", "pmem", "time", "exit", "font", "mouse", "circ", "circb", "tri", \
 | 
			
		||||
	"memcpy", "memset", "trace", "pmem", "time", "exit", "font", "mouse", "circ", "circb", "tri", "textri", \
 | 
			
		||||
	"clip", "music", "sync"}
 | 
			
		||||
 | 
			
		||||
#define TIC_FONT_CHARS 128
 | 
			
		||||
 
 | 
			
		||||
@@ -82,6 +82,7 @@ typedef struct
 | 
			
		||||
	void (*circle)				(tic_mem* memory, s32 x, s32 y, u32 radius, u8 color);
 | 
			
		||||
	void (*circle_border)		(tic_mem* memory, s32 x, s32 y, u32 radius, u8 color);
 | 
			
		||||
	void (*tri)					(tic_mem* memory, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32 y3, u8 color);
 | 
			
		||||
	void (*textri)				(tic_mem* memory, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32 y3, s32 u1, s32 v1, s32 u2, s32 v2, s32 u3, s32 v3 ,bool use_map,u8 chroma);
 | 
			
		||||
	void (*clip)				(tic_mem* memory, s32 x, s32 y, s32 width, s32 height);
 | 
			
		||||
	void (*sfx)					(tic_mem* memory, s32 index, s32 note, s32 octave, s32 duration, s32 channel);
 | 
			
		||||
	void (*sfx_stop)			(tic_mem* memory, s32 channel);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user