//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## //** ## ## ######## ## ## ## ## ## ## ## ### ## //** ### ## ## ### ## ## ## ## ## ## //** # ## ## # #### #### ## ## //** //** $Id: PolyobjRotator.vc 1703 2006-09-07 23:04:54Z dj_jl $ //** //** Copyright (C) 1999-2006 Jānis Legzdiņš //** //** This program is free software; you can redistribute it and/or //** modify it under the terms of the GNU General Public License //** as published by the Free Software Foundation; either version 2 //** of the License, or (at your option) any later version. //** //** This program is distributed in the hope that it will be useful, //** but WITHOUT ANY WARRANTY; without even the implied warranty of //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //** GNU General Public License for more details. //** //************************************************************************** class PolyobjRotator:PolyobjThinker; int polyobj; float dist; float speed; //========================================================================== // // Tick // //========================================================================== void Tick(float deltaTime) { float move; float absMove; polyobj_t *poly; move = speed * deltaTime; absMove = fabs(move); if (dist >= 0.0 && dist < absMove) { move = dist * (speed < 0.0 ? -1.0 : 1.0); } if (XLevel.RotatePolyobj(polyobj, move)) { if (dist < 0.0) { // perpetual polyobj return; } dist -= absMove; if (dist <= 0.0) { poly = XLevel.GetPolyobj(polyobj); if (poly->SpecialData == self) { poly->SpecialData = none; } PolyobjStopSequence(poly); Destroy(); return; } } } defaultproperties { }