~flosoft/s25rttr/trunk

« back to all changes in this revision

Viewing changes to src/dskCredits.cpp

  • Committer: FloSoft
  • Date: 2014-04-25 15:35:50 UTC
  • Revision ID: flosoft@siedler25.org-20140425153550-9muu4vodhlqu58m0
committing subversion revision 9357 by FloSoft
astyle

modified:
s25client/trunk/
s25client/trunk/contrib/lua/lin32/include/
s25client/trunk/contrib/lua/lin64/include/
s25client/trunk/contrib/lua/mac/include/
s25client/trunk/contrib/lua/win32/include/
s25client/trunk/contrib/lua/win64/include/
s25client/trunk/driver/audio/SDL/src/
s25client/trunk/driver/src/
s25client/trunk/driver/video/GLFW/src/
s25client/trunk/driver/video/SDL/src/
s25client/trunk/driver/video/WinAPI/src/
s25client/trunk/src/
s25client/trunk/win32/
s25client/trunk/win32/prebuild-mutex/src/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: dskCredits.cpp 9199 2014-02-27 10:21:26Z marcus $
 
1
// $Id: dskCredits.cpp 9357 2014-04-25 15:35:25Z FloSoft $
2
2
//
3
3
// Copyright (c) 2005 - 2011 Settlers Freaks (sf-team at siedler25.org)
4
4
//
33
33
#include "JobConsts.h"
34
34
 
35
35
#include <cstdlib>
36
 
#include <ctime> 
 
36
#include <ctime>
37
37
 
38
38
///////////////////////////////////////////////////////////////////////////////
39
39
// Makros / Defines
40
40
#if defined _WIN32 && defined _DEBUG && defined _MSC_VER
41
 
        #define new new(_NORMAL_BLOCK, THIS_FILE, __LINE__)
42
 
        #undef THIS_FILE
43
 
        static char THIS_FILE[] = __FILE__;
 
41
#define new new(_NORMAL_BLOCK, THIS_FILE, __LINE__)
 
42
#undef THIS_FILE
 
43
static char THIS_FILE[] = __FILE__;
44
44
#endif
45
45
 
46
46
///////////////////////////////////////////////////////////////////////////////
65
65
 */
