Commit Graph
128 Commits
Author SHA1 Message Date
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 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
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 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 edd338b229 Make engines/draci/ compilable after merging from a branch
svn-id: r44327
2009-09-25 06:43:33 +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 1c0df34b4d Removed _roomChange hack since it's no longer needed.
svn-id: r43392
2009-08-15 02:53:14 +00:00
Denis Kasak 51cc821619 Added dialogue support.
svn-id: r43253
2009-08-11 04:03:22 +00:00
Denis Kasak 58c56e28b9 Fixed the 'ESC room' feature to work as intended.
svn-id: r43087
2009-08-06 07:42:14 +00:00
Denis Kasak e632106169 * Made some type changes to struct/class members in game.cpp (uint -> int and uint16 -> uint)
* Added enum constant kNoEscRoom for rooms that have no escape room defined
* Fixed crash when ESC is pressed in rooms which have no escape room defined
* Renamed kNotFound (used as a return value for Game::getObjectWithAnimation) to kObjectNotFound for clarity.

svn-id: r43072
2009-08-05 17:58:14 +00:00
Denis Kasak 1363a0680a * Implemented the "escape room" feature of the original engine which lets a user switch to another location (or skip the intro) by pressing ESC (the escRoom for every location is stored in the data files).
* Reworked the left and right arrow key commands so they don't call changeRoom() themselves but instead schedule the room change via Game::setRoomNum(). In this way, changing rooms like that is still a hack but a bit more "natural", since the loop doesn't get skipped, the gate scripts get run, etc.

svn-id: r43065
2009-08-05 02:42:23 +00:00
Denis Kasak 2d1df86f69 Added the strings archive to DraciEngine.
svn-id: r42989
2009-08-02 03:16:44 +00:00
Denis Kasak 52a1c5df91 Added archives for item descriptions and images.
svn-id: r42970
2009-08-01 02:49:40 +00:00
Denis Kasak e9669b8e2b * Moved event handling to DraciEngine::handleEvents()
* Added Game::start() method which is called from DraciEngine::go()
* Made Game::loop() suitable for calling from other places (like GPL scripts) by handling events, redrawing the screen, etc from inside. This way it doesn't freeze the game if it doesn't return immediately.
* Added Game::shouldQuit() and Game::setQuit() which can be used to signal the engine to quit.
* Fixed race condition related to mouse buttons not getting released.
* Instead of deleting frames for the title animation and adding a new one, reset the text for its frame.

