1 /* 2 * Copyright 2011-2012 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 ARKANE Studios SA. All rights reserved 46 47 #ifndef ARX_SCENE_OBJECTFORMAT_H 48 #define ARX_SCENE_OBJECTFORMAT_H 49 50 #include "graphics/GraphicsFormat.h" 51 #include "platform/Platform.h" 52 53 54 #pragma pack(push,1) 55 56 57 const u32 CURRENT_THEO_VERSION = 3011; 58 const u32 CURRENT_SCENE_VERSION = 3024; 59 const u32 CURRENT_THEA_VERSION = 2015; 60 61 #define SAVE_MAP_IN_OBJECT 0 62 #define SAVE_MAP_BMP 1 63 #define SAVE_MAP_TGA 2 64 65 const size_t SIZE_NAME = 256; 66 const size_t SIZE_IDENTITY_OBJECT = 17; 67 68 // Magic conversion constant used for loading rotations in TEO files. 69 const float THEO_ROTCONVERT = 0.087890625f; 70 71 typedef s32 TBOOL; 72 73 struct ArxQuat { 74 75 f32 w; 76 f32 x; 77 f32 y; 78 f32 z; 79 EERIE_QUATArxQuat80 inline operator EERIE_QUAT() const { 81 EERIE_QUAT a; 82 a.x = x, a.y = y, a.z = z, a.w = w; 83 return a; 84 } 85 86 inline ArxQuat & operator=(const EERIE_QUAT & b) { 87 x = b.x, y = b.y, z = b.z, w = b.w; 88 return *this; 89 } 90 91 }; 92 93 struct TheoAngle { 94 s32 alpha; 95 s32 beta; 96 s32 gamma; 97 }; 98 99 100 // THEO SCN FILE FORMAT structures 101 102 struct TSCN_HEADER { 103 u32 version; 104 s32 maps_seek; 105 s32 object_seek; 106 s32 anim_seek; 107 s32 path_seek; 108 s32 cam_seek; 109 s32 light_seek; 110 s32 particle_seek; 111 s32 groups_seek; // Added version 3007; 112 s32 nb_maps; 113 u32 type_write; 114 }; 115 116 struct TSCN_OBJHEADER { 117 s32 next_obj; 118 char object_name[SIZE_NAME]; 119 TBOOL object_state; 120 TBOOL object_state_module; 121 TBOOL object_freeze; 122 TBOOL object_selected; 123 }; 124 125 const u32 LIGHT_DIRECTIONAL = 0; 126 const u32 LIGHT_OMNI = 1; 127 const u32 LIGHT_OMNI_SHADOW = 2; 128 const u32 LIGHT_SPOT = 3; 129 const u32 LIGHT_SPOT_SHADOW = 4; 130 131 struct TSCN_LIGHT { 132 char light_name[SIZE_NAME]; 133 TBOOL light_state; 134 u32 light_type; 135 SavedVec3 pos; 136 s32 red; 137 s32 green; 138 s32 blue; 139 f32 falloff; 140 f32 hotspot; 141 SavedVec3 spot_target; 142 f32 intensity; 143 f32 saturation; 144 f32 radiosity; 145 TBOOL shadow; 146 f32 factor_size; 147 s32 hallow_nummap; 148 f32 hallow_ray; 149 f32 hallow_zmarge; 150 }; 151 152 struct TSCN_LIGHT_3019 { 153 char light_name[SIZE_NAME]; 154 TBOOL light_state; 155 TBOOL light_selected; 156 u32 light_type; 157 SavedVec3 pos; 158 s32 red; 159 s32 green; 160 s32 blue; 161 f32 falloff; 162 f32 hotspot; 163 SavedVec3 spot_target; 164 f32 intensity; 165 f32 saturation; 166 f32 radiosity; 167 TBOOL shadow; 168 f32 factor_size; 169 s32 hallow_nummap; 170 f32 hallow_ray; 171 f32 hallow_zmarge; 172 }; 173 174 struct TSCN_LIGHT_3024 { 175 char light_name[SIZE_NAME]; 176 TBOOL light_state; 177 TBOOL light_selected; 178 TBOOL light_Freeze; 179 u32 light_type; 180 SavedVec3 pos; 181 s32 red; 182 s32 green; 183 s32 blue; 184 f32 falloff; 185 f32 hotspot; 186 SavedVec3 spot_target; 187 f32 intensity; 188 f32 saturation; 189 f32 radiosity; 190 TBOOL shadow; 191 f32 factor_size; 192 s32 hallow_nummap; 193 f32 hallow_ray; 194 f32 hallow_zmarge; 195 }; 196 197 198 // THEO TEO FILE FORMAT structures 199 200 struct THEO_HEADER { 201 char identity[SIZE_IDENTITY_OBJECT]; 202 u32 version; 203 s32 maps_seek; 204 s32 object_seek; 205 s32 nb_maps; 206 u32 type_write; 207 }; 208 209 struct THEO_TEXTURE { 210 char texture_name[SIZE_NAME]; 211 s32 dx; // texture width 212 s32 dy; // texture height 213 u32 bpp; // number of bits per pixel 214 u32 map_data; // dx*dy*sizeof(logtype) 215 u32 map_type; 216 s32 reflect_map; 217 f32 water_intensity; 218 s32 mipmap_level; 219 u32 color_mask; 220 TBOOL animated_map; 221 }; 222 223 struct THEO_SAVE_MAPS_IN { 224 char texture_name[SIZE_NAME]; 225 u32 map_type; 226 s32 reflect_map; 227 f32 water_intensity; 228 s32 mipmap_level; 229 TBOOL animated_map; 230 }; 231 232 struct THEO_SAVE_MAPS_IN_3019 { 233 char texture_name[SIZE_NAME]; 234 u32 map_type; 235 s32 reflect_map; 236 f32 water_intensity; 237 s32 mipmap_level; 238 u32 color_mask; 239 TBOOL animated_map; 240 }; 241 242 struct THEO_OFFSETS { 243 s32 vertex_seek; 244 s32 action_point_seek; 245 s32 lines_seek; 246 s32 faces_seek; 247 s32 extras_seek; 248 s32 groups_seek; 249 }; 250 251 struct THEO_NB { 252 s32 nb_vertex; 253 s32 nb_action_point; 254 s32 nb_lines; 255 s32 nb_faces; 256 s32 nb_groups; 257 u32 channel; 258 }; 259 260 struct THEO_VERTEX { 261 SavedVec3 pos; 262 TBOOL hide; 263 TBOOL freeze; 264 TBOOL isselected; 265 }; 266 267 struct THEO_ACTION_POINT { 268 char name[SIZE_NAME]; 269 s32 vert_index; 270 s32 action; 271 s32 num_sfx; 272 }; 273 274 struct THEO_FACE_UV { 275 s32 u1; 276 s32 v1; 277 s32 u2; 278 s32 v2; 279 s32 u3; 280 s32 v3; 281 }; 282 283 struct THEO_FACE_RGB { 284 s32 r; 285 s32 g; 286 s32 b; 287 }; 288 289 struct THEO_FACES { 290 u32 color; 291 s32 index1; 292 s32 index2; 293 s32 index3; 294 TBOOL ismap; 295 THEO_FACE_UV liste_uv; 296 s32 element_uv; 297 s32 num_map; 298 f32 tile_x; 299 f32 tile_y; 300 f32 user_tile_x; 301 f32 user_tile_y; 302 s32 flag; 303 s32 collision_type; 304 TBOOL rgb; // vertex 305 THEO_FACE_RGB rgb1; 306 THEO_FACE_RGB rgb2; 307 THEO_FACE_RGB rgb3; 308 TBOOL double_side; 309 u32 transparency; 310 f32 trans; 311 }; 312 313 struct THEO_FACES_3006 { 314 u32 color; 315 s32 index1; 316 s32 index2; 317 s32 index3; 318 TBOOL ismap; 319 THEO_FACE_UV liste_uv; 320 s32 element_uv; 321 s32 num_map; 322 f32 tile_x; 323 f32 tile_y; 324 f32 user_tile_x; 325 f32 user_tile_y; 326 s32 flag; 327 s32 collision_type; 328 TBOOL rgb; // vertex 329 THEO_FACE_RGB rgb1; 330 THEO_FACE_RGB rgb2; 331 THEO_FACE_RGB rgb3; 332 TBOOL double_side; 333 TBOOL hide; 334 TBOOL transparency; 335 f32 trans; 336 }; 337 338 struct THEO_EXTRA_DATA { 339 TheoAngle angle; 340 SavedVec3 pos; 341 s32 origin_index; 342 }; 343 344 struct THEO_EXTRA_DATA_3005 { 345 TheoAngle angle; 346 ArxQuat quat; 347 SavedVec3 pos; 348 s32 origin_index; 349 }; 350 351 enum TheoObjectType { 352 THEO_OBJECT_TYPE_3D = 0, 353 THEO_OBJECT_TYPE_SPRITE = 1 354 }; 355 356 enum TheoRenderType { 357 THEO_RENDER_TYPE_MAP = 0, 358 THEO_RENDER_TYPE_MAP_LIGHT = 1, 359 THEO_RENDER_TYPE_MAP_GOURAUD = 2, 360 THEO_RENDER_TYPE_SOLID = 3, 361 THEO_RENDER_TYPE_LIGHT = 4, 362 THEO_RENDER_TYPE_GOURAUD = 5, 363 THEO_RENDER_TYPE_WIRE = 6, 364 THEO_RENDER_TYPE_VERTEX = 7, 365 THEO_RENDER_TYPE_BBOX = 8, 366 THEO_RENDER_TYPE_PREDATOR = 9, 367 THEO_RENDER_TYPE_CHROME = 10 368 }; 369 370 struct THEO_GROUPS { 371 s32 origin; 372 s32 nb_index; 373 }; 374 375 struct THEO_GROUPS_3011 { 376 s32 origin; 377 s32 symetric; 378 TBOOL lock_alpha; 379 TBOOL lock_beta; 380 TBOOL lock_gamma; 381 TheoAngle min; 382 TheoAngle max; 383 s32 nb_index; 384 }; 385 386 struct THEO_SELECTED { 387 char name[SIZE_NAME]; 388 s32 nb_index; 389 }; 390 391 392 // THEO TEA Animation FILE FORMAT structures 393 394 const size_t THEO_SIZE_IDENTITY_ANIM = 20; 395 typedef s32 STBOOL; 396 397 struct THEA_HEADER { 398 char identity[THEO_SIZE_IDENTITY_ANIM]; 399 u32 version; 400 char anim_name[SIZE_NAME]; 401 s32 nb_frames; 402 s32 nb_groups; 403 s32 nb_key_frames; 404 }; 405 406 struct THEA_KEYFRAME { 407 s32 num_frame; 408 s32 flag_frame; 409 STBOOL master_key_frame; 410 STBOOL key_frame; 411 STBOOL key_move; 412 STBOOL key_orient; 413 STBOOL key_morph; 414 s32 time_frame; 415 }; 416 417 struct THEA_KEYFRAME_2015 { 418 s32 num_frame; 419 s32 flag_frame; 420 char info_frame[SIZE_NAME]; 421 STBOOL master_key_frame; 422 STBOOL key_frame; 423 STBOOL key_move; 424 STBOOL key_orient; 425 STBOOL key_morph; 426 s32 time_frame; 427 }; 428 429 typedef SavedVec3 THEA_KEYMOVE; 430 431 struct THEO_GROUPANIM { 432 TBOOL key_group; 433 char angle[8]; // ignored 434 ArxQuat Quaternion; 435 SavedVec3 translate; 436 SavedVec3 zoom; 437 }; 438 439 struct THEA_SAMPLE { 440 char sample_name[SIZE_NAME]; 441 s32 sample_size; 442 }; 443 444 445 #pragma pack(pop) 446 447 448 #endif // ARX_SCENE_OBJECTFORMAT_H 449