Aliens Vs Predator source code mod is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

avp_source_code_mod

Commit 94a6641b73026d662261604d7d192beae70b11dc

User picture
  • Commiter: dla
  • Author: dla
  • In branches: master
  • 2010-03-05 15:53 (about 4 years ago)

remote backup solution

Files Affected

 
4b825dc642cb6eb9a060e54bf8d69288fbee490494a6641b73026d662261604d7d192beae70b11dc
 
 
1
#include "animchnk.hpp"
 
 
2
#include "files.h"
 
 
3
#include <string.h>
 
 
4
 
 
 
5
RIF_IMPLEMENT_DYNCREATE("TEXTANIM", Animation_Chunk)
 
 
6
 
 
 
7
Animation_Chunk::Animation_Chunk(Chunk_With_Children* parent,const char* data, size_t ):Chunk(parent, "TEXTANIM")
 
 
8
{
 
 
9
    NumPolys = *((int*)data);
 
 
10
    data += 4;
 
 
11
 
 
 
12
    if(NumPolys)
 
 
13
    {
 
 
14
        AnimList = (TEXANIM**)malloc(NumPolys*sizeof(TEXANIM*));
 
 
15
 
 
 
16
        for(int i=0; i < NumPolys; i++)
 
 
17
        {
 
 
18
            AnimList[i] = new TEXANIM;
 
 
19
            TEXANIM* ta = AnimList[i];
 
 
20
            ta->poly = *((int*)data);
 
 
21
            data += 4;
 
 
22
            ta->ID = *((int*)data);
 
 
23
            data += 4;
 
 
24
            ta->NumSeq = *((int*)data);
 
 
25
            data += 4;
 
 
26
            ta->NumVerts = *((int*)data);
 
 
27
            data += 4;
 
 
28
            ta->AnimFlags = *((int*)data);
 
 
29
            data += 4;
 
 
30
            ta->Identifier = *((int*)data);
 
 
31
            data += 4;
 
 
32
            ta->CurSeq = 0;
 
 
33
            ta->Seq = new FrameList*[ta->NumSeq];
 
 
34
 
 
 
35
            for(int j=0; j < ta->NumSeq; j++)
 
 
36
            {
 
 
37
                ta->Seq[j] = new FrameList(ta);
 
 
38
                FrameList* fl = ta->Seq[j];
 
 
39
                fl->Speed = *((int*)data);
 
 
40
                data += 4;
 
 
41
                fl->Flags = *((int*)data);
 
 
42
                data += 4;
 
 
43
 
 
 
44
                fl->NumFrames = *((int*)data);
 
 
45
                data += 4;
 
 
46
                fl->spare1 = *((int*)data);
 
 
47
                data += 4;
 
 
48
                fl->spare2 = *((int*)data);
 
 
49
                data += 4;
 
 
50
                fl->CurFrame = 0;
 
 
51
 
 
 
52
                fl->Textures = new int[fl->NumFrames];
 
 
53
                fl->UVCoords = new int[(2*ta->NumVerts)*fl->NumFrames];
 
 
54
                for(int k=0; k < fl->NumFrames; k++)
 
 
55
                {
 
 
56
                    fl->Textures[k] = *((int*)data);
 
 
57
                    data += 4;
 
 
58
                }
 
 
59
 
 
 
60
                for(int k=0; k < (2*ta->NumVerts) * fl->NumFrames; k++)
 
 
61
                {
 
 
62
                    fl->UVCoords[k] = *((int*)data);
 
 
63
                    data += 4;
 
 
64
                }
 
 
65
            }
 
 
66
 
 
 
67
        }
 
 
68
    }
 
 
69
    else
 
 
70
        AnimList = 0;
 
 
71
}
 
 
72
 
 
 
73
Animation_Chunk::~Animation_Chunk()
 
 
74
{
 
 
75
    for(int i=0; i < NumPolys; i++)
 
 
76
        delete AnimList[i];
 
 
77
 
 
 
78
    free(AnimList);
 
 
79
}
 
 
80
 
 
 
81
size_t Animation_Chunk::size_chunk()
 
 
82
{
 
 
83
    chunk_size = 12 + 4;
 
 
84
 
 
 
85
    for(int i=0; i < NumPolys; i++)
 
 
86
    {
 
 
87
        chunk_size += 24;
 
 
88
        TEXANIM* ta = AnimList[i];
 
 
89
 
 
 
90
        for(int j=0; j < ta->NumSeq; j++)
 
 
91
        {
 
 
92
            chunk_size += 20;
 
 
93
            chunk_size += 4*(1+2*ta->NumVerts)*ta->Seq[j]->NumFrames;
 
 
94
        }
 
 
95
    }
 
 
96
 
 
 
97
return chunk_size;
 
 
98
}
 
 
99
 
 
 
100
void Animation_Chunk::fill_data_block(char* data_start)
 
 
101
{
 
 
102
    strncpy (data_start, identifier, 8);
 
 
103
 
 
 
104
    data_start += 8;
 
 
105
 
 
 
106
    *((int *) data_start) = chunk_size;
 
 
107
 
 
 
108
    data_start += 4;
 
 
109
 
 
 
110
    *(int*)data_start = NumPolys;
 
 
111
    data_start += 4;
 
 
112
 
 
 
113
    for(int i=0; i < NumPolys; i++)
 
 
114
    {
 
 
115
        TEXANIM* ta = AnimList[i];
 
 
116
        *(int*)data_start = ta->poly;        
 
 
117
        data_start += 4;
 
 
118
        *(int*)data_start = ta->ID;        
 
 
119
        data_start += 4;
 
 
120
        *(int*)data_start = ta->NumSeq;        
 
 
121
        data_start += 4;
 
 
122
        *(int*)data_start = ta->NumVerts;        
 
 
123
        data_start += 4;
 
 
124
        *(int*)data_start = ta->AnimFlags;        
 
 
125
        data_start += 4;
 
 
126
        *(int*)data_start = ta->Identifier;        
 
 
127
        data_start += 4;
 
 
128
 
 
 
129
        for(int j=0; j < ta->NumSeq; j++)
 
 
130
        {
 
 
131
            FrameList* fl = ta->Seq[j];
 
 
132
            *(int*)data_start = fl->Speed;        
 
 
133
            data_start += 4;
 
 
134
            *(int*)data_start = fl->Flags;        
 
 
135
            data_start += 4;
 
 
136
            *(int*)data_start = fl->NumFrames;        
 
 
137
            data_start += 4;
 
 
138
            *(int*)data_start = fl->spare1;        
 
 
139
            data_start += 4;
 
 
140
            *(int*)data_start = fl->spare2;        
 
 
141
            data_start += 4;
 
 
142
 
 
 
143
            for(int k=0; k < fl->NumFrames; k++)
 
 
144
            {
 
 
145
                *(int*)data_start = fl->Textures[k];        
 
 
146
                data_start += 4;
 
 
147
            }
 
 
148
 
 
 
149
            for(int k=0; k < (2*ta->NumVerts) * fl->NumFrames; k++)
 
 
150
            {
 
 
151
                *(int*)data_start = fl->UVCoords[k];
 
 
152
                data_start += 4;
 
 
153
            }
 
 
154
        }
 
 
155
    }
 
 
156
}
 
 
157
 
 
 
158
FrameList::FrameList(TEXANIM* p)
 
 
159
{
 
 
160
    Speed = 65536;
 
 
161
    Flags = 0;
 
 
162
    NumFrames = 0;
 
 
163
    CurFrame = -1;
 
 
164
    parent = p;
 
 
165
    Textures = 0;
 
 
166
    UVCoords = 0;
 
 
167
    spare1 = spare2 = 0;
 
 
168
}
 
 
169
 
 
 
170
FrameList::FrameList(TEXANIM* p,FrameList* fl,int* conv)
 
 
171
{
 
 
172
    Speed = fl->Speed;
 
 
173
    Flags = fl->Flags;
 
 
174
    NumFrames = fl->NumFrames;
 
 
175
    parent = p;
 
 
176
    Textures = new int[NumFrames];
 
 
177
    UVCoords = new int[NumFrames*2*p->NumVerts];
 
 
178
 
 
 
179
    spare1 = fl->spare1;
 
 
180
    spare2 = fl->spare2;
 
 
181
 
 
 
182
    if(conv)
 
 
183
    {
 
 
184
        for(int i=0; i < NumFrames; i++)
 
 
185
        {
 
 
186
            Textures[i]= conv[fl->Textures[i]];
 
 
187
        }
 
 
188
    }
 
 
189
    else
 
 
190
    {
 
 
191
        for(int i=0; i < NumFrames; i++)
 
 
192
        {
 
 
193
            Textures[i] = fl->Textures[i];
 
 
194
        }
 
 
195
    }
 
 
196
 
 
 
197
    for(int i=0; i < NumFrames * 2 * p->NumVerts; i++)
 
 
198
    {
 
 
199
        UVCoords[i] = fl->UVCoords[i];
 
 
200
    }
 
 
201
 
 
 
202
    CurFrame = 0;
 
 
203
}
 
 
204
 
 
 
