npc也支持大素材

This commit is contained in:
ckcz123 2021-08-12 13:25:26 +08:00
parent f7ef0e9586
commit a41c91f61d
5 changed files with 25 additions and 9 deletions

View File

@ -3891,7 +3891,7 @@ Arithmetic_List
AssignOperator_List
: '设为'|'增加'|'减少'|'乘以'|'除以'|'乘方'|'除以并取商'|'除以并取余'|'设为不小于'|'设为不大于'
/*AssignOperator_List ['=','+=','-=','*=','/=','**=','//=','%=','min=','max=']*/;
/*AssignOperator_List ['=','+=','-=','*=','/=','**=','//=','%=','max=','min=']*/;
UnaryOperator_List
: '向下取整'|'向上取整'|'四舍五入'|'整数截断'|'绝对值'|'开方'|'变量类型'

View File

@ -155,7 +155,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
return current[0];
}).toString(),
"_docs": "绑定贴图",
"_data": "该怪物绑定的怪物贴图"
"_data": "该怪物绑定的怪物贴图,用法详见文档"
},
"hp": {
"_leaf": true,
@ -397,6 +397,21 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_event": "faceIds",
"_docs": "行走图朝向",
"_data": "行走图朝向。在勇士撞上图块时,或图块在移动时,会自动选择最合适的朝向图块(如果存在定义)来进行绘制。"
},
"bigImage": {
"_leaf": true,
"_type": "material",
"_directory": "./project/images/",
"_transform": (function (one) {
if (one.endsWith('.png')) return one;
return null;
}).toString(),
"_onconfirm": (function (previous, current) {
if (current.length == 0) return null;
return current[0];
}).toString(),
"_docs": "绑定贴图",
"_data": "该图块绑定的贴图,用法详见文档"
}
}
},

View File

@ -146,7 +146,7 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) {
if (core.status.floorId) {
// Global Animate
core.status.globalAnimateObjs.forEach(function (block) {
core.drawBlock(block, core.status.globalAnimateStatus % (block.event.animate||1));
core.drawBlock(block, core.status.globalAnimateStatus);
});
// Global floor images

View File

@ -386,7 +386,7 @@ enemys.prototype._getCurrentEnemys_getEnemy = function (enemyId) {
if (!enemy) return null;
// 检查朝向displayIdInBook
return core.material.enemys[(enemy.faceIds || {}).down] || core.material.enemys[enemy.displayIdInBook] || enemy;
return core.material.enemys[enemy.displayIdInBook] || core.material.enemys[(enemy.faceIds || {}).down] || enemy;
}
enemys.prototype._getCurrentEnemys_addEnemy = function (enemyId, enemys, used, x, y, floorId) {

View File

@ -960,7 +960,7 @@ maps.prototype._getBigImageInfo = function (bigImage, face, animate) {
var per_width = bigImage.width / 4;
var per_height = bigImage.height / 4;
var sx = animate * per_width, sy;
if (per_height < per_width / 2) { // 强制视为 1*4 的怪物
if (per_height <= per_width / 2) { // 强制视为 1*4 的怪物
per_height = bigImage.height;
sy = 0;
} else {
@ -1968,13 +1968,14 @@ maps.prototype.getBlockInfo = function (block) {
break;
}
}
if (block.event.bigImage) bigImage = core.material.images.images[block.event.bigImage];
if (core.material.enemys[id]) {
name = core.material.enemys[id].name;
bigImage = core.material.images.images[core.material.enemys[id].bigImage] || null;
if (bigImage != null) animate = 4;
bigImage = core.material.images.images[core.material.enemys[id].bigImage];
} else if (core.material.items[id]) {
name = core.material.items[id].name;
}
if (bigImage != null) animate = 4;
}
return {number: number, id: id, cls: cls, name: name, image: image, posX: posX,
@ -2582,7 +2583,7 @@ maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) {
}
maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, callback) {
var animateTotal = core.icons._getAnimateFrames(blockInfo.cls), animateTime = 0;
var animateTotal = blockInfo.animate, animateTime = 0;
var _run = function () {
var animate = window.setInterval(function () {
if (blockInfo.cls != 'tileset') {
@ -2872,7 +2873,7 @@ maps.prototype.addGlobalAnimate = function (block) {
core.status.autotileAnimateObjs.push(block);
}
else {
if (!block.event.animate || block.event.animate == 1) return;
if (!block.event.bigImage && (!block.event.animate || block.event.animate == 1)) return;
core.status.globalAnimateObjs.push(block);
}
}