aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2009-07-29* Implemented the StartPlay and Play GPL commands properlyDenis Kasak
* Changed Script::load() to use the new animation callbacks svn-id: r42902
2009-07-29Added support for animation callbacks and implemented a few callbacks ↵Denis Kasak
(doNothing, exitGameLoop, stopAnimation). svn-id: r42901
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-29Fixed text bugs related to the fact that some strings in the data files ↵Denis Kasak
don't end with '|' like they should. svn-id: r42897
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-29* Implemented GPL function ActPhase (as Script::funcActPhase())Denis Kasak
* Trivial implementation of the Play GPL command * Fixed Script::load() to load animation IDs to objects in increasing order (needed by funcActPhase()) svn-id: r42874
2009-07-29* Added method Animation::currentFrameNum()Denis Kasak
* Renamed Animation::getFramesNum() to Animation::getFrameCount() for clarity. svn-id: r42873
2009-07-27Enabled running of look/use scripts on left/right mouse button press for ↵Denis Kasak
testing (Warning: unstable in some places). svn-id: r42841
2009-07-27Added methods to Mouse for setting the state of the button.Denis Kasak
svn-id: r42840
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-27Fixed one more bug related to animations having no frames.Denis Kasak
svn-id: r42838
2009-07-27Fixed segfault when the screen is deleted before animations (the Animation ↵Denis Kasak
destructor still needs to use the screen). svn-id: r42837
2009-07-27* Added AnimationManager::addText() for adding text animationsDenis Kasak
* Added AnimationManager::getTopAnimationID(x, y) which returns the ID of the top layer animation located on a point * Added Animation::getScale{X,Y}() * Fixed a few bugs related to animations sometimes having no frames svn-id: r42836
2009-07-27* Added Sprite::getPixel() (takes into account whether a sprite is mirrored ↵Denis Kasak
or scaled) * Made the Text class internally store a Common::String instead of a byte * svn-id: r42835
2009-07-27* Removed unused variableDenis Kasak
* Fixed unsigned to signed comparison warning svn-id: r42834
2009-07-27* Added Font::getStringHeight()Denis Kasak
* Made Font::getStringWidth() calculate the width of the string properly now that handling of multi-row strings is in * Fixed bug which caused the last column of pixels in the last letter of a string to linger on the screen svn-id: r42832
2009-07-26* Removed friend declarations in Drawable for Sprite and Text, and made ↵Denis Kasak
Drawable's private members protected so they can access them * Added Text::drawScaled() and altered Text::getRect() so Text instances can be accessed through a Drawable pointer. Scaling text is planned for later because it's not essential. svn-id: r42789
2009-07-25Handled the '|' char correctly when drawing text (it serves as both a ↵Denis Kasak
newline and end-of-string marker). svn-id: r42788
2009-07-25Simplified rectangle height and width calculation in Sprite::drawScaled() ↵Denis Kasak
(use methods of Common::Rect instead of doing it manually). svn-id: r42779
2009-07-25Replaced magic constant with enum kWalkingMapOverlay.Denis Kasak
svn-id: r42778
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-25Made Script::run() manually mark the last animation index before it executes ↵Denis Kasak
a program. This is done to prevent Release wreaking havoc if it is unpaired (i.e. if the script forgot to call a Mark first). svn-id: r42733
2009-07-25Implemented ExecUse, ExecLook and ExecInit GPL commands.Denis Kasak
svn-id: r42732
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-24Temporary mapped GPL command StartPlay to handler for Start and reenabled ↵Denis Kasak
gates' scripts (for added effects and testing). svn-id: r42684
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-24Added support for per-animation scaling (via scaling factors). I have ↵Denis Kasak
decided to go for a mixed approach (where Animation has a global scaling factor for the whole animation which is separate from Drawable's scaled width and height) so the animation can be scaled more naturally when the scale often changes (like with perspective when the dragon is walking). Previously, one had to alter the sizes of each frame of the dragon's animation whenever the dragon moved which was unclean. svn-id: r42680
2009-07-22* Disabled unconditional execution of gates' scriptsDenis Kasak
* Fixed bug in Animation::nextFrame() which caused non-looping animations to linger on forever * Stopped setting looping to false explicitly in AnimationManager::addAnimation() since the Animation constructor already does that svn-id: r42657
2009-07-22Fix warningsEugene Sandulenko
svn-id: r42653
2009-07-22* Stopped AnimationManager::drawScene() from marking its own dirtiness.Denis Kasak
* Instead, Animation::nextFrame() marks both the old and the new frame dirty. This makes it possible to only update the real screen when the animation changes and results in a pretty big speedup. * Added utility method Animation::markDirtyRect() which takes a (Surface *) and marks a dirty rect on it for the current frame. * Fixed artifacts when moving the dragon. svn-id: r42652
2009-07-22Check whether the walking map overlay is already in the desired state so we ↵Denis Kasak
don't start/stop it over and over. svn-id: r42651
2009-07-22If a frame has scaled dimensions set to 0, the engine now does no scaling ↵Denis Kasak
instead of scaling it to nothing. Fixes the disappearing chair bug. svn-id: r42650
2009-07-22Fixed scaled mirrored sprite drawing. This change enables the NoSense logo ↵Denis Kasak
animation to be played correctly. svn-id: r42649
2009-07-22* Removed some unnecessary virtual qualifiers from methods in Drawable, ↵Denis Kasak
Sprite and Text. * Changed some Drawable members from uint16 to uint. * Added some const qualifiers to methods of Drawable. svn-id: r42648
2009-07-22* Moved scaling support from Animation to SpriteDenis Kasak
* Now each Sprite (and hence frame in an animation) can have a separate zoom (which is needed for some animations in the game) * Scale factors are not stored any more; instead, we only store scaled dimensions (since these are stored in the data files) and calculate the factors from those. svn-id: r42647
2009-07-20Made 'show walking map overlay' setting persist when changing rooms.Denis Kasak
svn-id: r42628
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-18Fixed bug which caused the dragon to be animated with the wrong Z coordinate ↵Denis Kasak
for short periods of time when moved to a new location. svn-id: r42586
2009-07-18Fixed bug which caused animations to sometimes be played too fast if the ↵Denis Kasak
engine was busier than usual (like when redrawing the whole screen when returning from minimized state). svn-id: r42585
2009-07-18Made the engine handle the Z coordinate for the hero properly.Denis Kasak
svn-id: r42584
2009-07-18Made the engine stop the dragon animation when the room changes.Denis Kasak
svn-id: r42583
2009-07-18Fixed a bug where the cursor was not shown when the first room is loaded and ↵Denis Kasak
has mouse enabled. svn-id: r42582
2009-07-18* Added support for "walking" with the hero (i.e. moving the sprite to ↵Denis Kasak
locations allowed by the walking map) * Enabled drawing the walking map with the 'w' hotkey for testing svn-id: r42581
2009-07-18Fixed bug where certain animations were played very fast when not played ↵Denis Kasak
immediately when they are created. svn-id: r42580
2009-07-18* Added Animation::getFrame()Denis Kasak
* Added support for sorting animations when Z is changed later on (AnimationManager::sortAnimations()) * Added support for relative coordinates (Animation::setRelative()) * Fixed bug where AnimationManager::deleteOverlays() deleted all animations svn-id: r42579
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