Commit Graph

507 Commits

Author SHA1 Message Date
Robert Špalek
57b22e3688 Walking animations are fully smooth now
svn-id: r45743
2009-11-08 05:29:12 +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
9f1a756576 Gradual walking implemented.
It is not fully smooth yet due to rounding errors.  However, it otherwise
does what it is supposed to including perspective correction.

svn-id: r45727
2009-11-07 12:20:27 +00:00
Robert Špalek
0b67aa406e Debugged updating the position of the hero during walking.
I project the hero immediately to the end of each edge for the time being
though.

svn-id: r45722
2009-11-07 11:45:13 +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
638305fcbb The hero turns the right direction after walking
svn-id: r45713
2009-11-07 01:54:47 +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
fdad4e7b54 Done research on ignored animation flags and commented the code
svn-id: r45711
2009-11-07 00:36:23 +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
73cf7a55fc Fixed several gross walking bugs.
- SIGSEGV by not stopping walking when changing rooms
- reset of the mouse cursor and object title during gate scripts
- updating the previous animation phase, also when starting new animation
- swapped up and down animations

svn-id: r45690
2009-11-05 23:59:26 +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
fc2e2e27fc Added helper functions for dragon animations
svn-id: r45677
2009-11-05 00:21:54 +00:00
Robert Špalek
90eba9310a Brought back one old line, just to be sure.
svn-id: r45675
2009-11-04 22:54:14 +00:00
Robert Špalek
f147fbb936 Properly animate the last phase of the walk before running callbacks
svn-id: r45649
2009-11-04 04:27:31 +00:00
Robert Špalek
14f2685134 Implemented and debugged the walking framework.
The hero does not walk yet (it still teleports to the target immediately),
but that is just because the actual walking algorithm is left trivial first.
However, the main game loop, callbacks, and waiting all already work with
the general framework.

svn-id: r45648
2009-11-04 00:42:37 +00:00
Robert Špalek
930910fe5c Created walking-callback infrastructure and converted the code to use it
svn-id: r45644
2009-11-03 22:13:37 +00:00
Robert Špalek
b506b9f7c2 Removed an old FIXME
svn-id: r45642
2009-11-03 21:34:38 +00:00
Robert Špalek
0071829aee Implement properly stayOn instead of using walkOn
svn-id: r45641
2009-11-03 21:30:24 +00:00
Robert Špalek
9ad5e7461f Let setPath() store path with pixel precision, and update the map sprite when reloaded
svn-id: r45640
2009-11-03 21:05:26 +00:00
Robert Špalek
0d5627d8f1 Run the path obliqueing process repeatedly until it converges.
svn-id: r45623
2009-11-03 03:38:28 +00:00
Robert Špalek
75bf8237b0 Greatly improved the quality of obliqueing the shortest path.
The current algorithm is much better than the original player'ss one and it
find really nice curved paths.

Also, started preparing interface for actually walking along this path.

svn-id: r45622
2009-11-03 03:24:59 +00:00
Max Horn
51933629d1 Changed foo(void) to foo() in almost all non-backend source files
svn-id: r45616
2009-11-02 21:54:57 +00:00
Robert Špalek
ab3eb81dfb Little clean-up after the refactoring.
svn-id: r45609
2009-11-02 05:37:17 +00:00
Robert Špalek
6de74446ab Split loop() into several cleaned helper methods
svn-id: r45608
2009-11-02 05:31:03 +00:00
Robert Špalek
c45f0343f4 Refactored running loop().
- shouldExitLoop() is a bool again and introduced new flag isReloaded() instead
  of adding special hacky value 2
- loop() accepts 2 parameters: loop substatus and shouldExit flag, because each
  caller previously had to set and restore these manually.  loop() now also
  tests whether the substatuses are properly nested.  reordered the
  loop-exitting code.
- renamed loop substatuses to logical names
- enterNewRoom() returns bool whether loop() should continue so that start()
  doesn't have to test and clear shouldEndProgram().  it doesn't need
  force_reload as a parameter anymore.
- dialog selections use new inner substatus instead of outer substatus, for
  consistency

