Commit Graph

82 Commits

Author SHA1 Message Date
Torbjörn Andersson
f7a6729a01 This should really be two or three different commits, but I'm too lazy for
that:

* Re-worked the elevator script bug workaround so that it's more consistent
  with the other two script bug workarounds.

* Some renamings to make it more clear that game events and input events
  are two completely different things.

* Added function for clearing pending input events, and used that to fix an
  annoying keyboard repeat bug when closing the debug console. (The console
  would keep re-opening because the key press to open it kept repeating
  even though the key had been released.)

svn-id: r18522
2005-07-09 13:21:21 +00:00
Torbjörn Andersson
55f98f9b04 Added keyboard auto-repeat. (I've been meaning to do that for a long time.)
svn-id: r18302
2005-05-31 12:53:55 +00:00
Torbjörn Andersson
e70c98fa22 Oops. This should have been removed long ago.
svn-id: r17768
2005-04-23 12:55:54 +00:00
Torbjörn Andersson
a5356edb36 Got rid of all the .h files but one in the 'driver' directory. They were
either very small or, in the case of driver96.h, a disorganized jumbles.

svn-id: r16952
2005-02-27 16:11:19 +00:00
Torbjörn Andersson
9bb1414818 Moved some debugging stuff into the debugger class.
svn-id: r16859
2005-02-22 07:37:50 +00:00
Torbjörn Andersson
807b33ec29 More BS2 restructuring.
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-20 15:38:48 +00:00
Torbjörn Andersson
43cfe01f3d This is the second part of the BS2 restructuring. There are two new
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-19 14:02:16 +00:00
Torbjörn Andersson
c0a3816e17 Began what I hope is the final major restructuring of the BS2 engine.
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-28 16:33:14 +00:00
Torbjörn Andersson
0b461c8506 Updated copyright header, as discussed on the mailing list.
svn-id: r16580
2005-01-17 10:57:15 +00:00
Max Horn
cffd917165 system.h was being included in tons of places, without any good reason; reduced this (total dependencies on system.h went down from 193 to 85 files)
svn-id: r16527
2005-01-10 22:06:49 +00:00
Torbjörn Andersson
5178822833 Updated copyright year.
svn-id: r16397
2005-01-01 15:10:22 +00:00
Max Horn
d299f0601b Reducing header dependencies a bit
svn-id: r16347
2004-12-27 22:08:20 +00:00
Eugene Sandulenko
31e434dcf1 Fix a`ll engines. They work, though current fix is just temporary.
There are plans to add some brains to GameDetector class, which will let us
avoid passing detector to init() method.

svn-id: r15873
2004-11-24 00:14:21 +00:00
Max Horn
aad9f122c0 Added Engine::init() method; added return value to Engine::go()
svn-id: r15865
2004-11-23 00:03:25 +00:00
Torbjörn Andersson
7adc1f419f Cleanup
svn-id: r15826
2004-11-16 09:15:25 +00:00
Torbjörn Andersson
38baf0a0d3 I think this is the kind of constructor/go changes _sev was talking about
in his mail to scummvm-devel. (Though "a discussed a while ago change"
sounds like sort of thing Robert Jordan writes whenever there is danger of
anything actually happening in any of his more recent books. Tantalizing,
yet non-informative. ;-)

It's still rather messy. I'll look into cleaning it up later.

svn-id: r15818
2004-11-15 08:22:16 +00:00
Torbjörn Andersson
0cfd573951 Cleanup
svn-id: r15810
2004-11-14 15:00:01 +00:00
Torbjörn Andersson
412f7105f0 Fixed evil regression #2. Restarting the game, or using the "start" debug
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-09-08 07:10:54 +00:00
Torbjörn Andersson
3c70f5a85c If the 'time' parameter to displayMsg() is 0, wait until the user clicks
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-10 06:48:50 +00:00
Torbjörn Andersson
dabb32ce1a Some more work on the - still disabled - "right click to clear luggage"
code I added some time ago.

svn-id: r13952
2004-06-10 06:41:08 +00:00
Torbjörn Andersson
fc970b3c75 Removed the buffering of mouse and keyboard events. I don't think any of
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-09 13:32:04 +00:00
Torbjörn Andersson
bc77ba431a Simplified the handling of sound effects. It's not necessary for the driver
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-05-01 10:42:23 +00:00
Torbjörn Andersson
6a432d10b5 Cleanup. I plan to take a closer look at the sound effects handling later.
svn-id: r13661
2004-04-28 11:47:19 +00:00
Torbjörn Andersson
0fcd887dcd Cleanup. Mostly removal of redundant comments.
I've also made the SaveGameHeader struct packed, which may break savegame
compatibility on some architectures (though not on the Linux and Windows
boxes I've tried it on). But I'm hoping it will guarantee, or at least make
it more likely, that savegames will be portable across architectures.

svn-id: r13634
2004-04-26 07:37:25 +00:00
Torbjörn Andersson
a575576890 fetchObjectName() no longer assumes that the resource will still be in the
cache after it's been closed. (Currently it always is, but ideally I'd like
for BS to work even if resource caching is disabled.)

svn-id: r13610
2004-04-24 12:29:35 +00:00
Torbjörn Andersson
8f8185f035 Major revamping of the BS2 memory manager and, some small changes to the
resource manager. All new code! All new bugs!

svn-id: r13603
2004-04-23 07:02:11 +00:00
Torbjörn Andersson
0d2d884bb7 Cleanup
svn-id: r13582
2004-04-16 06:46:03 +00:00
Torbjörn Andersson
489e473fca Cleanup.
svn-id: r13494
2004-04-07 12:31:32 +00:00
Torbjörn Andersson
6d460d2e10 Cleanup.
svn-id: r13457
2004-04-04 15:16:05 +00:00
Torbjörn Andersson
bf10f5a616 Cleanup.
This removes a bunch of debugging code/commands that either didn't do
anything useful under ScummVM (e.g. "soft" and "hard"), or which did things
that was already easily avaiable elsewhere (e.g. "save" and "restore").

I didn't have the heart to remove the "tony" command, though. :-)

svn-id: r13422
2004-03-29 06:37:46 +00:00
Torbjörn Andersson
41ef5a97ea Cleanup.
One of the changes, I'm not quite sure about: buildDisplay() used to open
and close the _thisScreen.background_layer_id resource for each layer it
processed. In particular, it used to "release the screen resource before
cacheing the sprites".

I have no idea why, because I can't see any trace of a sprite cache, and I
can't think of any harm in keeping the resource open during the whole
render cycle. The resource is probably loaded into memory already anyway,
though its reference counter may be 0.

svn-id: r13401
2004-03-28 13:16:01 +00:00
Torbjörn Andersson
ece97788ac If the user has previous savegames, display a restart/restore dialog when
the game starts. (I know it could look prettier, but I don't have much to
work with here...)

svn-id: r13178
2004-03-04 08:03:32 +00:00
Torbjörn Andersson
802a301a16 Removed some of the #includes from sword2.h
svn-id: r12739
2004-02-05 14:19:07 +00:00
Torbjörn Andersson
12cd552cab Allow quitting during cutscenes and credits again. This is getting a bit
hackish...

svn-id: r12247
2004-01-08 13:03:50 +00:00
Torbjörn Andersson
065f2bb9eb It's a new year in BS2 land, too!
svn-id: r12181
2004-01-06 13:44:17 +00:00
Torbjörn Andersson
6ae8218d53 Hopefully the last big renaming. Now the datatypes have names like
"StandardHeader" instead of "_standardHeader".

svn-id: r11997
2003-12-28 15:08:12 +00:00
Torbjörn Andersson
9f465dab04 cleanup
svn-id: r11581
2003-12-11 13:08:36 +00:00
Torbjörn Andersson
5eb38cb380 cleanup
svn-id: r11364
2003-11-25 09:05:10 +00:00
Torbjörn Andersson
509235e176 Added experimental (i.e. not tested) resource dumping code.
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-23 13:40:24 +00:00
Torbjörn Andersson
50be85ac42 The readFile() function was only used once, for creating the debugger start
menu, and wasn't even necessary there so I've removed it. That means the
tony_gsdk.cpp file is no longer necessary. Sorry Tony, but at least you
still have your own debugger command! ;-)

svn-id: r11342
2003-11-18 08:17:36 +00:00
Torbjörn Andersson
fa2b8ba8de More cleanup. I've eliminated all the temporary global variables I've added
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-16 14:18:29 +00:00
Torbjörn Andersson
aaa5631a99 Mostly cleanup. Also prevented what would probably have been an infinite
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-15 09:38:00 +00:00
Torbjörn Andersson
30670deb2c cleanup
svn-id: r11290
2003-11-14 07:41:22 +00:00
Torbjörn Andersson
beed02807f cleanup
svn-id: r11266
2003-11-12 08:21:18 +00:00
Torbjörn Andersson
1f53624d88 Removed SVM_timeGetTime(). We may as well call get_msecs() directly.
svn-id: r11260
2003-11-11 10:30:25 +00:00
Torbjörn Andersson
446a01ba09 Moved low-level keyboard and mouse handling to a new Input class, and
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-11 07:43:02 +00:00
Max Horn
e34f2b8b33 cut down on unnecessary GameDetector references
svn-id: r11239
2003-11-10 01:04:12 +00:00
Torbjörn Andersson
9106229bef Removed some now redundant header files.
svn-id: r11209
2003-11-08 18:15:35 +00:00
Torbjörn Andersson
688c80b062 Moved more stuff into classes, changed some static allocation to dynamic,
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
2003-11-08 15:47:51 +00:00
Torbjörn Andersson
b3b0118292 The resource and memory managers are now created dynamically.
Renamed the resource manager's open/close methods openResource() and
closeResource() to avoid confusion. (It was I who originally shortened
their names to open() and close(), but I've changed my mind now.)

Moved more stuff into Sword2Engine.

svn-id: r11088
2003-11-03 07:47:42 +00:00