205
FrameList::~FrameList()
 
 
206
{
 
 
207
    delete [] Textures;
 
 
208
    delete UVCoords;
 
 
209
}
 
 
210
 
 
 
211
TEXANIM::TEXANIM()
 
 
212
{
 
 
213
    shape = 0;
 
 
214
    NumSeq = 0;
 
 
215
    CurSeq = -1;
 
 
216
    Seq = 0;
 
 
217
    NumVerts = 3;
 
 
218
    AnimFlags = Identifier = 0;
 
 
219
}
 
 
220
 
 
 
221
TEXANIM::TEXANIM(TEXANIM* ta)
 
 
222
{
 
 
223
    shape = 0;
 
 
224
    NumSeq = 0;
 
 
225
    CurSeq = -1;
 
 
226
    Seq = 0;
 
 
227
    NumVerts = 3;
 
 
228
    AnimFlags = Identifier = 0;
 
 
229
    CopyAnimData(ta, 0);
 
 
230
}
 
 
231
 
 
 
232
TEXANIM::~TEXANIM()
 
 
233
{
 
 
234
    for(int i=0; i < NumSeq; i++)
 
 
235
        delete Seq[i];
 
 
236
 
 
 
237
delete [] Seq;    
 
 
238
}
 
 
239
 
 
 
240
void TEXANIM::CopyAnimData(TEXANIM* ta,int*conv)
 
 
241
{
 
 
242
    shape = ta->shape;
 
 
243
    poly = ta->poly;
 
 
244
    ID = ta->ID;
 
 
245
    NumSeq = ta->NumSeq;
 
 
246
    CurSeq = 0;
 
 
247
    Seq = new FrameList*[NumSeq];
 
 
248
    NumVerts = ta->NumVerts;
 
 
249
    AnimFlags = ta->AnimFlags;
 
 
250
    Identifier = ta->Identifier;
 
 
251
 
 
 
252
    for(int i=0; i < NumSeq; i++)
 
 
253
        Seq[i] = new FrameList(this,ta->Seq[i],conv);    
 
 
254
}
4b825dc642cb6eb9a060e54bf8d69288fbee490494a6641b73026d662261604d7d192beae70b11dc
 
 
1
#include "animobs.hpp"
 
 
2
#include <string.h>
 
 
3
#include <stdio.h>
 
 
4
 
 
 
5
RIF_IMPLEMENT_DYNCREATE("OBASEQHD", Object_Animation_Sequence_Header_Chunk)
 
 
6
 
 
 
7
void Object_Animation_Sequence_Header_Chunk::fill_data_block (char *data_start)
 
 
8
{
 
 
9
    strncpy (data_start, identifier, 8);
 
 
10
 
 
 
11
    data_start += 8;
 
 
12
 
 
 
13
    *((int *) data_start) = chunk_size;
 
 
14
 
 
 
15
    data_start += 4;
 
 
16
 
 
 
17
    *((int *) data_start) = num_frames;
 
 
18
    data_start += 4;
 
 
19
 
 
 
20
    *((int *) data_start) = sequence_number;
 
 
21
    data_start += 4;
 
 
22
 
 
 
23
    *((int *) data_start) = sub_sequence_number;
 
 
24
    data_start += 4;
 
 
25
 
 
 
26
    *(int*)data_start=num_extra_data;
 
 
27
    data_start+=4;
 
 
28
 
 
 
29
    for (int i=0; i<num_extra_data; i++)
 
 
30
    {
 
 
31
        *((int *) data_start) = extra_data[i];
 
 
32
        data_start += 4;
 
 
33
    }
 
 
34
 
 
 
35
    if (sequence_name.size())
 
 
36
        sprintf (data_start, "%s", sequence_name.c_str());
 
 
37
    else
 
 
38
        *data_start = 0;
 
 
39
}
 
 
40
 
 
 
41
Object_Animation_Sequence_Header_Chunk::~Object_Animation_Sequence_Header_Chunk()
 
 
42
{
 
 
43
    if(extra_data)
 
 
44
        delete extra_data;
 
 
45
}
 
 
46
 
 
 
47
Object_Animation_Sequence_Header_Chunk::Object_Animation_Sequence_Header_Chunk (Chunk_With_Children * parent,const char * data_start, size_t)
 
 
48
: Chunk (parent, "OBASEQHD")
 
 
49
{
 
 
50
    num_frames = *((int *) data_start);
 
 
51
    data_start += 4;
 
 
52
 
 
 
53
    sequence_number = *((int *) data_start);
 
 
54
    data_start += 4;
 
 
55
 
 
 
56
    sub_sequence_number = *((int *) data_start);
 
 
57
    data_start += 4;
 
 
58
 
 
 
59
    num_extra_data = *(int*) data_start;
 
 
60
    data_start += 4;
 
 
61
 
 
 
62
    if(num_extra_data)
 
 
63
        extra_data = new int[num_extra_data];
 
 
64
    else
 
 
65
        extra_data = 0;
 
 
66
 
 
 
67
    for (int i=0; i<num_extra_data; i++)
 
 
68
    {
 
 
69
        extra_data[i] =    *((int *) data_start);
 
 
70
        data_start += 4;
 
 
71
    }
 
 
72
 
 
 
73
    if (strlen(data_start))
 
 
74
        sequence_name = data_start;
 
 
75
}
 
 
76
 
 
 
77
Object_Animation_Sequence_Header_Chunk * Object_Animation_Sequence_Chunk::get_header()
 
 
78
{
 
 
79
    return(Object_Animation_Sequence_Header_Chunk *) lookup_single_child("OBASEQHD");
 
 
80
}
 
 
81
 
 
 
82
RIF_IMPLEMENT_DYNCREATE("OBANSEQS", Object_Animation_Sequences_Chunk)
 
 
83
 
 
 
84
void Object_Animation_Sequences_Chunk::list_sequences(std::list <Object_Animation_Sequence_Chunk *> * pList)
 
 
85
{
 
 
86
    std::list <Chunk *> cl; 
 
 
87
    lookup_child ("OBANSEQC", cl);
 
 
88
 
 
 
89
    std::list<Chunk *>::iterator cli = cl.begin();
 
 
90
 
 
 
91
    for (; cli != cl.end(); cli++)
 
 
92
        pList->push_back((Object_Animation_Sequence_Chunk *) *cli);
 
 
93
}
 
 
94
 
 
 
95
Object_Animation_Sequence_Chunk::Object_Animation_Sequence_Chunk(Object_Animation_Sequences_Chunk* parent,Object_Animation_Sequence_Chunk* template_seq)
 
 
96
:Chunk_With_Children (parent, "OBANSEQC")
 
 
97
{
 
 
98
    Object_Animation_Sequence_Header_Chunk* template_header=template_seq->get_header();
 
 
99
    Object_Animation_Sequence_Header_Chunk* header=new Object_Animation_Sequence_Header_Chunk(this);
 
 
100
 
 
 
101
    header->num_frames = 65536;
 
 
102
    header->sequence_number = template_header->sequence_number;
 
 
103
    header->sub_sequence_number = template_header->sub_sequence_number;
 
 
104
    header->sequence_name = template_header->sequence_name;
 
 
105
}
 
 
106
 
 
 
107
Object_Animation_Sequence_Chunk * Object_Animation_Sequences_Chunk::get_sequence (int num, int subnum)
 
 
108
{
 
 
109
    std::list <Object_Animation_Sequence_Chunk *> seq_list;
 
 
110
    list_sequences(&seq_list);
 
 
111
 
 
 
112
    std::list<Object_Animation_Sequence_Chunk *>::iterator sli = seq_list.begin();
 
 
113
 
 
 
114
    for (; sli != seq_list.end(); sli++)
 
 
115
    {
 
 
116
        Object_Animation_Sequence_Header_Chunk * oashc = (*sli)->get_header();
 
 
117
        if (oashc)
 
 
118
        {
 
 
119
            if (oashc->sequence_number == num && oashc->sub_sequence_number == subnum)
 
 
120
                    break;
 
 
121
        }
 
 
122
    }
 
 
123
 
 
 
124
    if (sli != seq_list.end())
 
 
125
        return *sli;
 
 
126
 
 
 
127
return 0;
 
 
128
}
 
 
129
 
 
 
130
RIF_IMPLEMENT_DYNCREATE("OBANALLS",Object_Animation_All_Sequence_Chunk)
 
 
131
 
 
 
