1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2006 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "PROImporter.h"
25 #include "EffectMgr.h"
26 #include "Interface.h"
28 PROImporter::PROImporter(void)
34 PROImporter::~PROImporter(void)
42 bool PROImporter::Open(DataStream
* stream
, bool autoFree
)
51 this->autoFree
= autoFree
;
53 str
->Read( Signature
, 8 );
54 if (strncmp( Signature
, "PRO V1.0", 8 ) == 0) {
57 printf( "[PROImporter]: This file is not a valid PRO File\n" );
64 Projectile
* PROImporter::GetProjectile(Projectile
*s
)
71 str
->ReadWord( &AreaExtension
);
72 str
->ReadWord( &s
->Speed
);
73 str
->ReadDword( &s
->SFlags
); //spark, ignore center, looping sound etc
74 str
->ReadResRef( s
->SoundRes1
);
75 str
->ReadResRef( s
->SoundRes2
);
76 str
->ReadResRef( s
->SoundRes3
);
77 str
->ReadDword( &s
->SparkColor
);//enabled by PSF_SPARK
78 str
->ReadDword( &s
->ExtFlags
) ; //gemrb extension flags
79 str
->ReadDword( &s
->StrRef
); //gemrb extension strref
80 str
->ReadDword( &s
->RGB
); //gemrb extension rgb pulse
81 str
->ReadWord( &s
->ColorSpeed
); //gemrb extension rgb speed
82 str
->ReadWord( &s
->Shake
); //gemrb extension screen shake
83 str
->Seek(196, GEM_CURRENT_POS
); //skipping unused (unknown) bytes
84 //we should stand at offset 0x100 now
85 str
->ReadDword( &s
->TFlags
); //other projectile flags
86 str
->ReadResRef( s
->BAMRes1
);
87 str
->ReadResRef( s
->BAMRes2
);
88 str
->Read( &s
->Seq1
,1 );
89 str
->Read( &s
->Seq2
,1 );
90 str
->ReadWord( &s
->LightZ
);
91 str
->ReadWord( &s
->LightX
);
92 str
->ReadWord( &s
->LightY
);
93 str
->ReadResRef( s
->PaletteRes
);
94 str
->Read( s
->Gradients
, 7);
95 str
->Read( &s
->SmokeSpeed
, 1);
96 str
->Read( s
->SmokeGrad
, 7);
97 str
->Read( &s
->Aim
, 1);
98 str
->ReadWord( &s
->SmokeAnimID
);
99 str
->ReadResRef( s
->TrailBAM
[0] );
100 str
->ReadResRef( s
->TrailBAM
[1] );
101 str
->ReadResRef( s
->TrailBAM
[2] );
102 str
->ReadWord( &s
->TrailSpeed
[0] );
103 str
->ReadWord( &s
->TrailSpeed
[1] );
104 str
->ReadWord( &s
->TrailSpeed
[2] );
105 str
->Seek(172, GEM_CURRENT_POS
);
106 if (AreaExtension
!=3) {
110 GetAreaExtension(s
->Extension
);
114 void PROImporter::GetAreaExtension(ProjectileExtension
*e
)
118 str
->ReadDword( &e
->AFlags
);
119 str
->ReadWord( &e
->TriggerRadius
);
120 str
->ReadWord( &e
->ExplosionRadius
);
121 str
->ReadResRef( e
->SoundRes
); //explosion sound
122 str
->ReadWord( &e
->Delay
);
123 str
->ReadWord( &e
->FragAnimID
);
124 //this projectile index shouldn't be adjusted like the others!!!
125 str
->ReadWord( &e
->FragProjIdx
);
126 str
->Read( &e
->ExplosionCount
,1 );
127 //the area puff type (flames, puffs, clouds) fireball.ids
128 //gemrb uses areapro.2da for this
129 //It overrides Spread, VVCRes, Secondary, SoundRes, AreaSound, APFlags
130 str
->Read( &e
->ExplType
,1 );
131 str
->ReadWord( &e
->ExplColor
);
132 //this index is off by one in the .pro files, consolidating it here
133 str
->ReadWord( &tmp
);
137 e
->ExplProjIdx
= tmp
;
139 str
->ReadResRef( e
->VVCRes
);
140 str
->ReadWord( &tmp
);
141 //limit the cone width to 359 degrees (for full compatibility)
146 str
->ReadWord( &tmp
);
148 //These are GemRB specific, not used in the original engine
149 str
->ReadResRef( e
->Spread
);
150 str
->ReadResRef( e
->Secondary
);
151 str
->ReadResRef( e
->AreaSound
);
152 str
->ReadDword( &e
->APFlags
);
154 str
->Seek(188, GEM_CURRENT_POS
);
157 #include "plugindef.h"
159 GEMRB_PLUGIN(0xCAD2D64, "PRO File Importer")
160 PLUGIN_CLASS(IE_PRO_CLASS_ID
, PROImporter
)