Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- transient MoveTracer moveTracer;
- override void Tick()
- {
- if (IsFrozen())
- return;
- if (bWindThrust)
- {
- int special = CurSector.special;
- switch (special)
- {
- // Wind_East
- case 40:
- case 41:
- case 42:
- Thrust(windTab[special-40], 0);
- break;
- // Wind_North
- case 43:
- case 44:
- case 45:
- Thrust(windTab[special-43], 90);
- break;
- // Wind_South
- case 46:
- case 47:
- case 48:
- Thrust(windTab[special-46], 270);
- break;
- // Wind_West
- case 49:
- case 50:
- case 51:
- Thrust(windTab[special-49], 180);
- break;
- }
- }
- bool bHitActor, bHitWall, bHitPlane, bHitWater;
- if (!moveTracer)
- {
- moveTracer = new("MoveTracer");
- moveTracer.master = self;
- }
- if (!(vel ~== (0, 0, 0))) {
- double velLen = vel.Length();
- Vector3 velDir = vel / velLen;
- if (moveTracer.Trace(pos, CurSector, velDir, velLen, TRACE_ReportPortals)) {
- bHitActor = moveTracer.bHitActor;
- bHitWall = moveTracer.bHitWall;
- bHitPlane = moveTracer.bHitPlane;
- bHitWater = moveTracer.bHitWater;
- SetOrigin(moveTracer.results.hitPos);
- } else {
- SetOrigin(level.Vec3Offset(pos, vel));
- }
- }
- if (moveTracer.bHitPortal)
- vel.xy = RotateVector(vel.xy, DeltaAngle(VectorAngle(vel.x, vel.y), moveTracer.results.srcAngleFromTarget));
- CheckPortalTransition();
- if (pos.z < floorz)
- SetZ(floorz);
- else if (pos.z+height > ceilingz)
- SetZ(ceilingz-height);
- if (!bNoGravity && pos.z > floorz)
- vel.z -= GetGravity();
- if (bMissile
- && (bHitWall || bHitActor || bHitPlane || bHitWater
- || pos.z <= floorz || pos.z+height >= ceilingz))
- {
- bMissile = false;
- vel = (0,0,0);
- if (bHitWater)
- bNoGravity = true;
- SetState(FindState("Death"));
- return;
- }
- if (!CheckNoDelay())
- return;
- if (tics > 0)
- --tics;
- while (!tics)
- {
- if (!SetState(CurState.NextState))
- return;
- }
- class MoveTracer : LineTracer
- {
- Actor master;
- bool bHitActor;
- bool bHitWall;
- bool bHitPlane;
- bool bHitWater;
- bool bHitPortal;
- override ETraceStatus TraceCallback()
- {
- if (results.crossedWater || results.crossed3DWater)
- {
- bHitWater = true;
- results.hitPos = results.crossedWater ? results.crossedWaterPos : results.crossed3DWaterPos;
- return TRACE_Stop;
- }
- switch (results.HitType)
- {
- case TRACE_CrossingPortal:
- bHitPortal = true;
- break;
- case TRACE_HitWall:
- if (results.ffloor
- && (!(results.ffloor.flags & F3DFloor.FF_EXISTS)
- || !(results.ffloor.flags & F3DFloor.FF_SOLID)))
- {
- results.ffloor = null;
- break;
- }
- if (results.tier == TIER_Middle
- && (results.hitLine.flags & Line.ML_TWOSIDED)
- && !(results.hitLine.flags & (Line.ML_BLOCKING|Line.ML_BLOCKEVERYTHING)))
- {
- break;
- }
- bHitWall = true;
- return TRACE_Stop;
- break;
- case TRACE_HitFloor:
- case TRACE_HitCeiling:
- if (results.ffloor
- && (results.ffloor.flags & F3DFloor.FF_EXISTS)
- && (results.ffloor.flags & F3DFloor.FF_SOLID))
- {
- bHitPlane = true;
- return TRACE_Stop;
- }
- results.ffloor = null;
- break;
- case TRACE_HitActor:
- if (results.hitActor != master && results.hitActor.bSolid)
- {
- bHitActor = true;
- return TRACE_Stop;
- }
- break;
- }
- return TRACE_Skip;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement