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

Function DemoReadWeaponFire

Descent3/demofile.cpp:943–1098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

941}
942
943void DemoReadWeaponFire() {
944 vector pos, dir;
945 float gametime;
946 uint32_t uniqueid;
947 object *obj;
948 int16_t weaponnum, objnum, weapobjnum;
949 vector laser_pos, laser_dir;
950
951 // Mass driver is hack
952 static int mass_driver_id = -2;
953 static int mass_driver_ring = -2;
954 static int omega_id = -2;
955 static int vauss_id = -2;
956 static int napalm_id = -2;
957
958 if (mass_driver_id == -2) {
959 mass_driver_id = FindWeaponName("Mass Driver");
960 ASSERT(mass_driver_id != -1); // DAJ -1FIX
961 mass_driver_ring = FindTextureName("CloakRing.tga1");
962 ASSERT(mass_driver_ring != -1); // DAJ -1FIX
963 omega_id = FindWeaponName("Omega");
964 ASSERT(omega_id != -1); // DAJ -1FIX
965 vauss_id = FindWeaponName("Vauss");
966 ASSERT(vauss_id != -1); // DAJ -1FIX
967 napalm_id = FindWeaponName("Napalm");
968 ASSERT(napalm_id != -1); // DAJ -1FIX
969 }
970
971 gametime = cf_ReadFloat(Demo_cfp);
972 int16_t old_objnum = cf_ReadShort(Demo_cfp);
973 objnum = Demo_obj_map[old_objnum];
974 obj = &Objects[objnum];
975 ASSERT(Objects[objnum].type != OBJ_NONE);
976
977 uniqueid = cf_ReadInt(Demo_cfp);
978 gs_ReadVector(Demo_cfp, pos);
979 gs_ReadVector(Demo_cfp, dir);
980 laser_pos = pos;
981 laser_dir = dir;
982 weaponnum = MultiMatchWeapon(uniqueid);
983 weapobjnum = cf_ReadShort(Demo_cfp);
984 int16_t gunnum = cf_ReadShort(Demo_cfp);
985 ASSERT(uniqueid != 0xffffffff);
986 ASSERT(dir != Zero_vector);
987
988 // This is a hack for the napalm, omega & vauss to prevent making files incompatible
989 if ((obj->type == OBJ_PLAYER) && (obj->id != Player_num)) {
990 if (omega_id == weaponnum) {
991 Players[obj->id].weapon[PW_PRIMARY].index = OMEGA_INDEX;
992 } else if (vauss_id == weaponnum) {
993 Players[obj->id].weapon[PW_PRIMARY].index = VAUSS_INDEX;
994 } else if (napalm_id == weaponnum) {
995 Players[obj->id].weapon[PW_PRIMARY].index = NAPALM_INDEX;
996 }
997 }
998
999 uint16_t new_weap_objnum = CreateAndFireWeapon(&pos, &dir, &Objects[objnum], weaponnum);
1000 if (0xffff == new_weap_objnum) {

Callers 1

DemoFrameFunction · 0.85

Calls 12

FindWeaponNameFunction · 0.85
FindTextureNameFunction · 0.85
cf_ReadFloatFunction · 0.85
cf_ReadShortFunction · 0.85
cf_ReadIntFunction · 0.85
MultiMatchWeaponFunction · 0.85
CreateAndFireWeaponFunction · 0.85
VisEffectCreateFunction · 0.85
fvi_FindIntersectionFunction · 0.85
GR_RGB16Function · 0.85
Play3dSoundMethod · 0.80
vm_VectorDistanceQuickFunction · 0.50

Tested by

no test coverage detected