Skip to content

Commit

Permalink
Added baby cry hallucination
Browse files Browse the repository at this point in the history
  • Loading branch information
meszaros-lajos-gyorgy committed Feb 11, 2022
1 parent eb072a9 commit 3f30939
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 48 deletions.
Binary file added assets/projects/the-backrooms/sfx/baby.wav
Binary file not shown.
113 changes: 67 additions & 46 deletions src/projects/the-backrooms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ ON GOT_RUNE {
>>WELCOME_MESSAGE {
PLAY -o "system"
HEROSAY "You've noclipped out of reality and landed in the backrooms!"
QUEST "You've noclipped out of reality and landed in the backrooms!"
HEROSAY "You've noclipped out of reality and landed in the backrooms! You might leave by exiting through an unmarked fire exit."
QUEST "You've noclipped out of reality and landed in the backrooms! You might leave by exiting through an unmarked fire exit."
RETURN
}
Expand Down Expand Up @@ -203,7 +203,7 @@ ON GOT_RUNE {
)(items.marker);
};

const createJumpscareController = (pos, config) => {
const createJumpscareController = (pos, lampCtrl, config) => {
return compose(
markAsUsed,
moveTo(pos, [0, 0, 0]),
Expand Down Expand Up @@ -236,6 +236,10 @@ ON PICKUP {
}
}
if (^$PARAM1 == "key:exit") {
GOSUB BABY
}
ACCEPT
}
Expand Down Expand Up @@ -288,18 +292,20 @@ ON SPELLCAST {
}
>>BABY {
// save lámpa state
// 100ms villanás sárgába, mint az exit-nél
// összes lámpa kialszik
// sebesség lelassítása player-nél -> 0.3-ra
// kis pause, babasírás fadein
// szívdobogás hang
// random lámpa felkapcsolások, vagy az összes lámpa felkapcsolása?
// 5 másodperc ott tartás
// fadeout feketébe
// hang kikapcs
// lámpák restore
// hang vissza
PLAY -o "strange_noise1"
PLAY -oil "player_heartb"
PLAY -o "baby"
SENDEVENT SAVE ${lampCtrl.ref} NOP
SENDEVENT SETSPEED player 0.3
WORLDFADE OUT 10 ${color("khaki")} WORLDFADE IN 500 NOP
TIMERoff -m 1 600 SENDEVENT OFF ${lampCtrl.ref} NOP
TIMERstopheartbeat -m 1 13000 PLAY -os "player_heartb"
TIMERend -m 1 13000 SENDEVENT RESTORE ${lampCtrl.ref} NOP
TIMERspeedrestore -m 1 14000 SENDEVENT SETSPEED player 1
RETURN
}
`;
}),
Expand Down Expand Up @@ -343,6 +349,7 @@ ON SPELLCAST {
"projects/the-backrooms/whispers/german/no-exit.wav",
"speech/deutsch/whisper--no-exit.wav"
),
addDependencyAs("projects/the-backrooms/sfx/baby.wav", "sfx/baby.wav"),
declare("int", "magicCntr", 0),
declare("int", "almondwaterCntr", 0),
createItem
Expand Down Expand Up @@ -428,7 +435,7 @@ ON ACTION {
)(items.doors.lightDoor, { name: "Unmarked fire exit" });
};

const createKey = (pos, angle = [0, 0, 0]) => {
const createKey = (pos, angle = [0, 0, 0], jumpscareCtrl) => {
return compose(
markAsUsed,
moveTo(pos, angle),
Expand All @@ -438,10 +445,20 @@ const createKey = (pos, angle = [0, 0, 0]) => {
ON INIT {
${getInjections("init", self)}
OBJECT_HIDE SELF NO
ACCEPT
}
ON INVENTORYIN {
IF (${self.state.pickedUp} == 0) {
SET ${self.state.pickedUp} 0
SENDEVENT PICKUP ${jumpscareCtrl.ref} "key:exit"
}
ACCEPT
}
`;
}),
declare("int", "pickedUp", 0),
createItem
// )(items.keys.oliverQuest, { name: "[key--exit]" });
)(items.keys.oliverQuest, { name: "Fire exit key" });
Expand Down Expand Up @@ -777,36 +794,6 @@ const generate = async (config) => {
floors
);

const key = createKey([
left + keyX * UNIT - 50,
0,
-(top + keyZ * UNIT) - 50,
]);

const jumpscareCtrl = createJumpscareController([-10, 0, -10], config);

const loots = [
(pos) =>
createAlmondWater(
pos,
[0, 0, 0],
getAlmondWaterVariant(),
jumpscareCtrl
),
// TODO: more loot
];

lootSlot.forEach(([x, z]) => {
const offsetX = Math.floor(randomBetween(0, UNIT / 100)) * 100;
const offsetZ = Math.floor(randomBetween(0, UNIT / 100)) * 100;
const pos = [
left + x * UNIT - 50 + offsetX,
0,
-(top + z * UNIT) - 50 + offsetZ,
];
pickRandoms(1, loots)[0](pos);
});

let translate = [0, 0, 0];
let rotate = [0, 0, 0];

Expand All @@ -831,13 +818,47 @@ const generate = async (config) => {

const lampCtrl = createLampController([10, 0, 10], lamps, config);

const jumpscareCtrl = createJumpscareController(
[-10, 0, -10],
lampCtrl,
config
);

const key = createKey(
[left + keyX * UNIT - 50, 0, -(top + keyZ * UNIT) - 50],
[0, 0, 0],
jumpscareCtrl
);

createExit(
move(...translate, [left + wallX * UNIT, 0, -(top + wallZ * UNIT)]),
rotate,
key,
lampCtrl
);

const loots = [
(pos) =>
createAlmondWater(
pos,
[0, 0, 0],
getAlmondWaterVariant(),
jumpscareCtrl
),
// TODO: more loot
];

lootSlot.forEach(([x, z]) => {
const offsetX = Math.floor(randomBetween(0, UNIT / 100)) * 100;
const offsetZ = Math.floor(randomBetween(0, UNIT / 100)) * 100;
const pos = [
left + x * UNIT - 50 + offsetX,
0,
-(top + z * UNIT) - 50 + offsetZ,
];
pickRandoms(1, loots)[0](pos);
});

return mapData;
},

Expand Down
4 changes: 2 additions & 2 deletions src/scripting.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const rgba = require("color-rgba");
const { compose, dropLast, join, curry, map, divide, __ } = require("ramda");
const { compose, dropLast, join, curry, map } = require("ramda");

const color = (colorDefinition) => {
return compose(
join(" "),
map(divide(__, 256)),
map((channel) => Math.round((channel / 256) * 10 ** 6) / 10 ** 6),
dropLast(1),
rgba
)(colorDefinition);
Expand Down

0 comments on commit 3f30939

Please sign in to comment.