svn-id: r45607
2009-11-02 02:28:43 +00:00
Robert Špalek
9f711bd0ce Commented the rest of the loop() logic
svn-id: r45606
2009-11-01 23:20:46 +00:00
Robert Špalek
9ad86a800a Fix SIGSEGV when quitting the game during playing sounds
svn-id: r45605
2009-11-01 23:20:19 +00:00
Robert Špalek
f77446a500 Commented on loop() before refactoring.
svn-id: r45604
2009-11-01 23:04:56 +00:00
Robert Špalek
0470c25881 Small bugfix in path-finding
svn-id: r45602
2009-11-01 21:19:39 +00:00
Robert Špalek
504973a073 One more clean-up of the path-finding code
svn-id: r45599
2009-11-01 19:30:51 +00:00
Robert Špalek
170918afab Cleaned up the walking code.
PathVertex replaced by Common::Point.  Do not update the path sprites if
not in the debugging mode.

svn-id: r45598
2009-11-01 19:22:41 +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
5c7a120471 Add methods to draw computed walking paths.
svn-id: r45596
2009-11-01 10:58:34 +00:00
Robert Špalek
7927196b3f Fix mistakenly ordered flushing revealed by the last commit
svn-id: r45595
2009-11-01 10:15:48 +00:00
Robert Špalek
f91c89560f Get rid of doubling memory allocation and a lot of copying.
The Sprite class points to the original buffer (which is cached in the memory
thanks to BArchive machinery) instead of allocating its own buffer and
copying the source there.

svn-id: r45594
2009-11-01 10:03:37 +00:00
Robert Špalek
c8534e1802 Implemented some utility functions for path-finding.
In particular, breadth-first search algorithm for getting the shortest path
in the walkable area and an algorithm making the path oblique when possible.

