|
@@ -63,21 +63,20 @@ OpenRaider *OpenRaider::Instance()
|
63
|
63
|
}
|
64
|
64
|
|
65
|
65
|
|
66
|
|
-void killOpenRaiderSingleton()
|
67
|
|
-{
|
|
66
|
+void killOpenRaiderSingleton() {
|
68
|
67
|
killNetworkSingleton();
|
69
|
68
|
|
70
|
69
|
printf("Shutting down Game...\n");
|
71
|
70
|
|
72
|
71
|
// Requires public deconstructor
|
73
|
|
- // Causes pointer-being-freed-not-allocated error!
|
|
72
|
+ //! \fixme Causes pointer-being-freed-not-allocated error!
|
74
|
73
|
//delete OpenRaider::Instance();
|
75
|
|
-#warning "Can't delete OpenRaider::Instance() without a not-allocated-free error. Something is fishy here..."
|
76
|
74
|
|
77
|
75
|
printf("\nThanks for testing %s\n", VERSION);
|
78
|
76
|
printf("Build date: %s @ %s\n", __DATE__, __TIME__);
|
79
|
77
|
printf("Build host: %s\n", BUILD_HOST);
|
80
|
78
|
printf("Web site : http://github.com/xythobuz/OpenRaider\n");
|
|
79
|
+ printf("Contact : xythobuz@xythobuz.de");
|
81
|
80
|
}
|
82
|
81
|
|
83
|
82
|
|
|
@@ -116,33 +115,26 @@ OpenRaider::OpenRaider() : SDLSystem()
|
116
|
115
|
}
|
117
|
116
|
|
118
|
117
|
|
119
|
|
-OpenRaider::~OpenRaider()
|
120
|
|
-{
|
|
118
|
+OpenRaider::~OpenRaider() {
|
121
|
119
|
/*! \fixme GL call to critical section,
|
122
|
120
|
* needs mutex really -- Mongoose 2002.01.02
|
123
|
121
|
*/
|
124
|
122
|
m_render.setMode(Render::modeDisabled);
|
125
|
|
- sleep(1);
|
|
123
|
+ //sleep(1);
|
126
|
124
|
|
127
|
125
|
printf("Removing World...\n");
|
128
|
126
|
gWorld.destroy();
|
129
|
127
|
|
130
|
128
|
printf("Cleaning up...\n");
|
131
|
129
|
|
132
|
|
- for (mMapList.start(); mMapList.forward(); mMapList.next())
|
133
|
|
- {
|
|
130
|
+ for (mMapList.start(); mMapList.forward(); mMapList.next()) {
|
134
|
131
|
if (mMapList.current())
|
135
|
|
- {
|
136
|
132
|
delete [] mMapList.current();
|
137
|
|
- }
|
138
|
133
|
}
|
139
|
134
|
|
140
|
|
- for (mMusicList.start(); mMusicList.forward(); mMusicList.next())
|
141
|
|
- {
|
|
135
|
+ for (mMusicList.start(); mMusicList.forward(); mMusicList.next()) {
|
142
|
136
|
if (mMusicList.current())
|
143
|
|
- {
|
144
|
137
|
delete [] mMusicList.current();
|
145
|
|
- }
|
146
|
138
|
}
|
147
|
139
|
|
148
|
140
|
if (m_pakDir)
|
|
@@ -182,18 +174,16 @@ void eventAnimTest(int anim)
|
182
|
174
|
}
|
183
|
175
|
|
184
|
176
|
|
185
|
|
-void percent_callback(int p)
|
186
|
|
-{
|
|
177
|
+void percent_callback(int p) {
|
187
|
178
|
OpenRaider &game = *OpenRaider::Instance();
|
188
|
179
|
|
189
|
|
- switch (p)
|
190
|
|
- {
|
|
180
|
+ switch (p) {
|
191
|
181
|
case 10:
|
192
|
182
|
game.print(true, "Level textures loaded");
|
193
|
183
|
break;
|
194
|
184
|
default:
|
195
|
|
- // %% has problems with OpenRaider::print it seems
|
196
|
|
- game.print(false, "Level pak %i/100 loaded", p);
|
|
185
|
+ game.print(false, "Level pak %i%% loaded", p);
|
|
186
|
+ break;
|
197
|
187
|
}
|
198
|
188
|
}
|
199
|
189
|
|
|
@@ -832,7 +822,7 @@ void OpenRaider::print(bool dump_stdout, const char *format, ...)
|
832
|
822
|
return;
|
833
|
823
|
}
|
834
|
824
|
|
835
|
|
- // Strip message of an trailing carrage return
|
|
825
|
+ // Strip message of trailing newline
|
836
|
826
|
if (buffer[l-1] == '\n')
|
837
|
827
|
{
|
838
|
828
|
buffer[l-1] = 0;
|
|
@@ -853,7 +843,7 @@ void OpenRaider::print(bool dump_stdout, const char *format, ...)
|
853
|
843
|
va_end(args);
|
854
|
844
|
|
855
|
845
|
// Mongoose 2002.08.14, Currently, you must request
|
856
|
|
- // frame redraws in this mode
|
|
846
|
+ // frame redraws in this mode
|
857
|
847
|
if (m_flags & OpenRaider_Loading)
|
858
|
848
|
{
|
859
|
849
|
gameFrame();
|
|
@@ -921,7 +911,7 @@ void OpenRaider::start()
|
921
|
911
|
m_render.setMode(Render::modeLoadScreen);
|
922
|
912
|
|
923
|
913
|
// Mongoose 2002.01.02, Load external audio tracks and fx
|
924
|
|
- // General audio init
|
|
914
|
+ // General audio init
|
925
|
915
|
initSound();
|
926
|
916
|
|
927
|
917
|
// Old room movement
|
|
@@ -1518,7 +1508,7 @@ void OpenRaider::processMoveables()
|
1518
|
1508
|
switch ((int)moveable[i].object_id)
|
1519
|
1509
|
{
|
1520
|
1510
|
case 30:
|
1521
|
|
- case 2: // Which tr needs this as model agian?
|
|
1511
|
+ case 2: // Which tr needs this as model again?
|
1522
|
1512
|
processMoveable(i, i, &ent, cache2, cache,
|
1523
|
1513
|
(int)moveable[i].object_id);
|
1524
|
1514
|
break;
|
|
@@ -2832,7 +2822,7 @@ void OpenRaider::processRoom(int index)
|
2832
|
2822
|
fflush(stdout);
|
2833
|
2823
|
}
|
2834
|
2824
|
|
2835
|
|
-
|
|
2825
|
+//! \fixme Use rc_get_bool consistently!
|
2836
|
2826
|
void OpenRaider::consoleCommand(char *cmd)
|
2837
|
2827
|
{
|
2838
|
2828
|
if (!cmd || !cmd[0])
|
|
@@ -3223,14 +3213,12 @@ void OpenRaider::consoleCommand(char *cmd)
|
3223
|
3213
|
}
|
3224
|
3214
|
else if (rc_command("sshot", cmd))
|
3225
|
3215
|
{
|
3226
|
|
- char sfilename[1024];
|
3227
|
3216
|
char *tmp = fullPath("~/.OpenRaider/sshots/", '/');
|
3228
|
|
-
|
3229
|
|
- /* Not very pretty, but gets it done */
|
3230
|
|
- snprintf(sfilename, 1024, "%s%s", tmp, VERSION);
|
3231
|
|
- delete [] tmp;
|
|
3217
|
+ char *sfilename = bufferString("%s%s", tmp, VERSION);
|
3232
|
3218
|
m_render.screenShot(sfilename);
|
3233
|
|
- print(false, "Took screenshot");
|
|
3219
|
+ delete [] tmp;
|
|
3220
|
+ delete [] sfilename;
|
|
3221
|
+ print(true, "Took screenshot");
|
3234
|
3222
|
}
|
3235
|
3223
|
else if (rc_command("fullscreen", cmd))
|
3236
|
3224
|
{
|