Rearranged some stuff

This commit is contained in:
2023-08-15 05:13:39 +10:00
parent 33a9c2f0d1
commit 321a73d20b
7 changed files with 42 additions and 30 deletions

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "Box"]
path = Box
url = https://github.com/Ratstail91/Box.git

View File

@@ -3,19 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Airport", "Airport.vcxproj", "{B6819868-2E07-4E17-8B91-33E8B0D39530}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Airport", "Airport\Airport.vcxproj", "{B6819868-2E07-4E17-8B91-33E8B0D39530}"
ProjectSection(ProjectDependencies) = postProject
{26360002-CC2A-469A-9B28-BA0C1AF41657} = {26360002-CC2A-469A-9B28-BA0C1AF41657}
{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA} = {2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Toy", "Box\Toy\Toy.vcxproj", "{26360002-CC2A-469A-9B28-BA0C1AF41657}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Box", "Box\Box.vcxproj", "{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Box", "Airport\Box\Box.vcxproj", "{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}"
ProjectSection(ProjectDependencies) = postProject
{26360002-CC2A-469A-9B28-BA0C1AF41657} = {26360002-CC2A-469A-9B28-BA0C1AF41657}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Toy", "Airport\Box\Toy\Toy.vcxproj", "{26360002-CC2A-469A-9B28-BA0C1AF41657}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -32,14 +32,6 @@ Global
{B6819868-2E07-4E17-8B91-33E8B0D39530}.Release|x64.Build.0 = Release|x64
{B6819868-2E07-4E17-8B91-33E8B0D39530}.Release|x86.ActiveCfg = Release|Win32
{B6819868-2E07-4E17-8B91-33E8B0D39530}.Release|x86.Build.0 = Release|Win32
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x64.ActiveCfg = Debug|x64
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x64.Build.0 = Debug|x64
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x86.ActiveCfg = Debug|Win32
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x86.Build.0 = Debug|Win32
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x64.ActiveCfg = Release|x64
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x64.Build.0 = Release|x64
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x86.ActiveCfg = Release|Win32
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x86.Build.0 = Release|Win32
{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}.Debug|x64.ActiveCfg = Debug|x64
{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}.Debug|x64.Build.0 = Debug|x64
{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}.Debug|x86.ActiveCfg = Debug|Win32
@@ -48,6 +40,14 @@ Global
{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}.Release|x64.Build.0 = Release|x64
{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}.Release|x86.ActiveCfg = Release|Win32
{2937C4D3-5C8D-4E59-9B6D-452B409F4ABA}.Release|x86.Build.0 = Release|Win32
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x64.ActiveCfg = Debug|x64
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x64.Build.0 = Debug|x64
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x86.ActiveCfg = Debug|Win32
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x86.Build.0 = Debug|Win32
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x64.ActiveCfg = Release|x64
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x64.Build.0 = Release|x64
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x86.ActiveCfg = Release|Win32
{26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -117,7 +117,7 @@
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AdditionalIncludeDirectories>$(SDL2Dir)\include;$(SDL2ImageDir)\include;$(SDL2MixerDir)\include;$(SDL2TTFDir)\include;$(SolutionDir)Box/source;$(SolutionDir)Box/Toy/source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SDL2Dir)\include;$(SDL2ImageDir)\include;$(SDL2MixerDir)\include;$(SDL2TTFDir)\include;$(ProjectDir)Box/source;$(ProjectDir)Box/Toy/source</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -131,8 +131,7 @@
<Command>xcopy "$(SDL2Dir)\lib\x64\SDL2.dll" "$(OutDir)" /Y /I /E
xcopy "$(SDL2ImageDir)\lib\x64\SDL2_image.dll" "$(OutDir)" /Y /I /E
xcopy "$(SDL2MixerDir)\lib\x64\SDL2_mixer.dll" "$(OutDir)" /Y /I /E
xcopy "$(SDL2TTFDir)\lib\x64\SDL2_ttf.dll" "$(OutDir)" /Y /I /E
xcopy "$(ProjectDir)assets" "$(Outdir)assets" /Y /I /E</Command>
xcopy "$(SDL2TTFDir)\lib\x64\SDL2_ttf.dll" "$(OutDir)" /Y /I /E</Command>
</PostBuildEvent>
<Bscmake>
<OutputFile>$(Platform)\$(Configuration)\$(TargetName).bsc</OutputFile>
@@ -147,7 +146,7 @@ xcopy "$(ProjectDir)assets" "$(Outdir)assets" /Y /I /E</Command>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AdditionalIncludeDirectories>$(SDL2Dir)\include;$(SDL2ImageDir)\include;$(SDL2MixerDir)\include;$(SDL2TTFDir)\include;$(SolutionDir)Box/source;$(SolutionDir)Box/Toy/source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SDL2Dir)\include;$(SDL2ImageDir)\include;$(SDL2MixerDir)\include;$(SDL2TTFDir)\include;$(ProjectDir)Box/source;$(ProjectDir)Box/Toy/source</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
</ClCompile>
<Link>
@@ -164,8 +163,7 @@ xcopy "$(ProjectDir)assets" "$(Outdir)assets" /Y /I /E</Command>
<Command>xcopy "$(SDL2Dir)\lib\x64\SDL2.dll" "$(OutDir)" /Y /I /E
xcopy "$(SDL2ImageDir)\lib\x64\SDL2_image.dll" "$(OutDir)" /Y /I /E
xcopy "$(SDL2MixerDir)\lib\x64\SDL2_mixer.dll" "$(OutDir)" /Y /I /E
xcopy "$(SDL2TTFDir)\lib\x64\SDL2_ttf.dll" "$(OutDir)" /Y /I /E
xcopy "$(ProjectDir)assets" "$(Outdir)assets" /Y /I /E</Command>
xcopy "$(SDL2TTFDir)\lib\x64\SDL2_ttf.dll" "$(OutDir)" /Y /I /E</Command>
</PostBuildEvent>
<Bscmake>
<OutputFile>$(Platform)\$(Configuration)\$(TargetName).bsc</OutputFile>

1
Box

Submodule Box deleted from ed1da29186

View File

@@ -69,7 +69,7 @@ fn shadowCastOctant(node: opaque, x: int, y: int, dirX: int, dirY: int, depth: i
//for each tile, cast its shadow, and see if its already obscured
for (var j: int = 0; abs(j) < depth; j += dirY) {
for (var i: int = 0; abs(i) < depth; i += dirX) {
for (var i: int = 0; abs(i) < abs(j); i += dirX) {
//make sure this tile can actually cast a shadow
var CACHE_ITERATION: int const = (y + j) * MAP_GRID_WIDTH * 2 + (x + i) * 2;
var ITERATION: int const = (y + j) * MAP_GRID_WIDTH * 3 + (x + i) * 3;
@@ -87,6 +87,10 @@ fn shadowCastOctant(node: opaque, x: int, y: int, dirX: int, dirY: int, depth: i
//cast the shadow
var shadow = shadowCastTile(i + x, j + y, dirX, dirY, depth);
if (shadow == null) {
continue;
}
//merge shadows if needed
var index: int = 0;
@@ -127,12 +131,17 @@ fn shadowCastOctant(node: opaque, x: int, y: int, dirX: int, dirY: int, depth: i
if (index > 0 && shadows.length() > index && shadows[index -1][1] > shadow[0]) {
print "second bracket";
overlapping = true;
shadows[index-1][1] = shadow[1]; //extend the prev shadow
print "MARK one";
shadows[index-1][1] = max(shadows[index-1][1], shadow[1]); //extend the prev shadow
print "MARK two";
//see if the newly extended prev overlaps the shadow at "index"
if (shadows[index-1][1] >= shadows[index][0]) {
//merge the two
shadows[index-1][1] = shadows[index][1];
shadows[index-1][1] = max(shadows[index-1][1], shadows[index][1]);
shadows = shadows.remove(index);
}
}
@@ -142,7 +151,7 @@ fn shadowCastOctant(node: opaque, x: int, y: int, dirX: int, dirY: int, depth: i
print "third bracket";
overlapping = true;
//extend the next shadow
shadows[index][1] = shadow[0];
shadows[index][0] = min(shadows[index][0], shadow[0]);
}
if (!overlapping) {
@@ -163,13 +172,22 @@ fn shadowCastTile(x: int, y: int, dirX: int, dirY: int, depth: int) {
var start = abs(shadowCastPoint(x, y, depth));
var end = abs(shadowCastPoint(x + sign(dirX), y + sign(dirY), depth));
if (checkIsNaN(start) || checkIsNaN(end)) {
return null;
}
if (start < end) {
return [start, end];
}
else {
return [end, start];
}
}
fn shadowCastPoint(x: float, y: float, depth: int) {
// if (y == 0) {
// return sin(tan(INFINITY));
// }
if (y == 0) {
return NAN;
}
return sin(tan(x/y)) * depth;
}