소스 검색

Guarded interactive commands

Thomas Buck 11 년 전
부모
커밋
46acd107ba
2개의 변경된 파일32개의 추가작업 그리고 17개의 파일을 삭제
  1. 0
    17
      include/WorldData.h
  2. 32
    0
      src/OpenRaider.cpp

+ 0
- 17
include/WorldData.h 파일 보기

193
 
193
 
194
 } actor_entity_t;
194
 } actor_entity_t;
195
 
195
 
196
-enum OpenRaiderEvent {
197
-    eNone = 0,
198
-    eWeaponDischarge,
199
-    eDying,
200
-    eDead,
201
-    eWounded,
202
-    eRunForward,
203
-    eRunBackward,
204
-    eJump,
205
-    eCrouchWalk,
206
-    eIdle,
207
-    eTaunt,
208
-    eTurn,
209
-    eRespawn,
210
-    eLand
211
-};
212
-
213
 #endif
196
 #endif
214
 
197
 

+ 32
- 0
src/OpenRaider.cpp 파일 보기

141
     } else if (strcmp(command, "quit") == 0) {
141
     } else if (strcmp(command, "quit") == 0) {
142
         exit(0);
142
         exit(0);
143
     } else if (strcmp(command, "load") == 0) {
143
     } else if (strcmp(command, "load") == 0) {
144
+        if (!mRunning) {
145
+            getConsole().print("Use load command interactively!");
146
+            return -999;
147
+        }
144
         char *tmp = bufferString("%s/%s", mPakDir, args->at(0));
148
         char *tmp = bufferString("%s/%s", mPakDir, args->at(0));
145
         int error = getGame().loadLevel(tmp);
149
         int error = getGame().loadLevel(tmp);
146
         delete [] tmp;
150
         delete [] tmp;
147
         return error;
151
         return error;
148
     } else if (strcmp(command, "sshot") == 0) {
152
     } else if (strcmp(command, "sshot") == 0) {
153
+        if (!mRunning) {
154
+            getConsole().print("Use sshot command interactively!");
155
+            return -999;
156
+        }
149
         char *filename = bufferString("%s/sshots/%s", mBaseDir, VERSION);
157
         char *filename = bufferString("%s/sshots/%s", mBaseDir, VERSION);
150
         bool console = (args->size() > 0) && (strcmp(args->at(0), "console") == 0);
158
         bool console = (args->size() > 0) && (strcmp(args->at(0), "console") == 0);
151
         bool menu = (args->size() > 0) && (strcmp(args->at(0), "menu") == 0);
159
         bool menu = (args->size() > 0) && (strcmp(args->at(0), "menu") == 0);
211
             return -8;
219
             return -8;
212
         }
220
         }
213
     } else if (strcmp(command, "move") == 0) {
221
     } else if (strcmp(command, "move") == 0) {
222
+        if (!mRunning) {
223
+            getConsole().print("Use move command interactively!");
224
+            return -999;
225
+        }
214
         if (args->size() > 0) {
226
         if (args->size() > 0) {
215
             if (getGame().mLoaded) {
227
             if (getGame().mLoaded) {
216
                 char *move = args->at(0);
228
                 char *move = args->at(0);
236
             return -11;
248
             return -11;
237
         }
249
         }
238
     } else if (strcmp(command, "sound") == 0) {
250
     } else if (strcmp(command, "sound") == 0) {
251
+        if ((!mRunning) || (!getGame().mLoaded)) {
252
+            getConsole().print("Use sound command interactively!");
253
+            return -999;
254
+        }
239
         if (args->size() > 0) {
255
         if (args->size() > 0) {
240
             getSound().play(atoi(args->at(0)));
256
             getSound().play(atoi(args->at(0)));
241
         } else {
257
         } else {
243
             return -12;
259
             return -12;
244
         }
260
         }
245
     } else if (strcmp(command, "animate") == 0) {
261
     } else if (strcmp(command, "animate") == 0) {
262
+        if ((!mRunning) || (!getGame().mLoaded)) {
263
+            getConsole().print("Use animate command interactively!");
264
+            return -999;
265
+        }
246
         if (args->size() > 0) {
266
         if (args->size() > 0) {
247
             char c = args->at(0)[0];
267
             char c = args->at(0)[0];
248
             if (c == 'n') {
268
             if (c == 'n') {
340
             return -20;
360
             return -20;
341
         }
361
         }
342
     } else if (strcmp(command, "viewmodel") == 0) {
362
     } else if (strcmp(command, "viewmodel") == 0) {
363
+        if ((!mRunning) || (!getGame().mLoaded)) {
364
+            getConsole().print("Use viewmodel command interactively!");
365
+            return -999;
366
+        }
343
         if (getGame().mLara) {
367
         if (getGame().mLara) {
344
             SkeletalModel *smdl = static_cast<SkeletalModel *>(getGame().mLara->tmpHook);
368
             SkeletalModel *smdl = static_cast<SkeletalModel *>(getGame().mLara->tmpHook);
345
             skeletal_model_t *mdl = getWorld().getModel(atoi(args->at(0)));
369
             skeletal_model_t *mdl = getWorld().getModel(atoi(args->at(0)));
550
             return -45;
574
             return -45;
551
         }
575
         }
552
     } else if (strcmp(command, "pigtail") == 0) {
576
     } else if (strcmp(command, "pigtail") == 0) {
577
+        if ((!mRunning) || (!getGame().mLoaded)) {
578
+            getConsole().print("Use pigtail command interactively!");
579
+            return -999;
580
+        }
553
         if (args->size() > 0) {
581
         if (args->size() > 0) {
554
             bool b;
582
             bool b;
555
             if (readBool(args->at(0), &b) < 0) {
583
             if (readBool(args->at(0), &b) < 0) {
571
             return -47;
599
             return -47;
572
         }
600
         }
573
     } else if (strcmp(command, "ponypos") == 0) {
601
     } else if (strcmp(command, "ponypos") == 0) {
602
+        if ((!mRunning) || (!getGame().mLoaded)) {
603
+            getConsole().print("Use ponypos command interactively!");
604
+            return -999;
605
+        }
574
         if (args->size() > 3) {
606
         if (args->size() > 3) {
575
             SkeletalModel *tmp = static_cast<SkeletalModel *>(getGame().mLara->tmpHook);
607
             SkeletalModel *tmp = static_cast<SkeletalModel *>(getGame().mLara->tmpHook);
576
             tmp->model->ponytail[0] = (float)atof(args->at(0));
608
             tmp->model->ponytail[0] = (float)atof(args->at(0));

Loading…
취소
저장