1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 09:04:13 +02:00

move handlers for each packet to their own file

This commit is contained in:
Robin Appelman 2015-04-01 20:56:04 +02:00
commit 9d5e599f89
13 changed files with 431 additions and 392 deletions

View file

@ -0,0 +1,29 @@
module.exports = function (stream, events) { // 30: gameEventList
// list of game events and parameters
var numEvents = stream.readBits(9);
var length = stream.readBits(20);
for (var i = 0; i < numEvents; i++) {
var id = stream.readBits(9);
var name = stream.readASCIIString();
var type = stream.readBits(3);
var entries = [];
while (type !== 0) {
var entryName = stream.readASCIIString();
entries.push({
type: type,
name: entryName
});
type = stream.readBits(3);
}
events[id] = {
id : id,
name : name,
type : type,
entries: entries
};
}
return {
packetType: 'gameEventList',
events : events
}
};