aboutsummaryrefslogtreecommitdiff
path: root/sword2/function.cpp
AgeCommit message (Collapse)Author
2005-06-20WhitespaceTorbjörn Andersson
svn-id: r18415
2005-05-12Whitespace: "(type *)something" instead of "(type *) something", becauseTorbjörn Andersson
that's how we write it in most other places. svn-id: r18069
2005-05-12Moved some more animation stuff out of the Logic class and into theTorbjörn Andersson
increasingly misnamed Router class. (I'll fix the naming later. Probably.) svn-id: r18066
2005-05-03More cleanup/restructuring: Moved walk-related code from Logic to Router.Torbjörn Andersson
(I may have to think up some better name for that class later.) svn-id: r17901
2005-05-02Cleanup. Most of is simply moves the credits code out of Logic and intoTorbjörn Andersson
Screen. I've also added an unused "splash screen" function that displays the image that used to be shown by CacheNewCluster() while copying a data file from CD to hard disk. ScummVM doesn't do that, but it's a nice image that I wish we could do something useful with, and it's easier to have the code here for reference than having to dig through old revisions of the resource manager. svn-id: r17894
2005-04-24Moved conversation stuff from Logic to Mouse.Torbjörn Andersson
svn-id: r17787
2005-04-22* Added new virtual base class 'Stream', ReadStream andMax Horn
WriteStream are now subclasses of it. * Added new methods eos(), ioFailed(), clearIOFailed() to all streams. This allows better error checking. * SaveFile classes take advantage of these new standard stream APIS * Removed File::gets() * Added SeekableReadStream::readLine() (replaces File::gets) * Added WriteStream::writeString, for convenience svn-id: r17752
2005-02-27Got rid of all the .h files but one in the 'driver' directory. They wereTorbjörn Andersson
either very small or, in the case of driver96.h, a disorganized jumbles. svn-id: r16952
2005-02-20More BS2 restructuring.Torbjörn Andersson
The various game settings are no longer stored in the Gui class. They are stored in the class that use them. Code that doesn't belong in the Gui class, e.g. the "restart" code, has been moved out of it. Afterwards, the Gui class had been reduced to nothing more than a handful of trivial methods for invoking the in-game dialogs. So the entire Gui class has been removed. svn-id: r16827
2005-02-19This is the second part of the BS2 restructuring. There are two newTorbjörn Andersson
classes: Screen and Mouse. Screen handles most of the drawing, except the mouse cursor and in-game menus. The old Graphics class is no more. I've also fixed some "reverse stereo" regressions from the first part of the restructuring. I'm not sure what the next step will be, but hopefully it will be smaller than this one was. svn-id: r16812
2005-02-08Now there are two file handles for the music: one for each CD. This is notTorbjörn Andersson
the same thing as one for each music stream. If both music streams are playing music from the same CD, they will both take turns at using the same file handle. The only case where both file handles are used is when music from one CD is fading in while music from the other CD is fading out. Which of course can only happen if you play the game from hard disk. If the game has to ask for the other CD, it kills the music immediately. The reason for doing this is that there was some concern about whether having two file handles open to the same file was portable or not. I don't think that question was ever fully answered, so I avoid the situation. svn-id: r16753
2005-01-28Began what I hope is the final major restructuring of the BS2 engine.Torbjörn Andersson
In this first step, I have moved all opcode functions into functions.cpp, instead of having them scattered all over the place. To get things to compile again, I had to rewrite the overly complicated sound effects handling. It's much simpler now. The next step will be to move any non-trivial code out of the opcode functions and into the appropriate object. This, I hope, will make it easier to create well-separated objects, instead of the current mess. I also want to tear down the artificial boundary between the main directory and the "driver" directory. We already have a cross-platform layer; there's no need to have yet another one. (Actually, the rewriting of the sound effects code took one first step in this direction.) At the final stage, I'd like to get rid of the "drivers" directory completely, but I'll probably need some help with that if I want to preserve the CVS history of the code. Things will probably be a bit bumpy along the way, but I seem to have reached a point of relative stability again, which is why I'm commiting this now. svn-id: r16668
2005-01-20Fixed bug that I must have introduced during one of my cleanups. TheTorbjörn Andersson
original code read "LLogic.Logic_up( (*params*65536)+2);". I don't know where this opcode is actually used, though. svn-id: r16600
2005-01-17Updated copyright header, as discussed on the mailing list.Torbjörn Andersson
svn-id: r16580
2005-01-10system.h was being included in tons of places, without any good reason; ↵Max Horn
reduced this (total dependencies on system.h went down from 193 to 85 files) svn-id: r16527
2005-01-01Updated copyright year.Torbjörn Andersson
svn-id: r16397
2004-11-16CleanupTorbjörn Andersson
svn-id: r15826
2004-11-14CleanupTorbjörn Andersson
svn-id: r15810
2004-10-19Cleanup of the credits code. Use the new gets() function.Torbjörn Andersson
svn-id: r15609
2004-09-28Rename remaining OSystem methods to match our coding guidelinesMax Horn
svn-id: r15332
2004-09-04Rewrote the code that loads credits.clu into memory. The new code isTorbjörn Andersson
perhaps less clever than the old one I wrote, but should be much easier to read. Besides, the old code had a small memory leak in it. svn-id: r14897
2004-09-04Added support for compressed music. I'm sure there are some glitches stillTorbjörn Andersson
to fix, but it should work well enough for now. In this rewrite of the music code, I removed the "save/restore music state" function, since it just complicated things for a very small gain. It wasn't in the original engine, and I added it just for the credits, so that the previously playing music could be resumed afterwards. I might re-add it later, but probably not. svn-id: r14887
2004-06-10If the 'time' parameter to displayMsg() is 0, wait until the user clicksTorbjörn Andersson
or presses a button. This is how displayMsg() was always used, so the only difference is that the code to check for events is no longer outside the function. In the process, it turned out that removeMsg() was probably unnecessary so I have removed it. May cause regressions, but we can deal with them later. svn-id: r13953
2004-06-09Cleaned up the palette handling a bit. Renamed _palCopy to _palette since ITorbjörn Andersson
found the old name misleading (there is only one array that stores the palette in the engine, though it could be argued that it's a copy of the one used by the backend), and removed some code that I'm almost certain was never used. (I've added assert()s to trigger in the cases where it would have been used.) svn-id: r13949
2004-05-09Removed the buffering of mouse and keyboard events. I don't think any ofTorbjörn Andersson
our other engines do this, so there is little reason for BS2 to. I did add a filtering mechanism so that mouse button releases and scroll wheeling is ignored during normal gameplay, but I don't know if that was necessary either. Since this left little more than an empty husk where the Input class used to be, I've eliminated that class and buried its remains in Sword2Engine. svn-id: r13812
2004-04-23Major revamping of the BS2 memory manager and, some small changes to theTorbjörn Andersson
resource manager. All new code! All new bugs! svn-id: r13603
2004-04-16CleanupTorbjörn Andersson
svn-id: r13582
2004-03-30CleanupTorbjörn Andersson
svn-id: r13431
2004-03-17Use the same syntax for accessing script variables as BS1 does, i.e. nowTorbjörn Andersson
it's Logic::_scriptVars[ID] instead of just ID. Apart from looking cool, it makes it much easier to tell the difference between variables and constants when looking at the code. Of course, this sort of sweeping changes is jolly good for introducing truly weird regressions, which is why I waited until after 0.6.0. svn-id: r13331
2004-03-01Add fix for error at end of sword2demo (From eriktorbjorn)Travis Howell
Prevent false warnings in demo. svn-id: r13102
2004-02-05Removed some of the #includes from sword2.hTorbjörn Andersson
svn-id: r12739
2004-01-17Yet Another EVC fixNicolas Bacca
svn-id: r12452
2004-01-12- whitespacesPaweł Kołodziejski
- fix for compilation at MAX, at include types - changed to our types svn-id: r12344
2004-01-12Sync the credits so that the text scroll and music will last for about theTorbjörn Andersson
same amount of time. I don't think the original did this, but it turned out to be pretty easy. svn-id: r12334
2004-01-11cleanupTorbjörn Andersson
svn-id: r12322
2004-01-09Removed redundant comments.Torbjörn Andersson
svn-id: r12279
2004-01-08Allow quitting during cutscenes and credits again. This is getting a bitTorbjörn Andersson
hackish... svn-id: r12247
2004-01-06It's a new year in BS2 land, too!Torbjörn Andersson
svn-id: r12181
2004-01-06Made sure the screen is really cleared when drawing a dialog window, plusTorbjörn Andersson
some other cleanups. (This was a regression caused by the less stupid screen updates implemented recently.) svn-id: r12180
2004-01-05Slowed down the credits slightly. With the recent optimizations, the musicTorbjörn Andersson
lasted longer than the text. Now the text lasts longer than the music. svn-id: r12151
2004-01-04Adapted LavosSpawn's idea for more efficient screen updating. It stillTorbjörn Andersson
renders the entire screen every frame, but it tries to update (i.e. copy to the backend) only the parts of the screen that actually changed. At least approximately so. svn-id: r12142
2003-12-31Some tweaking of the new credits code. It is no longer necessary to haveTorbjörn Andersson
to have the credits.bmp file, though if you don't you won't see the "Smacker" logo. (Whether or not this is a feature is open to debate.) Happy New Year! svn-id: r12062
2003-12-31I still don't know how to draw the credits like the original did, but atTorbjörn Andersson
least the credits text is showing now. svn-id: r12053
2003-12-28Hopefully the last big renaming. Now the datatypes have names likeTorbjörn Andersson
"StandardHeader" instead of "_standardHeader". svn-id: r11997
2003-11-25cleanupTorbjörn Andersson
svn-id: r11364
2003-11-16More cleanup. I've eliminated all the temporary global variables I've addedTorbjörn Andersson
over the past few weeks, except for g_sword2. (Of course, this doesn't necessarily make the code any prettier, but we can work on that later.) svn-id: r11309
2003-11-11Moved low-level keyboard and mouse handling to a new Input class, andTorbjörn Andersson
renamed the Display class Graphics for no better reason than me liking the phrase "sound and graphics" better than "sound and display". svn-id: r11258
2003-11-10The script engine frequently needs to pass pointers to various structuresTorbjörn Andersson
etc. to the different opcodes. Until now it has done so by casting the pointer to an int32 (opcode parameters are represented as arrays of int32) and then the opcode function casts it back to whatever pointer it needs. At least in C there is no guarantee that a pointer can be represented as an integer type (though apparently C99 may define such a type), so this has struck me as unsafe ever since I first noticed it. However, since all such pointers appear to point to the memory block owned by the memory manager, we can easily convert them to integers by treating them as offsets into the memory block. So that's what I have done. I hope I caught all the occurences in the opcode functions, or we're going to have some pretty interesting regressions on our hands... svn-id: r11241
2003-11-08Removed some now redundant header files.Torbjörn Andersson
svn-id: r11209
2003-11-08Moved more stuff into classes, changed some static allocation to dynamic,Torbjörn Andersson
and removed some of the references to global variables. At this point I believe everything in the main game engine has been moved into classes - not necessarily the correct ones, but still... However, there is some stuff in the driver directory that need to be taken care of as well. svn-id: r11207