mdx-m3-viewer
Version:
A browser WebGL model viewer. Mainly focused on models of the games Warcraft 3 and Starcraft 2.
31 lines (26 loc) • 810 B
text/typescript
import BinaryStream from '../../../common/binarystream';
import { byteLengthUtf8 } from '../../../common/utf8';
/**
* A map title.
*/
export default class MapTitle {
visible: number = 0;
chapterTitle: string = '';
mapTitle: string = '';
path: string = '';
load(stream: BinaryStream) {
this.visible = stream.readInt32();
this.chapterTitle = stream.readNull();
this.mapTitle = stream.readNull();
this.path = stream.readNull();
}
save(stream: BinaryStream) {
stream.writeInt32(this.visible);
stream.writeNull(this.chapterTitle);
stream.writeNull(this.mapTitle);
stream.writeNull(this.path);
}
getByteLength() {
return 7 + byteLengthUtf8(this.chapterTitle) + byteLengthUtf8(this.mapTitle) + byteLengthUtf8(this.path);
}
}