Skip to content

Commit 6ec1215

Browse files
author
Diogenesthecynic
committed
Simple wrapper UI
What fullscreenmario.com had before it was shut down.
1 parent f69e06f commit 6ec1215

10 files changed

+385
-50
lines changed

Maps/World62.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ map.areas = [
1414
setLocationGeneration(0);
1515

1616
pushPreCastle();
17-
pushPrePattern("backreg", 0, 0, 4);
17+
pushPrePattern("backreg", 0, 0, 5);
1818
pushPreFloor(0, 0, 123);
1919
fillPreThing(Brick, 80, jumplev1, 3, 1, 8);
2020
pushPrePipe(152, 0, 32, true, 5); // enter first underworld

Theme/Beta.png

10.3 KB
Loading

Theme/Header - Website.gif

3.06 KB
Loading

Theme/Header.gif

2.83 KB
Loading

default.css

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
background: black;
5+
color: white;
6+
font-size: 21px;
7+
font-family: "Press Start";
8+
text-transform: uppercase;
9+
line-height: 117%;
10+
}
11+
12+
/* General Positioning */
13+
14+
#header {
15+
position: absolute;
16+
height: 49px;
17+
width: 100%;
18+
background-image:url('Theme/Header.gif');
19+
background-repeat:no-repeat;
20+
background-color:#070707;
21+
}
22+
23+
iframe {
24+
position: absolute;
25+
margin-top: 49px;
26+
width: 100%;
27+
height: 462px;
28+
border: 0;
29+
z-index: -96;
30+
}
31+
32+
#after {
33+
position: absolute;
34+
margin-top: 511px;
35+
width: 100%;
36+
}
37+
38+
/* #after bar */
39+
40+
.bar1 {
41+
margin: 7px;
42+
width: 280px;
43+
text-align: center;
44+
}
45+
46+
#out_editor {
47+
float: left;
48+
}
49+
50+
#out_mapselect {
51+
float: right;
52+
}
53+
54+
.expander {
55+
margin-top: -24px;
56+
padding: 7px;
57+
width: 256px;
58+
height: 24px;
59+
display: none;
60+
z-index: 98;
61+
background: #009966;
62+
border: 3px solid #99ffcc;
63+
border-radius: 7px;
64+
box-shadow: 0 3px 7px black inset;
65+
font-size: 14px;
66+
}
67+
.bar1:hover .expander {
68+
margin-top: -294px;
69+
height: 280px;
70+
display: block;
71+
}
72+
73+
.bar1 div.label {
74+
margin: 0 14px;
75+
font-size: 14px;
76+
}
77+
78+
/* Individual map buttons */
79+
80+
.maprectout {
81+
margin: 1px 3px;
82+
display: inline-block;
83+
background: #ffcc33;
84+
border: 3px outset;
85+
cursor: pointer;
86+
color: black;
87+
font-size: 14px;
88+
}
89+
90+
.maprect {
91+
width: 49px;
92+
height: 20px;
93+
}
94+
95+
.maprect.off {
96+
background: #996600;
97+
}
98+
99+
.maprect.big { width: 231px; }
100+
.maprect.giant {
101+
padding: 28px 0 70px 0;
102+
font-size: 17px;
103+
line-height: 210%;
104+
}

