// C Source File // Created 01/10/2007 09:16:38 PM // Star Blaster by Tyler Cassidy // Version 1.00 // Email: tyler@tylerc.org || altadogsledder89@yahoo.ca // 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. #include #include "include.h" /* Calculate Final Velocity from Initial Velocity & speed */ /* speed: 0 = reverse, 1 = drift, 2 = go, 3 = speed boost */ long velocityFinal(long vi, unsigned char speed) { long vf; switch(speed) { case 0: // Reverse vf = vi - ACEL_RATE; break; default: case 1: // Drift vf = vi - DECEL_RATE; break; case 2: // Go vf = vi + ACEL_RATE; break; case 3: // Speed Boost vf = vi + ACEL_SRATE; break; } return vf; } /* Calculate new X Coordinate from Velocity, angle and oldX */ long newDest_x(short angle, long velocity, long oldX) { return CosCalc(angle, (short)velocity) + oldX; } /* Calculate new Y Coordinate from Velocity, angle and oldY */ long newDest_y(short angle, long velocity, long oldY) { return SinCalc(angle, (short)velocity) + oldY; }