diff --git a/src/common/ecs/README.md b/src/common/ecs/README.md index 73db0182..7dc1c759 100644 --- a/src/common/ecs/README.md +++ b/src/common/ecs/README.md @@ -143,6 +143,7 @@ banks need to duplicate code and/or rodata - don't split critical code across banks need bank trampoline macro nested scopes for game modes? (title / demo / play) +access parent data from child scope critical data fields if accessed in critical section, make critical @@ -150,4 +151,8 @@ ignore arrays that aren't referenced use DASM for multipass? -default values for component fields +processes +take up at least one byte if stateful +might need free list +need jump table? +you'd like to change "mode" from any event diff --git a/src/common/ecs/compiler.ts b/src/common/ecs/compiler.ts index 8ca73c01..45957533 100644 --- a/src/common/ecs/compiler.ts +++ b/src/common/ecs/compiler.ts @@ -139,7 +139,12 @@ export class ECSCompiler extends Tokenizer { let lo = this.expectInteger(); this.expectToken('..'); let hi = this.expectInteger(); - return { dtype: 'int', lo, hi } as IntType; + // TODO: use default value? + let defvalue; + if (this.ifToken('default')) { + defvalue = this.expectInteger(); + } + return { dtype: 'int', lo, hi, defvalue } as IntType; } if (this.peekToken().str == '[') { return { dtype: 'ref', query: this.parseQuery() } as RefType; @@ -392,8 +397,7 @@ export class ECSCompiler extends Tokenizer { entname = this.expectIdent().str; } let etype = this.parseEntityArchetype(); - let entity = this.currentScope.newEntity(etype); - entity.name = entname; + let entity = this.currentScope.newEntity(etype, entname); let cmd2: string; // TODO: remove init? while ((cmd2 = this.expectTokens(['const', 'init', 'var', 'decode', 'end']).str) != 'end') { diff --git a/src/common/ecs/decoder.ts b/src/common/ecs/decoder.ts index 7b2e91e0..51f5beb2 100644 --- a/src/common/ecs/decoder.ts +++ b/src/common/ecs/decoder.ts @@ -73,6 +73,24 @@ export class VCSSpriteDecoder extends LineDecoder { } } +export class VCSBitmapDecoder extends LineDecoder { + parse() { + let height = this.lines.length; + let bitmapdata = new Uint8Array(height); + for (let i=0; i