11045 Commits

Author SHA1 Message Date
Denis Kasak
eef64cc737 Enabled some more rooms in the demo and disabled loading the former distributor logo.
svn-id: r42426
2009-07-12 19:02:08 +00:00
Denis Kasak
d369a257d1 Enabled clearing the screen when the room changes since some rooms do not draw anything on some parts of the screen.
svn-id: r42425
2009-07-12 19:00:24 +00:00
Denis Kasak
a41d36de0f Fixed bug in the GPL math evaluator (GPL function results were not pushed onto the evaluation stack).
svn-id: r42424
2009-07-12 18:55:44 +00:00
Denis Kasak
6b2991f488 Made Script::run() seek in SEEK_CUR mode when jumping instead of the default SEEK_SET. It also now checks whether there is a non-zero jump value set before doing the jump.
svn-id: r42254
2009-07-08 06:14:17 +00:00
Denis Kasak
0ec737db69 Stopped doing a screen update immediately after changing the palette. This caused a noisy effect when changing rooms because the palette was changed before the new scene was loaded.
svn-id: r42251
2009-07-08 00:48:03 +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
d8c33f6836 * Implemented GPL jumps
* Implemented c_If, c_Goto and c_Let opcodes
* Changed the interpreter to work with signed ints instead of uints (the interpreter uses negative values sometimes)
* Fixed documentation of Script::run() which said it is a disassembler (forgot to change it earlier)

svn-id: r42249
2009-07-08 00:34:53 +00:00
Denis Kasak
68ec1350c0 Fixed two mismatched (de)allocations in BArchive and BAFile.
svn-id: r42247
2009-07-07 21:46:34 +00:00
Denis Kasak
dd955bb08e * Made Game::_variables private and, instead, added Game::{get,set}Variable() methods.
* Removed obsolete comment about the cyclic field not being used in Game::loadAnimation()

svn-id: r42246
2009-07-07 21:30:36 +00:00
Denis Kasak
bab9293f97 Implementend F_Not GPL function.
svn-id: r42245
2009-07-07 21:24:39 +00:00
Denis Kasak
586af0ab42 * From Game::GameObject removed the following _idxSeq, _numSeq, _animObj, _seqTab (not used anymore), added Common::Array<int> _anims.
* Handled cylic animations properly
* Handled the Z coordinate properly

svn-id: r42244
2009-07-07 21:18:28 +00:00
Denis Kasak
9246e9cf4a * Added some more animation debug info
* Reordered Animation::nextFrame() a bit to make sure the timings are correct (particularly the last frame)
* Added checks to AnimationManager::play() and AnimationManager::stop() so it doesn't dereference a null pointer.

svn-id: r42243
2009-07-07 21:11:36 +00:00
Denis Kasak
b6b1402368 * Changed Game::_variables to public since the GPL interpreter needs to use it and made it int instead of uint16
* Implemented variable accessing by the math evaluator
* Fixed bug from previous commit (should have used && when checking for ending instructions, not ||)

