Commit Graph

68 Commits

Author SHA1 Message Date
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Ori Avtalion
9414d7a6e2 JANITORIAL: Reduce header dependencies in shared code
Some backends may break as I only compiled SDL
2011-04-28 15:08:58 +03:00
Max Horn
84184aabc0 ALL: colour -> color 2011-04-14 14:12:35 +02:00
Max Horn
2180b2d6b5 COMMON: Split common/stream.h into several headers
svn-id: r54385
2010-11-19 17:03:07 +00:00
Robert Špalek
0fd3558986 Finish support of compressed dubbing
Now even the length of a compressed stream is measured precisely and
the dubbing sounds exactly like the original.

svn-id: r50618
2010-07-03 05:05:28 +00:00
Robert Špalek
2d8b25f656 Dragon History: fixing properly bug 2976774
The previous bugfix just hid the problem by removing an assert, but it might demonstrate
itself in another way later.  This is a proper bugfix.

svn-id: r48460
2010-04-01 22:01:40 +00:00
Max Horn
f3420c6372 DRACI: Reduce header interdependencies; some cleanup
svn-id: r46320
2009-12-09 21:03:22 +00:00
Robert Špalek
87c26fe54b Fixed bug with exhausting sound handles
It was caused by forever re-starting the same sample when the animation was
stopped and the same frame got displayed over and over, each time triggering
playing the same sample.

svn-id: r46168
2009-11-28 00:07:22 +00:00
Robert Špalek
4e830d821c Fix SIGSEGV found by ValGrind
svn-id: r46142
2009-11-26 00:09:17 +00:00
Robert Špalek
0ee8f879fa Fix positioning of one-time hero animations.
With the previous code, the position of the animation was doubled (due to
counting the position twice, the second time being a relative shift), which
put it mostly outside the screen.  This is because one-time hero animations
are actually stored using absolute coordinates.

svn-id: r46057
2009-11-22 05:10:31 +00:00
Robert Špalek
509444cc91 Fixed Animation::getTopAnimation()
It does not return kTitleText and others.  This caused flickering of speech
texts on/off when the title got displayed under the mouse.

svn-id: r46056
2009-11-22 02:42:15 +00:00
Robert Špalek
e2ca397e63 Huge refactoring of data structures.
Replaced IDs of objects by pointers, which saves many lookups, each of which
is horribly ineffective.  Moved a lot of code into methods of structs now
turned into objects.

Tested the new code a lot and seems to work as well as the old code.

svn-id: r45799
2009-11-10 05:16:34 +00:00
Robert Špalek
99037380ee Removed old hack for cyclic animations.
This makes the hero's walk even smoother.

svn-id: r45763
2009-11-08 21:35:19 +00:00
Johannes Schickel
f8ab3f866e Silence gcc warning by putting parentheses around an && expression nested in an || expression.
svn-id: r45752
2009-11-08 18:55:18 +00:00
Robert Špalek
4341a36641 Implement QuickHero walking.
Pressing Q during the game enables/disables faster walking; all animation
phases are flipped after one refresh instead of after given delay.

svn-id: r45748
2009-11-08 06:46:24 +00:00
Robert Špalek
5c8aa6ee91 Fixed mistake with two inner loop caused by not clearing the path.
Also, optimize play() and stop()

svn-id: r45746
2009-11-08 06:16:25 +00:00
Robert Špalek
354d7f6366 Debugged smooth walking except for 1 bug.
Adjusting to the edge is done such that it respects slight sideways movements of the dragon.
Fixed rounding issues in the whole game.  Improved debug messages.  Made sure that the dragon
does not turn like crazy around when clicking on the same pixel: the final point is always the
clicked one although the middle points made by shifted to make the animations smooth, and
preserve the dragons direction if he has not walked.

There is a bug with running turning animations as they seem to disappear for 1 frame and have
incorrect Z coordinate.  Will investigate it next.

svn-id: r45742
2009-11-08 03:16:22 +00:00
Robert Špalek
f534c12289 Add helper functions to retrieve dragon position from the animation.
To implement proper walking, I have to respect the relative shifts defined
by the sprites as opposed to apply some constant velocity.

svn-id: r45714
2009-11-07 04:56:28 +00:00
Robert Špalek
357d9989d4 Implemented relative animations.
In these animations, each sprite can specify a relative shift with respect
to the previous sprite.  Moving animations (such as walking of the dragon)
are easily described in this framework.  I have sort of hacked their support
and it seems to work.

The current walking code does not interact with the new code yet, but it will
be easy to do.

svn-id: r45712
2009-11-07 01:28:27 +00:00
Robert Špalek
881bf37554 Add safe-guard against collision of animation IDs.
When debugging another issue, I preloaded all animations, and horrible things
happened that I debugged for a few hours.

svn-id: r45695
2009-11-06 16:48:37 +00:00
Robert Špalek
f8a19bb4a9 Implemented proper walking.
First shot, not debugged yet, but seems to work (even though a bit hairy)!

svn-id: r45688
2009-11-05 14:22:39 +00:00
Robert Špalek
c1cc230e4b Debugged computation and displaying of optimal walking paths
svn-id: r45597
2009-11-01 12:57:06 +00:00
Robert Špalek
6411125f39 Moved all one-line getters/setters to the header files
svn-id: r45524
2009-10-30 06:11:04 +00:00
Robert Špalek
d662c4aa20 Remove the last 2 default parameter values.
They usually just add unnecessary confusion and this is definitely such
an example.  Removal will clarify the code.

