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

Function DoPlayerFrameForOne

Descent3/Player.cpp:1793–1966  ·  view source on GitHub ↗

Does actions for the given player slot

Source from the content-addressed store, hash-verified

1791
1792// Does actions for the given player slot
1793void DoPlayerFrameForOne(int slot) {
1794 ASSERT(slot >= 0 && slot < MAX_PLAYERS);
1795 object *obj = &Objects[Players[slot].objnum];
1796 static int napalm_id = -1;
1797
1798 Players[slot].time_level = Gametime;
1799
1800 if (napalm_id == -1) {
1801 napalm_id = FindWeaponName("Napalm");
1802 }
1803
1804 // If piggy backing observer, then set position relative to observed object
1805 if (obj->type == OBJ_OBSERVER && Players[slot].piggy_objnum != -1) {
1806 object *observed = &Objects[Players[slot].piggy_objnum];
1807 ObjSetPos(obj, &observed->pos, observed->roomnum, &observed->orient, false);
1808
1809 obj->mtype.phys_info = observed->mtype.phys_info;
1810 }
1811
1812 if (obj->type == OBJ_PLAYER || obj->type == OBJ_OBSERVER && obj->id == Player_num) {
1813 // Do camera stuff if needed
1814 SetupPlayerCamera();
1815 }
1816
1817 if (Demo_flags != DF_PLAYBACK) {
1818 if ((Players[slot].flags & PLAYER_FLAGS_DYING) || (Players[slot].flags & PLAYER_FLAGS_DEAD))
1819 DoNewPlayerDeathFrame(slot);
1820 }
1821
1822 // do invulnerable stuff
1823 if (Players[slot].flags & PLAYER_FLAGS_INVULNERABLE) {
1824 Players[slot].invulnerable_time -= Frametime;
1825 if (Players[slot].invulnerable_time <= 0.0f) {
1826 // deinvulnerablize the player!!
1827 MakePlayerVulnerable(slot);
1828 }
1829 }
1830
1831 // Do terrain damage stuff
1832 if (Terrain_sky.damage_per_second > 0 && !(Players[slot].flags & (PLAYER_FLAGS_DYING | PLAYER_FLAGS_DEAD))) {
1833 if (OBJECT_OUTSIDE(obj)) {
1834 float scalar = GetTerrainDynamicScalar(&obj->pos, CELLNUM(obj->roomnum));
1835
1836 // White out the screen
1837 if (scalar > 0 && slot == Player_num) {
1838 float vals[4];
1839
1840 vals[0] = 1.0;
1841 vals[1] = 1.0;
1842 vals[2] = .8f;
1843 vals[3] = scalar / 4;
1844
1845 CreateNewEvent(RENDER_EVENT, 0, 0, &vals, sizeof(float) * 4, DrawAlphaEvent);
1846 }
1847
1848 if (scalar > .7) {
1849 SetNapalmDamageEffect(obj, NULL, napalm_id);
1850 obj->effect_info->damage_time = 1;

Callers 1

DoPlayerFrameFunction · 0.85

Calls 12

FindWeaponNameFunction · 0.85
ObjSetPosFunction · 0.85
SetupPlayerCameraFunction · 0.85
DoNewPlayerDeathFrameFunction · 0.85
MakePlayerVulnerableFunction · 0.85
GetTerrainDynamicScalarFunction · 0.85
CreateNewEventFunction · 0.85
SetNapalmDamageEffectFunction · 0.85
DoSprayEffectFunction · 0.85
FireOnOffWeaponFunction · 0.85
StopSoundImmediateMethod · 0.80
Play3dSoundMethod · 0.80

Tested by

no test coverage detected