22 #ifndef LASTEXPRESS_STATE_H 23 #define LASTEXPRESS_STATE_H 25 #include "lastexpress/shared.h" 27 #include "common/rect.h" 28 #include "common/serializer.h" 29 #include "common/system.h" 30 #include "common/textconsole.h" 34 class LastExpressEngine;
45 bool eventCorpseMovedFromFloor;
47 bool eventCorpseFound;
51 bool eventCorpseThrown;
70 bool eventMertensAugustWaiting;
71 bool eventMertensKronosInvitation;
95 bool eventMetBoutarel;
174 jacket = kJacketOriginal;
175 eventCorpseMovedFromFloor =
false;
177 eventCorpseFound =
false;
180 portrait = _defaultPortrait;
181 eventCorpseThrown =
false;
186 eventMetAugust =
false;
193 isTrainRunning =
false;
200 eventMertensAugustWaiting =
false;
201 eventMertensKronosInvitation =
false;
225 eventMetBoutarel =
false;
226 eventMetHadija =
false;
227 eventMetYasmin =
false;
315 return getOrSetValueName(index) == val;
318 uint32 getOrSetValueName(uint index,
Common::String *name = NULL,
const uint32* newValue = NULL) {
319 #define EXPOSE_VALUE(idx, entryName, fieldType) \ 321 if (name) (*name) = "" #entryName; \ 322 if (newValue) {entryName = (fieldType)*newValue;} \ 323 return (uint32)entryName; \ 328 error(
"[GameProgress::getValueName] Invalid index value (was: %d, max:127)", index);
331 EXPOSE_VALUE(0, field_0, uint32);
332 EXPOSE_VALUE(1, jacket, JacketType);
333 EXPOSE_VALUE(2, eventCorpseMovedFromFloor,
bool);
334 EXPOSE_VALUE(3, field_C, uint32);
335 EXPOSE_VALUE(4, eventCorpseFound,
bool);
336 EXPOSE_VALUE(5, field_14, uint32);
337 EXPOSE_VALUE(6, field_18, uint32);
338 EXPOSE_VALUE(7, portrait, uint32);
339 EXPOSE_VALUE(8, eventCorpseThrown,
bool);
340 EXPOSE_VALUE(9, field_24, uint32);
341 EXPOSE_VALUE(10, field_28, uint32);
342 EXPOSE_VALUE(11, chapter, ChapterIndex);
343 EXPOSE_VALUE(12, field_30, uint32);
344 EXPOSE_VALUE(13, eventMetAugust,
bool);
345 EXPOSE_VALUE(14, isNightTime,
bool);
346 EXPOSE_VALUE(15, field_3C, uint32);
347 EXPOSE_VALUE(16, field_40, uint32);
348 EXPOSE_VALUE(17, field_44, uint32);
349 EXPOSE_VALUE(18, field_48, uint32);
350 EXPOSE_VALUE(19, field_4C, uint32);
351 EXPOSE_VALUE(20, isTrainRunning,
bool);
352 EXPOSE_VALUE(21, field_54, uint32);
353 EXPOSE_VALUE(22, field_58, uint32);
354 EXPOSE_VALUE(23, field_5C, uint32);
355 EXPOSE_VALUE(24, field_60, uint32);
356 EXPOSE_VALUE(25, field_64, uint32);
357 EXPOSE_VALUE(26, field_68, uint32);
358 EXPOSE_VALUE(27, eventMertensAugustWaiting,
bool);
359 EXPOSE_VALUE(28, eventMertensKronosInvitation,
bool);
360 EXPOSE_VALUE(29, isEggOpen,
bool);
361 EXPOSE_VALUE(30, field_78, uint32);
362 EXPOSE_VALUE(31, field_7C, uint32);
363 EXPOSE_VALUE(32, field_80, uint32);
364 EXPOSE_VALUE(33, field_84, uint32);
365 EXPOSE_VALUE(34, field_88, uint32);
366 EXPOSE_VALUE(35, field_8C, uint32);
367 EXPOSE_VALUE(36, field_90, uint32);
368 EXPOSE_VALUE(37, field_94, uint32);
369 EXPOSE_VALUE(38, field_98, uint32);
370 EXPOSE_VALUE(39, field_9C, uint32);
371 EXPOSE_VALUE(40, field_A0, uint32);
372 EXPOSE_VALUE(41, field_A4, uint32);
373 EXPOSE_VALUE(42, field_A8, uint32);
374 EXPOSE_VALUE(43, field_AC, uint32);
375 EXPOSE_VALUE(44, field_B0, uint32);
376 EXPOSE_VALUE(45, field_B4, uint32);
377 EXPOSE_VALUE(46, field_B8, uint32);
378 EXPOSE_VALUE(47, field_BC, uint32);
379 EXPOSE_VALUE(48, field_C0, uint32);
380 EXPOSE_VALUE(49, field_C4, uint32);
381 EXPOSE_VALUE(50, field_C8, uint32);
382 EXPOSE_VALUE(51, field_CC, uint32);
383 EXPOSE_VALUE(52, eventMetBoutarel,
bool);
384 EXPOSE_VALUE(53, eventMetHadija,
bool);
385 EXPOSE_VALUE(54, eventMetYasmin,
bool);
386 EXPOSE_VALUE(55, field_DC, uint32);
387 EXPOSE_VALUE(56, field_E0, uint32);
388 EXPOSE_VALUE(57, field_E4, uint32);
389 EXPOSE_VALUE(58, field_E8, uint32);
390 EXPOSE_VALUE(59, field_EC, uint32);
391 EXPOSE_VALUE(60, field_F0, uint32);
392 EXPOSE_VALUE(61, field_F4, uint32);
393 EXPOSE_VALUE(62, field_F8, uint32);
394 EXPOSE_VALUE(63, field_FC, uint32);
395 EXPOSE_VALUE(64, field_100, uint32);
396 EXPOSE_VALUE(65, field_104, uint32);
397 EXPOSE_VALUE(66, field_108, uint32);
398 EXPOSE_VALUE(67, field_10C, uint32);
399 EXPOSE_VALUE(68, field_110, uint32);
400 EXPOSE_VALUE(69, field_114, uint32);
401 EXPOSE_VALUE(70, field_118, uint32);
402 EXPOSE_VALUE(71, field_11C, uint32);
403 EXPOSE_VALUE(72, field_120, uint32);
404 EXPOSE_VALUE(73, field_124, uint32);
405 EXPOSE_VALUE(74, field_128, uint32);
406 EXPOSE_VALUE(75, field_12C, uint32);
407 EXPOSE_VALUE(76, field_130, uint32);
408 EXPOSE_VALUE(77, field_134, uint32);
409 EXPOSE_VALUE(78, field_138, uint32);
410 EXPOSE_VALUE(79, field_13C, uint32);
411 EXPOSE_VALUE(80, field_140, uint32);
412 EXPOSE_VALUE(81, field_144, uint32);
413 EXPOSE_VALUE(82, field_148, uint32);
414 EXPOSE_VALUE(83, field_14C, uint32);
415 EXPOSE_VALUE(84, field_150, uint32);
416 EXPOSE_VALUE(85, field_154, uint32);
417 EXPOSE_VALUE(86, field_158, uint32);
418 EXPOSE_VALUE(87, field_15C, uint32);
419 EXPOSE_VALUE(88, field_160, uint32);
420 EXPOSE_VALUE(89, field_164, uint32);
421 EXPOSE_VALUE(90, field_168, uint32);
422 EXPOSE_VALUE(91, field_16C, uint32);
423 EXPOSE_VALUE(92, field_170, uint32);
424 EXPOSE_VALUE(93, field_174, uint32);
425 EXPOSE_VALUE(94, field_178, uint32);
426 EXPOSE_VALUE(95, field_17C, uint32);
427 EXPOSE_VALUE(96, field_180, uint32);
428 EXPOSE_VALUE(97, field_184, uint32);
429 EXPOSE_VALUE(98, field_188, uint32);
430 EXPOSE_VALUE(99, field_18C, uint32);
431 EXPOSE_VALUE(100, field_190, uint32);
432 EXPOSE_VALUE(101, field_194, uint32);
433 EXPOSE_VALUE(102, field_198, uint32);
434 EXPOSE_VALUE(103, field_19C, uint32);
435 EXPOSE_VALUE(104, field_1A0, uint32);
436 EXPOSE_VALUE(105, field_1A4, uint32);
437 EXPOSE_VALUE(106, field_1A8, uint32);
438 EXPOSE_VALUE(107, field_1AC, uint32);
439 EXPOSE_VALUE(108, field_1B0, uint32);
440 EXPOSE_VALUE(109, field_1B4, uint32);
441 EXPOSE_VALUE(110, field_1B8, uint32);
442 EXPOSE_VALUE(111, field_1BC, uint32);
443 EXPOSE_VALUE(112, field_1C0, uint32);
444 EXPOSE_VALUE(113, field_1C4, uint32);
445 EXPOSE_VALUE(114, field_1C8, uint32);
446 EXPOSE_VALUE(115, field_1CC, uint32);
447 EXPOSE_VALUE(116, field_1D0, uint32);
448 EXPOSE_VALUE(117, field_1D4, uint32);
449 EXPOSE_VALUE(118, field_1D8, uint32);
450 EXPOSE_VALUE(119, field_1DC, uint32);
451 EXPOSE_VALUE(120, field_1E0, uint32);
452 EXPOSE_VALUE(121, field_1E4, uint32);
453 EXPOSE_VALUE(122, field_1E8, uint32);
454 EXPOSE_VALUE(123, field_1EC, uint32);
455 EXPOSE_VALUE(124, field_1F0, uint32);
456 EXPOSE_VALUE(125, field_1F4, uint32);
457 EXPOSE_VALUE(126, field_1F8, uint32);
458 EXPOSE_VALUE(127, field_1FC, uint32);
465 for (uint i = 0; i < 128; i++) {
467 uint val = getOrSetValueName(i, &name, NULL);
476 for (uint i = 0; i < 128; i++) {
478 s.syncAsUint32LE(val);
479 getOrSetValueName(i, NULL, &val);
482 for (uint i = 0; i < 128; i++) {
483 uint32 val = getOrSetValueName(i);
484 s.syncAsUint32LE(val);
502 SceneIndex sceneBackup;
503 SceneIndex sceneBackup2;
509 brightness = _defaultBrigthness;
510 volume = _defaultVolume;
514 time = kTimeCityParis;
515 timeDelta = _defaultTimeDelta;
517 sceneUseBackup =
false;
518 scene = kSceneDefault;
519 sceneBackup = kSceneNone;
520 sceneBackup2 = kSceneNone;
523 memset(events, 0, 512*
sizeof(byte));
536 getHourMinutes(time, &hours, &minutes);
538 ret +=
Common::String::format(
"Time: %d (%d:%d) - Time delta: %d - Ticks: %d\n", time, hours, minutes, timeDelta, timeTicks);
539 ret +=
Common::String::format(
"Brightness: %d - Volume: %d - UseBackup: %d\n", brightness, volume, sceneUseBackup);
540 ret +=
Common::String::format(
"Scene: %d - Scene backup: %d - Scene backup 2: %d\n", scene, sceneBackup, sceneBackup2);
546 s.syncAsUint32LE(time);
547 s.syncAsUint32LE(timeDelta);
548 s.syncAsUint32LE(timeTicks);
549 s.syncAsUint32LE(scene);
550 s.syncAsByte(sceneUseBackup);
551 s.syncAsUint32LE(sceneBackup);
552 s.syncAsUint32LE(sceneBackup2);
556 for (uint i = 0; i <
ARRAYSIZE(events); i++)
557 s.syncAsByte(events[i]);
573 bool mouseRightClick;
575 bool mouseLeftPressed;
576 bool mouseRightPressed;
578 bool flag_entities_0;
579 bool flag_entities_1;
582 bool shouldDrawEggOrHourGlass;
592 frameInterval =
false;
594 isGameRunning =
false;
596 mouseRightClick =
false;
597 mouseLeftClick =
false;
599 mouseLeftPressed =
false;
600 mouseRightPressed =
false;
602 flag_entities_0 =
false;
603 flag_entities_1 =
false;
605 shouldRedraw =
false;
606 shouldDrawEggOrHourGlass =
false;
619 ret +=
Common::String::format(
"Unknown: 0:%02d - 3:%02d - 4:%02d - 5:%02d\n", flag_0, flag_3, flag_4, flag_5);
620 ret +=
Common::String::format(
"FrameInterval: %02d - ShouldRedraw:%02d - ShouldDrawEggOrHourGlass:%02d\n", frameInterval, shouldRedraw, shouldDrawEggOrHourGlass);
622 ret +=
Common::String::format(
"Mouse: RightClick:%02d - LeftClick:%02d\n", mouseRightClick, mouseLeftClick);
636 Inventory *getGameInventory() {
return _inventory; }
637 Objects *getGameObjects() {
return _objects; }
638 SavePoints *getGameSavePoints() {
return _savepoints; }
639 GameState *getGameState() {
return _state; }
640 Flags *getGameFlags() {
return _flags; }
643 bool isNightTime()
const;
646 int getTimer() {
return _timer; }
647 void setTimer(
int val) { _timer = val; }
650 void setCoordinates(
Common::Point coords) { _coords = coords; }
654 static uint32 getPowerOfTwo(uint32 x);
655 static void getHourMinutes(uint32 time, uint8 *hours, uint8 *minutes);
658 static const uint32 _defaultBrigthness = 3;
659 static const uint32 _defaultVolume = 7;
660 static const uint32 _defaultTimeDelta = 3;
661 static const uint32 _defaultPortrait = 32;
678 #endif // LASTEXPRESS_STATE_H #define ARRAYSIZE(x)
Definition: util.h:91
Common::String toString()
Definition: state.h:531
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: savepoint.h:78
Definition: lastexpress.h:69
Definition: animation.h:45
Definition: inventory.h:51
Definition: serializer.h:79
bool isEqual(uint index, uint val)
Definition: state.h:314
Common::String toString()
Definition: state.h:616
Definition: serializer.h:308
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
uint32 field_14
EntityIndex (used in Gendarmes)
Definition: state.h:48