Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
AmmoManager.cpp
Package: 3dexplorerTest.rar [view]
Upload User: hkb425
Upload Date: 2007-06-16
Package Size: 34191k
Code Size: 2k
Category:
Game Engine
Development Platform:
Visual C++
- // AmmoManager.cpp: implementation of the CAmmoManager class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "AmmoManager.h"
- #include "texture.h"
- #include "math.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CAmmoManager::CAmmoManager()
- {
- }
- CAmmoManager::~CAmmoManager()
- {
- }
- bool CAmmoManager::InitAmmoManager()
- {
- CTexture cTexture;
- if(!cTexture.MakeAlphaTextureBind("texture/smoke.bmp", &texid))return false;
- return true;
- }
- void CAmmoManager::LaunchRocket(VERTEX startPos,float rotx,float roty )
- {
- NORMAL direction;
- direction.nx=-cosf(rotx*0.0174533f)*sinf(roty*0.0174533f);
- direction.ny=-sinf(rotx*0.0174533f);
- direction.nz=-cosf(rotx*0.0174533f)*cosf(roty*0.0174533f);
- LaunchRocket(startPos,rotx,roty ,direction);
- }
- void CAmmoManager::LaunchRocket(VERTEX startPos,float rotx,float roty ,NORMAL normal)
- {
- int index=0;
- bool bSuccess=false;
- while(index<MAXROCKET && (!bSuccess))
- {
- if(m_rocketList[index].m_life==0)
- {
- m_rocketList[index].InitRocket(startPos,rotx,roty,normal,texid);
- bSuccess=true;
- }
- index++;
- }
- }
- void CAmmoManager::UpdateAmmoManager()
- {
- for(int i=0;i<MAXROCKET;i++)
- {
- if(m_rocketList[i].m_life>0) //flying
- {
- m_rocketList[i].UpdateRocket();
- m_rocketList[i].DrawRocket();
- }
- }
- }
- void CAmmoManager::DrawAmmoManager()
- {
- m_rifle.DrawRifleShot();
- }
- //////////////////////////////////////////
- ////////////////////////////////////////
- /////////////////////////////////////////////
- void CAmmoManager::RifleFire(VERTEX startPos,float rotx,float roty )
- {
- NORMAL direction;
- direction.nx=-cosf(rotx*0.0174533f)*sinf(roty*0.0174533f);
- direction.ny=-sinf(rotx*0.0174533f);
- direction.nz=-cosf(rotx*0.0174533f)*cosf(roty*0.0174533f);
- m_rifle.LunchBullet(1,startPos,rotx,roty , direction);
- }