~ubuntu-branches/ubuntu/lucid/warzone2100/lucid

« back to all changes in this revision

Viewing changes to data/base/multiplay/script/multiplay.slo

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger, Paul Wise, Christoph Egger
  • Date: 2009-06-29 17:12:52 UTC
  • mfrom: (1.1.11 upstream) (2.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090629171252-5ddnlfg3zfchrega
Tags: 2.2.1+dfsg1-1
[ Paul Wise ]
* New upstream release (Closes: #534962)
* Adjust the flex build-depends to take account of the conflict
  with all the versions of flex 2.5.34 (LP: #372872)
* Make the -music Recommends more strict, 2.1 music doesn't work
  with 2.2.
* Upstream moved the downloads to sourceforge, update the watch file
* Bump Standards-Version, no changes needed
* Drop use of dh_desktop since it no longer does anything
* Recommend the new warzone2100-video package, version 2.2 or similar
* Mention the warzone2100 crash reports in the -dbg package description

[ Christoph Egger ]
* Replace CC-2.0 graphic from cybersphinx, create a new tarball
* Add myself to uploaders

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// Multi-player script for upto 8 players.
 
3
//
 
4
 
 
5
public  STRUCTURESTAT   command;                        
 
6
public  STRUCTURESTAT   factory;                        
 
7
public  STRUCTURESTAT   wall;                   
 
8
public  STRUCTURESTAT   cornerWall;             
 
9
public  STRUCTURESTAT   oilDerrick;             
 
10
public  STRUCTURESTAT   powerGen;               
 
11
public  STRUCTURESTAT   research;
 
12
public  STRUCTURESTAT   commandrelay;
 
13
public  STRUCTURESTAT   cybfac;
 
14
public  STRUCTURESTAT   vtolfac;
 
15
 
 
16
// starting technologies.
 
17
public  int                             numtecP0, numtecP1, numtecP2, numtecP3,numtecP4, numtecP5, numtecP6, numtecP7;
 
18
public  RESEARCHSTAT    tecP0[5], tecP1[5], tecP2[5], tecP3[5], tecP4[5], tecP5[5], tecP6[5], tecP7[5];
 
19
 
 
20
public  int                             numCleanTech,   numBaseTech,    numDefTech;
 
21
public  RESEARCHSTAT    cleanTech[32],  baseTech[32],   defTech[64];
 
22
 
 
23
// research topics
 
24
public  int                             numResP0, numResP1, numResP2, numResP3, numResP4, numResP5, numResP6, numResP7;
 
25
public  RESEARCHSTAT    resP0[5], resP1[5], resP2[5], resP3[5], resP4[5], resP5[5], resP6[5], resP7[5];
 
26
 
 
27
public  int                             numCleanRes,    numBaseRes,             numDefRes;
 
28
public  RESEARCHSTAT    cleanRes[10],   baseRes[10],    defRes[10];             
 
29
 
 
30
//      Other Stuff
 
31
private INT                             count;
 
32
private INT                             playnum;
 
33
private BOOL                    gamenotwon;
 
34
 
 
35
// Base Under Attack Stuff 
 
36
private STRUCTURE               hitStruc;
 
37
private BASEOBJ                 attackerObj;
 
38
private int                             t;
 
39
public  SOUND                   attackSnd1;     
 
40
 
 
41
public  INTMESSAGE              endMsg, winMsg;
 
42
 
 
43
// /////////////////////////////////////////////////////////////////
 
44
 
 
45
trigger endConditions(every, 100);      
 
46
 
 
47
// /////////////////////////////////////////////////////////////////
 
48
//this event is called once the game has initialised itself
 
49
 
 
50
event initialisedEvent(CALL_GAMEINIT)
 
51
{
 
52
        playnum=0;
 
53
        while (playnum < 8)
 
54
        {
 
55
                if(multiPlayerBaseType == CAMP_CLEAN)
 
56
                {
 
57
                        setPowerLevel(750,playnum);     
 
58
                        count = 0;                                                              
 
59
                        while (count < numCleanTech)
 
60
                        {
 
61
                                completeResearch(cleanTech[count], playnum);
 
62
                                count = count +1;
 
63
                        }
 
64
                        
 
65
                        count = 0;
 
66
                        while (count < numCleanRes)
 
67
                        {
 
68
                                enableResearch(cleanRes[count], playnum);
 
69
                                count = count +1;
 
70
                        }
 
71
                }
 
72
                else if(multiPlayerBaseType == CAMP_BASE)
 
73
                {
 
74
                        setPowerLevel(1000,playnum);    
 
75
                        count = 0;                                                              
 
76
                        while (count < numBaseTech)
 
77
                        {
 
78
                                completeResearch(baseTech[count], playnum);
 
79
                                count = count +1;
 
80
                        }
 
81
                        count = 0;                                                              
 
82
                        while (count < numBaseRes)
 
83
                        {
 
84
                                enableResearch(baseRes[count], playnum);
 
85
                                count = count +1;
 
86
                        }
 
87
                }
 
88
                else
 
89
                {       
 
90
                        setPowerLevel(2000,playnum);            
 
91
                        count = 0;                                                              
 
92
                        while (count < numDefTech)
 
93
                        {
 
94
                                completeResearch(defTech[count], playnum);
 
95
                                count = count +1;
 
96
                        }
 
97
                        count = 0;                                                              
 
98
                        while (count < numDefRes)
 
99
                        {
 
100
                                enableResearch(defRes[count], playnum);
 
101
                                count = count +1;
 
102
                        }
 
103
                }
 
104
        
 
105
                playnum = playnum + 1;          
 
106
        }
 
107
 
 
108
}
 
109
 
 
110
 
 
111
event initialisedEvent2(CALL_GAMEINIT)
 
112
{
 
113
 
 
114
        //set up the reticule buttons
 
115
        addReticuleButton(OPTIONS);
 
116
        addReticuleButton(CANCEL);
 
117
        addReticuleButton(BUILD);
 
118
        addReticuleButton(MANUFACTURE);
 
119
        addReticuleButton(RESEARCH);
 
120
        addReticuleButton(INTELMAP);
 
121
        addReticuleButton(DESIGN);
 
122
 
 
123
        playnum=0;
 
124
        while (playnum < 8)
 
125
        {
 
126
                enableStructure(command ,       playnum);               //make structures available to build
 
127
                enableStructure(factory,        playnum);
 
128
                //enableStructure(wall,         playnum);
 
129
                //enableStructure(cornerWall,   playnum);
 
130
                enableStructure(oilDerrick,     playnum);
 
131
                enableStructure(powerGen,       playnum);
 
132
                enableStructure(research,       playnum);
 
133
                
 
134
                setStructureLimits(factory,     5, playnum);    // set structure limits
 
135
                setStructureLimits(powerGen,    5, playnum);
 
136
                setStructureLimits(research,    5, playnum);
 
137
                setStructureLimits(command,     1, playnum);
 
138
                setStructureLimits(commandrelay,1, playnum);
 
139
                setStructureLimits(cybfac,      5, playnum);
 
140
                setStructureLimits(vtolfac,     5, playnum);
 
141
 
 
142
                playnum = playnum+1;
 
143
        }
 
144
        applyLimitSet();        // set limit options
 
145
 
 
146
        // player specific technology startups
 
147
        count = 0;
 
148
        while (count < numtecP0)
 
149
        {
 
150
                completeResearch(tecP0[count], 0);
 
151
                count = count +1;
 
152
        }
 
153
        count = 0;
 
154
        while (count < numtecP1)
 
155
        {
 
156
                completeResearch(tecP1[count], 1);
 
157
                count = count +1;
 
158
        }
 
159
        count = 0;
 
160
        while (count < numtecP2)
 
161
        {
 
162
                completeResearch(tecP2[count], 2);
 
163
                count = count +1;
 
164
        }
 
165
        count = 0;
 
166
        while (count < numtecP3)
 
167
        {
 
168
                completeResearch(tecP3[count], 3);
 
169
                count = count +1;
 
170
        }
 
171
        count = 0;
 
172
        while (count < numtecP4)
 
173
        {
 
174
                completeResearch(tecP4[count], 4);
 
175
                count = count +1;
 
176
        }
 
177
        count = 0;
 
178
        while (count < numtecP5)
 
179
        {
 
180
                completeResearch(tecP5[count], 5);
 
181
                count = count +1;
 
182
        }
 
183
        count = 0;
 
184
        while (count < numtecP6)
 
185
        {
 
186
                completeResearch(tecP6[count], 6);
 
187
                count = count +1;
 
188
        }
 
189
        count = 0;
 
190
        while (count < numtecP7)
 
191
        {
 
192
                completeResearch(tecP7[count], 7);
 
193
                count = count +1;
 
194
        }
 
195
 
 
196
 
 
197
        // player specific research startups
 
198
        count = 0;
 
199
        while (count < numResP0)
 
200
        {
 
201
                enableResearch(resP0[count], 0);
 
202
                count = count +1;
 
203
        }
 
204
        count = 0;
 
205
        while (count < numResP1)
 
206
        {
 
207
                enableResearch(resP1[count], 1);
 
208
                count = count +1;
 
209
        }
 
210
        count = 0;
 
211
        while (count < numResP2)
 
212
        {
 
213
                enableResearch(resP2[count], 2);
 
214
                count = count +1;
 
215
        }
 
216
        count = 0;
 
217
        while (count < numResP3)
 
218
        {
 
219
                enableResearch(resP3[count], 3);
 
220
                count = count +1;
 
221
        }
 
222
        count = 0;
 
223
        while (count < numResP4)
 
224
        {
 
225
                enableResearch(resP4[count], 4);
 
226
                count = count +1;
 
227
        }
 
228
        count = 0;
 
229
        while (count < numResP5)
 
230
        {
 
231
                enableResearch(resP5[count], 5);
 
232
                count = count +1;
 
233
        }
 
234
        count = 0;
 
235
        while (count < numResP6)
 
236
        {
 
237
                enableResearch(resP6[count], 6);
 
238
                count = count +1;
 
239
        }
 
240
        count = 0;
 
241
        while (count < numResP7)
 
242
        {
 
243
                enableResearch(resP7[count], 7);
 
244
                count = count +1;
 
245
        }
 
246
}
 
247
 
 
248
 
 
249
 
 
250
// /////////////////////////////////////////////////////////////////
 
251
event checkEndConditions (endConditions)
 
252
{
 
253
        // Losing Conditions
 
254
//      if(        ( not (multiPlayerGameType == DMATCH))
 
255
          if(  ( not anyDroidsLeft(selectedPlayer))
 
256
          and  ( not anyFactoriesLeft(selectedPlayer))  
 
257
//        and  ( not playerInAlliance(selectedPlayer)) 
 
258
          )
 
259
        {
 
260
//              addMessage(endMsg, MISS_MSG, 0, true);
 
261
//              pause(10);
 
262
//              gameOver(FALSE);
 
263
                gameOverMessage(endMsg, MISS_MSG, 0, FALSE);
 
264
                setEventTrigger(checkEndConditions, inactive);
 
265
                exit;
 
266
        }
 
267
        
 
268
        
 
269
        // Winning Conditions
 
270
        playnum=0;
 
271
        gamenotwon = FALSE;
 
272
 
 
273
        ////////////////
 
274
        // Campaign Game
 
275
        if(multiPlayerGameType == CAMPAIGN)
 
276
        {
 
277
                // check humans are still about
 
278
                while (playnum < multiPlayerMaxPlayers)
 
279
                {
 
280
                        if (playnum != selectedPlayer)
 
281
                        {
 
282
                                if(anyDroidsLeft(playnum) or anyFactoriesLeft(playnum) )
 
283
                                {
 
284
                                        gamenotwon = TRUE;
 
285
                                }
 
286
                        }
 
287
                        playnum = playnum + 1;                  
 
288
                }
 
289
                
 
290
                //check computer/babas are wiped out completely
 
291
                while(playnum<8)
 
292
                {
 
293
                        if(not isHumanPlayer(playnum))
 
294
                        {
 
295
                                if(anyDroidsLeft(playnum) or anyStructButWallsLeft(playnum))
 
296
                                {
 
297
                                        gamenotwon = TRUE;
 
298
                                }
 
299
                        }
 
300
                        playnum = playnum + 1;                  
 
301
                }                       
 
302
        }
 
303
        
 
304
        if(gamenotwon == FALSE)
 
305
        {
 
306
//              addMessage(winMsg, MISS_MSG, 0, true);
 
307
//              pause(10);
 
308
//              gameOver(TRUE);
 
309
                gameOverMessage(winMsg, MISS_MSG, 0, TRUE);
 
310
                setEventTrigger(checkEndConditions, inactive);
 
311
        }       
 
312
}
 
313
 
 
314
// /////////////////////////////////////////////////////////////////
 
315
/* Base Under Attack */
 
316
event baseHit(CALL_STRUCT_ATTACKED, selectedPlayer, ref hitStruc, ref attackerObj)
 
317
{
 
318
        if (t >= 10)
 
319
        {
 
320
                t=0;
 
321
                if (hitStruc != NULLOBJECT)
 
322
                {
 
323
                        playSoundPos(attackSnd1, selectedPlayer, hitStruc.x, hitStruc.y, hitStruc.z);   //show position if still alive
 
324
                }
 
325
                else
 
326
                {
 
327
                        playSound(attackSnd1, selectedPlayer);
 
328
                }
 
329
        }
 
330
}
 
331
 
 
332
event everySec(every, 10)
 
333
{
 
334
        t=t+1;
 
335
}
 
336
 
 
337
//go to where the structure being attacked is on CTRL B
 
338
event seeBaseHit(CALL_MISSION_END)
 
339
{
 
340
        if (hitStruc!=NULLOBJECT)
 
341
        {
 
342
                centreView(hitStruc);
 
343
                t=0;                                                    //flag known about!
 
344
        }
 
345
}
 
346