132
Object_Animation_All_Sequence_Chunk::Object_Animation_All_Sequence_Chunk(Chunk_With_Children * const parent,const char * data, const size_t)
 
 
133
:Chunk(parent,"OBANALLS")
 
 
134
{
 
 
135
    num_sequences = *(int*)data;
 
 
136
    data += 4;
 
 
137
 
 
 
138
    if(num_sequences)
 
 
139
        sequences = new Object_Animation_Sequence[num_sequences];    
 
 
140
    else
 
 
141
        sequences = 0;
 
 
142
 
 
 
143
    for(int i=0; i < num_sequences; i++)
 
 
144
    {
 
 
145
        Object_Animation_Sequence* seq = &sequences[i];
 
 
146
        seq->num_frames = *(int*)data;
 
 
147
        data += 4;
 
 
148
        seq->sequence_number = *(int*)data;
 
 
149
        data += 4;
 
 
150
        seq->sub_sequence_number = *(int*)data;
 
 
151
        data += 4;
 
 
152
        seq->sequence_time = *(int*)data;
 
 
153
        data += 4;
 
 
154
 
 
 
155
        if(seq->num_frames)
 
 
156
            seq->frames = new Object_Animation_Frame[seq->num_frames];
 
 
157
        else
 
 
158
            seq->frames = 0;
 
 
159
 
 
 
160
        for(unsigned j=0; j < seq->num_frames; j++)
 
 
161
        {
 
 
162
            seq->frames[j] = *(Object_Animation_Frame*)data;
 
 
163
            data += sizeof(Object_Animation_Frame);
 
 
164
        }
 
 
165
    }
 
 
166
}
 
 
167
 
 
 
168
void Object_Animation_All_Sequence_Chunk::fill_data_block(char* data)
 
 
169
{
 
 
170
    strncpy (data, identifier, 8);
 
 
171
    data += 8;
 
 
172
    *((int *) data) = chunk_size;
 
 
173
    data += 4;
 
 
174
 
 
 
175
    *(int*)data = num_sequences;
 
 
176
    data += 4;
 
 
177
 
 
 
178
    for(int i=0; i < num_sequences;i++)
 
 
179
    {
 
 
180
        Object_Animation_Sequence* seq = &sequences[i];
 
 
181
        *(int*)data = seq->num_frames;
 
 
182
        data += 4;
 
 
183
        *(int*)data = seq->sequence_number;
 
 
184
        data += 4;
 
 
185
        *(int*)data = seq->sub_sequence_number;
 
 
186
        data += 4;
 
 
187
        *(int*)data = seq->sequence_time;
 
 
188
        data += 4;
 
 
189
 
 
 
190
        for(unsigned j=0; j < seq->num_frames; j++)
 
 
191
        {
 
 
192
            *(Object_Animation_Frame*)data = seq->frames[j];
 
 
193
            data+=sizeof(Object_Animation_Frame);
 
 
194
        }
 
 
195
    }
 
 
196
}
 
 
197
 
 
 
198
size_t Object_Animation_All_Sequence_Chunk::size_chunk()
 
 
199
{
 
 
200
    chunk_size = 12+4;
 
 
201
    chunk_size += num_sequences*16;
 
 
202
 
 
 
203
    for(int i=0; i < num_sequences; i++)
 
 
204
        chunk_size += sequences[i].num_frames*sizeof(Object_Animation_Frame);
 
 
205
 
 
 
206
return chunk_size;
 
 
207
}
 
 
208
 
 
 
209
//loader for Object_Animation_Sequences_Chunk
 
 
210
CHUNK_WITH_CHILDREN_LOADER("OBANSEQS",Object_Animation_Sequences_Chunk)
 
 
211
 
 
 
212
RIF_IMPLEMENT_DYNCREATE("OBANSEQC",Object_Animation_Sequence_Chunk)
 
 
213
 
 
 
214
//loader for Object_Animation_Sequence_Chunk
 
 
215
CHUNK_WITH_CHILDREN_LOADER("OBANSEQC",Object_Animation_Sequence_Chunk)
4b825dc642cb6eb9a060e54bf8d69288fbee490494a6641b73026d662261604d7d192beae70b11dc
 
 
1
#include "avpchunk.hpp"
 
 
2
#include "hash_function.h"
 
 
3
#include <string.h>
 
 
4
#include <assert.h>
 
 
5
 
 
 
6
RIF_IMPLEMENT_DYNCREATE("AVPGENER", AVP_Generator_Chunk)
 
 
7
 
 
 
8
void AVP_Generator_Chunk::fill_data_block (char * data_start)
 
 
9
{
 
 
10
    strncpy (data_start, identifier, 8);
 
 
11
 
 
 
12
    data_start += 8;
 
 
13
 
 
 
14
    *((int *) data_start) = chunk_size;
 
 
15
 
 
 
16
    data_start += 4;
 
 
17
 
 
 
18
    *((ChunkVectorInt *) data_start) = location;
 
 
19
    data_start += sizeof(ChunkVectorInt);
 
 
20
 
 
 
21
    *((int *) data_start) = orientation;
 
 
22
    data_start += 4;
 
 
23
 
 
 
24
    *((int *) data_start) = type;
 
 
25
    data_start += 4;
 
 
26
 
 
 
27
    *((int *) data_start) = flags;
 
 
28
    data_start += 4;
 
 
29
 
 
 
30
    *(data_start) = textureID;
 
 
31
    data_start ++;
 
 
32
 
 
 
33
    *(data_start) = sub_type;
 
 
34
    data_start ++;
 
 
35
 
 
 
36
    *(data_start) = extra1;
 
 
37
    data_start ++;
 
 
38
 
 
 
39
    *(data_start) = extra2;
 
 
40
    data_start ++;
 
 
41
 
 
 
42
    strcpy (data_start, name.c_str());
 
 
43
}
 
 
44
 
 
 
45
size_t AVP_Generator_Chunk::size_chunk()
 
 
46
{
 
 
47
    chunk_size = 12 + 3 * 4 + 4 * 4 + name.size() + 4 - name.size() % 4;
 
 
48
 
 
 
49
return chunk_size;
 
 
50
}
 
 
51
 
 
 
52
AVP_Generator_Chunk::AVP_Generator_Chunk (Chunk_With_Children * parent, const char * data, size_t) :Chunk (parent, "AVPGENER")
 
 
53
{
 
 
54
    location = *((ChunkVectorInt*) data);
 
 
55
    data += sizeof(ChunkVectorInt);
 
 
56
 
 
 
57
    orientation = *((int *) data);
 
 
58
    data += 4;
 
 
59
 
 
 
60
    type = *((int *) data);
 
 
61
    data += 4;
 
 
62
 
 
 
63
    flags = *((int *) data);
 
 
64
    data += 4;
 
 
65
 
 
 
66
    textureID = *(data);
 
 
67
    data ++;
 
 
68
 
 
 
69
    sub_type = *(data);
 
 
70
    data ++;
 
 
71
 
 
 
72
    extra1 = *(uint8_t*)(data);
 
 
73
    data ++;
 
 
74
 
 
 
75
    extra2 = *(uint8_t*)(data);
 
 
76
    data ++;
 
 
77
 
 
 
78
    name = data;
 
 
79
}
 
 
80
 
 
 
81
ObjectID AVP_Generator_Chunk::CalculateID()
 
 
82
{
 
 
83
    ObjectID retval={0,0};
 
 
84
 
 
 
85
    //get the environment_data_chunk
 
 
86
    Chunk_With_Children* cwc = ((Special_Objects_Chunk *)parent)->parent;
 
 
87
 
 
 
88
    std::list<Chunk*> chlist;
 
 
89
    cwc->lookup_child("RIFFNAME", chlist);
 
 
90
 
 
 
91
    if(!chlist.size())
 
 
92
        return retval;
 
 
93
 
 
 
94
    char Name[100];
 
 
95
 
 
 
96
    strcpy(Name,((RIF_Name_Chunk*)chlist.front())->rif_name.c_str());
 
 
97
 
 
 
98
    strcat(Name, name.c_str());
 
 
99
    char buffer[16];
 
 
100
    hash_function(Name, strlen(Name), &buffer[0]);
 
 
101
    buffer[7] = 0;
 
 
102
    retval = *(ObjectID*)&buffer[0];
 
 
103
 
 
 
104
return retval;
 
 
105
}
 
 
106
 
 
 
107
AVP_Generator_Extra_Data_Chunk* AVP_Generator_Chunk::get_extra_data_chunk()
 
 
108
{
 
 
109
    std::list<Chunk*> chlist;
 
 
110
    parent->lookup_child("AVPGENEX", chlist);
 
 
111
 
 
 
112
    if(!chlist.size())
 
 
113
        return 0;
 
 
114
 
 
 
115
    std::list<Chunk *>::iterator chlif = chlist.begin();
 
 
116
 
 
 
117
    for (; chlif != chlist.end(); chlif++)
 
 
118
    {
 
 
119
        AVP_Generator_Extra_Data_Chunk* agedc=(AVP_Generator_Extra_Data_Chunk*) *chlif;
 
 
120
        std::list<Chunk*> chlist2;
 
 
121
        agedc->lookup_child("AVPGENNM", chlist2);
 
 
122
 
 
 
123
        if(chlist2.size())
 
 
124
        {
 
 
125
            if(! name.compare( ((AVP_Generator_Extra_Name_Chunk*)chlist2.front())->name) )
 
 
126
                return agedc;
 
 
127
        }
 
 
128
    }
 
 
129
    //no extra data chunk found
 
 
130
return 0;
 
 
131
}
 
 
132
 
 
 
