diff --git a/img/frames/dungeon/regular/b.png b/img/frames/dungeon/regular/b.png index 8d697422..ac08810e 100644 Binary files a/img/frames/dungeon/regular/b.png and b/img/frames/dungeon/regular/b.png differ diff --git a/img/frames/dungeon/regular/bThumb.png b/img/frames/dungeon/regular/bThumb.png index 9052f8ab..06f17ff2 100644 Binary files a/img/frames/dungeon/regular/bThumb.png and b/img/frames/dungeon/regular/bThumb.png differ diff --git a/img/frames/dungeon/regular/c.png b/img/frames/dungeon/regular/c.png new file mode 100644 index 00000000..2c679155 Binary files /dev/null and b/img/frames/dungeon/regular/c.png differ diff --git a/img/frames/dungeon/regular/cThumb.png b/img/frames/dungeon/regular/cThumb.png new file mode 100644 index 00000000..ac4f2c92 Binary files /dev/null and b/img/frames/dungeon/regular/cThumb.png differ diff --git a/img/frames/dungeon/regular/frame.svg b/img/frames/dungeon/regular/frame.svg new file mode 100644 index 00000000..8e73565b --- /dev/null +++ b/img/frames/dungeon/regular/frame.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/img/frames/dungeon/regular/frameThumb.png b/img/frames/dungeon/regular/frameThumb.png new file mode 100644 index 00000000..646a590e Binary files /dev/null and b/img/frames/dungeon/regular/frameThumb.png differ diff --git a/img/frames/dungeon/regular/g.png b/img/frames/dungeon/regular/g.png new file mode 100644 index 00000000..2fec5584 Binary files /dev/null and b/img/frames/dungeon/regular/g.png differ diff --git a/img/frames/dungeon/regular/gThumb.png b/img/frames/dungeon/regular/gThumb.png new file mode 100644 index 00000000..c892bcca Binary files /dev/null and b/img/frames/dungeon/regular/gThumb.png differ diff --git a/img/frames/dungeon/regular/pinline.svg b/img/frames/dungeon/regular/pinline.svg new file mode 100644 index 00000000..f2c4c575 --- /dev/null +++ b/img/frames/dungeon/regular/pinline.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/img/frames/dungeon/regular/pinlineThumb.png b/img/frames/dungeon/regular/pinlineThumb.png new file mode 100644 index 00000000..844527d2 Binary files /dev/null and b/img/frames/dungeon/regular/pinlineThumb.png differ diff --git a/img/frames/dungeon/regular/r.png b/img/frames/dungeon/regular/r.png new file mode 100644 index 00000000..a66f445c Binary files /dev/null and b/img/frames/dungeon/regular/r.png differ diff --git a/img/frames/dungeon/regular/rThumb.png b/img/frames/dungeon/regular/rThumb.png new file mode 100644 index 00000000..aa743f58 Binary files /dev/null and b/img/frames/dungeon/regular/rThumb.png differ diff --git a/img/frames/dungeon/regular/u.png b/img/frames/dungeon/regular/u.png new file mode 100644 index 00000000..ed06a566 Binary files /dev/null and b/img/frames/dungeon/regular/u.png differ diff --git a/img/frames/dungeon/regular/uThumb.png b/img/frames/dungeon/regular/uThumb.png new file mode 100644 index 00000000..e96a7e7d Binary files /dev/null and b/img/frames/dungeon/regular/uThumb.png differ diff --git a/img/frames/dungeon/regular/w.png b/img/frames/dungeon/regular/w.png new file mode 100644 index 00000000..06786793 Binary files /dev/null and b/img/frames/dungeon/regular/w.png differ diff --git a/img/frames/dungeon/regular/wThumb.png b/img/frames/dungeon/regular/wThumb.png new file mode 100644 index 00000000..a9bcca0b Binary files /dev/null and b/img/frames/dungeon/regular/wThumb.png differ diff --git a/img/frames/dungeon/walls/fx/corner.png b/img/frames/dungeon/walls - original/fx/corner.png similarity index 100% rename from img/frames/dungeon/walls/fx/corner.png rename to img/frames/dungeon/walls - original/fx/corner.png diff --git a/img/frames/dungeon/walls/fx/cross.png b/img/frames/dungeon/walls - original/fx/cross.png similarity index 100% rename from img/frames/dungeon/walls/fx/cross.png rename to img/frames/dungeon/walls - original/fx/cross.png diff --git a/img/frames/dungeon/walls/fx/straight.png b/img/frames/dungeon/walls - original/fx/straight.png similarity index 100% rename from img/frames/dungeon/walls/fx/straight.png rename to img/frames/dungeon/walls - original/fx/straight.png diff --git a/img/frames/dungeon/walls/fx/t.png b/img/frames/dungeon/walls - original/fx/t.png similarity index 100% rename from img/frames/dungeon/walls/fx/t.png rename to img/frames/dungeon/walls - original/fx/t.png diff --git a/img/frames/dungeon/walls - original/shape/corner.png b/img/frames/dungeon/walls - original/shape/corner.png new file mode 100644 index 00000000..52095db5 Binary files /dev/null and b/img/frames/dungeon/walls - original/shape/corner.png differ diff --git a/img/frames/dungeon/walls - original/shape/cross.png b/img/frames/dungeon/walls - original/shape/cross.png new file mode 100644 index 00000000..8ad286a1 Binary files /dev/null and b/img/frames/dungeon/walls - original/shape/cross.png differ diff --git a/img/frames/dungeon/walls - original/shape/straight.png b/img/frames/dungeon/walls - original/shape/straight.png new file mode 100644 index 00000000..ad1ce0af Binary files /dev/null and b/img/frames/dungeon/walls - original/shape/straight.png differ diff --git a/img/frames/dungeon/walls - original/shape/t.png b/img/frames/dungeon/walls - original/shape/t.png new file mode 100644 index 00000000..efb80eb6 Binary files /dev/null and b/img/frames/dungeon/walls - original/shape/t.png differ diff --git a/img/frames/dungeon/walls/arrow.png b/img/frames/dungeon/walls/arrow.png new file mode 100644 index 00000000..d8efe8b4 Binary files /dev/null and b/img/frames/dungeon/walls/arrow.png differ diff --git a/img/frames/dungeon/walls/doorway.png b/img/frames/dungeon/walls/doorway.png new file mode 100644 index 00000000..ba40c0d1 Binary files /dev/null and b/img/frames/dungeon/walls/doorway.png differ diff --git a/img/frames/dungeon/walls/fx/bottom.png b/img/frames/dungeon/walls/fx/bottom.png new file mode 100644 index 00000000..0c6dd91f Binary files /dev/null and b/img/frames/dungeon/walls/fx/bottom.png differ diff --git a/img/frames/dungeon/walls/fx/bottomleft.png b/img/frames/dungeon/walls/fx/bottomleft.png new file mode 100644 index 00000000..d07d8b04 Binary files /dev/null and b/img/frames/dungeon/walls/fx/bottomleft.png differ diff --git a/img/frames/dungeon/walls/fx/bottomright.png b/img/frames/dungeon/walls/fx/bottomright.png new file mode 100644 index 00000000..e4fd09c6 Binary files /dev/null and b/img/frames/dungeon/walls/fx/bottomright.png differ diff --git a/img/frames/dungeon/walls/fx/doorway.png b/img/frames/dungeon/walls/fx/doorway.png new file mode 100644 index 00000000..9f639085 Binary files /dev/null and b/img/frames/dungeon/walls/fx/doorway.png differ diff --git a/img/frames/dungeon/walls/fx/left.png b/img/frames/dungeon/walls/fx/left.png new file mode 100644 index 00000000..57b55045 Binary files /dev/null and b/img/frames/dungeon/walls/fx/left.png differ diff --git a/img/frames/dungeon/walls/fx/outer.png b/img/frames/dungeon/walls/fx/outer.png new file mode 100644 index 00000000..f46eb3cc Binary files /dev/null and b/img/frames/dungeon/walls/fx/outer.png differ diff --git a/img/frames/dungeon/walls/fx/right.png b/img/frames/dungeon/walls/fx/right.png new file mode 100644 index 00000000..53605a63 Binary files /dev/null and b/img/frames/dungeon/walls/fx/right.png differ diff --git a/img/frames/dungeon/walls/fx/top.png b/img/frames/dungeon/walls/fx/top.png new file mode 100644 index 00000000..f147ee2f Binary files /dev/null and b/img/frames/dungeon/walls/fx/top.png differ diff --git a/img/frames/dungeon/walls/fx/topleft.png b/img/frames/dungeon/walls/fx/topleft.png new file mode 100644 index 00000000..415f29d4 Binary files /dev/null and b/img/frames/dungeon/walls/fx/topleft.png differ diff --git a/img/frames/dungeon/walls/fx/topright.png b/img/frames/dungeon/walls/fx/topright.png new file mode 100644 index 00000000..5b2b2051 Binary files /dev/null and b/img/frames/dungeon/walls/fx/topright.png differ diff --git a/img/frames/dungeon/walls/ref.png b/img/frames/dungeon/walls/ref.png new file mode 100644 index 00000000..e56ffbdc Binary files /dev/null and b/img/frames/dungeon/walls/ref.png differ diff --git a/img/frames/dungeon/walls/shape/bottom.png b/img/frames/dungeon/walls/shape/bottom.png new file mode 100644 index 00000000..0531a05b Binary files /dev/null and b/img/frames/dungeon/walls/shape/bottom.png differ diff --git a/img/frames/dungeon/walls/shape/bottomleft.png b/img/frames/dungeon/walls/shape/bottomleft.png new file mode 100644 index 00000000..a530686b Binary files /dev/null and b/img/frames/dungeon/walls/shape/bottomleft.png differ diff --git a/img/frames/dungeon/walls/shape/bottomright.png b/img/frames/dungeon/walls/shape/bottomright.png new file mode 100644 index 00000000..f95f960b Binary files /dev/null and b/img/frames/dungeon/walls/shape/bottomright.png differ diff --git a/img/frames/dungeon/walls/shape/corner.png b/img/frames/dungeon/walls/shape/corner.png deleted file mode 100644 index 28fe0313..00000000 Binary files a/img/frames/dungeon/walls/shape/corner.png and /dev/null differ diff --git a/img/frames/dungeon/walls/shape/cross.png b/img/frames/dungeon/walls/shape/cross.png deleted file mode 100644 index 3c349428..00000000 Binary files a/img/frames/dungeon/walls/shape/cross.png and /dev/null differ diff --git a/img/frames/dungeon/walls/shape/doorway.png b/img/frames/dungeon/walls/shape/doorway.png new file mode 100644 index 00000000..a68c1aae Binary files /dev/null and b/img/frames/dungeon/walls/shape/doorway.png differ diff --git a/img/frames/dungeon/walls/shape/left.png b/img/frames/dungeon/walls/shape/left.png new file mode 100644 index 00000000..cdc3edbe Binary files /dev/null and b/img/frames/dungeon/walls/shape/left.png differ diff --git a/img/frames/dungeon/walls/shape/outer.png b/img/frames/dungeon/walls/shape/outer.png new file mode 100644 index 00000000..d2541e09 Binary files /dev/null and b/img/frames/dungeon/walls/shape/outer.png differ diff --git a/img/frames/dungeon/walls/shape/right.png b/img/frames/dungeon/walls/shape/right.png new file mode 100644 index 00000000..55f84b90 Binary files /dev/null and b/img/frames/dungeon/walls/shape/right.png differ diff --git a/img/frames/dungeon/walls/shape/straight.png b/img/frames/dungeon/walls/shape/straight.png deleted file mode 100644 index 3a539e24..00000000 Binary files a/img/frames/dungeon/walls/shape/straight.png and /dev/null differ diff --git a/img/frames/dungeon/walls/shape/t.png b/img/frames/dungeon/walls/shape/t.png deleted file mode 100644 index fb8f4191..00000000 Binary files a/img/frames/dungeon/walls/shape/t.png and /dev/null differ diff --git a/img/frames/dungeon/walls/shape/top.png b/img/frames/dungeon/walls/shape/top.png new file mode 100644 index 00000000..7ef16d2c Binary files /dev/null and b/img/frames/dungeon/walls/shape/top.png differ diff --git a/img/frames/dungeon/walls/shape/topleft.png b/img/frames/dungeon/walls/shape/topleft.png new file mode 100644 index 00000000..9d5c5f3e Binary files /dev/null and b/img/frames/dungeon/walls/shape/topleft.png differ diff --git a/img/frames/dungeon/walls/shape/topright.png b/img/frames/dungeon/walls/shape/topright.png new file mode 100644 index 00000000..f9b75f87 Binary files /dev/null and b/img/frames/dungeon/walls/shape/topright.png differ diff --git a/img/frames/dungeon/walls/textures/b.png b/img/frames/dungeon/walls/textures/b.png new file mode 100644 index 00000000..46b2fa72 Binary files /dev/null and b/img/frames/dungeon/walls/textures/b.png differ diff --git a/img/frames/dungeon/walls/textures/c.png b/img/frames/dungeon/walls/textures/c.png new file mode 100644 index 00000000..608ea36d Binary files /dev/null and b/img/frames/dungeon/walls/textures/c.png differ diff --git a/img/frames/dungeon/walls/textures/g.png b/img/frames/dungeon/walls/textures/g.png new file mode 100644 index 00000000..a1d0b9b4 Binary files /dev/null and b/img/frames/dungeon/walls/textures/g.png differ diff --git a/img/frames/dungeon/walls/textures/r.png b/img/frames/dungeon/walls/textures/r.png new file mode 100644 index 00000000..31a3deb0 Binary files /dev/null and b/img/frames/dungeon/walls/textures/r.png differ diff --git a/img/frames/dungeon/walls/textures/u.png b/img/frames/dungeon/walls/textures/u.png new file mode 100644 index 00000000..ac7aa489 Binary files /dev/null and b/img/frames/dungeon/walls/textures/u.png differ diff --git a/img/frames/dungeon/walls/textures/w.png b/img/frames/dungeon/walls/textures/w.png new file mode 100644 index 00000000..e06c63fb Binary files /dev/null and b/img/frames/dungeon/walls/textures/w.png differ diff --git a/img/manaSymbols/tafr-21-lost-mine-of-phandelver.jpg b/img/manaSymbols/tafr-21-lost-mine-of-phandelver.jpg new file mode 100644 index 00000000..a3fd263d Binary files /dev/null and b/img/manaSymbols/tafr-21-lost-mine-of-phandelver.jpg differ diff --git a/js/creator-20.js b/js/creator-20.js index a4795ef2..23c513c7 100644 --- a/js/creator-20.js +++ b/js/creator-20.js @@ -1392,6 +1392,9 @@ function drawCard() { if (card.version.includes('saga') && typeof sagaCanvas !== "undefined") { cardContext.drawImage(sagaCanvas, 0, 0, cardCanvas.width, cardCanvas.height); } + if (card.version.includes('dungeon') && typeof dungeonCanvas !== "undefined") { + cardContext.drawImage(dungeonCanvas, 0, 0, cardCanvas.width, cardCanvas.height); + } cardContext.drawImage(textCanvas, 0, 0, cardCanvas.width, cardCanvas.height); cardContext.drawImage(setSymbol, scaleX(card.setSymbolX), scaleY(card.setSymbolY), setSymbol.width * card.setSymbolZoom, setSymbol.height * card.setSymbolZoom) cardContext.drawImage(bottomInfoCanvas, 0, 0, cardCanvas.width, cardCanvas.height); diff --git a/js/frames/groupMisc-1.js b/js/frames/groupMisc-1.js index fe42dfcf..3317944f 100644 --- a/js/frames/groupMisc-1.js +++ b/js/frames/groupMisc-1.js @@ -1,4 +1,5 @@ loadFramePacks([ + {name:'Dungeon (AFR)', value:'Dungeon'}, {name:'Future Shifted', value:'FutureRegular'}, {name:'Seventh Edition', value:'Seventh'}, {name:'Fifth Edition', value:'SeventhButFifth'}, diff --git a/js/frames/packDungeon.js b/js/frames/packDungeon.js index 8e8aeade..9654f6a6 100644 --- a/js/frames/packDungeon.js +++ b/js/frames/packDungeon.js @@ -1,20 +1,21 @@ //Create objects for common properties across available frames -// var masks = [{src:'/img/frames/saga/sagaMaskPinline.png', name:'Pinline'}, {src:'/img/frames/m15/regular/m15MaskTitle.png', name:'Title'}, {src:'/img/frames/saga/sagaMaskType.png', name:'Type'}, {src:'/img/frames/saga/sagaMaskFrame.png', name:'Frame'}, {src:'/img/frames/saga/sagaMaskBanner.png', name:'Banner'}, {src:'/img/frames/saga/sagaMaskBannerRight.png', name:'Banner (Right)'}, {src:'/img/frames/saga/sagaMaskText.png', name:'Text'}, {src:'/img/frames/saga/sagaMaskTextRight.png', name:'Text (Right)'}, {src:'/img/frames/saga/sagaMaskBorder.png', name:'Border'}]; +var masks = [{src:'/img/frames/dungeon/regular/pinline.svg', name:'Pinline'}, {src:'/img/frames/m15/regular/m15MaskTitle.png', name:'Title'}, {src:'/img/frames/dungeon/regular/frame.svg', name:'Frame'}]; //defines available frames availableFrames = [ - {name:'White Frame', src:'/img/frames/dungeon/regular/b.png', complementary:7}, - {name:'Blue Frame', src:'/img/frames/dungeon/regular/b.png', complementary:7}, - {name:'Black Frame', src:'/img/frames/dungeon/regular/b.png', complementary:7}, - {name:'Red Frame', src:'/img/frames/dungeon/regular/b.png', complementary:7}, - {name:'Green Frame', src:'/img/frames/dungeon/regular/b.png', complementary:7}, - {name:'Multicolored Frame', src:'/img/frames/dungeon/regular/b.png', complementary:7}, - {name:'Land Frame', src:'/img/frames/dungeon/regular/b.png', complementary:7}, + {name:'White Frame', src:'/img/frames/dungeon/regular/w.png', complementary:6, masks:masks}, + {name:'Blue Frame', src:'/img/frames/dungeon/regular/u.png', complementary:6, masks:masks}, + {name:'Black Frame', src:'/img/frames/dungeon/regular/b.png', complementary:6, masks:masks}, + {name:'Red Frame', src:'/img/frames/dungeon/regular/r.png', complementary:6, masks:masks}, + {name:'Green Frame', src:'/img/frames/dungeon/regular/g.png', complementary:6, masks:masks}, + {name:'Colorless Frame', src:'/img/frames/dungeon/regular/c.png', complementary:6, masks:masks}, {name:'Floor', src:'/img/frames/dungeon/regular/floor.png'} ]; //disables/enables the "Load Frame Version" button document.querySelector('#loadFrameVersion').disabled = false; //defines process for loading this version, if applicable document.querySelector('#loadFrameVersion').onclick = async function() { + // message + notify('Dungeons should now be fully functional, though the interface can be difficult. See the "Dungeon" tab to adjust rooms, and for more information.', 15); //resets things so that every frame doesn't have to await resetCardIrregularities(); //sets card version @@ -25,15 +26,14 @@ document.querySelector('#loadFrameVersion').onclick = async function() { card.artBounds = {x:0, y:0, width:1, height:1}; autoFitArt(); //set symbol bounds - card.setSymbolBounds = {x:0.9227, y:0.8739, width:0.12, height:0.0381, vertical:'center', horizontal: 'right'}; + card.setSymbolBounds = {x:0.5, y:0.8967, width:0.12, height:0.0410, vertical:'center', horizontal: 'center'}; resetSetSymbol(); //watermark bounds card.watermarkBounds = {x:0.3027, y:0.4748, width:0.3547, height:0.6767}; resetWatermark(); //text loadTextOptions({ - title: {name:'Title', text:'', x:0.0854, y:0.0522, width:0.8292, height:0.0543, oneLine:true, font:'belerenbsc', size:0.0381, color:'white', align:'center'}, - room1: {name:'Ability 1', text:'', x:0.1334, y:0.2896, width:0.35, height:0.1786, size:0.0305}, + title: {name:'Title', text:'', x:0.0854, y:0.0522, width:0.8292, height:0.0543, oneLine:true, font:'belerenbsc', size:0.0381, color:'white', align:'center'} }); } //loads available frames diff --git a/js/frames/versionDungeon.js b/js/frames/versionDungeon.js index a6b83532..9237849c 100644 --- a/js/frames/versionDungeon.js +++ b/js/frames/versionDungeon.js @@ -2,38 +2,66 @@ if (!loadedVersions.includes('/js/frames/versionDungeon.js')) { loadedVersions.push('/js/frames/versionDungeon.js'); sizeCanvas('dungeon'); + sizeCanvas('dungeonFX'); document.querySelector('#creator-menu-tabs').innerHTML += '

Dungeon

'; var newHTML = document.createElement('div'); newHTML.id = 'creator-menu-dungeon'; newHTML.classList.add('hidden'); newHTML.innerHTML = ` +
+
Use the following textbox to specify your room locations and sizes.

Each room must be separated by a new line, and may only include numeric characters.

Each number must be seperated by a comma, and ordered as follows:
X,Y,Width,Height,Door-1,Door-2,...
(doors are optional).

Apologies for the difficult interface; I hope to implement an improved UI in the future.
+ +
-
Adjust the height (first input) and chapter count (second input) of each Dungeon ability
- +
Select the dungeon wall color:
+
`; if (!card.dungeon) { card.dungeon = {abilities:[1, 1, 1, 0], count:3, x:0.1, width:0.3947}; } document.querySelector('#creator-menu-sections').appendChild(newHTML); - var dungeonFX1 = new Image(); - dungeonFX1.src = '/img/frames/dungeon/walls/fx/straight.png'; - var dungeonFX2 = new Image(); - dungeonFX2.src = '/img/frames/dungeon/walls/fx/corner.png'; - var dungeonFX3 = new Image(); - dungeonFX3.src = '/img/frames/dungeon/walls/fx/t.png'; - var dungeonFX4 = new Image(); - dungeonFX4.src = '/img/frames/dungeon/walls/fx/cross.png'; - var dungeonShape1 = new Image(); - dungeonShape1.src = '/img/frames/dungeon/walls/shape/straight.png'; - var dungeonShape2 = new Image(); - dungeonShape2.src = '/img/frames/dungeon/walls/shape/corner.png'; - var dungeonShape3 = new Image(); - dungeonShape3.src = '/img/frames/dungeon/walls/shape/t.png'; - var dungeonShape4 = new Image(); - dungeonShape4.src = '/img/frames/dungeon/walls/shape/cross.png'; - // var dungeonTexture = new Image(); - // dungeonTexture.src = '/img/frames/dungeon/dungeonTexture.png'; - dungeonShape4.onload = dungeonEdited; + var dungeonFXtop = new Image(); dungeonFXtop.src = '/img/frames/dungeon/walls/fx/top.png'; + var dungeonFXleft = new Image(); dungeonFXleft.src = '/img/frames/dungeon/walls/fx/left.png'; + var dungeonFXbottom = new Image(); dungeonFXbottom.src = '/img/frames/dungeon/walls/fx/bottom.png'; + var dungeonFXright = new Image(); dungeonFXright.src = '/img/frames/dungeon/walls/fx/right.png'; + var dungeonFXtopright = new Image(); dungeonFXtopright.src = '/img/frames/dungeon/walls/fx/topright.png'; + var dungeonFXtopleft = new Image(); dungeonFXtopleft.src = '/img/frames/dungeon/walls/fx/topleft.png'; + var dungeonFXbottomright = new Image(); dungeonFXbottomright.src = '/img/frames/dungeon/walls/fx/bottomright.png'; + var dungeonFXbottomleft = new Image(); dungeonFXbottomleft.src = '/img/frames/dungeon/walls/fx/bottomleft.png'; + var dungeonShapetop = new Image(); dungeonShapetop.src = '/img/frames/dungeon/walls/shape/top.png'; + var dungeonShapeleft = new Image(); dungeonShapeleft.src = '/img/frames/dungeon/walls/shape/left.png'; + var dungeonShapebottom = new Image(); dungeonShapebottom.src = '/img/frames/dungeon/walls/shape/bottom.png'; + var dungeonShaperight = new Image(); dungeonShaperight.src = '/img/frames/dungeon/walls/shape/right.png'; + var dungeonShapetopright = new Image(); dungeonShapetopright.src = '/img/frames/dungeon/walls/shape/topright.png'; + var dungeonShapetopleft = new Image(); dungeonShapetopleft.src = '/img/frames/dungeon/walls/shape/topleft.png'; + var dungeonShapebottomright = new Image(); dungeonShapebottomright.src = '/img/frames/dungeon/walls/shape/bottomright.png'; + var dungeonShapebottomleft = new Image(); dungeonShapebottomleft.src = '/img/frames/dungeon/walls/shape/bottomleft.png'; + var dungeonDoorwayShape = new Image(); dungeonDoorwayShape.src = '/img/frames/dungeon/walls/shape/doorway.png'; + var dungeonDoorwayFX = new Image(); dungeonDoorwayFX.src = '/img/frames/dungeon/walls/fx/doorway.png'; + var dungeonDoorwayArrow = new Image(); dungeonDoorwayArrow.src = '/img/frames/dungeon/walls/arrow.png'; + var dungeonDoorwayCutout = new Image(); dungeonDoorwayCutout.src = '/img/frames/dungeon/walls/doorway.png'; + var dungeonOuterShape = new Image(); dungeonOuterShape.src = '/img/frames/dungeon/walls/shape/outer.png'; + var dungeonOuterFX = new Image(); dungeonOuterFX.src = '/img/frames/dungeon/walls/fx/outer.png'; + var dungeonTextureW = new Image(); dungeonTextureW.src = '/img/frames/dungeon/walls/textures/w.png'; + var dungeonTextureU = new Image(); dungeonTextureU.src = '/img/frames/dungeon/walls/textures/u.png'; + var dungeonTextureB = new Image(); dungeonTextureB.src = '/img/frames/dungeon/walls/textures/b.png'; + var dungeonTextureR = new Image(); dungeonTextureR.src = '/img/frames/dungeon/walls/textures/r.png'; + var dungeonTextureG = new Image(); dungeonTextureG.src = '/img/frames/dungeon/walls/textures/g.png'; + var dungeonTextureC = new Image(); dungeonTextureC.src = '/img/frames/dungeon/walls/textures/c.png'; + dungeonTextureC.onload = dungeonEditedBuffer; +} + +var drawingDungeon; +function dungeonEditedBuffer() { + clearTimeout(drawingDungeon); + drawingDungeon = setTimeout(dungeonEdited, 500); } function dungeonEdited() { @@ -43,48 +71,103 @@ function dungeonEdited() { data.replace(/ /g, '').split('\n').forEach(room => { newRoom = room.split(','); for (i = 0; i < newRoom.length; i++) { - newRoom[i] = parseInt(newRoom[i]); + if (i >= 4) { + newRoom[i] = parseFloat(newRoom[i]); + } else { + newRoom[i] = parseInt(newRoom[i]); + } + if (1 < i && i < 4) { + newRoom[i] -= 1; + } + } + while (room.length < 4) { + try { + room.push(1); + } catch { + room = [0, 0, 1, 1]; + } } rooms.push(newRoom); }); console.log(rooms); - - //draw to dungeon canvas + // init variables + const cellSize = scaleHeight(0.0381); + const origX = scaleX(0.0734); + const origY = scaleY(0.1377); + // walls dungeonContext.clearRect(0, 0, dungeonCanvas.width, dungeonCanvas.height); - - + dungeonFXContext.clearRect(0, 0, dungeonFXCanvas.width, dungeonFXCanvas.height); + rooms.forEach(room => { + //top left corner + dungeonContext.drawImage(dungeonShapetopleft, origX + cellSize * room[0], origY + cellSize * room[1], cellSize, cellSize); + dungeonFXContext.drawImage(dungeonFXtopleft, origX + cellSize * room[0], origY + cellSize * room[1], cellSize, cellSize); + //top right corner + dungeonContext.drawImage(dungeonShapetopright, origX + cellSize * (room[0] + room[2]), origY + cellSize * room[1], cellSize, cellSize); + dungeonFXContext.drawImage(dungeonFXtopright, origX + cellSize * (room[0] + room[2]), origY + cellSize * room[1], cellSize, cellSize); + //bottom left corner + dungeonContext.drawImage(dungeonShapebottomleft, origX + cellSize * room[0], origY + cellSize * (room[1] + room[3]), cellSize, cellSize); + dungeonFXContext.drawImage(dungeonFXbottomleft, origX + cellSize * room[0], origY + cellSize * (room[1] + room[3]), cellSize, cellSize); + //bottom right corner + dungeonContext.drawImage(dungeonShapebottomright, origX + cellSize * (room[0] + room[2]), origY + cellSize * (room[1] + room[3]), cellSize, cellSize); + dungeonFXContext.drawImage(dungeonFXbottomright, origX + cellSize * (room[0] + room[2]), origY + cellSize * (room[1] + room[3]), cellSize, cellSize); + // horizontal walls + for (var i = 1; i < room[2]; i++) { + //top walls + dungeonContext.drawImage(dungeonShapetop, origX + cellSize * (room[0] + i), origY + cellSize * room[1], cellSize, cellSize); + dungeonFXContext.drawImage(dungeonFXtop, origX + cellSize * (room[0] + i), origY + cellSize * room[1], cellSize, cellSize); + //bottom walls + dungeonContext.drawImage(dungeonShapebottom, origX + cellSize * (room[0] + i), origY + cellSize * (room[1] + room[3]), cellSize, cellSize); + dungeonFXContext.drawImage(dungeonFXbottom, origX + cellSize * (room[0] + i), origY + cellSize * (room[1] + room[3]), cellSize, cellSize); + } + // vertical walls + for (var i = 1; i < room[3]; i++) { + // left walls + dungeonContext.drawImage(dungeonShapeleft, origX + cellSize * room[0], origY + cellSize * (room[1] + i), cellSize, cellSize); + dungeonFXContext.drawImage(dungeonFXleft, origX + cellSize * room[0], origY + cellSize * (room[1] + i), cellSize, cellSize); + // right walls + dungeonContext.drawImage(dungeonShaperight, origX + cellSize * (room[0] + room[2]), origY + cellSize * (room[1] + i), cellSize, cellSize); + dungeonFXContext.drawImage(dungeonFXright, origX + cellSize * (room[0] + room[2]), origY + cellSize * (room[1] + i), cellSize, cellSize); + } + }); + dungeonContext.drawImage(dungeonOuterShape, 0, 0, dungeonCanvas.width, dungeonCanvas.height); + dungeonFXContext.drawImage(dungeonOuterFX, 0, 0, dungeonFXCanvas.width, dungeonFXCanvas.height); + // text + var textObjects = {}; + textObjects.title = {name:'Title', text:'', x:0.0854, y:0.0522, width:0.8292, height:0.0543, oneLine:true, font:'belerenbsc', size:0.0381, color:'white', align:'center'}; + roomNumber = 1; + rooms.forEach(room => { + var textbox = {name:`Dungeon Room ${roomNumber}`, text:`Room ${roomNumber}{lns}{fontmplantin}{fontsize-8}Effect.`, x:(origX + cellSize * (room[0] + 0.5)) / card.width, y:(origY + cellSize * (room[1] + 0.5)) / card.height, width:(cellSize * room[2]) / card.width, height:(cellSize * room[3]) / card.height, font:'belerenb', size:0.0324, align:'center'}; + if (room[3] < 3) { + textbox.text = textbox.text.replace('{lns}', ' '); + } + textObjects[`dungeonRoom${roomNumber}`] = textbox; + roomNumber ++; + }) + // doorways + rooms.push([0,-2,16,1,7]); + rooms.forEach(room => { + doorways = room.slice(4); + doorways.forEach(doorway => { + dungeonContext.globalCompositeOperation = 'destination-out'; + dungeonFXContext.globalCompositeOperation = 'destination-out'; + dungeonContext.drawImage(dungeonDoorwayCutout, origX + cellSize * (room[0] + doorway - 0.5), origY + cellSize * (room[1] + room[3])); + dungeonFXContext.drawImage(dungeonDoorwayCutout, origX + cellSize * (room[0] + doorway - 0.5), origY + cellSize * (room[1] + room[3])); + dungeonContext.globalCompositeOperation = 'source-over'; + dungeonFXContext.globalCompositeOperation = 'source-over'; + dungeonContext.drawImage(dungeonDoorwayShape, origX + cellSize * (room[0] + doorway - 0.5), origY + cellSize * (room[1] + room[3])); + dungeonFXContext.drawImage(dungeonDoorwayFX, origX + cellSize * (room[0] + doorway - 0.5), origY + cellSize * (room[1] + room[3])); + if (room[1] != -2 && room[1] + room[3] != 18) { + dungeonFXContext.drawImage(dungeonDoorwayArrow, origX + cellSize * (room[0] + doorway + 0.5), origY + cellSize * (room[1] + room[3] + 0.5)); + } + }); + }); + // apply textures and FX + dungeonContext.globalCompositeOperation = 'source-in'; + texture = window[`dungeonTexture${document.querySelector('#dungeon-color').value}`]; + dungeonContext.drawImage(texture, 0, 0, dungeonCanvas.width, dungeonCanvas.height); + dungeonContext.globalCompositeOperation = 'source-over'; + dungeonContext.drawImage(dungeonFXCanvas, 0, 0, dungeonCanvas.width, dungeonCanvas.height) + // finish + loadTextOptions(textObjects); drawTextBuffer(); - drawCard(); } - -//Data structures... - -class Vertex { - constructor(x = 0, y = 0, up = false, down = false, left = false, right = false) { - this.x = x; - this.y = y; - this.up = up; - this.down = down; - this.left = left; - this.right = right; - } -} - -class Graph { - // defining vertex array and - // adjacent list - constructor(noOfVertices) - { - this.noOfVertices = noOfVertices; - this.AdjList = new Map(); - } - - // functions to be implemented - - // addVertex(v) - // addEdge(v, w) - // printGraph() - - // bfs(v) - // dfs(v) -} \ No newline at end of file