forked from riperiperi/mkjs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglobal.d.ts
196 lines (167 loc) · 5.24 KB
/
global.d.ts
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
import * as glMatrix from "gl-matrix";
import { IngameRes } from "./src/engine/ingameRes";
import { Item } from "./src/entities/item";
import { Kart } from "./src/entities/kart";
import { kcl_plane, kcl } from "./src/formats/kcl";
import { ndsFS } from "./src/formats/ndsFS";
import { nkm_section_OBJI, nkm, nkm_section_POIT } from "./src/formats/nkm";
import { nsbca } from "./src/formats/nsbca";
import { nsbmd } from "./src/formats/nsbmd";
import { nsbta } from "./src/formats/nsbta";
import { nsbtp } from "./src/formats/nsbtp";
import { nsbtx } from "./src/formats/nsbtx";
import { nitromodel_BoundingCollisionModel_dat, nitroModel } from "./src/render/nitroModel";
declare global {
type CustomAudioBufferSourceNode = {
noteOn: (when?: number, offset?: number, duration?: number) => void,
donezo: boolean,
} & AudioBufferSourceNode
type CustomWebGLRenderingContext = {
viewportWidth: number,
viewportHeight: number
} & WebGLRenderingContext;
type CustomWebGLTexture = {
width: number,
height: number,
realWidth?: number,
realHeight?: number
} & WebGLTexture;
interface Window {
debugParticle: boolean
VTX_PARTICLE: {
posArray: Float32Array,
vPos: WebGLBuffer,
vTx: WebGLBuffer,
vCol: WebGLBuffer,
vMat: WebGLBuffer,
vNorm: WebGLBuffer,
verts: number,
mode: GLenum,
}
}
const gl: CustomWebGLRenderingContext;
const gameROM: ndsFS;
const simpleMatStack: {
dat: mat4,
built: boolean
};
type lscraycast = {
plane: any;
t: number;
normal: vec3;
object: lsc_taget;
colPoint: vec3;
}
type lscsweepellipse = {
t: number,
plane: any
colPoint: vec3,
normal: vec3,
pNormal: any,
embedded: boolean,
object: lsc_taget
}
interface lsc_taget {
collidable: boolean;
vel?: vec3;
getCollision(): {
mat: mat4;
frame?: number;
tris: nitromodel_BoundingCollisionModel_dat;
}
moveWith?(obj: Kart | Item): void;
}
type other = nsbmd | nsbtx | nsbca | nsbta | nsbtp
type ProvidedRes = { mdl: nitroModel[], other: other[] }
const mat4: typeof glMatrix.mat4;
const mat3: typeof glMatrix.mat3;
const vec3: typeof glMatrix.vec3;
const vec2: typeof glMatrix.vec2;
const vec4: typeof glMatrix.vec4;
type mat4 = glMatrix.mat4;
type mat3 = glMatrix.mat3;
type vec3 = glMatrix.vec3;
type vec2 = glMatrix.vec2;
type vec4 = glMatrix.vec4;
interface CamView {
p: mat4;
mv: mat4;
pos: vec3;
}
type MKJSDataInput = ArrayBufferLike & { BYTES_PER_ELEMENT?: never; }
abstract class MKJSDataFormator {
abstract load(input: MKJSDataInput): void;
}
interface SceneEntity {
transparent: boolean
draw(view: mat4, pMatrix: mat4, gl: CustomWebGLRenderingContext): void
update(scn: Scene): void;
sndUpdate?(view: mat4): void;
}
class SceneEntityObject {
collidable: boolean;
pos: vec3;
constructor(obji: nkm_section_OBJI, scene: Scene);
draw(view: mat4, pMatrix: mat4, gl?: CustomWebGLRenderingContext): void
update(scn: Scene): void;
sndUpdate?(view: mat4): void;
requireRes(): { mdl: { nsbmd: string; nsbtx?: string }[]; other?: string[] }
provideRes(r: ProvidedRes): void;
moveWith?(obj: Item): void;
}
class KartItemEntity {
canBeHeld: boolean;
canBeDropped: boolean;
isDestructive: boolean;
isSolid: boolean;
constructor(item: any, scene: Scene, type: string);
update(scene: Scene): void;
release?(forward: number): void;
onDie?(final: boolean): void;
collide?(item: Item | Kart): void;
collideKart?(k: Kart): void;
colResponse?(pos: vec3, pvel: vec3, dat: lscraycast, ignoreList: kcl_plane[]): void;
draw?(mvMatrix: mat4, pMatrix: mat4): void;
onRest?(normal: vec3): void;
}
interface Camera {
targetShadowPos:vec3;
view: CamView;
getView(scene: Scene, width: number, height: number): CamView
}
interface SceneParticule {
}
interface Scene {
camera: Camera;
gameRes: IngameRes;
karts: Kart[];
removeEntity(obj: SceneEntity): void;
removeParticle(obj: SceneParticule): void;
nkm: nkm;
paths: nkm_section_POIT[][];
items: {
createItem(t: string, o: Kart): Item,
removeItem(i: Item): void;
items: Item[]
},
particles: any[];
kcl: kcl;
}
interface InputData {
accel: boolean;
decel: boolean;
drift: boolean;
item: boolean;
turn: number; //-1 to 1, intensity
airTurn: number; //air excitebike turn, doesn't really have much function
}
const input: InputData;
class Controls {
constructor(nkm: nkm)
local: boolean;
setKart(k: Kart): void;
fetchInput(): InputData;
setRouteID?(i: number): void;
}
}
export { };