133
AVP_Generator_Extra_Data_Chunk* AVP_Generator_Chunk::create_extra_data_chunk()
 
 
134
{
 
 
135
    AVP_Generator_Extra_Data_Chunk* agedc=get_extra_data_chunk();
 
 
136
 
 
 
137
    if(agedc)
 
 
138
        return agedc;
 
 
139
 
 
 
140
return new AVP_Generator_Extra_Data_Chunk(parent,this);
 
 
141
}
 
 
142
 
 
 
143
AVP_Generator_Extended_Settings_Chunk* AVP_Generator_Chunk::get_extended_settings()
 
 
144
{
 
 
145
    if(flags & AVPGENFLAG_ADVANCEDGENERATOR)
 
 
146
    {
 
 
147
        AVP_Generator_Extra_Data_Chunk* agedc=get_extra_data_chunk();
 
 
148
 
 
 
149
        if(!agedc)
 
 
150
            return 0;
 
 
151
 
 
 
152
        return (AVP_Generator_Extended_Settings_Chunk*)agedc->lookup_single_child("GENEXSET");
 
 
153
    }
 
 
154
 
 
 
155
return 0;
 
 
156
}
 
 
157
 
 
 
158
Object_Alternate_Locations_Chunk* AVP_Generator_Chunk::get_alternate_locations_chunk()
 
 
159
{
 
 
160
    AVP_Generator_Extra_Data_Chunk* agedc=get_extra_data_chunk();
 
 
161
 
 
 
162
    if(!agedc)
 
 
163
        return 0;
 
 
164
 
 
 
165
    return (Object_Alternate_Locations_Chunk*)agedc->lookup_single_child("ALTLOCAT");
 
 
166
}
 
 
167
 
 
 
168
RIF_IMPLEMENT_DYNCREATE("AVPGENEX",AVP_Generator_Extra_Data_Chunk)
 
 
169
 
 
 
170
//loader for AVP_Generator_Extra_Data_Chunk
 
 
171
CHUNK_WITH_CHILDREN_LOADER("AVPGENEX",AVP_Generator_Extra_Data_Chunk)
 
 
172
 
 
 
173
/*
 
 
174
children for AVP_Generator_Extra_Data_Chunk :
 
 
175
 
 
 
176
"AVPSTRAT"        AVP_Strategy_Chunk)
 
 
177
"AVPGENNM"        AVP_Generator_Extra_Name_Chunk)
 
 
178
"GENEXSET"        AVP_Generator_Extended_Settings_Chunk)
 
 
179
"ALTLOCAT"        Object_Alternate_Locations_Chunk)
 
 
180
*/
 
 
181
 
 
 
182
AVP_Generator_Extra_Data_Chunk::AVP_Generator_Extra_Data_Chunk(Chunk_With_Children* parent,AVP_Generator_Chunk* agc)
 
 
183
:Chunk_With_Children(parent,"AVPGENEX")
 
 
184
{
 
 
185
    new AVP_Generator_Extra_Name_Chunk(this, agc->name);    
 
 
186
}
 
 
187
 
 
 
188
RIF_IMPLEMENT_DYNCREATE("AVPGENNM", AVP_Generator_Extra_Name_Chunk)
 
 
189
 
 
 
190
void AVP_Generator_Extra_Name_Chunk::fill_data_block(char* data_start)
 
 
191
{
 
 
192
    strncpy (data_start, identifier, 8);
 
 
193
    data_start += 8;
 
 
194
    *((int *) data_start) = chunk_size;
 
 
195
    data_start += 4;
 
 
196
 
 
 
197
    strcpy(data_start, name.c_str());
 
 
198
}
 
 
199
 
 
 
200
size_t AVP_Generator_Extra_Name_Chunk::size_chunk()
 
 
201
{
 
 
202
    chunk_size = 12;
 
 
203
    chunk_size += (name.size() + 4)&~3;
 
 
204
 
 
 
205
return chunk_size;
 
 
206
}
 
 
207
 
 
 
208
RIF_IMPLEMENT_DYNCREATE("GENEXSET",AVP_Generator_Extended_Settings_Chunk)
 
 
209
 
 
 
210
AVP_Generator_Extended_Settings_Chunk::AVP_Generator_Extended_Settings_Chunk(Chunk_With_Children* parent,const char* data,size_t)
 
 
211
:Chunk(parent,"GENEXSET")
 
 
212
{
 
 
213
    CHUNK_EXTRACT(GenerationRate,int)
 
 
214
    CHUNK_EXTRACT(GenRateIncrease,int)
 
 
215
    CHUNK_EXTRACT(GenLimit,uint8_t)
 
 
216
    CHUNK_EXTRACT(pad1,uint8_t)
 
 
217
    CHUNK_EXTRACT(pad2,uint8_t)
 
 
218
    CHUNK_EXTRACT(pad3,uint8_t)
 
 
219
    CHUNK_EXTRACT(spare1,int)
 
 
220
    CHUNK_EXTRACT(spare2,int)
 
 
221
 
 
 
222
    size_t size = std::max(*(int*) data,(int)sizeof(AVP_Generator_Weighting));
 
 
223
 
 
 
224
    weights = (AVP_Generator_Weighting*)new uint8_t[size];
 
 
225
    memset(weights,0,sizeof(AVP_Generator_Weighting));
 
 
226
    memcpy(weights,data,*(int*) data);
 
 
227
 
 
 
228
    weights->data_size = size;
 
 
229
}
 
 
230
 
 
 
231
AVP_Generator_Extended_Settings_Chunk::AVP_Generator_Extended_Settings_Chunk(Chunk_With_Children* parent) :Chunk(parent,"GENEXSET")
 
 
232
{
 
 
233
    weights = new AVP_Generator_Weighting;
 
 
234
    memset(weights,0,sizeof(AVP_Generator_Weighting));
 
 
235
    weights->data_size = sizeof(AVP_Generator_Weighting);
 
 
236
    GenLimit = pad1 = pad2 = pad3 = 0;
 
 
237
    spare1 = spare2 = 0;
 
 
238
}
 
 
239
 
 
 
240
void AVP_Generator_Extended_Settings_Chunk::fill_data_block (char * data)
 
 
241
{
 
 
242
        strncpy (data, identifier, 8);
 
 
243
        data += 8;
 
 
244
        *(int *) data = chunk_size;
 
 
245
        data += 4;
 
 
246
 
 
 
247
    CHUNK_FILL(GenerationRate,int)
 
 
248
    CHUNK_FILL(GenRateIncrease,int)
 
 
249
    CHUNK_FILL(GenLimit,uint8_t)
 
 
250
    CHUNK_FILL(pad1,uint8_t)
 
 
251
    CHUNK_FILL(pad2,uint8_t)
 
 
252
    CHUNK_FILL(pad3,uint8_t)
 
 
253
    CHUNK_FILL(spare1,int)
 
 
254
    CHUNK_FILL(spare2,int)
 
 
255
 
 
 
256
    memcpy(data,weights,weights->data_size);
 
 
257
}
 
 
258
 
 
 
259
size_t AVP_Generator_Extended_Settings_Chunk::size_chunk ()
 
 
260
{
 
 
261
    chunk_size = 12 + 20 + weights->data_size;
 
 
262
    return(chunk_size);
 
 
263
}
 
 
264
 
 
 
265
RIF_IMPLEMENT_DYNCREATE("GLOGENDC", Global_Generator_Data_Chunk)
 
 
266
 
 
 
267
Global_Generator_Data_Chunk::Global_Generator_Data_Chunk(Chunk_With_Children* parent) :Chunk(parent,"GLOGENDC")
 
 
268
{
 
 
269
    EnemyGenerated = Generate_Aliens;
 
 
270
    MaxNPCSOnLevel = 25;
 
 
271
    NPCSPerMinute = 4;
 
 
272
    NPCAcceleration = 2;
 
 
273
    HiveStateChangeTime = 60;
 
 
274
    spare1 = spare2 = 0;
 
 
275
}
 
 
276
 
 
 
277
Global_Generator_Data_Chunk::Global_Generator_Data_Chunk(Chunk_With_Children* parent,const char* data,size_t) :Chunk(parent,"GLOGENDC")
 
 
278
{
 
 
279
    EnemyGenerated = *(int*)data;
 
 
280
    data += sizeof(int);
 
 
281
    MaxNPCSOnLevel = *(int*)data;
 
 
282
    data += sizeof(int);
 
 
283
    NPCSPerMinute = *(int*)data;
 
 
284
    data += sizeof(int);
 
 
285
    NPCAcceleration = *(int*)data;
 
 
286
    data += sizeof(int);
 
 
287
    HiveStateChangeTime = *(int*)data;
 
 
288
    data += sizeof(int);
 
 
289
 
 
 
290
    spare1 = *(int*)data;
 
 
291
    data += sizeof(int);
 
 
292
    spare2 = *(int*)data;
 
 
293
    data += sizeof(int);
 
 
294
}
 
 
295
 
 
 
