1 // 2 // C++ Interface: WeaponDesc 3 // 4 // Description: weapon description 5 // 6 // 7 // Author: Albert Zeyer <ich@az2000.de>, (C) 2009 8 // 9 // code under LGPL 10 // 11 // 12 13 #ifndef __WEAPONDESC_H__ 14 #define __WEAPONDESC_H__ 15 16 #include <string> 17 #include <SDL.h> 18 #include "ProjAction.h" 19 #include "Color.h" 20 21 22 23 24 // Weapon classes 25 enum Wpn_Class { 26 WCL_AUTOMATIC = 0, 27 WCL_POWERGUN = 1, 28 WCL_GRENADE = 3, 29 WCL_MISSILE = 4, 30 WCL_CLOSERANGE = 5, 31 32 __WCL_LBOUND = INT_MIN, 33 __WCL_UBOUND = INT_MAX, 34 }; 35 36 static_assert(sizeof(Wpn_Class) == sizeof(int), "Wpn_Class__SizeCheck"); 37 38 // Weapon types 39 enum Wpn_Type { 40 WPN_PROJECTILE = 0, 41 WPN_SPECIAL = 1, 42 WPN_BEAM = 2, 43 44 __WPN_LBOUND = INT_MIN, 45 __WPN_UBOUND = INT_MAX 46 }; 47 48 static_assert(sizeof(Wpn_Type) == sizeof(int), "Wpn_Type__SizeCheck"); 49 50 51 // Special Weapons 52 enum Wpn_Special { 53 SPC_NONE = 0, 54 SPC_JETPACK = 1, 55 56 __SPC_LBOUND = INT_MIN, 57 __SPC_UBOUND = INT_MAX 58 }; 59 60 static_assert(sizeof(Wpn_Special) == sizeof(int), "Wpn_Special__SizeCheck"); 61 62 63 64 // Special structure 65 struct gs_special_t { 66 Uint32 Thrust; 67 }; 68 69 class CGameScript; 70 71 struct Wpn_Beam { Wpn_BeamWpn_Beam72 Wpn_Beam() : Damage(0), PlyDamage(0), Length(0), InitWidth(1), WidthIncrease(0.0f), DistributeDamageOverWidth(false) {} 73 74 Color Colour; 75 int Damage; 76 int PlyDamage; 77 int Length; 78 int InitWidth; // new since beta9 79 float WidthIncrease; // new since beta9 80 bool DistributeDamageOverWidth; // new since beta9 81 82 bool readFromIni(const IniReader& ini, const std::string& section); 83 bool read(CGameScript* gs, FILE* fp); 84 bool write(CGameScript* gs, FILE* fp); 85 }; 86 87 struct SoundSample; 88 89 // Weapon structure 90 struct weapon_t { weapon_tweapon_t91 weapon_t() : ID(0), smpSample(NULL) { 92 Proj.UseRandomRot = true; Proj.Useangle = true; Proj.AddParentVel = true; 93 FinalProj.UseRandomRot = true; FinalProj.Useangle = true; FinalProj.AddParentVel = true; 94 } 95 96 int ID; 97 std::string Name; // (was 64b before) 98 Wpn_Type Type; 99 Wpn_Special Special; 100 Wpn_Class Class; 101 int Recoil; 102 float Recharge; 103 float Drain; 104 float ROF; 105 bool UseSound; 106 std::string SndFilename; // (was 64b before) 107 bool LaserSight; 108 109 // Projectile 110 Proj_SpawnInfo Proj; 111 112 // when fire key got released 113 Proj_SpawnInfo FinalProj; 114 115 // Beam 116 Wpn_Beam Bm; 117 118 // Special 119 gs_special_t tSpecial; 120 121 SoundSample * smpSample; // Read-only var, managed by game script, no need in smartpointer 122 123 }; 124 125 126 127 #endif 128 129