@wwawing/engine 3.13.0-acorn-statement.based-on.3.12.3 → 3.13.0-acorn-statement.based-on.3.12.3.p.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,6 +53,11 @@ export interface BlockStatement extends Node {
53
53
  type: "BlockStatement";
54
54
  body: Node[];
55
55
  }
56
+ export interface FunctionDeclaration extends Node {
57
+ type: "FunctionDeclaration";
58
+ body: BlockStatement;
59
+ id: Identifier;
60
+ }
56
61
  export interface ForStatement extends Node {
57
62
  type: "ForStatement";
58
63
  body: BlockStatement;
@@ -62,4 +67,14 @@ export interface ForStatement extends Node {
62
67
  }
63
68
  export interface UpdateExpression extends Node {
64
69
  type: "UpdateExpression";
70
+ operator: string;
71
+ argument: Node;
72
+ }
73
+ export interface BreakStatement extends Node {
74
+ label: string;
75
+ type: "BreakExpression";
76
+ }
77
+ export interface ContinueStatement extends Node {
78
+ label: string;
79
+ type: "ContinueExpression";
65
80
  }
@@ -1,4 +1,4 @@
1
1
  import * as Acorn from "./acorn";
2
2
  import * as Wwa from "./wwa";
3
- export declare function convertNodeAcornToWwaArray(node: Acorn.Node): Wwa.Node[];
4
- export declare function convertNodeAcornToWwa(node: Acorn.Node): Wwa.Node;
3
+ export declare function convertNodeAcornToWwaArray(node: Acorn.Node): Wwa.WWANode[];
4
+ export declare function convertNodeAcornToWwa(node: Acorn.Node): Wwa.WWANode;
@@ -8,9 +8,16 @@ export declare class EvalCalcWwaNode {
8
8
  k: number;
9
9
  loopCount: number;
10
10
  };
11
+ break_flag: boolean;
12
+ continue_flag: boolean;
13
+ loop_limit: number;
11
14
  constructor(wwa: WWA);
12
- evalWwaNodes(nodes: Wwa.Node[]): any[];
13
- evalWwaNode(node: Wwa.Node): any;
15
+ evalWwaNodes(nodes: Wwa.WWANode[]): any[];
16
+ evalWwaNode(node: Wwa.WWANode): any;
17
+ callDefinedFunction(node: Wwa.CallDefinedFunction): void;
18
+ updateExpression(node: Wwa.UpdateExpression): void;
19
+ contunueStatment(node: Wwa.Continue): void;
20
+ breakStatement(node: Wwa.Break): void;
14
21
  forStateMent(node: Wwa.ForStatement): void;
15
22
  evalAnyFunction(node: Wwa.AnyFunction): void;
16
23
  partsAssignment(node: Wwa.PartsAssignment): void;
@@ -20,12 +27,12 @@ export declare class EvalCalcWwaNode {
20
27
  evalMessage(node: Wwa.Msg): number;
21
28
  evalJumpgate(node: Wwa.Jumpgate): void;
22
29
  evalRandom(node: Wwa.Random): any;
23
- evalSetSpecialParameter(node: Wwa.SpecialParameterAssignment): any;
30
+ evalSetSpecialParameter(node: Wwa.SpecialParameterAssignment): number;
24
31
  evalSetUserVariable(node: Wwa.UserVariableAssignment): number;
25
32
  evalUnaryOperation(node: Wwa.UnaryOperation): any;
26
33
  evalBinaryOperation(node: Wwa.BinaryOperation): any;
27
34
  evalSymbol(node: Wwa.Symbol): number;
28
35
  evalArray1D(node: Wwa.Array1D): number;
29
- evalArray2D(node: Wwa.Array2D): void;
36
+ evalArray2D(node: Wwa.Array2D): number;
30
37
  evalNumber(node: Wwa.Number): number;
31
38
  }
@@ -1,5 +1,5 @@
1
1
  export declare type Calcurable = Array1D | Array2D | Number | Symbol | UnaryOperation | BinaryOperation;
2
- export declare function isCalcurable(node: Node): node is Calcurable;
2
+ export declare function isCalcurable(node: WWANode): node is Calcurable;
3
3
  export interface PartsAssignment {
4
4
  type: "PartsAssignment";
5
5
  partsKind: "map" | "object";
@@ -20,7 +20,7 @@ export interface UserVariableAssignment {
20
20
  }
21
21
  export interface SpecialParameterAssignment {
22
22
  type: "SpecialParameterAssignment";
23
- kind: "X" | "Y" | "PX" | "PY" | "HP" | "HPMAX" | "AT" | "DF" | "GD" | "STEP" | "TIME" | "PRID" | "i" | "j" | "k";
23
+ kind: "X" | "Y" | "PX" | "PY" | "HP" | "HPMAX" | "AT" | "DF" | "GD" | "STEP" | "TIME" | "PRID" | "i" | "j" | "k" | "LOOPLIMIT";
24
24
  value: Calcurable;
25
25
  }
26
26
  export interface UnaryOperation {
@@ -36,7 +36,7 @@ export interface BinaryOperation {
36
36
  }
37
37
  export interface Symbol {
38
38
  type: "Symbol";
39
- name: "ITEM" | "m" | "o" | "v" | "X" | "Y" | "PX" | "PY" | "HP" | "HPMAX" | "AT" | "DF" | "GD" | "STEP" | "TIME" | "PRID" | "i" | "j" | "k";
39
+ name: "ITEM" | "m" | "o" | "v" | "X" | "Y" | "PX" | "PY" | "HP" | "HPMAX" | "AT" | "DF" | "GD" | "STEP" | "TIME" | "PRID" | "i" | "j" | "k" | "LOOPLIMIT";
40
40
  }
41
41
  export interface Array1D {
42
42
  type: "Array1D";
@@ -55,37 +55,59 @@ export interface Number {
55
55
  }
56
56
  export interface Random {
57
57
  type: "Random";
58
- value: Node;
58
+ value: WWANode;
59
59
  }
60
60
  export interface Jumpgate {
61
61
  type: "Jumpgate";
62
- x: Node;
63
- y: Node;
62
+ x: WWANode;
63
+ y: WWANode;
64
64
  }
65
65
  export interface Msg {
66
66
  type: "Msg";
67
- value: Node;
67
+ value: WWANode;
68
68
  }
69
69
  export interface IfStatement {
70
70
  type: "IfStatement";
71
- consequent: Node;
72
- test: Node;
73
- alternate?: Node;
71
+ consequent: WWANode;
72
+ test: WWANode;
73
+ alternate?: WWANode;
74
74
  }
75
75
  export interface BlockStatement {
76
76
  type: "BlockStatement";
77
- value: Node[];
77
+ value: WWANode[];
78
78
  }
79
79
  export interface ForStatement {
80
80
  type: "ForStatement";
81
- body: Node[];
82
- init: Node;
83
- test: Node;
84
- update: Node;
81
+ body: WWANode[];
82
+ init: WWANode;
83
+ test: WWANode;
84
+ update: WWANode;
85
85
  }
86
86
  export interface AnyFunction {
87
87
  type: "AnyFunction";
88
88
  functionName: string;
89
- value: Node[];
89
+ value: WWANode[];
90
90
  }
91
- export declare type Node = PartsAssignment | ItemAssignment | UserVariableAssignment | SpecialParameterAssignment | UnaryOperation | BinaryOperation | Array1D | Array2D | Number | Symbol | Random | Jumpgate | Msg | IfStatement | BlockStatement | ForStatement | AnyFunction;
91
+ export interface DefinedFunction {
92
+ type: "DefinedFunction";
93
+ functionName: string;
94
+ body: WWANode;
95
+ }
96
+ export interface CallDefinedFunction {
97
+ type: "CallDefinedFunction";
98
+ functionName: string;
99
+ }
100
+ export interface Break {
101
+ type: "Break";
102
+ label: string;
103
+ }
104
+ export interface Continue {
105
+ type: "Continue";
106
+ label: string;
107
+ }
108
+ export interface UpdateExpression {
109
+ type: "UpdateExpression";
110
+ operator: string;
111
+ argument: WWANode;
112
+ }
113
+ export declare type WWANode = PartsAssignment | ItemAssignment | UserVariableAssignment | SpecialParameterAssignment | UnaryOperation | BinaryOperation | Array1D | Array2D | Number | Symbol | Random | Jumpgate | Msg | IfStatement | BlockStatement | AnyFunction | DefinedFunction | CallDefinedFunction | ForStatement | AnyFunction | Break | Continue | UpdateExpression;
package/lib/wwa_main.d.ts CHANGED
@@ -4,6 +4,7 @@ import { ItemMenu } from "./wwa_item_menu";
4
4
  import { WWACompress } from "./wwa_save";
5
5
  import { IEventEmitter } from "@wwawing/event-emitter";
6
6
  import * as ExpressionParser from "./wwa_expression";
7
+ import { WWANode } from "./wwa_expression2/wwa";
7
8
  export declare function getProgress(current: number, total: number, stage: LoadStage): LoaderProgress;
8
9
  interface PartsAppearance {
9
10
  pos: Coord;
@@ -97,7 +98,15 @@ export declare class WWA {
97
98
  private soundLoadedCheckTimer;
98
99
  private _startTime;
99
100
  private _dumpElement;
101
+ private evalCalcWwaNode;
102
+ private userDefinedFunctions;
100
103
  constructor(mapFileName: string, urlgateEnabled: boolean, titleImgName: string, classicModeEnabled: boolean, itemEffectEnabled: boolean, useGoToWWA: boolean, audioDirectory: string, disallowLoadOldSave: boolean, dumpElm: HTMLElement, userVarNamesFile: string | null, canDisplayUserVars: boolean, enableVirtualPad?: boolean, virtualpadControllerElm?: HTMLElement);
104
+ callJumpGateUserDefineFunction(): void;
105
+ callMoveUserDefineFunction(): void;
106
+ getUserScript(functionName: string): WWANode | null;
107
+ private setUsertScript;
108
+ private convertWwaNodes;
109
+ private setUserVarStatus;
101
110
  private convertUserVariableNameListToArray;
102
111
  private _setProgressBar;
103
112
  private _setLoadingMessage;
@@ -180,6 +189,7 @@ export declare class WWA {
180
189
  reserveJumpInNextFrame(position: Position): void;
181
190
  appearPartsByDirection(distance: number, targetPartsID: number, targetPartsType: PartsType): void;
182
191
  appearPartsEval(triggerPartsPos: Coord, xstr: string, ystr: string, targetPartsID: number, targetPartsType: PartsType): void;
192
+ getPartsID(triggerPartsPos: Coord, targetPartsType: PartsType): number;
183
193
  private _replaceRandomObject;
184
194
  private _replaceRandomObjectsInScreen;
185
195
  private _replaceAllRandomObjects;
@@ -308,7 +318,7 @@ export declare class WWA {
308
318
  private compareUserVar;
309
319
  setPlayerSpeedIndex(speedIndex: number): void;
310
320
  setUserVarPlayTime(num: number): void;
311
- private setNowPlayTime;
321
+ setNowPlayTime(): void;
312
322
  hideStatus(no: number, isHide: boolean): void;
313
323
  varMap(triggerPartsPos: Coord, xstr: string, ystr: string, partsID: number, targetPartsType: PartsType): void;
314
324
  setItemboxBackgroundPosition(pos: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wwawing/engine",
3
- "version": "3.13.0-acorn-statement.based-on.3.12.3",
3
+ "version": "3.13.0-acorn-statement.based-on.3.12.3.p.1",
4
4
  "description": "World Wide Adventure: an RPG Engine.",
5
5
  "main": "./lib/wwa.js",
6
6
  "files": [
@@ -45,14 +45,14 @@
45
45
  "@types/pug": "^2.0.6",
46
46
  "@types/terser-webpack-plugin": "^5.2.0",
47
47
  "@types/webpack": "^5.28.0",
48
- "@wwawing/assets": "^3.13.0-acorn-statement.based-on.3.12.3",
49
- "@wwawing/common-interface": "^3.13.0-acorn-statement.based-on.3.12.3",
50
- "@wwawing/debug-server": "^3.13.0-acorn-statement.based-on.3.12.3",
51
- "@wwawing/event-emitter": "^3.13.0-acorn-statement.based-on.3.12.3",
52
- "@wwawing/loader": "^3.13.0-acorn-statement.based-on.3.12.3",
53
- "@wwawing/page-generator": "^3.13.0-acorn-statement.based-on.3.12.3",
54
- "@wwawing/styles": "^3.13.0-acorn-statement.based-on.3.12.3",
55
- "@wwawing/virtual-pad": "^3.13.0-acorn-statement.based-on.3.12.3",
48
+ "@wwawing/assets": "^3.13.0-acorn-statement.based-on.3.12.3.p.1",
49
+ "@wwawing/common-interface": "^3.13.0-acorn-statement.based-on.3.12.3.p.1",
50
+ "@wwawing/debug-server": "^3.13.0-acorn-statement.based-on.3.12.3.p.1",
51
+ "@wwawing/event-emitter": "^3.13.0-acorn-statement.based-on.3.12.3.p.1",
52
+ "@wwawing/loader": "^3.13.0-acorn-statement.based-on.3.12.3.p.1",
53
+ "@wwawing/page-generator": "^3.13.0-acorn-statement.based-on.3.12.3.p.1",
54
+ "@wwawing/styles": "^3.13.0-acorn-statement.based-on.3.12.3.p.1",
55
+ "@wwawing/virtual-pad": "^3.13.0-acorn-statement.based-on.3.12.3.p.1",
56
56
  "crypto-js": "^4.1.1",
57
57
  "npm-run-all": "^4.1.5",
58
58
  "pug": "^3.0.2",
@@ -72,5 +72,5 @@
72
72
  "node": ">=18",
73
73
  "npm": ">=8"
74
74
  },
75
- "gitHead": "a8dbb1c0df7146aefad367e72b3a82bf1e6f2ce6"
75
+ "gitHead": "a7b399b462819dba505b28c8427dc4ec7989b174"
76
76
  }