Commit Graph

336 Commits

Author SHA1 Message Date
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
Robert Špalek
c4563616ae Added support for sound archives.
We initialize them in the DraciEngine constructor, but don't play any sounds
yet.  Checked that it works for all existing sound files (required several
work-arounds against unspoken specification).

When copying the interface from barchive.h, I decided to remove some const's
from there, because getFile() wasn't really behaving like const.

Removed some static Common::String instances.

svn-id: r44953
2009-10-11 22:30:40 +00:00
Max Horn
3399c3aeb6 Change doxygen inline comments from "//!" to "///" as proposed on -devel
svn-id: r44802
2009-10-08 21:28:57 +00:00
Max Horn
42120ed626 Introduce a new struct TimeDate, replacing struct tm in client code. May lead to compilation issues in ports, which should be trivial to fix, though
svn-id: r44793
2009-10-08 19:41:38 +00:00
Filippos Karapetis
136dbba9c4 Fixed warning (GameObject is a struct)
svn-id: r44648
2009-10-05 07:00:59 +00:00
Robert Špalek
cc39c5022a Work-around a bug in the original game files.
svn-id: r44645
2009-10-04 22:55:54 +00:00
Robert Špalek
eb56dfa965 Fixed two bugs concerning loading:
1. a room need to be reloaded by force when the loaded game is in the same
room as the game before the load
2. objects from the last room and their animations must be deallocated
before I change the room number

svn-id: r44638
2009-10-04 22:11:46 +00:00
Max Horn
f242266f6d Change a couple places from 'end of namespace' to 'End of namespace', for consistency
svn-id: r44634
2009-10-04 21:26:33 +00:00
Robert Špalek
c8f002ae43 Removed Ctrl-Left Click treating as a Right Click
svn-id: r44633
2009-10-04 20:08:11 +00:00
Robert Špalek
42ee5350c3 Hack Game::_shouldExitLoop.
Immediate exit needed when loading a savegame hurts waiting in an inner
(strange) loop inside a GPL program, because animations don't progress at
all.  Reverted to the previous behavior and kept the immediate exit as a
hack for loading the game.

svn-id: r44590
2009-10-04 09:33:07 +00:00
Robert Špalek
1ed6a2668b Load inventory items properly after loading the game.
This solution is quite hacky, but so is the rest of the code, before a
future refactoring done one day.

svn-id: r44588
2009-10-04 09:13:15 +00:00
Robert Špalek
df14027c41 Implemented rudimentary game loading/saving.
Fixed many bugs in the boilerplate.  Saving (only) things that really need to
be saved.  Loading seems to work modulo dialogs and (possibly) inventory.

