aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/script.cpp
AgeCommit message (Collapse)Author
2009-08-03Fixed bug in the math expression evaluator; when evaluating operators, ↵Denis Kasak
operands were being popped from the stack in the wrong order. svn-id: r43019
2009-08-02Implemented the Talk GPL command.Denis Kasak
svn-id: r42992
2009-07-31* Added Game::runGateProgram()Denis Kasak
* 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-29Removed some garbage I accidentally pasted into a comment.Denis Kasak
svn-id: r42909
2009-07-29* Removed some code I forgot to remove in Game::startPlay() (a call to ↵Denis Kasak
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* Implemented the StartPlay and Play GPL commands properlyDenis Kasak
* Changed Script::load() to use the new animation callbacks svn-id: r42902
2009-07-29* Implemented GPL function ActPhase (as Script::funcActPhase())Denis Kasak
* Trivial implementation of the Play GPL command * Fixed Script::load() to load animation IDs to objects in increasing order (needed by funcActPhase()) svn-id: r42874
2009-07-25* Moved walking code to Game::walkHero().Denis Kasak
* Implemented WalkOn GPL command. * Temporarily remaped StayOn and WalkOnPlay to WalkOn (for testing). svn-id: r42735
2009-07-25Made Script::run() manually mark the last animation index before it executes ↵Denis Kasak
a program. This is done to prevent Release wreaking havoc if it is unpaired (i.e. if the script forgot to call a Mark first). svn-id: r42733
2009-07-25Implemented ExecUse, ExecLook and ExecInit GPL commands.Denis Kasak
svn-id: r42732
2009-07-25* Added DraciEngine::_initArchive and made Game use it. Fixes a memory bug ↵Denis Kasak
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* Added handlers for the ObjStat and ObjStat_On GPL commandsDenis Kasak
* Removed temporary hack I accidentally committed svn-id: r42730
2009-07-24Temporary mapped GPL command StartPlay to handler for Start and reenabled ↵Denis Kasak
gates' scripts (for added effects and testing). svn-id: r42684
2009-07-24* Added tracking and deleting animations by index (which represents the ↵Denis Kasak
order in which they were loaded). This is needed by some GPL commands. * Added Game::getNumObjects() which returns the number of objects in the game * Fixed segfault (accessing a null Animation *) * Added some docs to various things svn-id: r42683
2009-07-17* Added Game::loop()Denis Kasak
* Added WalkingMap::isWalkable() * Renamed remaining _priority identifiers to _z which were left by mistake in the previous commit svn-id: r42546
2009-07-15* Changed Game members _numMasks, _init, _look, _use and _canUse from uint16 ↵Denis Kasak
to int * Modified Game::loadRoom to load gates and execute their scripts * The first room loaded is now Game::_info._startRoom instead of 0 * Fixed reading of _pers0 and _persStep from the data files (they are 6 instead of 12 bytes) * Added more debug info to Script and Game svn-id: r42515
2009-07-13* Implemented the following GPL functions: IsIcoOn, IcoStat, IsObjOn, ↵Denis Kasak
IsObjOff, IsObjAway * Changed GameObject::_location to an int since we sometimes use location -1. * Some more uint <-> int changes to prevent comparisons between signed and unsigned. svn-id: r42452
2009-07-12Fixed bug in the GPL math evaluator (GPL function results were not pushed ↵Denis Kasak
onto the evaluation stack). svn-id: r42424
2009-07-08Made Script::run() seek in SEEK_CUR mode when jumping instead of the default ↵Denis Kasak
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* Implemented GPL jumpsDenis Kasak
* 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-07* Made Game::_variables private and, instead, added ↵Denis Kasak
Game::{get,set}Variable() methods. * Removed obsolete comment about the cyclic field not being used in Game::loadAnimation() svn-id: r42246
2009-07-07Implementend F_Not GPL function.Denis Kasak
svn-id: r42245
2009-07-07* From Game::GameObject removed the following _idxSeq, _numSeq, _animObj, ↵Denis Kasak
_seqTab (not used anymore), added Common::Array<int> _anims. * Handled cylic animations properly * Handled the Z coordinate properly svn-id: r42244
2009-07-07* Changed Game::_variables to public since the GPL interpreter needs to use ↵Denis Kasak
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-07Made GPL interpreter exit on both gplend and exit instructions.Denis Kasak
svn-id: r42241
2009-07-07Added enum constant for the dragon object (kDragonObject) and made ↵Denis Kasak
Script::start() a bit more readable. svn-id: r42236
2009-07-06Removed two variables that were committed by mistake.Denis Kasak
svn-id: r42193
2009-07-06Implemented Script::funcRandom (GPL function).Denis Kasak
svn-id: r42191
2009-07-06Set up GPL functions properly (the math evaluator now calls the handler if ↵Denis Kasak
its implemented). svn-id: r42188
2009-07-06Fixed bug where the GPL interpreter left parameters from previous commands ↵Denis Kasak
on the stack. svn-id: r42185
2009-07-06Implemented Script::play() GPL opcode.Denis Kasak
svn-id: r42184
2009-07-06Implemented GPL operators.Denis Kasak
svn-id: r42183
2009-07-04Implemented handler for the Load instruction. Removed Script::dummy().Denis Kasak
svn-id: r42102
2009-07-04Restructured Script so I can start adding callbacks to GPL commands (added ↵Denis Kasak
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-06-28Added an offset parameter to Script::run() so we can specify where to start ↵Denis Kasak
the GPL program execution. Also, the init script for the dragon object is now run inside Game::Game(). svn-id: r41928
2009-06-28Changed Script::run() to accept a GPL2Program struct instead of a byte ↵Denis Kasak
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-27Renamed Script::gpldisasm() to Script::run().Denis Kasak
svn-id: r41920
2009-06-27Put all GPL interpreter related routines inside a Script class.Denis Kasak
svn-id: r41919
2009-06-27Renamed gpldisasm.* to script.* in anticipation of using it as a script ↵Denis Kasak
intepreter. svn-id: r41918