-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patheditor.php
134 lines (125 loc) · 11.2 KB
/
editor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
require_once 'php/app.inc.php';
App::init();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<style>
html, body {
margin: 0;
padding: 0;
overflow: hidden;
}
#sprites {
width: 100%;
height: 100%;
background: rgba(255, 0, 0, 0.4);
}
#panel {
background: grey;
position: absolute;
left: 0;
top: 0;
width: 256px;
height: 100%;
position: fixed;
}
#sprites-pal {
background: #ccc;
width: 100%;
}
#sprites-pal .sprite-label {
border: 1px solid #666;
margin: 1px;
display: block;
float: left;
}
.sprite {
background: white;
top: 2px;
margin-left: 16px;
position: relative;
}
.marker {
border: 4px solid green;
}
.clearfix {
clear: both;
}
#panel textarea {
background: #ccc;
width: 100%;
margin: 0;
padding: 0;
border: 0;
}
</style>
</head>
<body>
<canvas id="display"></canvas>
<form id="panel">
<textarea id="json" rows="8" cols="8">[{"aX":384,"aY":256,"bX":384,"bY":96},{"aX":384,"aY":96,"bX":544,"bY":96},{"aX":544,"aY":256,"bX":384,"bY":256},{"aX":544,"aY":160,"bX":640,"bY":160},{"aX":640,"aY":160,"bX":640,"bY":96},{"aX":640,"aY":256,"bX":640,"bY":192},{"aX":640,"aY":96,"bX":736,"bY":96},{"aX":736,"aY":96,"bX":736,"bY":384},{"aX":576,"aY":320,"bX":640,"bY":256},{"aX":384,"aY":384,"bX":384,"bY":320},{"aX":384,"aY":320,"bX":576,"bY":320},{"aX":544,"aY":96,"bX":544,"bY":160},{"aX":480,"aY":384,"bX":384,"bY":384},{"aX":480,"aY":352,"bX":480,"bY":384},{"aX":576,"aY":352,"bX":480,"bY":352},{"aX":576,"aY":448,"bX":576,"bY":352},{"aX":384,"aY":576,"bX":384,"bY":448},{"aX":448,"aY":576,"bX":384,"bY":576},{"aX":448,"aY":480,"bX":448,"bY":576},{"aX":512,"aY":576,"bX":512,"bY":480},{"aX":576,"aY":576,"bX":512,"bY":576},{"aX":576,"aY":480,"bX":576,"bY":576},{"aX":608,"aY":480,"bX":576,"bY":480},{"aX":608,"aY":576,"bX":608,"bY":480},{"aX":672,"aY":576,"bX":608,"bY":576},{"aX":672,"aY":384,"bX":672,"bY":576},{"aX":704,"aY":384,"bX":672,"bY":384},{"aX":704,"aY":576,"bX":704,"bY":384},{"aX":736,"aY":384,"bX":736,"bY":544},{"aX":672,"aY":288,"bX":608,"bY":352},{"aX":608,"aY":352,"bX":704,"bY":352},{"aX":704,"aY":352,"bX":704,"bY":288},{"aX":704,"aY":288,"bX":672,"bY":288},{"aX":832,"aY":544,"bX":832,"bY":352},{"aX":832,"aY":352,"bX":896,"bY":288},{"aX":896,"aY":480,"bX":896,"bY":576},{"aX":1120,"aY":480,"bX":896,"bY":480},{"aX":1504,"aY":480,"bX":1120,"bY":480},{"aX":1120,"aY":416,"bX":1504,"bY":480},{"aX":1024,"aY":32,"bX":1024,"bY":320},{"aX":896,"aY":32,"bX":1024,"bY":32},{"aX":800,"aY":160,"bX":896,"bY":32},{"aX":800,"aY":224,"bX":800,"bY":160},{"aX":928,"aY":128,"bX":800,"bY":224},{"aX":896,"aY":288,"bX":928,"bY":128},{"aX":1024,"aY":320,"bX":1088,"bY":256},{"aX":1088,"aY":256,"bX":1120,"bY":288},{"aX":1184,"aY":352,"bX":1120,"bY":416},{"aX":1152,"aY":320,"bX":1184,"bY":352},{"aX":1120,"aY":288,"bX":1184,"bY":224},{"aX":1184,"aY":224,"bX":1280,"bY":192},{"aX":1280,"aY":192,"bX":1376,"bY":192},{"aX":1376,"aY":192,"bX":1472,"bY":224},{"aX":1472,"aY":224,"bX":1536,"bY":288},{"aX":1216,"aY":256,"bX":1152,"bY":320},{"aX":1312,"aY":256,"bX":1216,"bY":256},{"aX":1440,"aY":288,"bX":1312,"bY":256},{"aX":1504,"aY":320,"bX":1440,"bY":288},{"aX":1536,"aY":288,"bX":1504,"bY":320},{"aX":928,"aY":352,"bX":896,"bY":384},{"aX":992,"aY":352,"bX":928,"bY":352},{"aX":1024,"aY":416,"bX":992,"bY":352},{"aX":960,"aY":416,"bX":1024,"bY":416},{"aX":896,"aY":384,"bX":960,"bY":416},{"aX":544,"aY":192,"bX":544,"bY":256},{"aX":640,"aY":192,"bX":544,"bY":192},{"aX":544,"aY":160,"bX":544,"bY":192,"door":2},{"aX":1120,"aY":288,"bX":1152,"bY":320,"door":4},{"aX":576,"aY":320,"bX":576,"bY":352,"door":5},{"aX":576,"aY":448,"bX":576,"bY":480,"door":7},{"aX":480,"aY":448,"bX":576,"bY":448},{"aX":384,"aY":448,"bX":480,"bY":448},{"aX":480,"aY":480,"bX":448,"bY":480},{"aX":512,"aY":480,"bX":480,"bY":480},{"aX":480,"aY":448,"bX":480,"bY":480,"door":2},{"aX":736,"aY":544,"bX":768,"bY":544},{"aX":768,"aY":544,"bX":832,"bY":544},{"aX":896,"aY":576,"bX":768,"bY":576},{"aX":768,"aY":576,"bX":704,"bY":576},{"aX":768,"aY":576,"bX":768,"bY":544,"door":3}]</textarea>
<button id="bsp">generate BSP tree</button>
<hr>
<label>
(lefts - rights) multiplier:
<input type="number" id="bsp-lefts-rights" value="1"/>
</label><br>
<label>
(intersecting) multiplier:
<input type="number" id="bsp-intersecting" value="2"/>
</label><br>
<label>
BSP JSON:
<textarea id="bsp-json" rows="8" cols="8"></textarea>
</label>
<hr>
Sprites:
<div id="sprites-pal">
<label class="sprite-label">
N/A
<input type="radio" name="sprite" value="" checked />
</label>
<label class="sprite-label">
<img id="bush" class="sprite" src="assets/bush.png" alt=""/>
<input type="radio" name="sprite" value="bush" />
</label>
<label class="sprite-label">
<img id="sta" class="sprite" src="assets/sta.png" alt=""/>
<input type="radio" name="sprite" value="sta" />
</label>
<label class="sprite-label">
<img id="stone" class="sprite" src="assets/stone.png" alt=""/>
<input type="radio" name="sprite" value="stone" />
</label>
<label class="sprite-label">
<img id="m_zombie" class="sprite marker" src="assets/markers/zombie.png" alt=""/>
<input type="radio" name="sprite" value="m_zombie" />
</label>
<div class="clearfix"></div>
</div>
<label>
Vertical pos.:
<input type="number" id="sprite-z" value="72"/>
</label><br>
<label>
Radius:
<input type="number" id="sprite-radius" value="16"/>
</label><br>
<label>
Obstacle:
<input type="checkbox" id="sprite-obstacle" checked />
</label><br>
<label>
Sprites JSON:
<textarea id="sprites-json" rows="8" cols="8">[{"x":476,"y":192,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":516,"y":125,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":447,"y":127,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":708,"y":264,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":679,"y":158,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":615,"y":323,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":629,"y":399,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":651,"y":519,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":518,"y":546,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":557,"y":496,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":412,"y":507,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":422,"y":549,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":417,"y":338,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":534,"y":341,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":865,"y":460,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":914,"y":327,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":975,"y":136,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":905,"y":51,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":1077,"y":413,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":1086,"y":324,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":1252,"y":468,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":931,"y":472,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":1354,"y":238,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":1442,"y":266,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":1430,"y":230,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":1206,"y":244,"z":159,"radius":16,"obstacle":false,"id":"stone"},{"x":468,"y":170,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":511,"y":226,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":695,"y":241,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":720,"y":449,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":618,"y":448,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":419,"y":481,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":541,"y":537,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":1075,"y":462,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":964,"y":264,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":954,"y":70,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":837,"y":155,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":1129,"y":360,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":1320,"y":209,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":834,"y":571,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":447,"y":365,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":715,"y":137,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":603,"y":178,"z":-158,"radius":16,"obstacle":false,"id":"sta"},{"x":486,"y":120,"z":80,"radius":16,"obstacle":true,"id":"bush"},{"x":559,"y":561,"z":80,"radius":16,"obstacle":true,"id":"bush"},{"x":592,"y":412,"z":80,"radius":16,"obstacle":true,"id":"bush"},{"x":847,"y":415,"z":80,"radius":16,"obstacle":true,"id":"bush"},{"x":1122,"y":466,"z":80,"radius":16,"obstacle":true,"id":"bush"},{"x":718,"y":182,"z":80,"radius":16,"obstacle":true,"id":"bush"},{"x":945,"y":138,"z":80,"radius":16,"obstacle":true,"id":"bush"},{"x":1479,"y":249,"z":80,"radius":16,"obstacle":true,"id":"bush"},{"x":666,"y":258,"id":"m_zombie","marker":true},{"x":425,"y":349,"id":"m_zombie","marker":true},{"x":412,"y":538,"id":"m_zombie","marker":true},{"x":535,"y":479,"id":"m_zombie","marker":true},{"x":554,"y":519,"id":"m_zombie","marker":true},{"x":721,"y":485,"id":"m_zombie","marker":true},{"x":925,"y":315,"id":"m_zombie","marker":true},{"x":983,"y":232,"id":"m_zombie","marker":true},{"x":982,"y":89,"id":"m_zombie","marker":true},{"x":1400,"y":240,"id":"m_zombie","marker":true},{"x":1310,"y":230,"id":"m_zombie","marker":true},{"x":1055,"y":452,"id":"m_zombie","marker":true},{"x":1104,"y":355,"id":"m_zombie","marker":true}]</textarea>
</label>
</form>
<?php
App::includeCoreScript('js/editor/editor.js');
?>
</body>
</html>