svn-id: r44586
2009-10-04 05:44:23 +00:00
Robert Špalek
b6d7da6927 Implement all boilerplate concerning Global Main Menu.
All currently defined featues will be supported.  I have implemented 
everything boilerplatish, except for the actual game saving/loading (which
will come in the next commit), getting volumes from the configuration
(because we don't play sounds yet), and changing subtitles.

svn-id: r44583
2009-10-04 03:50:10 +00:00
Robert Špalek
3035ca2fd3 Let Ctrl-Left click behave like Right lick in Dragon History.
Also, started implementing Advanced Engine Features:
- pause support
- RTL support

svn-id: r44575
2009-10-03 22:07:18 +00:00
Robert Špalek
43f84746bf Fixed positioning and update of the title under the mouse pointer.
Clamping on the border of the screen works precisely.  When switched to the
inventory, titles of game items are displayed instead of a (sticky) title of
the last object before entering the inventory.  Put some const's where
appropriate.

svn-id: r44550
2009-10-03 05:16:19 +00:00
Robert Špalek
4a7cea6813 Fixed event handling. ValGrind fixups.
My yesterday's fix on handling 1 event per call caused the game to be
unbearably slow on Linux.  The old way was much faster.  I have solved too
fast a succession of mouse button down and up by not clearing the mouse flag
when the button goes up instead.

Fixed a memory leak and uninitialized variable after my refactoring of game
location changes; found by ValGrind.

svn-id: r44525
2009-10-01 16:47:34 +00:00
Robert Špalek
24d649b972 Clean up room changing code and support returning from the map.
Completely changed the interface, removing unused methods and attributes,
renaming other ones to reflect what they do, and moving some methods into the
private section.  Code changing the location, originally scattered over many
pieces of code, has been unified into one place.  Remember the previous room
when entering the map so that one can return there.

Also, the event handler processes one event at a time, preventing lost clicks
on touchpads.

svn-id: r44508
2009-10-01 08:32:35 +00:00
Robert Špalek
5ad13a3dff Fix 2 ValGrind warnings.
svn-id: r44499
2009-09-30 21:07:04 +00:00
Max Horn
8ba75fc522 Fix code formatting (esp. 'if(' -> 'if (' etc., but also indention and other things)
svn-id: r44495
2009-09-30 16:16:53 +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
Robert Špalek
76a0bcb6c4 Implemented the map room, entered when 'm' is pressed.
svn-id: r44474
2009-09-30 04:33:52 +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
Robert Špalek
4be9e6cda0 Rewrite from scratch drawReScaled() and cropping now works well.
I left draw() as is for now, although it could also be similarly simplified.
Also, one could easily completely get rid of columnIndices[], but I was too
tired for the time being.

svn-id: r44457
2009-09-29 06:36:39 +00:00
Robert Špalek
00a733f7cf Clean up and unify positioning dragon's animations
svn-id: r44456
2009-09-29 05:54:59 +00:00
Denis Kasak
635769bd5d draci:
* 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-29 00:03:09 +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
0c0135e0ed draci: Added methods Game::positionAnimAsHero(), Game::getHeroX() and Game::getHeroY() and implemented correct positioning of all dragon animations. Fixed exiting the inventory by right-clicking outside it.
svn-id: r44453
2009-09-28 23:10:08 +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
ccc737a714 Fix a memory leak
svn-id: r44447
2009-09-28 11:28:09 +00:00
Robert Špalek
359d374dc6 Added const's to getPalette() and several uses of getObject()
svn-id: r44434
2009-09-28 04:09:03 +00:00
Robert Špalek
8a78e96838 Make getFile() return a const pointer and clean-up all uses of it.
svn-id: r44433
2009-09-28 03:51:23 +00:00
Robert Špalek
7ef17ba73e get rid of static Common::String's
svn-id: r44432
2009-09-28 03:06:43 +00:00
Robert Špalek
42e3c63b11 get rid of static Common::String's
svn-id: r44431
2009-09-28 02:54:38 +00:00
Robert Špalek
d0db596311 Fix rounding coordinates at the edge of the screen.
svn-id: r44430
2009-09-27 23:57:39 +00:00
Robert Špalek
a04881072a Reduce code duplication when cleaning animations
svn-id: r44422
2009-09-27 21:25:34 +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
Denis Kasak
27a638fa82 draci: Fixed bug in Surface::centerOn{X,Y}() which made it return a negative coordinate for strings that are too long. Resolves the crash caused by the English data files containing strings which are improperly line-breaked. Ideally, the engine should do the line-breaking itself when the string does not fit.
svn-id: r44376
2009-09-26 13:47:32 +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
Filippos Karapetis
e296cef9be Created a macro for lround(), for non-C99 compilers, and used that in places where lround() is used
svn-id: r44337
2009-09-25 09:48:43 +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
Filippos Karapetis
a74a9c6c01 Silenced some warnings
svn-id: r44329
2009-09-25 07:06:55 +00:00
Filippos Karapetis
7106caca81 Replaced the C99 lround() with floor(), to get draci to compile under non-C99 compilers (e.g. VS)
svn-id: r44328
2009-09-25 07:05:26 +00:00
Robert Špalek
edd338b229 Make engines/draci/ compilable after merging from a branch
svn-id: r44327
2009-09-25 06:43:33 +00:00
Denis Kasak
be0cfa50f2 Removed public data variables of Game concerning dialogues and added getters/setters.
svn-id: r43492
2009-08-17 19:37:55 +00:00
Denis Kasak
85bf130a50 Enabled hotkey 'i' for accessing or exiting the inventory.
svn-id: r43488
2009-08-17 18:51:45 +00:00
Denis Kasak
b0fea939f4 Added inventory and item handling support (monster patch, sorry). Items were previously called "icons" as in the original player. This commit also renamed every such instance to the proper "item".
svn-id: r43487
2009-08-17 18:50:38 +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