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

Function VisEffectMoveOne

Descent3/viseffect.cpp:2025–2178  ·  view source on GitHub ↗

Moves

Source from the content-addressed store, hash-verified

2023
2024// Moves
2025void VisEffectMoveOne(vis_effect *vis) {
2026 if (vis->flags & VF_USES_LIFELEFT)
2027 vis->lifeleft -= Frametime; //...inevitable countdown towards death
2028
2029 // Chris, do your stuff here
2030 if (vis->movement_type == MT_PHYSICS)
2031 do_vis_physics_sim(vis);
2032
2033 if (vis->flags & VF_USES_LIFELEFT) {
2034 if (vis->lifeleft < 0)
2035 VisEffectSetDeadFlag(vis);
2036 }
2037
2038 if (vis->id == SNOWFLAKE_INDEX) {
2039 Weather.snowflakes_to_create++;
2040
2041 vis->pos += vis->velocity * Frametime;
2042
2043 if (vis->pos.y < 1)
2044 VisEffectSetDeadFlag(vis);
2045 }
2046
2047 // Do attached viseffect stuff here
2048 if (vis->flags & VF_ATTACHED) {
2049 int objnum = vis->attach_info.obj_handle & HANDLE_OBJNUM_MASK;
2050 uint32_t sig = vis->attach_info.obj_handle & HANDLE_COUNT_MASK;
2051 object *obj = &Objects[objnum];
2052
2053 if ((obj->flags & OF_DEAD) || (obj->handle & HANDLE_COUNT_MASK) != sig) {
2054 // The object we're attached to doesn't exist anymore
2055 VisEffectSetDeadFlag(vis);
2056
2057 } else if (obj->type == OBJ_PLAYER && (Players[obj->id].flags & (PLAYER_FLAGS_DYING | PLAYER_FLAGS_DEAD))) {
2058 // The object we're attached to doesn't exist anymore
2059 VisEffectSetDeadFlag(vis);
2060 } else {
2061 if (vis->id == THICK_LIGHTNING_INDEX) {
2062 if (vis->flags & VF_PLANAR) {
2063 // Do object to object attachment
2064 int dest_objnum = vis->attach_info.dest_objhandle & HANDLE_OBJNUM_MASK;
2065 uint32_t dest_sig = vis->attach_info.dest_objhandle & HANDLE_COUNT_MASK;
2066 object *dest_obj = &Objects[dest_objnum];
2067
2068 if ((dest_obj->flags & OF_DEAD) || (dest_obj->handle & HANDLE_COUNT_MASK) != dest_sig) {
2069 // The object we're attached to doesn't exist anymore
2070 VisEffectSetDeadFlag(vis);
2071 return;
2072 }
2073
2074 if (dest_obj->type == OBJ_PLAYER &&
2075 (Players[dest_obj->id].flags & (PLAYER_FLAGS_DYING | PLAYER_FLAGS_DEAD))) {
2076 VisEffectSetDeadFlag(vis);
2077 return;
2078 }
2079
2080 vis->pos = obj->pos;
2081 vis->end_pos = dest_obj->pos;
2082

Callers 1

VisEffectMoveAllFunction · 0.85

Calls 14

do_vis_physics_simFunction · 0.85
VisEffectSetDeadFlagFunction · 0.85
WeaponCalcGunFunction · 0.85
SetNormalizedTimeObjFunction · 0.85
SetModelAnglesFunction · 0.85
SetModelInterpPosFunction · 0.85
GetPolyModelPointInWorldFunction · 0.85
VisEffectRelinkFunction · 0.85
GR_16_TO_COLORFunction · 0.85
GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85

Tested by

no test coverage detected