-
Notifications
You must be signed in to change notification settings - Fork 0
/
tileview.html
164 lines (145 loc) · 5.33 KB
/
tileview.html
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tile View</title>
</head>
<body style="background:#000;color:#fff">
<script src="jquery.min.js"></script>
<h1>Tile View</h1>
<input type="text" id="picnum" placeholder="picnum"><br />
<img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><br>
<img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><br>
<img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><br>
<img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><img class="tile" src="#"><br>
<h1>Stat</h1>
<input type="text" id="stat" placeholder="stat"><br />
<textarea style="height:500px; width:250px;" spellcheck="false" id="stat-sector"></textarea>
<textarea style="height:500px; width:250px;" spellcheck="false" id="stat-wall"></textarea>
<textarea style="height:500px; width:250px;" spellcheck="false" id="stat-sprite"></textarea>
<script>
let stat = {
bit: [
1, 2, 4, 8, 16, 32, 64, 128,
256, 512, 1024, 2048, 4096, 8192, 16384, 32768
],
read_sprite_stat: function(stat) {
var result = {
/*
bit 0: 1 = Blocking sprite (use with clipmove, getzrange)
bit 1: 1 = transluscence, 0 = normal
bit 2: 1 = x-flipped, 0 = normal
bit 3: 1 = y-flipped, 0 = normal
bits 5-4:
00 = FACE sprite (default)
01 = WALL sprite (like masked walls)
10 = FLOOR sprite (parallel to ceilings&floors)
bit 6: 1 = 1-sided sprite, 0 = normal
bit 7: 1 = Real centered centering, 0 = foot center
bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1)
bit 9: 1 = Transluscence reversing, 0 = normal
bits 10-14: reserved
bit 15: 1 = Invisible sprite, 0 = not invisible
*/
blocking_clipmove: (stat & this.bit[0]) != 0,
transluscence: (stat & this.bit[1]) != 0,
xflip: (stat & this.bit[2]) != 0,
yflip: (stat & this.bit[3]) != 0,
//face: (stat & this.bit[4]) != 0,
type: "",
onesided: (stat & this.bit[6]) != 0,
realcenter: (stat & this.bit[7]) != 0,
blocking_hitscan: (stat & this.bit[8]) != 0,
transluscence_rev: (stat & this.bit[9]) != 0,
invisible: (stat & this.bit[15]) != 0,
};
var bits4 = (stat & this.bit[4]) != 0;
var bits5 = (stat & this.bit[5]) != 0;
if (bits4 == false && bits5 == false) {
result.type = "FACE";
}
if (bits4 == false && bits5 == true) {
result.type = "WALL";
}
if (bits4 == true && bits5 == false) {
result.type = "FLOOR";
}
return result;
},
read_wall_stat: function(stat) {
var result = {
/*
bit 0: 1 = Blocking wall (use with clipmove, getzrange)
bit 1: 1 = bottoms of invisible walls swapped, 0 = not
bit 2: 1 = align picture on bottom (for doors), 0 = top
bit 3: 1 = x-flipped, 0 = normal
bit 4: 1 = masking wall, 0 = not
bit 5: 1 = 1-way wall, 0 = not
bit 6: 1 = Blocking wall (use with hitscan / cliptype 1)
bit 7: 1 = Transluscence, 0 = not
bit 8: 1 = y-flipped, 0 = normal
bit 9: 1 = Transluscence reversing, 0 = normal
bits 10-15: reserved
*/
blocking_clipmove: (stat & this.bit[0]) != 0,
bottomswap: (stat & this.bit[1]) != 0,
alignpicbottom: (stat & this.bit[2]) != 0,
xflip: (stat & this.bit[3]) != 0,
masking: (stat & this.bit[4]) != 0,
oneway: (stat & this.bit[5]) != 0,
blocking_hitscan: (stat & this.bit[6]) != 0,
transluscence: (stat & this.bit[7]) != 0,
yflip: (stat & this.bit[8]) != 0,
transluscence_rev: (stat & this.bit[9]) != 0,
};
return result;
},
read_sector_stat: function(stat) {
/*
bit 0: 1 = parallaxing, 0 = not
bit 1: 1 = sloped, 0 = not
bit 2: 1 = swap x&y, 0 = not
bit 3: 1 = double smooshiness
bit 4: 1 = x-flip
bit 5: 1 = y-flip
bit 6: 1 = Align texture to first wall of sector
bits 7-15: reserved
*/
var result = {
parallaxing: (stat & this.bit[0]) != 0,
sloped: (stat & this.bit[1]) != 0,
swap: (stat & this.bit[2]) != 0,
double: (stat & this.bit[3]) != 0,
xflip: (stat & this.bit[4]) != 0,
yflip: (stat & this.bit[5]) != 0,
align: (stat & this.bit[6]) != 0,
};
//console.log(result);
return result;
}
};
function get_tile_name(picnum) {
var num1 = picnum & 0xFF;
var num2 = ((picnum >> 8) & 0xFF);
var tex_file = 'TILES' + ('000'+num2).slice(-3);
tex_file += "_" + num1;
return tex_file;
}
(function($) {
$("#stat").on("input", function() {
let val = parseInt($(this).val());
$("#stat-sector").val("Sector\n---\n" + JSON.stringify(stat.read_sector_stat(val), null, 2));
$("#stat-wall").val("Wall\n---\n" + JSON.stringify(stat.read_wall_stat(val), null, 2));
$("#stat-sprite").val("Sprite\n---\n" + JSON.stringify(stat.read_sprite_stat(val), null, 2));
});
$("#picnum").on("input", function() {
let picnum = parseInt($(this).val());
let filename = get_tile_name(picnum);
$(".tile").attr("src", "duke-tex/" + filename + ".png");
});
let filename = get_tile_name(0);
$(".tile").attr("src", "duke-tex/" + filename + ".png");
})(jQuery);
</script>
</body>
</html>