66
66
dskCredits::dskCredits(void) : Desktop(LOADER.GetImageN("setup013", 0))
67
67
{
68
 
        // Zurück
69
 
        AddTextButton(0, 300, 550, 200, 22,   TC_RED1, _("Back"),NormalFont);
70
 
 
71
 
        // "Die Siedler II.5 RTTR"
72
 
        AddText(1, 400, 10, _("Return To The Roots"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER, LargeFont);
73
 
 
74
 
        // "Credits"
75
 
        AddText(2, 400, 33, _("Credits"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER, LargeFont);
76
 
        
77
 
        CreditsEntry entry = CreditsEntry();
78
 
        entry.title = "Florian Doersch (FloSoft):";
79
 
        entry.picId = 1;
80
 
        entry.lastLine = "";
81
 
        entry.lines.push_back(CreditsEntry::Line(_("Project management")));
82
 
        entry.lines.push_back(CreditsEntry::Line(_("Server management")));
83
 
        entry.lines.push_back(CreditsEntry::Line(_("Programming")));
84
 
        entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
85
 
        entry.lines.push_back(CreditsEntry::Line(_("Website Programming")));
86
 
        entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
87
 
 
88
 
        this->entries.push_back(entry);
89
 
        entry.lines.clear();
90
 
 
91
 
        entry.title = "Oliver Siebert (Oliverr):";
92
 
        entry.picId = 4;
93
 
        entry.lastLine = "";
94
 
        entry.lines.push_back(CreditsEntry::Line(_("Project management")));
95
 
        entry.lines.push_back(CreditsEntry::Line(_("Programming")));
96
 
        entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
97
 
 
98
 
        this->entries.push_back(entry);
99
 
        entry.lines.clear();
100
 
 
101
 
        entry.title = "Stefan Schüchl (Z-Stef):";
102
 
        entry.picId = 6;
103
 
        entry.lastLine = "";
104
 
        entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
105
 
        entry.lines.push_back(CreditsEntry::Line(_("Website Programming")));
106
 
 
107
 
        this->entries.push_back(entry);
108
 
        entry.lines.clear();
109
 
 
110
 
        entry.title = "Patrick Haak (Demophobie):";
111
 
        entry.picId = 0;
112
 
        entry.lastLine = "";
113
 
        entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
114
 
        entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
115
 
 
116
 
        this->entries.push_back(entry);
117
 
        entry.lines.clear();
118
 
 
119
 
        entry.title = "Jonas Trampe (NastX):";
120
 
        entry.picId = 3;
121
 
        entry.lastLine = "";
122
 
        entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
123
 
        entry.lines.push_back(CreditsEntry::Line(_("Mapping")));
124
 
 
125
 
        this->entries.push_back(entry);
126
 
        entry.lines.clear();
127
 
 
128
 
        entry.title = "Jan-Henrik Kluth (jh):";
129
 
        entry.picId = 2;
130
 
        entry.lastLine = "";
131
 
        entry.lines.push_back(CreditsEntry::Line(_("Programming")));
132
 
        entry.lines.push_back(CreditsEntry::Line(_("Artificial Intelligence (AI)")));
133
 
 
134
 
        this->entries.push_back(entry);
135
 
        entry.lines.clear();
136
 
 
137
 
        entry.title = "Christopher Kuehnel (Spikeone):";
138
 
        entry.picId = 5;
139
 
        entry.lastLine = "";
140
 
        entry.lines.push_back(CreditsEntry::Line(_("Additional graphics")));
141
 
        entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
142
 
        entry.lines.push_back(CreditsEntry::Line(_("Mapping")));
143
 
 
144
 
        this->entries.push_back(entry);
145
 
        entry.lines.clear();
146
 
 
147
 
        entry.title = "Marcus Ströbel (Maqs):";
148
 
        entry.picId = -1;
149
 
        entry.lastLine = "";
150
 
        entry.lines.push_back(CreditsEntry::Line(_("Programming")));
151
 
        entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
152
 
 
153
 
        this->entries.push_back(entry);
154
 
        entry.lines.clear();
155
 
 
156
 
        entry.title = _("Additional Programming:");
157
 
        entry.picId = -1;
158
 
        entry.lastLine = "";
159
 
        entry.lines.push_back(CreditsEntry::Line("Siegfried Oleg Pammer (siegi44)"));
160
 
        entry.lines.push_back(CreditsEntry::Line("Lienhart Woitok (liwo)"));
161
 
        entry.lines.push_back(CreditsEntry::Line("Christoph Erhardt (Airhardt)"));
162
 
        entry.lines.push_back(CreditsEntry::Line("Divan"));
163
 
        entry.lines.push_back(CreditsEntry::Line("Cat666"));
164
 
        entry.lines.push_back(CreditsEntry::Line("Devil"));
165
 
        entry.lines.push_back(CreditsEntry::Line("Ikhar Beq (PoC)"));
166
 
 
167
 
        this->entries.push_back(entry);
168
 
        entry.lines.clear();
169
 
 
170
 
        entry.title = _("Additional Graphics:");
171
 
        entry.picId = -1;
172
 
        entry.lastLine = "";
173
 
        entry.lines.push_back(CreditsEntry::Line("Marcus Bullin (Parasit)"));
174
 
 
175
 
        this->entries.push_back(entry);
176
 
        entry.lines.clear();
177
 
 
178
 
        entry.title = _("Other Support:");
179
 
        entry.picId = -1;
180
 
        entry.lastLine = "";
181
 
        entry.lines.push_back(CreditsEntry::Line("muhahahaha"));
182
 
        entry.lines.push_back(CreditsEntry::Line("Sotham"));
183
 
        entry.lines.push_back(CreditsEntry::Line("Fenan"));
184
 
        entry.lines.push_back(CreditsEntry::Line("Phil Groenewold (Phil333)"));
185
 
        entry.lines.push_back(CreditsEntry::Line("Marc Vester (xaser)"));
186
 
 
187
 
        this->entries.push_back(entry);
188
 
        entry.lines.clear();
189
 
 
190
 
        entry.title = _("Donators");
191
 
        entry.picId = -1;
192
 
        entry.lines.push_back(CreditsEntry::Line(_("various anonymous donators")));
193
 
        entry.lines.push_back(CreditsEntry::Line("Markus Becker"));
194
 
        entry.lines.push_back(CreditsEntry::Line("Karsten Backhaus (K-Duke)"));
195
 
        entry.lines.push_back(CreditsEntry::Line("Patrick Haak (Demophobie)"));
196
 
        entry.lines.push_back(CreditsEntry::Line("Gilles Bordelais"));
197
 
        entry.lines.push_back(CreditsEntry::Line("Dominic Jonas"));
198
 
        entry.lines.push_back(CreditsEntry::Line("Rene Hopf"));
199
 
        entry.lines.push_back(CreditsEntry::Line("Christopher Kuehnel (Spikeone)"));
200
 
        entry.lines.push_back(CreditsEntry::Line("Philipp Strathausen"));
201
 
 
202
 
        entry.lines.push_back(CreditsEntry::Line("Max Skuratov", 1));
203
 
        entry.lines.push_back(CreditsEntry::Line("Marius Loewe", 1));
204
 
        entry.lines.push_back(CreditsEntry::Line("Eric Lutter", 1));
205
 
        entry.lines.push_back(CreditsEntry::Line("Bob Kromonos Achten", 1));
206
 
        entry.lines.push_back(CreditsEntry::Line("morlock", 1));
207
 
        entry.lines.push_back(CreditsEntry::Line("Hans Gabathuler", 1));
208
 
        entry.lines.push_back(CreditsEntry::Line("Jan Montag", 1));
209
 
        entry.lines.push_back(CreditsEntry::Line("Patrick Schefczyk", 1));
210
 
        entry.lastLine = _("Thank you for your donations!");
211
 
 
212
 
        this->entries.push_back(entry);
213
 
        entry.lines.clear();
214
 
 
215
 
        entry.title = _("We hope you enjoy playing Return To The Roots!");
216
 
        entry.picId = -1;
217
 
        entry.lines.push_back(CreditsEntry::Line(_("Thank you!")));
218
 
        entry.lastLine = _("THE END");
219
 
 
220
 
        this->entries.push_back(entry);
221
 
        entry.lines.clear();
222
 
 
223
 
        bool nations[NATION_COUNT] = { true, true, true, true, false };
224
 
 
225
 
        LOADER.LoadFilesAtGame(0, nations);
226
 
 
227
 
        this->it = entries.begin();
228
 
        startTime = bobTime = bobSpawnTime = VideoDriverWrapper::inst().GetTickCount();
229
 
        
230
 
        GetMusic(sng_lst, 8)->Play(0);
 
68
    // Zurück
 
69
    AddTextButton(0, 300, 550, 200, 22,   TC_RED1, _("Back"), NormalFont);
 
70
 
 
71
    // "Die Siedler II.5 RTTR"
 
72
    AddText(1, 400, 10, _("Return To The Roots"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER, LargeFont);
 
73
 
 
74
    // "Credits"
 
75
    AddText(2, 400, 33, _("Credits"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER, LargeFont);
 
76
 
 
77
    CreditsEntry entry = CreditsEntry();
 
78
    entry.title = "Florian Doersch (FloSoft):";
 
79
    entry.picId = 1;
 
80
    entry.lastLine = "";
 
81
    entry.lines.push_back(CreditsEntry::Line(_("Project management")));
 
82
    entry.lines.push_back(CreditsEntry::Line(_("Server management")));
 
83
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
 
84
    entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
 
85
    entry.lines.push_back(CreditsEntry::Line(_("Website Programming")));
 
86
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
 
87
 
 
88
    this->entries.push_back(entry);
 
89
    entry.lines.clear();
 
90
 
 
91
    entry.title = "Oliver Siebert (Oliverr):";
 
92
    entry.picId = 4;
 
93
    entry.lastLine = "";
 
94
    entry.lines.push_back(CreditsEntry::Line(_("Project management")));
 
95
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
 
96
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
 
97
 
 
98
    this->entries.push_back(entry);
 
99
    entry.lines.clear();
 
100
 
 
101
    entry.title = "Stefan Schüchl (Z-Stef):";
 
102
    entry.picId = 6;
 
103
    entry.lastLine = "";
 
104
    entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
 
105
    entry.lines.push_back(CreditsEntry::Line(_("Website Programming")));
 
106
 
 
107
    this->entries.push_back(entry);
 
108
    entry.lines.clear();
 
109
 
 
110
    entry.title = "Patrick Haak (Demophobie):";
 
111
    entry.picId = 0;
 
112
    entry.lastLine = "";
 
113
    entry.lines.push_back(CreditsEntry::Line(_("Website Administration")));
 
114
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
 
115
 
 
116
    this->entries.push_back(entry);
 
117
    entry.lines.clear();
 
118
 
 
119
    entry.title = "Jonas Trampe (NastX):";
 
120
    entry.picId = 3;
 
121
    entry.lastLine = "";
 
122
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
 
123
    entry.lines.push_back(CreditsEntry::Line(_("Mapping")));
 
124
 
 
125
    this->entries.push_back(entry);
 
126
    entry.lines.clear();
 
127
 
 
128
    entry.title = "Jan-Henrik Kluth (jh):";
 
129
    entry.picId = 2;
 
130
    entry.lastLine = "";
 
131
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
 
132
    entry.lines.push_back(CreditsEntry::Line(_("Artificial Intelligence (AI)")));
 
133
 
 
134
    this->entries.push_back(entry);
 
135
    entry.lines.clear();
 
136
 
 
137
    entry.title = "Christopher Kuehnel (Spikeone):";
 
138
    entry.picId = 5;
 
139
    entry.lastLine = "";
 
140
    entry.lines.push_back(CreditsEntry::Line(_("Additional graphics")));
 
141
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
 
142
    entry.lines.push_back(CreditsEntry::Line(_("Mapping")));
 
143
 
 
144
    this->entries.push_back(entry);
 
145
    entry.lines.clear();
 
146
 
 
147
    entry.title = "Marcus Ströbel (Maqs):";
 
148
    entry.picId = -1;
 
149
    entry.lastLine = "";
 
150
    entry.lines.push_back(CreditsEntry::Line(_("Programming")));
 
151
    entry.lines.push_back(CreditsEntry::Line(_("Quality Assurance")));
 
152
 
 
153
    this->entries.push_back(entry);
 
154
    entry.lines.clear();
 
155
 
 
156
    entry.title = _("Additional Programming:");
 
157
    entry.picId = -1;
 
158
    entry.lastLine = "";
 
159
    entry.lines.push_back(CreditsEntry::Line("Siegfried Oleg Pammer (siegi44)"));
 
160
    entry.lines.push_back(CreditsEntry::Line("Lienhart Woitok (liwo)"));
 
161
    entry.lines.push_back(CreditsEntry::Line("Christoph Erhardt (Airhardt)"));
 
162
    entry.lines.push_back(CreditsEntry::Line("Divan"));
 
163
    entry.lines.push_back(CreditsEntry::Line("Cat666"));
 
164
    entry.lines.push_back(CreditsEntry::Line("Devil"));
 
165
    entry.lines.push_back(CreditsEntry::Line("Ikhar Beq (PoC)"));
 
166
 
 
167
    this->entries.push_back(entry);
 
168
    entry.lines.clear();
 
169
 
 
170
    entry.title = _("Additional Graphics:");
 
171
    entry.picId = -1;
 
172
    entry.lastLine = "";
 
173
    entry.lines.push_back(CreditsEntry::Line("Marcus Bullin (Parasit)"));
 
174
 
 
175
    this->entries.push_back(entry);
 
176
    entry.lines.clear();
 
177
 
 
178
    entry.title = _("Other Support:");
 
179
    entry.picId = -1;
 
180
    entry.lastLine = "";
 
181
    entry.lines.push_back(CreditsEntry::Line("muhahahaha"));
 
182
    entry.lines.push_back(CreditsEntry::Line("Sotham"));
 
183
    entry.lines.push_back(CreditsEntry::Line("Fenan"));
 
184
    entry.lines.push_back(CreditsEntry::Line("Phil Groenewold (Phil333)"));
 
185
    entry.lines.push_back(CreditsEntry::Line("Marc Vester (xaser)"));
 
186
 
 
187
    this->entries.push_back(entry);
 
188
    entry.lines.clear();
 
189
 
 
190
    entry.title = _("Donators");
 
191
    entry.picId = -1;
 
192
    entry.lines.push_back(CreditsEntry::Line(_("various anonymous donators")));
 
193
    entry.lines.push_back(CreditsEntry::Line("Markus Becker"));
 
194
    entry.lines.push_back(CreditsEntry::Line("Karsten Backhaus (K-Duke)"));
 
195
    entry.lines.push_back(CreditsEntry::Line("Patrick Haak (Demophobie)"));
 
196
    entry.lines.push_back(CreditsEntry::Line("Gilles Bordelais"));
 
197
    entry.lines.push_back(CreditsEntry::Line("Dominic Jonas"));
 
198
    entry.lines.push_back(CreditsEntry::Line("Rene Hopf"));
 
199
    entry.lines.push_back(CreditsEntry::Line("Christopher Kuehnel (Spikeone)"));
 
200
    entry.lines.push_back(CreditsEntry::Line("Philipp Strathausen"));
 
201
 
 
202
    entry.lines.push_back(CreditsEntry::Line("Max Skuratov", 1));
 
203
    entry.lines.push_back(CreditsEntry::Line("Marius Loewe", 1));
 
204
    entry.lines.push_back(CreditsEntry::Line("Eric Lutter", 1));
 
205
    entry.lines.push_back(CreditsEntry::Line("Bob Kromonos Achten", 1));
 
206
    entry.lines.push_back(CreditsEntry::Line("morlock", 1));
 
207
    entry.lines.push_back(CreditsEntry::Line("Hans Gabathuler", 1));
 
208
    entry.lines.push_back(CreditsEntry::Line("Jan Montag", 1));
 
209
    entry.lines.push_back(CreditsEntry::Line("Patrick Schefczyk", 1));
 
210
    entry.lastLine = _("Thank you for your donations!");
 
211
 
 
212
    this->entries.push_back(entry);
 
213
    entry.lines.clear();
 
214
 
 
215
    entry.title = _("We hope you enjoy playing Return To The Roots!");
 
216
    entry.picId = -1;
 
217
    entry.lines.push_back(CreditsEntry::Line(_("Thank you!")));
 
218
    entry.lastLine = _("THE END");
 
219
 
 
220
    this->entries.push_back(entry);
 
221
    entry.lines.clear();
 
222
 
 
223
    bool nations[NATION_COUNT] = { true, true, true, true, false };
 
224
 
 
225
    LOADER.LoadFilesAtGame(0, nations);
 
226
 
 
227
    this->it = entries.begin();
 
228
    startTime = bobTime = bobSpawnTime = VideoDriverWrapper::inst().GetTickCount();
 
229
 
 
230
    GetMusic(sng_lst, 8)->Play(0);
231
231
}
232
232
 
233
233
///////////////////////////////////////////////////////////////////////////////
234
234
/**
235
 
 *  
 
235
 *
236
236
 *
237
237
 *  @author FloSoft
238
238
 */
242
242
 
243
243
///////////////////////////////////////////////////////////////////////////////
244
244
/**
245
 
 *  
 
245
 *
246
246
 *
247
247
 *  @author siegi44
248
248
 */
249
249
void dskCredits::Msg_PaintAfter()
250
250
{
251
 
        unsigned int time = VideoDriverWrapper::inst().GetTickCount() - startTime;
252
 
 
253
 
        if (time > PAGE_TIME) {
254
 
                ++this->it;
255
 
                if (this->it == entries.end())
256
 
                        this->it = entries.begin();
257
 
                this->startTime = VideoDriverWrapper::inst().GetTickCount();
258
 
        }
259
 
 
260
 
        // Frameratebegrenzer
261
 
        int bob_time = VideoDriverWrapper::inst().GetTickCount() - bobTime;
262
 
        int bob_prosec = 25;
263
 
 
264
 
        int bob_spawntime = VideoDriverWrapper::inst().GetTickCount() - bobSpawnTime;
265
 
        int bob_spawnprosec = 5;
266
 
 
267
 
        if(GAMEMANAGER.GetFPS() < 30)
268
 
                bob_spawnprosec = 0;
269
 
        else if(GAMEMANAGER.GetFPS() < 60)
270
 
                bob_spawnprosec = 1;
271
 
        else if(GAMEMANAGER.GetFPS() < 200)
272
 
                bob_spawnprosec = 2;
273
 
 
274
 
        // add new bob
275
 
        if ( bob_spawnprosec > 0 && bob_spawntime > (1000/bob_spawnprosec) && (int)bobs.size() < (int)(50 + VideoDriverWrapper::inst().GetScreenWidth() / 2)) 
276
 
        {
277
 
                bobSpawnTime = VideoDriverWrapper::inst().GetTickCount();
278
 
 
279
 
                Bob b = Bob();
280
 
                b.animationStep = 0;
281
 
                b.speed = 1 + rand() % 4;
282
 
 
283
 
                // links oder rechts spawnen
284
 
                if(rand() % 2 == 0)
285
 
                {
286
 
                        b.x = 0;
287
 
                        b.direction = 3;
288
 
                }
289
 
                else
290
 
                {
291
 
                        b.x = VideoDriverWrapper::inst().GetScreenWidth();
292
 
                        b.direction = 6;
293
 
                }
294
 
 
295
 
                b.color = COLORS[rand() % PLAYER_COLORS_COUNT];
296
 
                unsigned int job = rand() % 29;
297
 
 
298
 
                // exclude "headless" bobs
299
 
                if (job == 8 || job == 9 || job == 12 || job == 18) {
300
 
                        job = rand() % (WARE_TYPES_COUNT - 1);
301
 
                        b.hasWare = true;
302
 
                } else {
303
 
                        if(job == JOB_SCOUT)
304
 
                                job = 35+NATION_RTTR_TO_S2[rand() % 4]*6;
305
 
                        else if(job >= JOB_PRIVATE && job <= JOB_GENERAL)
306
 
                                job = 30+NATION_RTTR_TO_S2[rand() % 4]*6+job-JOB_PRIVATE;
307
 
                        else
308
 
                                job = JOB_CONSTS[job].jobs_bob_id;
309
 
                        b.hasWare = false;
310
 
                }
311
 
 
312
 
                b.id = job;
313
 
                b.y = GetCtrl<ctrlButton>(0)->GetY() - 20 - rand() % 150;
314
 
                bobs.push_back(b);
315
 
        }
316
 
        
317
 
        // draw bobs
318
 
        for (std::list<Bob>::iterator bob = bobs.begin(); bob != bobs.end(); ++bob) {
319
 
                if (!bob->hasWare)
320
 
                        Loader::inst().GetBobN("jobs")->Draw(bob->id, bob->direction, bob->isFat, bob->animationStep, bob->x, bob->y, bob->color);
321
 
                else
322
 
                        Loader::inst().GetBobN("carrier")->Draw(bob->id, bob->direction, bob->isFat, bob->animationStep, bob->x, bob->y, bob->color);
323
 
                
324
 
                if( bob_time > (1000/bob_prosec) )
325
 
                {
326
 
                        bobTime = VideoDriverWrapper::inst().GetTickCount();
327
 
 
328
 
                        bob->animationStep++;
329
 
                        if (bob->animationStep > 7)
330
 
                                bob->animationStep = 0;
331
 
                        if (bob->direction == 3) {
332
 
                                bob->x += bob->speed;
333
 
                                if (bob->x > VideoDriverWrapper::inst().GetScreenWidth())
334
 
                                        bob->direction = 6;
335
 
                        } else if (bob->direction == 6) {
336
 
                                bob->x -= bob->speed;
337
 
                                if (bob->x < 0)
338
 
                                        bob->direction = 3;
339
 
                        }
340
 
                }
341
 
        }
342
 
 
343
 
        // Frameratebegrenzer aktualisieren
344
 
        if( bob_time > (1000/bob_prosec) )
345
 
                bobTime = VideoDriverWrapper::inst().GetTickCount();
346
 
 
347
 
        // calculate text transparency
348
 
        unsigned transparency = 0xFF;
349
 
 
350
 
        if(time < FADING_TIME)
351
 
                transparency = 0xFF * time / FADING_TIME;
352
 
        if (time > PAGE_TIME-FADING_TIME)
353
 
                transparency = (0xFF - 0xFF*(time-(PAGE_TIME-FADING_TIME))/FADING_TIME);
354
 
 
355
 
        if (time > PAGE_TIME)
356
 
                transparency = 0;
357
 
 
358
 
        transparency=transparency<<24;
359
 
 
360
 
        // draw text
361
 
        LargeFont->Draw(40, 100, it->title, 0, (COLOR_RED & 0x00FFFFFF) | transparency);
362
 
 
363
 
        unsigned int y[2] = {150, 150};
364
 
 
365
 
        for(std::list<CreditsEntry::Line>::iterator line = this->it->lines.begin(); line != it->lines.end(); ++line)
366
 
        {
367
 
                LargeFont->Draw(60 + line->column * 350, y[line->column], line->line.c_str(), 0, (COLOR_YELLOW & 0x00FFFFFF) | transparency);
368
 
                y[line->column] += LargeFont->getHeight() + 5;
369
 
        }
370
 
        
371
 
        LargeFont->Draw(40, y[0] + 20, it->lastLine, 0, (COLOR_RED & 0x00FFFFFF) | transparency);
372
 
 
373
 
        // draw picture
374
 
        glArchivItem_Bitmap *item = LOADER.GetImageN("credits", it->picId);
375
 
        
376
 
        if (item)
377
 
                item->Draw(VideoDriverWrapper::inst().GetScreenWidth() - 300, 70, 0, 0, 0, 0, 0, 0, (COLOR_WHITE & 0x00FFFFFF) | transparency);
 
251
    unsigned int time = VideoDriverWrapper::inst().GetTickCount() - startTime;
 
252
 
 
253
    if (time > PAGE_TIME)
 
254
    {
 
255
        ++this->it;
 
256
        if (this->it == entries.end())
 
257
            this->it = entries.begin();
 
258
        this->startTime = VideoDriverWrapper::inst().GetTickCount();
 
259
    }
 
260
 
 
261
    // Frameratebegrenzer
 
262
    int bob_time = VideoDriverWrapper::inst().GetTickCount() - bobTime;
 
263
    int bob_prosec = 25;
 
264
 
 
265
    int bob_spawntime = VideoDriverWrapper::inst().GetTickCount() - bobSpawnTime;
 
266
    int bob_spawnprosec = 5;
 
267
 
 
268
    if(GAMEMANAGER.GetFPS() < 30)
 
269
        bob_spawnprosec = 0;
 
270
    else if(GAMEMANAGER.GetFPS() < 60)
 
271
        bob_spawnprosec = 1;
 
272
    else if(GAMEMANAGER.GetFPS() < 200)
 
273
        bob_spawnprosec = 2;
 
274
 
 
275
    // add new bob
 
276
    if ( bob_spawnprosec > 0 && bob_spawntime > (1000 / bob_spawnprosec) && (int)bobs.size() < (int)(50 + VideoDriverWrapper::inst().GetScreenWidth() / 2))
 
277
    {
 
278
        bobSpawnTime = VideoDriverWrapper::inst().GetTickCount();
 
279
 
 
280
        Bob b = Bob();
 
281
        b.animationStep = 0;
 
282
        b.speed = 1 + rand() % 4;
 
283
 
 
284
        // links oder rechts spawnen
 
285
        if(rand() % 2 == 0)
 
286
        {
 
287
            b.x = 0;
 
288
            b.direction = 3;
 
289
        }
 
290
        else
 
291
        {
 
292
            b.x = VideoDriverWrapper::inst().GetScreenWidth();
 
293
            b.direction = 6;
 
294
        }
 
295
 
 
296
        b.color = COLORS[rand() % PLAYER_COLORS_COUNT];
 
297
        unsigned int job = rand() % 29;
 
298
 
 
299
        // exclude "headless" bobs
 
300
        if (job == 8 || job == 9 || job == 12 || job == 18)
 
301
        {
 
302
            job = rand() % (WARE_TYPES_COUNT - 1);
 
303
            b.hasWare = true;
 
304
        }
 
305
        else
 
306
        {
 
307
            if(job == JOB_SCOUT)
 
308
                job = 35 + NATION_RTTR_TO_S2[rand() % 4] * 6;
 
309
            else if(job >= JOB_PRIVATE && job <= JOB_GENERAL)
 
310
                job = 30 + NATION_RTTR_TO_S2[rand() % 4] * 6 + job - JOB_PRIVATE;
 
311
            else
 
312
                job = JOB_CONSTS[job].jobs_bob_id;
 
313
            b.hasWare = false;
 
314
        }
 
315
 
 
316
        b.id = job;
 
317
        b.y = GetCtrl<ctrlButton>(0)->GetY() - 20 - rand() % 150;
 
318
        bobs.push_back(b);
 
319
    }
 
320
 
 
321
    // draw bobs
 
322
    for (std::list<Bob>::iterator bob = bobs.begin(); bob != bobs.end(); ++bob)
 
323
    {
 
324
        if (!bob->hasWare)
 
325
            Loader::inst().GetBobN("jobs")->Draw(bob->id, bob->direction, bob->isFat, bob->animationStep, bob->x, bob->y, bob->color);
 
326
        else
 
327
            Loader::inst().GetBobN("carrier")->Draw(bob->id, bob->direction, bob->isFat, bob->animationStep, bob->x, bob->y, bob->color);
 
328
 
 
329
        if( bob_time > (1000 / bob_prosec) )
 
330
        {
 
331
            bobTime = VideoDriverWrapper::inst().GetTickCount();
 
332
 
 
333
            bob->animationStep++;
 
334
            if (bob->animationStep > 7)
 
335
                bob->animationStep = 0;
 
336
            if (bob->direction == 3)
 
337
            {
 
338
                bob->x += bob->speed;
 
339
                if (bob->x > VideoDriverWrapper::inst().GetScreenWidth())
 
340
                    bob->direction = 6;
 
341
            }
 
342
            else if (bob->direction == 6)
 
343
            {
 
344
                bob->x -= bob->speed;
 
345
                if (bob->x < 0)
 
346
                    bob->direction = 3;
 
347
            }
 
348
        }
 
349
    }
 
350
 
 
351
    // Frameratebegrenzer aktualisieren
 
352
    if( bob_time > (1000 / bob_prosec) )
 
353
        bobTime = VideoDriverWrapper::inst().GetTickCount();
 
354
 
 
355
    // calculate text transparency
 
356
    unsigned transparency = 0xFF;
 
357
 
 
358
    if(time < FADING_TIME)
 
359
        transparency = 0xFF * time / FADING_TIME;
 
360
    if (time > PAGE_TIME - FADING_TIME)
 
361
        transparency = (0xFF - 0xFF * (time - (PAGE_TIME - FADING_TIME)) / FADING_TIME);
 
362
 
 
363
    if (time > PAGE_TIME)
 
364
        transparency = 0;
 
365
 
 
366
    transparency = transparency << 24;
 
367
 
 
368
    // draw text
 
369
    LargeFont->Draw(40, 100, it->title, 0, (COLOR_RED & 0x00FFFFFF) | transparency);
 
370
 
 
371
    unsigned int y[2] = {150, 150};
 
372
 
 
373
    for(std::list<CreditsEntry::Line>::iterator line = this->it->lines.begin(); line != it->lines.end(); ++line)
 
374
    {
 
375
        LargeFont->Draw(60 + line->column * 350, y[line->column], line->line.c_str(), 0, (COLOR_YELLOW & 0x00FFFFFF) | transparency);
 
376
        y[line->column] += LargeFont->getHeight() + 5;
 
377
    }
 
378
 
 
379
    LargeFont->Draw(40, y[0] + 20, it->lastLine, 0, (COLOR_RED & 0x00FFFFFF) | transparency);
 
380
 
 
381
    // draw picture
 
382
    glArchivItem_Bitmap* item = LOADER.GetImageN("credits", it->picId);
 
383
 
 
384
    if (item)
 
385
        item->Draw(VideoDriverWrapper::inst().GetScreenWidth() - 300, 70, 0, 0, 0, 0, 0, 0, (COLOR_WHITE & 0x00FFFFFF) | transparency);
378
386
}
379
387
 
380
388
///////////////////////////////////////////////////////////////////////////////
381
389
/**
382
 
 *  
 
390
 *
383
391
 *
384
392
 *  @author siegi44
385
393
 */
386
394
bool dskCredits::Close(void)
387
395
{
388
 
        WindowManager::inst().Switch(new dskMainMenu());
389
 
        return true;
 
396
    WindowManager::inst().Switch(new dskMainMenu());
 
397
    return true;
390
398
}
391
399
 
392
400
///////////////////////////////////////////////////////////////////////////////
393
401
/**
394
 
 *  
 
402
 *
395
403
 *
396
404
 *  @author siegi44
397
405
 */
398
406
bool dskCredits::Msg_KeyDown(const KeyEvent& ke)
399
407
{
400
 
        return Close();
 
408
    return Close();
401
409
}
402
410
 
403
411
 
404
412
void dskCredits::Msg_ButtonClick(const unsigned ctrl_id)
405
413
{
406
 
        Close();
 
414
    Close();
407
415
}
408
416
 
409
417
///////////////////////////////////////////////////////////////////////////////