Commit Graph

31856 Commits

Author SHA1 Message Date
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
Denis Kasak
d2f7268171 Removed TODO concerning the nearest walkable point feature and reworded some obsolete documentation.
svn-id: r43128
2009-08-08 15:53:47 +00:00
Denis Kasak
19d5d66fd7 * Implemented WalkingMap::findNearestWalkable() which mimics a heuristic from the original game that attempts to find walkable spots near the given point
* Implemented moving to the right place when looking / using objects.

svn-id: r43125
2009-08-08 12:31:49 +00:00
Denis Kasak
fc6ff00cbc Implemented Surface::getRect().
svn-id: r43109
2009-08-08 03:17:18 +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
907a35c929 Added ability to end the currently executing GPL program before it finishes via Script::endCurrentProgram().
svn-id: r43086
2009-08-06 07:40:14 +00:00
Denis Kasak
3ce16763c7 Enabled skipping the current line of text if a mouse click occurs.
svn-id: r43085
2009-08-06 05:17:18 +00:00
Denis Kasak
5ea44b9b5e Moved walkHero() (in the main loop) to the appropriate place (in anticipation of a smart finding a walkable point) and disabled walking during script execution / inventory.
svn-id: r43084
2009-08-06 05:04:21 +00:00
Denis Kasak
09e49a354f Turn off mouse cursor and disable titles when running look / use scripts.
svn-id: r43083
2009-08-06 04:50:37 +00:00
Denis Kasak
c2dccaafcd Added method Mouse::isCursorOn().
svn-id: r43082
2009-08-06 04:48:43 +00:00
Denis Kasak
da8bad0ef5 Made the game behave properly and safe when clicking on objects multiple times during talking or executing look/use scripts. Previously, the loop could be called nested arbitrarily many times.
svn-id: r43081
2009-08-06 03:52:08 +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
6546c2ed8e * Added kTitleColour = 255 enum constant used in the following item.
* Added proper colouring of the title animation fonts
* Added Game::getEscRoom().

svn-id: r43063
2009-08-05 02:35:51 +00:00
Denis Kasak
c9b24d2ff9 * Changed title text to use the small instead of the big font
* Handled title positioning
* Cleaned up the main loop a bit (comments, stylistic changes, shortened some lines, etc)
* Fixed setting the dragon's feet position (the x coordinate should be at the midpoint of the animation)

svn-id: r43059
2009-08-05 00:11:09 +00:00
Denis Kasak
88276e91d9 Fixed second call to Surface::centerOnX() (should have been centerOnY()).
svn-id: r43058
2009-08-05 00:05:36 +00:00
Denis Kasak
71dbb75031 * Added Font::getLineWidth()
* Changed Font::getStringWidth() and Font::getStringHeight() to return uint instead of int.
* Made the Font::drawString() overload which accepts a Common::String the "default" one. The overload accepting a (byte *) now calls that one (it was the other way around before).
* Added proper line centering to the Font::drawString() routine. 

svn-id: r43053
2009-08-04 19:23:59 +00:00
Denis Kasak
d3412ea3a4 Refactored Script::talk() to use the new centering methods.
svn-id: r43052
2009-08-04 19:09:41 +00:00
Denis Kasak
561d55ff4d Added Surface methods centerOnX() and centerOnY().
svn-id: r43051
2009-08-04 19:07:12 +00:00
Denis Kasak
41d7590835 * Reverted change that subtracts 1 from font colour indexes for various speaking characters; they are 0-based after all.
* Fixed font blitting algorithm to allow for both white fonts and transparency.

svn-id: r43044
2009-08-04 15:41:27 +00:00
Denis Kasak
5e2eefd4fe * Fixed bug which made characters talk with the wrong colour; the colour indexes are indexed from 1 in the data files so we need to subtract 1.
* Turned on font transparency again. 

svn-id: r43022
2009-08-03 01:48:15 +00:00
Denis Kasak
96744e42c7 Fixed bug in the math expression evaluator; when evaluating operators, operands were being popped from the stack in the wrong order.
svn-id: r43019
2009-08-03 01:06:13 +00:00
Denis Kasak
f9bdd09659 * Fixed bug when reading in persons data. I was reading in coordinates as bytes and font colour as int16; it should be the other way around.
* Handled the kStatusTalk loop substatus properly inside Game::loop().
* Made Game::walkHero() set the person coordinates for the dragon after it warps him to a new location
* Added Game::getPerson() method (used by Script::talk())
* Added Game::setSpeechTick() method (set by Script::talk() and used inside the loop to determine when to switch to new text).

