Skip to content

Commit

Permalink
fix: update to bitsy 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
seleb committed Jul 23, 2022
1 parent b8c52ac commit 5d9e8f8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"main": "index.mjs",
"version": "21.0.0",
"bitsyVersion": "8.0",
"bitsyVersion": "8.1",
"scripts": {
"build": "rollup -c",
"test": "jest --runInBand",
Expand Down
36 changes: 33 additions & 3 deletions src/test/Bitsy 8.0.html → src/test/Bitsy 8.1.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<script type="text/bitsyGameData" id="exportedGameData">
Write your game's title here

# BITSY VERSION 8.0
# BITSY VERSION 8.1

! VER_MAJ 8
! VER_MIN 0
! VER_MIN 1
! ROOM_FORMAT 1
! DLG_COMPAT 0
! TXT_MODE 0
Expand Down Expand Up @@ -990,6 +990,8 @@

self._poke(self._buttonBlock, self.BTN_MENU,
(input.isRestartComboPressed()) ? 1 : 0);

input.resetTapReleased();
}

function updateSound(dt) {
Expand Down Expand Up @@ -4628,6 +4630,10 @@
initRoom(state.room);
}

if (dialogRenderer) {
dialogRenderer.updateTextboxPosition();
}

// resume dialog script
onReturn(state.room);
};
Expand Down Expand Up @@ -6760,6 +6766,10 @@
shouldDrawArrow = true;
}

this.updateTextboxPosition = function() {
shouldUpdateTextboxSettings = true;
};

// this.CharsPerRow = function() {
// return textboxInfo.charsPerRow;
// }
Expand Down Expand Up @@ -7817,7 +7827,7 @@
/* VERSION */
var version = {
major: 8, // major changes
minor: 0, // smaller changes
minor: 1, // smaller changes
devBuildPhase: "RELEASE",
};
function getEngineVersion() {
Expand Down Expand Up @@ -9317,6 +9327,24 @@
}
}

function drawRoomForegroundTile(room, frameIndex, x, y) {
// draw items
for (var i = 0; i < room.items.length; i++) {
var itm = room.items[i];
if (itm.x === x && itm.y === y) {
drawItem(getItemFrame(item[itm.id], frameIndex), itm.x, itm.y);
}
}

// draw sprites
for (id in sprite) {
var spr = sprite[id];
if (id != playerId && spr.room === room.id && spr.x === x && spr.y === y) {
drawSprite(getSpriteFrame(spr, frameIndex), spr.x, spr.y);
}
}
}

function drawRoom(room, args) {
if (room === undefined || isNarrating) {
// protect against invalid rooms
Expand All @@ -9331,6 +9359,8 @@
// if *only* redrawing the avatar, first clear its previous position
if (redrawAvatar) {
setTile(bitsy.MAP2, playerPrevX, playerPrevY, 0);
// also redraw any sprite or item that might be "under" the player (todo: possible perf issue?)
drawRoomForegroundTile(room, frameIndex, playerPrevX, playerPrevY);
}

// draw background & foreground tiles
Expand Down

0 comments on commit 5d9e8f8

Please sign in to comment.