Thomas Buck 11 years ago
parent
commit
781c888173
1 changed files with 20 additions and 32 deletions
  1. 20
    32
      src/OpenRaider.cpp

+ 20
- 32
src/OpenRaider.cpp View File

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

Loading…
Cancel
Save