svn-id: r42994
2009-08-02 05:21:21 +00:00
Denis Kasak
77033ca9a1 * Fixed bug in Font::getStringWidth() which made it miscalculate string widths (a temporary variable used for storing the width of the current line was not being reset).
* Temporarily disabled font transparency because the dragon's text is rendered hollow (transparency inside glyph bodies). 

svn-id: r42993
2009-08-02 05:16:36 +00:00
Denis Kasak
6bd1cfa1bd Implemented the Talk GPL command.
svn-id: r42992
2009-08-02 05:12:42 +00:00
Denis Kasak
e6df651c08 Changed some uint16s to uints (to blend more naturally with the rest of the engine).
svn-id: r42991
2009-08-02 05:11:15 +00:00
Denis Kasak
854c27ffac Calculate the character length of Text objects (without the '|' separators) when setting a new string. Implemented Text::getLength().
svn-id: r42990
2009-08-02 05:09:55 +00:00
Denis Kasak
2d1df86f69 Added the strings archive to DraciEngine.
svn-id: r42989
2009-08-02 03:16:44 +00:00
Denis Kasak
014c33718f Added a dedicated animation for speech text.
svn-id: r42988
2009-08-02 03:02:22 +00:00
Denis Kasak
e0e06fc9e0 * Made the engine set the appropriate loop status before running a gate program or entering the main loop
* Removed hack which ran programs for all gates when the room was changed

svn-id: r42977
2009-08-01 17:52:16 +00:00
Denis Kasak
5c6643f0f3 When changing rooms, set the first two game variables to the new room and gate number. Also, if the new room is the map room, set the appropriate coordinates for the dragon in the persons array.
svn-id: r42972
2009-08-01 03:26:39 +00:00
Denis Kasak
240871aa20 * Added support for loop substatus
* Set loop substatus to Ordinary when changing rooms

svn-id: r42971
2009-08-01 03:07:18 +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
18a8b5b3af * Added Game::runGateProgram()
* Added a separate mechanism to Game to keep track both of the current room number and the next room/gate. Periodically, I check whether the new room differs from the old one and, if it does, I do the change. Doing it any other would is nearly impossible because of the way the original scripts were written.
* Added GPL command Script::newRoom(). Rooms can now be traversed by clicking on their exits. Also, the intro animation partly works. Some parts go by far too soon. I assume this is because the engine still lacks a dialogue GPL command.
* Fixed bug where the gates array of a room was not cleared between uses.
* Save old jump value when we enter Script::run() and restore it in the end (mimicking the original engine).
* Fixed small bug where the gate was supposed to be stored as the first in-game variable and not the room number.

svn-id: r42957
2009-07-31 04:32:33 +00:00
Denis Kasak
167b6da230 * Woops, Game::getRoomNum() was already implemented. Removed the superfluous implementation.
* Set the first two game variables to the gate and room number in Game::init()
* Fixed compilation

svn-id: r42916
2009-07-30 03:43:44 +00:00
Denis Kasak
181b155a2f * Added support for keeping track of gates (exits from rooms)
* Added getters and setters for current room and gate numbers

svn-id: r42915
2009-07-30 03:37:04 +00:00
Denis Kasak
7532845fee Fixed sanity check in Animation::setCurrentFrame().
svn-id: r42914
2009-07-30 02:16:58 +00:00
Denis Kasak
b124c8b122 * Added Animation::setCurrentFrame()
* Moved rewinding the animation to the beginning from Animation::nextFrame() to AnimationManager::stop() (fixes the owl animation)

svn-id: r42913
2009-07-30 01:12:07 +00:00
Denis Kasak
6ed99df75a Removed some garbage I accidentally pasted into a comment.
svn-id: r42909
2009-07-29 20:42:55 +00:00
Denis Kasak
ad752b268b * Removed some code I forgot to remove in Game::startPlay() (a call to AnimationManager::play())
* Fixed logic checking for object visibility in various GPL commands (I originally misinterpreted the original engine code).

svn-id: r42908
2009-07-29 20:41:53 +00:00