296
void Global_Generator_Data_Chunk::fill_data_block (char * data_start)
 
 
297
{
 
 
298
    strncpy (data_start, identifier, 8);
 
 
299
    data_start += 8;
 
 
300
    *((int *) data_start) = chunk_size;
 
 
301
    data_start += 4;
 
 
302
 
 
 
303
    *(int*)data_start = EnemyGenerated;
 
 
304
    data_start += 4;
 
 
305
    *(int*)data_start = MaxNPCSOnLevel;
 
 
306
    data_start += 4;
 
 
307
    *(int*)data_start = NPCSPerMinute;
 
 
308
    data_start += 4;
 
 
309
    *(int*)data_start = NPCAcceleration;
 
 
310
    data_start += 4;
 
 
311
    *(int*)data_start = HiveStateChangeTime;
 
 
312
    data_start += 4;
 
 
313
 
 
 
314
    *(int*)data_start = spare1;
 
 
315
    data_start += 4;
 
 
316
    *(int*)data_start = spare2;
 
 
317
    data_start += 4;
 
 
318
}
 
 
319
 
 
 
320
RIF_IMPLEMENT_DYNCREATE("AVPSTART",AVP_Player_Start_Chunk)
 
 
321
 
 
 
322
AVP_Player_Start_Chunk::AVP_Player_Start_Chunk(Chunk_With_Children* parent) :Chunk(parent,"AVPSTART")
 
 
323
{
 
 
324
    location.x = location.y = location.z = 0;
 
 
325
    orientation.mat11 = orientation.mat22 = orientation.mat33 = 65536;
 
 
326
    orientation.mat12 = orientation.mat23 = orientation.mat31 = 0;
 
 
327
    orientation.mat21 = orientation.mat32 = orientation.mat13 = 0;
 
 
328
    moduleID.id1 = 0;
 
 
329
    moduleID.id2 = 0;
 
 
330
}
 
 
331
 
 
 
332
AVP_Player_Start_Chunk::AVP_Player_Start_Chunk(Chunk_With_Children* parent,const char* data,size_t) :Chunk(parent,"AVPSTART")
 
 
333
{
 
 
334
    CHUNK_EXTRACT(location,ChunkVectorInt)
 
 
335
    CHUNK_EXTRACT(orientation,ChunkMatrix)
 
 
336
    CHUNK_EXTRACT(moduleID,ObjectID)
 
 
337
}
 
 
338
 
 
 
339
void AVP_Player_Start_Chunk::fill_data_block (char * data)
 
 
340
{
 
 
341
        strncpy (data, identifier, 8);
 
 
342
        data += 8;
 
 
343
        *(int *) data = chunk_size;
 
 
344
        data += 4;
 
 
345
 
 
 
346
    CHUNK_FILL(location,ChunkVectorInt)
 
 
347
    CHUNK_FILL(orientation,ChunkMatrix)
 
 
348
    CHUNK_FILL(moduleID,ObjectID)
 
 
349
}
 
 
350
 
 
 
351
size_t AVP_Player_Start_Chunk::size_chunk ()
 
 
352
{
 
 
353
    chunk_size = 12+sizeof(ChunkVectorInt)+sizeof(ChunkMatrix)+sizeof(ObjectID);
 
 
354
 
 
 
355
return(chunk_size);
 
 
356
}
 
 
357
 
 
 
358
RIF_IMPLEMENT_DYNCREATE("AVPENVIR",AVP_Environment_Settings_Chunk)
 
 
359
 
 
 
360
AVP_Environment_Settings_Chunk::AVP_Environment_Settings_Chunk(Chunk_With_Children* parent,const char* data,size_t data_size)
 
 
361
:Chunk(parent,"AVPENVIR")
 
 
362
{
 
 
363
    size_t size = std::max(data_size, sizeof(AVP_Environment_Settings));
 
 
364
 
 
 
365
    settings = (AVP_Environment_Settings*)new uint8_t[size];
 
 
366
    memcpy(settings,data,data_size);
 
 
367
 
 
 
368
    if(settings->data_size < 16)
 
 
369
    {
 
 
370
        settings->sky_colour_red = 200;
 
 
371
        settings->sky_colour_green = 200;
 
 
372
        settings->sky_colour_blue = 200;
 
 
373
    }
 
 
374
 
 
 
375
    if(settings->data_size < 24)
 
 
376
    {
 
 
377
        settings->predator_pistol = 1;
 
 
378
        settings->predator_plasmacaster = 1;
 
 
379
        settings->predator_disc = 1;
 
 
380
        settings->predator_medicomp = 1;
 
 
381
        settings->predator_grappling_hook = 0;
 
 
382
        settings->predator_num_spears = 30;
 
 
383
        settings->marine_jetpack = 0;
 
 
384
        settings->stars_in_sky = 0;
 
 
385
        settings->spare_bits = 0;
 
 
386
    }
 
 
387
 
 
 
388
    settings->data_size = size;
 
 
389
}
 
 
390
 
 
 
391
AVP_Environment_Settings_Chunk::AVP_Environment_Settings_Chunk(Chunk_With_Children* parent)
 
 
392
:Chunk(parent,"AVPENVIR")
 
 
393
{
 
 
394
    settings=new AVP_Environment_Settings;
 
 
395
    settings->data_size=sizeof(AVP_Environment_Settings);
 
 
396
    settings->sky_colour_red=200;
 
 
397
    settings->sky_colour_green=200;
 
 
398
    settings->sky_colour_blue=200;
 
 
399
 
 
 
400
    settings->predator_pistol=1;
 
 
401
    settings->predator_plasmacaster=1;
 
 
402
    settings->predator_disc=1;
 
 
403
    settings->predator_medicomp=1;
 
 
404
    settings->predator_grappling_hook=0;
 
 
405
    settings->predator_num_spears=30;
 
 
406
    settings->marine_jetpack=0;
 
 
407
    settings->stars_in_sky=0;
 
 
408
    settings->spare_bits=0;
 
 
409
}
 
 
410
 
 
 
411
void AVP_Environment_Settings_Chunk::fill_data_block (char * data_start)
 
 
412
{
 
 
413
    strncpy (data_start, identifier, 8);
 
 
414
    data_start += 8;
 
 
415
    *((int *) data_start) = chunk_size;
 
 
416
    data_start += 4;
 
 
417
 
 
 
418
    memcpy(data_start,settings,settings->data_size);
 
 
419
}
 
 
420
 
 
 
421
size_t AVP_Environment_Settings_Chunk::size_chunk ()
 
 
422
{
 
 
423
    return (chunk_size = 12 + settings->data_size);
 
 
424
}
 
 
425
 
 
 
426
AVP_Environment_Settings_Chunk* GetAVPEnvironmentSettings(Environment_Data_Chunk* env_chunk)
 
 
427
{
 
 
428
    assert(env_chunk);
 
 
429
 
 
 
430
    AVP_Environment_Settings_Chunk* env_set=(AVP_Environment_Settings_Chunk*)env_chunk->lookup_single_child("AVPENVIR");
 
 
431
 
 
 
432
    if(!env_set)
 
 
433
        env_set = new AVP_Environment_Settings_Chunk(env_chunk);
 
 
434
 
 
 
435
return env_set;
 
 
436
}
 
 
437
 
 
 
438
RIF_IMPLEMENT_DYNCREATE("AVPDECAL",AVP_Decal_Chunk)
 
 
439
 
 
 
440
AVP_Decal_Chunk::AVP_Decal_Chunk(Chunk_With_Children* parent,const char* data,size_t)
 
 
441
:Chunk(parent,"AVPDECAL")
 
 
442
{
 
 
443
    num_decals = *(int*)data;
 
 
444
    data += 4;
 
 
445
 
 
 
446
    int loaded_decal_size = *(int*)data;
 
 
447
    data += 4;
 
 
448
 
 
 
449
    decal_size = std::max(loaded_decal_size, (int)sizeof(AVP_Decal));
 
 
450
 
 
 
451
    //allocate buffer for decals , and initialise to zero
 
 
452
    decal_buffer = new char[num_decals*decal_size];
 
 
453
    memset(decal_buffer,0,num_decals*decal_size);
 
 
454
 
 
 
455
    char* buffer_ptr = decal_buffer;
 
 
456
 
 
 
457
    for(int i=0; i <num_decals; i++)
 
 
458
    {
 
 
459
        memcpy(buffer_ptr,data,loaded_decal_size);
 
 
460
        buffer_ptr += decal_size;
 
 
461
        data += loaded_decal_size;
 
 
462
    }
 
 
463
 
 
 
464
    //only allow access to the decals if the loaded structure size is less than or equal
 
 
465
    //to the current stucture size
 
 
466
 
 
 
467
    if(loaded_decal_size<=(int)sizeof(AVP_Decal))
 
 
468
        decals = (AVP_Decal*)decal_buffer;
 
 
469
    else
 
 
470
        decals = 0;
 
 
471
}
 
 
472
 
 
 
