Skip to content

Commit

Permalink
feat: update hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
seleb authored and actions-user committed Apr 9, 2022
1 parent 384dbfc commit b355f2a
Show file tree
Hide file tree
Showing 62 changed files with 956 additions and 670 deletions.
1,147 changes: 645 additions & 502 deletions docs/assets/index.2942b0cf.js → docs/assets/index.5c35e4ea.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -51,7 +51,7 @@
]
},
"devDependencies": {
"@bitsy/hecks": "^20.2.0",
"@bitsy/hecks": "^20.2.1",
"eslint": "^8.12.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
Expand Down
7 changes: 4 additions & 3 deletions src/hacks/avatar-by-room.txt
Expand Up @@ -4,7 +4,7 @@
@summary change the avatar in certain rooms
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -177,7 +177,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -219,6 +219,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand All @@ -244,7 +245,7 @@ var after = kitsy.after;
@file utils
@summary miscellaneous bitsy utilities
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down
38 changes: 34 additions & 4 deletions src/hacks/backdrops.txt
Expand Up @@ -4,7 +4,7 @@
@summary makes the game have a backdrop
@license MIT
@author Cephalopodunk & Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -181,7 +181,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -223,6 +223,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand Down Expand Up @@ -250,7 +251,7 @@ var after = kitsy.after;
@summary makes all sprites have transparent backgrounds
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -279,6 +280,35 @@ before('renderer.GetDrawingFrame', function (drawing, frameIndex) {
});
// send -1 instead of background colour index if transparent
inject(/bitsyDrawPixel\(backgroundColor, x, y\)/, 'bitsyDrawPixel(window.makeTransparent ? -1 : backgroundColor, x, y)');
// make sure transitions render using regular room logic
inject(
/(function createRoomPixelBuffer\(room\) {)/,
`$1
var buffer = drawingBuffers[screenBufferId];
var s = buffer.scale;
buffer.scale = 1;
drawRoom(room);
renderDrawingBuffer(screenBufferId, buffer);
const data = buffer.canvas.getContext('2d').getImageData(0, 0, buffer.width, buffer.height).data;
var pixelBuffer = [];
for (var y = 0; y < buffer.height; ++y) {
for (var x = 0; x < buffer.width; ++x) {
var idx = (y*buffer.width + x)*4;
var r = data[idx + 0];
var g = data[idx + 1];
var b = data[idx + 2];
var p = getPal(getRoomPal(curRoom)).findIndex(i => r === i[0] && g === i[1] && b === i[2]);
pixelBuffer.push(tileColorStartIndex + p);
}
}
buffer.scale = s;
invalidateDrawingBuffer(buffer);
return pixelBuffer;
`
);
// make sure tiles are available when drawing rooms
inject(/(var tileBuffer = drawingBuffers\[tileId\];)/, 'hackForEditor_GetImageFromTileId(tileId); $1');

// overwrite transparent pixel
after('renderPixelInstruction', function (bufferId, buffer, paletteIndex, x, y) {
if (paletteIndex !== -1) return;
Expand All @@ -302,7 +332,7 @@ after('renderPixelInstruction', function (bufferId, buffer, paletteIndex, x, y)
@summary makes the game have a transparent background
@license MIT
@author Cephalopodunk & Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down
7 changes: 4 additions & 3 deletions src/hacks/basic-sfx.txt
Expand Up @@ -4,7 +4,7 @@
@summary "walk" and "talk" sound effect support
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -172,7 +172,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -214,6 +214,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand All @@ -239,7 +240,7 @@ var after = kitsy.after;
@file utils
@summary miscellaneous bitsy utilities
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down
7 changes: 4 additions & 3 deletions src/hacks/bitsymuse.txt
Expand Up @@ -4,7 +4,7 @@
@summary A variety of Bitsy sound and music handlers
@license MIT
@author David Mowatt
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -206,7 +206,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -248,6 +248,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand Down Expand Up @@ -371,7 +372,7 @@ function addDualDialogTag(tag, fn) {
@file utils
@summary miscellaneous bitsy utilities
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down
5 changes: 3 additions & 2 deletions src/hacks/canvas-replacement.txt
Expand Up @@ -4,7 +4,7 @@
@summary WebGLazy bitsy integration (this one's mostly just for me)
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -203,7 +203,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -245,6 +245,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand Down
7 changes: 4 additions & 3 deletions src/hacks/character-portraits-animated.txt
Expand Up @@ -4,7 +4,7 @@
@summary high quality anime gifs
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -971,7 +971,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -1013,6 +1013,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand Down Expand Up @@ -1088,7 +1089,7 @@ function addDialogTag(tag, fn) {
@summary high quality anime jpegs (or pngs i guess)
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down
5 changes: 3 additions & 2 deletions src/hacks/character-portraits.txt
Expand Up @@ -4,7 +4,7 @@
@summary high quality anime jpegs (or pngs i guess)
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -200,7 +200,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -242,6 +242,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand Down
5 changes: 3 additions & 2 deletions src/hacks/close-on-ending.txt
Expand Up @@ -4,7 +4,7 @@
@summary Prevents from playing past an ending
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -163,7 +163,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -205,6 +205,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand Down
9 changes: 5 additions & 4 deletions src/hacks/corrupt.txt
Expand Up @@ -4,7 +4,7 @@
@summary corrupts gamedata at runtime
@license MIT
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12


Expand Down Expand Up @@ -60,7 +60,7 @@ bitsy = bitsy || /*#__PURE__*/_interopDefaultLegacy(bitsy);
@file utils
@summary miscellaneous bitsy utilities
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -122,7 +122,7 @@ function getImage(name, map) {
@file edit image at runtime
@summary API for updating image data at runtime.
@author Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

@description
Expand Down Expand Up @@ -340,7 +340,7 @@ function applyHook(root, functionName) {
@summary Monkey-patching toolkit to make it easier and cleaner to run code before and after functions or to inject new code into script tags
@license WTFPL (do WTF you want)
@author Original by mildmojo; modified by Sean S. LeBlanc
@version 20.2.0
@version 20.2.1
@requires Bitsy 7.12

*/
Expand Down Expand Up @@ -382,6 +382,7 @@ if (!hooked) {
bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer();
bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer();
bitsy.renderer = new bitsy.TileRenderer(bitsy.tilesize);
bitsy.transition = new bitsy.TransitionManager();

// Hook everything
kitsy.applyHooks();
Expand Down

0 comments on commit b355f2a

Please sign in to comment.