MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / serializeInputs

Function serializeInputs

TheForceEngine/TFE_Input/replay.cpp:278–305  ·  view source on GitHub ↗

Serializes the input events into the demo file from vectors to strings

Source from the content-addressed store, hash-verified

276
277 // Serializes the input events into the demo file from vectors to strings
278 vector<s32> serializeInputs(Stream* stream, vector<s32> inputList, bool writeFlag)
279 {
280 s32 keySize = 0;
281 string keyString;
282
283 // The Vector would consist of the key codes for the input events
284 // Or it will contain the mouse positions along with yaw/pitch/roll
285
286 if (writeFlag)
287 {
288 keyString = convertToString(inputList);
289 keySize = (s32)keyString.size();
290 }
291
292 SERIALIZE(ReplayVersionInit, keySize, 0);
293 if (!writeFlag)
294 {
295 keyString.resize(keySize);
296 }
297
298 SERIALIZE_BUF(ReplayVersionInit, &keyString[0], keySize);
299
300 if (!writeFlag && keySize > 0)
301 {
302 return convertFromString(keyString);
303 }
304 return inputList;
305 }
306
307 void storePDAPosition(Vec2i pos)
308 {

Callers 1

serializeDemoFunction · 0.85

Calls 4

convertToStringFunction · 0.85
convertFromStringFunction · 0.85
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected