aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.h
AgeCommit message (Collapse)Author
2009-09-30Implemented the map room, entered when 'm' is pressed.Robert Špalek
svn-id: r44474
2009-09-29Clean up and unify positioning dragon's animationsRobert Špalek
svn-id: r44456
2009-09-29draci:Denis Kasak
* Added const to some methods of Game. * Removed some code cruft from Game::walkHero() (duplicate calculations and variables). * Fixed small bug which prevented talking text from being centered above the dragon. svn-id: r44455
2009-09-28draci: Added methods Game::positionAnimAsHero(), Game::getHeroX() and ↵Denis Kasak
Game::getHeroY() and implemented correct positioning of all dragon animations. Fixed exiting the inventory by right-clicking outside it. svn-id: r44453
2009-09-27Reduce code duplication when cleaning animationsRobert Špalek
svn-id: r44422
2009-09-25Added some more const's to the interface of Dragon HistoryRobert Špalek
svn-id: r44362
2009-09-25Add const's to many interfaces of engines/draci/Robert Špalek
svn-id: r44331
2009-08-17Removed public data variables of Game concerning dialogues and added ↵Denis Kasak
getters/setters. svn-id: r43492
2009-08-17Added inventory and item handling support (monster patch, sorry). Items were ↵Denis Kasak
previously called "icons" as in the original player. This commit also renamed every such instance to the proper "item". svn-id: r43487
2009-08-16Added struct GameItem.Denis Kasak
svn-id: r43424
2009-08-15Removed _roomChange hack since it's no longer needed.Denis Kasak
svn-id: r43392
2009-08-15* Implemented LoadPalette, SetPalette and BlackPalette GPL commands.Denis Kasak
* Used a more natural condition (whether the scheduled room number is different from the current room number) instead of the _roomChange hack. svn-id: r43391
2009-08-12* Split loop status and substatus into two different enums since they are ↵Denis Kasak
two separate concepts * Fixed slight glitch where object titles (which normally disappear when objects are used/looked at) reappeared for a moment after the script has finished svn-id: r43305
2009-08-11Added dialogue support.Denis Kasak
svn-id: r43253
2009-08-09* Implemented Game::loadWalkingMap().Denis Kasak
* Extracted title updating from the main loop to a new method, Game::updateTitle(). * Added Game::updateCursor(). * Restructured the main loop to fix many subtle bugs and enable some new functionality concerning object scripts (like support for room-global use scripts). * Added support for tracking currently selected icons (items, probably should be renamed). * Changed walkDir, lookDir and useDir members of GameObject to int and adjusted them for zero-based indexing. * Added Game::getCurrentIcon(). * Return from WalkingMap::findNearestWalkable immediately if the starting point is walkable. svn-id: r43160
2009-08-08* Implemented WalkingMap::findNearestWalkable() which mimics a heuristic ↵Denis Kasak
from the original game that attempts to find walkable spots near the given point * Implemented moving to the right place when looking / using objects. svn-id: r43125
2009-08-05* Made some type changes to struct/class members in game.cpp (uint -> int ↵Denis Kasak
and uint16 -> uint) * Added enum constant kNoEscRoom for rooms that have no escape room defined * Fixed crash when ESC is pressed in rooms which have no escape room defined * Renamed kNotFound (used as a return value for Game::getObjectWithAnimation) to kObjectNotFound for clarity. svn-id: r43072
2009-08-05* Added kTitleColour = 255 enum constant used in the following item.Denis Kasak
* Added proper colouring of the title animation fonts * Added Game::getEscRoom(). svn-id: r43063
2009-08-02* Fixed bug when reading in persons data. I was reading in coordinates as ↵Denis Kasak
bytes and font colour as int16; it should be the other way around. * Handled the kStatusTalk loop substatus properly inside Game::loop(). * Made Game::walkHero() set the person coordinates for the dragon after it warps him to a new location * Added Game::getPerson() method (used by Script::talk()) * Added Game::setSpeechTick() method (set by Script::talk() and used inside the loop to determine when to switch to new text). svn-id: r42994
2009-08-01* Added support for loop substatusDenis Kasak
* Set loop substatus to Ordinary when changing rooms svn-id: r42971
2009-07-31* Added Game::runGateProgram()Denis Kasak
* Added a separate mechanism to Game to keep track both of the current room number and the next room/gate. Periodically, I check whether the new room differs from the old one and, if it does, I do the change. Doing it any other would is nearly impossible because of the way the original scripts were written. * Added GPL command Script::newRoom(). Rooms can now be traversed by clicking on their exits. Also, the intro animation partly works. Some parts go by far too soon. I assume this is because the engine still lacks a dialogue GPL command. * Fixed bug where the gates array of a room was not cleared between uses. * Save old jump value when we enter Script::run() and restore it in the end (mimicking the original engine). * Fixed small bug where the gate was supposed to be stored as the first in-game variable and not the room number. svn-id: r42957
2009-07-30* Woops, Game::getRoomNum() was already implemented. Removed the superfluous ↵Denis Kasak
implementation. * Set the first two game variables to the gate and room number in Game::init() * Fixed compilation svn-id: r42916
2009-07-30* Added support for keeping track of gates (exits from rooms)Denis Kasak
* Added getters and setters for current room and gate numbers svn-id: r42915
2009-07-29Explicitly set the kDragonObject enum constant value for clarity.Denis Kasak
svn-id: r42906
2009-07-29* Made Game::loop() exit conditionally depending on whether the internal ↵Denis Kasak
Game::_shouldExitLoop variable is set. * Added mechanisms for signalling whether the main game loop should exit or not (Game::setExitLoop() and Game::shouldExitLoop()) svn-id: r42899
2009-07-29* Moved event handling to DraciEngine::handleEvents()Denis Kasak
* Added Game::start() method which is called from DraciEngine::go() * Made Game::loop() suitable for calling from other places (like GPL scripts) by handling events, redrawing the screen, etc from inside. This way it doesn't freeze the game if it doesn't return immediately. * Added Game::shouldQuit() and Game::setQuit() which can be used to signal the engine to quit. * Fixed race condition related to mouse buttons not getting released. * Instead of deleting frames for the title animation and adding a new one, reset the text for its frame. svn-id: r42875
2009-07-27* Added Game::getObjectWithAnimation() which finds the object that owns an ↵Denis Kasak
animation with a certain ID * Made GameObjects track their titles as Strings rather than byte * * Made the engine display the title of the object under the cursor (added a special animation ID for that, kTitleText) svn-id: r42839
2009-07-25* Moved walking code to Game::walkHero().Denis Kasak
* Implemented WalkOn GPL command. * Temporarily remaped StayOn and WalkOnPlay to WalkOn (for testing). svn-id: r42735
2009-07-25Added Movement enum that enumerates the animations for the dragon's movement.Denis Kasak
svn-id: r42734
2009-07-25* Added DraciEngine::_initArchive and made Game use it. Fixes a memory bug ↵Denis Kasak
because Game uses pointers from the init archive which should outlive it (but didn't previously). * Added support for setting loop status to Game. * Made some GPL commands check whether we are in the correct loop status before executing. svn-id: r42731
2009-07-25* Added handlers for the ObjStat and ObjStat_On GPL commandsDenis Kasak
* Removed temporary hack I accidentally committed svn-id: r42730
2009-07-24* Added tracking and deleting animations by index (which represents the ↵Denis Kasak
order in which they were loaded). This is needed by some GPL commands. * Added Game::getNumObjects() which returns the number of objects in the game * Fixed segfault (accessing a null Animation *) * Added some docs to various things svn-id: r42683
2009-07-20* Added scaling supportDenis Kasak
* Made the dragon scale when it is in different parts of the room * Added getters for relative coordinates (Animation::getRelativeX() and Animation::getRelativeY()) * Commented Game::loop() and Sprite::draw*() methods in more detail svn-id: r42627
2009-07-19* Used ldexp() in real_to_double() instead of doing the calculation manuallyDenis Kasak
* Moved static declaration of real_to_double() to game.cpp svn-id: r42616
2009-07-19Added capability for reading in Pascal 6-byte floats and made ↵Denis Kasak
Game::loadRoom() read in pers0 and persStep correctly. svn-id: r42612
2009-07-18Removed room switching hack from Mouse and re-added it to DraciEngine::go() ↵Denis Kasak
(right arrow switches to the next room, left to the previous. svn-id: r42577
2009-07-17* Made Game::changeRoom() clear some more archivesDenis Kasak
* Modified the engine to leverage BArchive's memory management capabilities by using its pointers to data directly instead of copying * Removed GameObject destructor (not needed because of the above change) * Changed some more data members from uint16 to uint svn-id: r42555
2009-07-17* Renamed Room::_numMasks to _numOverlays for consistency.Denis Kasak
* Fixed unsigned to signed comparison. svn-id: r42549
2009-07-17* Added Game::loop()Denis Kasak
* Added WalkingMap::isWalkable() * Renamed remaining _priority identifiers to _z which were left by mistake in the previous commit svn-id: r42546
2009-07-16Renamed GameObject::_priority to _z.Denis Kasak
svn-id: r42542
2009-07-16* Added WalkingMaps classDenis Kasak
* Added DraciEngine::walkingMapsArchive * Made Game::loadRoom() read in the current walking map svn-id: r42541
2009-07-15* Changed Game members _numMasks, _init, _look, _use and _canUse from uint16 ↵Denis Kasak
to int * Modified Game::loadRoom to load gates and execute their scripts * The first room loaded is now Game::_info._startRoom instead of 0 * Fixed reading of _pers0 and _persStep from the data files (they are 6 instead of 12 bytes) * Added more debug info to Script and Game svn-id: r42515
2009-07-14Renamed GameInfo::_currentRoom to _startRoom to better reflect its purpose.Denis Kasak
svn-id: r42465
2009-07-14Made Game allocate its _info member statically instead of dinamically.Denis Kasak
svn-id: r42464
2009-07-13* Implemented the following GPL functions: IsIcoOn, IcoStat, IsObjOn, ↵Denis Kasak
IsObjOff, IsObjAway * Changed GameObject::_location to an int since we sometimes use location -1. * Some more uint <-> int changes to prevent comparisons between signed and unsigned. svn-id: r42452
2009-07-13Renamed Game::_itemStatus to _iconStatus. Added an assert to check if the ↵Denis Kasak
number of icons is correct. svn-id: r42449
2009-07-12Enabled some more rooms in the demo and disabled loading the former ↵Denis Kasak
distributor logo. svn-id: r42426
2009-07-07* Made Game::_variables private and, instead, added ↵Denis Kasak
Game::{get,set}Variable() methods. * Removed obsolete comment about the cyclic field not being used in Game::loadAnimation() svn-id: r42246
2009-07-07* From Game::GameObject removed the following _idxSeq, _numSeq, _animObj, ↵Denis Kasak
_seqTab (not used anymore), added Common::Array<int> _anims. * Handled cylic animations properly * Handled the Z coordinate properly svn-id: r42244
2009-07-07* Changed Game::_variables to public since the GPL interpreter needs to use ↵Denis Kasak
it and made it int instead of uint16 * Implemented variable accessing by the math evaluator * Fixed bug from previous commit (should have used && when checking for ending instructions, not ||) svn-id: r42242