svn-id: r45512
2009-10-30 01:56:52 +00:00
Robert Špalek
c778efaca5 Remove most of default parameter values.
Also, add comments to the last commit.

svn-id: r45511
2009-10-30 01:41:57 +00:00
Robert Špalek
e779284403 Sound effects are now correctly played.
Dubbing is not yet played.

svn-id: r45000
2009-10-12 22:27:23 +00:00
Robert Špalek
f71b32dd96 Loading and caching sound samples in memory.
The sounds are not played yet, but the infrastructure is getting ready.

svn-id: r44957
2009-10-11 23:01:59 +00:00
Max Horn
cc54ad650d Remove trailing whitespaces
svn-id: r44493
2009-09-30 16:04:21 +00:00
Johannes Schickel
c9ca057ae2 - Adapt parts of the Draci code to match our code formatting guidelines
- Remove use of tabs for formatting, now in nearly all cases tabs are only used for indentation
- Use "uint" instead of "unsigned int" in the whole engine for consistency's sake
- Strip some trailing tabs and leading whitespaces

svn-id: r44478
2009-09-30 10:45:14 +00:00
Torbjörn Andersson
c857369131 Fixed Valgrind warnings about invalid memory access. Hopefully without breaking
anything, but modifying a data structure while traversing it can be a bit
tricky...

svn-id: r44469
2009-09-29 19:51:37 +00:00
Denis Kasak
137c44013c draci: Inverted a logical check to make it more obvious.
svn-id: r44454
2009-09-28 23:32:16 +00:00
Denis Kasak
a8d6e8774c Made AnimationManager::sortAnimations() do multiple passes, if necessary, and added some animation debug info.
svn-id: r44452
2009-09-28 23:02:39 +00:00
Robert Špalek
caa3b6707e Improved the interface of Sprite and Animation concerning relative coordinates and scaling.
It is no longer needed to modify the underlying animations when drawing them
on the screen or testing pixels in them.  Read access is enough, because
the displacement of the object is passed as a parameter.

Added some more const's where they logically belong.

svn-id: r44419
2009-09-27 20:49:59 +00:00
Robert Špalek
cf1031fc63 Fix renumbering of animation indexes
svn-id: r44414
2009-09-27 18:51:07 +00:00
Robert Špalek
fc2bb50600 Remove memory leak in animation manager. Get rid of 1 non-const reference parameter.
svn-id: r44413
2009-09-27 18:11:06 +00:00
Robert Špalek
431780297e Added some more const's to the interface of Dragon History
svn-id: r44362
2009-09-25 17:33:00 +00:00
Robert Špalek
f51c81f344 Add const's to many interfaces of engines/draci/
svn-id: r44331
2009-09-25 08:13:39 +00:00
Denis Kasak
e5774d2881 * Added pause support for animations.
* Added AnimationManager::addItem() for adding inventory items animations.

svn-id: r43486
2009-08-17 18:47:17 +00:00
Denis Kasak
3022c623d6 Stopped returning from Animation::nextFrame() early even if the animation has only one frame because such animations may need to have callbacks called too. Fixes intro freeze during mother's lecture.
svn-id: r43313
2009-08-12 07:37:08 +00:00
Denis Kasak
7532845fee Fixed sanity check in Animation::setCurrentFrame().
svn-id: r42914
2009-07-30 02:16:58 +00:00
Denis Kasak
b124c8b122 * Added Animation::setCurrentFrame()
* Moved rewinding the animation to the beginning from Animation::nextFrame() to AnimationManager::stop() (fixes the owl animation)

svn-id: r42913
2009-07-30 01:12:07 +00:00
Denis Kasak
f42894c33c Added support for animation callbacks and implemented a few callbacks (doNothing, exitGameLoop, stopAnimation).
svn-id: r42901
2009-07-29 19:39:10 +00:00
Denis Kasak
33af83c650 * Added method Animation::currentFrameNum()
* Renamed Animation::getFramesNum() to Animation::getFrameCount() for clarity.

svn-id: r42873
2009-07-29 00:46:36 +00:00
Denis Kasak
0098084969 Fixed one more bug related to animations having no frames.
svn-id: r42838
2009-07-27 04:47:38 +00:00
Denis Kasak
673bae4443 * Added AnimationManager::addText() for adding text animations
* 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 04:18:44 +00:00
Denis Kasak
c1ad0c3926 * Added tracking and deleting animations by index (which represents the 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-24 05:00:53 +00:00
Denis Kasak
a2bca06b3f Added support for per-animation scaling (via scaling factors). I have 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-24 01:54:13 +00:00
Denis Kasak
1726cc8d24 * Disabled unconditional execution of gates' scripts
* 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-22 11:30:57 +00:00
Denis Kasak
ef37d0a9b0 * Stopped AnimationManager::drawScene() from marking its own dirtiness.
* 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-22 07:18:00 +00:00
Denis Kasak
b3a2d186bb * Moved scaling support from Animation to Sprite
* 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-22 04:42:33 +00:00