⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debris.cpp

📁 After decades of war one company, who had gained powerful supplying both sides with weaponary, steps
💻 CPP
字号:
/*Copyright (C) 2003 Parallel RealitiesThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*/#include "debris.h"void addDebris(int x, int y, int amount){	if ((rand() % 2) == 0)		playSound(SFX_DEBRIS);	else		playSound(SFX_DEBRIS2);	object *debris;		amount = Math::rrand(3, rand() % amount);	Math::limitInt(&amount, 3, 8);	for (int i = 0 ; i < amount ; i++)	{		debris = new object;		debris->next = NULL;		debris->x = x;		debris->y = y;		debris->thinktime = Math::rrand(60, 180);		debris->dx = Math::rrand(-500, 500);		debris->dy = Math::rrand(-500, 500);		if (debris->dx != 0)			debris->dx /= 100;		if (debris->dy != 0)			debris->dy /= 100;		engine.debrisTail->next = debris;		engine.debrisTail = debris;	}}void doDebris(){	object *prevDebris = engine.debrisHead;	object *debris = engine.debrisHead;	engine.debrisTail = engine.debrisHead;	while (debris->next != NULL)	{		debris = debris->next;		if (debris->thinktime > 0)		{			debris->thinktime--;			debris->x += engine.ssx;			debris->y += engine.ssy;			debris->x += debris->dx;			debris->y += debris->dy;			addExplosion(debris->x + Math::rrand(-10, 10), debris->y + Math::rrand(-10, 10), E_BIG_EXPLOSION);		}		if (debris->thinktime < 1)		{			prevDebris->next = debris->next;			delete debris;			debris = prevDebris;		}		else		{			prevDebris = debris;			engine.debrisTail = debris;		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -