Commit Graph

513 Commits

Author SHA1 Message Date
Marcus Comstedt
40f9506163 The default keycolor for mouse pointers used to be 255.
This makes sense as a default for CLUT8 modes, but not really
for anything else.  As part of the gsoc2009-16bit merge, the
default was changed to "all ones", with extra code in the SDL
backend to truncate this to the depth of the mode.  However,
"all ones" (white) still isn't a very useful default for RGB modes.
So rather than jumping through hoops to provide a bad default,
it's better to remove the default altogether.  Engines which relied
on the old default of 255 have been updated to specify it explicitly.

svn-id: r47118
2010-01-07 15:07:36 +00:00
Johannes Schickel
9e04ca3633 Silence gcc warning.
svn-id: r46326
2009-12-09 23:05:36 +00:00
Johannes Schickel
2f372d79d5 Fix compilation for systems without USE_RGB_COLOR defined.
svn-id: r46323
2009-12-09 22:50:12 +00:00
Max Horn
f3420c6372 DRACI: Reduce header interdependencies; some cleanup
svn-id: r46320
2009-12-09 21:03:22 +00:00
Max Horn
c8873d8492 Changed MidiDriver::createMidi to take a MidiDriverType instead of an int
svn-id: r46316
2009-12-09 18:12:51 +00:00
Johannes Schickel
e3d1d914ac Attempt to fix MSVC warning C4121.
svn-id: r46299
2009-12-08 22:07:17 +00:00
Torbjörn Andersson
184a741757 For consistency, make F5 bring up the main menu in the Draci engine too, just
like megath just did in the TeenAgent engine.

svn-id: r46284
2009-12-07 20:32:54 +00:00
Lars Persson
61d68b9d4a Removed <cmath> includes since a) not a part of Symbian OS b) Compiles fine without it (at least with Symbian OS GCCE 3.4.3 and CW 2)
svn-id: r46213
2009-11-30 08:09:39 +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
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
Max Horn
df651bf20f Added Doxygen comments for the various engine namespaces (currently mostly without details; help filling these out is welcome)
svn-id: r46128
2009-11-24 22:10:14 +00:00
Max Horn
e34f1415db DRACI: Reduce header interdependency
svn-id: r46117
2009-11-23 23:54:20 +00:00
Robert Špalek
95d4c62efb Fixed breaking long lines instead of using smaller font (which is sometimes not enough)
svn-id: r46101
2009-11-23 06:44:40 +00:00
Robert Špalek
604ed73b87 Move setIsReloaded(false) in enterNewRoom() to the right place.
Last commit moved it below, but that cancelled GPL2 programs run right
after loading the game.

svn-id: r46099
2009-11-22 21:27:30 +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
772b89682d Make sure hands are empty after loading the game
(otherwise we could have in our hands an unreachable object).  This works
thanks to moving clearing _currentItem into putItem(), which gets called
in inventoryReload().

svn-id: r46096
2009-11-22 20:25:27 +00:00
Robert Špalek
00063b1423 Clearing object animations in a cleaner way
Verified that we really do not need object animations even if they are in
a different location, and clearing them thus regardless of their location.
Although the game was not crashing due to previous work-arounds at this
moment, this cleanup obliterates the most horrible hack and makes sure
animations will never get stale.

svn-id: r46095
2009-11-22 20:17:39 +00:00
Robert Špalek
3d687d07f5 Fixed assert() on already loaded animation
Now the game seems fully playable with crazy loading all the time, even
though it is a hacky solution.  Updated the TODOs

svn-id: r46094
2009-11-22 20:02:13 +00:00
Robert Špalek
4bd395a1ee Updated an urgent TODO to make the game playable
svn-id: r46070
2009-11-22 09:21:40 +00:00
Robert Špalek
2397efd730 Fix SIGSEGV by an absolutely brutally horrible hack
I have thoroughly documented why this hack is needed and added ideas how to
fix it properly.

svn-id: r46068
2009-11-22 09:13:05 +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
5b9bfaee2b Opening the inventory stops hero walking
(otherwise the relative animation would repeat itself unhandled until the
hero disappears from the screen.)

svn-id: r46058
2009-11-22 05:35:36 +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
9297e62aed Fixed re-entering the same room using a different gate
svn-id: r46044
2009-11-21 18:18:09 +00:00
Robert Špalek
de6dc9a784 Handled loading/saving from the map location
svn-id: r45876
2009-11-12 23:33:22 +00:00
Robert Špalek
0a2b2a2256 Removed 2 old TODOs
svn-id: r45874
2009-11-12 22:57:01 +00:00
Robert Špalek
24ccc94f79 Implemented "Mute All"
svn-id: r45873
2009-11-12 22:52:00 +00:00
Robert Špalek
fc0c195ea3 Implementing switching to/from the map room by mouse
svn-id: r45872
2009-11-12 22:41:14 +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
13a2b24ab5 Removed 2 TODOs
svn-id: r45851
2009-11-12 03:25:10 +00:00
Robert Špalek
793761c695 Fixed Script::icoStat()
svn-id: r45850
2009-11-12 03:09:15 +00:00
Robert Špalek
c17e4f1b68 Subtitles are positioned correctly in the inventory
svn-id: r45849
2009-11-12 00:57:38 +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
8ed71d903a Refactored draw() according to drawReScaled()
svn-id: r45826
2009-11-11 02:25:42 +00:00
Robert Špalek
9dd61159cd Documented palette shift
svn-id: r45825
2009-11-11 00:27:08 +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
dea7e18172 Fixed walking to unreachable positions
svn-id: r45823
2009-11-10 23:23:40 +00:00
Robert Špalek
9ba6e8138c Fixed two bugs.
Putting items back to the inventory into clipped coordinates, and exiting
running GPL2 programs when the game engine it to be interrupted.

svn-id: r45822
2009-11-10 23:21:29 +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
ed348133d1 GPL2 callbacks accept const Array& instead of Queue&
svn-id: r45771
2009-11-09 04:27:08 +00:00
Robert Špalek
8edfd6b56c Updated the list of TODOs
svn-id: r45768
2009-11-08 22:48:27 +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
e9c6fd5e39 Fixed aligning items in the inventory
svn-id: r45764
2009-11-08 21:44:30 +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
Robert Špalek
abbb3dccd7 Items put into inventory are placed correctly.
Also, named correctly GPL2 parameter types.

This fixes all FIXMEs

svn-id: r45762
2009-11-08 21:26:04 +00:00
Robert Špalek
121baa2660 Fix running clearing IsReloaded().
Currently, if gate programs used loop(), they exitted immediately due to not
having cleared this flag.

svn-id: r45753
2009-11-08 18:55:41 +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
75bbe04280 Fix enabling mouse cursor when entering a room.
It used to have a wrong palette.

svn-id: r45749
2009-11-08 06:56:30 +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
a4393d46b2 Do not immediately clear the path when it has just 1 vertex.
This fixes the previous bugfix, which causes that I could not re-run the same
program (e.g., by repeatedly clicking on the hollow tree) if the hero did not
move at least one pixel.

svn-id: r45747
2009-11-08 06:30:10 +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
bea00d86cb Tuned Z-coordinate of the dragon.
Adding +1 made the dragon sometimes flip before an object when it should
have been behind.

svn-id: r45745
2009-11-08 05:47:39 +00:00
Robert Špalek
0640b5e402 Renumbered path segments.
Increasing _segment by 1 makes the code much simpler.

svn-id: r45744
2009-11-08 05:44:50 +00:00
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