svn-id: r45591
2009-11-01 09:34:07 +00:00
Robert Špalek
afcd186bef Move drawing of walking map to walking.cpp
svn-id: r45525
2009-10-30 07:26:43 +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
839a7d5db6 Fixed svn:keywords
svn-id: r45523
2009-10-30 05:21:44 +00:00
Robert Špalek
f3700a23e9 Move WalkingMap instance to Game, and clean up parameters
svn-id: r45516
2009-10-30 02:15:41 +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
a20e42efb9 Move WalkingMap into new module.
Also, fix a bug when loading the default walking map (wasn't implemented)
and setting font size.  The reason I move this code into a new module is
because I will augment it with other walking-related algorithms soon.

svn-id: r45510
2009-10-30 00:52:05 +00:00
Torbjörn Andersson
cbf2b03c22 Silenced GCC warning.
svn-id: r45505
2009-10-29 18:15:12 +00:00
Robert Špalek
403668898f Implement flipping the QuickHero and SpeedText flags in GPL2.
All GPL2 callbacks are now fully implemented.  It remains to implement
proper walking.

svn-id: r45501
2009-10-29 15:26:48 +00:00
Robert Špalek
25b3e687a7 Fix several palette fading bugs.
svn-id: r45497
2009-10-29 01:55:06 +00:00
Robert Špalek
c781f01321 Implement palette fading
svn-id: r45455
2009-10-28 07:34:17 +00:00
Robert Špalek
e75637ec1f Fix initialization of the mouse cursor.
svn-id: r45453
2009-10-28 00:20:45 +00:00
Robert Špalek
bbb72eee55 Fix entering the same room when re-loading the game.
(Most objects were not loaded due to incorrect cleaning of a flag).  Also,
clean up accessing some boolean attributes.

svn-id: r45452
2009-10-28 00:04:59 +00:00
Robert Špalek
ed87e5cd31 Don't change mouse cursors so ridiculously often.
svn-id: r45451
2009-10-27 23:51:32 +00:00
Robert Špalek
46cb0be173 fix free/delete
svn-id: r45422
2009-10-26 22:04:03 +00:00
Robert Špalek
7bec12bbec Fix 2 MIDI bugs
svn-id: r45392
2009-10-26 09:03:54 +00:00
Robert Špalek
74da9e5e3b Fix Escape in the intro, and switching map and the inventory
svn-id: r45389
2009-10-26 04:59:52 +00:00
Robert Špalek
819449d099 Implemented GPL2 commands for music.
Debugged everything.

svn-id: r45330
2009-10-22 07:34:43 +00:00
Robert Špalek
8f75ee9a37 Fix uninitialized channel volumes.
This fixed stopped music after calling the configuration dialog.

svn-id: r45327
2009-10-22 06:41:11 +00:00
Robert Špalek
3903be61e7 Improved music handling:
- reading the volume from the configuration
- error handling of non-existent MIDI files
- pausing/resuming music

unfortunately, sometimes music stops playing or slows down, and my log
messages have so far not helped me to identify why

svn-id: r45326
2009-10-22 06:21:39 +00:00
Robert Špalek
958bc7ba81 Avoid opening and closing BArchive files all the time
svn-id: r45325
2009-10-22 06:05:34 +00:00
Robert Špalek
8d8b4dc50a Enabled music.
Several TODO's added.

svn-id: r45298
2009-10-21 08:41:57 +00:00
Robert Špalek
b2bf21f0da Fix memory leaks when reading thumbnails
svn-id: r45142
2009-10-16 00:09:20 +00:00
Robert Špalek
dddce5d97b Don't crash without sound support.
svn-id: r45137
2009-10-15 23:57:13 +00:00
Robert Špalek
baec8c2421 Set all sound/subtitle-related parameters from ConfMan.
Made it intelligent so that when, for example, the dubbing file doesn't exist,
we don't fail, but instead always show subtitles even if the GUI settings
says dubbing only, etc.

svn-id: r45002
2009-10-13 05:38:45 +00:00
Robert Špalek
7c311057c1 Dubbing is played.
I haven't implemented switching dubbing and subtitles on/off according to
the config manager nor the speed of the subtitles, yet.

svn-id: r45001
2009-10-13 04:44:22 +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
43437eecb8 Dragon looks into the requested direction.
Parsing _lookDir and _useDir, and passing it all the way around to walkHero().

Also, added playHeroAnimation() to reduce code duplication.

svn-id: r44965
2009-10-12 03:08:28 +00:00
Robert Špalek
1a4dcd3c82 Implemented GPL commands JustTalk and JustStay.
The basic commands are done.  It remains to implement handling music (after
we play it at all), fading palette, and controlling the quick-hero and
speed-text flags (after I find out what they do).

Now the dragon switches between talking and staying during dialogs.  However,
the left/right direction doesn't work yet, because we don't respect _lookDir
and _useDir yet.

svn-id: r44964
2009-10-12 01:16:13 +00:00
Robert Špalek
ca35af2697 Fixed funcActPhase()
svn-id: r44963
2009-10-12 00:39:49 +00:00
Robert Špalek
b99e69f4d9 Fix indexing of the dragon's animations.
After inspection, I assert that it isn't true that the _anim array needs to
be sorted.  In fact, sorting ruins the ordering of the dragon's animations,
which corresponds to enum Movement.

After fixing this, let the dragon have a rest instead of constantly walking
down.

svn-id: r44962
2009-10-12 00:32:51 +00:00
Robert Špalek
3ef5145b41 Reduced huge code duplication by introducing Game::stopObjectAnimations()
svn-id: r44961
2009-10-12 00:15:34 +00:00
Robert Špalek
6aaf99ec67 Disambiguated _anims.
It's both a pointer to an AnimationManager and list of animation ID's fo
each object.  The latter renamed to _anim so that I can easily search for
them.

Also, fixed the bug promised in the previous commit.

svn-id: r44960
2009-10-12 00:01:39 +00:00
Robert Špalek
6768065f14 Reduced code duplication and fixed one deletion bug.
svn-id: r44959
2009-10-11 23:54:44 +00:00
Robert Špalek
62cebbb51e Implemented a few more harmless GPL2 commands
svn-id: r44958
2009-10-11 23:28:40 +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
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
Denis Kasak
680bed134b * Set the _x and _y position for the mouse only when an EVENT_MOUSEMOVE happens.
* Stop calling Mouse::setPosition() on EVENT_MOUSEMOVE since it's not needed (the engine warps the mouse automatically; I still left the method for situations when we want to warp the mouse explicitly).

svn-id: r43484
2009-08-17 18:23:05 +00:00
Denis Kasak
74d4392a78 Added struct GameItem.
svn-id: r43424
2009-08-16 04:21:17 +00:00
Denis Kasak
1c0df34b4d Removed _roomChange hack since it's no longer needed.
svn-id: r43392
2009-08-15 02:53:14 +00:00
Denis Kasak
abf10049bb * Implemented LoadPalette, SetPalette and BlackPalette GPL commands.
* 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-15 02:42:34 +00:00
Denis Kasak
fad77de234 Sped up the game during dialogues by not updating every drawn char separately but the whole string at once. Also removed the markDirty parameter from Font::drawChar() since it's not needed anymore.
svn-id: r43368
2009-08-14 16:12:17 +00:00
Denis Kasak
87e64d27f7 Fixed bug which made the dragon's spoken line in a dialogue end too quickly.
svn-id: r43365
2009-08-14 13:17:53 +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
8ca10ac3b0 Fixed dialogues logic (some indexes were calculated erroneously +/- 1).
svn-id: r43312
2009-08-12 07:34:31 +00:00
Denis Kasak
c57515b5f8 Moved setting inactive dialogue option colour to an else branch.
svn-id: r43311
2009-08-12 05:38:15 +00:00
Denis Kasak
45e4f88e4e Removed unnecessary else branch in the part of the loop handling substatus Talk.
svn-id: r43310
2009-08-12 05:35:08 +00:00
Denis Kasak
e526983dbe Fixed erroneous comment mentioning gates in Game::runDialogueProg().
svn-id: r43309
2009-08-12 05:22:50 +00:00
Denis Kasak
534158af87 * When setting the first two game variables (room and gate), first convert them back to 1-based indexing so they play well with the rest of the scripts. This fixes a number of bugs, e.g. the dragon now appears automatically when the game starts and the question mark animation in the intro is played / stopped at an appropriate time.
* Removed hack from Script::start() which loaded animation 657 before playing it to stop a crash. The fix above seems to fix this bug as well.

svn-id: r43308
2009-08-12 05:20:25 +00:00
Denis Kasak
303085c66b Whenever we enter the top-level loop, disable exiting by default (fixes the high-five scene between Bert and Eveline which ended too fast).
svn-id: r43306
2009-08-12 04:22:47 +00:00
Denis Kasak
6693b22851 * Split loop status and substatus into two different enums since they are 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-12 04:18:45 +00:00
Denis Kasak
100603e683 Fixed Script::walkOnPlay() (was setting loop status whereas it was substatus that needed to be set).
svn-id: r43297
2009-08-12 01:03:54 +00:00
Denis Kasak
3b0895dd2f Added some debug info for loop statuses and dialogues.
svn-id: r43295
2009-08-12 00:56:44 +00:00
Denis Kasak
9093e179cc Added dialogue selection colouring.
svn-id: r43256
2009-08-11 04:53:30 +00:00
Denis Kasak
ee7b9271a2 Implemented GPL command WalkOnPlay.
svn-id: r43255
2009-08-11 04:18:14 +00:00
Denis Kasak
0daad90685 Fix intro crash because of bug in the data files.
svn-id: r43254
2009-08-11 04:14:38 +00:00
Denis Kasak
51cc821619 Added dialogue support.
svn-id: r43253
2009-08-11 04:03:22 +00:00
Denis Kasak
d59d03e52f Multiply itemID by two before using it as an index into the item image archive because every item has a highlighted and a non-highlighted version.
svn-id: r43185
2009-08-09 20:33:58 +00:00
Denis Kasak
b9a9a5ef88 Implemented GPL function Script::funcObjStat().
svn-id: r43176
2009-08-09 16:58:04 +00:00
Denis Kasak
abedc7e9bb Moved cursor state setting (when entering a new room) from Game::loadRoom() to Game::start() (just after running the gate program). This fixes a black cursor bug when the game starts (the cursor should not be even displayed then).
svn-id: r43162
2009-08-09 04:24:52 +00:00
Denis Kasak
f68ceeb88c * Implemented GPL functions Script::funcActIco() and Script::funcIsIcoAct().
* Implemented GPL commands Script::loadMap() and Script::roomMap().
* Added temporary HACK to change some speech texts to use the small font because some strings overflow the screen (as stored in the data files).

svn-id: r43161
2009-08-09 04:12:36 +00:00
Denis Kasak
eeb72e3d0d * Implemented Game::loadWalkingMap().
* 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-09 04:09:24 +00:00
Denis Kasak
e46abf1643 Added Text::setFont().
svn-id: r43159
2009-08-09 03:59:39 +00:00
Denis Kasak
295ab7e6ff Added Mouse::loadItemCursor(). Removed hotspot FIXME as all cursors seem to use the same hotspot (the center of the sprite).
svn-id: r43158
2009-08-09 03:58:03 +00:00
Denis Kasak
c193c80e67 * Test whether an object can be used by evaluating its canUse script (warning: this will break many things currently working until I implement IsIcoAct in my next few commits).
* Removed old HACK note because look / use scripts are now more properly implemented.

svn-id: r43130
2009-08-08 16:17:21 +00:00
Denis Kasak
18b5d7ce33 Implemented Script::testExpression().
svn-id: r43129
2009-08-08 15:55:19 +00:00