1 /* 2 * Copyright 2011-2013 Arx Libertatis Team (see the AUTHORS file) 3 * 4 * This file is part of Arx Libertatis. 5 * 6 * Arx Libertatis is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Arx Libertatis is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Arx Libertatis. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 /* Based on: 20 =========================================================================== 21 ARX FATALIS GPL Source Code 22 Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company. 23 24 This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code'). 25 26 Arx Fatalis Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public 27 License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 28 29 Arx Fatalis Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 30 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 31 32 You should have received a copy of the GNU General Public License along with Arx Fatalis Source Code. If not, see 33 <http://www.gnu.org/licenses/>. 34 35 In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these 36 additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx 37 Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below. 38 39 If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o 40 ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 41 =========================================================================== 42 */ 43 // Code: Cyril Meynier 44 // 45 // Copyright (c) 1999-2000 ARKANE Studios SA. All rights reserved 46 47 #ifndef ARX_AI_PATHS_H 48 #define ARX_AI_PATHS_H 49 50 #include <stddef.h> 51 #include <string> 52 53 #include "graphics/BaseGraphicsTypes.h" 54 #include "graphics/Color.h" 55 #include "io/resource/ResourcePath.h" 56 #include "math/MathFwd.h" 57 #include "math/Vector3.h" 58 #include "platform/Flags.h" 59 60 struct EERIE_CAMERA; 61 struct EERIE_3DOBJ; 62 class Entity; 63 class CRuban; 64 65 enum PathwayType { 66 PATHWAY_STANDARD = 0, 67 PATHWAY_BEZIER = 1, 68 PATHWAY_BEZIER_CONTROLPOINT = 2 69 }; 70 71 struct ARX_PATHWAY { 72 Vec3f rpos; //relative pos 73 PathwayType flag; 74 float _time; 75 }; 76 77 // ARX_PATH@flags values 78 enum PathFlag { 79 PATH_LOOP = (1<<0), 80 PATH_AMBIANCE = (1<<1), 81 PATH_RGB = (1<<2), 82 PATH_FARCLIP = (1<<3), 83 PATH_REVERB = (1<<4) 84 }; 85 DECLARE_FLAGS(PathFlag, PathFlags) 86 DECLARE_FLAGS_OPERATORS(PathFlags) 87 88 struct ARX_PATH { 89 90 ARX_PATH(const std::string & name, const Vec3f & pos); 91 92 std::string name; 93 PathFlags flags; 94 Vec3f initpos; 95 Vec3f pos; 96 long nb_pathways; 97 ARX_PATHWAY * pathways; 98 99 long height; // 0 NOT A ZONE 100 101 //! name of IO to be notified of other IOs interacting with the path 102 std::string controled; // TODO why store the name and not a pointer? 103 104 res::path ambiance; 105 106 Color3f rgb; 107 float farclip; 108 float reverb; // TODO unused 109 float amb_max_vol; 110 Vec3f bbmin; 111 Vec3f bbmax; 112 113 }; 114 115 enum UsePathFlag { 116 ARX_USEPATH_FLAG_FINISHED = (1<<0), 117 ARX_USEPATH_WORM_SPECIFIC = (1<<1), 118 ARX_USEPATH_FOLLOW_DIRECTION = (1<<2), 119 ARX_USEPATH_FORWARD = (1<<3), 120 ARX_USEPATH_BACKWARD = (1<<4), 121 ARX_USEPATH_PAUSE = (1<<5), 122 ARX_USEPATH_FLAG_ADDSTARTPOS = (1<<6) 123 }; 124 DECLARE_FLAGS(UsePathFlag, UsePathFlags) 125 DECLARE_FLAGS_OPERATORS(UsePathFlags) 126 127 struct ARX_USE_PATH { 128 ARX_PATH * path; 129 float _starttime; 130 float _curtime; 131 UsePathFlags aupflags; 132 Vec3f initpos; 133 long lastWP; 134 }; 135 136 struct MASTER_CAMERA_STRUCT { 137 long exist; // 2== want to change to want_vars... 138 Entity * io; 139 ARX_USE_PATH * aup; 140 EERIE_CAMERA * cam; 141 Entity * want_io; 142 ARX_USE_PATH * want_aup; 143 EERIE_CAMERA * want_cam; 144 }; 145 146 enum PathMod { 147 ARX_PATH_MOD_POSITION = (1<<0), 148 ARX_PATH_MOD_FLAGS = (1<<1), 149 ARX_PATH_MOD_TIME = (1<<2), 150 ARX_PATH_MOD_TRANSLATE = (1<<3), 151 ARX_PATH_HIERARCHY = (1<<4) 152 }; 153 DECLARE_FLAGS(PathMod, PathMods) 154 DECLARE_FLAGS_OPERATORS(PathMods) 155 156 extern MASTER_CAMERA_STRUCT MasterCamera; 157 extern ARX_USE_PATH USE_CINEMATICS_PATH; 158 extern ARX_PATH ** ARXpaths; 159 #ifdef BUILD_EDITOR 160 extern ARX_PATH * ARX_PATHS_FlyingOverAP; 161 extern ARX_PATH * ARX_PATHS_SelectedAP; 162 extern long ARX_PATHS_SelectedNum; 163 extern long ARX_PATHS_FlyingOverNum; 164 #endif 165 extern long USE_CINEMATICS_CAMERA; 166 extern long nbARXpaths; 167 168 void ARX_PATH_UpdateAllZoneInOutInside(); 169 long ARX_PATH_IsPosInZone(ARX_PATH * ap, float x, float y, float z); 170 void ARX_PATH_ClearAllUsePath(); 171 void ARX_PATH_ReleaseAllPath(); 172 ARX_PATH * ARX_PATH_GetAddressByName(const std::string & name); 173 void ARX_PATH_ClearAllControled(); 174 void ARX_PATH_ComputeAllBoundingBoxes(); 175 176 ARX_PATH * ARX_PATHS_ExistName(const std::string & name); 177 void ARX_PATHS_Delete(ARX_PATH * ap); 178 long ARX_PATHS_Interpolate(ARX_USE_PATH * aup, Vec3f * pos); 179 180 enum ThrownObjectFlag { 181 ATO_EXIST = (1<<0), 182 ATO_MOVING = (1<<1), 183 ATO_UNDERWATER = (1<<2), 184 ATO_FIERY = (1<<3) 185 }; 186 DECLARE_FLAGS(ThrownObjectFlag, ThrownObjectFlags) 187 DECLARE_FLAGS_OPERATORS(ThrownObjectFlags) 188 189 struct ARX_THROWN_OBJECT { 190 ThrownObjectFlags flags; 191 Vec3f vector; 192 Vec3f upvect; 193 EERIE_QUAT quat; 194 Vec3f initial_position; 195 float velocity; 196 Vec3f position; 197 float damages; 198 EERIE_3DOBJ * obj; 199 long source; 200 unsigned long creation_time; 201 float poisonous; 202 CRuban * pRuban; 203 }; 204 205 const size_t MAX_THROWN_OBJECTS = 100; 206 207 extern ARX_THROWN_OBJECT Thrown[MAX_THROWN_OBJECTS]; 208 extern long Thrown_Count; 209 210 class CRuban { 211 212 private: 213 214 short key; 215 int duration; 216 int currduration; 217 int iNumThrow; 218 219 struct T_RUBAN { 220 int actif; 221 Vec3f pos; 222 int next; 223 }; 224 T_RUBAN truban[2048]; 225 226 struct T_RUBAN_DEF { 227 int first; 228 int origin; 229 float size; 230 int dec; 231 float r, g, b; 232 float r2, g2, b2; 233 }; 234 235 int nbrubandef; 236 T_RUBAN_DEF trubandef[256]; 237 238 int GetFreeRuban(void); 239 void AddRuban(int * f, int dec); 240 void DrawRuban(int num, float size, int dec, float r, float g, float b, float r2, float g2, float b2); 241 242 public: 243 244 void AddRubanDef(int origin, float size, int dec, float r, float g, float b, float r2, float g2, float b2); 245 void Create(int numinteractive, int duration); 246 void Update(); 247 float Render(); 248 249 }; 250 251 long ARX_THROWN_OBJECT_GetFree(); 252 long ARX_THROWN_OBJECT_Throw(long source, Vec3f * position, Vec3f * vect, Vec3f * upvect, EERIE_QUAT * quat, float velocity, float damages, float poisonous); 253 void ARX_THROWN_OBJECT_KillAll(); 254 void ARX_THROWN_OBJECT_Manage(unsigned long time_offset); 255 void EERIE_PHYSICS_BOX_Launch_NOCOL(Entity * io, EERIE_3DOBJ * obj, Vec3f * pos, Vec3f * vect, long flags = 0, Anglef * angle = NULL); 256 257 long ARX_PHYSICS_BOX_ApplyModel(EERIE_3DOBJ * obj, float framediff, float rubber, long source); 258 259 #endif // ARX_AI_PATHS_H 260