svn-id: r42242
2009-07-07 20:57:14 +00:00
Denis Kasak
318d406242 Made GPL interpreter exit on both gplend and exit instructions.
svn-id: r42241
2009-07-07 20:46:26 +00:00
Denis Kasak
d37d49e50c Removed testing hack from Game::init() that displayed the dragon in the upper left corner. Replaced some more instances of magic numbers with kDragonObject. Made Game::init() a bit more readable.
svn-id: r42237
2009-07-07 19:53:40 +00:00
Denis Kasak
fd2ab9e3c0 Added enum constant for the dragon object (kDragonObject) and made Script::start() a bit more readable.
svn-id: r42236
2009-07-07 19:50:12 +00:00
Denis Kasak
c258eefc82 Made AnimationManager::getAnimation() return NULL when an animation is not found instead of Common::List<>::end().
svn-id: r42228
2009-07-07 15:39:18 +00:00
Denis Kasak
d519626c55 Added const keyword to "transparent" local variable in Sprite::draw() and removed leading underscore.
svn-id: r42227
2009-07-07 15:37:50 +00:00
Denis Kasak
4cfdf8c855 Shortened AnimationManager::{play,stop}(). Removed some excessive newlines.
svn-id: r42226
2009-07-07 15:35:35 +00:00
Denis Kasak
2e552bf643 Stopped running the room init scripts twice.
svn-id: r42225
2009-07-07 15:31:13 +00:00
Denis Kasak
7f3af129f2 mplemented changing rooms properly (overlays and objects' animations are deleted before a new room is loaded) and set up a quick demonstration (left click advances to the next room, right click goes back).
svn-id: r42224
2009-07-07 15:21:41 +00:00
Denis Kasak
82e6bcea2f * Added AnimationManager::deleteOverlays().
* Fixed bug in AnimationManager::deleteAnimation() that could result in accessing the Common::List::end() sentinel value.

svn-id: r42223
2009-07-07 14:52:36 +00:00
Denis Kasak
79c42abf08 * Fixed extracting visibility and location of object from its status byte
* Added Game::getRoomNum() which returns the current room number
* Made Game::loadRoom() execute the room's startup script, load the room's objects and run their init scripts as well

svn-id: r42194
2009-07-06 19:50:59 +00:00
Denis Kasak
3b75b8003d Removed two variables that were committed by mistake.
svn-id: r42193
2009-07-06 19:43:21 +00:00
Denis Kasak
61fa4d27d5 Cache the transparent colour instead of calling a function for every pixel.
svn-id: r42192
2009-07-06 19:41:13 +00:00
Denis Kasak
b2c24dd640 Implemented Script::funcRandom (GPL function).
svn-id: r42191
2009-07-06 19:26:53 +00:00
Denis Kasak
218a15d890 Made _rnd member of DraciEngine public.
svn-id: r42190
2009-07-06 19:22:13 +00:00
Denis Kasak
edaaca97f9 Set up GPL functions properly (the math evaluator now calls the handler if its implemented).
svn-id: r42188
2009-07-06 18:49:51 +00:00
Denis Kasak
237707dd6e Fixed bug where the GPL interpreter left parameters from previous commands on the stack.
svn-id: r42185
2009-07-06 17:29:44 +00:00
Denis Kasak
4e15262e74 Implemented Script::play() GPL opcode.
svn-id: r42184
2009-07-06 17:27:12 +00:00
Denis Kasak
f4ba64d2e4 Implemented GPL operators.
svn-id: r42183
2009-07-06 17:25:34 +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
6c3e9f5151 * API change for Animation and AnimObj; AnimObj is now a proper class and each instance handles its own animation. Animation handles adding, fetching and deleting of AnimObjs (probably needs a namechange).
* Implemented actual animation (previously only the first frame was display)
* Implemented animation starting, stoping, looping
* Loaded looping dragon animation as a test

svn-id: r42114
2009-07-05 03:24:46 +00:00
Denis Kasak
960740fe83 Rewrote Sprite::draw() to draw overflowing sprites correctly. Stopped playing animations as soon as they're loaded from Game::loadAnimation().
svn-id: r42111
2009-07-04 23:05:13 +00:00
Denis Kasak
fdf9eb84d6 Implemented handler for the Load instruction. Removed Script::dummy().
svn-id: r42102
2009-07-04 18:36:45 +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
a06509f3c2 * Removed tracking of Z coordinates in Drawable since it's not used
* Made columnwise parameter mandatory
* Made Sprite coordinates signed (the engine sometimes uses negative coordinates)
* Prevented overflow when drawing sprites in some cases

svn-id: r42100
2009-07-04 18:29:01 +00:00
Denis Kasak
0888e8a6da * Split code from Game::changeRoom() into Game::loadRoom() and game::loadOverlays(). Game::changeRoom() now calls them instead.
* Added Game::loadAnimation()
* The engine now stores "real" indexes (zero-based) instead of Pascal's because the previous approach was messy. 

svn-id: r42092
2009-07-04 15:21:12 +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
a4e6464a63 Added support for playing and stopping animations.
svn-id: r42075
2009-07-03 19:05:58 +00:00
Denis Kasak
63d0fdea68 Added Sprite::getRect() and Text::getRect().
svn-id: r42074
2009-07-03 19:02:08 +00:00
Denis Kasak
4465ecf123 Added deconstructor for Animation. Made Animation objects delete their frames when deleteAll() or deleteAnimation() are called.
svn-id: r42073
2009-07-03 18:19:51 +00:00
Denis Kasak
c651d1c2e2 Made Game::changeRoom() clear the overlaysArchive cache when it's done loading overlays.
svn-id: r42072
2009-07-03 18:17:05 +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
4ba1ea8adf Added support for loading room overlays to Game::changeRoom().
svn-id: r42070
2009-07-03 17:54:13 +00:00
Denis Kasak
22cfdf01ee Made the animation engine compile.
svn-id: r42069
2009-07-03 17:53:05 +00:00
Denis Kasak
c178409b56 Implemented beginning of the animation engine.
svn-id: r42068
2009-07-03 17:50:22 +00:00
Denis Kasak
90e6ff9d8a Added support for mirrored sprites.
svn-id: r42067
2009-07-03 17:39:13 +00:00
Denis Kasak
8e9771d15c Added bool parameter markDirty to Sprite::draw() and Text::draw() to specify whether to mark a dirty rect for a particular draw (also added such support to the Font class since it's needed by Text). Made spacing parameters for Text instances mandatory.
svn-id: r42066
2009-07-03 16:41:11 +00:00