473
AVP_Decal_Chunk::AVP_Decal_Chunk(Chunk_With_Children* parent,int num_dec):Chunk(parent,"AVPDECAL")
 
 
474
{
 
 
475
    num_decals = num_dec;
 
 
476
    decal_size = sizeof(AVP_Decal);
 
 
477
 
 
 
478
    //allocate buffer for decals , and initialise to zero
 
 
479
    decal_buffer = new char[num_decals*decal_size];
 
 
480
    memset(decal_buffer,0,num_decals*decal_size);
 
 
481
 
 
 
482
    decals = (AVP_Decal*)decal_buffer;
 
 
483
}
 
 
484
 
 
 
485
AVP_Decal_Chunk::~AVP_Decal_Chunk()
 
 
486
{
 
 
487
    if(decal_buffer)
 
 
488
        delete [] decal_buffer;
 
 
489
}
 
 
490
 
 
 
491
void AVP_Decal_Chunk::fill_data_block(char* data)
 
 
492
{
 
 
493
    strncpy (data, identifier, 8);
 
 
494
    data += 8;
 
 
495
    *((int *) data) = chunk_size;
 
 
496
    data += 4;
 
 
497
 
 
 
498
    *(int*) data = num_decals;
 
 
499
    data += 4;
 
 
500
 
 
 
501
    *(int*) data = decal_size;
 
 
502
    data += 4;
 
 
503
 
 
 
504
    memcpy(data,decal_buffer,decal_size*num_decals);
 
 
505
}
 
 
506
 
 
 
507
size_t AVP_Decal_Chunk::size_chunk()
 
 
508
{
 
 
509
    return (chunk_size = 12 + 8 + num_decals * decal_size );
 
 
510
}
 
 
511
 
 
 
512
//Class AVP_Particle_Generator_Chunk
 
 
513
 
 
 
514
RIF_IMPLEMENT_DYNCREATE("PARGENER", AVP_Particle_Generator_Chunk)
 
 
515
 
 
 
516
CHUNK_WITH_CHILDREN_LOADER("PARGENER", AVP_Particle_Generator_Chunk)
 
 
517
 
 
 
518
/*
 
 
519
Children for AVP_Particle_Generator_Chunk :
 
 
520
 
 
 
521
AVP_Particle_Generator_Data_Chunk     "PARGENDA"
 
 
522
Object_Alternate_Locations_Chunk    "ALTLOCAT"
 
 
523
Indexed_Sound_Chunk            "INDSOUND"
 
 
524
*/
 
 
525
 
 
 
526
AVP_Particle_Generator_Chunk::AVP_Particle_Generator_Chunk(Chunk_With_Children* parent , const char* name,ObjectID & id)
 
 
527
:Chunk_With_Children(parent,"PARGENER")
 
 
528
{
 
 
529
    new AVP_Particle_Generator_Data_Chunk(this,name,id); 
 
 
530
}
 
 
531
 
 
 
532
AVP_Particle_Generator_Data_Chunk* AVP_Particle_Generator_Chunk::get_data_chunk()
 
 
533
{
 
 
534
    return (AVP_Particle_Generator_Data_Chunk*) lookup_single_child("PARGENDA");
 
 
535
}
 
 
536
 
 
 
537
Object_Alternate_Locations_Chunk* AVP_Particle_Generator_Chunk::get_alternate_locations_chunk()
 
 
538
{
 
 
539
    return (Object_Alternate_Locations_Chunk*) lookup_single_child("ALTLOCAT");
 
 
540
}
 
 
541
 
 
 
542
Indexed_Sound_Chunk* AVP_Particle_Generator_Chunk::get_sound_chunk()
 
 
543
{
 
 
544
    return (Indexed_Sound_Chunk*) lookup_single_child("INDSOUND");
 
 
545
}
 
 
546
 
 
 
547
RIF_IMPLEMENT_DYNCREATE("PARGENDA", AVP_Particle_Generator_Data_Chunk)
 
 
548
 
 
 
549
AVP_Particle_Generator_Data_Chunk::AVP_Particle_Generator_Data_Chunk(Chunk_With_Children* parent, const char* _name,ObjectID & _id)
 
 
550
:Chunk(parent,"PARGENDA")
 
 
551
{
 
 
552
    name = _name;
 
 
553
    id = _id;
 
 
554
    parent_id.id1 = 0;
 
 
555
    parent_id.id2 = 0;
 
 
556
    time = probability = speed = quantity = 0;
 
 
557
    spare1 = spare2 = 0;
 
 
558
}
 
 
559
 
 
 
560
AVP_Particle_Generator_Data_Chunk::AVP_Particle_Generator_Data_Chunk(Chunk_With_Children* parent, const char* data,size_t)
 
 
561
:Chunk(parent,"PARGENDA")
 
 
562
{
 
 
563
    CHUNK_EXTRACT(type,int)
 
 
564
    CHUNK_EXTRACT(flags,int)
 
 
565
    CHUNK_EXTRACT(time, uint16_t)
 
 
566
    CHUNK_EXTRACT(probability, uint16_t)
 
 
567
    CHUNK_EXTRACT(speed, uint16_t)
 
 
568
    CHUNK_EXTRACT(quantity, uint16_t)
 
 
569
    CHUNK_EXTRACT(spare1,int)
 
 
570
    CHUNK_EXTRACT(spare2,int)
 
 
571
    CHUNK_EXTRACT(id,ObjectID)
 
 
572
    CHUNK_EXTRACT(parent_id,ObjectID)
 
 
573
    CHUNK_EXTRACT(location,ChunkVectorInt)
 
 
574
    CHUNK_EXTRACT(orientation,ChunkQuat)
 
 
575
 
 
 
576
    int len = strlen(data);
 
 
577
 
 
 
578
    if (len)
 
 
579
        name = data;
 
 
580
 
 
 
581
    data += (len + 4) &~3 ;
 
 
582
}
 
 
583
 
 
 
584
void AVP_Particle_Generator_Data_Chunk::fill_data_block(char* data)
 
 
585
{
 
 
586
        strncpy (data, identifier, 8);
 
 
587
        data += 8;
 
 
588
        *(int *) data = chunk_size;
 
 
589
        data += 4;
 
 
590
 
 
 
591
    CHUNK_FILL(type,int)
 
 
592
    CHUNK_FILL(flags,int)
 
 
593
    CHUNK_FILL(time, uint16_t)
 
 
594
    CHUNK_FILL(probability, uint16_t)
 
 
595
    CHUNK_FILL(speed, uint16_t)
 
 
596
    CHUNK_FILL(quantity, uint16_t)
 
 
597
    CHUNK_FILL(spare1,int)
 
 
598
    CHUNK_FILL(spare2,int)
 
 
599
    CHUNK_FILL(id,ObjectID)
 
 
600
    CHUNK_FILL(parent_id,ObjectID)
 
 
601
    CHUNK_FILL(location,ChunkVectorInt)
 
 
602
    CHUNK_FILL(orientation,ChunkQuat)
 
 
603
 
 
 
604
    if (name.size())
 
 
605
        strcpy(data, name.c_str());
 
 
606
    else
 
 
607
        *data = 0;
 
 
608
 
 
 
609
    data += (strlen(data)+4)&~3;
 
 
610
}
 
 
611
 
 
 
612
size_t AVP_Particle_Generator_Data_Chunk::size_chunk()
 
 
613
{
 
 
614
    chunk_size = 12+6*sizeof(int) + sizeof(ObjectID)*2;
 
 
615
    chunk_size += sizeof(ChunkVectorInt) + sizeof(ChunkQuat);
 
 
616
    chunk_size += (name.size()+4)&~3;
 
 
617
 
 
 
618
return chunk_size;
 
 
619
}
4b825dc642cb6eb9a060e54bf8d69288fbee490494a6641b73026d662261604d7d192beae70b11dc
 
 
1
#include "bmpnames.hpp"
 
 
2
#include <cstring>
 
 
3
 
 
 
4
BMP_Name::BMP_Name (const BMP_Name & bn)
 
 
5
{
 
 
6
    if (&bn == this)
 
 
7
        return;
 
 
8
 
 
 
9
    filename =  bn.filename;
 
 
10
    flags = bn.flags;
 
 
11
    index = bn.index;
 
 
12
    version_num = bn.version_num;
 
 
13
    enum_id = bn.enum_id;
 
 
14
    priority = bn.priority;
 
 
15
    transparency_colour_union = bn.transparency_colour_union;
 
 
16
}
 
 
17
 
 
 
