aboutsummaryrefslogtreecommitdiff
path: root/sword2/resman.cpp
AgeCommit message (Collapse)Author
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-10Moved class File and the MD5 stuff to namespace CommonMax Horn
svn-id: r18037
2005-05-08Made it possible to quit while the game is asking for a CD.Torbjörn Andersson
svn-id: r17963
2005-02-25Whitespace changes.Torbjörn Andersson
svn-id: r16913
2005-02-22Fix compilation on BE systemsMax Horn
svn-id: r16861
2005-02-22Moved some debugging stuff into the debugger class.Torbjörn Andersson
svn-id: r16859
2005-02-21removed lots of unnecessary seek()s and read()s by keeping the datafiles' ↵Robert Göffringmann
index tables in memory instead of accessing them over and over again, which caused major slowdowns with cd accesses. Also, the caching of datafiles depends on the memory usage now, not on the number of screens that the player entered in the meantime. The old behaviour made the engine run out of memory on the PS2. svn-id: r16843
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-17Updated copyright header, as discussed on the mailing list.Torbjörn Andersson
svn-id: r16580
2005-01-01Updated copyright year.Torbjörn Andersson
svn-id: r16397
2004-11-27Make use of our String class instead of juggling with char pointers; added ↵Max Horn
File::exists method svn-id: r15913
2004-11-14CleanupTorbjörn Andersson
svn-id: r15810
2004-09-19Removed obsolete comment.Torbjörn Andersson
svn-id: r15193
2004-09-12As an experiment, expire SCREEN_FILE resources faster than other resources.Torbjörn Andersson
They're generally the largest resources in the cache by far (though some ANIMATION_FILE resources are about as big). I still don't know how much benefit there is to resource caching, but some of it is definitely needed, or the game won't work properly. Oh well, as long as no one complains about the extra memory usage... svn-id: r15079
2004-09-08Fixed evil regression #2. Restarting the game, or using the "start" debugTorbjörn Andersson
command, would close the global script variables and player object resources, without reopening them again. This made them fair game for the resource expiration mechanism. The player object is probably referenced often enough to stay alive, but the variables died on me pretty quickly, causing ScummVM to crash. I've also added a "reslist" debug command to make this sort of things easier to spot. By default it only lists resources with refCount > 0. Use "reslist 0" to see all the cached resources as well. svn-id: r14958
2004-06-27Reversed param order of File::open() -- this allowed me to get rid of a few ↵Max Horn
more getGameDataPath() calls svn-id: r14090
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-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-05-09My recent sound changes broke "restart". This should un-break it again.Torbjörn Andersson
svn-id: r13810
2004-05-01Simplified the handling of sound effects. It's not necessary for the driverTorbjörn Andersson
to keep its own copy of the sound data. It could be even further simplified (I don't really see any reason for having two different sound queues), but I seem to have reached a point of stability here and I don't want to jinx it by making further changes yet. svn-id: r13705
2004-04-23I forgot to clear the reference counter when a resource is forcibly removedTorbjörn Andersson
and I may as well clear it when a resource is read from disk as well. svn-id: r13606
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-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-04If the user has previous savegames, display a restart/restore dialog whenTorbjörn Andersson
the game starts. (I know it could look prettier, but I don't have much to work with here...) svn-id: r13178
2004-02-05Removed some of the #includes from sword2.hTorbjörn Andersson
svn-id: r12739
2004-01-18fix warningsPaweł Kołodziejski
svn-id: r12504
2004-01-12fixed bug that was causing lots of havoc on BE machines. Thanks eriktorbjornOliver Kiehl
svn-id: r12348
2004-01-11cleanupTorbjörn Andersson
svn-id: r12322
2004-01-07Valgrind fixes. Mostly about memory not being freed when the engine isTorbjörn Andersson
deleted. svn-id: r12211
2004-01-06It's a new year in BS2 land, too!Torbjörn Andersson
svn-id: r12181
2004-01-03It was pointed out to me that we can't use the DEMO variable here, becauseTorbjörn Andersson
the missing file may be the one with the resource for the global variables. svn-id: r12112
2003-12-29The game sets its own DEMO variable, so we might as well check that one asTorbjörn Andersson
checking the GF_DEMO flag. (There's still one "unnecessary" reference to GF_DEMO in functions.cpp, but I plan on rewriting that function soon so I don't want to touch it right now.) svn-id: r12009
2003-12-28Hopefully the last big renaming. Now the datatypes have names likeTorbjörn Andersson
"StandardHeader" instead of "_standardHeader". svn-id: r11997
2003-12-17cleanupTorbjörn Andersson
svn-id: r11704
2003-12-08Shut up Valgrind warnings.Torbjörn Andersson
svn-id: r11528
2003-11-28Some formatting changes, and a few debug message corrections.Torbjörn Andersson
svn-id: r11384
2003-11-27Mostly whitespace changes, but also a few modifications to the stillTorbjörn Andersson
experimental resource dumping code. svn-id: r11382
2003-11-23Added experimental (i.e. not tested) resource dumping code.Torbjörn Andersson
Added tentative workaround for the bug (a script bug, I think) that causes the game to hang when examining the lift at the top of the pyramid. And, of course, some misc. cleanup. svn-id: r11359
2003-11-19Eliminated some more references to g_sword2. I think the only thing thatTorbjörn Andersson
still uses it are the engine's global variables which, on the other hand, are used *everywhere*. I'll have to think some more about those. I guess I should take a closer look at how the other engines handle them. (That goes for a lot of things by the way.) svn-id: r11349
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-15Mostly cleanup. Also prevented what would probably have been an infiniteTorbjörn Andersson
loop if ScummVM failed to find a file in the demo. (Now it should error out instead, which is marginally preferable.) svn-id: r11298
2003-11-14cleanupTorbjörn Andersson
svn-id: r11290
2003-11-13Re-enabled the CD swapping code, after rewriting it a bit.Torbjörn Andersson
If a cluster file isn't found the resource manager will first check if it's one of the files that it expects to find on the hard disk. If so, it's considered a fatal error. Otherwise it will present the user with an "Insert CD1" or "Insert CD2" message, just like the original did. Unlike the original, the user will have to press a button or click the mouse to indicate when he's done. I don't know if we even can detect the CD automatically in any portable way. As far as I can see, we'll need at least two separate path settings for this to actually work: one for the HD install directory, and one or two for the CDs. The file that are supposed to be found on the HD are only on one of the CDs, so the amount of CD swapping would probably be unbearable otherwise. As a consequence, I haven't actually tried running the game from CD yet. By the way, the old caching code has been removed completely now. All it did was to copy the cluster file to HD for faster access. ScummVM never did that, but so far no one has complained. svn-id: r11273
2003-11-11Slight refinement to the last patch. There are four different possibilitiesTorbjörn Andersson
for which CD to look for: 0 (both CDs - not used?), 1, 2 and 3 (not used?) svn-id: r11263
2003-11-11Extended the "res" debugger command to print information about where theTorbjörn Andersson
game expects to find the various cluster files. I plan to look into making the game playable from CD, and this should help during the testing. svn-id: r11262
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-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