-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscenes.js
850 lines (705 loc) · 18.8 KB
/
scenes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
import Room from './room.js'
import Shader from './shader.js'
import Node from '../boot/node.js'
import Rdt from './rdt.js'
import Liv from './living.js'
import Ai from './ai.js'
import Tool, {DrawArray, Point2, RectangleMark} from './tool.js'
import Tbl from './init-tbl.js'
import Sound from './sound.js';
import PFind from './astar.js';
import Item from './item.js';
const matrix = Node.load('boot/gl-matrix.js');
const {vec3, mat4} = matrix;
const _DEBUG = 1;
export default {
init,
start_game,
};
let window, camera, draw_order;
const LEON = 0;
const CLAIRE = 1;
const DISK_A = 0;
const DISK_B = 1;
const HARD = 2;
const NORMAL = 1;
const EASY = 0;
// 切换镜头的等待时间, 太短刺眼
const CAM_SW_WAIT = 0; //300;
// game_var 常量定义
const V_CAMERA = 26;
// 在整个游戏过程中保存变量
// 26: 当前摄像机号码
const game_var = [];
// CK? 变量,
// 0:游戏状态, 1:场景设置, 4:事件id
// 5:?, 6:实体被杀身份, 7:与实体健康状况有关
// 8:项目抓取状态, 0B:1F玩家回答问题(0 =是,1 =否)
// 1D:游戏状态,通过几次重播保持?
const ck_flag = [];
// 当前地图上的所有需要释放资源的对象
const scenes_garbage = [];
// 当前地图上的对象, 用于 bio2 脚本
const object_arr = [];
const enemy = [];
// 被杀死的敌人
const killed = [];
// 角色的活动范围.
const play_range = [];
// 地图上的障碍物
const collisions = [];
// 当玩家进入范围, 时间被触发, 调用 act()
const touch = [];
// 地图上的可调查对象, 当玩家在范围内调查时, 事件被触发, 调用 act()
const survey = [];
// 地板, 用于步行音效
const floors = [];
// 记录摄像机切换顺序
const cut_stack = [];
// 用地图数据构建的寻路路径图, 寻路图大小 1x1, 映射到实际地图的 512x512 方格上.
const map_mblock = 512;
const map_pblock = 0x20000 / map_mblock;
const map_path = new PFind.AStarFindPath(map_pblock, map_pblock);
const frame_task = Tool.FrameTaskMana(map_path, map_mblock, map_pblock);
// 当前房间脚本上下文
let script_context;
let goto_next_door;
let map_data;
let stage = 1;
let room_nm = 0;
let camera_nm = -1;
let play_mode = LEON;
let ab = DISK_A;
let lock_camera = false;
// 玩家对象
let p1;
const gameState = {
// 属性
survey,
touch,
play_range,
collisions,
script_running : false,
floors,
map_path,
map_mblock,
map_pblock,
enemy,
rand_value : 0,
// js 脚本函数
switch_camera,
next_frame,
reverse,
setDoor,
bind_ex_anim,
getPlayer(num) { return p1 },
frame_task,
_show_point,
// bio 脚本函数
waittime:0,
cut_chg,
cut_restore,
cut_auto,
aot_set,
addEnemy,
setGameVar,
getGameVar,
get_bitarr,
set_bitarr,
calc,
get_game_object,
play_se,
play_voice,
show_message,
garbage,
};
function init(_window, _camera, _shader_pro, order) {
window = _window;
camera = _camera;
draw_order = order;
vec3.set(camera.up(), 0, -1, 0);
window.add(frame_task);
_DEBUG && _test_switch_camera();
}
function start_game() {
// logo();
// game_select();
begin_level();
}
function switch_camera() {
if (lock_camera) return;
let cd = map_data.cameras[camera_nm];
camera.setPos(cd.from_x, cd.from_y, cd.from_z);
camera.lookAt(cd.to_x, cd.to_y, cd.to_z);
Room.switchWith(stage, room_nm, camera_nm, cd.mask);
game_var[V_CAMERA] = camera_nm;
Shader.setFov(cd.fov);
setup_lights(cd);
for (let i=touch.length-1; i>=0; --i) {
if (touch[i].cam1 >= 0) {
touch.splice(i, 1);
}
}
find_camera_switcher();
Tool.debug("Current Camera", camera_nm, 'fov', cd.fov);
}
function find_camera_switcher() {
for (let i = map_data.cameras_sw.length-1; i>=0; --i) {
let sw = map_data.cameras_sw[i];
if (sw.cam0 == camera_nm && sw.cam0 != sw.cam1) {
bind_cm(sw);
}
}
function bind_cm(sw) {
// TODO: 如果角色离开摄像机开关, 恢复开关的功能
const w = p1.where();
let isStanding = Tool.inRange(sw, w[0], w[2]);
if (!isStanding) {
sw.act = function() {
if (sw.floor == 0xFF || sw.floor == p1.floor()) {
// thread.wait(CAM_SW_WAIT);
camera_nm = this.cam1;
switch_camera();
}
};
touch.push(sw);
}
}
}
function setup_lights(cr) {
// Tool.debug("Env:", cr.env_color);
// Tool.debug(" l0:", cr.light0);
// Tool.debug(" l1:", cr.light1);
// Tool.debug(" l2:", cr.light2);
Shader.setEnvLight(cr.env_color);
Shader.setLights(camera, cr.light0, cr.light1, cr.light2);
}
function free_map() {
for (let i = scenes_garbage.length-1; i>=0; --i) {
scenes_garbage[i].free();
}
scenes_garbage.length = 0;
object_arr.length = 0;
play_range.length = 0;
survey.length = 0;
touch.length = 0;
collisions.length = 0;
enemy.length = 0;
floors.length = 0;
cut_stack.length = 0;
}
function load_map() {
free_map();
map_data = Rdt.from(stage, room_nm, play_mode);
map_path.setAllWeights(-1);
build_road();
build_collisions();
build_floors_se();
try {
Tool.debug("0----------------------- Start init script");
gameState.script_running = true;
map_data.init_script.run(gameState);
Tool.debug("0----------------------- script end");
} catch(e) {
console.error(e.stack);
}
}
function build_collisions() {
let check = {};
// TODO: 碰撞体在游戏时可被改变, 如枪店后巷, 僵尸把门撞开后.
for (let i=0; i<map_data.collision.length; ++i) {
let c = map_data.collision[i];
collisions.push(c);
c.py && c.py.mark(map_mblock, mark_point_callback);
// 显示碰撞体
// const color2 = new Float32Array([0.1, 0.7, 0.9*Math.random()]);
// scenes_garbage.push(Tool.showCollision(c, window, color2));
}
function mark_point_callback(x, y) {
let x0 = parseInt(x / map_mblock + map_pblock/2);
let y0 = parseInt(y / map_mblock + map_pblock/2);
map_path.setWeights(x0, y0, -1);
// if (check[x0+'|'+y0] == null) {
// //显示不可通过路径点
// check[x0+'|'+y0] = 1;
// let r = Tool.xywd2range({x, y, w:100, d:100});
// let color = new Float32Array([1, 0, 0]);
// garbage(Tool.showRange(r, window, color, -110));
// }
}
}
function build_road() {
const color = new Float32Array([0.9, 0.1, 0.3]);
for (let i=map_data.block.length-1; i>=0; --i) {
let b = map_data.block[i];
play_range.push(b);
new RectangleMark(b.x1, b.y1, b.x3-b.x1, b.y3-b.y1)
.mark(map_mblock, mark_point_callback);
// 调试 block
// scenes_garbage.push(Tool.showRange(b, window, color));
}
function mark_point_callback(x, y) {
let x0 = parseInt(x / map_mblock + map_pblock/2);
let y0 = parseInt(y / map_mblock + map_pblock/2);
map_path.setWeights(x0, y0, 0);
}
}
function build_floors_se() {
for (let i=map_data.floor.length-1; i>=0; --i) {
let f = map_data.floor[i];
// let se = Sound.floorSE(f);
let se = Sound.floorSE(f, map_data.vab);
scenes_garbage.push(se);
floors.push(se);
}
}
function load_bgm() {
const STOP_FLAG = 0x40;
const UK_FLAG = 0xC0;
let cfg = Tbl.get(stage, room_nm, play_mode, ab);
let m = cfg.main != 0xFF ? cfg.main : -1;
let s = cfg.sub != 0xFF ? cfg.sub : -1;
let mid, sid;
if (m >= 0) {
if (m == 0x0B) {
mid = '00_1';
} else {
mid = Tool.b2(m & 0x3F);
}
}
if (s >= 0) {
sid = Tool.b2(s & 0x3F);
}
Sound.bgm(mid, sid);
Tool.debug("BGM", cfg, mid, sid);
if (m>=0 && (m & STOP_FLAG) == 0) {
Sound.getBgm(0).play();
}
if (s>=0 && (s & STOP_FLAG) == 0) {
Sound.getBgm(1).play();
}
}
function init_pos(t) {
switch (t) {
case 0: // LEON A 初始位置
p1.setPos(19771.0371, 0, -2603.186);
p1.rotateY(Math.PI);
// 首先改变这些参数, 再调用 load_map/switch_camera
stage = 1; room_nm = 0; camera_nm = 0;
break;
case 1: // 警署大厅
p1.setPos(-12780.552734375, 0, -20381.51953125);
stage = 0x2; room_nm = 0; camera_nm = 10;
break;
case 2: // 有楼梯的城市一角
p1.setPos(-9874.8447265625,0,3555.011962890625);
stage = 1; room_nm = 0x18; camera_nm = 0;
break;
case 3: // 图书馆 ROOM1120.RDT
p1.setPos(-15589.3955078125,0,-26244.947265625);
stage = 1; room_nm = 0x12, camera_nm = 6;
break;
case 4: // 下水道1
p1.setPos(-7114.603515625,0,-3748.042724609375);
stage = 3; room_nm = 0x7, camera_nm = 3;
break;
case 5: // 火炬谜题房间 ROOM20d0.RDT, 椭圆碰撞反馈优化
p1.setPos(-24400.1015625,0,-10989.9453125);
stage = 2; room_nm = 0xd, camera_nm = 7;
break;
case 6: // 下水道, 脚本死循环 ROOM4020.RDT
p1.setPos(-16256.4697265625,0,-25555.30078125);
stage = 4; room_nm = 0x2; camera_nm = 0;
break;
case 7: // 监狱, 大量对话和过场剧情 ROOM3010.RDT
p1.setPos(-25099.73046875,0,-15760);
stage = 3; room_nm = 0x1; camera_nm = 0;
break;
case 8: // 卡车门口
p1.setPos(-6806,0,-16363);
stage = 1; room_nm = 0x19; camera_nm = 0;
break;
}
}
function begin_level() {
// 游戏参数初始化
// 难度
set_bitarr(0, 0x19, EASY);
// 角色类型
set_bitarr(1, 0x00, play_mode);
// 二周目 0:A, 1:B
set_bitarr(1, 0x01, ab);
// 游戏模式 0:Leon/Claire, 1:Hunk/Tofu, or vice versa
set_bitarr(1, 0x06, 0);
// TODO: 加载玩家角色模型, pld 的部分动作来自 plw.
let liv = Liv.fromEmd(play_mode, 0x50);
// let liv = Liv.fromPld(play_mode);
p1 = Ai.player(liv, window, draw_order, gameState, camera);
set_weapon(p1, liv, 7);
window.add(Tool.EnemyCollision(p1, enemy));
// 玩家初始位置
init_pos(0);
liv.moveImmediately();
while (window.notClosed()) {
p1.able_to_control(false);
goto_next_door = false;
load_map();
load_bgm();
switch_camera();
script_context = map_data.room_script.createContext(gameState, 0);
p1.able_to_control(true);
// vm.gc();
// TODO: 这里是补丁, 房间脚本应该不会退出?
while (!goto_next_door && window.notClosed()) {
window.nextFrame();
for (let i=0; i<100; ++i) {
// 单步执行
// while (!window.input().isKeyPress(gl.GLFW_KEY_Z)) {
// window.nextFrame();
// console.line("press z to continue.");
// }
if (script_context.frame(window.usedTime()) == 1) {
break;
}
}
}
}
}
function next_frame() {
return window.nextFrame();
}
function get_bitarr(arr, num) {
let a = ck_flag[arr];
if (!a) return 0;
return a[num] || 0;
}
function set_bitarr(arr, num, v) {
let a = ck_flag[arr];
if (!a) a = ck_flag[arr] = [];
a[num] = v;
}
function setGameVar(i, v) {
game_var[i] = v;
}
function getGameVar(i) {
return game_var[i] || 0;
}
function reverse(a, n) {
let v = this.get_bitarr(a, n);
this.set_bitarr(a, n, v == 0 ? 1 : 0);
}
function addEnemy(zb) {
if (get_bitarr(6, zb.killed_id))
return;
let ai_cons;
switch (zb.model) {
case 72: // 枪店老版
ai_cons = Ai.Npc;
break;
default:
ai_cons = Ai.zombie;
break;
}
let mod = Liv.fromEmd(play_mode, zb.model);
let se = Sound.enemySE(zb.sound_bank);
let ai = ai_cons(mod, window, draw_order, gameState, se, zb);
scenes_garbage.push(ai, se);
ai.setPos(zb.x, zb.y, zb.z);
ai.setDirection(zb.dir);
ai.initAiState(zb.state);
mod.moveImmediately();
enemy[zb.id] = ai;
}
// 进入后触发一次, 直到离开后再次进入触发
function LeaveTrigger(obj, callback) {
let td = false;
obj.act = function() {
if (td) return;
td = true;
Tool.debug('!!!!!!!!!!!!!!!!!!!! LeaveTrigger +++', obj)
callback();
};
obj.leave = function() {
td = false;
};
}
// 只触发一次
function OnceTrigger(obj, callback) {
obj.act = function() {
for (let i=0; i<touch.length; ++i) {
if (touch[i] == obj) {
touch.splice(i, 1);
break;
}
}
Tool.debug('!!!!!!!!!!!!!!!!!!!! OnceTrigger', obj)
callback();
};
}
function createTriggerType(obj, cb) {
const sat = obj.sat;
// 由谁触发
let _player = sat & 1;
let _enemy = sat & (1<<1);
let _splayer = sat & (1<<2);
let _obj = sat & (1<<3);
// 如何触发
let _manual = sat & (1<<4);
let _front = sat & (1<<5);
let _under = sat & (1<<6);
let _uk = sat & (1<<7);
if (_player) {
if (_manual) {
obj.act = cb;
survey.push(obj);
} else if (_under || _front) {
OnceTrigger(obj, cb);
touch.push(obj);
}
} else {
console.warn("Unsupport trigger "+ Tool.b2(sat));
}
}
//
// 设置一个对象, 必须有 x1-4, y1-4 属性
//
function aot_set(npo) {
const type = isNaN(npo.type) ? npo.sce : npo.type;
switch (type) {
case 3: // NORMAL 设置事件触发器
Tool.debug("触发器");
// createTrigger(npo);
break;
case 2: // item
Tool.debug("物品");
setItem(npo);
break;
case 11: // 燃烧的火, 走进后被灼伤
Tool.debug("伤害");
break;
case 0: // auto?
Tool.debug("自动?");
// createAuto(npo, '自动?');
break;
case 5: // event?
Tool.debug("事件");
createTriggerType(npo, function() {
script_context.callSub(npo.d3);
});
break;
case 1: // door
Tool.debug("门"); break;
case 4: // message
Tool.debug("信息"); break;
case 6: // flag_chg
Tool.debug("flag_chg"); break;
case 7: // water
Tool.debug("水/玻璃?"); break;
case 8: // move,
Tool.debug("移动?"); break;
case 9: // save
Tool.debug("存档"); break;
case 0xA: // itembox
Tool.debug("道具箱"); break;
case 0xC: // status
Tool.debug("状态"); break;
case 0xD: // HIKIDASHI
Tool.debug("抽屉"); break;
case 0xE: // windows
Tool.debug("窗"); break;
default:
throw new Error("unknow aot", type);
}
object_arr[npo.id] = npo;
// scenes_garbage.push(Tool.showRange(npo, window));
}
function setDoor(d) {
let range = Tool.xywh2range(d);
survey.push(range);
object_arr[d.id] = d;
range.act = function opendoor() {
// TODO: 检查门锁 locked 和对应的钥匙 key, lock 无法打开.
p1.able_to_control(false);
p1.setPos(d.next_x, d.next_y, d.next_z);
p1.setDirection(d.next_dir);
stage = d.stage + 1;
room_nm = d.room;
camera_nm = d.camera;
goto_next_door = true;
};
_DEBUG && _test_bind_key_sw_room(d.id, range.act);
// scenes_garbage.push(Tool.showRange(range, window));
}
function setItem(item) {
// TODO: 忽略拾起的物品, 显示物品, 绑定触发事件
set_bitarr(8, item.array08_idx, 1);
switch (item.itemid) {
case 0x07:
Tool.debug('色带');
break;
case 0x14:
Tool.debug('子弹包');
break;
}
}
function calc(op, a, b) {
switch (op) {
case 0x0: return a + b;
case 0x1: return a - b;
case 0x2: return a * b;
case 0x3: return a / b;
case 0x4: return a % b;
case 0x5: return a | b;
case 0x6: return a & b;
case 0x7: return a ^ b;
case 0x8: return ~a;
case 0x9: return a << b;
case 0xA: return a >> b;
case 0xB: return a >>= b;
default: throw new Error("bad op "+ op);
}
}
function _test_switch_camera() {
// ']' switch to next camera
window.input().pressOnce(gl.GLFW_KEY_RIGHT_BRACKET, function() {
if (lock_camera) {
console.log("Camera Locked !");
return;
}
camera_nm++;
if (camera_nm >= map_data.cameras.length) camera_nm = 0;
try {
switch_camera();
console.line("cam", camera_nm);
} catch(e) {
camera_nm = -1;
}
});
// 'Pause' Lock / unlock camera
window.input().pressOnce(gl.GLFW_KEY_PAUSE, ()=>{
lock_camera = !lock_camera;
console.log(lock_camera ? "Lock camera" : "Unlock camera");
});
// '[' Load next map
window.input().pressOnce(gl.GLFW_KEY_LEFT_BRACKET, function() {
load_map(stage, room_nm+1);
switch_camera(0);
});
}
function _test_bind_key_sw_room(door_id, act) {
const ip = window.input();
const fn = function() {
ip.unbind(gl.GLFW_KEY_1 + door_id);
act();
};
ip.pressOnce(gl.GLFW_KEY_1 + door_id, null, fn);
scenes_garbage.push({
free() {
ip.unbind(gl.GLFW_KEY_1 + door_id);
}
});
}
function cut_chg(c) {
p1.able_to_control(false);
cut_stack.push(camera_nm);
camera_nm = c;
switch_camera();
}
function cut_restore() {
p1.able_to_control(true);
let c = cut_stack.pop();
if (c) {
camera_nm = c;
switch_camera();
}
}
function cut_auto(is_on) {
p1.able_to_control(is_on);
}
function get_game_object(type, id) {
switch (type) {
case 0x01: // player
Tool.debug("get player");
return p1;
case 0x02: // SPLAYER
Tool.debug("get splayer");
return enemy[255];
case 0x03: // ENEMY
Tool.debug("get enemy");
return enemy[id];
case 0x04: // OBJECT
Tool.debug("get object");
return object_arr[id];
case 0x05: // DOOR
Tool.debug("get door");
return object_arr[id];
case 0x06: // ALL?
Tool.debug("get all?");
return object_arr[id];
case 0x80: // PL_PARTS
Tool.debug("get pl_parts");
return object_arr[id];
case 0xA0: // SPL_PARTS
Tool.debug("get spl_parts");
return object_arr[id];
case 0xC0: // EM_PARTS
Tool.debug("get em_parts");
return object_arr[id];
case 0xE0: // OM_PARTS
Tool.debug("get om_parts");
return object_arr[id];
default:
throw new Error("invaild type "+ type);
}
}
function play_se(prog, tone) {
// TODO: 整对他
try {
let raw = map_data.vab.raw[ map_data.vab.prog[prog].tone[tone].vag ];
let se = Sound.mapSE(raw);
if (se) {
se.play();
scenes_garbage.push(se);
return se.length();
}
} catch(e) {
console.error(e);
}
Tool.debug("No play se!!", map_data.vab.prog.length, prog, tone);
return 0;
}
function play_voice(id, rl) {
let v = Sound.playVoice(play_mode, stage, id);
if (v) {
scenes_garbage.push(v);
return v.length();
}
return 0;
}
function show_message(d0, d1, d2) {
}
function set_weapon(ai, target, weaponid) {
const weapon = Liv.fromPlw(play_mode, weaponid);
const comp = new DrawArray();
Liv.createSprites(weapon.mesh, weapon.tex, comp.array);
const md = target.getMD();
md.setPoseFromMD(weapon, 10/* 覆盖动画 */);
md.combinationDraw(11/* 右手 */, comp);
ai.set_weapon(Item.getGun(weaponid));
}
//
// 把地图上的动画绑定给角色, 从 bindIdx 号开始覆盖
//
function bind_ex_anim(target, bindIdx) {
target.setPoseFromMD(map_data.extern_anim, bindIdx);
}
function garbage(x) {
scenes_garbage.push(x)
}
function _show_point(x, y) {
if (!_DEBUG) return;
let r = Tool.xywd2range({x, y, w:100, d:100});
let color = new Float32Array([0.5, 0.5, 1]);
garbage(Tool.showRange(r, window, color, -110));
console.log('Point', x, y);
}