Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Oct 15, 2019
2 parents de3a743 + b99a630 commit 88640c6
Show file tree
Hide file tree
Showing 94 changed files with 4,920 additions and 1,733 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jquery": true
"node": true
},
"parserOptions": {
"ecmaVersion": 2018
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ builds
build
cache
/app/data/docs
tempChangelog.md

# tests
error_screenshots/
Expand Down
60 changes: 60 additions & 0 deletions app/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
## v 1.1.0

*15 October 2019*

### ✨ New Features

* Add a debug mode to ct.place (you can find it in the settings tab)
* texture-editor: Add the Symmetry tool for polygonal shapes (by @schadocalex)
* Add Iosevka as a default typeface for code, allow setting your own typeface, control line height and ligatures
* Open the `includes` folder from the hamburger menu
* Support for nested copies (#127) by @schadocalex
* Support for Yarn (a tool for making dialogues and interactive fiction), powered by bondage.js
* texture-editor: Directly add/remove shape points on texture with your mouse. Add a point by clicking on the yellow line segments, delete points by clicking on them (by @schadocalex)

### ⚡️ General Improvements

* Add Pt-Br translation of UI by Folha de SP from Discord
* Better checkboxes, radio inputs, and other fields
* Better styling of inline code fragments in the modules panel
* Better texture-editor layout
* Better, more readeable tables in module's docs
* Change Horizon colors a bit to make it more pleasant to look at
* Highlight code blocks at modules panel
* Improve texture packing
* Make module list and their details scroll independently
* Remove excess borders in nested views
* Remove excess borders on module panels
* Remove old language keys, add Comments.json, Debug.json
* Rename "Is tiled" property of textures to "Use as background", hide splitting tools if used as background
* texture-editor: Make the axis handle squared (by @schadocalex)
* texture-editor: Zooming in/out now works when scrolling outside the texture as well (by @schadocalex)
* Tiny UI improvements, here and there

### 🐛 Bug Fixes

* :pencil: Replace Lato's license with Open Sans', as we don't use Lato
* Color inputs should show white value on a dark background from the very start
* Fix broken style editor
* Fix numerous collision problems that appeared with rotated entities
* Fix the checkbox "close the shape", as it didn't change the actual state before
* Stop chromium from messing up with color profiles and colors in ct.js

### 🍱 Demos and Stuff

* Add a Yarn demo

### 📝 Docs

* Document the `alpha` property of copies
* :zap: Update Troubleshooting — teared backgrounds
* :bug: Update tut-making-shooter.md
* Pt-Br translation :tada:

### 🌐 Website

* :bug: Fix an outdated link to downloads in the header
* :sparkles: Add partial Russian translation
* :zap: Align social icons at the footer to the right


## v 1.0.2

*25 September 2019.*
Expand Down
3 changes: 2 additions & 1 deletion app/data/ct.libs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"globals": {
"ct": false
"ct": false,
"PIXI": true
},
"rules": {
"object-shorthand": 0
Expand Down
70 changes: 54 additions & 16 deletions app/data/ct.libs/place/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-underscore-dangle */
/* global ct SSCD */
/* global SSCD */
/* eslint prefer-destructuring: 0 */
(function (ct) {
const circlePrecision = 16,
Expand All @@ -12,19 +12,19 @@
position.x -= copy.scale.x > 0? (shape.left * copy.scale.x) : (-copy.scale.x * shape.right);
position.y -= copy.scale.y > 0? (shape.top * copy.scale.y) : (-shape.bottom * copy.scale.y);
return new SSCD.Rectangle(
position,
position,
new SSCD.Vector(Math.abs((shape.left + shape.right) * copy.scale.x), Math.abs((shape.bottom + shape.top) * copy.scale.y))
);
}
const upperLeft = ct.u.rotate(-shape.left * copy.scale.x, -shape.top * copy.scale.y, copy.rotation),
upperRight = ct.u.rotate(shape.right * copy.scale.x, -shape.top * copy.scale.y, copy.rotation),
bottomLeft = ct.u.rotate(-shape.left * copy.scale.x, shape.bottom * copy.scale.y, copy.rotation),
bottomRight = ct.u.rotate(shape.right * copy.scale.x, shape.bottom * copy.scale.y, copy.rotation);
bottomRight = ct.u.rotate(shape.right * copy.scale.x, shape.bottom * copy.scale.y, copy.rotation),
upperRight = ct.u.rotate(shape.right * copy.scale.x, -shape.top * copy.scale.y, copy.rotation);
return new SSCD.LineStrip(position, [
new SSCD.Vector(upperLeft[0], upperLeft[1]),
new SSCD.Vector(upperRight[0], upperRight[1]),
new SSCD.Vector(bottomLeft[0], bottomLeft[1]),
new SSCD.Vector(bottomRight[0], bottomRight[1])
new SSCD.Vector(bottomRight[0], bottomRight[1]),
new SSCD.Vector(upperRight[0], upperRight[1])
], true);
}
if (shape.type === 'circle') {
Expand Down Expand Up @@ -57,7 +57,7 @@
vertices.push(new SSCD.Vector(point.x * copy.scale.x, point.y * copy.scale.y));
}
}
return new SSCD.LineStrip(position, vertices, false);
return new SSCD.LineStrip(position, vertices, Boolean(shape.closedStrip));
}
if (shape.type === 'line') {
return new SSCD.Line(
Expand Down Expand Up @@ -92,6 +92,37 @@
}
return hashes;
},
/**
* Applied to copies in the debug mode. Draws a collision shape
* @this Copy
* @returns {void}
*/
drawDebugGraphic() {
const shape = this._shape || getSSCDShape(this);
const g = this.$cDebugCollision;
const color = this.$cHadCollision? 0x00ff00 : 0x0066ff;
if (shape instanceof SSCD.Rectangle) {
const pos = shape.get_position(),
size = shape.get_size();
g.lineStyle(2, color)
.drawRect(pos.x - this.x, pos.y - this.y, size.x, size.y);
} else if (shape instanceof SSCD.LineStrip) {
g.lineStyle(2, color)
.moveTo(shape.__points[0].x, shape.__points[0].y);
for (let i = 1; i < shape.__points.length; i++) {
g.lineTo(shape.__points[i].x, shape.__points[i].y);
}
} else if (shape instanceof SSCD.Circle) {
g.lineStyle(2, color)
.drawCircle(0, 0, shape.get_radius());
} else {
g.lineStyle(4, 0xff0000)
.moveTo(-40, -40)
.lineTo(40, 40,)
.moveTo(-40, 40)
.lineTo(40, -40);
}
},
collide(c1, c2) {
// ct.place.collide(<c1: Copy, c2: Copy>)
// Test collision between two copies
Expand All @@ -105,12 +136,19 @@
return false;
}
}
return SSCD.CollisionManager.test_collision(c1._shape, c2._shape);
if (SSCD.CollisionManager.test_collision(c1._shape, c2._shape)) {
if ([/*%debugMode%*/][0]) {
c1.$cHadCollision = true;
c2.$cHadCollision = true;
}
return true;
}
return false;
},
/**
* Determines if the place in (x,y) is occupied.
* Determines if the place in (x,y) is occupied.
* Optionally can take 'ctype' as a filter for obstackles' collision group (not shape type)
*
*
* @param {Copy} me The object to check collisions on
* @param {Number} [x] The x coordinate to check, as if `me` was placed there.
* @param {Number} [y] The y coordinate to check, as if `me` was placed there.
Expand All @@ -120,7 +158,7 @@
* @returns {Copy|Array<Copy>} The collided copy, or an array of all the detected collisions (if `multiple` is `true`)
*/
occupied(me, x, y, ctype, multiple) {
var oldx = me.x,
var oldx = me.x,
oldy = me.y,
shapeCashed = me._shape;
let hashes;
Expand Down Expand Up @@ -184,7 +222,7 @@
meet(me, x, y, type, multiple) {
// ct.place.meet(<me: Copy, x: Number, y: Number>[, type: Type])
// detects collision between a given copy and a copy of a certain type
var oldx = me.x,
var oldx = me.x,
oldy = me.y,
shapeCashed = me._shape;
let hashes;
Expand Down Expand Up @@ -364,7 +402,7 @@
me.y += ct.u.ldy(length, dir);
delete me._shape;
me.dir = dir;
// otherwise, try to change direction by 30...60...90 degrees.
// otherwise, try to change direction by 30...60...90 degrees.
// Direction changes over time (ct.place.m).
} else {
for (var i = -1; i <= 1; i+= 2) {
Expand All @@ -382,14 +420,14 @@
},
/**
* Throws a ray from point (x1, y1) to (x2, y2), returning all the instances that touched the ray.
* The first copy in the returned array is the closest copy, the last one is the furthest.
*
* The first copy in the returned array is the closest copy, the last one is the furthest.
*
* @param {Number} x1 A horizontal coordinate of the starting point of the ray.
* @param {Number} y1 A vertical coordinate of the starting point of the ray.
* @param {Number} x2 A horizontal coordinate of the ending point of the ray.
* @param {Number} y2 A vertical coordinate of the ending point of the ray.
* @param {String} [ctype] An optional collision group to trace against. If omitted, will trace through all the copies in the current room.
*
*
* @returns {Array<Copy>} Array of all the copies that touched the ray
*/
trace(x1, y1, x2, y2, ctype) {
Expand Down
3 changes: 2 additions & 1 deletion app/data/ct.libs/place/injects/afterdraw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
if (this.x !== this.xprev || this.y !== this.yprev) {
/* eslint-disable no-underscore-dangle */
if ((this.transform && (this.transform._localID !== this.transform._currentLocalID)) || this.x !== this.xprev || this.y !== this.yprev) {
delete this._shape;
const oldHashes = this.$chashes || [];
this.$chashes = ct.place.getHashes(this);
Expand Down
16 changes: 16 additions & 0 deletions app/data/ct.libs/place/injects/beforedraw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if ([/*%debugMode%*/][0] && this instanceof ct.types.Copy) {
this.$cDebugText.scale.x = this.$cDebugCollision.scale.x = 1 / this.scale.x;
this.$cDebugText.scale.y = this.$cDebugCollision.scale.y = 1 / this.scale.y;
this.$cDebugText.rotation = this.$cDebugCollision.rotation = -ct.u.degToRad(this.rotation);

const newtext = `Partitions: ${this.$chashes.join(', ')}
Group: ${this.ctype}
Shape: ${this._shape && this._shape.__type}`;
if (this.$cDebugText.text !== newtext) {
this.$cDebugText.text = newtext;
}
this.$cDebugCollision
.clear();
ct.place.drawDebugGraphic.apply(this);
this.$cHadCollision = false;
}
10 changes: 10 additions & 0 deletions app/data/ct.libs/place/injects/oncreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ for (const hash of this.$chashes) {
ct.place.grid[hash].push(this);
}
}
if ([/*%debugMode%*/][0] && this instanceof ct.types.Copy) {
this.$cDebugText = new PIXI.Text('Not initialized', {
fill: 0xffffff,
dropShadow: true,
dropShadowDistance: 2,
fontSize: [/*%debugText%*/][0] || 16
});
this.$cDebugCollision = new PIXI.Graphics();
this.addChild(this.$cDebugCollision, this.$cDebugText);
}
2 changes: 1 addition & 1 deletion app/data/ct.libs/place/injects/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ Object.defineProperty(ct.types.Copy.prototype, 'moveContinuous', {
this.vspeed += this.gravity * ct.delta * Math.sin(this.gravityDir*Math.PI/-180);
}
return ct.place.moveAlong(this, this.direction, this.speed, ctype, precision);
}
}
});
14 changes: 14 additions & 0 deletions app/data/ct.libs/place/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@
"id": "gridY",
"default": 512,
"type": "number"
}, {
"name": "Debug mode",
"help": "Displays collision shapes, collision groups and partitions. It will also write additional keys to most colliding objects. Doesn't work on hidden objects.",
"key": "debugMode",
"id": "debugMode",
"default": false,
"type": "checkbox"
}, {
"name": "Debug text size",
"help": "",
"key": "debugText",
"id": "debugText",
"default": 16,
"type": "number"
}],
"typeExtends": [{
"name": "Collision group",
Expand Down
Loading

0 comments on commit 88640c6

Please sign in to comment.