Commit Graph

113 Commits

Author SHA1 Message Date
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
Robert Špalek
96068d30d9 Handle properly shouldQuit()
svn-id: r47215
2010-01-10 01:25:37 +00:00
Max Horn
f3420c6372 DRACI: Reduce header interdependencies; some cleanup
svn-id: r46320
2009-12-09 21:03:22 +00:00
Robert Špalek
63a6480057 Hopefully fix switching to the map right after switching the location
It seems that the mouse was simply on the below line and triggered the switch
to the map without the user realizing.

svn-id: r46171
2009-11-28 00:57:42 +00:00
Robert Špalek
f6f8b66d45 Remove obsolete and unneeded logic bypassing reloading a location.
I have tested that this could only possibly happen when the game has been
loaded with last location being the map.  Then pressing Escape calls
enterNewRoom() and this superfluous optimization takes place.  It is harmless
to simply reload the map.  After having removed it, enterNewRoom() needs not
return any return value, because the test at the tail can be done by the
caller.  I have then restructured the code a little to make it cleaner.

svn-id: r46098
2009-11-22 21:12:23 +00:00
Robert Špalek
d3d16422e0 Further cleaned up the hack with removing old animations.
Now only a long-term (complete rewrite) TODO is left in the code, but nothing
urgent to solve.

svn-id: r46097
2009-11-22 20:44:37 +00:00
Robert Špalek
3ddf90a872 Only enable changing rooms by left/right arrows when debugging
svn-id: r46059
2009-11-22 05:42:46 +00:00
Robert Špalek
44afaf9bf1 Display/remove the inventory based on mouse "gestures"
svn-id: r45855
2009-11-12 09:27:41 +00:00
Robert Špalek
d281fe4717 Added runWrapper() calling run() and some actions around it.
This simplifies a lot of code calling run().  Also, scripts called from the
inventory are now called with disabled mouse and title, as desired.

svn-id: r45848
2009-11-12 00:45:28 +00:00
Robert Špalek
78a10999ab Cleaned up searching the closest point.
The old comments were completely misleading although the algorithm was good.

svn-id: r45824
2009-11-11 00:19:23 +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
b257892387 Removed almost all TODOs from the header files
svn-id: r45765
2009-11-08 21:49:40 +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
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
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
0071829aee Implement properly stayOn instead of using walkOn
svn-id: r45641
2009-11-03 21:30:24 +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
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
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
f3700a23e9 Move WalkingMap instance to Game, and clean up parameters
svn-id: r45516
2009-10-30 02:15:41 +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
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
819449d099 Implemented GPL2 commands for music.
Debugged everything.

svn-id: r45330
2009-10-22 07:34:43 +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
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
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
Max Horn
3399c3aeb6 Change doxygen inline comments from "//!" to "///" as proposed on -devel
svn-id: r44802
2009-10-08 21:28:57 +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
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
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
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
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