MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MultiDoGuidedInfo

Function MultiDoGuidedInfo

Descent3/multi.cpp:5447–5495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5445}
5446
5447void MultiDoGuidedInfo(uint8_t *data) {
5448 int count = 0;
5449
5450 // Skip header stuff
5451 SKIP_HEADER(data, &count);
5452
5453 uint8_t slot = MultiGetByte(data, &count);
5454 uint8_t release = MultiGetByte(data, &count);
5455
5456 if (Players[slot].guided_obj == NULL)
5457 return;
5458
5459 object *obj = Players[slot].guided_obj;
5460
5461 vector pos;
5462 matrix orient;
5463 uint16_t short_roomnum;
5464 int roomnum;
5465
5466 MultiExtractPositionData(&pos, data, &count);
5467
5468 // Get orientation
5469 uint16_t p = MultiGetShort(data, &count);
5470 uint16_t h = MultiGetShort(data, &count);
5471 uint16_t b = MultiGetShort(data, &count);
5472
5473 vm_AnglesToMatrix(&orient, p, h, b);
5474
5475 // Get room and terrain flag
5476 short_roomnum = MultiGetUshort(data, &count);
5477 uint8_t terrain = MultiGetByte(data, &count);
5478
5479 roomnum = short_roomnum;
5480 if (terrain)
5481 roomnum = MAKE_ROOMNUM(roomnum);
5482
5483 // Get velocity
5484 vector vel;
5485 vel.x = ((float)MultiGetShort(data, &count)) / 128.0;
5486 vel.y = ((float)MultiGetShort(data, &count)) / 128.0;
5487 vel.z = ((float)MultiGetShort(data, &count)) / 128.0;
5488
5489 obj->mtype.phys_info.velocity = vel;
5490
5491 ObjSetPos(obj, &pos, roomnum, &orient, false);
5492
5493 if (release)
5494 ReleaseGuidedMissile(slot);
5495}
5496
5497// Stuff info for a guided missile
5498int MultiStuffGuidedInfo(int slot, uint8_t *data) {

Callers 1

MultiProcessDataFunction · 0.85

Calls 8

SKIP_HEADERFunction · 0.85
MultiGetByteFunction · 0.85
MultiExtractPositionDataFunction · 0.85
MultiGetShortFunction · 0.85
MultiGetUshortFunction · 0.85
ObjSetPosFunction · 0.85
ReleaseGuidedMissileFunction · 0.85
vm_AnglesToMatrixFunction · 0.50

Tested by

no test coverage detected