18
const BMP_Name & BMP_Name::operator=(const BMP_Name & bn)
 
 
19
{
 
 
20
    if (&bn == this)
 
 
21
        return(*this);
 
 
22
 
 
 
23
    filename = bn.filename;
 
 
24
    flags = bn.flags;
 
 
25
    index = bn.index;
 
 
26
    version_num = bn.version_num;
 
 
27
    enum_id = bn.enum_id;
 
 
28
    priority = bn.priority;
 
 
29
    transparency_colour_union = bn.transparency_colour_union;
 
 
30
 
 
 
31
return(*this);
 
 
32
}
 
 
33
 
 
 
34
Chunk_With_BMPs::Chunk_With_BMPs (Chunk_With_Children * parent, const char * const ident, const char * bdata, size_t )
 
 
35
: Chunk (parent, ident), max_index (0)
 
 
36
{
 
 
37
    int temp = *(int *)bdata;
 
 
38
 
 
 
39
    int num = temp & 0xffff;
 
 
40
 
 
 
41
    bdata += 4;
 
 
42
 
 
 
43
    for (int j=0; j < num; j++)
 
 
44
    {
 
 
45
        int f,i,d1,d2,d3;
 
 
46
 
 
 
47
        f = *((int *)bdata);
 
 
48
        bdata += 4;
 
 
49
        i = *((int *)bdata);
 
 
50
        bdata += 4;
 
 
51
        d1 = *((int *)bdata);
 
 
52
        bdata += 4;
 
 
53
        d2 = *((int *)bdata);
 
 
54
        bdata += 4;
 
 
55
        d3 = *((int *)bdata);
 
 
56
        bdata += 4;
 
 
57
 
 
 
58
        BMP_Name bn (bdata);
 
 
59
        bdata += (4 - bn.filename.size() % 4) + bn.filename.size();
 
 
60
 
 
 
61
        bn.flags = (BMPN_Flags)f;
 
 
62
        bn.index = i;
 
 
63
        bn.version_num = d1 & BMPNAME_VERSION_NUM_MASK;
 
 
64
        bn.enum_id = (int)((unsigned int)d1 >> BMPNAME_ENUMID_SHIFT);
 
 
65
        bn.priority = d2;
 
 
66
        bn.transparency_colour_union = d3;
 
 
67
 
 
 
68
        max_index = std::max (bn.index, max_index);
 
 
69
 
 
 
70
        bmps.push_back(bn);
 
 
71
    }
 
 
72
}
 
 
73
 
 
 
74
size_t Chunk_With_BMPs::size_chunk()
 
 
75
{
 
 
76
    int sz = 12 + 4;
 
 
77
 
 
 
78
    std::list<BMP_Name>::iterator bl = bmps.begin();
 
 
79
 
 
 
80
    for (; bl != bmps.end(); bl++)
 
 
81
    {
 
 
82
        sz += (4 - (*bl).filename.size() % 4) + (*bl).filename.size() + 20;
 
 
83
    }
 
 
84
 
 
 
85
    chunk_size = sz;
 
 
86
 
 
 
87
return chunk_size;
 
 
88
}
 
 
89
 
 
 
90
void Chunk_With_BMPs::fill_data_block (char * data_start)
 
 
91
{
 
 
92
    strncpy (data_start, identifier, 8);
 
 
93
 
 
 
94
    data_start += 8;
 
 
95
 
 
 
96
    *((int *) data_start) = chunk_size;
 
 
97
 
 
 
98
    data_start += 4;
 
 
99
 
 
 
100
    *((int *) data_start) = bmps.size();
 
 
101
 
 
 
102
    data_start += 4;
 
 
103
 
 
 
104
    std::list<BMP_Name>::iterator bl = bmps.begin();
 
 
105
 
 
 
106
    for (; bl != bmps.end(); bl++)
 
 
107
    {
 
 
108
        *((int *) data_start) = (*bl).flags;
 
 
109
        data_start += 4;
 
 
110
        *((int *) data_start) = (*bl).index;
 
 
111
        data_start += 4;
 
 
112
        *((int *) data_start) = ((*bl).version_num & BMPNAME_VERSION_NUM_MASK) | (*bl).enum_id << BMPNAME_ENUMID_SHIFT;
 
 
113
        data_start += 4;
 
 
114
        *((int *) data_start) = (*bl).priority;
 
 
115
        data_start += 4;
 
 
116
        *((int *) data_start) = (*bl).transparency_colour_union;
 
 
117
        data_start += 4;
 
 
118
 
 
 
119
        strcpy (data_start, (*bl).filename.c_str());
 
 
120
        data_start += (4 - (*bl).filename.size() % 4) + (*bl).filename.size();
 
 
121
    }
 
 
122
}
 
 
123
 
 
 
124
RIF_IMPLEMENT_DYNCREATE("BMPNAMES", Global_BMP_Name_Chunk)
 
 
125
RIF_IMPLEMENT_DYNCREATE("BMPLSTST", Bitmap_List_Store_Chunk)
File was changed - ok, show the diff
File was changed - ok, show the diff
4b825dc642cb6eb9a060e54bf8d69288fbee490494a6641b73026d662261604d7d192beae70b11dc
 
 
1
#include "chunkpal.hpp"
 
 
2
 
 
 
3
RIF_IMPLEMENT_DYNCREATE("ENVTXLIT", Environment_TLT_Chunk)
 
 
4
 
 
 
5
Environment_TLT_Chunk::Environment_TLT_Chunk (Chunk_With_Children * parent, const char * sdata, size_t ssize)
 
 
6
: Chunk (parent, "ENVTXLIT"), width (*((int*)(sdata))), num_levels (*((int*)(sdata+4))), flags(*(int *)(sdata+28)), table (0)
 
 
7
{
 
 
8
    for (int i=0; i<ChunkTLT_NumReserved; ++i) reserved[i] = *(int *)(sdata+8+(i<<2));
 
 
9
 
 
 
10
    if (flags & ChunkTLTFlag_ExternalFile)
 
 
11
    {
 
 
12
        filename = sdata + 32;
 
 
13
    }
 
 
14
    else if ((signed) ssize >= 32 + width*num_levels)
 
 
15
    {
 
 
16
        table = new uint8_t [width*num_levels];
 
 
17
        uint8_t * tableptr = table;
 
 
18
        uint8_t const * sdataptr = (uint8_t *)(sdata+32);
 
 
19
 
 
 
20
        for (int i=width*num_levels; i; --i)
 
 
21
            *tableptr++ = *sdataptr++;
 
 
22
    }
 
 
23
 
 
 
24
}
 
 
25
 
 
 
26
Environment_TLT_Chunk::~Environment_TLT_Chunk ()
 
 
27
{
 
 
28
    if (table)
 
 
29
        delete[] table;
 
 
30
}
 
 
31
 
 
 
32
size_t Environment_TLT_Chunk::size_chunk()
 
 
33
{
 
 
34
    if (flags & ChunkTLTFlag_ExternalFile)
 
 
35
        chunk_size = filename.size() ? (12 + 32 + (filename.size() + (4 & ~3))) : (12 + 32 + 4); 
 
 
36
    else
 
 
37
        chunk_size = 12 + 32 + width * num_levels;
 
 
38
 
 
 
39
return chunk_size;
 
 
40
}
 
 
41
 
 
 
42
void Environment_TLT_Chunk::fill_data_block (char * data_start)
 
 
43
{
 
 
44
    strncpy (data_start, identifier, 8);
 
 
45
 
 
 
46
    data_start += 8;
 
 
47
 
 
 
48
    *((int *) data_start) = chunk_size;
 
 
49
 
 
 
50
    data_start += 4;
 
 
51
 
 
 
52
    *((int*)data_start) = width;
 
 
53
    *((int*)(data_start+4)) = num_levels;
 
 
54
 
 
 
55
    data_start += 8;
 
 
56
 
 
 
57
    for (int i=0; i < ChunkTLT_NumReserved ; ++i, data_start+=4)
 
 
58
        *((int *)data_start) = reserved[i];
 
 
59
 
 
 
60
    *(int *)data_start = flags;
 
 
61
    data_start += 4;
 
 
62
 
 
 
63
    if (flags & ChunkTLTFlag_ExternalFile)
 
 
64
    {
 
 
65
        if (filename.size())
 
 
66
            strcpy(data_start, filename.c_str());
 
 
67
        else
 
 
68
            *data_start = 0;
 
 
69
    }
 
 
70
    else
 
 
71
    {
 
 
72
        if (table)
 
 
73
        {
 
 
74
            uint8_t * tableptr = table;
 
 
75
 
 
 
76
            for (int i=width*num_levels; i; --i)
 
 
77
                *data_start++ = *tableptr++;
 
 
78
        }
 
 
79
        else
 
 
80
        {
 
 
81
            for (int i=width*num_levels; i; --i)
 
 
82
                *data_start++ = 0;
 
 
83
        }
 
 
84
    }
 
 
85
}
 
 
86
 
 
 
87
RIF_IMPLEMENT_DYNCREATE("GAMEMODE", Environment_Game_Mode_Chunk)
 
 
88
 
 
 
