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

Function LGSPlayers

Descent3/loadstate.cpp:779–815  ·  view source on GitHub ↗

players

Source from the content-addressed store, hash-verified

777
778// players
779int LGSPlayers(CFILE *fp) {
780 player *plr = &Players[0];
781 int16_t size;
782
783 // must do this if we read player struct as whole.
784 plr->inventory.Reset(false, INVRESET_ALL);
785 plr->counter_measures.Reset(false, INVRESET_ALL);
786
787 gs_ReadShort(fp, size);
788 if (size != sizeof(player)) {
789 Int3();
790 return LGS_OUTDATEDVER;
791 } else {
792 int guided_handle;
793 cf_ReadBytes((uint8_t *)plr, sizeof(player), fp);
794 if (plr->guided_obj) {
795 gs_ReadInt(fp, guided_handle);
796 plr->guided_obj = &Objects[guided_handle & HANDLE_OBJNUM_MASK];
797 }
798 // save inventory and countermeasures
799 // must do this if we read player struct as whole.
800 plr->inventory.ReadInventory(fp);
801 plr->counter_measures.ReadInventory(fp);
802 }
803
804 int ship_index = Players[Player_num].ship_index;
805
806 if (ship_index < 0)
807 ship_index = 0;
808
809 FreeCockpit();
810 CloseShipHUD();
811 InitShipHUD(ship_index);
812 InitCockpit(ship_index);
813
814 return LGS_OK;
815}
816
817extern int Physics_NumLinked;
818extern int PhysicsLinkList[MAX_OBJECTS];

Callers 2

LoadGameStateFunction · 0.85
DemoReadHeaderFunction · 0.85

Calls 7

cf_ReadBytesFunction · 0.85
FreeCockpitFunction · 0.85
CloseShipHUDFunction · 0.85
InitShipHUDFunction · 0.85
InitCockpitFunction · 0.85
ReadInventoryMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected