//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## //** ## ## ######## ## ## ## ## ## ## ## ### ## //** ### ## ## ### ## ## ## ## ## ## //** # ## ## # #### #### ## ## //** //** $Id: PolyobjMover.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 PolyobjMover:PolyobjThinker; int polyobj; float speed; float dist; float angle; //========================================================================== // // Tick // //========================================================================== void Tick(float deltaTime) { float move; float absMove; float xMove; float yMove; polyobj_t *poly; move = speed * deltaTime; absMove = fabs(move); if (dist < absMove) { move = dist * (move < 0.0 ? -1.0 : 1.0); } xMove = move * cos(angle); yMove = move * sin(angle); if (XLevel.MovePolyobj(polyobj, xMove, yMove)) { dist -= absMove; if (dist <= 0.0) { poly = XLevel.GetPolyobj(polyobj); if (poly->SpecialData == self) { poly->SpecialData = none; } PolyobjStopSequence(poly); Destroy(); return; } } } defaultproperties { }