89
/*
 
 
90
Children For  Environment_Game_Mode_Chunk :
 
 
91
 
 
 
92
"GMODHEAD"        Environment_Game_Mode_Header_Chunk
 
 
93
"ENVTXLIT"        Environment_TLT_Chunk
 
 
94
*/
 
 
95
 
 
 
96
Environment_Game_Mode_Chunk::Environment_Game_Mode_Chunk(Chunk_With_Children* const parent,const char* data,size_t const size)
 
 
97
:Chunk_With_Children(parent,"GAMEMODE") , envd_parent((Environment_Data_Chunk *)parent)
 
 
98
{
 
 
99
    const char * buffer_ptr = data;
 
 
100
 
 
 
101
    while ((data-buffer_ptr)< (signed) size) 
 
 
102
    {
 
 
103
        if ((*(int *)(data + 8)) + (data-buffer_ptr) > (signed) size) 
 
 
104
        {
 
 
105
            Parent_File->error_code = CHUNK_FAILED_ON_LOAD_NOT_RECOGNISED;
 
 
106
            break;
 
 
107
        }
 
 
108
 
 
 
109
    DynCreate(data);
 
 
110
    data += *(int *)(data + 8);
 
 
111
    }
 
 
112
}
 
 
113
 
 
 
114
// header chunk
 
 
115
RIF_IMPLEMENT_DYNCREATE("GMODHEAD", Environment_Game_Mode_Header_Chunk)
 
 
116
 
 
 
117
Environment_Game_Mode_Header_Chunk::Environment_Game_Mode_Header_Chunk(Chunk_With_Children * const parent, const char * pdata, size_t const)
 
 
118
: Chunk (parent, "GMODHEAD"), flags(0)
 
 
119
{
 
 
120
    flags = *((int *) pdata);
 
 
121
 
 
 
122
    pdata+=4;
 
 
123
 
 
 
124
    for (int i=0; i<ChunkGMod_NumReserved; i++, pdata+=4)
 
 
125
        reserved[i] = *((int *) pdata);
 
 
126
 
 
 
127
    version_num = *(int *)pdata;
 
 
128
    pdata+=4;
 
 
129
 
 
 
130
    mode_identifier =  pdata;
 
 
131
 
 
 
132
    pdata += mode_identifier.size() + 1;
 
 
133
 
 
 
134
    while (*pdata)
 
 
135
    {
 
 
136
        unsigned int len = strlen(pdata)+1;
 
 
137
        rif_files.push_back(std::string(pdata));
 
 
138
        pdata += len;
 
 
139
    }
 
 
140
 
 
 
141
    ((Environment_Game_Mode_Chunk*)parent)->header = this;
 
 
142
}
 
 
143
 
 
 
144
void Environment_Game_Mode_Header_Chunk::fill_data_block ( char * data_start)
 
 
145
{
 
 
146
    strncpy (data_start, identifier, 8);
 
 
147
 
 
 
148
    data_start += 8;
 
 
149
 
 
 
150
    *((int *) data_start) = chunk_size;
 
 
151
 
 
 
152
    data_start += 4;
 
 
153
 
 
 
154
    *((int *) data_start) = flags;
 
 
155
    data_start+=4;
 
 
156
 
 
 
157
    for (int i=0; i<ChunkGMod_NumReserved; i++, data_start+=4)
 
 
158
        *((int *) data_start) = reserved[i];
 
 
159
 
 
 
160
    *(int *)data_start = version_num;
 
 
161
    data_start+=4;
 
 
162
 
 
 
163
    strcpy ((data_start), mode_identifier.c_str());
 
 
164
 
 
 
165
    data_start += mode_identifier.size() + 1;
 
 
166
 
 
 
167
    std::list<std::string>::iterator it = rif_files.begin();
 
 
168
 
 
 
169
    for (; it != rif_files.end(); it++)
 
 
170
    {
 
 
171
        strcpy(data_start, (*it).c_str());
 
 
172
        data_start += (*it).size() + 1;
 
 
173
    }
 
 
174
 
 
 
175
    *data_start = 0; // double 0-byte terminator
 
 
176
}
 
 
177
 
 
 
178
size_t Environment_Game_Mode_Header_Chunk::size_chunk ()
 
 
179
{
 
 
180
    chunk_size = 12 + 20 + mode_identifier.size() + 1 ;
 
 
181
 
 
 
182
    std::list<std::string>::iterator it = rif_files.begin();
 
 
183
 
 
 
184
    for (; it != rif_files.end(); it++)
 
 
185
        chunk_size += (*it).size() + 1;
 
 
186
 
 
 
187
    chunk_size += 4; // 1 byte terminator, 3(max) to pad
 
 
188
    chunk_size &= ~3;
 
 
189
 
 
 
190
return chunk_size;
 
 
191
}
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
4b825dc642cb6eb9a060e54bf8d69288fbee490494a6641b73026d662261604d7d192beae70b11dc
 
 
1
#ifndef _animchnk_hpp
 
 
2
#define _animchnk_hpp
 
 
3
#include "chunk.hpp"
 
 
4
 
 
 
5
struct FrameList;
 
 
6
 
 
 
7
struct TEXANIM
 
 
8
{
 
 
9
    TEXANIM(TEXANIM*);
 
 
10
    TEXANIM();
 
 
11
    ~TEXANIM();
 
 
12
 
 
 
13
    int shape;
 
 
14
    int poly;
 
 
15
    int NumVerts;
 
 
16
    int ID;
 
 
17
    int NumSeq;//number of sequences
 
 
18
    int CurSeq;
 
 
19
    int AnimFlags;
 
 
20
    int Identifier;
 
 
21
    FrameList** Seq;
 
 
22
 
 
 
23
    void CopyAnimData(TEXANIM* ta,int* conv);
 
 
24
};
 
 
25
 
 
 
26
class Animation_Chunk : public Chunk
 
 
27
{
 
 
28
public :
 
 
29
    Animation_Chunk(Chunk_With_Children* parent,const char*,size_t);
 
 
30
    Animation_Chunk(Chunk_With_Children* parent):Chunk(parent, "TEXTANIM"),NumPolys(0),AnimList(0) {}
 
 
31
 
 
 
32
    ~Animation_Chunk();
 
 
33
 
 
 
34
    virtual size_t size_chunk();
 
 
35
    virtual void fill_data_block(char* data_start);
 
 
36
 
 
 
37
    int NumPolys; //with animation in this shape
 
 
38
    TEXANIM** AnimList;
 
 
39
};
 
 
40
 
 
 
41
#define txa_flag_nointerptofirst 0x80000000
 
 
42
 
 
 
43
struct FrameList
 
 
44
{
 
 
45
    ~FrameList();
 
 
46
    FrameList(TEXANIM*);
 
 
47
    FrameList(TEXANIM* p,FrameList* fl,int* conv);
 
 
48
    int Speed;
 
 
49
    int Flags;
 
 
50
 
 
 
51
    int NumFrames;
 
 
52
    int CurFrame;
 
 
53
    TEXANIM* parent;
 
 
54
 
 
 
55
    int* Textures;
 
 
56
    int* UVCoords;
 
 
57
    int spare1,spare2;
 
 
58
};
 
 
59
 
 
 
60
#define AnimFlag_NotPlaying 0x00000001
 
 
61
 
 
 
62
#endif
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
4b825dc642cb6eb9a060e54bf8d69288fbee490494a6641b73026d662261604d7d192beae70b11dc
 
 
1
indLandscapePolygonsInObjectsPa z buffe weapon landscape
 
 
2
destroyed_but_preserved
 
 
3
ew_NPC_IsObstructe
 
 
4
 
 
 
5
Extreme_Gibbing ONE_FIXED
 
 
6
 
 
 
7
players weapon extets displayblock
 
 
8
NPC_IsDead
 
 
9
AlienIsAwareOfTarget
 
 
10
 
 
 
11
nitXenoMorphRoom
 
 
12
xenoborg HandleWeaponImpact1( far behave error process ins section bug
 
 
13
I_BehaviourDormantPredator
 
 
14
ockable_Chunk_With_Childr
 
 
15
etupPolygonAccessFromShapeIndex
 
 
16
new_predator->health
 
 
17
 
 
 
18
CheckForRayIntersectionWithObject /jadda
 
 
19
 
 
 
20
fix debris visual
 
 
21
CheckForObjectsInWate make splash with aleins/predatros
 
 
22
enable cheats/bonus in menu for all levels
 
 
23
 
 
 
24
CalculateTorqueAtPoint
 
 
25
IgnoreThePlaye
 
 
26
reserve_until_end_of_leve not modules remove
 
 
27
AnythingNearProxDoor
 
 
28
predator stop bleading medikit marine can follow predator blood path
 
 
29
alin random timer sniff module to slow them down
 
 
30
xplosion_SoundDat
 
 
31
HtoHDamageToHModel
 
 
32
three_dot
 
 
33
MakeHierarchicalDebris
 
 
34
ApplyGravity
 
 
35
DeleteLightBlock object.c
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff