Skip to content

Commit

Permalink
Dead end collision checks and sideroom
Browse files Browse the repository at this point in the history
  • Loading branch information
kaosnyrb committed Jun 10, 2020
1 parent 2ae8ed8 commit 9e5b5fd
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 17 deletions.
37 changes: 23 additions & 14 deletions Undaunted/RiftManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,24 +310,33 @@ namespace Undaunted {
//Close the remaining exits
while (sideexits.size() > 0)
{
bool validbox = false;
Tile exit = sideexits.front();
sideexits.pop();
Block selectedblock = FindDeadend(exit.exittype.c_str(),"end");
selectedblock.RotateAroundPivot(Vector3(0, 0, 0), exit.bearing);
_MESSAGE("Place the block");
for (int i = 0; i < selectedblock.reflist.length; i++)
{
FormRef ref = selectedblock.reflist.data[i];
ref.pos.x += exit.x;
ref.pos.y += exit.y;
ref.pos.z += exit.z;
formlist.AddItem(ref);
}
placedRooms++;
_MESSAGE("Update the navmesh");
for (int i = 0; i < selectedblock.navlist.length; i++)
BoundingBox box;
box = selectedblock.boundingbox;
box.position.x += exit.x;
box.position.y += exit.y;
validbox = !boundingboxes.Intersects(box);
if (validbox)
{
MarkTile(selectedblock.navlist.data[i].x + exit.x, selectedblock.navlist.data[i].y + exit.y, selectedblock.navlist.data[i].z + exit.z, selectedblock.navlist.data[i].quadsize);
sideexits.pop();
_MESSAGE("Place the block");
for (int i = 0; i < selectedblock.reflist.length; i++)
{
FormRef ref = selectedblock.reflist.data[i];
ref.pos.x += exit.x;
ref.pos.y += exit.y;
ref.pos.z += exit.z;
formlist.AddItem(ref);
}
_MESSAGE("Update the navmesh");
for (int i = 0; i < selectedblock.navlist.length; i++)
{
MarkTile(selectedblock.navlist.data[i].x + exit.x, selectedblock.navlist.data[i].y + exit.y, selectedblock.navlist.data[i].z + exit.z, selectedblock.navlist.data[i].quadsize);
}
boundingboxes.AddItem(box);
}
}

Expand Down
Binary file modified datafiles/Mundusform.esp
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
["Skyrim.esm", 351246, 0.000000, 512.000000, 0.000000, 0.000000, -0.000000, 0.000000, 100]
],
[
[0,-256,0,128],
[0,0,0,128],
[0,256,0,128],
[0,512,0,128],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
["Skyrim.esm",507382,0,0,256,0,0,0,100]
],
[
[0,-256,0,128],
[0,0,256,128],
[0,256,256,128]
],
Expand Down
65 changes: 65 additions & 0 deletions datafiles/Mundusform/Blocks/DweFacadeHallSm_sideroom01.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[
["end",0,0,0],
[-512,512,512,512],
["DweFacadeHallSm1way01",0,0,0,128],
[
["Skyrim.esm", 576660, 253.000000, 696.000000, -18.000000, 0.000000, -0.000000, 0.000000, 100],
["Skyrim.esm", 489313, -256.000000, 704.000000, 128.000000, 0.000000, -0.000000, 0.000000, 100],
["Skyrim.esm", 576660, 253.000000, 1842.000000, -16.000000, 0.000000, -0.000000, 180.000005, 100],
["Skyrim.esm", 360894, -512.000000, 1280.000000, 0.000000, 0.000000, -0.000000, 180.000005, 100],
["Skyrim.esm", 360889, 512.000000, 768.000000, 0.000000, 0.000000, -0.000000, 90.000003, 100],
["Skyrim.esm", 360894, 512.000000, 1280.000000, 0.000000, 0.000000, -0.000000, 0.000000, 100],
["Skyrim.esm", 372189, 253.000000, 1880.000000, 114.000000, 0.000000, -0.000000, 90.000003, 67],
["Skyrim.esm", 372189, -259.000000, 664.000000, 114.000000, 0.000000, -0.000000, 270.000001, 67],
["Skyrim.esm", 489313, 250.000000, 1840.000000, 128.000000, 0.000000, -0.000000, 180.000005, 100],
["Skyrim.esm", 360895, 0.000000, 768.000000, 0.000000, 0.000000, -0.000000, 90.000003, 100],
["Skyrim.esm", 360889, -512.000000, 1792.000000, 0.000000, 0.000000, -0.000000, 270.000001, 100],
["Skyrim.esm", 360893, 0.000000, 1280.000000, 0.000000, 0.000000, 0.000000, 0.000000, 100],
["Skyrim.esm", 348439, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 100],
["Skyrim.esm", 489313, 256.000000, 698.000000, 126.000000, 0.000000, -0.000000, 0.000000, 100],
["Skyrim.esm", 360889, -512.000000, 768.000000, 0.000000, 0.000000, -0.000000, 180.000005, 100],
["Skyrim.esm", 576660, -259.000000, 702.000000, -16.000000, 0.000000, -0.000000, 0.000000, 100],
["Skyrim.esm", 372189, -259.000000, 1880.000000, 114.000000, 0.000000, -0.000000, 90.000003, 67],
["Skyrim.esm", 360889, 512.000000, 1792.000000, 0.000000, 0.000000, -0.000000, 0.000000, 100],
["Skyrim.esm", 576660, -259.000000, 1842.000000, -16.000000, 0.000000, -0.000000, 180.000005, 100],
["Skyrim.esm", 372189, 253.000000, 658.000000, 112.000000, 0.000000, -0.000000, 270.000001, 67],
["Skyrim.esm", 360894, 0.000000, 1792.000000, 0.000000, 0.000000, -0.000000, 270.000001, 100],
["Skyrim.esm", 489313, -262.000000, 1840.000000, 128.000000, 0.000000, -0.000000, 180.000005, 100],
["Skyrim.esm", 351246, 0.000000, 512.000000, 0.000000, 0.000000, -0.000000, 0.000000, 100]
],
[
[0,0,0,128],
[0,256,0,128],
[0,512,0,128],
[0,768,0,128],
[0,1024,0,128],
[0,1280,0,128],
[-256,768,0,128],
[-256,512,0,128],
[-256,1024,0,128],
[-256,1280,0,128],
[-512,512,0,128],
[-512,768,0,128],
[-512,1024,0,128],
[-512,1280,0,128],
[-512,1536,0,128],
[-512,1792,0,128],
[-256,1792,0,128],
[-256,1536,0,128],
[0,1536,0,128],
[0,1792,0,128],
[256,1536,0,128],
[256,1792,0,128],
[256,512,0,128],
[256,768,0,128],
[256,1280,0,128],
[256,1024,0,128],
[512,1792,0,128],
[512,1536,0,128],
[512,1280,0,128],
[512,1024,0,128],
[512,768,0,128],
[512,512,0,128]
],
[]
]
2 changes: 1 addition & 1 deletion datafiles/Mundusform/Settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
["BaseNavmeshResolution","64", "The size of the quads stored"],
["NavmeshCorriderHeight","512", "The distance at which to join vertices vertically"],
["RiftGenerationRooms","3", "The number of rooms in a dungeon."],
["RiftGenerationHallLength","5", "The length of the hall between rooms."],
["RiftGenerationHallLength","10", "The length of the hall between rooms."],
["RiftGenerationRoomAttempts","100", "Number of times we try and place a room in the slot before trying another hall."],
["RiftGenerationBreaker","1000", "Number of times we try and place a block before giving up entirely. Prevents infinite loops."],
["BoundingBoxCheck","1", "Use bounding boxes to prevent overlaps. Useful to turn off while debugging."]
Expand Down
Binary file modified datafiles/Scripts/Mundusform_CaptureAreaEffect.pex
Binary file not shown.
Binary file modified datafiles/Scripts/Mundusform_ExportNavMesh.pex
Binary file not shown.
Binary file modified datafiles/Scripts/Mundusform_NavTileCapture.pex
Binary file not shown.
Binary file modified datafiles/Scripts/Mundusform_RiftDoor.pex
Binary file not shown.
Binary file modified datafiles/Scripts/Mundusform_SystemScript.pex
Binary file not shown.
1 change: 1 addition & 0 deletions datafiles/Source/Scripts/Mundusform_CaptureAreaEffect.psc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import Mundusform_SystemScript

Event OnEffectStart(Actor Target, Actor Caster)
CaptureArea()
Debug.Notification("Cell saved to UndauntedRift.pas")
EndEvent
3 changes: 2 additions & 1 deletion datafiles/Source/Scripts/Mundusform_ExportNavMesh.psc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Scriptname Mundusform_ExportNavMesh extends activemagiceffect
import Mundusform_SystemScript

Event OnEffectStart(Actor Target, Actor Caster)
Debug.Notification("Exporting Navmesh...")

ExportNavMesh()
Debug.Notification("Exported Navmesh.")
EndEvent
9 changes: 8 additions & 1 deletion datafiles/Source/Scripts/Mundusform_RiftDoor.psc
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,12 @@ event onActivate(objectReference akActivator)
refs[refslength].SetAngle(rotations[(refslength * 3)],rotations[(refslength * 3)+1],rotations[(refslength * 3)+2])
endwhile

;Things get stuck sometimes. Do it again.
refslength = refs.Length
while(refslength > 0)
Debug.Notification("Translating")
refslength -= 1
refs[refslength].TranslateTo(refs[refslength].GetPositionX(), refs[refslength].GetPositionY(), refs[refslength].GetPositionZ(), rotations[(refslength * 3)], rotations[(refslength * 3)+1],rotations[(refslength * 3)+2], 1, 10.0)
endwhile
Debug.Notification("Rift Complete")
endEvent
endEvent

0 comments on commit 9e5b5fd

Please sign in to comment.