Commit Graph

73 Commits

Author SHA1 Message Date
Torbjörn Andersson
5553ef53f1 Moved conversation stuff from Logic to Mouse.
svn-id: r17787
2005-04-24 12:13:03 +00:00
Torbjörn Andersson
140a1d7c46 Initialization fix.
svn-id: r17535
2005-04-11 06:25:05 +00:00
Torbjörn Andersson
342334f235 Removed unnecessary includes.
svn-id: r17477
2005-04-09 13:08:00 +00:00
Torbjörn Andersson
58dc309969 And, finally, the change I meant to before I got side-tracked: Use
ScummVM's "Rect" data type in the mouse list. The benefit of this is that
we can then use the contains() function in checkMouseList(), which makes
the code a bit less eye-watering.

svn-id: r16961
2005-02-28 14:03:53 +00:00
Torbjörn Andersson
bed897719c Index the "mouse list" from 0 instead of 1. I have no idea why it wasn't
this way to begin with.

svn-id: r16959
2005-02-28 13:28:02 +00:00
Torbjörn Andersson
8edce85e04 Some cleanup and renaming. (It was confusing to see "load" sometimes and
"restore" other times.) The save/restore dialog now has two separate
classes, though they both inherit from the old combined class of course.

svn-id: r16848
2005-02-21 08:16: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
Torbjörn Andersson
5178822833 Updated copyright year.
svn-id: r16397
2005-01-01 15:10:22 +00:00
Torbjörn Andersson
0cfd573951 Cleanup
svn-id: r15810
2004-11-14 15:00:01 +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
9742985e50 Fixed typo.
svn-id: r13830
2004-05-10 07:10:28 +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
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
8675bcfc6c Fixed a crash regression in setLuggage() that was caused by a change I
didn't make. :-)

(That is, I made the change and then thought better of it, but I forgot to
change one line back to its original form.)

svn-id: r13608
2004-04-23 11:43:20 +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
9b9ebb3a91 Make sure looping music is restarted after loading a savegame, regardless
of how the savegame is loaded. (ScummVM adds two alternative methods: the
-x command-line parameter, and the restart/restore dialog at the beginning
of the game, which is only shown when there are savegames available.)

svn-id: r13386
2004-03-27 12:07:07 +00:00
Torbjörn Andersson
4c3a68027f Use the same syntax for accessing script variables as BS1 does, i.e. now
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-17 09:03:15 +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
06caf87bdc Removed redundant comment.
svn-id: r12282
2004-01-09 15:58:21 +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
eb5c4a1449 Made sure the screen is really cleared when drawing a dialog window, plus
some other cleanups. (This was a regression caused by the less stupid
screen updates implemented recently.)

svn-id: r12180
2004-01-06 13:33:28 +00:00
Torbjörn Andersson
5607f41e2d Some cleanup and Valgrind warning fixes.
svn-id: r12141
2004-01-04 15:05:54 +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
a2221c88e9 Sprite surfaces (as opposed to standard sprites) are always display
aligned, never flipped and never RLE16-compressed. Simplified the code
accordingly. (Displaying the restore dialog when specifying an unused save
slot from the command-line works again now.)

Plus some minor cleanups.

svn-id: r11550
2003-12-10 08:01:58 +00:00
Torbjörn Andersson
67c75a35c6 Clarified comment about the elevator script bug and added a workaround for
the dreaded Pyramid Bug.

svn-id: r11427
2003-11-29 17:05:30 +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
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
beed02807f cleanup
svn-id: r11266
2003-11-12 08:21:18 +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
Torbjörn Andersson
3d012651fd The script engine frequently needs to pass pointers to various structures
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-10 07:52:15 +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
ba098a3a5b Create g_logic dynamically. More moving of stuff into classes.
svn-id: r11129
2003-11-04 18:02:49 +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
Torbjörn Andersson
7ec257ae3f Even more stuff moving into Sword2Engine. I'm tempted to make a new class
for the mouse stuff, but I need to think about that a bit more. I have a
feeling the code could be cleaned up a bit anyway...

svn-id: r11060
2003-11-02 18:50:09 +00:00
Torbjörn Andersson
2adc147600 Moved some more "homeless" functions into Sword2Engine. (Don't worry -- I
promise I will get rid of g_sword2 later.)

svn-id: r11057
2003-11-02 17:17:10 +00:00
Torbjörn Andersson
db9b8070f6 More moving of stuff into classes. I had to make a few changes/cleanups to
events.cpp, so there could be regressions.

svn-id: r11053
2003-11-02 15:58:45 +00:00
Torbjörn Andersson
0435658b96 Create the gui object dynamically
svn-id: r11026
2003-11-01 17:08:23 +00:00
Torbjörn Andersson
94edf540ef More moving of stuff into classes
svn-id: r11025
2003-11-01 16:55:20 +00:00
Max Horn
2fef2dcb84 bs2 -> sword2
svn-id: r10997
2003-10-28 19:51:30 +00:00
Torbjörn Andersson
7c4cc25cec Enable the debug console. Actually, what I've done is to adapt the debug
console from the SCUMM engine. I decided that would be easier than to clean
up the original console code.

Unfortunately there's a bunch of code that I just copied - a pretty lousy
form of code-reusal. It'd be nice if the console could be made part of the
Engine class, or something like that.

Most of the debug commands seem to be working. Some aren't relevant for
ScummVM, and some are a bit obscure so I'm not quite sure what they're
supposed to be doing.

svn-id: r10978
2003-10-26 15:42:49 +00:00
Torbjörn Andersson
3a43829b88 Moved the opcode functions into the Logic class.
svn-id: r10885
2003-10-18 08:11:50 +00:00
Torbjörn Andersson
8b42d65a7e Dumped most of the remaining "driver" code into a new "Display" class. This
touches a lot of the code, of course, and adds yet another global variable
(temporarily, I hope), but everything still seems to work.

Knock on wood.

svn-id: r10806
2003-10-15 06:40:31 +00:00
Torbjörn Andersson
02a157e745 Moved the text drawing stuff into a class of its own. (Adding another
global variable which will hopefully be dealt with later.)

svn-id: r10734
2003-10-11 12:26:53 +00:00
Torbjörn Andersson
d5bd6812ee Some cleanups and clarifications. Mainly, we no longer refer to the
inventory/conversation menu (which is drawn at the bottom of the screen) as
the "top menu".

svn-id: r10693
2003-10-09 06:57:35 +00:00
Torbjörn Andersson
7adf0ff1fc Some more cosmetic changes while I'm considering the next move. (Or maybe
I'm just hoping that if I stall long enough, someone else will make the
move for me. :-)

svn-id: r10676
2003-10-08 06:58:34 +00:00