generator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ function prepareNextGeneratorStandard(xloc, bwidth, func, allow_platforms, no_un
967967
// }
968968
// else map.needs_floor = false;
969969

970-
if(func == pushRandomSectionOverworld && (map.num_random_sections >= 3 || randTrue(7)))
970+
if(func == pushRandomSectionOverworld && (map.num_random_sections >= 3 + randTrue(7)))
971971
func = pushRandomSectionPreCastle;
972972

973973
if(!no_unusuals && ++map.sincechange > 3) {

index.html

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE HTML>
2+
3+
<html lang="en-us">
4+
5+
<head>
6+
<meta charset="utf-8">
7+
<link href="default.css" rel="stylesheet">
8+
<link href="Fonts/stylesheet.css" rel="stylesheet">
9+
<script src="ui.js"></script>
10+
</head>
11+
12+
<body onload="start()">
13+
14+
<!-- Top header -->
15+
<div id="header">
16+
<!-- <img id="beta" src="Theme/Beta.png"> -->
17+
<!-- <span id="version"></span> -->
18+
</div>
19+
20+
<!-- Game itself -->
21+
<iframe id="game" src="mario.html"></iframe>
22+
23+
<!-- After the game (retracts as needed) -->
24+
<div id="after">
25+
26+
<!-- Level Editor popup -->
27+
<div id="out_editor" class="bar1">
28+
<div class="label">- Level Editor -</div>
29+
<div id="in_editor" class="expander"></div>
30+
</div>
31+
32+
<!-- Level Editor popup -->
33+
<div id="out_mapselect" class="bar1">
34+
<div class="label">- Map Select -</div>
35+
<div id="in_mapselect" class="expander"></div>
36+
</div>
37+
38+
</div>
39+
40+
</body>
41+
42+
</html>

maps.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3302,7 +3302,7 @@ function World62(map) {
33023302
setLocationGeneration(0);
33033303

33043304
pushPreCastle();
3305-
pushPrePattern("backreg", 0, 0, 4);
3305+
pushPrePattern("backreg", 0, 0, 5);
33063306
pushPreFloor(0, 0, 123);
33073307
fillPreThing(Brick, 80, jumplev1, 3, 1, 8);
33083308
pushPrePipe(152, 0, 32, true, 5); // enter first underworld

triggers.js

+83-47
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,63 @@
11
/* Triggers.js */
2-
// Keeps track of triggers, which mainly consist of key presses
2+
// Keeps track of triggers, which mainly consist of key presses,
3+
// and messages, which would be from an index.html UI
34

45
function resetTriggers() {
56
// Make the controls object
67
window.controls = new Controls({
7-
left: [37, 65, "AXIS_LEFT", "DPAD_LEFT"], // a, left
8-
right: [39, 68, "AXIS_RIGHT", "DPAD_RIGHT"], // d, right
9-
up: [38, 87, 32, "FACE_1", "DPAD_UP", "LEFT_BOTTOM_SHOULDER"], // w, up
10-
down: [40, 83, "AXIS_DOWN", "DPAD_DOWN"], // s, down
11-
sprint: [16, 17, "FACE_1"], // shift, ctrl
12-
pause: [80, "START_FORWARD"], // p
13-
mute: [77], // m
14-
q: [81] // q
8+
left: [37, 65, "AXIS_LEFT", "DPAD_LEFT"], // a, left
9+
right: [39, 68, "AXIS_RIGHT", "DPAD_RIGHT"], // d, right
10+
up: [38, 87, 32, "FACE_1", "DPAD_UP", "LEFT_BOTTOM_SHOULDER"], // w, up
11+
down: [40, 83, "AXIS_DOWN", "DPAD_DOWN"], // s, down
12+
sprint: [16, 17, "FACE_1"], // shift, ctrl
13+
pause: [80, "START_FORWARD"], // p
14+
mute: [77], // m
15+
q: [81] // q
1516
});
16-
1717

18+
// Gamepad.js support for joysticks and controllers
1819
window.gamepad = new Gamepad();
1920
gamepad.bind(Gamepad.Event.BUTTON_DOWN, ControlsPipe("keydown", true));
2021
gamepad.bind(Gamepad.Event.BUTTON_UP, ControlsPipe("keyup", false));
2122
gamepad.bind(Gamepad.Event.AXIS_CHANGED, function(event) {
22-
var value = event.value,
23-
value_abs = abs(value);
24-
25-
// Don't allow tremors
26-
if(value_abs < 0.1) return;
27-
28-
// Depending on the axis used...
29-
switch(event.axis) {
30-
// Left stick, vertical
31-
case "LEFT_STICK_Y":
32-
case "RIGHT_STICK_Y":
33-
// If it actually has a direction, either go up or down
34-
if(value_abs > 0.5) {
35-
keydown(value > 0 ? "DPAD_DOWN" : "DPAD_UP");
36-
}
37-
// It doesn't have a direction, so they're both unpressed
38-
else {
39-
keyup("DPAD_UP");
40-
keyup("DPAD_DOWN");
41-
}
42-
break;
43-
// Left stick, horizontal
44-
case "LEFT_STICK_X":
45-
case "RIGHT_STICK_X":
46-
// If it actually has a direction, either go left or right
47-
if(value_abs > 0.5) {
48-
keydown(value < 0 ? "DPAD_LEFT" : "DPAD_RIGHT");
49-
}
50-
// It doesn't have a direction, so they're both unpressed
51-
else {
52-
keyup("DPAD_UP");
53-
keyup("DPAD_DOWN");
54-
}
55-
break;
56-
}
57-
});
23+
var value = event.value,
24+
value_abs = abs(value);
25+
26+
// Don't allow tremors
27+
if(value_abs < 0.1) return;
28+
29+
// Depending on the axis used...
30+
switch(event.axis) {
31+
// Left stick, vertical
32+
case "LEFT_STICK_Y":
33+
case "RIGHT_STICK_Y":
34+
// If it actually has a direction, either go up or down
35+
if(value_abs > 0.5) {
36+
keydown(value > 0 ? "DPAD_DOWN" : "DPAD_UP");
37+
}
38+
// It doesn't have a direction, so they're both unpressed
39+
else {
40+
keyup("DPAD_UP");
41+
keyup("DPAD_DOWN");
42+
}
43+
break;
44+
// Left stick, horizontal
45+
case "LEFT_STICK_X":
46+
case "RIGHT_STICK_X":
47+
// If it actually has a direction, either go left or right
48+
if(value_abs > 0.5) {
49+
keydown(value < 0 ? "DPAD_LEFT" : "DPAD_RIGHT");
50+
}
51+
// It doesn't have a direction, so they're both unpressed
52+
else {
53+
keyup("DPAD_UP");
54+
keyup("DPAD_DOWN");
55+
}
56+
break;
57+
}
58+
});
5859

59-
gamepad.init();
60+
gamepad.init();
6061

6162
// Set the key events on the body
6263
proliferate(body, {
@@ -65,6 +66,9 @@ gamepad.init();
6566
oncontextmenu: contextmenu,
6667
onmousedown: mousedown
6768
});
69+
70+
// Set UI triggers
71+
setMessageTriggers();
6872
}
6973

7074
// Hash table for onkeydown and onkeyup
@@ -270,3 +274,35 @@ function maxlulz() {
270274
setAreaSetting(arr[randInt(arr.length)]);
271275
}, 7, Infinity, ["Overworld", "Underworld", "Underwater", "Sky", "Castle"]);
272276
}
277+
278+
279+
280+
/* Triggers (from a UI)
281+
*/
282+
function setMessageTriggers() {
283+
// Commands will be sent in by these codes
284+
var command_codes = {
285+
setMap: triggerSetMap,
286+
startEditor: function() { loadEditor(); }
287+
};
288+
289+
// When a message is received, send it to the appropriate command code
290+
window.addEventListener("message", function(event) {
291+
var data = event.data,
292+
type = data.type;
293+
// If the type is known, do it
294+
if(command_codes[type])
295+
command_codes[type](data);
296+
// Otherwise complain
297+
else {
298+
console.log("Unknown event type received:", type, ".\n", data);
299+
}
300+
});
301+
}
302+
303+
// The UI has requested a map change
304+
function triggerSetMap(data) {
305+
clearMarioStats();
306+
setMap.apply(this, data.map || []);
307+
setLives(3);
308+
}

0 commit comments

Comments
 (0)