remove object from the world
| 1829 | |
| 1830 | // remove object from the world |
| 1831 | void ObjDelete(int objnum) { |
| 1832 | object *obj = &Objects[objnum]; |
| 1833 | |
| 1834 | if (obj->type == OBJ_DUMMY) { |
| 1835 | // unghost the object before destroying it |
| 1836 | ObjUnGhostObject(objnum); |
| 1837 | } |
| 1838 | |
| 1839 | /* if ((Game_mode & GM_MULTI) && Netgame.local_role==LR_CLIENT && Objects[objnum].type==OBJ_POWERUP) |
| 1840 | { |
| 1841 | mprintf(0,"Deleting object number %d type=%d id=%d\n",objnum,obj->type,obj->id); |
| 1842 | }*/ |
| 1843 | |
| 1844 | if ((Game_mode & GM_MULTI) && (obj->flags & OF_SERVER_OBJECT)) { |
| 1845 | if (Netgame.local_role == LR_CLIENT && NetPlayers[Player_num].sequence > NETSEQ_OBJECTS && |
| 1846 | NetPlayers[Player_num].sequence != NETSEQ_LEVEL_END) { |
| 1847 | if (!(obj->flags & OF_SERVER_SAYS_DELETE)) { |
| 1848 | mprintf(0, "Illegally deleting server object! Objnum=%d type=%d id=%d\n", objnum, obj->type, obj->id); |
| 1849 | Int3(); |
| 1850 | return; |
| 1851 | } |
| 1852 | } |
| 1853 | } |
| 1854 | |
| 1855 | if (obj->flags & OF_POLYGON_OBJECT) { |
| 1856 | polyobj_info *p_info = &obj->rtype.pobj_info; |
| 1857 | if (p_info->multi_turret_info.keyframes != NULL) { |
| 1858 | mem_free(p_info->multi_turret_info.keyframes); |
| 1859 | mem_free(p_info->multi_turret_info.last_keyframes); |
| 1860 | |
| 1861 | p_info->multi_turret_info.keyframes = NULL; |
| 1862 | p_info->multi_turret_info.last_keyframes = NULL; |
| 1863 | } |
| 1864 | } |
| 1865 | |
| 1866 | ASSERT(objnum != -1); |
| 1867 | // ASSERT(objnum != 0 ); |
| 1868 | ASSERT(obj->type != OBJ_NONE); |
| 1869 | // ASSERT(obj != Player_object); |
| 1870 | |
| 1871 | //?? if (obj->type==OBJ_WEAPON && obj->id==GUIDEDMISS_ID) { |
| 1872 | //?? int pnum=Objects[obj->ctype.laser_info.parent_num].id; |
| 1873 | //?? mprintf(0,"Deleting a guided missile! Player %d\n\n",pnum); |
| 1874 | //?? |
| 1875 | //?? if (pnum!=Player_num) { |
| 1876 | //?? mprintf(0,"deleting missile that belongs to %d (%s)!\n",pnum,Players[pnum].callsign); |
| 1877 | //?? Guided_missile[pnum]=NULL; |
| 1878 | //?? } |
| 1879 | //?? else if (Newdemo_state==ND_STATE_RECORDING) |
| 1880 | //?? newdemo_record_guided_end(); |
| 1881 | //?? |
| 1882 | //?? } |
| 1883 | |
| 1884 | if (obj == Viewer_object) // deleting the viewer? |
| 1885 | Viewer_object = Player_object; //..make the player the viewer |
| 1886 | |
| 1887 | // Delete this chase camera if needed |
| 1888 | if (Player_camera_objnum == objnum) |
no test coverage detected