Skip to content

Commit

Permalink
feat: update bitsy version to 8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
seleb committed Jul 7, 2023
1 parent fa96e73 commit e1ed1f7
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 31 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.3.0",
"bitsyVersion": "8.4",
"bitsyVersion": "8.6",
"scripts": {
"build": "rollup -c --bundleConfigAsCjs",
"test": "jest --runInBand",
Expand Down
104 changes: 74 additions & 30 deletions src/test/Bitsy 8.4.html → src/test/Bitsy 8.6.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.4
# BITSY VERSION 8.6

! VER_MAJ 8
! VER_MIN 4
! VER_MIN 6
! ROOM_FORMAT 1
! DLG_COMPAT 0
! TXT_MODE 0
Expand Down Expand Up @@ -1548,7 +1548,7 @@
// is this the right place for this to live?
var version = {
major: 8, // major changes
minor: 4, // smaller changes
minor: 6, // smaller changes
devBuildPhase: "RELEASE",
};
function getEngineVersion() {
Expand Down Expand Up @@ -1965,6 +1965,28 @@
};
}

function createExitData(x, y, destRoom, destX, destY, transition, dlg) {
return {
x: x,
y: x,

This comment has been minimized.

Copy link
@o72336595

o72336595 Jul 23, 2023

Wrong line here! Expected y: y

This comment has been minimized.

Copy link
@o72336595

o72336595 Jul 23, 2023

Please see le-doux/bitsy#224

This comment has been minimized.

Copy link
@seleb

seleb Jul 23, 2023

Author Owner

yes, i'm aware of this issue and waiting on adam to apply the fix. this template is just a copy of the recent version of bitsy for testing purposes, there's no point in fixing it here

dest: {
room: destRoom,
x: destX,
y: destY
},
transition_effect: transition,
dlg: dlg,
};
}

function createEndingData(id, x, y) {
return {
id: id,
x: x,
y: y
};
}

function parseRoom(parseState, world) {
var i = parseState.index;
var lines = parseState.lines;
Expand Down Expand Up @@ -2056,17 +2078,14 @@
var exitCoords = exitArgs[1].split(",");
var destName = exitArgs[2];
var destCoords = exitArgs[3].split(",");
var ext = {
x : parseInt(exitCoords[0]),
y : parseInt(exitCoords[1]),
dest : {
room : destName,
x : parseInt(destCoords[0]),
y : parseInt(destCoords[1])
},
transition_effect : null,
dlg: null,
};
var ext = createExitData(
/* x */ parseInt(exitCoords[0]),
/* y */ parseInt(exitCoords[1]),
/* destRoom */ destName,
/* destX */ parseInt(destCoords[0]),
/* destY */ parseInt(destCoords[1]),
/* transition */ null,
/* dlg */ null);

// optional arguments
var exitArgIndex = 4;
Expand All @@ -2091,11 +2110,10 @@
var endId = getId(lines[i]);

var endCoords = getCoord(lines[i], 2);
var end = {
id : endId,
x : parseInt(endCoords[0]),
y : parseInt(endCoords[1])
};
var end = createEndingData(
/* id */ endId,
/* x */ parseInt(endCoords[0]),
/* y */ parseInt(endCoords[1]));

roomData.endings.push(end);
}
Expand Down Expand Up @@ -7230,7 +7248,7 @@

// TODO : convert this into something that takes DialogChar arrays
this.AddText = function(textStr) {
bitsy.log("ADD TEXT " + textStr);
bitsy.log("ADD TEXT >>" + textStr + "<<");

//process dialog so it's easier to display
var words = textStr.split(" ");
Expand Down Expand Up @@ -7338,20 +7356,25 @@
var curRowArr = buffer[curPageIndex][curRowIndex];

// need to actually create a whole new page if following another pagebreak character
if (this.CurChar() && this.CurChar().isPageBreak) {
if (afterManualPagebreak) {
this.FlipPage(); // hacky

buffer[curPageIndex][curRowIndex] = curRowArr;
buffer.push([]);
curPageIndex++;
buffer[curPageIndex].push([]);
curRowIndex = 0;
curRowArr = buffer[curPageIndex][curRowIndex];

afterManualPagebreak = false;
}

var pagebreakChar = new DialogPageBreakChar();
pagebreakChar.SetContinueHandler(onReturnHandler);

curRowArr.push(pagebreakChar);

isActive = true;
isActive = true;
}

this.hasTextEffect = function(name) {
Expand Down Expand Up @@ -7839,6 +7862,8 @@
state.ava = playerId; // avatar appearance override
state.pal = "0"; // current palette id
state.tune = "0"; // current tune id ("0" === off)
state.exits = []; // exits in current room
state.endings = []; // endings in current room
}

// title helper functions
Expand Down Expand Up @@ -8551,13 +8576,31 @@
}

// init exit properties
state.exits = [];
for (var i = 0; i < room[roomId].exits.length; i++) {
room[roomId].exits[i].property = { locked:false };
var exit = createExitData(
/* x */ room[roomId].exits[i].x,
/* y */ room[roomId].exits[i].y,
/* destRoom */ room[roomId].exits[i].dest.room,
/* destX */ room[roomId].exits[i].dest.x,
/* destY */ room[roomId].exits[i].dest.y,
/* transition */ room[roomId].exits[i].transition_effect,
/* dlg */ room[roomId].exits[i].dlg);
exit.property = { locked: false };

state.exits.push(exit);
}

// init ending properties
state.endings = [];
for (var i = 0; i < room[roomId].endings.length; i++) {
room[roomId].endings[i].property = { locked:false };
var end = createEndingData(
/* id */ room[roomId].endings[i].id,
/* x */ room[roomId].endings[i].x,
/* y */ room[roomId].endings[i].y);
end.property = { locked: false };

state.endings.push(end);
}

if (soundPlayer) {
Expand Down Expand Up @@ -8652,19 +8695,20 @@
return null;
}

function getExit(roomId,x,y) {
for (i in room[roomId].exits) {
var e = room[roomId].exits[i];
// todo : roomId isn't useful in these functions anymore! safe to remove?
function getExit(roomId, x, y) {
for (i in state.exits) {
var e = state.exits[i];
if (x == e.x && y == e.y) {
return e;
}
}
return null;
}

function getEnding(roomId,x,y) {
for (i in room[roomId].endings) {
var e = room[roomId].endings[i];
function getEnding(roomId, x, y) {
for (i in state.endings) {
var e = state.endings[i];
if (x == e.x && y == e.y) {
return e;
}
Expand Down

1 comment on commit e1ed1f7

@stysan
Copy link

@stysan stysan commented on e1ed1f7 Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yaaaay

Please sign in to comment.