aboutsummaryrefslogtreecommitdiff
path: root/sword2/resman.cpp
AgeCommit message (Collapse)Author
2006-02-11Moved engines to the new engines/ directoryMax Horn
svn-id: r20582
2006-02-09Fix $Header$ and some minor file header inconsistencies.Torbjörn Andersson
svn-id: r20444
2006-01-18Update copyright noticeEugene Sandulenko
svn-id: r20088
2006-01-01Some cleanup/paranoia fixes to the previous missing voices/music fix. TreatTorbjörn Andersson
files marked as being on both CDs (I haven't seen any such file -- ever), treat it as if it's on the hard disk. Also, the "cd" field of the ResourceFile struct now holds 0, 1 or 2, not the bit flags from the data file. (This last change is not in the 0.8 branch.) svn-id: r19884
2006-01-01Hopefully fixed the missing speech bug reported on the forum, once and forTorbjörn Andersson
all. svn-id: r19879
2005-12-30Slightly more verbose debugging messages. Still trying to track down weirdTorbjörn Andersson
bug report from the forum. svn-id: r19865
2005-12-21Added debugging messages to track which CD (1 or 2) the game thinks it'sTorbjörn Andersson
supposed to be reading data from. Maybe this will help track down the mysterious missing speech problem reported on the forum. svn-id: r19823
2005-12-11Fix warningMax Horn
svn-id: r19776
2005-12-11Fixed Valgrind memory leak warnings, either by freeing memory on exit orTorbjörn Andersson
(in one case) by not allocating file handles dynamically. While this isn't really necessary at the moment, it makes it easier to find the real memory leaks, if there are any. svn-id: r19775
2005-10-29Applied my own patch #1341495, in an attempt to fix alignment issuesTorbjörn Andersson
reported by Crilith. To elaborate a bit, the engine no longer accesses resource data through packed structs. Instead it uses memory streams and the READ/WRITE functions. If data is mainly read, not written, I have replaced the old struct with a new one with a read() function to read the whole thing from memory into the struct's variables, and a write() function to dump the struct's variables to memory. In fact, most of these write() functions remain unused. If data is both read and written, I have replaced the struct with a class with individual get/set functions to replace the old variables. This manipulates memory directly. Since I'm fairly sure that these structs are frequently stored as local variables for a script, all script variables (both local and global) are stored as little-endian and accessed through the READ/WRITE functions, rather than being treated as arrays of 32-bit integers. On a positive note, the functions for doing endian conversion of resources and save games have been removed, and some general cleanups have been made to assist in the rewrite. Initial reports indicate that this patch indeed fixes alignment issues, and that I have not - surprisingly - broken the game on big-endian platforms. At least not in any immediately obvious way. And there's still plenty of time to fix regressions before 0.9.0, too. svn-id: r19366
2005-10-18Update FSF address. Eek. Actually that took place on May 1, 2005Eugene Sandulenko
svn-id: r19142
2005-10-17Fixed end credits crash. (See bug #1327650). Actually, there were severalTorbjörn Andersson
more or less serious bugs here: * The fnResetGlobals() function returned IR_CONT. Since it potentially kills its own script resource, this can lead to illegal read accesses. Not it returns IR_STOP instead. This was probably a bug in the original interpreter as well, but it handled memory allocation quite differently so it was probably never an issue. * Since fnResetGlobals() forcibly closes resources, I've changed the closeResource() function to silently ignore requests to close resources where the data pointer is NULL. While it could signify an error, it isn't necessarily so. * Don't force the screen to fade up after the credits -- let the script do it instead. This prevents it from fading up the wrong image. svn-id: r19127
2005-07-30Remove trailing whitespaces.Eugene Sandulenko
svn-id: r18604
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