Count chips in C2Ms on level start, not on parse (so editing updates the chip count)
This commit is contained in:
parent
56611958f7
commit
3020e3b038
@ -100,7 +100,9 @@ export class StoredLevel extends LevelInterface {
|
||||
this.author = '';
|
||||
this.password = null;
|
||||
this.hint = '';
|
||||
this.chips_required = 0;
|
||||
// A number is a specified count; the default of null means that the chips are counted on
|
||||
// level init, as in CC2
|
||||
this.chips_required = null;
|
||||
this.time_limit = 0;
|
||||
this.viewport_size = 9;
|
||||
this.extra_chunks = [];
|
||||
|
||||
@ -1241,9 +1241,6 @@ export function parse_level(buf, number = 1) {
|
||||
cell[type.layer] = {type};
|
||||
}
|
||||
|
||||
if (type.is_required_chip) {
|
||||
level.chips_required++;
|
||||
}
|
||||
if (type.is_hint) {
|
||||
// Remember all the hint tiles (in reading order) so we can map extra hints
|
||||
// to them later. Don't do it now, since the format doesn't technically
|
||||
|
||||
@ -177,6 +177,7 @@ function parse_level(bytes, number) {
|
||||
level.has_custom_connections = true;
|
||||
level.format = 'ccl';
|
||||
level.uses_ll_extensions = false;
|
||||
level.chips_required = 0;
|
||||
// Map size is always fixed as 32x32 in CC1
|
||||
level.size_x = 32;
|
||||
level.size_y = 32;
|
||||
|
||||
@ -482,7 +482,7 @@ export class Level extends LevelInterface {
|
||||
this.p1_input = 0;
|
||||
this.p1_released = 0xff;
|
||||
this.actors = [];
|
||||
this.chips_remaining = this.stored_level.chips_required;
|
||||
this.chips_remaining = this.stored_level.chips_required ?? 0;
|
||||
this.bonus_points = 0;
|
||||
this.aid = 0;
|
||||
|
||||
@ -566,6 +566,9 @@ export class Level extends LevelInterface {
|
||||
this.player = tile;
|
||||
}
|
||||
}
|
||||
if (tile.type.is_required_chip && this.stored_level.chips_required === null) {
|
||||
this.chips_remaining++;
|
||||
}
|
||||
if (tile.type.is_actor) {
|
||||
this.actors.push(tile);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user