svn-id: r42875
2009-07-29 01:11:53 +00:00
Denis Kasak aa6efa33f1 Fixed segfault when the screen is deleted before animations (the Animation destructor still needs to use the screen).
svn-id: r42837
2009-07-27 04:20:27 +00:00
Denis Kasak d28658984d * Added DraciEngine::_initArchive and made Game use it. Fixes a memory bug because Game uses pointers from the init archive which should outlive it (but didn't previously).
* Added support for setting loop status to Game.
* Made some GPL commands check whether we are in the correct loop status before executing.

svn-id: r42731
2009-07-25 03:28:04 +00:00
Denis Kasak 5a77f089e1 Check whether the walking map overlay is already in the desired state so we don't start/stop it over and over.
svn-id: r42651
2009-07-22 05:03:34 +00:00
Denis Kasak 6097828f54 Made 'show walking map overlay' setting persist when changing rooms.
svn-id: r42628
2009-07-20 17:34:19 +00:00
Denis Kasak 94417e7743 * Added support for "walking" with the hero (i.e. moving the sprite to locations allowed by the walking map)
* Enabled drawing the walking map with the 'w' hotkey for testing

svn-id: r42581
2009-07-18 03:00:12 +00:00
Denis Kasak 8e1f296308 Removed room switching hack from Mouse and re-added it to DraciEngine::go() (right arrow switches to the next room, left to the previous.
svn-id: r42577
2009-07-18 01:11:45 +00:00
Denis Kasak cfa4d5eba0 Added sanity checks for all archives (whether opening succeeded).
svn-id: r42547
2009-07-17 00:24:56 +00:00
Denis Kasak e419110569 * Added Game::loop()
* Added WalkingMap::isWalkable()
* Renamed remaining _priority identifiers to _z which were left by mistake in the previous commit

svn-id: r42546
2009-07-17 00:20:57 +00:00
Denis Kasak 652acfc4ca * Added WalkingMaps class
* Added DraciEngine::walkingMapsArchive
* Made Game::loadRoom() read in the current walking map

svn-id: r42541
2009-07-16 18:31:15 +00:00
Denis Kasak e031709989 Added _iconsArchive to DraciEngine and modified the Mouse class to use it.
svn-id: r42535
2009-07-16 16:06:29 +00:00
Denis Kasak 1bf574aaa9 Added proper cursor state handling (when in rooms that don't use the mouse). Added a HACK note for running the gates' scripts.
svn-id: r42532
2009-07-16 12:07:41 +00:00
Denis Kasak a4a3ad123c Renamed Font::setFont() to loadFont(). Removed DraciEngine::_font and added _smallFont and _bigFont so each font can be handled separately.
svn-id: r42514
2009-07-15 18:16:54 +00:00
Denis Kasak 32d692aea6 Made the engine clear some more caches when it changes rooms (room, sprites and palette caches). Made the DraciEngine destructor delete the rooms, overlays and animations archives.
svn-id: r42250
2009-07-08 00:40:22 +00:00
Denis Kasak 8e341ee968 Renaming Animation -> AnimationManager and AnimObj -> Animation in light of the new API change.
svn-id: r42133
2009-07-05 11:52:17 +00:00
Denis Kasak b96b434446 * Added Game::init() and moved some functionality from Game::Game to it (loading objects, changing rooms)
* Made Game::load*(), Game::getObject() and Game::changeRoom() methods public
* Stopped specifying Z coordinate when creating some Sprites (which I forgot in my previous commit)

svn-id: r42101
2009-07-04 18:35:08 +00:00
Denis Kasak b1d6377aa1 Added _animationsArchive member to DraciEngine.
svn-id: r42091
2009-07-04 14:54:22 +00:00
Denis Kasak 885ce59ce8 Restructured Script so I can start adding callbacks to GPL commands (added DraciEngine * member to Script, added Script::setupCommandList() which initialises the command list array, added Script::dummy() callback for the Load command for testing).
svn-id: r42090
2009-07-04 14:48:36 +00:00
Denis Kasak 1853d594b8 Enabled loading room number 1 as a test.
svn-id: r42071
2009-07-03 17:55:28 +00:00
Denis Kasak 52642e2dc9 Added two more debug levels (logic and animation).
svn-id: r42065
2009-07-03 16:35:04 +00:00
Denis Kasak b232202b33 Removed demo code so I can start working on the real intro.
svn-id: r42063
2009-07-03 16:29:56 +00:00
Denis Kasak cac39d8295 Added rooms and overlays archives.
svn-id: r42035
2009-07-02 19:57:09 +00:00
Denis Kasak be3c0461d6 DraciEngine now opens and stores pointers to essential archives. Changed code that used those archives to use that instead of opening them manually. Replaced BArchive::operator[] functionality with BArchive::getFile() to prevent ugliness when accessing archives via pointers.
svn-id: r42031
2009-07-02 16:15:32 +00:00
Denis Kasak 1373eeea12 Made Text objects calculate their widths and heights properly.
svn-id: r41998
2009-07-01 16:14:04 +00:00
Denis Kasak cfadb6cc3d Made coordinate specification mandatory when constructing objects of type Sprite and Class. Made transforming from columnwise a default (since it was done most of the time anyway). Changed coordinates to use uint instead of uint16.
svn-id: r41996
2009-07-01 16:00:27 +00:00
Denis Kasak f0fcd7fd8e Modified Sprite, Text and Drawable to handle data hiding properly since they're no longer just C-like struct containers. Implemented getters/setters accordingly and changed existing code that used those classes.
svn-id: r41995
2009-07-01 15:22:36 +00:00
Denis Kasak 4895993588 Added Text::setText() and Text::setColour() methods. Changed demo animation to use them.
svn-id: r41984
2009-07-01 01:43:20 +00:00
Denis Kasak 4c86646db6 Changed intro animation to render text via the new Text class.
svn-id: r41983
2009-07-01 01:25:48 +00:00
Denis Kasak f61b2d289d Changed Script::run() to accept a GPL2Program struct instead of a byte pointer and a length. Also, Script::run() now executes the GPL program until a gplend instruction rather than to the end of the whole program. Modified GameObject according to the new changes.
svn-id: r41927
2009-06-28 16:19:10 +00:00
Denis Kasak 948bf2cfcc Removed disassembling of the GPL script for the first game location from Draci::init().
svn-id: r41926
2009-06-28 15:28:20 +00:00
Denis Kasak 1e70f25fcf Added Script instance to DraciEngine. Restored disassembling of a demo script on engine startup (previously via gpldisasm(), now via _script->run()).
svn-id: r41921
2009-06-27 15:26:33 +00:00
Denis Kasak 97dde5e1ed Put all GPL interpreter related routines inside a Script class.
svn-id: r41919
2009-06-27 15:17:26 +00:00